action_log.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. return array
  19. (
  20. # 表名
  21. 'name' => 'action_log',
  22. # 显示给用户看的名称
  23. 'lang' => '积分行为日志',
  24. 'order' => 10,
  25. 'menu' => false,
  26. # 数据结构
  27. 'struct' => array
  28. (
  29. 'id' => array
  30. (
  31. 'type' => 'int-11',
  32. 'name' => 'ID',
  33. 'default' => '',
  34. 'desc' => '',
  35. 'match' => 'is_numeric',
  36. 'list' => true,
  37. ),
  38. 'uid' => array
  39. (
  40. 'type' => 'int-11',
  41. 'name' => '用户名',
  42. 'default' => '0',
  43. 'desc' => '请选择用户',
  44. 'match' => 'is_numeric',
  45. //'update' => 'select',
  46. //'search' => 'select',
  47. 'search' => array
  48. (
  49. 'api' => 'passport/user-all',
  50. 'col' => 'username',
  51. 'result' => 'id',
  52. ),
  53. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  54. ),
  55. 'action_id' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => '所属行为',
  59. 'default' => '1',
  60. 'desc' => '所属行为',
  61. 'match' => 'is_numeric',
  62. 'update' => 'select',
  63. 'option' => $action,
  64. 'search' => 'select',
  65. 'list' => true,
  66. ),
  67. 'score_type' => array
  68. (
  69. 'type' => 'int-11',
  70. 'name' => '是否增加积分',
  71. 'default' => '1',
  72. 'desc' => '是否增加积分',
  73. 'match' => 'is_numeric',
  74. 'update' => 'select',
  75. 'option' => $score_type,
  76. 'search' => 'select',
  77. 'list' => true,
  78. ),
  79. 'score' => array
  80. (
  81. 'type' => 'varchar-30',
  82. 'name' => '增加积分数',
  83. 'default' => '0',
  84. 'desc' => '积分数',
  85. 'match' => 'is_string',
  86. 'list' => true,
  87. ),
  88. 'num' => array
  89. (
  90. 'type' => 'varchar-30',
  91. 'name' => '增加的积分将乘以该数量',
  92. 'default' => '0',
  93. 'desc' => '积分数',
  94. 'match' => 'is_string',
  95. ),
  96. 'mscore' => array
  97. (
  98. 'type' => 'varchar-30',
  99. 'name' => '手动增加积分数',
  100. 'default' => '0',
  101. 'desc' => '积分数',
  102. 'match' => 'is_string',
  103. ),
  104. 'callback' => array
  105. (
  106. 'type' => 'varchar-800',
  107. 'name' => '行为回调方法',
  108. 'default' => '',
  109. 'desc' => '行为回调方法',
  110. 'match' => 'option',
  111. 'update' => 'textarea',
  112. //'list' => true,
  113. ),
  114. 'cdate' => array
  115. (
  116. 'type' => 'int-11',
  117. 'name' => '录入时间',
  118. 'match' => array('is_numeric', time()),
  119. 'desc' => '',
  120. # 只有insert时才生效
  121. 'insert' => true,
  122. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  123. ),
  124. ),
  125. 'manage' => array
  126. (
  127. 'delete' => false,
  128. 'edit' => false,
  129. 'insert' => false,
  130. ),
  131. # request 请求接口定义
  132. 'request' => array
  133. (
  134. 'getDataByDate' => array
  135. (
  136. # 匹配的正则或函数 选填项
  137. 'option' => array
  138. (
  139. 'time' => array('yes-cdate', '>='),
  140. ),
  141. 'type' => 'all',
  142. 'order' => array('id' => 'desc'),
  143. 'col' => 'id',
  144. ),
  145. )
  146. );