goods.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. 'value' => Dever::input('search_option_factory_id'),
  52. 'list' => 'Dever::load("factory/info-find#name", {factory_id})',
  53. ),
  54. 'goods_id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => '商品名称',
  58. 'default' => '',
  59. 'desc' => '商品名称',
  60. 'match' => 'is_numeric',
  61. 'update' => 'select',
  62. 'update_search' => 'goods/lib/manage.search',
  63. 'list' => 'Dever::load("goods/info-find#name", {goods_id})',
  64. ),
  65. 'category_id' => array
  66. (
  67. 'type' => 'int-11',
  68. 'name' => '分类id',
  69. 'default' => '',
  70. 'desc' => '分类id',
  71. 'match' => 'is_numeric',
  72. ),
  73. 'price_type' => array
  74. (
  75. 'type' => 'int-11',
  76. 'name' => '价格类型',
  77. 'default' => '0',
  78. 'desc' => '价格类型',
  79. 'match' => 'is_numeric',
  80. 'table' => 'goods/info',
  81. ),
  82. 'p_price' => array
  83. (
  84. 'type' => 'varchar-100',
  85. 'name' => '出厂价',
  86. 'default' => '0',
  87. 'desc' => '出厂价',
  88. 'match' => 'option',
  89. 'update' => Dever::input('col') ? 'text' : 'hidden',
  90. 'list' => 'Dever::load("goods/lib/sku.table", "{goods_id}", "factory", "{factory_id}", false, false)',
  91. ),
  92. 'sell_num' => array
  93. (
  94. 'type' => 'int-11',
  95. 'name' => '销量',
  96. 'default' => '0',
  97. 'desc' => '请填写销量',
  98. 'match' => 'option',
  99. 'search' => 'order',
  100. //'list' => true,
  101. ),
  102. 'status' => array
  103. (
  104. 'type' => 'tinyint-1',
  105. 'name' => '状态',
  106. 'default' => '2',
  107. 'desc' => '状态',
  108. 'match' => 'is_numeric',
  109. //'update' => 'select',
  110. 'option' => $status,
  111. 'search' => 'select',
  112. 'list' => true,
  113. //'edit' => true,
  114. ),
  115. 'state' => array
  116. (
  117. 'type' => 'tinyint-1',
  118. 'name' => '状态',
  119. 'default' => '1',
  120. 'desc' => '请选择状态',
  121. 'match' => 'is_numeric',
  122. ),
  123. 'cdate' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '创建时间',
  127. 'match' => array('is_numeric', time()),
  128. 'desc' => '',
  129. # 只有insert时才生效
  130. //'insert' => true,
  131. 'search' => 'date',
  132. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  133. ),
  134. ),
  135. 'alter' => array
  136. (
  137. 2 => array
  138. (
  139. array('update', 'p_price', 'p_price', 'varchar-100 0 出厂价'),
  140. ),
  141. 'version' => 2,
  142. ),
  143. 'manage' => array
  144. (
  145. 'insert' => false,
  146. 'edit' => false,
  147. 'delete' => false,
  148. # 列表里的按钮
  149. 'list_button' => array
  150. (
  151. //'edit' => array('设置出厂价', 'p_price', '{price_type} == 1'),
  152. //'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"'),
  153. 'fast_list' => array('设置出厂价', '"info_sku&project=goods&goods_id={goods_id}&other=factory&other_id={factory_id}&page_type=1"'),
  154. ),
  155. ),
  156. 'request' => array
  157. (
  158. 'getIds' => array
  159. (
  160. # 匹配的正则或函数 选填项
  161. 'option' => array
  162. (
  163. 'factory_id' => 'yes',
  164. 'state' => 1,
  165. ),
  166. 'type' => 'all',
  167. 'order' => array('id' => 'desc'),
  168. 'col' => '*|goods_id',
  169. ),
  170. # 更新售出量
  171. 'incSell' => array
  172. (
  173. 'type' => 'update',
  174. 'where' => array
  175. (
  176. 'factory_id' => 'yes',
  177. 'goods_id' => 'yes',
  178. ),
  179. 'set' => array
  180. (
  181. 'sell_num' => array('yes', '+='),
  182. ),
  183. ),
  184. ),
  185. );