goods_stat.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <?php
  2. $type = Dever::db('setting/role_goods')->config['set']['type'];
  3. if (Dever::load('manage/auth')->checkFunc('menu_268.menu_272', 'edit1', '导出数据')) {
  4. $excel = true;
  5. }else{
  6. $excel = false;
  7. }
  8. return array
  9. (
  10. # 表名
  11. 'name' => 'goods_stat',
  12. # 显示给用户看的名称
  13. 'lang' => '权益统计',
  14. 'order' => 78,
  15. 'menu' => 'agent',
  16. # 数据结构
  17. 'struct' => array
  18. (
  19. 'id' => array
  20. (
  21. 'type' => 'int-11',
  22. 'name' => 'ID',
  23. 'default' => '',
  24. 'desc' => '',
  25. 'match' => 'is_numeric',
  26. 'search' => 'order',
  27. //'list' => true,
  28. ),
  29. 'day' => array
  30. (
  31. 'type' => 'int-11',
  32. 'name' => '日期',
  33. 'default' => '',
  34. 'match' => 'is_numeric',
  35. 'desc' => '',
  36. 'search' => 'sday',
  37. 'search_buttons' => array
  38. (
  39. 'sum' => 'total_num,sell_num,cash',
  40. 'option' => array(
  41. 'day' => '按天',
  42. 'week' => '按周',
  43. 'month' => '按月',
  44. ),
  45. 'group' => 'type,type_id,sku_id',
  46. ),
  47. 'order' => 'desc',
  48. //'list' => 'Dever::showDay("{day}")',
  49. ),
  50. 'type' => array
  51. (
  52. 'type' => 'tinyint-1',
  53. 'name' => '类型',
  54. 'default' => '1',
  55. 'desc' => '类型',
  56. 'match' => 'is_numeric',
  57. 'update' => 'radio',
  58. 'option' => $type,
  59. 'search' => 'select',
  60. 'list' => true,
  61. 'list_order' => 4,
  62. ),
  63. 'type_id' => array
  64. (
  65. 'type' => 'int-11',
  66. 'name' => '类型id',
  67. 'default' => '-1',
  68. 'desc' => '类型id',
  69. 'match' => 'is_numeric',
  70. 'list_name' => '权益名称',
  71. //'list' => 'Dever::load("agent/lib/manage.getGoods#name", "{type}", "{type_id}", "{sku_id}")',
  72. //'list_order' => 5,
  73. 'list_name' => '单件价值',
  74. 'list' => '{price}',
  75. 'list_order' => 9,
  76. ),
  77. 'sku_id' => array
  78. (
  79. 'type' => 'int-11',
  80. 'name' => 'sku_id',
  81. 'default' => '-1',
  82. 'desc' => 'sku_id',
  83. 'match' => 'is_numeric',
  84. 'list' => true,
  85. 'list_name' => '未兑换数量',
  86. 'list' => '{total_num} - {sell_num}',
  87. 'list_order' => 7,
  88. ),
  89. 'name' => array
  90. (
  91. 'type' => 'varchar-100',
  92. 'name' => '权益名称',
  93. 'default' => '',
  94. 'desc' => '权益名称',
  95. 'match' => 'is_string',
  96. 'update' => 'text',
  97. 'search' => 'fulltext',
  98. 'list' => '"{name}" ? "{name}" : Dever::load("agent/lib/manage.getGoods#name", "{type}", "{type_id}", "{sku_id}")',
  99. 'list_order' => 5,
  100. ),
  101. 'total_num' => array
  102. (
  103. 'type' => 'int-11',
  104. 'name' => '总数量',
  105. 'default' => '0',
  106. 'desc' => '总数量',
  107. 'match' => 'is_numeric',
  108. //'list_name' => '剩余数量/总数量',
  109. //'list' => '{total_num} - {sell_num} . " / " . {total_num}',
  110. 'list' => true,
  111. 'list_order' => 6,
  112. ),
  113. 'sell_num' => array
  114. (
  115. 'type' => 'int-11',
  116. 'name' => '已兑换数量',
  117. 'default' => '0',
  118. 'desc' => '已兑换数量',
  119. 'match' => 'option',
  120. 'list' => true,
  121. 'list_order' => 8,
  122. ),
  123. 'cash' => array
  124. (
  125. 'type' => 'decimal-11,2',
  126. 'name' => '总价值',
  127. 'default' => '0',
  128. 'desc' => '总价值',
  129. 'match' => 'is_numeric',
  130. 'update' => 'text',
  131. 'list' => true,
  132. 'list_name' => '未兑换价值',
  133. 'list' => '({total_num} - {sell_num})*{price}',
  134. 'list_order' => 10,
  135. ),
  136. 'price' => array
  137. (
  138. 'type' => 'decimal-11,2',
  139. 'name' => '单件价值',
  140. 'default' => '0',
  141. 'desc' => '单件价值',
  142. 'match' => 'is_numeric',
  143. 'update' => 'text',
  144. 'list' => true,
  145. 'list_name' => '已兑换价值',
  146. 'list' => '{sell_num}*{price}',
  147. 'list_order' => 11,
  148. ),
  149. 'state' => array
  150. (
  151. 'type' => 'tinyint-1',
  152. 'name' => '状态',
  153. 'default' => '1',
  154. 'desc' => '请选择状态',
  155. 'match' => 'is_numeric',
  156. ),
  157. 'cdate' => array
  158. (
  159. 'type' => 'int-11',
  160. 'name' => '统计时间',
  161. 'match' => array('is_numeric', time()),
  162. 'desc' => '',
  163. ),
  164. ),
  165. 'manage' => array
  166. (
  167. 'insert' => false,
  168. 'delete' => false,
  169. 'edit' => false,
  170. 'excel' => $excel,
  171. ),
  172. 'request' => array
  173. (
  174. 'list' => array
  175. (
  176. # 匹配的正则或函数 选填项
  177. 'option' => array
  178. (
  179. 'type' => 'yes',
  180. 'type_id' => 'yes',
  181. 'sku_id' => 'yes',
  182. 'start_day' => array('yes-day', '>='),
  183. 'end_day' => array('yes-day', '<='),
  184. 'state' => 1,
  185. ),
  186. 'type' => 'all',
  187. 'order' => array('day' => 'desc', 'cdate' => 'desc'),
  188. 'page' => array(20, 'list'),
  189. 'group' => '(case when type = 2 then concat_ws("_", type, type_id) else concat_ws("_", type, type_id, sku_id) end)',
  190. 'col' => '*,sum(total_num) as total_num, sum(sell_num) as sell_num, sum(cash) as cash',
  191. ),
  192. 'all' => array
  193. (
  194. # 匹配的正则或函数 选填项
  195. 'option' => array
  196. (
  197. 'type' => 'yes',
  198. 'type_id' => 'yes',
  199. 'sku_id' => 'yes',
  200. 'start_day' => array('yes-day', '>='),
  201. 'end_day' => array('yes-day', '<='),
  202. 'state' => 1,
  203. ),
  204. 'type' => 'all',
  205. 'order' => array('day' => 'desc', 'cdate' => 'desc'),
  206. 'group' => '(case when type = 2 then concat_ws("_", type, type_id) else concat_ws("_", type, type_id, sku_id) end)',
  207. 'col' => '*,sum(total_num) as total_num, sum(sell_num) as sell_num, sum(cash) as cash',
  208. ),
  209. ),
  210. );