user_score.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. return array
  3. (
  4. # 表名
  5. 'name' => 'user_score',
  6. # 显示给用户看的名称
  7. 'lang' => '用户积分',
  8. 'menu' => 'passport',
  9. 'order' => 19,
  10. # 数据结构
  11. 'struct' => array
  12. (
  13. 'id' => array
  14. (
  15. 'type' => 'int-11',
  16. 'name' => 'ID',
  17. 'default' => '',
  18. 'desc' => '',
  19. 'match' => 'is_numeric',
  20. //'search' => 'order',
  21. 'order' => 'desc',
  22. 'list' => true,
  23. ),
  24. 'uid' => array
  25. (
  26. 'type' => 'int-11',
  27. 'name' => '用户名',
  28. 'default' => '',
  29. 'desc' => '用户名',
  30. 'match' => 'is_numeric',
  31. //'update' => 'text',
  32. 'search' => array
  33. (
  34. 'api' => 'passport/user-all',
  35. 'col' => 'username',
  36. 'result' => 'id',
  37. ),
  38. 'list' => 'Dever::load("passport/user-one#username", {uid})',
  39. ),
  40. 'score' => array
  41. (
  42. 'type' => 'varchar-11',
  43. 'name' => '可用积分',
  44. 'default' => '0',
  45. 'desc' => '可用积分',
  46. 'match' => 'is_numeric',
  47. 'update' => 'text',
  48. 'list' => true,
  49. ),
  50. 'code' => array
  51. (
  52. 'type' => 'varchar-50',
  53. 'name' => '邀请码',
  54. 'default' => '0',
  55. 'desc' => '邀请码',
  56. 'match' => 'is_string',
  57. 'update' => 'text',
  58. //'list' => true,
  59. ),
  60. 'state' => array
  61. (
  62. 'type' => 'tinyint-1',
  63. 'name' => '状态',
  64. 'default' => '1',
  65. 'desc' => '请选择状态',
  66. 'match' => 'is_numeric',
  67. ),
  68. 'cdate' => array
  69. (
  70. 'type' => 'int-11',
  71. 'name' => '入库时间',
  72. 'match' => array('is_numeric', time()),
  73. 'desc' => '',
  74. # 只有insert时才生效
  75. 'insert' => true,
  76. 'search' => 'date',
  77. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  78. ),
  79. ),
  80. # 更新表结构
  81. 'alter' => array
  82. (
  83. 1 => array
  84. (
  85. array('update', 'score', 'score', 'varchar-11 0 积分'),
  86. ),
  87. 'version' => 1,
  88. ),
  89. 'manage' => array
  90. (
  91. 'insert' => false,
  92. 'edit' => false,
  93. 'delete' => false,
  94. # 列表
  95. 'list_button' => array
  96. (
  97. 'list' => array('积分日志', '"user_score_log&project=task&search_option_uid={uid}&search_option_status=2&oper_parent=user_score&oper_project=task"'),
  98. ),
  99. ),
  100. 'request' => array
  101. (
  102. 'updateScore' => array
  103. (
  104. # 匹配的正则或函数 选填项
  105. 'where' => array
  106. (
  107. 'uid' => 'yes',
  108. ),
  109. 'set' => array
  110. (
  111. 'score' => array('yes', '+='),
  112. ),
  113. 'type' => 'update',
  114. ),
  115. )
  116. );