action_log.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <?php
  2. $action = function()
  3. {
  4. $array = array();
  5. $info = Dever::db('score/action')->state();
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $score_type = array
  13. (
  14. 1 => '未加积分',
  15. 2 => '已加积分',
  16. 3 => '达到积分上限',
  17. );
  18. $cron_type = array
  19. (
  20. 1 => '未开始',
  21. 2 => '进行中',
  22. 3 => '已完成',
  23. );
  24. return array
  25. (
  26. # 表名
  27. 'name' => 'action_log',
  28. # 显示给用户看的名称
  29. 'lang' => '积分行为日志',
  30. 'order' => 10,
  31. 'menu' => false,
  32. # 数据结构
  33. 'struct' => array
  34. (
  35. 'id' => array
  36. (
  37. 'type' => 'int-11',
  38. 'name' => 'ID',
  39. 'default' => '',
  40. 'desc' => '',
  41. 'match' => 'is_numeric',
  42. 'list' => true,
  43. ),
  44. 'uid' => array
  45. (
  46. 'type' => 'int-11',
  47. 'name' => '用户名',
  48. 'default' => '0',
  49. 'desc' => '请选择用户',
  50. 'match' => 'is_numeric',
  51. //'update' => 'select',
  52. //'search' => 'select',
  53. 'search' => array
  54. (
  55. 'api' => 'passport/user-all',
  56. 'col' => 'username',
  57. 'result' => 'id',
  58. ),
  59. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  60. ),
  61. 'parent_uid' => array
  62. (
  63. 'type' => 'int-11',
  64. 'name' => '上级用户',
  65. 'default' => '0',
  66. 'desc' => '请选择上级用户',
  67. 'match' => 'is_numeric',
  68. 'list' => true,
  69. ),
  70. 'action_id' => array
  71. (
  72. 'type' => 'int-11',
  73. 'name' => '所属行为',
  74. 'default' => '1',
  75. 'desc' => '所属行为',
  76. 'match' => 'is_numeric',
  77. 'update' => 'select',
  78. 'option' => $action,
  79. 'search' => 'select',
  80. 'list' => true,
  81. ),
  82. 'type' => array
  83. (
  84. 'type' => 'varchar-32',
  85. 'name' => '所属数据源',
  86. 'default' => '',
  87. 'desc' => '所属数据源',
  88. 'match' => 'is_string',
  89. 'list' => true,
  90. ),
  91. 'type_id' => array
  92. (
  93. 'type' => 'int-11',
  94. 'name' => '数据源id',
  95. 'default' => '',
  96. 'desc' => '数据源id',
  97. 'match' => 'is_numeric',
  98. 'list' => true,
  99. ),
  100. 'score_type' => array
  101. (
  102. 'type' => 'int-11',
  103. 'name' => '是否增加积分',
  104. 'default' => '1',
  105. 'desc' => '是否增加积分',
  106. 'match' => 'is_numeric',
  107. 'update' => 'select',
  108. 'option' => $score_type,
  109. //'search' => 'select',
  110. //'list' => true,
  111. ),
  112. 'cron_type' => array
  113. (
  114. 'type' => 'int-11',
  115. 'name' => '状态',
  116. 'default' => '3',
  117. 'desc' => '状态',
  118. 'match' => 'is_numeric',
  119. 'update' => 'select',
  120. 'option' => $cron_type,
  121. //'search' => 'select',
  122. //'list' => true,
  123. ),
  124. 'score' => array
  125. (
  126. 'type' => 'varchar-30',
  127. 'name' => '增加积分数',
  128. 'default' => '0',
  129. 'desc' => '积分数',
  130. 'match' => 'is_string',
  131. //'list' => true,
  132. ),
  133. 'num' => array
  134. (
  135. 'type' => 'varchar-30',
  136. 'name' => '增加的积分将乘以该数量',
  137. 'default' => '0',
  138. 'desc' => '积分数',
  139. 'match' => 'is_string',
  140. ),
  141. 'mscore' => array
  142. (
  143. 'type' => 'varchar-30',
  144. 'name' => '手动增加积分数',
  145. 'default' => '0',
  146. 'desc' => '积分数',
  147. 'match' => 'is_string',
  148. ),
  149. 'callback' => array
  150. (
  151. 'type' => 'varchar-800',
  152. 'name' => '行为回调方法',
  153. 'default' => '',
  154. 'desc' => '行为回调方法',
  155. 'match' => 'option',
  156. 'update' => 'textarea',
  157. //'list' => true,
  158. ),
  159. 'cdate' => array
  160. (
  161. 'type' => 'int-11',
  162. 'name' => '录入时间',
  163. 'match' => array('is_numeric', time()),
  164. 'desc' => '',
  165. # 只有insert时才生效
  166. 'insert' => true,
  167. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  168. ),
  169. ),
  170. # 索引
  171. 'index' => array
  172. (
  173. 1 => array
  174. (
  175. 'search' => 'uid,action_id,cron_type',
  176. ),
  177. # 版本号 更改版本号会更新当前表的索引
  178. 'version' => 1,
  179. ),
  180. 'manage' => array
  181. (
  182. 'delete' => false,
  183. 'edit' => false,
  184. 'insert' => false,
  185. ),
  186. # request 请求接口定义
  187. 'request' => array
  188. (
  189. 'getDataByDate' => array
  190. (
  191. # 匹配的正则或函数 选填项
  192. 'option' => array
  193. (
  194. 'start' => array('yes-cdate', '>='),
  195. 'end' => array('yes-cdate', '<='),
  196. 'score_type' => 'yes',
  197. 'action_id' => 'yes',
  198. ),
  199. 'type' => 'all',
  200. 'order' => array('id' => 'desc'),
  201. 'col' => 'id',
  202. ),
  203. )
  204. );