info.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. <?php
  2. $time = (7*86400);
  3. $audit = Dever::config('base')->audit;
  4. $status = Dever::config('base')->status;
  5. $share = function()
  6. {
  7. $array = array();
  8. $info = Dever::db('poster/template')->state();
  9. if($info)
  10. {
  11. $array += $info;
  12. }
  13. return $array;
  14. };
  15. # 获取小刊分类权限
  16. $auth = Dever::tops();
  17. $cate = function() use ($auth)
  18. {
  19. $array = array();
  20. if ($auth) {
  21. $info = Dever::db('journal/cate')->getIds(array('ids' => $auth));
  22. } else {
  23. $info = Dever::db('journal/cate')->state();
  24. }
  25. if($info)
  26. {
  27. $array += $info;
  28. }
  29. return $array;
  30. };
  31. $share = array
  32. (
  33. 1 => '显示',
  34. 2 => '不显示',
  35. );
  36. $top = array
  37. (
  38. 1 => '显示',
  39. 2 => '不显示',
  40. );
  41. $buy = array
  42. (
  43. 1 => '收费',
  44. 2 => '免费',
  45. //3 => '会员',
  46. );
  47. $page = 15;
  48. # 常用的col
  49. $col = 'id,name,subname,pic_cover,pic_view_cover,pic_view_bg,pdate,num_view,num_ding,num_add_ding,num_ratio_ding,num_comment,buy,share_yes,share_title,share_pic,share_content,pic_gd,cate_id,cash,bgmusic';
  50. $config = array
  51. (
  52. # 表名
  53. 'name' => 'info',
  54. # 显示给用户看的名称
  55. 'lang' => '小刊管理',
  56. 'order' => 100,
  57. 'end' => array
  58. (
  59. 'insert' => 'journal/lib/manage.setJournalCache',
  60. 'update' => 'journal/lib/manage.setJournalCache',
  61. ),
  62. # 同步更新另外一个或多个表的数据 小刊不需要同步到审核页面
  63. /*
  64. 'syncone' => array
  65. (
  66. 'audit/data' => array
  67. (
  68. # 更新另外一个表的字段 => 本表的字段
  69. 'where' => array('data_id' => 'id', 'type' => 4),
  70. # 要更新的数据
  71. 'update' => array('data_id' => 'id', 'type' => 4, 'pdate' => 'pdate', 'reorder' => 'reorder', 'name' => 'name', 'audit' => 'audit', 'state' => 'state'),
  72. )
  73. ),
  74. */
  75. # 数据结构
  76. 'struct' => array
  77. (
  78. 'id' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => 'ID',
  82. 'default' => '',
  83. 'desc' => '',
  84. 'match' => 'is_numeric',
  85. 'list' => true,
  86. ),
  87. 'name' => array
  88. (
  89. 'type' => 'varchar-180',
  90. 'name' => '小刊标题',
  91. 'default' => '',
  92. 'desc' => '标题',
  93. 'match' => 'is_string',
  94. 'update' => 'text',
  95. 'search' => 'fulltext',
  96. 'list' => true,
  97. ),
  98. 'subname' => array
  99. (
  100. 'type' => 'varchar-80',
  101. 'name' => '子标题-一般为杂志的期数,如第1期',
  102. 'default' => '',
  103. 'desc' => '子标题',
  104. 'match' => 'is_string',
  105. 'update' => 'text',
  106. //'list' => true,
  107. ),
  108. 'cate_id' => array
  109. (
  110. 'type' => 'int-11',
  111. 'name' => '小刊分类',
  112. 'default' => '1',
  113. 'desc' => '小刊分类',
  114. 'match' => 'is_numeric',
  115. 'update' => 'select',
  116. 'option' => $cate,
  117. 'search' => 'select',
  118. 'list' => true,
  119. ),
  120. 'pic_cover' => array
  121. (
  122. 'type' => 'varchar-150',
  123. 'name' => '列表页封面图-4:3比例的图片',
  124. 'default' => '',
  125. 'desc' => '列表封面图',
  126. 'match' => 'is_string',
  127. //'update' => 'image',
  128. 'key' => '1',
  129. 'place' => '150',
  130. ),
  131. 'pic_view_cover' => array
  132. (
  133. 'type' => 'varchar-150',
  134. 'name' => '封面图-图片尺寸660*660px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  135. 'default' => '',
  136. 'desc' => '封面图',
  137. 'match' => 'is_string',
  138. 'update' => 'image',
  139. 'key' => '1',
  140. 'place' => '150',
  141. ),
  142. 'pic_view_bg' => array
  143. (
  144. 'type' => 'text-255',
  145. 'name' => '全屏背景图-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  146. 'default' => '',
  147. 'desc' => '全屏背景图',
  148. 'match' => 'is_string',
  149. 'update' => 'images',
  150. 'key' => '1',
  151. 'place' => '150',
  152. ),
  153. 'pic_gd' => array
  154. (
  155. 'type' => 'varchar-150',
  156. 'name' => '小刊推广图-图片尺寸512*688px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  157. 'default' => '',
  158. 'desc' => '小刊推广图',
  159. 'match' => 'is_string',
  160. 'update' => 'image',
  161. 'key' => '1',
  162. 'place' => '150',
  163. ),
  164. 'bgmusic' => array
  165. (
  166. 'type' => 'varchar-800',
  167. 'name' => '背景音乐-音频格式mp3,上传大小不能超过100M',
  168. 'default' => '',
  169. 'desc' => '背景音乐',
  170. 'match' => 'option',
  171. 'update' => 'upload',
  172. 'key' => '2',
  173. 'place' => '150',
  174. 'upload' => 'qiniu',
  175. 'large' => true,
  176. //不覆盖原文件,生成新文件
  177. 'cover' => 2,
  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. ),
  188. 'num_add_ding' => array
  189. (
  190. 'type' => 'int-11',
  191. 'name' => '订阅基数',
  192. 'default' => '0',
  193. 'desc' => '手动增加阅读数',
  194. 'match' => 'option',
  195. 'update' => 'text',
  196. ),
  197. 'num_ding' => array
  198. (
  199. 'type' => 'int-11',
  200. 'name' => '订阅数',
  201. 'default' => '0',
  202. 'desc' => '请填写订阅数',
  203. 'match' => 'option',
  204. 'search' => 'order',
  205. //'list' => '{num_view}+{num_add_view}',
  206. ),
  207. 'num_add_view' => array
  208. (
  209. 'type' => 'int-11',
  210. 'name' => '阅读数基数',
  211. 'default' => '0',
  212. 'desc' => '手动增加阅读数',
  213. 'match' => 'option',
  214. 'update' => 'text',
  215. ),
  216. 'num_view' => array
  217. (
  218. 'type' => 'int-11',
  219. 'name' => '阅读数',
  220. 'default' => '0',
  221. 'desc' => '请填写阅读数',
  222. 'match' => 'option',
  223. 'search' => 'order',
  224. //'list' => '{num_view}+{num_add_view}',
  225. ),
  226. 'num_add_up' => array
  227. (
  228. 'type' => 'int-11',
  229. 'name' => '喜欢基数',
  230. 'default' => '0',
  231. 'desc' => '喜欢基数',
  232. 'match' => 'option',
  233. //'update' => 'text',
  234. ),
  235. 'num_up' => array
  236. (
  237. 'type' => 'int-11',
  238. 'name' => '喜欢数',
  239. 'default' => '0',
  240. 'desc' => '请填写喜欢数',
  241. 'match' => 'option',
  242. //'search' => 'order',
  243. 'list' => 'Dever::load("journal/lib/manage.ding?id={id}")',
  244. 'list_name' => '统计数字',
  245. ),
  246. 'num_comment' => array
  247. (
  248. 'type' => 'int-11',
  249. 'name' => '评论数',
  250. 'default' => '0',
  251. 'desc' => '请填写评论数',
  252. 'search' => 'order',
  253. 'match' => 'option',
  254. //'list' => true,
  255. ),
  256. 'state' => array
  257. (
  258. 'type' => 'tinyint-1',
  259. 'name' => '状态',
  260. 'default' => '1',
  261. 'desc' => '请选择状态',
  262. 'match' => 'is_numeric',
  263. ),
  264. 'audit' => array
  265. (
  266. 'type' => 'int-11',
  267. 'name' => '审核',
  268. 'default' => '1',
  269. 'desc' => '审核',
  270. 'match' => 'is_numeric',
  271. //'update' => 'select',
  272. 'option' => $audit,
  273. //'search' => 'select',
  274. //'list' => true,
  275. //'edit' => true,
  276. ),
  277. 'status' => array
  278. (
  279. 'type' => 'int-11',
  280. 'name' => '上线状态',
  281. 'default' => '1',
  282. 'desc' => '上线状态',
  283. 'match' => 'is_numeric',
  284. //'update' => 'select',
  285. 'option' => $status,
  286. 'search' => 'select',
  287. 'list' => true,
  288. 'edit' => true,
  289. ),
  290. 'admin_founder' => array
  291. (
  292. 'type' => 'int-11',
  293. 'name' => '创建人',
  294. 'default' => '1',
  295. 'desc' => '创建人',
  296. 'match' => 'is_numeric',
  297. ),
  298. 'admin_editor' => array
  299. (
  300. 'type' => 'int-11',
  301. 'name' => '操作人',
  302. 'default' => '1',
  303. 'desc' => '操作人',
  304. 'match' => 'is_numeric',
  305. ),
  306. 'pdate' => array
  307. (
  308. 'type' => 'int-11',
  309. 'name' => '发售时间',
  310. 'match' => array('is_numeric', time()),
  311. 'default' => '',
  312. 'desc' => '',
  313. 'update' => 'date',
  314. 'callback' => 'maketime',
  315. 'insert' => true,
  316. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  317. 'auth' => '"{pdate}" > 0',
  318. ),
  319. 'ydate' => array
  320. (
  321. 'type' => 'int-11',
  322. 'name' => '预售时间',
  323. 'match' => 'option',
  324. 'default' => '',
  325. 'desc' => '',
  326. //'update' => 'date',
  327. 'callback' => 'maketime',
  328. //'insert' => true,
  329. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  330. //'auth' => '"{ydate}" > 0',
  331. ),
  332. 'share' => array
  333. (
  334. 'type' => 'text-255',
  335. 'name' => '分享海报-选择海报库中的海报',
  336. 'default' => '',
  337. 'desc' => '分享海报',
  338. 'match' => 'option',
  339. //'update' => 'checkbox',
  340. 'option' => $share,
  341. ),
  342. 'top' => array
  343. (
  344. 'type' => 'tinyint-11',
  345. 'name' => '是否显示排行榜',
  346. 'default' => '1',
  347. 'desc' => '是否显示排行榜',
  348. 'match' => 'option',
  349. 'update' => 'radio',
  350. 'option' => $top,
  351. 'list' => true,
  352. 'search' => 'select',
  353. ),
  354. 'buy' => array
  355. (
  356. 'type' => 'int-11',
  357. 'name' => '是否收费',
  358. 'default' => '1',
  359. 'desc' => '是否收费',
  360. 'match' => 'option',
  361. 'update' => 'radio',
  362. 'option' => $buy,
  363. 'control' => 'buy',
  364. 'list' => true,
  365. 'search' => 'select',
  366. ),
  367. 'cash' => array
  368. (
  369. 'type' => 'varchar-50',
  370. 'name' => '单本支付价格-实际的小刊单本支付价格,单位元,直接填写数字即可',
  371. 'default' => '',
  372. 'desc' => '支付价格',
  373. 'match' => 'is_string',
  374. 'update' => 'text',
  375. 'show' => 'buy=1',
  376. ),
  377. 'score' => array
  378. (
  379. 'type' => 'varchar-80',
  380. 'name' => '购买增加积分数-直接填写购买单本小刊的积分数,设置之后,积分规则里的设置将失效,如果设置为0,则按照积分规则进行增加积分',
  381. 'default' => '20',
  382. 'desc' => '增加积分数',
  383. 'match' => 'is_string',
  384. 'update' => 'text',
  385. 'show' => 'buy=1',
  386. ),
  387. 'dh_score' => array
  388. (
  389. 'type' => 'varchar-80',
  390. 'name' => '兑换增加积分数-直接填写兑换单本小刊的积分数,设置之后,积分规则里的设置将失效,如果设置为0,则按照积分规则进行增加积分',
  391. 'default' => '20',
  392. 'desc' => '增加积分数',
  393. 'match' => 'is_string',
  394. 'update' => 'text',
  395. 'show' => 'buy=1',
  396. ),
  397. 'share_yes' => array
  398. (
  399. 'type' => 'int-11',
  400. 'name' => '是否显示分享按钮',
  401. 'default' => '1',
  402. 'desc' => '是否显示分享按钮',
  403. 'match' => 'option',
  404. 'update' => 'radio',
  405. 'option' => $share,
  406. 'control' => 'share_yes',
  407. ),
  408. 'share_title' => array
  409. (
  410. 'type' => 'varchar-100',
  411. 'name' => '分享标题',
  412. 'default' => '',
  413. 'desc' => '分享标题',
  414. 'match' => 'option',
  415. 'update' => 'text',
  416. 'show' => 'share_yes=1',
  417. ),
  418. 'share_pic' => array
  419. (
  420. 'type' => 'varchar-150',
  421. 'name' => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  422. 'default' => '',
  423. 'desc' => '分享图片',
  424. 'match' => 'is_string',
  425. 'update' => 'image',
  426. 'key' => '1',
  427. 'place' => '150',
  428. 'show' => 'share_yes=1',
  429. //'upload' => 'qiniu',
  430. //'large' => true,
  431. ),
  432. 'share_content' => array
  433. (
  434. 'type' => 'varchar-200',
  435. 'name' => '分享内容',
  436. 'default' => '',
  437. 'desc' => '分享内容',
  438. 'match' => 'option',
  439. 'update' => 'textarea',
  440. 'show' => 'share_yes=1',
  441. ),
  442. 'reorder' => array
  443. (
  444. 'type' => 'int-11',
  445. 'name' => '排序(数值越大越靠前)',
  446. 'default' => '1',
  447. 'desc' => '请输入排序',
  448. 'match' => 'option',
  449. 'update' => 'text',
  450. 'search' => 'order',
  451. 'list' => true,
  452. 'order' => 'desc',
  453. 'edit' => true,
  454. ),
  455. 'udate' => array
  456. (
  457. 'type' => 'int-11',
  458. 'name' => '更新时间',
  459. 'match' => array('is_numeric', time()),
  460. 'desc' => '',
  461. ),
  462. 'cdate' => array
  463. (
  464. 'type' => 'int-11',
  465. 'name' => '录入时间',
  466. 'match' => array('is_numeric', time()),
  467. 'desc' => '',
  468. # 只有insert时才生效
  469. 'insert' => true,
  470. ),
  471. ),
  472. 'top' => Dever::config('base')->top,
  473. # 增加这个,为了给当前的list增加一个option
  474. 'top_option' => array
  475. (
  476. 'value' => $auth,
  477. 'col' => 'cate_id',
  478. ),
  479. # 管理功能
  480. 'manage' => array
  481. (
  482. //'insert' => false,
  483. 'delete' => false,
  484. # 列表
  485. 'list_button' => array
  486. (
  487. 'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=4'))),
  488. 'edit1' => array('活动预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=13'))),
  489. 'br2' => array('<br />'),
  490. 'list10' => array('排行榜', '"journal_num&project=act&search_type=4&search_option_journal_id={id}&oper_parent=info&oper_project=journal"'),
  491. 'list11' => array('积分排行榜(旧)', '"score&project=act&search_type=4&search_option_data_id={id}&oper_parent=info&oper_project=journal"'),
  492. //'list11' => array('邀请排行', '"invite&project=act&search_type=4&search_option_data_id={id}&oper_parent=info&oper_project=journal"'),
  493. 'br1' => array('<br />'),
  494. 'list' => array('内页管理', '"content&search_option_info_id={id}&oper_parent=info&page_type=1"' , '{audit} == 1'),
  495. 'br2' => array('<br />'),
  496. 'add' => array('购买设置', '"buy&project=journal&search_option_info_id={id}&oper_parent=info&oper_project=journal&oper_save_jump=info&where_id={id}"', '{audit} == 1'),
  497. 'add1' => array('活动设置', '"active&project=journal&search_option_info_id={id}&oper_parent=info&oper_project=journal&oper_save_jump=info&where_id={id}"', '{audit} == 1'),
  498. 'br3' => array('<br />'),
  499. 'list1' => array('购买本数管理', '"buy_num&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', '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', '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', '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_ding' => 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','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. 'getNew' => array
  605. (
  606. # 匹配的正则或函数 选填项
  607. 'option' => array
  608. (
  609. 'cate_id_1' => array('yes-cate_id', '=', 'and('),
  610. 'time' => array('yes-pdate', '<=', 'or)'),
  611. 'cate_id' => 'yes',
  612. 'status' => 2,
  613. 'state' => 1,
  614. ),
  615. 'type' => 'one',
  616. 'order' => array('ssdate' => 'desc'),
  617. 'col' => $col . ',case when cate_id = 1 then pdate else pdate-'.$time.' end as ssdate',
  618. ),
  619. ),
  620. );
  621. /* 由top_option取代
  622. if ($auth) {
  623. $config['request']['list'] = array
  624. (
  625. 'type' => 'all',
  626. 'order' => array('id' => 'desc'),
  627. 'col' => '*|id',
  628. 'page' => array(15, 'list'),
  629. 'option' => array
  630. (
  631. 'cate_id' => array($auth, 'in'),
  632. ),
  633. );
  634. }
  635. */
  636. return $config;