info_sku.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'info_sku',
  6. # 显示给用户看的名称
  7. 'lang' => '商品价格设置',
  8. 'order' => 200,
  9. 'menu' => false,
  10. # 数据结构 不同的字段放这里
  11. 'struct' => array
  12. (
  13. 'id' => array
  14. (
  15. 'type' => 'int-11',
  16. 'name' => 'ID',
  17. 'default' => '',
  18. 'desc' => '',
  19. 'match' => 'is_numeric',
  20. //'list' => true,
  21. ),
  22. 'info_id' => array
  23. (
  24. 'type' => 'int-11',
  25. 'name' => '商品ID',
  26. 'default' => '',
  27. 'desc' => '商品ID',
  28. 'match' => 'is_numeric',
  29. 'update' => 'text',
  30. 'list' => true,
  31. ),
  32. 'key' => array
  33. (
  34. 'type' => 'varchar-100',
  35. 'name' => '属性标识',
  36. 'default' => '',
  37. 'desc' => '属性标识',
  38. 'match' => 'is_string',
  39. 'update' => 'text',
  40. ),
  41. 'attr' => array
  42. (
  43. 'type' => 'text-255',
  44. 'name' => '属性组合规则',
  45. 'default' => '',
  46. 'desc' => '属性组合规则',
  47. 'match' => 'is_string',
  48. 'update' => 'textarea',
  49. 'list' => true,
  50. ),
  51. 'price' => array
  52. (
  53. 'type' => 'varchar-100',//decimal-10,2
  54. 'name' => '销售价',
  55. 'default' => '',
  56. 'desc' => '销售价',
  57. 'match' => 'option',
  58. 'update' => 'text',
  59. 'list' => true,
  60. ),
  61. 's_price' => array
  62. (
  63. 'type' => 'varchar-100',
  64. 'name' => '市场价',
  65. 'default' => '',
  66. 'desc' => '市场价',
  67. 'match' => 'option',
  68. 'update' => 'text',
  69. 'list' => true,
  70. ),
  71. 'f_price' => array
  72. (
  73. 'type' => 'varchar-100',
  74. 'name' => '进价',
  75. 'default' => '',
  76. 'desc' => '进价',
  77. 'match' => 'option',
  78. 'update' => 'text',
  79. 'list' => true,
  80. ),
  81. 'num' => array
  82. (
  83. 'type' => 'int-11',
  84. 'name' => '库存',
  85. 'default' => '',
  86. 'desc' => '库存',
  87. 'match' => 'is_string',
  88. 'update' => 'text',
  89. 'list' => true,
  90. ),
  91. 'sell_num' => array
  92. (
  93. 'type' => 'int-11',
  94. 'name' => '销量',
  95. 'default' => '0',
  96. 'desc' => '请填写销量',
  97. 'match' => 'option',
  98. 'search' => 'order',
  99. 'list' => true,
  100. ),
  101. 'reorder' => array
  102. (
  103. 'type' => 'int-11',
  104. 'name' => '排序-数值越大越靠前,相当于置顶',
  105. 'default' => '1',
  106. 'desc' => '请输入排序',
  107. 'match' => 'option',
  108. //'update' => 'text',
  109. 'search' => 'order',
  110. 'list' => true,
  111. 'order' => 'desc',
  112. 'edit' => true,
  113. ),
  114. 'state' => array
  115. (
  116. 'type' => 'tinyint-1',
  117. 'name' => '数据状态',
  118. 'default' => '1',
  119. 'desc' => '请选择状态',
  120. 'match' => 'is_numeric',
  121. ),
  122. 'cdate' => array
  123. (
  124. 'type' => 'int-11',
  125. 'name' => '发布时间',
  126. 'match' => array('is_numeric', time()),
  127. 'desc' => '',
  128. # 只有insert时才生效
  129. 'insert' => true,
  130. //'search' => 'date',
  131. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  132. ),
  133. ),
  134. 'manage' => array
  135. (
  136. 'insert' => false,
  137. 'edit' => false,
  138. 'delete' => false,
  139. 'num' => false,
  140. 'page_list_table' => 'sku',
  141. # 自定义快捷新增和编辑
  142. 'button' => array
  143. (
  144. //'自定义属性' => array('fast', 1, 'config&where_id=1'),
  145. ),
  146. ),
  147. # request 请求接口定义
  148. 'request' => array
  149. (
  150. # 列表
  151. 'getData' => array
  152. (
  153. # 匹配的正则或函数 选填项
  154. 'option' => array
  155. (
  156. 'info_id' => 'yes',
  157. 'state' => 1,
  158. ),
  159. 'type' => 'all',
  160. 'order' => array('id' => 'desc'),
  161. 'col' => 'id,info_id,`key`,price,s_price,f_price|key',
  162. ),
  163. # 获取单条数据
  164. 'getOne' => array
  165. (
  166. # 匹配的正则或函数 选填项
  167. 'option' => array
  168. (
  169. 'info_id' => 'yes',
  170. 'state' => 1,
  171. ),
  172. 'type' => 'one',
  173. 'col' => 'id,info_id,price,s_price,f_price',
  174. ),
  175. 'getMinOne' => array
  176. (
  177. # 匹配的正则或函数 选填项
  178. 'option' => array
  179. (
  180. 'info_id' => 'yes',
  181. 'state' => 1,
  182. ),
  183. 'type' => 'one',
  184. 'order' => array('price' => 'asc', 'id' => 'desc'),
  185. 'col' => 'id,info_id,price,s_price,f_price',
  186. ),
  187. 'getMaxOne' => array
  188. (
  189. # 匹配的正则或函数 选填项
  190. 'option' => array
  191. (
  192. 'info_id' => 'yes',
  193. 'state' => 1,
  194. ),
  195. 'type' => 'one',
  196. 'order' => array('price' => 'desc', 'id' => 'desc'),
  197. 'col' => 'id,info_id,price,s_price,f_price',
  198. ),
  199. # 更新售出量
  200. 'updateSell' => array
  201. (
  202. 'type' => 'update',
  203. 'where' => array
  204. (
  205. 'id' => 'yes',
  206. ),
  207. 'set' => array
  208. (
  209. 'sell_num' => array('yes', '+='),
  210. ),
  211. ),
  212. ),
  213. );
  214. return $config;