info.php 16 KB

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