info.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <?php
  2. $status = Dever::config('base')->status;
  3. $price_type = array
  4. (
  5. 1 => '单一价格',
  6. 2 => '多种价格(需进行sku设置)',
  7. );
  8. $mode = array
  9. (
  10. 1 => '自提',
  11. 2 => '外卖',
  12. 3 => '外卖+自提',
  13. );
  14. $config = array
  15. (
  16. # 表名
  17. 'name' => 'info',
  18. # 显示给用户看的名称
  19. 'lang' => '商品列表',
  20. 'order' => 200,
  21. 'auto' => 10000000,
  22. 'end' => array
  23. (
  24. 'insert' => 'goods/lib/manage.infoUpdate',
  25. 'update' => 'goods/lib/manage.infoUpdate',
  26. ),
  27. # 同步更新另外一个或多个表的数据,将数据同步到关联表中
  28. 'sync' => array
  29. (
  30. 'goods/info_category' => array
  31. (
  32. # 更新另外一个表的字段 => 本表的字段
  33. 'where' => array('info_id', 'id'),
  34. # 要更新的数据
  35. 'update' => array('category_id' => 'category'),
  36. # 同步更新的类型,delete为先删再插入,update为直接更新
  37. 'type' => 'delete',
  38. )
  39. ),
  40. # 数据结构 不同的字段放这里
  41. 'struct' => array
  42. (
  43. 'id' => array
  44. (
  45. 'type' => 'int-11',
  46. 'name' => 'ID',
  47. 'default' => '',
  48. 'desc' => '',
  49. 'match' => 'is_numeric',
  50. //'list' => true,
  51. ),
  52. 'name' => array
  53. (
  54. 'type' => 'varchar-800',
  55. 'name' => '商品名称',
  56. 'default' => '',
  57. 'desc' => '商品名称',
  58. 'match' => 'is_string',
  59. 'update' => 'textarea',
  60. 'search' => 'fulltext',
  61. 'list' => true,
  62. 'edit' => true,
  63. ),
  64. 'category' => array
  65. (
  66. 'type' => 'varchar-500',
  67. 'name' => '分类',
  68. 'default' => '',
  69. 'desc' => '分类',
  70. 'match' => 'is_string',
  71. 'search' => 'linkage',
  72. 'update' => 'linkage',
  73. 'option' => Dever::url('api.get', 'category'),
  74. //'list' => 'Dever::load("category/api.string", "{category}")',
  75. ),
  76. # 以下几个分类其实在关联表中已经有了,放到这里是为了查询方便,一般只有三级分类,多了就从关联表查询吧
  77. 'top_category_id' => array
  78. (
  79. 'type' => 'int-11',
  80. 'name' => '顶级分类ID-顶级分类,用于分类查询',
  81. 'default' => '-1',
  82. 'desc' => '顶级分类ID',
  83. 'match' => 'is_numeric',
  84. ),
  85. 'second_category_id' => array
  86. (
  87. 'type' => 'int-11',
  88. 'name' => '二级分类ID-二级分类,用于分类查询',
  89. 'default' => '-1',
  90. 'desc' => '二级分类ID',
  91. 'match' => 'is_numeric',
  92. ),
  93. 'category_id' => array
  94. (
  95. 'type' => 'int-11',
  96. 'name' => '子分类ID-最后一个级别的分类,用于分类查询',
  97. 'default' => '-1',
  98. 'desc' => '子分类ID',
  99. 'match' => 'is_numeric',
  100. ),
  101. 'area' => array
  102. (
  103. 'type' => 'int-11',
  104. 'name' => '所在地区',
  105. 'default' => '',
  106. 'desc' => '所在地区',
  107. 'match' => 'is_string',
  108. //'search' => 'linkage',
  109. 'update' => 'linkage',
  110. 'option' => Dever::url('api.get?level_total=1', 'area'),
  111. //'list' => 'Dever::load("area/api.string", "{goods_area}")',
  112. ),
  113. 'mode' => array
  114. (
  115. 'type' => 'int-11',
  116. 'name' => '取货形式',
  117. 'default' => '1',
  118. 'desc' => '取货形式',
  119. 'match' => 'is_numeric',
  120. 'update' => 'radio',
  121. 'option' => $mode,
  122. ),
  123. 'price_type' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '价格类型',
  127. 'default' => '1',
  128. 'desc' => '价格类型',
  129. 'match' => 'is_numeric',
  130. 'update' => 'radio',
  131. 'option' => $price_type,
  132. 'control' => 'price_type',
  133. ),
  134. 'price' => array
  135. (
  136. 'type' => 'varchar-100',
  137. 'name' => '销售价',
  138. 'default' => '',
  139. 'desc' => '销售价',
  140. 'match' => 'option',
  141. 'update' => 'text',
  142. 'show' => 'price_type=1',
  143. ),
  144. 's_price' => array
  145. (
  146. 'type' => 'varchar-100',
  147. 'name' => '市场价',
  148. 'default' => '',
  149. 'desc' => '市场价',
  150. 'match' => 'option',
  151. 'update' => 'text',
  152. 'show' => 'price_type=1',
  153. ),
  154. 'cover' => array
  155. (
  156. 'type' => 'varchar-150',
  157. 'name' => '封面图-图片尺寸300*300px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪',
  158. 'default' => '',
  159. 'desc' => '封面图',
  160. 'match' => 'option',
  161. 'update' => 'image',
  162. 'key' => '1',
  163. 'place' => '300*300',
  164. 'list_name' => '资源详情',
  165. 'list' => 'Dever::load("goods/lib/manage.info", "{id}")',
  166. ),
  167. 'pic' => array
  168. (
  169. 'type' => 'text-255',
  170. 'name' => '多张图片-图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪',
  171. 'default' => '',
  172. 'desc' => '多张图片',
  173. 'match' => 'option',
  174. 'update' => 'images',
  175. 'key' => '1',
  176. 'place' => '750*422',
  177. ),
  178. 'content' => array
  179. (
  180. 'type' => 'text-800',
  181. 'name' => '内容介绍',
  182. 'default' => '',
  183. 'desc' => '内容介绍',
  184. 'match' => 'is_string',
  185. 'update' => 'editor',
  186. 'key' => '1',
  187. ),
  188. 'status' => array
  189. (
  190. 'type' => 'tinyint-1',
  191. 'name' => '状态',
  192. 'default' => '1',
  193. 'desc' => '状态',
  194. 'match' => 'is_numeric',
  195. //'update' => 'select',
  196. 'option' => $status,
  197. 'search' => 'select',
  198. 'list' => true,
  199. 'edit' => true,
  200. ),
  201. 'reorder' => array
  202. (
  203. 'type' => 'int-11',
  204. 'name' => '排序-数值越大越靠前,相当于置顶',
  205. 'default' => '1',
  206. 'desc' => '请输入排序',
  207. 'match' => 'option',
  208. //'update' => 'text',
  209. 'search' => 'order',
  210. 'list' => true,
  211. 'order' => 'desc',
  212. 'edit' => true,
  213. ),
  214. 'state' => array
  215. (
  216. 'type' => 'tinyint-1',
  217. 'name' => '数据状态',
  218. 'default' => '1',
  219. 'desc' => '请选择状态',
  220. 'match' => 'is_numeric',
  221. ),
  222. 'udate' => array
  223. (
  224. 'type' => 'int-11',
  225. 'name' => '更新时间',
  226. 'match' => array('is_numeric', time()),
  227. 'desc' => '',
  228. ),
  229. 'cdate' => array
  230. (
  231. 'type' => 'int-11',
  232. 'name' => '发布时间',
  233. 'match' => array('is_numeric', time()),
  234. 'desc' => '',
  235. # 只有insert时才生效
  236. 'insert' => true,
  237. 'search' => 'date',
  238. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  239. ),
  240. ),
  241. # 索引
  242. 'index' => array
  243. (
  244. 1 => array
  245. (
  246. 'search' => 'category,top_category_id,second_category_id,category_id,mode,area',
  247. ),
  248. # 版本号 更改版本号会更新当前表的索引
  249. 'version' => 1,
  250. ),
  251. # 管理功能
  252. 'manage' => array
  253. (
  254. // 载入自定义资源 路径可以配置在config里。这里没有写路径。demo.css
  255. 'res' => array
  256. (
  257. //'css' => 'demo',
  258. ),
  259. //'insert' => false,
  260. //'delete' => false,
  261. 'mul' => true,
  262. # 自定义快捷新增和编辑
  263. 'button' => array
  264. (
  265. //'类别管理' => array('list', 'cate&project=demand&search_option_key=cate&search_option_tablename=类别&oper_parent=info&oper_project=demand'),
  266. ),
  267. # 列表里的按钮
  268. 'list_button' => array
  269. (
  270. 'add' => array('属性设置', '"info_attr
  271. &project=goods
  272. &search_option_info_id={id}
  273. &search_option_category={category}
  274. &oper_parent=info&oper_project=goods
  275. &oper_save_jump=info
  276. &where_id={id}"', '{price_type} == 2'),
  277. 'list' => array('sku设置', '"info_sku
  278. &project=goods
  279. &search_option_info_id={id}
  280. &oper_parent=info&oper_project=goods
  281. &oper_save_jump=info&page_type=1"', '{price_type} == 2'),
  282. 'br1' => array('<br />'),
  283. 'delete' => '删除',
  284. ),
  285. ),
  286. # request 请求接口定义
  287. 'request' => array
  288. (
  289. # 后台搜索用到
  290. 'search' => array
  291. (
  292. # 匹配的正则或函数 选填项
  293. 'option' => array
  294. (
  295. 'ids' => array('yes-id', 'in'),
  296. 'name' => array('yes', 'like'),
  297. 'id' => 'yes',
  298. 'state' => 1,
  299. ),
  300. 'type' => 'all',
  301. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  302. 'limit' => '0,1000',
  303. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  304. ),
  305. # 列表
  306. 'getAll' => array
  307. (
  308. # 匹配的正则或函数 选填项
  309. 'option' => array
  310. (
  311. 'audit' => 2,
  312. 'category' => array('yes', 'like'),
  313. 'top_category_id' => 'yes',
  314. 'second_category_id' => 'yes',
  315. 'category_id' => 'yes',
  316. //'status' => 1,
  317. 'state' => 1,
  318. ),
  319. 'type' => 'all',
  320. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  321. 'limit' => '0,10',
  322. //'page' => array(10, 'list'),
  323. 'col' => '*',
  324. ),
  325. # 分页
  326. 'getPageAll' => array
  327. (
  328. # 匹配的正则或函数 选填项
  329. 'option' => array
  330. (
  331. 'shop_id' => 'yes',
  332. 'brand_id' => 'yes',
  333. 'name' => array('yes', 'like'),
  334. 'audit' => 2,
  335. 'category' => array('yes', 'like'),
  336. 'top_category_id' => 'yes',
  337. 'second_category_id' => 'yes',
  338. 'category_id' => 'yes',
  339. //'status' => 1,
  340. 'state' => 1,
  341. ),
  342. 'type' => 'all',
  343. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  344. 'page' => array(10, 'list'),
  345. 'col' => '*',
  346. ),
  347. # 更新售出量
  348. 'updateSell' => array
  349. (
  350. 'type' => 'update',
  351. 'where' => array
  352. (
  353. 'id' => 'yes',
  354. ),
  355. 'set' => array
  356. (
  357. 'sell_num' => array('yes', '+='),
  358. ),
  359. ),
  360. 'getOne' => array
  361. (
  362. # 匹配的正则或函数 选填项
  363. 'option' => array
  364. (
  365. 'id' => 'yes',
  366. ),
  367. 'type' => 'one',
  368. 'col' => 'id,name,category,brand_id,shop_id,pic_cover,pic,sell_num+sell_add_num as sell_num,content,platform,price_type,price,s_price,num-sell_num as num,link,code,mode,goods_area,shape,reward_value,reward_type',
  369. ),
  370. ),
  371. );
  372. return $config;