info.php 13 KB

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