goods.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <?php
  2. $status = Dever::config('base')->status;
  3. return array
  4. (
  5. # 表名
  6. 'name' => 'goods',
  7. # 显示给用户看的名称
  8. 'lang' => '商品列表',
  9. 'order' => 10,
  10. 'menu' => false,
  11. 'ends' => array
  12. (
  13. 'insert' => 'factory/lib/manage.goodsUpdate',
  14. 'update' => 'factory/lib/manage.goodsUpdate',
  15. ),
  16. 'fill' => array
  17. (
  18. # 从哪个表填充
  19. 'goods/info' => array
  20. (
  21. # 条件,另外一个表的字段 => 本表的字段
  22. 'where' => array('id' => 'goods_id'),
  23. # 要填充的数据,另外一个表的字段 => 本表的字段,如果不填写就是所有的
  24. 'update' => array('price_type' => 'price_type', 'status' => 'status'),
  25. # 不需要填充的字段 与update互斥
  26. //'no' => array('id', 'seller_id', 'service_id', 'chose', 'state', 'cdate')
  27. )
  28. ),
  29. # 数据结构
  30. 'struct' => array
  31. (
  32. 'id' => array
  33. (
  34. 'type' => 'int-11',
  35. 'name' => 'ID',
  36. 'default' => '',
  37. 'desc' => '',
  38. 'match' => 'is_numeric',
  39. 'search' => 'order',
  40. 'update' => 'hidden',
  41. //'list' => true,
  42. ),
  43. 'factory_id' => array
  44. (
  45. 'type' => 'int-11',
  46. 'name' => '所属工厂',
  47. 'default' => '',
  48. 'desc' => '所属工厂',
  49. 'match' => 'is_numeric',
  50. 'update' => 'hidden',
  51. 'search' => 'hidden',
  52. 'value' => Dever::input('search_option_factory_id'),
  53. 'list' => 'Dever::load("factory/info-find#name", {factory_id})',
  54. ),
  55. 'goods_id' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => '商品名称',
  59. 'default' => '',
  60. 'desc' => '商品名称',
  61. 'match' => 'is_numeric',
  62. 'update' => 'select',
  63. 'update_search' => 'goods/lib/manage.search',
  64. 'list' => 'Dever::load("goods/info-find#name", {goods_id})',
  65. ),
  66. 'category_id' => array
  67. (
  68. 'type' => 'int-11',
  69. 'name' => '分类id',
  70. 'default' => '',
  71. 'desc' => '分类id',
  72. 'match' => 'is_numeric',
  73. ),
  74. 'price_type' => array
  75. (
  76. 'type' => 'int-11',
  77. 'name' => '价格类型',
  78. 'default' => '0',
  79. 'desc' => '价格类型',
  80. 'match' => 'is_numeric',
  81. 'table' => 'goods/info',
  82. ),
  83. 'p_price' => array
  84. (
  85. 'type' => 'varchar-100',
  86. 'name' => '出厂价',
  87. 'default' => '0',
  88. 'desc' => '出厂价',
  89. 'match' => 'option',
  90. 'update' => Dever::input('col') ? 'text' : 'hidden',
  91. 'list' => 'Dever::load("goods/lib/sku.table", "{goods_id}", "factory", "{factory_id}", false, false)',
  92. ),
  93. 'sell_num' => array
  94. (
  95. 'type' => 'float-11,2',
  96. 'name' => '销量',
  97. 'default' => '0',
  98. 'desc' => '请填写销量',
  99. 'match' => 'option',
  100. 'search' => 'order',
  101. //'list' => true,
  102. ),
  103. 'status' => array
  104. (
  105. 'type' => 'tinyint-1',
  106. 'name' => '状态',
  107. 'default' => '2',
  108. 'desc' => '状态',
  109. 'match' => 'is_numeric',
  110. //'update' => 'select',
  111. 'option' => $status,
  112. 'search' => 'select',
  113. 'list' => true,
  114. //'edit' => true,
  115. ),
  116. 'state' => array
  117. (
  118. 'type' => 'tinyint-1',
  119. 'name' => '状态',
  120. 'default' => '1',
  121. 'desc' => '请选择状态',
  122. 'match' => 'is_numeric',
  123. ),
  124. 'cdate' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '创建时间',
  128. 'match' => array('is_numeric', time()),
  129. 'desc' => '',
  130. # 只有insert时才生效
  131. //'insert' => true,
  132. 'search' => 'date',
  133. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  134. ),
  135. ),
  136. 'alter' => array
  137. (
  138. 3 => array
  139. (
  140. array('update', 'p_price', 'p_price', 'varchar-100 0 出厂价'),
  141. array('update', 'sell_num', 'sell_num', 'float-11,2 0 销量'),
  142. ),
  143. 'version' => 3,
  144. ),
  145. 'manage' => array
  146. (
  147. 'insert' => false,
  148. 'edit' => false,
  149. 'delete' => false,
  150. # 列表里的按钮
  151. 'list_button' => array
  152. (
  153. //'edit' => array('设置出厂价', 'p_price', '{price_type} == 1'),
  154. //'fast_list' => array('设置出厂价', '"goods_sku&project=factory&search_option_goods_id={goods_id}&search_option_factory_id={factory_id}&oper_parent=goods&oper_project=factory&top_table=info&oper_save_jump=goods&page_type=1"'),
  155. 'fast_list' => array('设置出厂价', '"info_sku&project=goods&goods_id={goods_id}&other=factory&other_id={factory_id}&page_type=1"'),
  156. ),
  157. ),
  158. 'request' => array
  159. (
  160. 'getIds' => array
  161. (
  162. # 匹配的正则或函数 选填项
  163. 'option' => array
  164. (
  165. 'factory_id' => 'yes',
  166. 'state' => 1,
  167. ),
  168. 'type' => 'all',
  169. 'order' => array('id' => 'desc'),
  170. 'col' => '*|goods_id',
  171. ),
  172. # 更新售出量
  173. 'incSell' => array
  174. (
  175. 'type' => 'update',
  176. 'where' => array
  177. (
  178. 'factory_id' => 'yes',
  179. 'goods_id' => 'yes',
  180. ),
  181. 'set' => array
  182. (
  183. 'sell_num' => array('yes', '+='),
  184. ),
  185. ),
  186. ),
  187. );