info.php 11 KB

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