action_log.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. 'action_id' => array
  62. (
  63. 'type' => 'int-11',
  64. 'name' => '所属行为',
  65. 'default' => '1',
  66. 'desc' => '所属行为',
  67. 'match' => 'is_numeric',
  68. 'update' => 'select',
  69. 'option' => $action,
  70. 'search' => 'select',
  71. 'list' => true,
  72. ),
  73. 'score_type' => array
  74. (
  75. 'type' => 'int-11',
  76. 'name' => '是否增加积分',
  77. 'default' => '1',
  78. 'desc' => '是否增加积分',
  79. 'match' => 'is_numeric',
  80. 'update' => 'select',
  81. 'option' => $score_type,
  82. 'search' => 'select',
  83. 'list' => true,
  84. ),
  85. 'cron_type' => array
  86. (
  87. 'type' => 'int-11',
  88. 'name' => '是否增加积分',
  89. 'default' => '3',
  90. 'desc' => '是否增加积分',
  91. 'match' => 'is_numeric',
  92. 'update' => 'select',
  93. 'option' => $cron_type,
  94. 'search' => 'select',
  95. 'list' => true,
  96. ),
  97. 'score' => array
  98. (
  99. 'type' => 'varchar-30',
  100. 'name' => '增加积分数',
  101. 'default' => '0',
  102. 'desc' => '积分数',
  103. 'match' => 'is_string',
  104. 'list' => true,
  105. ),
  106. 'num' => array
  107. (
  108. 'type' => 'varchar-30',
  109. 'name' => '增加的积分将乘以该数量',
  110. 'default' => '0',
  111. 'desc' => '积分数',
  112. 'match' => 'is_string',
  113. ),
  114. 'mscore' => array
  115. (
  116. 'type' => 'varchar-30',
  117. 'name' => '手动增加积分数',
  118. 'default' => '0',
  119. 'desc' => '积分数',
  120. 'match' => 'is_string',
  121. ),
  122. 'callback' => array
  123. (
  124. 'type' => 'varchar-800',
  125. 'name' => '行为回调方法',
  126. 'default' => '',
  127. 'desc' => '行为回调方法',
  128. 'match' => 'option',
  129. 'update' => 'textarea',
  130. //'list' => true,
  131. ),
  132. 'cdate' => array
  133. (
  134. 'type' => 'int-11',
  135. 'name' => '录入时间',
  136. 'match' => array('is_numeric', time()),
  137. 'desc' => '',
  138. # 只有insert时才生效
  139. 'insert' => true,
  140. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  141. ),
  142. ),
  143. 'manage' => array
  144. (
  145. 'delete' => false,
  146. 'edit' => false,
  147. 'insert' => false,
  148. ),
  149. # request 请求接口定义
  150. 'request' => array
  151. (
  152. 'getDataByDate' => array
  153. (
  154. # 匹配的正则或函数 选填项
  155. 'option' => array
  156. (
  157. 'start' => array('yes-cdate', '>='),
  158. 'end' => array('yes-cdate', '<='),
  159. 'score_type' => 'yes',
  160. 'action_id' => 'yes',
  161. ),
  162. 'type' => 'all',
  163. 'order' => array('id' => 'desc'),
  164. 'col' => 'id',
  165. ),
  166. )
  167. );