article.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <?php
  2. $audit = Dever::config('base')->audit;
  3. $status = Dever::config('base')->status;
  4. $function = Dever::config('base')->function;
  5. # 每页的数据量
  6. $page = 15;
  7. $cate = function()
  8. {
  9. $array = array();
  10. $info = Dever::db('content/cate')->state();
  11. if($info)
  12. {
  13. $array += $info;
  14. }
  15. return $array;
  16. };
  17. $author = function()
  18. {
  19. $array = array();
  20. $info = Dever::db('content/author')->state();
  21. if($info)
  22. {
  23. $array += $info;
  24. }
  25. return $array;
  26. };
  27. $share = array
  28. (
  29. 1 => '显示',
  30. 2 => '不显示',
  31. );
  32. $wechat = array
  33. (
  34. 1 => '否',
  35. 2 => '是',
  36. );
  37. # 常用的col
  38. $col = 'id,cate_id,name,pic_cover,pic_cover_169,pdate,num_add_view+num_view as num_view,num_up+num_add_up as num_up,num_comment,share_yes,share_title,share_pic,share_content,function,content,author_id';
  39. return array
  40. (
  41. # 表名
  42. 'name' => 'article',
  43. # 显示给用户看的名称
  44. 'lang' => '图文管理',
  45. 'order' => 100,
  46. # 数据结构
  47. 'struct' => array
  48. (
  49. 'id' => array
  50. (
  51. 'type' => 'int-11',
  52. 'name' => 'ID',
  53. 'default' => '',
  54. 'desc' => '',
  55. 'match' => 'is_numeric',
  56. 'list' => true,
  57. ),
  58. 'name' => array
  59. (
  60. 'type' => 'varchar-80',
  61. 'name' => '标题',
  62. 'default' => '',
  63. 'desc' => '标题',
  64. 'match' => 'is_string',
  65. 'update' => 'text',
  66. 'list' => true,
  67. 'search' => 'fulltext',
  68. //增加预览
  69. 'preview' => true,
  70. ),
  71. 'cate_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '所属栏目',
  75. 'default' => '1',
  76. 'desc' => '所属栏目',
  77. 'match' => 'is_numeric',
  78. 'update' => 'select',
  79. 'option' => $cate,
  80. 'search' => 'select',
  81. ),
  82. 'author_id' => array
  83. (
  84. 'type' => 'int-11',
  85. 'name' => '作者',
  86. 'default' => '1',
  87. 'desc' => '作者',
  88. 'match' => 'is_numeric',
  89. 'update' => 'select',
  90. //'option' => $author,
  91. 'search' => 'select',
  92. 'update_search' => 'content/lib/author.search',
  93. ),
  94. 'wechat' => array
  95. (
  96. 'type' => 'int-11',
  97. 'name' => '是否公众号文章',
  98. 'default' => '1',
  99. 'desc' => '是否公众号文章',
  100. 'match' => 'is_numeric',
  101. //'update' => 'select',
  102. 'option' => $wechat,
  103. 'search' => 'select',
  104. ),
  105. 'wechat_data_id' => array
  106. (
  107. 'type' => 'int-11',
  108. 'name' => '微信数据id',
  109. 'default' => '0',
  110. 'desc' => '微信数据id',
  111. 'match' => 'is_numeric',
  112. ),
  113. 'tag' => array
  114. (
  115. 'type' => 'text-255',
  116. 'name' => '标签',
  117. 'default' => '',
  118. 'desc' => '标签',
  119. 'match' => 'is_numeric',
  120. 'update' => 'selects',
  121. //'search' => 'fulltext',
  122. 'update_search' => 'tag/lib/core.search',
  123. ),
  124. 'pic_cover' => array
  125. (
  126. 'type' => 'varchar-150',
  127. 'name' => '4:3封面图-图片尺寸750*564px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  128. 'default' => '',
  129. 'desc' => '封面图',
  130. 'match' => 'is_string',
  131. 'update' => 'image',
  132. 'key' => '1',
  133. 'place' => '150',
  134. //直接上传到云端
  135. //'upload' => 'qiniu',
  136. //上传大数据
  137. //'large' => true,
  138. ),
  139. 'pic_cover_169' => array
  140. (
  141. 'type' => 'varchar-150',
  142. 'name' => '16:9封面图-图片尺寸750*422px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  143. 'default' => '',
  144. 'desc' => '封面图',
  145. 'match' => 'is_string',
  146. 'update' => 'image',
  147. 'key' => '1',
  148. 'place' => '150',
  149. //直接上传到云端
  150. //'upload' => 'qiniu',
  151. //上传大数据
  152. //'large' => true,
  153. ),
  154. 'num_add_view' => array
  155. (
  156. 'type' => 'int-11',
  157. 'name' => '浏览量基数',
  158. 'default' => '0',
  159. 'desc' => '浏览量基数',
  160. 'match' => 'option',
  161. 'update' => 'text',
  162. ),
  163. 'num_view' => array
  164. (
  165. 'type' => 'int-11',
  166. 'name' => '浏览量pv',
  167. 'default' => '0',
  168. 'desc' => '请填写浏览量pv',
  169. 'match' => 'option',
  170. 'search' => 'order',
  171. //'list' => '{num_view}+{num_add_view}',
  172. ),
  173. 'num_add_up' => array
  174. (
  175. 'type' => 'int-11',
  176. 'name' => '喜欢基数',
  177. 'default' => '0',
  178. 'desc' => '喜欢基数',
  179. 'match' => 'option',
  180. 'update' => 'text',
  181. ),
  182. 'num_up' => array
  183. (
  184. 'type' => 'int-11',
  185. 'name' => '喜欢数',
  186. 'default' => '0',
  187. 'desc' => '请填写喜欢数',
  188. 'match' => 'option',
  189. //'search' => 'order',
  190. 'list' => '"喜欢数:{num_up}+{num_add_up}<br />浏览量:{num_view}+{num_add_view}<br />评论数:{num_comment}<br />"',
  191. 'list_name' => '统计数字',
  192. ),
  193. 'num_comment' => array
  194. (
  195. 'type' => 'int-11',
  196. 'name' => '评论数',
  197. 'default' => '0',
  198. 'desc' => '请填写评论数',
  199. 'search' => 'order',
  200. 'match' => 'option',
  201. //'list' => true,
  202. ),
  203. 'state' => array
  204. (
  205. 'type' => 'tinyint-1',
  206. 'name' => '状态',
  207. 'default' => '1',
  208. 'desc' => '请选择状态',
  209. 'match' => 'is_numeric',
  210. ),
  211. 'admin_founder' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '创建人',
  215. 'default' => '1',
  216. 'desc' => '创建人',
  217. 'match' => 'is_numeric',
  218. ),
  219. 'admin_editor' => array
  220. (
  221. 'type' => 'int-11',
  222. 'name' => '操作人',
  223. 'default' => '1',
  224. 'desc' => '操作人',
  225. 'match' => 'is_numeric',
  226. ),
  227. 'pdate' => array
  228. (
  229. 'type' => 'int-11',
  230. 'name' => '发布时间',
  231. 'match' => array('is_numeric', time()),
  232. 'default' => '',
  233. 'desc' => '',
  234. 'update' => 'date',
  235. 'callback' => 'maketime',
  236. 'insert' => true,
  237. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  238. 'auth' => '"{pdate}" > 0',
  239. ),
  240. 'share' => array
  241. (
  242. 'type' => 'text-255',
  243. 'name' => '分享海报-选择海报库中的海报',
  244. 'default' => '',
  245. 'desc' => '分享海报',
  246. 'match' => 'option',
  247. //'update' => 'checkbox',
  248. 'option' => $share,
  249. ),
  250. 'reorder' => array
  251. (
  252. 'type' => 'int-11',
  253. 'name' => '排序(数值越大越靠前)',
  254. 'default' => '1',
  255. 'desc' => '请输入排序',
  256. 'match' => 'option',
  257. 'update' => 'text',
  258. 'search' => 'order',
  259. 'list' => true,
  260. 'order' => 'desc',
  261. 'edit' => true,
  262. ),
  263. 'udate' => array
  264. (
  265. 'type' => 'int-11',
  266. 'name' => '更新时间',
  267. 'match' => array('is_numeric', time()),
  268. 'desc' => '',
  269. ),
  270. 'function' => array
  271. (
  272. 'type' => 'varchar-100',
  273. 'name' => '功能选择',
  274. 'default' => '1,2,3',
  275. 'desc' => '功能选择',
  276. 'match' => 'option',
  277. 'update' => 'checkbox',
  278. 'option' => $function,
  279. ),
  280. 'share_yes' => array
  281. (
  282. 'type' => 'int-11',
  283. 'name' => '是否显示分享按钮',
  284. 'default' => '1',
  285. 'desc' => '是否显示分享按钮',
  286. 'match' => 'option',
  287. 'update' => 'radio',
  288. 'option' => $share,
  289. 'control' => 'share_yes',
  290. ),
  291. 'share_title' => array
  292. (
  293. 'type' => 'varchar-100',
  294. 'name' => '分享标题',
  295. 'default' => '',
  296. 'desc' => '分享标题',
  297. 'match' => 'option',
  298. 'update' => 'text',
  299. 'show' => 'share_yes=1',
  300. ),
  301. 'share_pic' => array
  302. (
  303. 'type' => 'varchar-150',
  304. 'name' => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  305. 'default' => '',
  306. 'desc' => '分享图片',
  307. 'match' => 'is_string',
  308. 'update' => 'image',
  309. 'key' => '1',
  310. 'place' => '150',
  311. 'show' => 'share_yes=1',
  312. //'upload' => 'qiniu',
  313. //'large' => true,
  314. ),
  315. 'share_content' => array
  316. (
  317. 'type' => 'varchar-200',
  318. 'name' => '分享内容',
  319. 'default' => '',
  320. 'desc' => '分享内容',
  321. 'match' => 'option',
  322. 'update' => 'textarea',
  323. 'show' => 'share_yes=1',
  324. ),
  325. 'content' => array
  326. (
  327. 'type' => 'text-255',
  328. 'name' => '内容',
  329. 'default' => '',
  330. 'desc' => '请输入内容',
  331. 'match' => 'is_string',
  332. 'update' => 'editor',
  333. 'key' => '1',
  334. //'media' => '5',//下面的音视频已经做到了
  335. //直接上传到云端
  336. //'upload' => 'qiniu',
  337. //上传大数据
  338. //'large' => true,
  339. //自定义编辑器右侧按钮
  340. 'editor' => array
  341. (
  342. 'name' => '选择插入模块',
  343. 'button' => array
  344. (
  345. array
  346. (
  347. # 名称
  348. 'name' => '图片',
  349. # 资源库id
  350. 'key' => 1,
  351. # 类型
  352. 'type' => 'image',
  353. ),
  354. array
  355. (
  356. 'name' => '音频',
  357. 'key' => 5,
  358. 'type' => 'media',
  359. ),
  360. array
  361. (
  362. 'name' => '视频',
  363. 'key' => 'video/lib/core.vod',
  364. ),
  365. array
  366. (
  367. 'name' => '直播',
  368. 'key' => 'video/lib/core.live',
  369. ),
  370. array
  371. (
  372. 'name' => '小程序',
  373. 'key' => 'content/lib/applet.update',
  374. 'type' => 'update',
  375. ),
  376. ),
  377. ),
  378. ),
  379. 'audit' => array
  380. (
  381. 'type' => 'int-11',
  382. 'name' => '审核状态',
  383. 'default' => '1',
  384. 'desc' => '审核',
  385. 'match' => 'is_numeric',
  386. //'update' => 'select',
  387. 'option' => $audit,
  388. 'search' => 'select',
  389. 'list' => true,
  390. 'edit' => true,
  391. ),
  392. 'status' => array
  393. (
  394. 'type' => 'int-11',
  395. 'name' => '发布状态',
  396. 'default' => '1',
  397. 'desc' => '发布状态',
  398. 'match' => 'is_numeric',
  399. //'update' => 'select',
  400. 'option' => $status,
  401. 'search' => 'select',
  402. 'list' => true,
  403. 'edit' => true,
  404. ),
  405. 'cdate' => array
  406. (
  407. 'type' => 'int-11',
  408. 'name' => '录入时间',
  409. 'match' => array('is_numeric', time()),
  410. 'desc' => '',
  411. # 只有insert时才生效
  412. 'insert' => true,
  413. ),
  414. ),
  415. # 索引
  416. 'index' => array
  417. (
  418. 'version' => 1,
  419. 1 => array
  420. (
  421. 'i1' => 'uid,cate_id',
  422. )
  423. ),
  424. # 管理功能
  425. 'manage' => array
  426. (
  427. //'insert' => false,
  428. # 列表
  429. 'list_button' => array
  430. (
  431. 'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=1'))),
  432. ),
  433. ),
  434. # request 请求接口定义
  435. 'request' => array
  436. (
  437. 'search' => array
  438. (
  439. # 匹配的正则或函数 选填项
  440. 'option' => array
  441. (
  442. 'ids' => array('yes-id', 'in'),
  443. 'cate_id' => 'yes',
  444. 'name' => array('yes', 'like'),
  445. 'id' => 'yes',
  446. 'state' => 1,
  447. ),
  448. 'type' => 'all',
  449. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  450. 'limit' => '0,1000',
  451. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  452. ),
  453. 'getAll' => array
  454. (
  455. # 匹配的正则或函数 选填项
  456. 'option' => array
  457. (
  458. 'cate_id' => 'yes',
  459. 'cate_ids' => array('yes-cate_id', 'in'),
  460. 'id' => 'yes',
  461. 'state' => 1,
  462. ),
  463. 'type' => 'all',
  464. 'order' => array('reorder' => 'desc','id' => 'desc'),
  465. 'page' => array($page, 'list'),
  466. 'col' => $col,
  467. ),
  468. 'getRelation' => array
  469. (
  470. # 匹配的正则或函数 选填项
  471. 'option' => array
  472. (
  473. 'cate_id' => 'yes',
  474. 'cate_ids' => array('yes-cate_id', 'in'),
  475. 'noid' => array('yes-id', '!='),
  476. 'audit' => 2,
  477. 'status' => 2,
  478. 'state' => 1,
  479. ),
  480. 'type' => 'all',
  481. 'order' => array('reorder' => 'desc','id' => 'desc'),
  482. 'limit' => '0,4',
  483. 'col' => $col,
  484. ),
  485. 'getOne' => array
  486. (
  487. # 匹配的正则或函数 选填项
  488. 'where' => array
  489. (
  490. 'id' => 'yes',
  491. ),
  492. 'type' => 'one',
  493. 'col' => $col,
  494. ),
  495. # 更新浏览量
  496. 'addView' => array
  497. (
  498. 'type' => 'update',
  499. 'where' => array
  500. (
  501. 'id' => 'yes',
  502. ),
  503. 'set' => array
  504. (
  505. 'num_view' => array('1', '+='),
  506. ),
  507. ),
  508. ),
  509. );