info.php 23 KB

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