info.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. <?php
  2. $audit = Dever::config('base')->audit;
  3. $status = Dever::config('base')->status;
  4. # 每页的数据量
  5. $page = 10;
  6. $cate = function()
  7. {
  8. $array = array();
  9. $info = Dever::db('article/cate')->state();
  10. if($info)
  11. {
  12. $array += $info;
  13. }
  14. return $array;
  15. };
  16. $author = function()
  17. {
  18. $array = array();
  19. $info = Dever::db('article/author')->state();
  20. if($info)
  21. {
  22. $array += $info;
  23. }
  24. return $array;
  25. };
  26. $share = array
  27. (
  28. 1 => '显示',
  29. 2 => '不显示',
  30. );
  31. $template = array
  32. (
  33. 1 => '图文',
  34. 2 => '视频',
  35. );
  36. # 常用的col
  37. $col = 'id,cate_id,name,pic_cover,num_add_view+num_view as num_view,content,author_id,template,`desc`,video,cdate';
  38. return array
  39. (
  40. # 表名
  41. 'name' => 'info',
  42. # 显示给用户看的名称
  43. 'lang' => '文章管理',
  44. 'order' => 100,
  45. 'end' => array
  46. (
  47. 'insert' => 'article/lib/author.data?source_table=article/info',
  48. 'update' => 'article/lib/author.data?source_table=article/info',
  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-80',
  65. 'name' => '标题-文章标题,同时也用于分享标题',
  66. 'default' => '',
  67. 'desc' => '标题',
  68. 'match' => 'is_string',
  69. 'update' => 'text',
  70. 'list' => true,
  71. 'search' => 'fulltext',
  72. //增加预览
  73. 'preview' => true,
  74. ),
  75. 'desc' => array
  76. (
  77. 'type' => 'varchar-500',
  78. 'name' => '摘要-文章摘要,同时也用于分享内容',
  79. 'default' => '',
  80. 'desc' => '摘要',
  81. 'match' => 'is_string',
  82. 'update' => 'textarea',
  83. ),
  84. 'cate_id' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '所属栏目',
  88. 'default' => '1',
  89. 'desc' => '所属栏目',
  90. 'match' => 'is_numeric',
  91. 'update' => 'select',
  92. 'option' => $cate,
  93. 'search' => 'select',
  94. 'list' => 'Dever::load("article/cate-one#name", {cate_id})',
  95. ),
  96. 'author_id' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '编辑',
  100. 'default' => '1',
  101. 'desc' => '编辑',
  102. 'match' => 'is_numeric',
  103. 'update' => 'select',
  104. //'option' => $author,
  105. 'search' => 'select',
  106. 'update_search' => 'article/lib/author.search',
  107. ),
  108. 'pic_cover' => array
  109. (
  110. 'type' => 'text-255',
  111. 'name' => '封面图-可以上传多张,也可以不传,不传则自动从内容中获取',
  112. 'default' => '',
  113. 'desc' => '封面图',
  114. 'match' => 'option',
  115. 'update' => 'images',
  116. 'key' => '1',
  117. 'place' => '345*200',
  118. //直接上传到云端
  119. //'upload' => 'qiniu',
  120. //上传大数据
  121. //'large' => true,
  122. ),
  123. 'template' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '文章模板',
  127. 'default' => '1',
  128. 'desc' => '文章模板',
  129. 'match' => 'is_numeric',
  130. 'update' => 'radio',
  131. 'option' => $template,
  132. 'search' => 'select',
  133. 'control' => 'template',
  134. ),
  135. 'video' => array
  136. (
  137. 'type' => 'varchar-800',
  138. //'name' => '上传视频-上传视频格式mp4,mov,上传大小不能超过4G,也可以直接填入腾讯视频的地址(如:https://v.qq.com/x/page/p0873p0efbx.html)或者mp4地址',
  139. 'name' => '上传视频-上传视频格式mp4,mov,上传大小不能超过4G,也可以直接填入mp4地址',
  140. 'default' => '',
  141. 'desc' => '上传视频',
  142. 'match' => 'is_string',
  143. 'update' => 'upload',
  144. 'key' => '5',
  145. 'place' => '150',
  146. 'upload' => 'yun',
  147. 'large' => true,
  148. //不覆盖原文件,生成新文件
  149. 'cover' => 2,
  150. 'show' => 'template=2',
  151. ),
  152. 'video_info' => array
  153. (
  154. 'type' => 'text-255',
  155. 'name' => '视频信息',
  156. 'default' => '',
  157. 'desc' => '视频信息',
  158. 'match' => 'is_string',
  159. 'show' => 'template=2',
  160. ),
  161. 'num_add_view' => array
  162. (
  163. 'type' => 'int-11',
  164. 'name' => '浏览量基数',
  165. 'default' => '0',
  166. 'desc' => '浏览量基数',
  167. 'match' => 'option',
  168. //'update' => 'text',
  169. ),
  170. 'num_view' => array
  171. (
  172. 'type' => 'int-11',
  173. 'name' => '浏览量',
  174. 'default' => '0',
  175. 'desc' => '请填写浏览量',
  176. 'match' => 'option',
  177. 'search' => 'order',
  178. 'list' => '{num_view}+{num_add_view}',
  179. ),
  180. 'pdate' => array
  181. (
  182. 'type' => 'int-11',
  183. 'name' => '发布时间',
  184. 'match' => array('is_numeric', time()),
  185. 'default' => '',
  186. 'desc' => '',
  187. 'update' => 'date',
  188. 'callback' => 'maketime',
  189. 'insert' => true,
  190. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  191. 'auth' => '"{pdate}" > 0',
  192. ),
  193. 'reorder' => array
  194. (
  195. 'type' => 'int-11',
  196. 'name' => '排序(数值越大越靠前)',
  197. 'default' => '1',
  198. 'desc' => '请输入排序',
  199. 'match' => 'option',
  200. 'update' => 'text',
  201. 'search' => 'order',
  202. 'list' => true,
  203. 'order' => 'desc',
  204. 'edit' => true,
  205. ),
  206. 'udate' => array
  207. (
  208. 'type' => 'int-11',
  209. 'name' => '更新时间',
  210. 'match' => array('is_numeric', time()),
  211. 'desc' => '',
  212. ),
  213. 'content' => array
  214. (
  215. 'type' => 'text-255',
  216. 'name' => '内容',
  217. 'default' => '',
  218. 'desc' => '请输入内容',
  219. 'match' => 'is_string',
  220. 'update' => 'editor',
  221. 'key' => '1',
  222. //'media' => '5',//下面的音视频已经做到了
  223. //直接上传到云端
  224. //'upload' => 'qiniu',
  225. //上传大数据
  226. //'large' => true,
  227. //自定义编辑器右侧按钮
  228. 'editors' => array
  229. (
  230. 'name' => '选择插入模块',
  231. 'button' => array
  232. (
  233. array
  234. (
  235. 'name' => '视频',
  236. 'key' => 'article/lib/article.vod',
  237. ),
  238. ),
  239. ),
  240. ),
  241. 'status' => array
  242. (
  243. 'type' => 'int-11',
  244. 'name' => '发布状态',
  245. 'default' => '1',
  246. 'desc' => '发布状态',
  247. 'match' => 'is_numeric',
  248. //'update' => 'select',
  249. 'option' => $status,
  250. 'search' => 'select',
  251. 'list' => true,
  252. 'edit' => true,
  253. ),
  254. 'source_id' => array
  255. (
  256. 'type' => 'int-11',
  257. 'name' => '来源ID',
  258. 'default' => '0',
  259. 'desc' => '来源ID',
  260. 'match' => 'is_numeric',
  261. ),
  262. 'state' => array
  263. (
  264. 'type' => 'tinyint-1',
  265. 'name' => '状态',
  266. 'default' => '1',
  267. 'desc' => '请选择状态',
  268. 'match' => 'is_numeric',
  269. ),
  270. 'admin_founder' => array
  271. (
  272. 'type' => 'int-11',
  273. 'name' => '创建人',
  274. 'default' => '1',
  275. 'desc' => '创建人',
  276. 'match' => 'is_numeric',
  277. ),
  278. 'admin_editor' => array
  279. (
  280. 'type' => 'int-11',
  281. 'name' => '操作人',
  282. 'default' => '1',
  283. 'desc' => '操作人',
  284. 'match' => 'is_numeric',
  285. ),
  286. 'cdate' => array
  287. (
  288. 'type' => 'int-11',
  289. 'name' => '录入时间',
  290. 'match' => array('is_numeric', time()),
  291. 'desc' => '',
  292. # 只有insert时才生效
  293. 'insert' => true,
  294. ),
  295. ),
  296. # 索引
  297. 'index' => array
  298. (
  299. 'version' => 1,
  300. 1 => array
  301. (
  302. 'i1' => 'cate_id,reorder',
  303. )
  304. ),
  305. # 管理功能
  306. 'manage' => array
  307. (
  308. //'insert' => false,
  309. # 列表
  310. 'list_button' => array
  311. (
  312. //'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=1'))),
  313. ),
  314. ),
  315. # request 请求接口定义
  316. 'request' => array
  317. (
  318. 'search' => array
  319. (
  320. # 匹配的正则或函数 选填项
  321. 'option' => array
  322. (
  323. 'ids' => array('yes-id', 'in'),
  324. 'cate_id' => 'yes',
  325. 'name' => array('yes', 'like'),
  326. 'id' => 'yes',
  327. 'state' => 1,
  328. ),
  329. 'type' => 'all',
  330. 'order' => array('reorder' => 'desc', 'pdate' => 'desc'),
  331. 'limit' => '0,1000',
  332. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  333. ),
  334. 'getAll' => array
  335. (
  336. # 匹配的正则或函数 选填项
  337. 'option' => array
  338. (
  339. 'cate_id' => 'yes',
  340. 'cate_ids' => array('yes-cate_id', 'in'),
  341. 'id' => 'yes',
  342. 'status' => 1,
  343. 'state' => 1,
  344. ),
  345. 'type' => 'all',
  346. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  347. 'page' => array($page, 'list'),
  348. 'col' => $col,
  349. ),
  350. 'getList' => array
  351. (
  352. # 匹配的正则或函数 选填项
  353. 'option' => array
  354. (
  355. 'cate_id' => 'yes',
  356. 'status' => 1,
  357. 'state' => 1,
  358. ),
  359. 'type' => 'all',
  360. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  361. 'limit' => '0,10',
  362. 'col' => $col,
  363. ),
  364. 'getRelation' => array
  365. (
  366. # 匹配的正则或函数 选填项
  367. 'option' => array
  368. (
  369. 'cate_id' => 'yes',
  370. 'cate_ids' => array('yes-cate_id', 'in'),
  371. 'noid' => array('yes-id', '!='),
  372. 'status' => 1,
  373. 'state' => 1,
  374. ),
  375. 'type' => 'all',
  376. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  377. 'limit' => '0,2',
  378. 'col' => $col,
  379. ),
  380. 'getOne' => array
  381. (
  382. # 匹配的正则或函数 选填项
  383. 'where' => array
  384. (
  385. 'id' => 'yes',
  386. ),
  387. 'type' => 'one',
  388. 'col' => $col,
  389. ),
  390. # 更新浏览量
  391. 'addView' => array
  392. (
  393. 'type' => 'update',
  394. 'where' => array
  395. (
  396. 'id' => 'yes',
  397. ),
  398. 'set' => array
  399. (
  400. 'num_view' => array('1', '+='),
  401. ),
  402. ),
  403. ),
  404. );