info_sku.php 8.5 KB

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