goods_sku.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'goods_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. 'price_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. 'goods_id' => array
  33. (
  34. 'type' => 'int-11',
  35. 'name' => '商品名称',
  36. 'default' => '',
  37. 'desc' => '商品名称',
  38. 'match' => 'is_numeric',
  39. 'search' => array
  40. (
  41. 'api' => 'goods/info-like',
  42. 'col' => 'name',
  43. 'result' => 'id',
  44. ),
  45. ),
  46. 'sku_id' => array
  47. (
  48. 'type' => 'int-11',
  49. 'name' => '规格型号',
  50. 'default' => '-1',
  51. 'desc' => '规格型号',
  52. 'match' => 'is_numeric',
  53. ),
  54. 'price_sell' => array
  55. (
  56. 'type' => 'varchar-100',
  57. 'name' => '销售价',
  58. 'default' => '',
  59. 'desc' => '销售价',
  60. 'match' => 'option',
  61. 'update' => 'text',
  62. ),
  63. 'price_buy' => array
  64. (
  65. 'type' => 'varchar-100',
  66. 'name' => '门店采购价',
  67. 'default' => '',
  68. 'desc' => '采购价',
  69. 'match' => 'option',
  70. 'update' => 'text',
  71. ),
  72. 'price_num' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '起购数',
  76. 'default' => '1',
  77. 'desc' => '起购数',
  78. 'match' => 'is_string',
  79. 'update' => 'text',
  80. ),
  81. 'state' => array
  82. (
  83. 'type' => 'tinyint-1',
  84. 'name' => '数据状态',
  85. 'default' => '1',
  86. 'desc' => '请选择状态',
  87. 'match' => 'is_numeric',
  88. ),
  89. 'cdate' => array
  90. (
  91. 'type' => 'int-11',
  92. 'name' => '发布时间',
  93. 'match' => array('is_numeric', time()),
  94. 'desc' => '',
  95. # 只有insert时才生效
  96. 'insert' => true,
  97. //'search' => 'date',
  98. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  99. ),
  100. ),
  101. 'manage' => array
  102. (
  103. 'insert' => false,
  104. 'edit' => false,
  105. 'delete' => false,
  106. 'page_list_table' => 'sku',
  107. # 自定义快捷新增和编辑
  108. 'button' => array
  109. (
  110. //'自定义属性' => array('fast', 1, 'config&where_id=1'),
  111. ),
  112. ),
  113. # request 请求接口定义
  114. 'request' => array
  115. (
  116. 'getDataPage' => array
  117. (
  118. # 匹配的正则或函数 选填项
  119. 'option' => array
  120. (
  121. 'price_id' => array('yes-t_1.price_id'),
  122. 'name' => array('yes-t_2.name', 'like'),
  123. 'column' => array('yes-t_2.column_id', 'like'),
  124. 'category' => array('yes-t_2.category', 'like'),
  125. 'top_category_id' => array('yes-t_2.top_category_id'),
  126. 'second_category_id' => array('yes-t_2.second_category_id'),
  127. 'category_id' => array('yes-t_2.category_id'),
  128. 'status' => array('yes-t_2.status', 1),
  129. 'state' => array('yes-t_2.state', 1),
  130. 'state_1' => array('yes-t_1.state', 1),
  131. ),
  132. # 联表
  133. 'join' => array
  134. (
  135. array
  136. (
  137. 'table' => 'goods/info',
  138. 'type' => 'left join',
  139. 'on' => array('goods_id','id'),
  140. 'col' => 'goods_id',
  141. ),
  142. ),
  143. 'type' => 'all',
  144. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc', 't_2.price' => 'asc'),
  145. 'page' => array(30, 'list'),
  146. 'col' => '*,t_2.name,t_2.cover,t_2.id as id',
  147. ),
  148. 'getAllData' => array
  149. (
  150. # 匹配的正则或函数 选填项
  151. 'option' => array
  152. (
  153. 'price_id' => array('yes-t_1.price_id'),
  154. 'name' => array('yes-t_2.name', 'like'),
  155. 'column' => array('yes-t_2.column_id', 'like'),
  156. 'category' => array('yes-t_2.category', 'like'),
  157. 'top_category_id' => array('yes-t_2.top_category_id'),
  158. 'second_category_id' => array('yes-t_2.second_category_id'),
  159. 'category_id' => array('yes-t_2.category_id'),
  160. 'status' => array('yes-t_2.status', 1),
  161. 'state' => array('yes-t_2.state', 1),
  162. 'state_1' => array('yes-t_1.state', 1),
  163. ),
  164. # 联表
  165. 'join' => array
  166. (
  167. array
  168. (
  169. 'table' => 'goods/info',
  170. 'type' => 'left join',
  171. 'on' => array('goods_id','id'),
  172. 'col' => 'goods_id',
  173. ),
  174. ),
  175. 'type' => 'all',
  176. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc', 't_2.price' => 'asc'),
  177. 'col' => '*,t_2.name,t_2.cover,t_2.id as id',
  178. ),
  179. # 列表
  180. 'getData' => array
  181. (
  182. # 匹配的正则或函数 选填项
  183. 'option' => array
  184. (
  185. 'price_id' => 'yes',
  186. 'goods_id' => 'yes',
  187. 'sku_id' => 'yes',
  188. 'state' => 1,
  189. ),
  190. 'type' => 'all',
  191. 'order' => array('id' => 'desc'),
  192. 'col' => '*|sku_id',
  193. ),
  194. # 列表
  195. 'getDataByPrice' => array
  196. (
  197. # 匹配的正则或函数 选填项
  198. 'option' => array
  199. (
  200. 'price_id' => 'yes',
  201. 'goods_id' => 'yes',
  202. 'sku_id' => 'yes',
  203. 'state' => 1,
  204. ),
  205. 'type' => 'all',
  206. 'order' => array('id' => 'desc'),
  207. 'col' => '*|price_id',
  208. ),
  209. # 获取单条数据
  210. 'getOne' => array
  211. (
  212. # 匹配的正则或函数 选填项
  213. 'option' => array
  214. (
  215. 'price_id' => 'yes',
  216. 'goods_id' => 'yes',
  217. 'sku_id' => 'yes',
  218. 'state' => 1,
  219. ),
  220. 'type' => 'one',
  221. 'col' => '*',
  222. ),
  223. ),
  224. );
  225. return $config;