goods_stat.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'goods_stat',
  6. # 显示给用户看的名称
  7. 'lang' => '门店单品销售统计',
  8. 'order' => -12,
  9. # 数据结构 不同的字段放这里
  10. 'struct' => array
  11. (
  12. 'id' => array
  13. (
  14. 'type' => 'int-11',
  15. 'name' => 'ID',
  16. 'default' => '',
  17. 'desc' => '',
  18. 'match' => 'is_numeric',
  19. //'list' => true,
  20. ),
  21. 'day' => array
  22. (
  23. 'type' => 'int-11',
  24. 'name' => '日期',
  25. 'default' => '',
  26. 'match' => 'is_numeric',
  27. 'desc' => '',
  28. 'search' => 'day',
  29. 'search_button' => array
  30. (
  31. 'sum' => 'num,cash',
  32. 'option' => array(
  33. 'day' => '按天',
  34. 'week' => '按周',
  35. 'month' => '按月',
  36. ),
  37. 'group' => 'goods_id',
  38. ),
  39. 'order' => 'desc',
  40. 'list' => 'Dever::showDay("{day}")',
  41. ),
  42. 'shop_id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '门店名称',
  46. 'default' => '',
  47. 'desc' => '门店名称',
  48. 'match' => 'is_numeric',
  49. 'search' => 'select',
  50. //'option' => $shop,
  51. 'update' => 'hidden',
  52. 'search' => 'hidden',
  53. 'search' => array
  54. (
  55. 'api' => 'shop/info-like',
  56. 'col' => 'name',
  57. 'result' => 'id',
  58. ),
  59. 'value' => Dever::input('search_option_shop_id'),
  60. //'list' => 'Dever::load("shop/info-one#name", {shop_id})',
  61. ),
  62. 'area' => array
  63. (
  64. 'type' => 'varchar-500',
  65. 'name' => '所在街道',
  66. 'default' => '',
  67. 'desc' => '所在街道',
  68. 'match' => 'option',
  69. 'search' => 'linkage',
  70. 'update' => 'linkage',
  71. 'option' => Dever::url('lib/area.get', 'shop'),
  72. //'list' => 'Dever::load("area/api.string", "{area}")',
  73. ),
  74. 'goods_id' => array
  75. (
  76. 'type' => 'int-11',
  77. 'name' => '商品名称',
  78. 'default' => '',
  79. 'desc' => '商品名称',
  80. 'match' => 'is_numeric',
  81. 'search' => array
  82. (
  83. 'api' => 'goods/info-like',
  84. 'col' => 'name',
  85. 'result' => 'id',
  86. 'search' => 'goods_id',//本表的字段,默认为当前的字段
  87. ),
  88. 'list' => 'Dever::load("goods/info-find#name", {goods_id})',
  89. 'list_order' => 5,
  90. ),
  91. 'category' => array
  92. (
  93. 'type' => 'varchar-500',
  94. 'name' => '商品分类',
  95. 'default' => '',
  96. 'desc' => '商品分类',
  97. 'match' => 'is_string',
  98. 'search' => 'linkage',
  99. 'update' => 'linkage',
  100. 'option' => Dever::url('api.get', 'category'),
  101. 'list' => 'Dever::load("category/api.string", "{category}")',
  102. ),
  103. 'num' => array
  104. (
  105. 'type' => 'float-11,2',
  106. 'name' => '数量',
  107. 'default' => '0',
  108. 'desc' => '数量',
  109. 'match' => 'is_numeric',
  110. 'search' => 'order',
  111. 'list' => true,
  112. ),
  113. 'cash' => array
  114. (
  115. 'type' => 'varchar-100',
  116. 'name' => '金额',
  117. 'default' => '0',
  118. 'desc' => '金额',
  119. 'match' => 'is_string',
  120. 'search' => 'order',
  121. 'list' => 'round({cash}, 2)',
  122. ),
  123. 'hb' => array
  124. (
  125. 'type' => 'varchar-11',
  126. 'name' => '环比增长',
  127. 'default' => '0',
  128. 'desc' => '环比增长',
  129. 'match' => 'option',
  130. 'update' => 'text',
  131. 'list' => 'Dever::load("shop/lib/manage.getGoodsHb", "{num}", "{time}", "{goods_id}")',
  132. ),
  133. 'state' => array
  134. (
  135. 'type' => 'tinyint-1',
  136. 'name' => '数据状态',
  137. 'default' => '1',
  138. 'desc' => '请选择状态',
  139. 'match' => 'is_numeric',
  140. ),
  141. 'cdate' => array
  142. (
  143. 'type' => 'int-11',
  144. 'name' => '发布时间',
  145. 'match' => array('is_numeric', time()),
  146. 'desc' => '',
  147. # 只有insert时才生效
  148. 'insert' => true,
  149. //'search' => 'date',
  150. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  151. ),
  152. ),
  153. 'alter' => array
  154. (
  155. 2 => array
  156. (
  157. array('update', 'num', 'num', 'float-11,2 0 数量'),
  158. ),
  159. 'version' => 2,
  160. ),
  161. 'manage' => array
  162. (
  163. 'insert' => false,
  164. 'edit' => false,
  165. 'delete' => false,
  166. 'num' => false,
  167. 'excel' => true,
  168. ),
  169. # request 请求接口定义
  170. 'request' => array
  171. (
  172. 'list' => array
  173. (
  174. # 匹配的正则或函数 选填项
  175. 'option' => array
  176. (
  177. 'shop_id' => 'yes',
  178. 'area' => array('yes', 'like'),
  179. 'category' => array('yes', 'like'),
  180. 'start_day' => array('yes-day', '>='),
  181. 'end_day' => array('yes-day', '<='),
  182. 'state' => 1,
  183. ),
  184. 'type' => 'all',
  185. 'order' => array('time' => 'desc', 'cdate' => 'desc'),
  186. 'page' => array(20, 'list'),
  187. 'group' => 'goods_id,day',
  188. 'col' => '*,min(day) as time,sum(cash) as cash, sum(num) as num',
  189. ),
  190. 'prev' => array
  191. (
  192. # 匹配的正则或函数 选填项
  193. 'option' => array
  194. (
  195. 'day' => array('yes-day', '<'),
  196. //'start_day' => array('yes-day', '>='),
  197. //'end_day' => array('yes-day', '<='),
  198. 'state' => 1,
  199. ),
  200. 'order' => array('time' => 'desc', 'id' => 'desc'),
  201. 'type' => 'one',
  202. 'col' => '*,min(day) as time,sum(cash) as cash, sum(num) as num',
  203. # 允许自定义以上配置
  204. 'config' => true,
  205. ),
  206. ),
  207. );
  208. return $config;