user_level.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. $level = function()
  3. {
  4. $array = array();
  5. $info = Dever::db('score/level')->state();
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $type_id = function()
  13. {
  14. $array = array();
  15. $info = Dever::db('score/level_type')->state();
  16. if($info)
  17. {
  18. $array += $info;
  19. }
  20. return $array;
  21. };
  22. return array
  23. (
  24. # 表名
  25. 'name' => 'user_level',
  26. # 显示给用户看的名称
  27. 'lang' => '用户积分等级',
  28. 'order' => 99,
  29. 'menu' => 'passport',
  30. 'menu' => false,
  31. # 数据结构
  32. 'struct' => array
  33. (
  34. 'id' => array
  35. (
  36. 'type' => 'int-11',
  37. 'name' => 'ID',
  38. 'default' => '',
  39. 'desc' => '',
  40. 'match' => 'is_numeric',
  41. ),
  42. 'uid' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '用户名',
  46. 'default' => '0',
  47. 'desc' => '请选择用户',
  48. 'match' => 'is_numeric',
  49. //'update' => 'select',
  50. //'search' => 'select',
  51. 'search' => array
  52. (
  53. 'api' => 'passport/user-all',
  54. 'col' => 'username',
  55. 'result' => 'id',
  56. ),
  57. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  58. ),
  59. 'level_type_id' => array
  60. (
  61. 'type' => 'int-11',
  62. 'name' => '等级类别',
  63. 'default' => '1',
  64. 'desc' => '等级类别',
  65. 'match' => 'is_numeric',
  66. 'update' => 'select',
  67. 'option' => $type_id,
  68. 'search' => 'select',
  69. 'list' => true,
  70. ),
  71. 'level_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '等级名称',
  75. 'default' => '1',
  76. 'desc' => '等级名称',
  77. 'match' => 'is_numeric',
  78. 'update' => 'select',
  79. 'option' => $level,
  80. 'search' => 'select',
  81. 'list' => true,
  82. 'edit' => true,
  83. ),
  84. 'type' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '升级方式',
  88. 'default' => '1',
  89. 'desc' => '升级方式',
  90. 'match' => 'is_numeric',
  91. //'update' => 'select',
  92. //'option' => $type,
  93. //'search' => 'select',
  94. //'list' => true,
  95. //'edit' => true,
  96. ),
  97. 'info' => array
  98. (
  99. 'type' => 'varchar-300',
  100. 'name' => '备注',
  101. 'default' => '',
  102. 'desc' => '备注',
  103. 'match' => 'option',
  104. 'update' => 'textarea',
  105. //'show' => 'status=5'
  106. 'list' => '"{info}" ? "{info}" : "双击添加备注"',
  107. 'edit' => true,
  108. ),
  109. 'cdate' => array
  110. (
  111. 'type' => 'int-11',
  112. 'name' => '录入时间',
  113. 'match' => array('is_numeric', time()),
  114. 'desc' => '',
  115. # 只有insert时才生效
  116. 'insert' => true,
  117. ),
  118. ),
  119. 'manage' => array
  120. (
  121. 'delete' => false,
  122. 'edit' => false,
  123. 'insert' => false,
  124. ),
  125. );