servicer_store_goods_sku.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'servicer_store_goods_sku',
  6. # 显示给用户看的名称
  7. 'lang' => '商品价格设置',
  8. 'order' => 200,
  9. 'menu' => false,
  10. # 数据结构 不同的字段放这里
  11. 'struct' => array
  12. (
  13. 'id' => array
  14. (
  15. 'type' => 'int-11',
  16. 'name' => 'ID',
  17. 'default' => '',
  18. 'desc' => '',
  19. 'match' => 'is_numeric',
  20. //'list' => true,
  21. ),
  22. 'servicer_store_id' => array
  23. (
  24. 'type' => 'int-11',
  25. 'name' => '所属配送商',
  26. 'default' => '',
  27. 'desc' => '所属配送商',
  28. 'match' => 'is_numeric',
  29. 'update' => 'hidden',
  30. 'search' => 'hidden',
  31. 'value' => Dever::input('search_option_servicer_store_id'),
  32. 'list' => 'Dever::load("scm_role/servicer_store-one#name", {servicer_store_id})',
  33. ),
  34. 'goods-info_sku-code'=> array
  35. (
  36. 'name' => '商品编码',
  37. 'default' => '',
  38. 'desc' => '商品编码',
  39. 'match' => 'option',
  40. # 读取另外表的关联方式
  41. 'sync' => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
  42. 'list' => true,
  43. 'list_order' => 4,
  44. ),
  45. 'goods_id' => array
  46. (
  47. 'type' => 'int-11',
  48. 'name' => '商品名称',
  49. 'default' => '',
  50. 'desc' => '商品名称',
  51. 'match' => 'is_numeric',
  52. 'update' => 'select',
  53. 'update_search' => 'scm_product/lib/manage.search',
  54. 'list' => 'Dever::load("scm_product/info-one#name", {goods_id})',
  55. ),
  56. 'sku_id' => array
  57. (
  58. 'type' => 'int-11',
  59. 'name' => '规格型号',
  60. 'default' => '-1',
  61. 'desc' => '规格型号',
  62. 'match' => 'is_numeric',
  63. ),
  64. 'in_num' => array
  65. (
  66. 'type' => 'decimal-11,2',
  67. 'name' => '入库库存',
  68. 'default' => '0',
  69. 'desc' => '入库库存',
  70. 'match' => 'is_numeric',
  71. ),
  72. 'out_num' => array
  73. (
  74. 'type' => 'decimal-11,2',
  75. 'name' => '出库库存',
  76. 'default' => '0',
  77. 'desc' => '出库库存',
  78. 'match' => 'option',
  79. ),
  80. 'state' => array
  81. (
  82. 'type' => 'tinyint-1',
  83. 'name' => '数据状态',
  84. 'default' => '1',
  85. 'desc' => '请选择状态',
  86. 'match' => 'is_numeric',
  87. ),
  88. 'cdate' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '发布时间',
  92. 'match' => array('is_numeric', time()),
  93. 'desc' => '',
  94. # 只有insert时才生效
  95. 'insert' => true,
  96. //'search' => 'date',
  97. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  98. ),
  99. ),
  100. 'manage' => array
  101. (
  102. 'insert' => false,
  103. 'edit' => false,
  104. 'delete' => false,
  105. //'excel' => array(array('导出门店库存', '门店库存', '')),
  106. 'page_list_table' => 'sku',
  107. ),
  108. # request 请求接口定义
  109. 'request' => array
  110. (
  111. 'getDataPage' => array
  112. (
  113. # 匹配的正则或函数 选填项
  114. 'option' => array
  115. (
  116. 'seller_id' => array('yes-t_1.seller_id'),
  117. 'name' => array('yes-t_2.name', 'like'),
  118. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  119. 'category' => array('yes-t_2.category', 'like'),
  120. 'top_category_id' => array('yes-t_2.top_category_id'),
  121. 'second_category_id' => array('yes-t_2.second_category_id'),
  122. 'category_id' => array('yes-t_2.category_id'),
  123. 'status' => array('yes-t_2.status', 1),
  124. 'state' => array('yes-t_2.state', 1),
  125. 'state_1' => array('yes-t_1.state', 1),
  126. ),
  127. # 联表
  128. 'join' => array
  129. (
  130. array
  131. (
  132. 'table' => 'scm_product/info',
  133. 'type' => 'left join',
  134. 'on' => array('goods_id','id'),
  135. 'col' => 'goods_id',
  136. ),
  137. ),
  138. 'type' => 'all',
  139. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  140. 'page' => array(30, 'list'),
  141. 'col' => '*,t_2.name,t_2.pic,t_2.video,t_2.id as id,t_1.in_num-t_1.out_num as total,t_1.out_num',
  142. ),
  143. 'getData' => array
  144. (
  145. # 匹配的正则或函数 选填项
  146. 'option' => array
  147. (
  148. 'seller_id' => array('yes-t_1.seller_id'),
  149. 'name' => array('yes-t_2.name', 'like'),
  150. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  151. 'category' => array('yes-t_2.category', 'like'),
  152. 'top_category_id' => array('yes-t_2.top_category_id'),
  153. 'second_category_id' => array('yes-t_2.second_category_id'),
  154. 'category_id' => array('yes-t_2.category_id'),
  155. 'status' => array('yes-t_2.status', 1),
  156. 'state' => array('yes-t_2.state', 1),
  157. 'state_1' => array('yes-t_1.state', 1),
  158. ),
  159. # 联表
  160. 'join' => array
  161. (
  162. array
  163. (
  164. 'table' => 'scm_product/info',
  165. 'type' => 'left join',
  166. 'on' => array('goods_id','id'),
  167. 'col' => 'goods_id',
  168. ),
  169. ),
  170. 'type' => 'all',
  171. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  172. 'col' => '*,t_2.name,t_2.pic,t_2.video,t_2.id as id,t_1.in_num-t_1.out_num as total,t_1.out_num,t_1.in_num,t_2.type,t_2.stock,t_2.commission,t_2.sell_type,t_2.buy_type',
  173. ),
  174. # 列表
  175. 'getList' => array
  176. (
  177. # 匹配的正则或函数 选填项
  178. 'option' => array
  179. (
  180. 'seller_id' => 'yes',
  181. 'goods_id' => 'yes',
  182. 'sku_id' => 'yes',
  183. 'state' => 1,
  184. ),
  185. 'type' => 'all',
  186. 'order' => array('id' => 'desc'),
  187. 'col' => '*,in_num-out_num as total|sku_id',
  188. ),
  189. # 获取单条数据
  190. 'getOne' => array
  191. (
  192. # 匹配的正则或函数 选填项
  193. 'option' => array
  194. (
  195. 'seller_id' => 'yes',
  196. 'goods_id' => 'yes',
  197. 'sku_id' => 'yes',
  198. 'state' => 1,
  199. ),
  200. 'type' => 'one',
  201. 'col' => '*,in_num-out_num as total',
  202. ),
  203. # 更新售出量
  204. 'incSell' => array
  205. (
  206. 'type' => 'update',
  207. 'where' => array
  208. (
  209. 'seller_id' => 'yes',
  210. 'goods_id' => 'yes',
  211. 'sku_id' => 'yes',
  212. ),
  213. 'set' => array
  214. (
  215. 'out_num' => array('yes', '+='),
  216. ),
  217. ),
  218. # 减少售出量
  219. 'decSell' => array
  220. (
  221. 'type' => 'update',
  222. 'where' => array
  223. (
  224. 'seller_id' => 'yes',
  225. 'goods_id' => 'yes',
  226. 'sku_id' => 'yes',
  227. ),
  228. 'set' => array
  229. (
  230. 'out_num' => array('yes', '-='),
  231. ),
  232. ),
  233. # 更新总库存
  234. 'updateTotal' => array
  235. (
  236. 'type' => 'update',
  237. 'where' => array
  238. (
  239. 'id' => 'yes',
  240. ),
  241. 'set' => array
  242. (
  243. 'in_num' => array('yes', '+='),
  244. ),
  245. ),
  246. # 增加总库存
  247. 'incTotal' => array
  248. (
  249. 'type' => 'update',
  250. 'where' => array
  251. (
  252. 'seller_id' => 'yes',
  253. 'goods_id' => 'yes',
  254. 'sku_id' => 'yes',
  255. ),
  256. 'set' => array
  257. (
  258. 'in_num' => array('yes', '+='),
  259. ),
  260. ),
  261. # 减少总库存
  262. 'decTotal' => array
  263. (
  264. 'type' => 'update',
  265. 'where' => array
  266. (
  267. 'seller_id' => 'yes',
  268. 'goods_id' => 'yes',
  269. 'sku_id' => 'yes',
  270. ),
  271. 'set' => array
  272. (
  273. 'in_num' => array('yes', '-='),
  274. ),
  275. ),
  276. ),
  277. );
  278. return $config;