goods_sku.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'goods_sku',
  6. # 显示给用户看的名称
  7. 'lang' => '商品价格设置',
  8. 'order' => 200,
  9. 'menu' => false,
  10. # 数据结构 不同的字段放这里
  11. 'struct' => array
  12. (
  13. 'id' => array
  14. (
  15. 'type' => 'int-11',
  16. 'name' => 'ID',
  17. 'default' => '',
  18. 'desc' => '',
  19. 'match' => 'is_numeric',
  20. //'list' => true,
  21. ),
  22. 'factory_id' => array
  23. (
  24. 'type' => 'int-11',
  25. 'name' => '所属工厂',
  26. 'default' => '',
  27. 'desc' => '所属工厂',
  28. 'match' => 'is_numeric',
  29. 'list' => 'Dever::load("factory/info-find#name", {factory_id})',
  30. ),
  31. 'goods_id' => array
  32. (
  33. 'type' => 'int-11',
  34. 'name' => '商品名称',
  35. 'default' => '',
  36. 'desc' => '商品名称',
  37. 'match' => 'is_numeric',
  38. 'list' => 'Dever::load("goods/info-find#name", {goods_id})',
  39. ),
  40. 'sku_id' => array
  41. (
  42. 'type' => 'int-11',
  43. 'name' => 'sku_id',
  44. 'default' => '-1',
  45. 'desc' => 'sku_id',
  46. 'match' => 'is_numeric',
  47. ),
  48. 'p_price' => array
  49. (
  50. 'type' => 'decimal-10,2',
  51. 'name' => '出厂价',
  52. 'default' => '0',
  53. 'desc' => '出厂价',
  54. 'match' => 'option',
  55. 'update' => 'text',
  56. ),
  57. 'sell_num' => array
  58. (
  59. 'type' => 'int-11',
  60. 'name' => '销量',
  61. 'default' => '0',
  62. 'desc' => '请填写销量',
  63. 'match' => 'option',
  64. 'search' => 'order',
  65. //'list' => true,
  66. ),
  67. 'reorder' => array
  68. (
  69. 'type' => 'int-11',
  70. 'name' => '排序-数值越大越靠前,相当于置顶',
  71. 'default' => '1',
  72. 'desc' => '请输入排序',
  73. 'match' => 'option',
  74. //'update' => 'text',
  75. 'search' => 'order',
  76. 'list' => true,
  77. 'order' => 'desc',
  78. 'edit' => true,
  79. ),
  80. 'state' => array
  81. (
  82. 'type' => 'tinyint-1',
  83. 'name' => '数据状态',
  84. 'default' => '1',
  85. 'desc' => '请选择状态',
  86. 'match' => 'is_numeric',
  87. ),
  88. 'cdate' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '发布时间',
  92. 'match' => array('is_numeric', time()),
  93. 'desc' => '',
  94. # 只有insert时才生效
  95. 'insert' => true,
  96. //'search' => 'date',
  97. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  98. ),
  99. ),
  100. 'manage' => array
  101. (
  102. 'insert' => false,
  103. 'edit' => false,
  104. 'delete' => false,
  105. 'num' => false,
  106. 'page_list_table' => 'sku',
  107. # 自定义快捷新增和编辑
  108. 'button' => array
  109. (
  110. //'自定义属性' => array('fast', 1, 'config&where_id=1'),
  111. ),
  112. ),
  113. # request 请求接口定义
  114. 'request' => array
  115. (
  116. # 更新售出量
  117. 'incSell' => array
  118. (
  119. 'type' => 'update',
  120. 'where' => array
  121. (
  122. 'factory_id' => 'yes',
  123. 'goods_id' => 'yes',
  124. 'sku_id' => 'yes',
  125. ),
  126. 'set' => array
  127. (
  128. 'sell_num' => array('yes', '+='),
  129. ),
  130. ),
  131. # 列表
  132. 'getData' => array
  133. (
  134. # 匹配的正则或函数 选填项
  135. 'option' => array
  136. (
  137. 'factory_id' => 'yes',
  138. 'sku_id' => 'yes',
  139. 'goods_id' => 'yes',
  140. 'state' => 1,
  141. ),
  142. 'type' => 'all',
  143. 'order' => array('id' => 'desc'),
  144. 'col' => '*|sku_id',
  145. ),
  146. # 获取单条数据
  147. 'getOne' => array
  148. (
  149. # 匹配的正则或函数 选填项
  150. 'option' => array
  151. (
  152. 'factory_id' => 'yes',
  153. 'sku_id' => 'yes',
  154. 'goods_id' => 'yes',
  155. 'state' => 1,
  156. ),
  157. 'type' => 'one',
  158. 'col' => '*',
  159. ),
  160. 'getMinOne' => array
  161. (
  162. # 匹配的正则或函数 选填项
  163. 'option' => array
  164. (
  165. 'factory_id' => 'yes',
  166. 'sku_id' => 'yes',
  167. 'goods_id' => 'yes',
  168. 'state' => 1,
  169. ),
  170. 'type' => 'one',
  171. 'order' => array('price' => 'asc', 'id' => 'desc'),
  172. 'col' => '*',
  173. ),
  174. 'getMaxOne' => array
  175. (
  176. # 匹配的正则或函数 选填项
  177. 'option' => array
  178. (
  179. 'factory_id' => 'yes',
  180. 'sku_id' => 'yes',
  181. 'goods_id' => 'yes',
  182. 'state' => 1,
  183. ),
  184. 'type' => 'one',
  185. 'order' => array('price' => 'desc', 'id' => 'desc'),
  186. 'col' => '*',
  187. ),
  188. ),
  189. );
  190. return $config;