user_level.php 2.4 KB

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