info_sku.php 9.9 KB

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