goods.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <?php
  2. return array
  3. (
  4. # 表名
  5. 'name' => 'goods',
  6. # 显示给用户看的名称
  7. 'lang' => '商品列表',
  8. 'order' => 10,
  9. 'menu' => false,
  10. 'end' => array
  11. (
  12. 'insert' => 'shop/lib/manage.goodsUpdate',
  13. 'update' => 'shop/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' => '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. 'shop_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_shop_id'),
  51. 'list' => 'Dever::load("shop/info-find#name", {shop_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}", "shop", "{shop_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. # 列表里的按钮
  132. 'list_button' => array
  133. (
  134. 'fast_list' => array('库存设置', '"info_sku&project=goods&goods_id={goods_id}&other=shop&other_id={shop_id}&page_type=1"', '{price_type} <= 3'),
  135. ),
  136. ),
  137. 'request' => array
  138. (
  139. # 更新售出量
  140. 'updateSell' => array
  141. (
  142. 'type' => 'update',
  143. 'where' => array
  144. (
  145. 'shop_id' => 'yes',
  146. 'goods_id' => 'yes',
  147. ),
  148. 'set' => array
  149. (
  150. 'sell_num' => array('yes', '+='),
  151. ),
  152. ),
  153. # 更新总库存
  154. 'updateTotal' => array
  155. (
  156. 'type' => 'update',
  157. 'where' => array
  158. (
  159. 'id' => 'yes',
  160. ),
  161. 'set' => array
  162. (
  163. 'total_num' => array('yes', '+='),
  164. ),
  165. ),
  166. # 获取单条数据
  167. 'getOne' => array
  168. (
  169. # 匹配的正则或函数 选填项
  170. 'option' => array
  171. (
  172. 'shop_id' => 'yes',
  173. 'goods_id' => 'yes',
  174. 'state' => 1,
  175. ),
  176. 'type' => 'one',
  177. 'col' => '*,total_num-sell_num as num',
  178. ),
  179. # 推荐列表
  180. 'getTop' => array
  181. (
  182. # 匹配的正则或函数 选填项
  183. 'option' => array
  184. (
  185. 'shop_id' => array('yes-t_1.shop_id'),
  186. 'hot' => array('yes-t_2.hot'),
  187. 'top' => array('yes-t_2.top'),
  188. 'status' => array('yes-t_2.status', 1),
  189. 'state' => array('yes-t_2.state', 1),
  190. ),
  191. # 联表
  192. 'join' => array
  193. (
  194. array
  195. (
  196. 'table' => 'goods/info',
  197. 'type' => 'left join',
  198. 'on' => array('goods_id','id'),
  199. 'col' => 'goods_id',
  200. ),
  201. ),
  202. 'type' => 'all',
  203. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  204. 'limit' => '0,6',
  205. 'col' => '*,t_2.*,t_1.total_num-t_1.sell_num as num,t_1.sell_num',
  206. ),
  207. 'getData' => array
  208. (
  209. # 匹配的正则或函数 选填项
  210. 'option' => array
  211. (
  212. 'shop_id' => array('yes-t_1.shop_id'),
  213. 'hot' => array('yes-t_2.hot'),
  214. 'top' => array('yes-t_2.top'),
  215. //'youhui' => array('yes-t_2.youhui'),
  216. 'name' => array('yes-t_2.name', 'like'),
  217. 'column' => array('yes-t_2.column_id', 'like'),
  218. 'category' => array('yes-t_2.category', 'like'),
  219. 'top_category_id' => array('yes-t_2.top_category_id'),
  220. 'second_category_id' => array('yes-t_2.second_category_id'),
  221. 'category_id' => array('yes-t_2.category_id'),
  222. 'status' => array('yes-t_2.status', 1),
  223. 'state' => array('yes-t_2.state', 1),
  224. ),
  225. # 联表
  226. 'join' => array
  227. (
  228. array
  229. (
  230. 'table' => 'goods/info',
  231. 'type' => 'left join',
  232. 'on' => array('goods_id','id'),
  233. 'col' => 'goods_id',
  234. ),
  235. ),
  236. 'type' => 'all',
  237. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  238. 'col' => '*,t_2.*,t_1.total_num-t_1.sell_num as num,t_1.sell_num',
  239. ),
  240. 'getDataPage' => array
  241. (
  242. # 匹配的正则或函数 选填项
  243. 'option' => array
  244. (
  245. 'shop_id' => array('yes-t_1.shop_id'),
  246. 'hot' => array('yes-t_2.hot'),
  247. 'top' => array('yes-t_2.top'),
  248. //'youhui' => array('yes-t_2.youhui'),
  249. 'name' => array('yes-t_2.name', 'like'),
  250. 'column' => array('yes-t_2.column_id', 'like'),
  251. 'category' => array('yes-t_2.category', 'like'),
  252. 'top_category_id' => array('yes-t_2.top_category_id'),
  253. 'second_category_id' => array('yes-t_2.second_category_id'),
  254. 'category_id' => array('yes-t_2.category_id'),
  255. 'status' => array('yes-t_2.status', 1),
  256. 'state' => array('yes-t_2.state', 1),
  257. ),
  258. # 联表
  259. 'join' => array
  260. (
  261. array
  262. (
  263. 'table' => 'goods/info',
  264. 'type' => 'left join',
  265. 'on' => array('goods_id','id'),
  266. 'col' => 'goods_id',
  267. ),
  268. ),
  269. 'type' => 'all',
  270. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  271. 'page' => array(10, 'list'),
  272. 'col' => '*,t_2.*,t_1.total_num-t_1.sell_num as num,t_1.sell_num',
  273. ),
  274. ),
  275. );