info_sku.php 4.4 KB

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