info.php 17 KB

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