info.php 19 KB

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