info.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <?php
  2. $time = (7*86400);
  3. $audit = Dever::config('base')->audit;
  4. $status = Dever::config('base')->status;
  5. # 分类权限
  6. $auth = Dever::tops();
  7. $cate = function() use ($auth)
  8. {
  9. $array = array();
  10. if ($auth) {
  11. $info = Dever::db('collection/cate')->getIds(array('ids' => $auth));
  12. } else {
  13. $info = Dever::db('collection/cate')->state();
  14. }
  15. if($info)
  16. {
  17. $array += $info;
  18. }
  19. return $array;
  20. };
  21. $buy = array
  22. (
  23. 1 => '收费',
  24. 2 => '免费',
  25. );
  26. $page = 15;
  27. # 常用的col
  28. $col = '*';
  29. $config = array
  30. (
  31. # 表名
  32. 'name' => 'info',
  33. # 显示给用户看的名称
  34. 'lang' => '合集列表',
  35. 'order' => 100,
  36. 'ends' => array
  37. (
  38. 'insert' => 'collection/lib/manage.setInfoCache',
  39. 'update' => 'collection/lib/manage.setInfoCache',
  40. 'update_status' => 'collection/lib/manage.setInfoCache',
  41. ),
  42. # 数据结构
  43. 'struct' => array
  44. (
  45. 'id' => array
  46. (
  47. 'type' => 'int-11',
  48. 'name' => 'ID',
  49. 'default' => '',
  50. 'desc' => '',
  51. 'match' => 'is_numeric',
  52. 'list' => true,
  53. ),
  54. 'hr1' => array
  55. (
  56. 'name' => '基本配置',
  57. 'class' => '',//本项必须填写
  58. 'attr' => '',
  59. ),
  60. 'name' => array
  61. (
  62. 'type' => 'varchar-180',
  63. 'name' => '标题-也用作分享标题',
  64. 'default' => '',
  65. 'desc' => '标题',
  66. 'match' => 'is_string',
  67. 'update' => 'text',
  68. 'search' => 'fulltext',
  69. 'list' => true,
  70. ),
  71. 'uid' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '作者',
  75. 'default' => '0',
  76. 'desc' => '请选择作者',
  77. 'match' => 'is_numeric',
  78. 'update' => 'select',
  79. 'update_search' => 'passport/lib/manage.search',
  80. //'search' => 'select',
  81. 'search' => array
  82. (
  83. 'api' => 'passport/user-all',
  84. 'col' => 'username',
  85. 'result' => 'id',
  86. ),
  87. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "官方"',
  88. ),
  89. 'desc' => array
  90. (
  91. 'type' => 'varchar-800',
  92. 'name' => '描述-也用分享描述',
  93. 'default' => '',
  94. 'desc' => '描述',
  95. 'match' => 'is_string',
  96. 'update' => 'text',
  97. //'list' => true,
  98. ),
  99. 'cate_id' => array
  100. (
  101. 'type' => 'int-11',
  102. 'name' => '分类',
  103. 'default' => '1',
  104. 'desc' => '分类',
  105. 'match' => 'is_numeric',
  106. 'update' => 'select',
  107. 'option' => $cate,
  108. 'search' => 'select',
  109. //'list' => true,
  110. ),
  111. 'pic_cover' => array
  112. (
  113. 'type' => 'varchar-150',
  114. 'name' => '封面图-也用作分享图片,图片尺寸660*660px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  115. 'default' => '',
  116. 'desc' => '封面图',
  117. 'match' => 'is_string',
  118. 'update' => 'image',
  119. 'key' => '1',
  120. 'place' => '660*660',
  121. ),
  122. 'pic_bg' => array
  123. (
  124. 'type' => 'text-255',
  125. 'name' => '全屏背景图-可以上传多张,展示在合集首页,图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  126. 'default' => '',
  127. 'desc' => '全屏背景图',
  128. 'match' => 'is_string',
  129. 'update' => 'images',
  130. 'key' => '1',
  131. 'place' => '750*1386',
  132. ),
  133. 'bgmusic' => array
  134. (
  135. 'type' => 'varchar-800',
  136. 'name' => '背景音乐-音频格式mp3,上传大小不能超过100M',
  137. 'default' => '',
  138. 'desc' => '背景音乐',
  139. 'match' => 'option',
  140. 'update' => 'upload',
  141. 'key' => '2',
  142. 'place' => '150',
  143. 'upload' => 'qiniu',
  144. 'large' => true,
  145. //不覆盖原文件,生成新文件
  146. 'cover' => 2,
  147. ),
  148. 'pdate' => array
  149. (
  150. 'type' => 'int-11',
  151. 'name' => '开放时间',
  152. 'match' => array('is_numeric', time()),
  153. 'default' => '',
  154. 'desc' => '',
  155. 'update' => 'date',
  156. 'callback' => 'maketime',
  157. 'insert' => true,
  158. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  159. 'auth' => '"{pdate}" > 0',
  160. ),
  161. 'hr2' => array
  162. (
  163. 'name' => '购买配置',
  164. 'class' => '',//本项必须填写
  165. 'attr' => '',
  166. ),
  167. 'ticket_name' => array
  168. (
  169. 'type' => 'varchar-50',
  170. 'name' => '门票名称-可以自定义门票的名称',
  171. 'default' => '门票',
  172. 'desc' => '门票名称',
  173. 'match' => 'option',
  174. 'update' => 'text',
  175. ),
  176. 'buy' => array
  177. (
  178. 'type' => 'int-11',
  179. 'name' => '是否收费',
  180. 'default' => '1',
  181. 'desc' => '是否收费',
  182. 'match' => 'option',
  183. 'update' => 'radio',
  184. 'option' => $buy,
  185. 'control' => 'buy',
  186. //'list' => true,
  187. 'search' => 'select',
  188. ),
  189. 'num_buy' => array
  190. (
  191. 'type' => 'int-11',
  192. 'name' => '购买数',
  193. 'default' => '0',
  194. 'desc' => '请填写购买数',
  195. 'match' => 'option',
  196. 'search' => 'order',
  197. 'show' => 'buy=1',
  198. 'list' => 'Dever::load("collection/lib/manage.num?id={id}")',
  199. 'list_name' => '统计数字',
  200. ),
  201. 'num_ratio_buy' => array
  202. (
  203. 'type' => 'varchar-20',
  204. 'name' => '购买系数-用以增加总购买量,系数不能小于等于0,支持两位小数,总购买量=(用户当前购买数+购买基数)*购买系数。',
  205. 'default' => '1',
  206. 'desc' => '手动增加购买系数',
  207. 'match' => 'is_string',
  208. 'update' => 'text',
  209. 'show' => 'buy=1',
  210. ),
  211. 'num_add_buy' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '购买基数',
  215. 'default' => '0',
  216. 'desc' => '手动增加阅读数',
  217. 'match' => 'option',
  218. 'update' => 'text',
  219. 'show' => 'buy=1',
  220. ),
  221. 'num_add_view' => array
  222. (
  223. 'type' => 'int-11',
  224. 'name' => '阅读数基数',
  225. 'default' => '0',
  226. 'desc' => '手动增加阅读数',
  227. 'match' => 'option',
  228. 'update' => 'text',
  229. 'show' => 'buy=2',
  230. ),
  231. 'num_view' => array
  232. (
  233. 'type' => 'int-11',
  234. 'name' => '阅读数',
  235. 'default' => '0',
  236. 'desc' => '请填写阅读数',
  237. 'match' => 'option',
  238. 'search' => 'order',
  239. ),
  240. 'buy_price' => array
  241. (
  242. 'type' => 'varchar-50',
  243. 'name' => '门票单张支付价格-单位元,直接填写数字即可',
  244. 'default' => '10',
  245. 'desc' => '支付价格',
  246. 'match' => 'is_string',
  247. 'update' => 'text',
  248. 'show' => 'buy=1',
  249. ),
  250. 'buy_content' => array
  251. (
  252. 'type' => 'text-255',
  253. 'name' => '购买说明',
  254. 'default' => "<p>
  255. 1、门票使用成功后可直接通过【入口】进入合集;&nbsp;
  256. </p>
  257. <p>
  258. 2、合集门票为虚拟商品,如无系统问题,使用后不可退款;
  259. </p>
  260. <p>
  261. &nbsp;3、购买多少张就会生成多少门票,每个门票只能被激活一次;
  262. </p>
  263. <p>
  264. &nbsp;4、当购买成功后,系统会自动使用一个门票;&nbsp;
  265. </p>
  266. <p>
  267. 5、若您购买了多张门票,可将剩余门票赠送好友;
  268. </p>
  269. <p>
  270. &nbsp;6、如有其它问题可咨询在线客服。
  271. </p>",
  272. 'desc' => '请输入内容',
  273. 'match' => 'is_string',
  274. 'update' => 'editor',
  275. 'key' => 1,
  276. 'show' => 'buy=1',
  277. ),
  278. 'audit' => array
  279. (
  280. 'type' => 'int-11',
  281. 'name' => '审核',
  282. 'default' => '1',
  283. 'desc' => '审核',
  284. 'match' => 'is_numeric',
  285. //'update' => 'select',
  286. 'option' => $audit,
  287. //'search' => 'select',
  288. //'list' => true,
  289. //'edit' => true,
  290. ),
  291. 'status' => array
  292. (
  293. 'type' => 'int-11',
  294. 'name' => '上线状态',
  295. 'default' => '2',
  296. 'desc' => '上线状态',
  297. 'match' => 'is_numeric',
  298. //'update' => 'select',
  299. 'option' => $status,
  300. 'search' => 'select',
  301. 'list' => true,
  302. 'edit' => true,
  303. ),
  304. 'hr3' => array
  305. (
  306. 'name' => '首页按钮配置',
  307. 'class' => '',//本项必须填写
  308. 'attr' => '',
  309. ),
  310. 'button' => array
  311. (
  312. 'type' => 'varchar-100',
  313. 'name' => '首页按钮名称配置-仅有两个按钮,用逗号隔开,第一个是入口,第二个是排行榜,这里仅能修改按钮名称',
  314. 'default' => '入口,排行榜',
  315. 'desc' => '首页按钮名称配置',
  316. 'match' => 'is_string',
  317. 'update' => 'text',
  318. ),
  319. 'button_ftcolor' => array
  320. (
  321. 'type' => 'varchar-10',
  322. 'name' => '首页按钮文字颜色-默认为白色',
  323. 'default' => '#ffffff',
  324. 'desc' => '首页按钮文字颜色',
  325. 'match' => 'is_string',
  326. 'update' => 'color',
  327. ),
  328. 'button_bgcolor' => array
  329. (
  330. 'type' => 'varchar-10',
  331. 'name' => '首页按钮背景颜色配置-默认为黑色',
  332. 'default' => '#000000',
  333. 'desc' => '首页按钮背景颜色配置',
  334. 'match' => 'is_string',
  335. 'update' => 'color',
  336. ),
  337. 'button_bgjcolor' => array
  338. (
  339. 'type' => 'varchar-10',
  340. 'name' => '首页按钮背景渐变颜色配置-默认为黑色',
  341. 'default' => '#000000',
  342. 'desc' => '首页按钮背景渐变颜色配置',
  343. 'match' => 'option',
  344. 'update' => 'color',
  345. ),
  346. 'reorder' => array
  347. (
  348. 'type' => 'int-11',
  349. 'name' => '排序(数值越大越靠前)',
  350. 'default' => '1',
  351. 'desc' => '请输入排序',
  352. 'match' => 'option',
  353. //'update' => 'text',
  354. 'search' => 'order',
  355. 'list' => true,
  356. 'order' => 'desc',
  357. 'edit' => true,
  358. ),
  359. 'admin_founder' => array
  360. (
  361. 'type' => 'int-11',
  362. 'name' => '创建人',
  363. 'default' => '1',
  364. 'desc' => '创建人',
  365. 'match' => 'is_numeric',
  366. ),
  367. 'admin_editor' => array
  368. (
  369. 'type' => 'int-11',
  370. 'name' => '操作人',
  371. 'default' => '1',
  372. 'desc' => '操作人',
  373. 'match' => 'is_numeric',
  374. ),
  375. 'udate' => array
  376. (
  377. 'type' => 'int-11',
  378. 'name' => '更新时间',
  379. 'match' => array('is_numeric', time()),
  380. 'desc' => '',
  381. ),
  382. 'state' => array
  383. (
  384. 'type' => 'tinyint-1',
  385. 'name' => '状态',
  386. 'default' => '1',
  387. 'desc' => '请选择状态',
  388. 'match' => 'is_numeric',
  389. ),
  390. 'cdate' => array
  391. (
  392. 'type' => 'int-11',
  393. 'name' => '录入时间',
  394. 'match' => array('is_numeric', time()),
  395. 'desc' => '',
  396. # 只有insert时才生效
  397. 'insert' => true,
  398. ),
  399. ),
  400. 'top' => Dever::config('base')->top,
  401. # 增加这个,为了给当前的list增加一个option $admin = Dever::load('manage/auth.info');
  402. 'top_option' => array
  403. (
  404. array
  405. (
  406. 'value' => $auth,
  407. 'col' => 'cate_id',
  408. ),
  409. array
  410. (
  411. 'value' => Dever::load('manage/auth.authData'),
  412. 'col' => 'id',
  413. ),
  414. ),
  415. # 管理功能
  416. 'manage' => array
  417. (
  418. //'insert' => false,
  419. 'delete' => false,
  420. # 列表
  421. 'list_button' => array
  422. (
  423. 'update' => '编辑',
  424. 'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=4'))),
  425. 'br2' => array('<br />'),
  426. 'list1' => array('功能', '"function&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'),
  427. 'list2' => array('门票', '"buy&search_option_info_id={id}&oper_table=info"' , '{audit} == 1 && {buy} == 1'),
  428. 'br3' => array('<br />'),
  429. 'list3' => array('章节', '"page&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'),
  430. 'list4' => array('榜单', '"ranking&project=collection&search_option_info_id={id}&oper_table=info&oper_project=collection&where_id={id}"', '{audit} == 1'),
  431. ),
  432. ),
  433. # request 请求接口定义
  434. 'request' => array
  435. (
  436. 'search' => array
  437. (
  438. # 匹配的正则或函数 选填项
  439. 'option' => array
  440. (
  441. 'ids' => array('yes-id', 'in'),
  442. 'cate_id' => 'yes',
  443. 'name' => array('yes', 'like'),
  444. 'id' => 'yes',
  445. 'state' => 1,
  446. ),
  447. 'type' => 'all',
  448. 'order' => array('reorder' => 'desc', 'pdate' => 'desc', 'id' => 'desc'),
  449. 'limit' => '0,1000',
  450. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  451. ),
  452. 'getAll' => array
  453. (
  454. # 匹配的正则或函数 选填项
  455. 'option' => array
  456. (
  457. //'audit' => 2,
  458. 'buy' => 'yes',
  459. 'cate_id' => 'yes',
  460. 'status' => 1,
  461. 'state' => 1,
  462. ),
  463. 'type' => 'all',
  464. 'order' => array('reorder' => 'desc', 'pdate' => 'desc', 'id' => 'desc'),
  465. //'page' => array(10, 'list'),
  466. 'col' => $col,
  467. ),
  468. 'getAllByPage' => array
  469. (
  470. # 匹配的正则或函数 选填项
  471. 'option' => array
  472. (
  473. //'audit' => 2,
  474. 'cate_id_1' => array('yes-cate_id', '=', 'and('),
  475. 'time' => array('yes-pdate', '<=', 'or)'),
  476. 'buy' => 'yes',
  477. 'cate_id' => 'yes',
  478. 'status' => 1,
  479. 'state' => 1,
  480. ),
  481. 'type' => 'all',
  482. 'order' => array('reorder' => 'desc', 'pdate' => 'desc', 'id' => 'desc'),
  483. 'page' => array(10, 'list'),
  484. 'col' => $col,
  485. ),
  486. # 更新浏览量
  487. 'addView' => array
  488. (
  489. 'type' => 'update',
  490. 'where' => array
  491. (
  492. 'id' => 'yes',
  493. ),
  494. 'set' => array
  495. (
  496. 'num_view' => array('1', '+='),
  497. ),
  498. ),
  499. # 更新购买量
  500. 'addDing' => array
  501. (
  502. 'type' => 'update',
  503. 'where' => array
  504. (
  505. 'id' => 'yes',
  506. ),
  507. 'set' => array
  508. (
  509. 'num_up' => array('1', '+='),
  510. ),
  511. ),
  512. 'getIds' => array
  513. (
  514. # 匹配的正则或函数 选填项
  515. 'option' => array
  516. (
  517. 'cate_id' => array('yes-cate_id', 'in'),
  518. 'state' => 1,
  519. ),
  520. 'type' => 'all',
  521. 'order' => array('reorder' => 'desc', 'pdate' => 'desc','id' => 'desc'),
  522. 'col' => '*,id as value|id',
  523. ),
  524. 'getOne' => array
  525. (
  526. # 匹配的正则或函数 选填项
  527. 'option' => array
  528. (
  529. 'id' => 'yes',
  530. 'state' => 1,
  531. ),
  532. 'type' => 'one',
  533. 'col' => $col,
  534. ),
  535. # 热门
  536. 'getHot' => array
  537. (
  538. # 匹配的正则或函数 选填项
  539. 'option' => array
  540. (
  541. //'audit' => 2,
  542. 'hot' => 1,
  543. 'buy' => 'yes',
  544. 'time' => array('yes-pdate', '<=', 'or)'),
  545. 'cate_id' => 'yes',
  546. 'status' => 1,
  547. 'state' => 1,
  548. ),
  549. 'type' => 'all',
  550. 'order' => array('reorder' => 'desc', 'pdate' => 'desc', 'id' => 'desc'),
  551. //'page' => array(10, 'list'),
  552. 'col' => $col,
  553. ),
  554. 'getNew' => array
  555. (
  556. # 匹配的正则或函数 选填项
  557. 'option' => array
  558. (
  559. 'cate_id_1' => array('yes-cate_id', '=', 'and('),
  560. 'time' => array('yes-pdate', '<=', 'or)'),
  561. 'cate_id' => 'yes',
  562. 'status' => 1,
  563. 'state' => 1,
  564. ),
  565. 'type' => 'one',
  566. 'order' => array('ssdate' => 'desc'),
  567. 'col' => $col . ',case when cate_id = 1 then pdate else pdate-'.$time.' end as ssdate',
  568. ),
  569. ),
  570. );
  571. /* 由top_option取代
  572. if ($auth) {
  573. $config['request']['list'] = array
  574. (
  575. 'type' => 'all',
  576. 'order' => array('id' => 'desc'),
  577. 'col' => '*|id',
  578. 'page' => array(15, 'list'),
  579. 'option' => array
  580. (
  581. 'cate_id' => array($auth, 'in'),
  582. ),
  583. );
  584. }
  585. */
  586. return $config;