goods_sku.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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' => 'varchar-100',
  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. 'alter' => array
  101. (
  102. 2 => array
  103. (
  104. array('update', 'p_price', 'p_price', 'varchar-100 0 出厂价'),
  105. ),
  106. 'version' => 2,
  107. ),
  108. 'manage' => array
  109. (
  110. 'insert' => false,
  111. 'edit' => false,
  112. 'delete' => false,
  113. 'num' => false,
  114. 'page_list_table' => 'sku',
  115. # 自定义快捷新增和编辑
  116. 'button' => array
  117. (
  118. //'自定义属性' => array('fast', 1, 'config&where_id=1'),
  119. ),
  120. ),
  121. # request 请求接口定义
  122. 'request' => array
  123. (
  124. 'getDataPage' => array
  125. (
  126. # 匹配的正则或函数 选填项
  127. 'option' => array
  128. (
  129. 'factory_id' => array('yes-t_1.factory_id'),
  130. 'name' => array('yes-t_2.name', 'like'),
  131. 'sell_num' => array('yes', '<'),
  132. 'column' => array('yes-t_2.column_id', 'like'),
  133. 'category' => array('yes-t_2.category', 'like'),
  134. 'top_category_id' => array('yes-t_2.top_category_id'),
  135. 'second_category_id' => array('yes-t_2.second_category_id'),
  136. 'category_id' => array('yes-t_2.category_id'),
  137. 'status' => array('yes-t_2.status', 1),
  138. 'state' => array('yes-t_2.state', 1),
  139. 'state_1' => array('yes-t_1.state', 1),
  140. ),
  141. # 联表
  142. 'join' => array
  143. (
  144. array
  145. (
  146. 'table' => 'goods/info',
  147. 'type' => 'left join',
  148. 'on' => array('goods_id','id'),
  149. 'col' => 'goods_id',
  150. ),
  151. ),
  152. 'type' => 'all',
  153. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc', 't_1.p_price' => 'asc'),
  154. //'page' => array(30, 'list'),
  155. 'col' => '*,t_2.name,t_2.cover,t_2.id as id,t_1.sell_num',
  156. ),
  157. # 更新售出量
  158. 'incSell' => array
  159. (
  160. 'type' => 'update',
  161. 'where' => array
  162. (
  163. 'factory_id' => 'yes',
  164. 'goods_id' => 'yes',
  165. 'sku_id' => 'yes',
  166. ),
  167. 'set' => array
  168. (
  169. 'sell_num' => array('yes', '+='),
  170. ),
  171. ),
  172. # 列表
  173. 'getData' => array
  174. (
  175. # 匹配的正则或函数 选填项
  176. 'option' => array
  177. (
  178. 'factory_id' => 'yes',
  179. 'sku_id' => 'yes',
  180. 'goods_id' => 'yes',
  181. 'state' => 1,
  182. ),
  183. 'type' => 'all',
  184. 'order' => array('id' => 'desc'),
  185. 'col' => '*|sku_id',
  186. ),
  187. # 获取单条数据
  188. 'getOne' => array
  189. (
  190. # 匹配的正则或函数 选填项
  191. 'option' => array
  192. (
  193. 'factory_id' => 'yes',
  194. 'sku_id' => 'yes',
  195. 'goods_id' => 'yes',
  196. 'state' => 1,
  197. ),
  198. 'type' => 'one',
  199. 'col' => '*',
  200. ),
  201. 'getMinOne' => array
  202. (
  203. # 匹配的正则或函数 选填项
  204. 'option' => array
  205. (
  206. 'factory_id' => 'yes',
  207. 'sku_id' => 'yes',
  208. 'goods_id' => 'yes',
  209. 'state' => 1,
  210. ),
  211. 'type' => 'one',
  212. 'order' => array('price' => 'asc', 'id' => 'desc'),
  213. 'col' => '*',
  214. ),
  215. 'getMaxOne' => array
  216. (
  217. # 匹配的正则或函数 选填项
  218. 'option' => array
  219. (
  220. 'factory_id' => 'yes',
  221. 'sku_id' => 'yes',
  222. 'goods_id' => 'yes',
  223. 'state' => 1,
  224. ),
  225. 'type' => 'one',
  226. 'order' => array('price' => 'desc', 'id' => 'desc'),
  227. 'col' => '*',
  228. ),
  229. ),
  230. );
  231. return $config;