info.php 19 KB

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