goods_stat.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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. ),
  74. 'sku_id' => array
  75. (
  76. 'type' => 'int-11',
  77. 'name' => 'sku_id',
  78. 'default' => '-1',
  79. 'desc' => 'sku_id',
  80. 'match' => 'is_numeric',
  81. 'list' => true,
  82. 'list_name' => '未兑换数量',
  83. 'list' => '{total_num} - {sell_num}',
  84. 'list_order' => 7,
  85. ),
  86. 'name' => array
  87. (
  88. 'type' => 'varchar-100',
  89. 'name' => '权益名称',
  90. 'default' => '',
  91. 'desc' => '权益名称',
  92. 'match' => 'is_string',
  93. 'update' => 'text',
  94. 'search' => 'fulltext',
  95. 'list' => '"{name}" ? "{name}" : Dever::load("agent/lib/manage.getGoods#name", "{type}", "{type_id}", "{sku_id}")',
  96. 'list_order' => 5,
  97. ),
  98. 'total_num' => array
  99. (
  100. 'type' => 'int-11',
  101. 'name' => '总数量',
  102. 'default' => '0',
  103. 'desc' => '总数量',
  104. 'match' => 'is_numeric',
  105. //'list_name' => '剩余数量/总数量',
  106. //'list' => '{total_num} - {sell_num} . " / " . {total_num}',
  107. 'list' => true,
  108. 'list_order' => 6,
  109. ),
  110. 'sell_num' => array
  111. (
  112. 'type' => 'int-11',
  113. 'name' => '已兑换数量',
  114. 'default' => '0',
  115. 'desc' => '已兑换数量',
  116. 'match' => 'option',
  117. 'list' => true,
  118. 'list_order' => 8,
  119. ),
  120. 'sell_nonum' => array
  121. (
  122. 'type' => 'int-11',
  123. 'name' => '已兑换未发货数量',
  124. 'default' => '0',
  125. 'desc' => '已兑换未发货数量',
  126. 'match' => 'option',
  127. 'list' => true,
  128. 'list_order' => 8,
  129. ),
  130. 'cash' => array
  131. (
  132. 'type' => 'decimal-11,2',
  133. 'name' => '总价值',
  134. 'default' => '0',
  135. 'desc' => '总价值',
  136. 'match' => 'is_numeric',
  137. 'update' => 'text',
  138. 'list' => true,
  139. 'list_order' => 9,
  140. ),
  141. 'w_cash' => array
  142. (
  143. 'type' => 'decimal-11,2',
  144. 'name' => '未兑换价值',
  145. 'default' => '0',
  146. 'desc' => '未兑换价值',
  147. 'match' => 'is_numeric',
  148. 'update' => 'text',
  149. 'list' => true,
  150. 'list_order' => 10,
  151. ),
  152. 'y_cash' => array
  153. (
  154. 'type' => 'decimal-11,2',
  155. 'name' => '已兑换价值',
  156. 'default' => '0',
  157. 'desc' => '已兑换价值',
  158. 'match' => 'is_numeric',
  159. 'update' => 'text',
  160. 'list' => true,
  161. 'list_order' => 11,
  162. ),
  163. 'state' => array
  164. (
  165. 'type' => 'tinyint-1',
  166. 'name' => '状态',
  167. 'default' => '1',
  168. 'desc' => '请选择状态',
  169. 'match' => 'is_numeric',
  170. ),
  171. 'cdate' => array
  172. (
  173. 'type' => 'int-11',
  174. 'name' => '统计时间',
  175. 'match' => array('is_numeric', time()),
  176. 'desc' => '',
  177. ),
  178. ),
  179. 'manage' => array
  180. (
  181. 'insert' => false,
  182. 'delete' => false,
  183. 'edit' => false,
  184. 'excel' => $excel,
  185. ),
  186. 'request' => array
  187. (
  188. 'list' => array
  189. (
  190. # 匹配的正则或函数 选填项
  191. 'option' => array
  192. (
  193. 'type' => 'yes',
  194. 'type_id' => 'yes',
  195. 'sku_id' => 'yes',
  196. 'start_day' => array('yes-day', '>='),
  197. 'end_day' => array('yes-day', '<='),
  198. 'state' => 1,
  199. ),
  200. 'type' => 'all',
  201. 'order' => array('day' => 'desc', 'cdate' => 'desc'),
  202. 'page' => array(20, 'list'),
  203. 'group' => '(case when type = 2 then concat_ws("_", type, type_id) else concat_ws("_", type, type_id, sku_id) end)',
  204. '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',
  205. ),
  206. 'all' => array
  207. (
  208. # 匹配的正则或函数 选填项
  209. 'option' => array
  210. (
  211. 'type' => 'yes',
  212. 'type_id' => 'yes',
  213. 'sku_id' => 'yes',
  214. 'start_day' => array('yes-day', '>='),
  215. 'end_day' => array('yes-day', '<='),
  216. 'state' => 1,
  217. ),
  218. 'type' => 'all',
  219. 'order' => array('day' => 'desc', 'cdate' => 'desc'),
  220. 'group' => '(case when type = 2 then concat_ws("_", type, type_id) else concat_ws("_", type, type_id, sku_id) end)',
  221. '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',
  222. ),
  223. ),
  224. );