info.php 13 KB

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