user_level.php 3.0 KB

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