info.php 12 KB

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