goods.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <?php
  2. return array
  3. (
  4. # 表名
  5. 'name' => 'goods',
  6. # 显示给用户看的名称
  7. 'lang' => '商品列表',
  8. 'order' => 10,
  9. 'menu' => false,
  10. 'ends' => array
  11. (
  12. 'insert' => 'store/lib/manage.goodsUpdate',
  13. 'update' => 'store/lib/manage.goodsUpdate',
  14. ),
  15. 'fill' => array
  16. (
  17. # 从哪个表填充
  18. 'goods/info' => array
  19. (
  20. # 条件,另外一个表的字段 => 本表的字段
  21. 'where' => array('id' => 'goods_id'),
  22. # 要填充的数据,另外一个表的字段 => 本表的字段,如果不填写就是所有的
  23. 'update' => array('price_type'),
  24. # 不需要填充的字段 与update互斥
  25. //'no' => array('id', 'seller_id', 'service_id', 'chose', 'state', 'cdate')
  26. )
  27. ),
  28. # 数据结构
  29. 'struct' => array
  30. (
  31. 'id' => array
  32. (
  33. 'type' => 'int-11',
  34. 'name' => 'ID',
  35. 'default' => '',
  36. 'desc' => '',
  37. 'match' => 'is_numeric',
  38. 'search' => 'order',
  39. 'update' => 'hidden',
  40. //'list' => true,
  41. ),
  42. 'store_id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '所属仓库',
  46. 'default' => '',
  47. 'desc' => '所属仓库',
  48. 'match' => 'is_numeric',
  49. 'update' => 'hidden',
  50. 'value' => Dever::input('search_option_store_id'),
  51. 'list' => 'Dever::load("store/info-find#name", {store_id})',
  52. ),
  53. 'goods_id' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '商品名称',
  57. 'default' => '',
  58. 'desc' => '商品名称',
  59. 'match' => 'is_numeric',
  60. 'update' => 'select',
  61. 'update_search' => 'goods/lib/manage.search',
  62. 'list' => 'Dever::load("goods/info-find#name", {goods_id})',
  63. ),
  64. 'category_id' => array
  65. (
  66. 'type' => 'int-11',
  67. 'name' => '分类id',
  68. 'default' => '',
  69. 'desc' => '分类id',
  70. 'match' => 'is_numeric',
  71. ),
  72. 'price_type' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '价格类型',
  76. 'default' => '1',
  77. 'desc' => '价格类型',
  78. 'match' => 'is_numeric',
  79. ),
  80. 'add_num' => array
  81. (
  82. 'type' => 'int-11',
  83. 'name' => '新增库存-输入小于0的数字,则为减少库存',
  84. 'default' => '0',
  85. 'desc' => '新增库存',
  86. 'match' => 'is_numeric',
  87. 'update' => Dever::input('col') ? 'text' : 'hidden',
  88. 'list_name' => '当前库存',
  89. 'list' => 'Dever::load("goods/lib/sku.table", "{goods_id}", "store", "{store_id}", false, false)',
  90. ),
  91. 'total_num' => array
  92. (
  93. 'type' => 'int-11',
  94. 'name' => '总库存',
  95. 'default' => '0',
  96. 'desc' => '总库存',
  97. 'match' => 'is_numeric',
  98. ),
  99. 'sell_num' => array
  100. (
  101. 'type' => 'int-11',
  102. 'name' => '销量',
  103. 'default' => '0',
  104. 'desc' => '请填写销量',
  105. 'match' => 'option',
  106. 'search' => 'order',
  107. //'list' => true,
  108. ),
  109. 'state' => array
  110. (
  111. 'type' => 'tinyint-1',
  112. 'name' => '状态',
  113. 'default' => '1',
  114. 'desc' => '请选择状态',
  115. 'match' => 'is_numeric',
  116. ),
  117. 'cdate' => array
  118. (
  119. 'type' => 'int-11',
  120. 'name' => '创建时间',
  121. 'match' => array('is_numeric', time()),
  122. 'desc' => '',
  123. # 只有insert时才生效
  124. //'insert' => true,
  125. 'search' => 'date',
  126. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  127. ),
  128. ),
  129. 'manage' => array
  130. (
  131. 'insert' => false,
  132. 'edit' => false,
  133. 'delete' => false,
  134. # 列表里的按钮
  135. 'list_button' => array
  136. (
  137. //'fast_list' => array('库存设置', '"info_sku&project=goods&goods_id={goods_id}&other=store&other_id={store_id}&page_type=1"'),
  138. ),
  139. ),
  140. 'request' => array
  141. (
  142. # 更新售出量
  143. 'incSell' => array
  144. (
  145. 'type' => 'update',
  146. 'where' => array
  147. (
  148. 'store_id' => 'yes',
  149. 'goods_id' => 'yes',
  150. ),
  151. 'set' => array
  152. (
  153. 'sell_num' => array('yes', '+='),
  154. ),
  155. ),
  156. # 减少售出量
  157. 'decSell' => array
  158. (
  159. 'type' => 'update',
  160. 'where' => array
  161. (
  162. 'store_id' => 'yes',
  163. 'goods_id' => 'yes',
  164. ),
  165. 'set' => array
  166. (
  167. 'sell_num' => array('yes', '-='),
  168. ),
  169. ),
  170. # 更新总库存
  171. 'updateTotal' => array
  172. (
  173. 'type' => 'update',
  174. 'where' => array
  175. (
  176. 'id' => 'yes',
  177. ),
  178. 'set' => array
  179. (
  180. 'total_num' => array('yes', '+='),
  181. ),
  182. ),
  183. # 增加总库存
  184. 'incTotal' => array
  185. (
  186. 'type' => 'update',
  187. 'where' => array
  188. (
  189. 'store_id' => 'yes',
  190. 'goods_id' => 'yes',
  191. ),
  192. 'set' => array
  193. (
  194. 'total_num' => array('yes', '+='),
  195. ),
  196. ),
  197. # 减少总库存
  198. 'decTotal' => array
  199. (
  200. 'type' => 'update',
  201. 'where' => array
  202. (
  203. 'store_id' => 'yes',
  204. 'goods_id' => 'yes',
  205. ),
  206. 'set' => array
  207. (
  208. 'total_num' => array('yes', '-='),
  209. ),
  210. ),
  211. # 获取单条数据
  212. 'getOne' => array
  213. (
  214. # 匹配的正则或函数 选填项
  215. 'option' => array
  216. (
  217. 'store_id' => 'yes',
  218. 'goods_id' => 'yes',
  219. 'state' => 1,
  220. ),
  221. 'type' => 'one',
  222. 'col' => '*,total_num-sell_num as num',
  223. ),
  224. 'getData' => array
  225. (
  226. # 匹配的正则或函数 选填项
  227. 'option' => array
  228. (
  229. 'top' => array('yes-t_2.top'),
  230. 'youhui' => array('yes-t_2.youhui'),
  231. 'category' => array('yes-t_2.category', 'like'),
  232. 'top_category_id' => array('yes-t_2.top_category_id'),
  233. 'second_category_id' => array('yes-t_2.second_category_id'),
  234. 'category_id' => array('yes-t_2.category_id'),
  235. 'status' => array('yes-t_2.status', 1),
  236. 'state' => array('yes-t_2.state', 1),
  237. ),
  238. # 联表
  239. 'join' => array
  240. (
  241. array
  242. (
  243. 'table' => 'goods/info',
  244. 'type' => 'left join',
  245. 'on' => array('goods_id','id'),
  246. 'col' => 'goods_id',
  247. ),
  248. ),
  249. 'type' => 'all',
  250. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  251. 'col' => '*,t_2.*,t_1.total_num-t_1.sell_num as num,t_1.sell_num',
  252. ),
  253. ),
  254. );