info_sku.php 7.7 KB

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