supplier_goods_sku.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'supplier_goods_sku',
  6. # 显示给用户看的名称
  7. 'lang' => '商品价格设置',
  8. 'order' => 200,
  9. 'menu' => false,
  10. /*
  11. 'end' => array
  12. (
  13. 'insert' => 'role/lib/seller.skuUpdate',
  14. 'update' => '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. 'supplier_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_supplier_id'),
  39. 'list' => 'Dever::load("role/supplier-one#name", {supplier_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' => 'product/lib/manage.search',
  61. 'list' => 'Dever::load("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. 'state' => array
  88. (
  89. 'type' => 'tinyint-1',
  90. 'name' => '数据状态',
  91. 'default' => '1',
  92. 'desc' => '请选择状态',
  93. 'match' => 'is_numeric',
  94. ),
  95. 'cdate' => array
  96. (
  97. 'type' => 'int-11',
  98. 'name' => '发布时间',
  99. 'match' => array('is_numeric', time()),
  100. 'desc' => '',
  101. # 只有insert时才生效
  102. 'insert' => true,
  103. //'search' => 'date',
  104. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  105. ),
  106. ),
  107. 'manage' => array
  108. (
  109. 'insert' => false,
  110. 'edit' => false,
  111. 'delete' => false,
  112. //'excel' => array(array('导出门店库存', '门店库存', '')),
  113. 'page_list_table' => 'sku',
  114. ),
  115. # request 请求接口定义
  116. 'request' => array
  117. (
  118. 'getDataPage' => array
  119. (
  120. # 匹配的正则或函数 选填项
  121. 'option' => array
  122. (
  123. 'seller_id' => array('yes-t_1.seller_id'),
  124. 'name' => array('yes-t_2.name', 'like'),
  125. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  126. 'category' => array('yes-t_2.category', 'like'),
  127. 'top_category_id' => array('yes-t_2.top_category_id'),
  128. 'second_category_id' => array('yes-t_2.second_category_id'),
  129. 'category_id' => array('yes-t_2.category_id'),
  130. 'status' => array('yes-t_2.status', 1),
  131. 'state' => array('yes-t_2.state', 1),
  132. 'state_1' => array('yes-t_1.state', 1),
  133. ),
  134. # 联表
  135. 'join' => array
  136. (
  137. array
  138. (
  139. 'table' => 'product/info',
  140. 'type' => 'left join',
  141. 'on' => array('goods_id','id'),
  142. 'col' => 'goods_id',
  143. ),
  144. ),
  145. 'type' => 'all',
  146. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc', 't_2.price' => 'asc'),
  147. 'page' => array(30, 'list'),
  148. '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',
  149. ),
  150. 'getData' => array
  151. (
  152. # 匹配的正则或函数 选填项
  153. 'option' => array
  154. (
  155. 'seller_id' => array('yes-t_1.seller_id'),
  156. 'name' => array('yes-t_2.name', 'like'),
  157. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  158. 'category' => array('yes-t_2.category', 'like'),
  159. 'top_category_id' => array('yes-t_2.top_category_id'),
  160. 'second_category_id' => array('yes-t_2.second_category_id'),
  161. 'category_id' => array('yes-t_2.category_id'),
  162. 'status' => array('yes-t_2.status', 1),
  163. 'state' => array('yes-t_2.state', 1),
  164. 'state_1' => array('yes-t_1.state', 1),
  165. ),
  166. # 联表
  167. 'join' => array
  168. (
  169. array
  170. (
  171. 'table' => 'product/info',
  172. 'type' => 'left join',
  173. 'on' => array('goods_id','id'),
  174. 'col' => 'goods_id',
  175. ),
  176. ),
  177. 'type' => 'all',
  178. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc', 't_2.price' => 'asc'),
  179. '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',
  180. ),
  181. # 列表
  182. 'getList' => array
  183. (
  184. # 匹配的正则或函数 选填项
  185. 'option' => array
  186. (
  187. 'shop_id' => 'yes',
  188. 'goods_id' => 'yes',
  189. 'sku_id' => 'yes',
  190. 'state' => 1,
  191. ),
  192. 'type' => 'all',
  193. 'order' => array('id' => 'desc'),
  194. 'col' => '*,in_num-out_num as total|sku_id',
  195. ),
  196. # 获取单条数据
  197. 'getOne' => array
  198. (
  199. # 匹配的正则或函数 选填项
  200. 'option' => array
  201. (
  202. 'shop_id' => 'yes',
  203. 'goods_id' => 'yes',
  204. 'sku_id' => 'yes',
  205. 'state' => 1,
  206. ),
  207. 'type' => 'one',
  208. 'col' => '*,in_num-out_num as total',
  209. ),
  210. # 更新售出量
  211. 'incSell' => array
  212. (
  213. 'type' => 'update',
  214. 'where' => array
  215. (
  216. 'shop_id' => 'yes',
  217. 'goods_id' => 'yes',
  218. 'sku_id' => 'yes',
  219. ),
  220. 'set' => array
  221. (
  222. 'out_num' => array('yes', '+='),
  223. ),
  224. ),
  225. # 减少售出量
  226. 'decSell' => array
  227. (
  228. 'type' => 'update',
  229. 'where' => array
  230. (
  231. 'shop_id' => 'yes',
  232. 'goods_id' => 'yes',
  233. 'sku_id' => 'yes',
  234. ),
  235. 'set' => array
  236. (
  237. 'out_num' => array('yes', '-='),
  238. ),
  239. ),
  240. # 更新总库存
  241. 'updateTotal' => array
  242. (
  243. 'type' => 'update',
  244. 'where' => array
  245. (
  246. 'id' => 'yes',
  247. ),
  248. 'set' => array
  249. (
  250. 'in_num' => array('yes', '+='),
  251. ),
  252. ),
  253. # 增加总库存
  254. 'incTotal' => array
  255. (
  256. 'type' => 'update',
  257. 'where' => array
  258. (
  259. 'shop_id' => 'yes',
  260. 'goods_id' => 'yes',
  261. 'sku_id' => 'yes',
  262. ),
  263. 'set' => array
  264. (
  265. 'in_num' => array('yes', '+='),
  266. ),
  267. ),
  268. # 减少总库存
  269. 'decTotal' => array
  270. (
  271. 'type' => 'update',
  272. 'where' => array
  273. (
  274. 'shop_id' => 'yes',
  275. 'goods_id' => 'yes',
  276. 'sku_id' => 'yes',
  277. ),
  278. 'set' => array
  279. (
  280. 'in_num' => array('yes', '-='),
  281. ),
  282. ),
  283. ),
  284. );
  285. return $config;