info.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  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,top,hot';
  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. 'search' => 'select',
  383. 'list' => true,
  384. 'edit' => true,
  385. ),
  386. 'cash' => array
  387. (
  388. 'type' => 'varchar-50',
  389. 'name' => '单本支付价格-实际的小刊单本支付价格,单位元,直接填写数字即可',
  390. 'default' => '',
  391. 'desc' => '支付价格',
  392. 'match' => 'is_string',
  393. 'update' => 'text',
  394. 'show' => 'buy=1',
  395. ),
  396. 'score' => array
  397. (
  398. 'type' => 'varchar-80',
  399. 'name' => '购买增加积分数-直接填写购买单本小刊的积分数,设置之后,积分规则里的设置将失效,如果设置为0,则按照积分规则进行增加积分',
  400. 'default' => '20',
  401. 'desc' => '增加积分数',
  402. 'match' => 'is_string',
  403. 'update' => 'text',
  404. 'show' => 'buy=1',
  405. ),
  406. 'dh_score' => array
  407. (
  408. 'type' => 'varchar-80',
  409. 'name' => '兑换增加积分数-直接填写兑换单本小刊的积分数,设置之后,积分规则里的设置将失效,如果设置为0,则按照积分规则进行增加积分',
  410. 'default' => '20',
  411. 'desc' => '增加积分数',
  412. 'match' => 'is_string',
  413. 'update' => 'text',
  414. 'show' => 'buy=1',
  415. ),
  416. 'share_yes' => array
  417. (
  418. 'type' => 'int-11',
  419. 'name' => '是否显示分享按钮',
  420. 'default' => '1',
  421. 'desc' => '是否显示分享按钮',
  422. 'match' => 'option',
  423. 'update' => 'radio',
  424. 'option' => $share,
  425. 'control' => 'share_yes',
  426. ),
  427. 'share_title' => array
  428. (
  429. 'type' => 'varchar-100',
  430. 'name' => '分享标题',
  431. 'default' => '',
  432. 'desc' => '分享标题',
  433. 'match' => 'option',
  434. 'update' => 'text',
  435. 'show' => 'share_yes=1',
  436. ),
  437. 'share_pic' => array
  438. (
  439. 'type' => 'varchar-150',
  440. 'name' => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  441. 'default' => '',
  442. 'desc' => '分享图片',
  443. 'match' => 'is_string',
  444. 'update' => 'image',
  445. 'key' => '1',
  446. 'place' => '150',
  447. 'show' => 'share_yes=1',
  448. //'upload' => 'qiniu',
  449. //'large' => true,
  450. ),
  451. 'share_content' => array
  452. (
  453. 'type' => 'varchar-200',
  454. 'name' => '分享内容',
  455. 'default' => '',
  456. 'desc' => '分享内容',
  457. 'match' => 'option',
  458. 'update' => 'textarea',
  459. 'show' => 'share_yes=1',
  460. ),
  461. 'reorder' => array
  462. (
  463. 'type' => 'int-11',
  464. 'name' => '排序(数值越大越靠前)',
  465. 'default' => '1',
  466. 'desc' => '请输入排序',
  467. 'match' => 'option',
  468. 'update' => 'text',
  469. 'search' => 'order',
  470. 'list' => true,
  471. 'order' => 'desc',
  472. 'edit' => true,
  473. ),
  474. 'udate' => array
  475. (
  476. 'type' => 'int-11',
  477. 'name' => '更新时间',
  478. 'match' => array('is_numeric', time()),
  479. 'desc' => '',
  480. ),
  481. 'cdate' => array
  482. (
  483. 'type' => 'int-11',
  484. 'name' => '录入时间',
  485. 'match' => array('is_numeric', time()),
  486. 'desc' => '',
  487. # 只有insert时才生效
  488. 'insert' => true,
  489. ),
  490. ),
  491. 'top' => Dever::config('base')->top,
  492. # 增加这个,为了给当前的list增加一个option $admin = Dever::load('manage/auth.info');
  493. 'top_option' => array
  494. (
  495. array
  496. (
  497. 'value' => $auth,
  498. 'col' => 'cate_id',
  499. ),
  500. array
  501. (
  502. 'value' => Dever::load('manage/auth.authData'),
  503. 'col' => 'id',
  504. ),
  505. ),
  506. # 管理功能
  507. 'manage' => array
  508. (
  509. //'insert' => false,
  510. 'delete' => false,
  511. # 列表
  512. 'list_button' => array
  513. (
  514. 'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=4'))),
  515. 'edit1' => array('活动预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=13')), '{audit} == 1 && {buy} == 1'),
  516. 'br2' => array('<br />'),
  517. 'list10' => array('排行榜', '"journal_num&project=act&search_type=4&search_option_journal_id={id}&oper_parent=info&oper_project=journal"' , '{audit} == 1 && {buy} == 1'),
  518. 'list11' => array('积分排行榜(旧)', '"score&project=act&search_type=4&search_option_data_id={id}&oper_parent=info&oper_project=journal"', '{audit} == 1 && {buy} == 1'),
  519. //'list11' => array('邀请排行', '"invite&project=act&search_type=4&search_option_data_id={id}&oper_parent=info&oper_project=journal"'),
  520. 'br1' => array('<br />'),
  521. 'list' => array('内页管理', '"content&search_option_info_id={id}&oper_parent=info&page_type=1"' , '{audit} == 1'),
  522. 'br2' => array('<br />'),
  523. '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'),
  524. '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'),
  525. 'br3' => array('<br />'),
  526. 'list1' => array('购买本数管理', '"buy_num&search_option_info_id={id}&oper_parent=info"' , '{audit} == 1 && {buy} == 1'),
  527. ),
  528. ),
  529. # request 请求接口定义
  530. 'request' => array
  531. (
  532. 'search' => array
  533. (
  534. # 匹配的正则或函数 选填项
  535. 'option' => array
  536. (
  537. 'ids' => array('yes-id', 'in'),
  538. 'cate_id' => 'yes',
  539. 'name' => array('yes', 'like'),
  540. 'id' => 'yes',
  541. 'state' => 1,
  542. ),
  543. 'type' => 'all',
  544. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  545. 'limit' => '0,1000',
  546. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  547. ),
  548. 'getAll' => array
  549. (
  550. # 匹配的正则或函数 选填项
  551. 'option' => array
  552. (
  553. //'audit' => 2,
  554. 'buy' => 'yes',
  555. 'cate_id' => 'yes',
  556. 'status' => 2,
  557. 'state' => 1,
  558. ),
  559. 'type' => 'all',
  560. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  561. //'page' => array(10, 'list'),
  562. 'col' => $col,
  563. ),
  564. 'getAllByPage' => array
  565. (
  566. # 匹配的正则或函数 选填项
  567. 'option' => array
  568. (
  569. //'audit' => 2,
  570. 'cate_id_1' => array('yes-cate_id', '=', 'and('),
  571. 'time' => array('yes-pdate', '<=', 'or)'),
  572. 'buy' => 'yes',
  573. 'cate_id' => 'yes',
  574. 'status' => 2,
  575. 'state' => 1,
  576. ),
  577. 'type' => 'all',
  578. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  579. 'page' => array(10, 'list'),
  580. 'col' => $col,
  581. ),
  582. # 更新浏览量
  583. 'addView' => array
  584. (
  585. 'type' => 'update',
  586. 'where' => array
  587. (
  588. 'id' => 'yes',
  589. ),
  590. 'set' => array
  591. (
  592. 'num_view' => array('1', '+='),
  593. ),
  594. ),
  595. # 更新订阅量
  596. 'addDing' => array
  597. (
  598. 'type' => 'update',
  599. 'where' => array
  600. (
  601. 'id' => 'yes',
  602. ),
  603. 'set' => array
  604. (
  605. 'num_up' => array('1', '+='),
  606. ),
  607. ),
  608. 'getIds' => array
  609. (
  610. # 匹配的正则或函数 选填项
  611. 'option' => array
  612. (
  613. 'cate_id' => array('yes-cate_id', 'in'),
  614. 'state' => 1,
  615. ),
  616. 'type' => 'all',
  617. 'order' => array('reorder' => 'desc','id' => 'desc'),
  618. 'col' => '*,id as value|id',
  619. ),
  620. 'getOne' => array
  621. (
  622. # 匹配的正则或函数 选填项
  623. 'option' => array
  624. (
  625. 'id' => 'yes',
  626. 'state' => 1,
  627. ),
  628. 'type' => 'one',
  629. 'col' => $col,
  630. ),
  631. 'getNew' => array
  632. (
  633. # 匹配的正则或函数 选填项
  634. 'option' => array
  635. (
  636. 'cate_id_1' => array('yes-cate_id', '=', 'and('),
  637. 'time' => array('yes-pdate', '<=', 'or)'),
  638. 'cate_id' => 'yes',
  639. 'status' => 2,
  640. 'state' => 1,
  641. ),
  642. 'type' => 'one',
  643. 'order' => array('ssdate' => 'desc'),
  644. 'col' => $col . ',case when cate_id = 1 then pdate else pdate-'.$time.' end as ssdate',
  645. ),
  646. ),
  647. );
  648. /* 由top_option取代
  649. if ($auth) {
  650. $config['request']['list'] = array
  651. (
  652. 'type' => 'all',
  653. 'order' => array('id' => 'desc'),
  654. 'col' => '*|id',
  655. 'page' => array(15, 'list'),
  656. 'option' => array
  657. (
  658. 'cate_id' => array($auth, 'in'),
  659. ),
  660. );
  661. }
  662. */
  663. return $config;