goods_stat.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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,sell_nonum,price',
  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("{month}")',
  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' => 'round({cash}/{total_num}, 2)',
  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. 'sell_nonum' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '已兑换未发货数量',
  127. 'default' => '0',
  128. 'desc' => '已兑换未发货数量',
  129. 'match' => 'option',
  130. 'list' => true,
  131. 'list_order' => 8,
  132. ),
  133. 'cash' => array
  134. (
  135. 'type' => 'decimal-11,2',
  136. 'name' => '总价值',
  137. 'default' => '0',
  138. 'desc' => '总价值',
  139. 'match' => 'is_numeric',
  140. 'update' => 'text',
  141. 'list' => true,
  142. 'list_order' => 10,
  143. ),
  144. 'w_cash' => array
  145. (
  146. 'type' => 'decimal-11,2',
  147. 'name' => '未兑换价值',
  148. 'default' => '0',
  149. 'desc' => '未兑换价值',
  150. 'match' => 'is_numeric',
  151. 'update' => 'text',
  152. 'list' => true,
  153. 'list_order' => 11,
  154. ),
  155. 'y_cash' => array
  156. (
  157. 'type' => 'decimal-11,2',
  158. 'name' => '已兑换价值',
  159. 'default' => '0',
  160. 'desc' => '已兑换价值',
  161. 'match' => 'is_numeric',
  162. 'update' => 'text',
  163. 'list' => true,
  164. 'list_order' => 12,
  165. ),
  166. 'state' => array
  167. (
  168. 'type' => 'tinyint-1',
  169. 'name' => '状态',
  170. 'default' => '1',
  171. 'desc' => '请选择状态',
  172. 'match' => 'is_numeric',
  173. ),
  174. 'cdate' => array
  175. (
  176. 'type' => 'int-11',
  177. 'name' => '统计时间',
  178. 'match' => array('is_numeric', time()),
  179. 'desc' => '',
  180. ),
  181. ),
  182. 'manage' => array
  183. (
  184. 'insert' => false,
  185. 'delete' => false,
  186. 'edit' => false,
  187. 'excel' => $excel,
  188. ),
  189. 'request' => array
  190. (
  191. 'list' => array
  192. (
  193. # 匹配的正则或函数 选填项
  194. 'option' => array
  195. (
  196. 'type' => 'yes',
  197. 'type_id' => 'yes',
  198. 'sku_id' => 'yes',
  199. 'start_day' => array('yes-day', '>='),
  200. 'end_day' => array('yes-day', '<='),
  201. 'state' => 1,
  202. ),
  203. 'type' => 'all',
  204. 'order' => array('day' => 'desc', 'cdate' => 'desc'),
  205. 'page' => array(20, 'list'),
  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,sum(sell_nonum) as sell_nonum,sum(w_cash) as w_cash,sum(y_cash) as y_cash',
  208. ),
  209. 'all' => array
  210. (
  211. # 匹配的正则或函数 选填项
  212. 'option' => array
  213. (
  214. 'type' => 'yes',
  215. 'type_id' => 'yes',
  216. 'sku_id' => 'yes',
  217. 'start_day' => array('yes-day', '>='),
  218. 'end_day' => array('yes-day', '<='),
  219. 'state' => 1,
  220. ),
  221. 'type' => 'all',
  222. 'order' => array('day' => 'desc', 'cdate' => 'desc'),
  223. 'group' => '(case when type = 2 then concat_ws("_", type, type_id) else concat_ws("_", type, type_id, sku_id) end)',
  224. 'col' => '*,sum(total_num) as total_num, sum(sell_num) as sell_num, sum(cash) as cash,sum(sell_nonum) as sell_nonum,sum(w_cash) as w_cash,sum(y_cash) as y_cash',
  225. ),
  226. ),
  227. );