goods_sku.php 7.3 KB

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