info_sku.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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. 'c_price' => array
  105. (
  106. 'type' => 'varchar-100',
  107. 'name' => '成本价',
  108. 'default' => '',
  109. 'desc' => '成本价',
  110. 'match' => 'option',
  111. 'update' => 'text',
  112. //'list' => true,
  113. ),
  114. 'min' => array
  115. (
  116. 'type' => 'int-11',
  117. 'name' => '起购数',
  118. 'default' => '1',
  119. 'desc' => '起购数',
  120. 'match' => 'is_string',
  121. 'update' => 'text',
  122. 'list' => true,
  123. ),
  124. 'num' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '库存',
  128. 'default' => '',
  129. 'desc' => '库存',
  130. 'match' => 'is_string',
  131. 'update' => 'text',
  132. 'list' => true,
  133. ),
  134. 'sell_num' => array
  135. (
  136. 'type' => 'int-11',
  137. 'name' => '销量',
  138. 'default' => '0',
  139. 'desc' => '请填写销量',
  140. 'match' => 'option',
  141. 'search' => 'order',
  142. 'list' => true,
  143. ),
  144. 'reorder' => array
  145. (
  146. 'type' => 'int-11',
  147. 'name' => '排序-数值越大越靠前,相当于置顶',
  148. 'default' => '1',
  149. 'desc' => '请输入排序',
  150. 'match' => 'option',
  151. //'update' => 'text',
  152. 'search' => 'order',
  153. 'list' => true,
  154. 'order' => 'desc',
  155. 'edit' => true,
  156. ),
  157. 'state' => array
  158. (
  159. 'type' => 'tinyint-1',
  160. 'name' => '数据状态',
  161. 'default' => '1',
  162. 'desc' => '请选择状态',
  163. 'match' => 'is_numeric',
  164. ),
  165. 'cdate' => array
  166. (
  167. 'type' => 'int-11',
  168. 'name' => '发布时间',
  169. 'match' => array('is_numeric', time()),
  170. 'desc' => '',
  171. # 只有insert时才生效
  172. 'insert' => true,
  173. //'search' => 'date',
  174. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  175. ),
  176. ),
  177. 'alter' => array
  178. (
  179. 2 => array
  180. (
  181. array('update', 'price', 'price', 'varchar-100 0 销售价'),
  182. array('update', 's_price', 's_price', 'varchar-100 0 市场价'),
  183. array('update', 'f_price', 'f_price', 'varchar-100 0 采购价'),
  184. ),
  185. 'version' => 2,
  186. ),
  187. 'manage' => array
  188. (
  189. 'insert' => false,
  190. 'edit' => false,
  191. 'delete' => false,
  192. 'num' => false,
  193. 'page_list_table' => 'sku',
  194. # 自定义快捷新增和编辑
  195. 'button' => array
  196. (
  197. //'自定义属性' => array('fast', 1, 'config&where_id=1'),
  198. ),
  199. ),
  200. # request 请求接口定义
  201. 'request' => array
  202. (
  203. # 后台搜索用到 也可以不加,自动生成
  204. 'search' => array
  205. (
  206. # 匹配的正则或函数 选填项
  207. 'option' => array
  208. (
  209. 'ids' => array('yes-id', 'in'),
  210. 'info_id' => 'yes',
  211. 'id' => 'yes',
  212. 'state' => 1,
  213. ),
  214. 'type' => 'all',
  215. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  216. 'limit' => '0,10',
  217. 'col' => 'key as name, id, id as value, "" as selected, "" as disabled|id',
  218. ),
  219. # 列表
  220. 'getData' => array
  221. (
  222. # 匹配的正则或函数 选填项
  223. 'option' => array
  224. (
  225. 'info_id' => 'yes',
  226. 'state' => 1,
  227. ),
  228. 'type' => 'all',
  229. 'order' => array('id' => 'desc'),
  230. 'col' => 'id,info_id,`key`,price,s_price,f_price,c_price,type,min,code',
  231. ),
  232. # 列表
  233. 'getDataByKeys' => array
  234. (
  235. # 匹配的正则或函数 选填项
  236. 'option' => array
  237. (
  238. 'info_id' => 'yes',
  239. 'state' => 1,
  240. ),
  241. 'type' => 'all',
  242. 'order' => array('id' => 'desc'),
  243. 'col' => 'id,info_id,`key`,price,s_price,f_price,c_price,min,code|key',
  244. ),
  245. # 获取单条数据
  246. 'getOne' => array
  247. (
  248. # 匹配的正则或函数 选填项
  249. 'option' => array
  250. (
  251. 'info_id' => 'yes',
  252. 'state' => 1,
  253. ),
  254. 'type' => 'one',
  255. 'col' => 'id,info_id,price,s_price,f_price,c_price,min,code',
  256. ),
  257. 'getMinOne' => array
  258. (
  259. # 匹配的正则或函数 选填项
  260. 'option' => array
  261. (
  262. 'info_id' => 'yes',
  263. 'state' => 1,
  264. ),
  265. 'type' => 'one',
  266. 'order' => array('price' => 'asc', 'id' => 'desc'),
  267. 'col' => 'id,info_id,price,s_price,min,code',
  268. ),
  269. 'getMaxOne' => array
  270. (
  271. # 匹配的正则或函数 选填项
  272. 'option' => array
  273. (
  274. 'info_id' => 'yes',
  275. 'state' => 1,
  276. ),
  277. 'type' => 'one',
  278. 'order' => array('price' => 'desc', 'id' => 'desc'),
  279. 'col' => 'id,info_id,price,s_price,min,code',
  280. ),
  281. # 更新售出量
  282. 'updateSell' => array
  283. (
  284. 'type' => 'update',
  285. 'where' => array
  286. (
  287. 'id' => 'yes',
  288. ),
  289. 'set' => array
  290. (
  291. 'sell_num' => array('yes', '+='),
  292. ),
  293. ),
  294. 'like' => array
  295. (
  296. # 匹配的正则或函数 选填项
  297. 'option' => array
  298. (
  299. 'code' => array('yes', 'like'),
  300. 'id' => 'yes',
  301. 'state' => 1,
  302. ),
  303. 'type' => 'all',
  304. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  305. 'col' => '*|id',
  306. ),
  307. ),
  308. );
  309. return $config;