info.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. <?php
  2. $status = Dever::config('base')->status;
  3. $price_type = array
  4. (
  5. 1 => '普通商品',
  6. 2 => '多价商品',
  7. //3 => '套餐商品',
  8. 4 => '组合商品',
  9. );
  10. $sell_type = array
  11. (
  12. 1 => '可售卖',
  13. 2 => '不可售卖',
  14. );
  15. $mode = array
  16. (
  17. 1 => '自提',
  18. 2 => '外送',
  19. 3 => '以上全支持',
  20. );
  21. $yes = array
  22. (
  23. 1 => '是',
  24. 2 => '否',
  25. );
  26. $column = function()
  27. {
  28. $array = array();
  29. $info = Dever::load('goods/column-state');
  30. if($info)
  31. {
  32. $array += $info;
  33. }
  34. return $array;
  35. };
  36. $tag = function()
  37. {
  38. $array = array();
  39. $info = Dever::load('goods/tag-state');
  40. if($info)
  41. {
  42. $array += $info;
  43. }
  44. return $array;
  45. };
  46. $config = array
  47. (
  48. # 表名
  49. 'name' => 'info',
  50. # 显示给用户看的名称
  51. 'lang' => '商品列表',
  52. 'order' => 200,
  53. 'auto' => 10000000,
  54. 'end' => array
  55. (
  56. 'insert' => 'goods/lib/manage.infoUpdate',
  57. 'update' => 'goods/lib/manage.infoUpdate',
  58. 'update_status' => 'goods/lib/manage.infoUpdate',
  59. ),
  60. # 同步更新另外一个或多个表的数据,将数据同步到关联表中
  61. 'sync' => array
  62. (
  63. 'goods/info_category' => array
  64. (
  65. # 更新另外一个表的字段 => 本表的字段
  66. 'where' => array('info_id', 'id'),
  67. # 要更新的数据
  68. 'update' => array('category_id' => 'category'),
  69. # 同步更新的类型,delete为先删再插入,update为直接更新
  70. 'type' => 'delete',
  71. ),
  72. 'goods/info_column' => array
  73. (
  74. # 更新另外一个表的字段 => 本表的字段
  75. 'where' => array('info_id', 'id'),
  76. # 要更新的数据
  77. 'update' => array('column_id' => 'column_id'),
  78. # 同步更新的类型,delete为先删再插入,update为直接更新
  79. 'type' => 'delete',
  80. ),
  81. 'goods/info_tag' => array
  82. (
  83. # 更新另外一个表的字段 => 本表的字段
  84. 'where' => array('info_id', 'id'),
  85. # 要更新的数据
  86. 'update' => array('tag_id' => 'tag_id'),
  87. # 同步更新的类型,delete为先删再插入,update为直接更新
  88. 'type' => 'delete',
  89. )
  90. ),
  91. # 数据结构 不同的字段放这里
  92. 'struct' => array
  93. (
  94. 'id' => array
  95. (
  96. 'type' => 'int-11',
  97. 'name' => 'ID',
  98. 'default' => '',
  99. 'desc' => '',
  100. 'match' => 'is_numeric',
  101. //'list' => true,
  102. ),
  103. 'name' => array
  104. (
  105. 'type' => 'varchar-800',
  106. 'name' => '商品名称',
  107. 'default' => '',
  108. 'desc' => '商品名称',
  109. 'match' => 'is_string',
  110. 'update' => 'textarea',
  111. 'search' => 'fulltext',
  112. //'list' => true,
  113. //'edit' => true,
  114. ),
  115. 'sell_type' => array
  116. (
  117. 'type' => 'int-11',
  118. 'name' => '售卖类型',
  119. 'default' => '1',
  120. 'desc' => '售卖类型',
  121. 'match' => 'is_numeric',
  122. 'update' => 'radio',
  123. 'option' => $sell_type,
  124. 'control' => 'sell_type',
  125. ),
  126. 'column_id' => array
  127. (
  128. 'type' => 'varchar-8000',
  129. 'name' => '售卖栏目',
  130. 'default' => '',
  131. 'desc' => '售卖栏目',
  132. 'match' => 'option',
  133. 'update' => 'checkbox',
  134. 'option' => $column,
  135. //'list' => true,
  136. ),
  137. 'category' => array
  138. (
  139. 'type' => 'varchar-500',
  140. 'name' => '属性规格分类',
  141. 'default' => '',
  142. 'desc' => '属性规格分类',
  143. 'match' => 'is_string',
  144. 'search' => 'linkage',
  145. 'update' => 'linkage',
  146. 'option' => Dever::url('api.get', 'category'),
  147. //'list' => 'Dever::load("category/api.string", "{category}")',
  148. ),
  149. # 以下几个分类其实在关联表中已经有了,放到这里是为了查询方便,一般只有三级分类,多了就从关联表查询吧
  150. 'top_category_id' => array
  151. (
  152. 'type' => 'int-11',
  153. 'name' => '顶级分类ID-顶级分类,用于分类查询',
  154. 'default' => '-1',
  155. 'desc' => '顶级分类ID',
  156. 'match' => 'is_numeric',
  157. ),
  158. 'second_category_id' => array
  159. (
  160. 'type' => 'int-11',
  161. 'name' => '二级分类ID-二级分类,用于分类查询',
  162. 'default' => '-1',
  163. 'desc' => '二级分类ID',
  164. 'match' => 'is_numeric',
  165. ),
  166. 'category_id' => array
  167. (
  168. 'type' => 'int-11',
  169. 'name' => '子分类ID-最后一个级别的分类,用于分类查询',
  170. 'default' => '-1',
  171. 'desc' => '子分类ID',
  172. 'match' => 'is_numeric',
  173. ),
  174. 'tag_id' => array
  175. (
  176. 'type' => 'varchar-800',
  177. 'name' => '商品标签',
  178. 'default' => '',
  179. 'desc' => '标签',
  180. 'match' => 'option',
  181. 'update' => 'checkbox',
  182. 'option' => $tag,
  183. //'list' => true,
  184. ),
  185. 'area' => array
  186. (
  187. 'type' => 'int-11',
  188. 'name' => '所在地区',
  189. 'default' => '',
  190. 'desc' => '所在地区',
  191. 'match' => 'is_string',
  192. //'search' => 'linkage',
  193. //'update' => 'linkage',
  194. //'option' => Dever::url('api.get?level_total=1', 'area'),
  195. //'list' => 'Dever::load("area/api.string", "{goods_area}")',
  196. ),
  197. 'mode' => array
  198. (
  199. 'type' => 'int-11',
  200. 'name' => '取货形式',
  201. 'default' => '1',
  202. 'desc' => '取货形式',
  203. 'match' => 'is_numeric',
  204. //'update' => 'radio',
  205. 'option' => $mode,
  206. ),
  207. 'price_type' => array
  208. (
  209. 'type' => 'int-11',
  210. 'name' => '商品类型-套餐商品由多个普通商品组成,可以单独定义库存,组合商品也由多个普通商品组成的,但库存无法自定义',
  211. 'default' => '1',
  212. 'desc' => '价格类型',
  213. 'match' => 'is_numeric',
  214. 'update' => 'radio',
  215. 'option' => $price_type,
  216. 'control' => 'price_type',
  217. ),
  218. 'sku_id' => array
  219. (
  220. 'type' => 'int-11',
  221. 'name' => 'sku_id',
  222. 'default' => '-1',
  223. 'desc' => 'sku_id',
  224. 'match' => 'is_numeric',
  225. ),
  226. 'code' => array
  227. (
  228. 'type' => 'varchar-100',
  229. 'name' => '商品条码号',
  230. 'default' => '',
  231. 'desc' => '商品条码号',
  232. 'match' => 'is_string',
  233. //'update' => 'text',
  234. //'search' => 'fulltext',
  235. //'list' => true,
  236. ),
  237. 'price' => array
  238. (
  239. 'type' => 'varchar-100',
  240. 'name' => '销售价',
  241. 'default' => '',
  242. 'desc' => '销售价',
  243. 'match' => 'option',
  244. //'update' => 'text',
  245. 'show' => 'price_type=1',
  246. ),
  247. 's_price' => array
  248. (
  249. 'type' => 'varchar-100',
  250. 'name' => '市场价',
  251. 'default' => '',
  252. 'desc' => '市场价',
  253. 'match' => 'option',
  254. //'update' => 'text',
  255. 'show' => 'price_type=1',
  256. ),
  257. 'f_price' => array
  258. (
  259. 'type' => 'varchar-100',
  260. 'name' => '门店采购价',
  261. 'default' => '',
  262. 'desc' => '采购价',
  263. 'match' => 'option',
  264. //'update' => 'text',
  265. 'show' => 'price_type=1',
  266. ),
  267. 'c_price' => array
  268. (
  269. 'type' => 'varchar-100',
  270. 'name' => '成本价',
  271. 'default' => '',
  272. 'desc' => '成本价',
  273. 'match' => 'option',
  274. //'update' => 'text',
  275. //'list' => true,
  276. ),
  277. 'min' => array
  278. (
  279. 'type' => 'int-11',
  280. 'name' => '起购数',
  281. 'default' => '1',
  282. 'desc' => '起购数',
  283. 'match' => 'is_string',
  284. //'update' => 'text',
  285. //'list' => true,
  286. ),
  287. 'unit' => array
  288. (
  289. 'type' => 'varchar-100',
  290. 'name' => '计量单位',
  291. 'default' => '',
  292. 'desc' => '计量单位',
  293. 'match' => 'is_string',
  294. //'update' => 'text',
  295. //'list' => true,
  296. ),
  297. 'weight' => array
  298. (
  299. 'type' => 'varchar-100',
  300. 'name' => '重量',
  301. 'default' => '',
  302. 'desc' => '重量',
  303. 'match' => 'is_string',
  304. //'update' => 'text',
  305. //'list' => true,
  306. ),
  307. 'goods' => array
  308. (
  309. 'type' => 'text-1000',
  310. 'name' => '套餐商品配置-套餐和组合商品只可以选择普通商品',
  311. 'default' => '',
  312. 'desc' => '套餐商品配置',
  313. 'match' => 'is_string',
  314. 'show' => 'price_type=3,4',
  315. 'update' => array
  316. (
  317. array
  318. (
  319. 'col' => 'goods_id',
  320. 'name' => '选择商品',
  321. 'default' => '',
  322. 'desc' => '选择商品',
  323. 'match' => 'option',
  324. 'update' => 'select',
  325. 'update_search' => 'goods/lib/manage.search?price_type=1',
  326. ),
  327. array
  328. (
  329. 'col' => 'num',
  330. 'name' => '数量',
  331. 'default' => '1',
  332. 'desc' => '数量',
  333. 'match' => 'is_string',
  334. 'update' => 'text',
  335. ),
  336. ),
  337. ),
  338. 'cover' => array
  339. (
  340. 'type' => 'varchar-150',
  341. 'name' => '封面图-图片尺寸300*300px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪',
  342. 'default' => '',
  343. 'desc' => '封面图',
  344. 'match' => 'is_string',
  345. 'update' => 'image',
  346. 'key' => '1',
  347. 'place' => '300*300',
  348. 'list_name' => '商品详情',
  349. 'list' => 'Dever::load("goods/lib/manage.info", "{id}")',
  350. 'list_header' => array('width' => '60%'),
  351. ),
  352. 'video' => array
  353. (
  354. 'type' => 'varchar-800',
  355. 'name' => '视频-视频格式mp4,上传大小不能超过4G',
  356. 'default' => '',
  357. 'desc' => '视频',
  358. 'match' => 'option',
  359. 'update' => 'video',
  360. 'key' => '3',
  361. 'place' => '150',
  362. 'upload' => 'yun',
  363. 'large' => true,
  364. //'cover' => 'pic',//封面图字段名
  365. ),
  366. 'pic' => array
  367. (
  368. 'type' => 'text-255',
  369. 'name' => '多张图片-图片尺寸759*562px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪',
  370. 'default' => '',
  371. 'desc' => '多张图片',
  372. 'match' => 'is_string',
  373. 'update' => 'images',
  374. 'key' => '1',
  375. 'place' => '759*562',
  376. ),
  377. 'hot' => array
  378. (
  379. 'type' => 'int-11',
  380. 'name' => '是否热门商品',
  381. 'default' => '2',
  382. 'desc' => '是否热门商品',
  383. 'match' => 'is_numeric',
  384. //'update' => 'radio',
  385. 'option' => $yes,
  386. //'list' => true,
  387. //'edit' => true,
  388. ),
  389. 'top' => array
  390. (
  391. 'type' => 'int-11',
  392. 'name' => '是否推荐商品',
  393. 'default' => '2',
  394. 'desc' => '是否推荐商品',
  395. 'match' => 'is_numeric',
  396. //'update' => 'radio',
  397. 'option' => $yes,
  398. //'list' => true,
  399. //'edit' => true,
  400. ),
  401. 'youhui' => array
  402. (
  403. 'type' => 'int-11',
  404. 'name' => '是否每日优惠',
  405. 'default' => '2',
  406. 'desc' => '是否每日优惠',
  407. 'match' => 'is_numeric',
  408. //'update' => 'radio',
  409. 'option' => $yes,
  410. //'list' => true,
  411. //'edit' => true,
  412. ),
  413. 'content' => array
  414. (
  415. 'type' => 'text-800',
  416. 'name' => '内容介绍',
  417. 'default' => '',
  418. 'desc' => '内容介绍',
  419. 'match' => 'is_string',
  420. 'update' => 'editor',
  421. 'key' => '1',
  422. ),
  423. 'status' => array
  424. (
  425. 'type' => 'tinyint-1',
  426. 'name' => '状态',
  427. 'default' => '2',
  428. 'desc' => '状态',
  429. 'match' => 'is_numeric',
  430. 'update' => 'radio',
  431. 'option' => $status,
  432. 'search' => 'select',
  433. 'list' => true,
  434. 'edit' => true,
  435. 'mul' => true,
  436. ),
  437. 'reorder' => array
  438. (
  439. 'type' => 'int-11',
  440. 'name' => '排序-数值越大越靠前,相当于置顶',
  441. 'default' => '1',
  442. 'desc' => '请输入排序',
  443. 'match' => 'option',
  444. //'update' => 'text',
  445. 'search' => 'order',
  446. 'list' => true,
  447. 'order' => 'desc',
  448. 'edit' => true,
  449. ),
  450. 'state' => array
  451. (
  452. 'type' => 'tinyint-1',
  453. 'name' => '数据状态',
  454. 'default' => '1',
  455. 'desc' => '请选择状态',
  456. 'match' => 'is_numeric',
  457. ),
  458. 'udate' => array
  459. (
  460. 'type' => 'int-11',
  461. 'name' => '更新时间',
  462. 'match' => array('is_numeric', time()),
  463. 'desc' => '',
  464. ),
  465. 'cdate' => array
  466. (
  467. 'type' => 'int-11',
  468. 'name' => '发布时间',
  469. 'match' => array('is_numeric', time()),
  470. 'desc' => '',
  471. # 只有insert时才生效
  472. 'insert' => true,
  473. 'search' => 'date',
  474. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  475. ),
  476. ),
  477. # 索引
  478. 'index' => array
  479. (
  480. 1 => array
  481. (
  482. 'search' => 'category,top_category_id,second_category_id,category_id,mode,area',
  483. ),
  484. # 版本号 更改版本号会更新当前表的索引
  485. 'version' => 1,
  486. ),
  487. # 管理功能
  488. 'manage' => array
  489. (
  490. // 载入自定义资源 路径可以配置在config里。这里没有写路径。demo.css
  491. 'res' => array
  492. (
  493. //'css' => 'demo',
  494. ),
  495. //'insert' => false,
  496. //'delete' => false,
  497. 'mul' => true,
  498. # 自定义快捷新增和编辑
  499. 'button' => array
  500. (
  501. //'类别管理' => array('list', 'cate&project=demand&search_option_key=cate&search_option_tablename=类别&oper_parent=info&oper_project=demand'),
  502. ),
  503. # 表格使用html模式,默认是js渲染模式
  504. 'list_table' => 'html',
  505. # 列表里的按钮
  506. 'list_button' => array
  507. (
  508. 'update' => array('编辑', 'info'),
  509. 'fast' => array('属性设置', '"info_attr&project=goods&search_option_info_id={id}&search_option_category={category}&oper_parent=info&oper_project=goods&oper_save_jump=info&where_id={id}"', '{price_type} == 2'),
  510. 'fast_list' => array('价格设置', '"info_sku&project=goods&goods_id={id}&page_type=1"', '{price_type} > 0'),
  511. 'br1' => array('<br />'),
  512. //'delete' => '删除',
  513. ),
  514. ),
  515. 'alter' => array
  516. (
  517. 2 => array
  518. (
  519. array('update', 'price', 'price', 'varchar-100 0 销售价'),
  520. array('update', 's_price', 's_price', 'varchar-100 0 市场价'),
  521. array('update', 'f_price', 'f_price', 'varchar-100 0 采购价'),
  522. ),
  523. 'version' => 2,
  524. ),
  525. # request 请求接口定义
  526. 'request' => array
  527. (
  528. 'getAllByName' => array
  529. (
  530. # 匹配的正则或函数 选填项
  531. 'option' => array
  532. (
  533. 'id' => array('yes', 'in'),
  534. 'name' => array('yes', 'like'),
  535. 'state' => 1,
  536. ),
  537. 'type' => 'all',
  538. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  539. 'col' => '*,name as value,name as label|id',
  540. ),
  541. # 后台搜索用到 也可以不加,自动生成
  542. 'search' => array
  543. (
  544. # 匹配的正则或函数 选填项
  545. 'option' => array
  546. (
  547. 'ids' => array('yes-id', 'in'),
  548. 'name' => array('yes', 'like'),
  549. 'price_type' => 'yes',
  550. 'id' => 'yes',
  551. 'state' => 1,
  552. ),
  553. 'type' => 'all',
  554. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  555. 'limit' => '0,10',
  556. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  557. ),
  558. # 推荐列表
  559. 'getTop' => array
  560. (
  561. # 匹配的正则或函数 选填项
  562. 'option' => array
  563. (
  564. 'hot' => 'yes',
  565. 'top' => 'yes',
  566. 'youhui' => 'yes',
  567. 'status' => 1,
  568. 'state' => 1,
  569. ),
  570. 'type' => 'all',
  571. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  572. 'limit' => '0,6',
  573. 'col' => '*,id as goods_id',
  574. ),
  575. # 列表
  576. 'getAll' => array
  577. (
  578. # 匹配的正则或函数 选填项
  579. 'option' => array
  580. (
  581. 'audit' => 2,
  582. 'category' => array('yes', 'like'),
  583. 'top_category_id' => 'yes',
  584. 'second_category_id' => 'yes',
  585. 'category_id' => 'yes',
  586. //'status' => 1,
  587. 'state' => 1,
  588. ),
  589. 'type' => 'all',
  590. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  591. 'limit' => '0,10',
  592. //'page' => array(10, 'list'),
  593. 'col' => '*',
  594. ),
  595. # 列表
  596. 'getData' => array
  597. (
  598. # 匹配的正则或函数 选填项
  599. 'option' => array
  600. (
  601. 'price_type' => array('yes', 'in'),
  602. 'status' => 1,
  603. 'state' => 1,
  604. ),
  605. 'type' => 'all',
  606. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  607. //'limit' => '0,10',
  608. //'page' => array(10, 'list'),
  609. 'col' => '*',
  610. ),
  611. # 分页
  612. 'getPageAll' => array
  613. (
  614. # 匹配的正则或函数 选填项
  615. 'option' => array
  616. (
  617. 'shop_id' => 'yes',
  618. 'brand_id' => 'yes',
  619. 'name' => array('yes', 'like'),
  620. 'column_id' => array('yes', 'like'),
  621. 'category' => array('yes', 'like'),
  622. 'top_category_id' => 'yes',
  623. 'second_category_id' => 'yes',
  624. 'category_id' => 'yes',
  625. 'status' => 1,
  626. 'state' => 1,
  627. ),
  628. 'type' => 'all',
  629. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  630. 'page' => array(10, 'list'),
  631. 'col' => '*',
  632. ),
  633. # 更新售出量
  634. 'updateSell' => array
  635. (
  636. 'type' => 'update',
  637. 'where' => array
  638. (
  639. 'id' => 'yes',
  640. ),
  641. 'set' => array
  642. (
  643. 'sell_num' => array('yes', '+='),
  644. ),
  645. ),
  646. 'like' => array
  647. (
  648. # 匹配的正则或函数 选填项
  649. 'option' => array
  650. (
  651. 'name' => array('yes', 'like'),
  652. 'id' => 'yes',
  653. //'status' => 1,
  654. 'state' => 1,
  655. ),
  656. 'type' => 'all',
  657. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  658. 'col' => '*|id',
  659. ),
  660. ),
  661. );
  662. return $config;