info_sku.php 6.1 KB

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