info_sku.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <?php
  2. $type = array
  3. (
  4. 1 => '普通属性',
  5. 2 => '组合属性',
  6. 3 => '单选属性',
  7. );
  8. $config = array
  9. (
  10. # 表名
  11. 'name' => 'info_sku',
  12. # 显示给用户看的名称
  13. 'lang' => '商品价格设置',
  14. 'order' => 200,
  15. 'menu' => false,
  16. # 数据结构 不同的字段放这里
  17. 'struct' => array
  18. (
  19. 'id' => array
  20. (
  21. 'type' => 'int-11',
  22. 'name' => 'ID',
  23. 'default' => '',
  24. 'desc' => '',
  25. 'match' => 'is_numeric',
  26. //'list' => true,
  27. ),
  28. 'info_id' => array
  29. (
  30. 'type' => 'int-11',
  31. 'name' => '商品ID',
  32. 'default' => '',
  33. 'desc' => '商品ID',
  34. 'match' => 'is_numeric',
  35. 'update' => 'text',
  36. 'list' => true,
  37. ),
  38. 'key' => array
  39. (
  40. 'type' => 'varchar-100',
  41. 'name' => '属性标识',
  42. 'default' => '-1',
  43. 'desc' => '属性标识',
  44. 'match' => 'is_string',
  45. 'update' => 'text',
  46. ),
  47. 'attr' => array
  48. (
  49. 'type' => 'text-255',
  50. 'name' => '属性组合规则',
  51. 'default' => '',
  52. 'desc' => '属性组合规则',
  53. 'match' => 'is_string',
  54. 'update' => 'textarea',
  55. 'list' => true,
  56. ),
  57. 'type' => array
  58. (
  59. 'type' => 'tinyint-1',
  60. 'name' => '属性类型',
  61. 'default' => '2',
  62. 'desc' => '属性类型',
  63. 'match' => 'is_numeric',
  64. 'update' => 'radio',
  65. 'option' => $type,
  66. ),
  67. 'price' => array
  68. (
  69. 'type' => 'decimal-10,2',
  70. 'name' => '销售价',
  71. 'default' => '',
  72. 'desc' => '销售价',
  73. 'match' => 'option',
  74. 'update' => 'text',
  75. 'list' => true,
  76. ),
  77. 's_price' => array
  78. (
  79. 'type' => 'decimal-10,2',
  80. 'name' => '市场价',
  81. 'default' => '',
  82. 'desc' => '市场价',
  83. 'match' => 'option',
  84. 'update' => 'text',
  85. 'list' => true,
  86. ),
  87. 'f_price' => array
  88. (
  89. 'type' => 'decimal-10,2',
  90. 'name' => '采购价',
  91. 'default' => '',
  92. 'desc' => '采购价',
  93. 'match' => 'option',
  94. 'update' => 'text',
  95. 'list' => true,
  96. ),
  97. 'num' => array
  98. (
  99. 'type' => 'int-11',
  100. 'name' => '库存',
  101. 'default' => '',
  102. 'desc' => '库存',
  103. 'match' => 'is_string',
  104. 'update' => 'text',
  105. 'list' => true,
  106. ),
  107. 'sell_num' => array
  108. (
  109. 'type' => 'int-11',
  110. 'name' => '销量',
  111. 'default' => '0',
  112. 'desc' => '请填写销量',
  113. 'match' => 'option',
  114. 'search' => 'order',
  115. 'list' => true,
  116. ),
  117. 'reorder' => array
  118. (
  119. 'type' => 'int-11',
  120. 'name' => '排序-数值越大越靠前,相当于置顶',
  121. 'default' => '1',
  122. 'desc' => '请输入排序',
  123. 'match' => 'option',
  124. //'update' => 'text',
  125. 'search' => 'order',
  126. 'list' => true,
  127. 'order' => 'desc',
  128. 'edit' => true,
  129. ),
  130. 'state' => array
  131. (
  132. 'type' => 'tinyint-1',
  133. 'name' => '数据状态',
  134. 'default' => '1',
  135. 'desc' => '请选择状态',
  136. 'match' => 'is_numeric',
  137. ),
  138. 'cdate' => array
  139. (
  140. 'type' => 'int-11',
  141. 'name' => '发布时间',
  142. 'match' => array('is_numeric', time()),
  143. 'desc' => '',
  144. # 只有insert时才生效
  145. 'insert' => true,
  146. //'search' => 'date',
  147. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  148. ),
  149. ),
  150. 'manage' => array
  151. (
  152. 'insert' => false,
  153. 'edit' => false,
  154. 'delete' => false,
  155. 'num' => false,
  156. 'page_list_table' => 'sku',
  157. # 自定义快捷新增和编辑
  158. 'button' => array
  159. (
  160. //'自定义属性' => array('fast', 1, 'config&where_id=1'),
  161. ),
  162. ),
  163. # request 请求接口定义
  164. 'request' => array
  165. (
  166. # 后台搜索用到 也可以不加,自动生成
  167. 'search' => array
  168. (
  169. # 匹配的正则或函数 选填项
  170. 'option' => array
  171. (
  172. 'ids' => array('yes-id', 'in'),
  173. 'info_id' => 'yes',
  174. 'id' => 'yes',
  175. 'state' => 1,
  176. ),
  177. 'type' => 'all',
  178. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  179. 'limit' => '0,10',
  180. 'col' => 'key as name, id, id as value, "" as selected, "" as disabled|id',
  181. ),
  182. # 列表
  183. 'getData' => array
  184. (
  185. # 匹配的正则或函数 选填项
  186. 'option' => array
  187. (
  188. 'info_id' => 'yes',
  189. 'state' => 1,
  190. ),
  191. 'type' => 'all',
  192. 'order' => array('id' => 'desc'),
  193. 'col' => 'id,info_id,`key`,price,s_price,type',
  194. ),
  195. # 列表
  196. 'getDataByKeys' => array
  197. (
  198. # 匹配的正则或函数 选填项
  199. 'option' => array
  200. (
  201. 'info_id' => 'yes',
  202. 'state' => 1,
  203. ),
  204. 'type' => 'all',
  205. 'order' => array('id' => 'desc'),
  206. 'col' => 'id,info_id,`key`,price,s_price,f_price|key',
  207. ),
  208. # 获取单条数据
  209. 'getOne' => array
  210. (
  211. # 匹配的正则或函数 选填项
  212. 'option' => array
  213. (
  214. 'info_id' => 'yes',
  215. 'state' => 1,
  216. ),
  217. 'type' => 'one',
  218. 'col' => 'id,info_id,price,s_price,f_price',
  219. ),
  220. 'getMinOne' => array
  221. (
  222. # 匹配的正则或函数 选填项
  223. 'option' => array
  224. (
  225. 'info_id' => 'yes',
  226. 'state' => 1,
  227. ),
  228. 'type' => 'one',
  229. 'order' => array('price' => 'asc', 'id' => 'desc'),
  230. 'col' => 'id,info_id,price,s_price',
  231. ),
  232. 'getMaxOne' => array
  233. (
  234. # 匹配的正则或函数 选填项
  235. 'option' => array
  236. (
  237. 'info_id' => 'yes',
  238. 'state' => 1,
  239. ),
  240. 'type' => 'one',
  241. 'order' => array('price' => 'desc', 'id' => 'desc'),
  242. 'col' => 'id,info_id,price,s_price',
  243. ),
  244. # 更新售出量
  245. 'updateSell' => array
  246. (
  247. 'type' => 'update',
  248. 'where' => array
  249. (
  250. 'id' => 'yes',
  251. ),
  252. 'set' => array
  253. (
  254. 'sell_num' => array('yes', '+='),
  255. ),
  256. ),
  257. ),
  258. );
  259. return $config;