action_log.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. 'score_type' => array
  83. (
  84. 'type' => 'int-11',
  85. 'name' => '是否增加积分',
  86. 'default' => '1',
  87. 'desc' => '是否增加积分',
  88. 'match' => 'is_numeric',
  89. 'update' => 'select',
  90. 'option' => $score_type,
  91. 'search' => 'select',
  92. 'list' => true,
  93. ),
  94. 'cron_type' => array
  95. (
  96. 'type' => 'int-11',
  97. 'name' => '是否增加积分',
  98. 'default' => '3',
  99. 'desc' => '是否增加积分',
  100. 'match' => 'is_numeric',
  101. 'update' => 'select',
  102. 'option' => $cron_type,
  103. 'search' => 'select',
  104. 'list' => true,
  105. ),
  106. 'score' => array
  107. (
  108. 'type' => 'varchar-30',
  109. 'name' => '增加积分数',
  110. 'default' => '0',
  111. 'desc' => '积分数',
  112. 'match' => 'is_string',
  113. 'list' => true,
  114. ),
  115. 'num' => array
  116. (
  117. 'type' => 'varchar-30',
  118. 'name' => '增加的积分将乘以该数量',
  119. 'default' => '0',
  120. 'desc' => '积分数',
  121. 'match' => 'is_string',
  122. ),
  123. 'mscore' => array
  124. (
  125. 'type' => 'varchar-30',
  126. 'name' => '手动增加积分数',
  127. 'default' => '0',
  128. 'desc' => '积分数',
  129. 'match' => 'is_string',
  130. ),
  131. 'callback' => array
  132. (
  133. 'type' => 'varchar-800',
  134. 'name' => '行为回调方法',
  135. 'default' => '',
  136. 'desc' => '行为回调方法',
  137. 'match' => 'option',
  138. 'update' => 'textarea',
  139. //'list' => true,
  140. ),
  141. 'cdate' => array
  142. (
  143. 'type' => 'int-11',
  144. 'name' => '录入时间',
  145. 'match' => array('is_numeric', time()),
  146. 'desc' => '',
  147. # 只有insert时才生效
  148. 'insert' => true,
  149. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  150. ),
  151. ),
  152. # 索引
  153. 'index' => array
  154. (
  155. 1 => array
  156. (
  157. 'search' => 'uid,action_id,cron_type',
  158. ),
  159. # 版本号 更改版本号会更新当前表的索引
  160. 'version' => 1,
  161. ),
  162. 'manage' => array
  163. (
  164. 'delete' => false,
  165. 'edit' => false,
  166. 'insert' => false,
  167. ),
  168. # request 请求接口定义
  169. 'request' => array
  170. (
  171. 'getDataByDate' => array
  172. (
  173. # 匹配的正则或函数 选填项
  174. 'option' => array
  175. (
  176. 'start' => array('yes-cdate', '>='),
  177. 'end' => array('yes-cdate', '<='),
  178. 'score_type' => 'yes',
  179. 'action_id' => 'yes',
  180. ),
  181. 'type' => 'all',
  182. 'order' => array('id' => 'desc'),
  183. 'col' => 'id',
  184. ),
  185. )
  186. );