seller_goods_sku.php 9.5 KB

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