goods_stat.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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' => '{cash}',
  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_name' => '未兑换价值',
  143. 'list' => '({total_num} - {sell_num})*{price}',
  144. 'list_order' => 10,
  145. ),
  146. 'price' => array
  147. (
  148. 'type' => 'decimal-11,2',
  149. 'name' => '单件价值',
  150. 'default' => '0',
  151. 'desc' => '单件价值',
  152. 'match' => 'is_numeric',
  153. 'update' => 'text',
  154. 'list' => true,
  155. 'list_name' => '已兑换价值',
  156. 'list' => '{sell_num}*{price}',
  157. 'list_order' => 11,
  158. ),
  159. 'state' => array
  160. (
  161. 'type' => 'tinyint-1',
  162. 'name' => '状态',
  163. 'default' => '1',
  164. 'desc' => '请选择状态',
  165. 'match' => 'is_numeric',
  166. ),
  167. 'cdate' => array
  168. (
  169. 'type' => 'int-11',
  170. 'name' => '统计时间',
  171. 'match' => array('is_numeric', time()),
  172. 'desc' => '',
  173. ),
  174. ),
  175. 'manage' => array
  176. (
  177. 'insert' => false,
  178. 'delete' => false,
  179. 'edit' => false,
  180. 'excel' => $excel,
  181. ),
  182. 'request' => array
  183. (
  184. 'list' => array
  185. (
  186. # 匹配的正则或函数 选填项
  187. 'option' => array
  188. (
  189. 'type' => 'yes',
  190. 'type_id' => 'yes',
  191. 'sku_id' => 'yes',
  192. 'start_day' => array('yes-day', '>='),
  193. 'end_day' => array('yes-day', '<='),
  194. 'state' => 1,
  195. ),
  196. 'type' => 'all',
  197. 'order' => array('day' => 'desc', 'cdate' => 'desc'),
  198. 'page' => array(20, 'list'),
  199. 'group' => '(case when type = 2 then concat_ws("_", type, type_id) else concat_ws("_", type, type_id, sku_id) end)',
  200. 'col' => '*,sum(total_num) as total_num, sum(sell_num) as sell_num, sum(cash) as cash,sum(sell_nonum) as sell_nonum,sum(price) as price',
  201. ),
  202. 'all' => array
  203. (
  204. # 匹配的正则或函数 选填项
  205. 'option' => array
  206. (
  207. 'type' => 'yes',
  208. 'type_id' => 'yes',
  209. 'sku_id' => 'yes',
  210. 'start_day' => array('yes-day', '>='),
  211. 'end_day' => array('yes-day', '<='),
  212. 'state' => 1,
  213. ),
  214. 'type' => 'all',
  215. 'order' => array('day' => 'desc', 'cdate' => 'desc'),
  216. 'group' => '(case when type = 2 then concat_ws("_", type, type_id) else concat_ws("_", type, type_id, sku_id) end)',
  217. 'col' => '*,sum(total_num) as total_num, sum(sell_num) as sell_num, sum(cash) as cash,sum(sell_nonum) as sell_nonum,sum(price) as price',
  218. ),
  219. ),
  220. );