user_log.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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_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. 'config_id' => array
  64. (
  65. 'type' => 'int-11',
  66. 'name' => '积分名称',
  67. 'default' => '1',
  68. 'desc' => '积分名称',
  69. 'match' => 'is_numeric',
  70. 'update' => 'select',
  71. 'option' => $config,
  72. 'search' => 'select',
  73. 'list' => true,
  74. ),
  75. 'action_id' => array
  76. (
  77. 'type' => 'int-11',
  78. 'name' => '所属行为',
  79. 'default' => '1',
  80. 'desc' => '所属行为',
  81. 'match' => 'is_numeric',
  82. 'update' => 'select',
  83. 'option' => $action,
  84. 'search' => 'select',
  85. 'list' => true,
  86. ),
  87. 'status' => array
  88. (
  89. 'type' => 'tinyint-1',
  90. 'name' => '收入支出状态',
  91. 'default' => '1',
  92. 'desc' => '收入支出状态',
  93. 'match' => 'is_numeric',
  94. 'update' => 'select',
  95. 'option' => $status,
  96. //'search' => 'select',
  97. 'list' => true,
  98. //'edit' => true,
  99. ),
  100. 'num' => array
  101. (
  102. 'type' => 'varchar-80',
  103. 'name' => '增加积分数-如果为负数,则是减少积分',
  104. 'default' => '',
  105. 'desc' => '增加积分数',
  106. 'match' => 'option',
  107. 'update' => 'textarea',
  108. 'list' => true,
  109. ),
  110. 'total' => array
  111. (
  112. 'type' => 'varchar-80',
  113. 'name' => '总积分数',
  114. 'default' => '',
  115. 'desc' => '总积分数',
  116. 'match' => 'option',
  117. 'update' => 'textarea',
  118. 'list' => true,
  119. ),
  120. 'desc' => array
  121. (
  122. 'type' => 'varchar-300',
  123. 'name' => '描述',
  124. 'default' => '',
  125. 'desc' => '描述',
  126. 'match' => 'option',
  127. 'update' => 'textarea',
  128. ),
  129. 'state' => array
  130. (
  131. 'type' => 'tinyint-1',
  132. 'name' => '状态',
  133. 'default' => '1',
  134. 'desc' => '请选择状态',
  135. 'match' => 'is_numeric',
  136. ),
  137. 'cdate' => array
  138. (
  139. 'type' => 'int-11',
  140. 'name' => '录入时间',
  141. 'match' => array('is_numeric', time()),
  142. 'desc' => '',
  143. # 只有insert时才生效
  144. 'insert' => true,
  145. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  146. ),
  147. ),
  148. 'manage' => array
  149. (
  150. 'delete' => false,
  151. 'edit' => false,
  152. 'insert' => false,
  153. # 列表
  154. 'list_button' => array
  155. (
  156. //'list' => array('行为日志', '"action_log&search_option_action_id={action_id}&search_option_uid={uid}&oper_parent=user_log"'),
  157. ),
  158. ),
  159. # request 请求接口定义
  160. 'request' => array
  161. (
  162. 'getNew' => array
  163. (
  164. # 匹配的正则或函数 选填项
  165. 'option' => array
  166. (
  167. 'config_id' => 'yes',
  168. 'action_id' => 'yes',
  169. 'uid' => 'yes',
  170. 'status' => 'yes',
  171. 'state' => 1,
  172. ),
  173. 'type' => 'one',
  174. 'order' => array('cdate' => 'desc'),
  175. 'col' => '*',
  176. ),
  177. 'getNewTotal' => array
  178. (
  179. # 匹配的正则或函数 选填项
  180. 'option' => array
  181. (
  182. 'config_id' => 'yes',
  183. 'action_id' => 'yes',
  184. 'uid' => 'yes',
  185. 'status' => 'yes',
  186. 'state' => 1,
  187. 'start' => array('yes-cdate', '>='),
  188. 'end' => array('yes-cdate', '<='),
  189. ),
  190. 'type' => 'count',
  191. 'order' => array('cdate' => 'desc'),
  192. 'col' => 'count(1) as total',
  193. ),
  194. )
  195. );