info.php 8.7 KB

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