info.php 17 KB

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