user_child_log.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <?php
  2. $config = function()
  3. {
  4. $array = array();
  5. $info = Dever::db('score/config')->state();
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $action = function()
  13. {
  14. $array = array();
  15. $info = Dever::db('score/action')->state();
  16. if($info)
  17. {
  18. $array += $info;
  19. }
  20. return $array;
  21. };
  22. $status = array
  23. (
  24. 1 => '收入',
  25. 2 => '支出',
  26. );
  27. return array
  28. (
  29. # 表名
  30. 'name' => 'user_child_log',
  31. # 显示给用户看的名称
  32. 'lang' => '用户积分日志',
  33. 'order' => 10,
  34. 'menu' => false,
  35. # 数据结构
  36. 'struct' => array
  37. (
  38. 'id' => array
  39. (
  40. 'type' => 'int-11',
  41. 'name' => 'ID',
  42. 'default' => '',
  43. 'desc' => '',
  44. 'match' => 'is_numeric',
  45. ),
  46. 'uid' => array
  47. (
  48. 'type' => 'int-11',
  49. 'name' => '用户名',
  50. 'default' => '0',
  51. 'desc' => '请选择用户',
  52. 'match' => 'is_numeric',
  53. //'update' => 'select',
  54. //'search' => 'select',
  55. 'search' => array
  56. (
  57. 'api' => 'passport/user-all',
  58. 'col' => 'username',
  59. 'result' => 'id',
  60. ),
  61. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  62. ),
  63. 'rebate_uid' => array
  64. (
  65. 'type' => 'int-11',
  66. 'name' => '下级用户',
  67. 'default' => '0',
  68. 'desc' => '下级用户',
  69. 'match' => 'is_numeric',
  70. 'list' => '{rebate_uid} > 0 ? Dever::load("passport/user-one#username", {rebate_uid}) : "无"',
  71. ),
  72. 'config_id' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '积分名称',
  76. 'default' => '1',
  77. 'desc' => '积分名称',
  78. 'match' => 'is_numeric',
  79. 'update' => 'select',
  80. 'option' => $config,
  81. 'search' => 'select',
  82. 'list' => true,
  83. ),
  84. 'config_child_id' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '子积分名称',
  88. 'default' => '',
  89. 'desc' => '子积分名称',
  90. 'match' => 'is_numeric',
  91. 'list' => 'Dever::load("score/config_child#name", {config_child_id})',
  92. ),
  93. 'action_id' => array
  94. (
  95. 'type' => 'int-11',
  96. 'name' => '所属行为',
  97. 'default' => '1',
  98. 'desc' => '所属行为',
  99. 'match' => 'is_numeric',
  100. 'update' => 'select',
  101. 'option' => $action,
  102. 'search' => 'select',
  103. 'list' => true,
  104. ),
  105. 'action_log_id' => array
  106. (
  107. 'type' => 'int-11',
  108. 'name' => '所属行为日志',
  109. 'default' => '1',
  110. 'desc' => '所属行为日志',
  111. 'match' => 'is_numeric',
  112. 'update' => 'text',
  113. 'list' => true,
  114. ),
  115. 'status' => array
  116. (
  117. 'type' => 'tinyint-1',
  118. 'name' => '收入支出状态',
  119. 'default' => '1',
  120. 'desc' => '收入支出状态',
  121. 'match' => 'is_numeric',
  122. 'update' => 'select',
  123. 'option' => $status,
  124. //'search' => 'select',
  125. 'list' => true,
  126. //'edit' => true,
  127. ),
  128. 'num' => array
  129. (
  130. 'type' => 'varchar-80',
  131. 'name' => '增加积分数-如果为负数,则是减少积分',
  132. 'default' => '',
  133. 'desc' => '增加积分数',
  134. 'match' => 'option',
  135. 'update' => 'textarea',
  136. 'list' => true,
  137. ),
  138. 'total' => array
  139. (
  140. 'type' => 'varchar-80',
  141. 'name' => '总积分数',
  142. 'default' => '',
  143. 'desc' => '总积分数',
  144. 'match' => 'option',
  145. 'update' => 'textarea',
  146. 'list' => true,
  147. ),
  148. 'desc' => array
  149. (
  150. 'type' => 'varchar-300',
  151. 'name' => '描述',
  152. 'default' => '',
  153. 'desc' => '描述',
  154. 'match' => 'option',
  155. 'update' => 'textarea',
  156. ),
  157. 'state' => array
  158. (
  159. 'type' => 'tinyint-1',
  160. 'name' => '状态',
  161. 'default' => '1',
  162. 'desc' => '请选择状态',
  163. 'match' => 'is_numeric',
  164. ),
  165. 'cdate' => array
  166. (
  167. 'type' => 'int-11',
  168. 'name' => '录入时间',
  169. 'match' => array('is_numeric', time()),
  170. 'desc' => '',
  171. # 只有insert时才生效
  172. 'insert' => true,
  173. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  174. ),
  175. ),
  176. # 索引
  177. 'index' => array
  178. (
  179. 1 => array
  180. (
  181. 'search' => 'uid,config_id,config_child_id,action_id,action_log_id',
  182. ),
  183. # 版本号 更改版本号会更新当前表的索引
  184. 'version' => 1,
  185. ),
  186. 'manage' => array
  187. (
  188. 'delete' => false,
  189. 'edit' => false,
  190. 'insert' => false,
  191. # 列表
  192. 'list_button' => array
  193. (
  194. //'list' => array('行为日志', '"action_log&search_option_action_id={action_id}&search_option_uid={uid}&oper_parent=user_log"'),
  195. ),
  196. ),
  197. # request 请求接口定义
  198. 'request' => array
  199. (
  200. 'getNew' => array
  201. (
  202. # 匹配的正则或函数 选填项
  203. 'option' => array
  204. (
  205. 'config_child_id' => 'yes',
  206. 'config_id' => 'yes',
  207. 'action_id' => 'yes',
  208. 'uid' => 'yes',
  209. 'status' => 'yes',
  210. 'state' => 1,
  211. ),
  212. 'type' => 'one',
  213. 'order' => array('cdate' => 'desc'),
  214. 'col' => '*',
  215. ),
  216. 'getList' => array
  217. (
  218. # 匹配的正则或函数 选填项
  219. 'option' => array
  220. (
  221. 'config_child_id' => 'yes',
  222. 'config_id' => 'yes',
  223. 'action_id' => 'yes',
  224. 'uid' => 'yes',
  225. 'status' => 'yes',
  226. 'state' => 1,
  227. ),
  228. 'type' => 'all',
  229. 'order' => array('cdate' => 'desc'),
  230. 'page' => array(5, 'list'),
  231. 'col' => '*',
  232. ),
  233. 'getNewTotal' => array
  234. (
  235. # 匹配的正则或函数 选填项
  236. 'option' => array
  237. (
  238. 'config_child_id' => 'yes',
  239. 'config_id' => 'yes',
  240. 'action_id' => 'yes',
  241. 'uid' => 'yes',
  242. 'status' => 'yes',
  243. 'state' => 1,
  244. 'start' => array('yes-cdate', '>='),
  245. 'end' => array('yes-cdate', '<='),
  246. ),
  247. 'type' => 'count',
  248. 'order' => array('cdate' => 'desc'),
  249. 'col' => 'count(1) as total',
  250. ),
  251. )
  252. );