info.php 18 KB

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