info.php 23 KB

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