info_sku.php 8.1 KB

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