info.php 9.2 KB

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