info.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  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. $buy_type = array
  48. (
  49. 1 => '普通支付',
  50. 2 => '按明星支付',
  51. );
  52. $hot = array
  53. (
  54. 1 => '热门',
  55. 2 => '普通',
  56. );
  57. $page = 15;
  58. # 常用的col
  59. $col = 'id,name,subname,pic_cover,pic_view_cover,pic_view_bg,pdate,num_ding,num_add_ding,num_ratio_ding,num_up,buy,buy_type,share_yes,share_title,share_pic,share_content,pic_gd,cate_id,cash,bgmusic,top,hot,h5';
  60. $config = array
  61. (
  62. # 表名
  63. 'name' => 'info',
  64. # 显示给用户看的名称
  65. 'lang' => '发刊管理',
  66. 'order' => 100,
  67. 'end' => array
  68. (
  69. 'insert' => 'journal/lib/manage.setJournalCache',
  70. 'update' => 'journal/lib/manage.setJournalCache',
  71. ),
  72. # 同步更新另外一个或多个表的数据 电子刊不需要同步到审核页面
  73. /*
  74. 'syncone' => array
  75. (
  76. 'audit/data' => array
  77. (
  78. # 更新另外一个表的字段 => 本表的字段
  79. 'where' => array('data_id' => 'id', 'type' => 4),
  80. # 要更新的数据
  81. 'update' => array('data_id' => 'id', 'type' => 4, 'pdate' => 'pdate', 'reorder' => 'reorder', 'name' => 'name', 'audit' => 'audit', 'state' => 'state'),
  82. )
  83. ),
  84. */
  85. # 数据结构
  86. 'struct' => array
  87. (
  88. 'id' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => 'ID',
  92. 'default' => '',
  93. 'desc' => '',
  94. 'match' => 'is_numeric',
  95. 'list' => true,
  96. ),
  97. 'name' => array
  98. (
  99. 'type' => 'varchar-180',
  100. 'name' => '电子刊标题',
  101. 'default' => '',
  102. 'desc' => '标题',
  103. 'match' => 'is_string',
  104. 'update' => 'text',
  105. 'search' => 'fulltext',
  106. 'list' => true,
  107. ),
  108. 'subname' => array
  109. (
  110. 'type' => 'varchar-80',
  111. 'name' => '子标题-一般为杂志的期数,如第1期',
  112. 'default' => '',
  113. 'desc' => '子标题',
  114. 'match' => 'is_string',
  115. 'update' => 'text',
  116. //'list' => true,
  117. ),
  118. 'cate_id' => array
  119. (
  120. 'type' => 'int-11',
  121. 'name' => '电子刊分类',
  122. 'default' => '1',
  123. 'desc' => '电子刊分类',
  124. 'match' => 'is_numeric',
  125. 'update' => 'select',
  126. 'option' => $cate,
  127. 'search' => 'select',
  128. //'list' => true,
  129. ),
  130. 'h5' => array
  131. (
  132. 'type' => 'varchar-800',
  133. 'name' => 'h5地址-填写后,直接跳转到该页面',
  134. 'default' => '',
  135. 'desc' => 'h5地址',
  136. 'match' => 'option',
  137. 'update' => 'textarea',
  138. //'search' => 'fulltext',
  139. //'list' => true,
  140. ),
  141. 'pic_cover' => array
  142. (
  143. 'type' => 'varchar-150',
  144. 'name' => '列表页封面图-4:3比例的图片',
  145. 'default' => '',
  146. 'desc' => '列表封面图',
  147. 'match' => 'is_string',
  148. //'update' => 'image',
  149. 'key' => '1',
  150. 'place' => '150',
  151. ),
  152. 'pic_view_cover' => array
  153. (
  154. 'type' => 'varchar-150',
  155. 'name' => '封面图-图片尺寸660*660px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  156. 'default' => '',
  157. 'desc' => '封面图',
  158. 'match' => 'is_string',
  159. 'update' => 'image',
  160. 'key' => '1',
  161. 'place' => '150',
  162. ),
  163. 'pic_view_bg' => array
  164. (
  165. 'type' => 'text-255',
  166. 'name' => '全屏背景图-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  167. 'default' => '',
  168. 'desc' => '全屏背景图',
  169. 'match' => 'is_string',
  170. 'update' => 'images',
  171. 'key' => '1',
  172. 'place' => '150',
  173. ),
  174. 'pic_gd' => array
  175. (
  176. 'type' => 'varchar-150',
  177. 'name' => '电子刊推广图-图片尺寸512*688px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  178. 'default' => '',
  179. 'desc' => '电子刊推广图',
  180. 'match' => 'is_string',
  181. 'update' => 'image',
  182. 'key' => '1',
  183. 'place' => '150',
  184. ),
  185. 'bgmusic' => array
  186. (
  187. 'type' => 'varchar-800',
  188. 'name' => '背景音乐-音频格式mp3,上传大小不能超过100M',
  189. 'default' => '',
  190. 'desc' => '背景音乐',
  191. 'match' => 'option',
  192. 'update' => 'upload',
  193. 'key' => '2',
  194. 'place' => '150',
  195. 'upload' => 'qiniu',
  196. 'large' => true,
  197. //不覆盖原文件,生成新文件
  198. 'cover' => 2,
  199. ),
  200. 'num_ding' => array
  201. (
  202. 'type' => 'int-11',
  203. 'name' => '订阅数',
  204. 'default' => '0',
  205. 'desc' => '请填写订阅数',
  206. 'match' => 'option',
  207. 'search' => 'order',
  208. 'list' => 'Dever::load("journal/lib/manage.ding?id={id}")',
  209. 'list_name' => '统计数字',
  210. ),
  211. 'num_up' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '阅读数',
  215. 'default' => '0',
  216. 'desc' => '阅读数',
  217. 'match' => 'option',
  218. ),
  219. 'state' => array
  220. (
  221. 'type' => 'tinyint-1',
  222. 'name' => '状态',
  223. 'default' => '1',
  224. 'desc' => '请选择状态',
  225. 'match' => 'is_numeric',
  226. ),
  227. 'audit' => array
  228. (
  229. 'type' => 'int-11',
  230. 'name' => '审核',
  231. 'default' => '1',
  232. 'desc' => '审核',
  233. 'match' => 'is_numeric',
  234. //'update' => 'select',
  235. 'option' => $audit,
  236. //'search' => 'select',
  237. //'list' => true,
  238. //'edit' => true,
  239. ),
  240. 'status' => array
  241. (
  242. 'type' => 'int-11',
  243. 'name' => '上线状态',
  244. 'default' => '1',
  245. 'desc' => '上线状态',
  246. 'match' => 'is_numeric',
  247. //'update' => 'select',
  248. 'option' => $status,
  249. 'search' => 'select',
  250. 'list' => true,
  251. 'edit' => true,
  252. ),
  253. 'admin_founder' => array
  254. (
  255. 'type' => 'int-11',
  256. 'name' => '创建人',
  257. 'default' => '1',
  258. 'desc' => '创建人',
  259. 'match' => 'is_numeric',
  260. ),
  261. 'admin_editor' => array
  262. (
  263. 'type' => 'int-11',
  264. 'name' => '操作人',
  265. 'default' => '1',
  266. 'desc' => '操作人',
  267. 'match' => 'is_numeric',
  268. ),
  269. 'pdate' => array
  270. (
  271. 'type' => 'int-11',
  272. 'name' => '发售时间',
  273. 'match' => array('is_numeric', time()),
  274. 'default' => '',
  275. 'desc' => '',
  276. 'update' => 'date',
  277. 'callback' => 'maketime',
  278. 'insert' => true,
  279. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  280. 'auth' => '"{pdate}" > 0',
  281. ),
  282. 'ydate' => array
  283. (
  284. 'type' => 'int-11',
  285. 'name' => '预售时间',
  286. 'match' => 'option',
  287. 'default' => '',
  288. 'desc' => '',
  289. //'update' => 'date',
  290. 'callback' => 'maketime',
  291. //'insert' => true,
  292. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  293. //'auth' => '"{ydate}" > 0',
  294. ),
  295. 'top' => array
  296. (
  297. 'type' => 'tinyint-11',
  298. 'name' => '是否显示排行榜',
  299. 'default' => '1',
  300. 'desc' => '是否显示排行榜',
  301. 'match' => 'option',
  302. 'update' => 'radio',
  303. 'option' => $top,
  304. 'list' => true,
  305. 'search' => 'select',
  306. 'edit' => true,
  307. ),
  308. 'buy' => array
  309. (
  310. 'type' => 'int-11',
  311. 'name' => '是否收费',
  312. 'default' => '1',
  313. 'desc' => '是否收费',
  314. 'match' => 'option',
  315. 'update' => 'radio',
  316. 'option' => $buy,
  317. 'control' => 'buy',
  318. //'list' => true,
  319. 'search' => 'select',
  320. ),
  321. 'buy_type' => array
  322. (
  323. 'type' => 'int-11',
  324. 'name' => '支付类型',
  325. 'default' => '1',
  326. 'desc' => '支付类型',
  327. 'match' => 'option',
  328. 'update' => 'radio',
  329. 'option' => $buy_type,
  330. 'show' => 'buy=1',
  331. ),
  332. 'hot' => array
  333. (
  334. 'type' => 'tinyint-1',
  335. 'name' => '是否热门电子刊',
  336. 'default' => '2',
  337. 'desc' => '是否热门电子刊',
  338. 'match' => 'option',
  339. //'update' => 'radio',
  340. 'option' => $hot,
  341. 'search' => 'select',
  342. 'list' => true,
  343. 'edit' => true,
  344. ),
  345. 'cash' => array
  346. (
  347. 'type' => 'varchar-50',
  348. 'name' => '单本支付价格-实际的电子刊单本支付价格,单位元,直接填写数字即可',
  349. 'default' => '',
  350. 'desc' => '支付价格',
  351. 'match' => 'is_string',
  352. 'update' => 'text',
  353. 'show' => 'buy=1',
  354. ),
  355. 'buy_content' => array
  356. (
  357. 'type' => 'text-255',
  358. 'name' => '购买说明',
  359. 'default' => '',
  360. 'desc' => '请输入内容',
  361. 'match' => 'is_string',
  362. 'update' => 'editor',
  363. 'key' => 1,
  364. 'show' => 'buy=1',
  365. ),
  366. 'num_ratio_ding' => array
  367. (
  368. 'type' => 'varchar-20',
  369. 'name' => '订阅系数-系数不能小于等于0,支持两位小数,电子刊总订阅量=(用户当前订阅数+订阅基数)*订阅系数。注意:如果设置了明星,这里设置将失效',
  370. 'default' => '1',
  371. 'desc' => '手动增加订阅系数',
  372. 'match' => 'is_string',
  373. 'update' => 'text',
  374. 'show' => 'buy=1&buy_type=1',
  375. ),
  376. 'num_add_ding' => array
  377. (
  378. 'type' => 'int-11',
  379. 'name' => '订阅基数-注意:如果设置了明星,这里设置将失效',
  380. 'default' => '0',
  381. 'desc' => '手动增加阅读数',
  382. 'match' => 'option',
  383. 'update' => 'text',
  384. 'show' => 'buy=1&buy_type=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. 'update' => '编辑电子刊',
  485. 'br1' => array('<br />'),
  486. 'edit' => array('电子刊预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=4'))),
  487. 'edit1' => array('活动预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=13')), '{audit} == 1 && {buy} == 1'),
  488. 'br2' => array('<br />'),
  489. 'list10' => array('排行榜', '"journal_num&project=act&search_type=4&search_option_journal_id={id}&oper_parent=info&oper_project=journal"' , '{audit} == 1 && {buy} == 1'),
  490. 'list' => array('内页管理', '"content&search_option_info_id={id}&oper_parent=info&page_type=1"' , '{audit} == 1'),
  491. //'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'),
  492. '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'),
  493. 'list1' => array('购买本数管理', '"buy_num&search_option_info_id={id}&oper_parent=info"' , '{audit} == 1 && {buy} == 1'),
  494. 'list2' => array('购买明星设置', '"star&search_option_info_id={id}&oper_parent=info"' , '{audit} == 1 && {buy} == 1 && {buy_type} == 2'),
  495. ),
  496. ),
  497. # request 请求接口定义
  498. 'request' => array
  499. (
  500. 'search' => array
  501. (
  502. # 匹配的正则或函数 选填项
  503. 'option' => array
  504. (
  505. 'ids' => array('yes-id', 'in'),
  506. 'cate_id' => 'yes',
  507. 'name' => array('yes', 'like'),
  508. 'id' => 'yes',
  509. 'state' => 1,
  510. ),
  511. 'type' => 'all',
  512. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  513. 'limit' => '0,1000',
  514. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  515. ),
  516. 'getAll' => array
  517. (
  518. # 匹配的正则或函数 选填项
  519. 'option' => array
  520. (
  521. //'audit' => 2,
  522. 'buy' => 'yes',
  523. 'buy_type' => '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. 'buy_type' => 'yes',
  543. 'cate_id' => 'yes',
  544. 'status' => 2,
  545. 'state' => 1,
  546. ),
  547. 'type' => 'all',
  548. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  549. 'page' => array(10, 'list'),
  550. 'col' => $col,
  551. ),
  552. # 更新阅读数
  553. 'addDing' => array
  554. (
  555. 'type' => 'update',
  556. 'where' => array
  557. (
  558. 'id' => 'yes',
  559. ),
  560. 'set' => array
  561. (
  562. 'num_up' => array('1', '+='),
  563. ),
  564. ),
  565. 'getIds' => array
  566. (
  567. # 匹配的正则或函数 选填项
  568. 'option' => array
  569. (
  570. 'cate_id' => array('yes-cate_id', 'in'),
  571. 'state' => 1,
  572. ),
  573. 'type' => 'all',
  574. 'order' => array('reorder' => 'desc','id' => 'desc'),
  575. 'col' => '*,id as value|id',
  576. ),
  577. 'getOne' => array
  578. (
  579. # 匹配的正则或函数 选填项
  580. 'option' => array
  581. (
  582. 'id' => 'yes',
  583. 'state' => 1,
  584. ),
  585. 'type' => 'one',
  586. 'col' => $col,
  587. ),
  588. # 热门
  589. 'getHot' => array
  590. (
  591. # 匹配的正则或函数 选填项
  592. 'option' => array
  593. (
  594. //'audit' => 2,
  595. 'hot' => 1,
  596. 'buy' => 'yes',
  597. 'buy_type' => 'yes',
  598. 'cate_id' => 'yes',
  599. 'status' => 2,
  600. 'state' => 1,
  601. ),
  602. 'type' => 'all',
  603. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  604. //'page' => array(10, 'list'),
  605. 'col' => $col,
  606. ),
  607. 'getNew' => array
  608. (
  609. # 匹配的正则或函数 选填项
  610. 'option' => array
  611. (
  612. 'cate_id_1' => array('yes-cate_id', '=', 'and('),
  613. 'time' => array('yes-pdate', '<=', 'or)'),
  614. 'cate_id' => 'yes',
  615. 'status' => 2,
  616. 'state' => 1,
  617. ),
  618. 'type' => 'one',
  619. 'order' => array('ssdate' => 'desc'),
  620. 'col' => $col . ',case when cate_id = 1 then pdate else pdate-'.$time.' end as ssdate',
  621. ),
  622. ),
  623. );
  624. /* 由top_option取代
  625. if ($auth) {
  626. $config['request']['list'] = array
  627. (
  628. 'type' => 'all',
  629. 'order' => array('id' => 'desc'),
  630. 'col' => '*|id',
  631. 'page' => array(15, 'list'),
  632. 'option' => array
  633. (
  634. 'cate_id' => array($auth, 'in'),
  635. ),
  636. );
  637. }
  638. */
  639. return $config;