info.php 11 KB

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