info.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  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';
  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. 'pic_cover' => array
  131. (
  132. 'type' => 'varchar-150',
  133. 'name' => '列表页封面图-4:3比例的图片',
  134. 'default' => '',
  135. 'desc' => '列表封面图',
  136. 'match' => 'is_string',
  137. //'update' => 'image',
  138. 'key' => '1',
  139. 'place' => '150',
  140. ),
  141. 'pic_view_cover' => array
  142. (
  143. 'type' => 'varchar-150',
  144. 'name' => '封面图-图片尺寸660*660px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  145. 'default' => '',
  146. 'desc' => '封面图',
  147. 'match' => 'is_string',
  148. 'update' => 'image',
  149. 'key' => '1',
  150. 'place' => '150',
  151. ),
  152. 'pic_view_bg' => array
  153. (
  154. 'type' => 'text-255',
  155. 'name' => '全屏背景图-图片尺寸750*1386px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  156. 'default' => '',
  157. 'desc' => '全屏背景图',
  158. 'match' => 'is_string',
  159. 'update' => 'images',
  160. 'key' => '1',
  161. 'place' => '150',
  162. ),
  163. 'pic_gd' => array
  164. (
  165. 'type' => 'varchar-150',
  166. 'name' => '电子刊推广图-图片尺寸512*688px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  167. 'default' => '',
  168. 'desc' => '电子刊推广图',
  169. 'match' => 'is_string',
  170. 'update' => 'image',
  171. 'key' => '1',
  172. 'place' => '150',
  173. ),
  174. 'bgmusic' => array
  175. (
  176. 'type' => 'varchar-800',
  177. 'name' => '背景音乐-音频格式mp3,上传大小不能超过100M',
  178. 'default' => '',
  179. 'desc' => '背景音乐',
  180. 'match' => 'option',
  181. 'update' => 'upload',
  182. 'key' => '2',
  183. 'place' => '150',
  184. 'upload' => 'qiniu',
  185. 'large' => true,
  186. //不覆盖原文件,生成新文件
  187. 'cover' => 2,
  188. ),
  189. 'num_ding' => array
  190. (
  191. 'type' => 'int-11',
  192. 'name' => '订阅数',
  193. 'default' => '0',
  194. 'desc' => '请填写订阅数',
  195. 'match' => 'option',
  196. 'search' => 'order',
  197. 'list' => 'Dever::load("journal/lib/manage.ding?id={id}")',
  198. 'list_name' => '统计数字',
  199. ),
  200. 'num_up' => array
  201. (
  202. 'type' => 'int-11',
  203. 'name' => '阅读数',
  204. 'default' => '0',
  205. 'desc' => '阅读数',
  206. 'match' => 'option',
  207. ),
  208. 'state' => array
  209. (
  210. 'type' => 'tinyint-1',
  211. 'name' => '状态',
  212. 'default' => '1',
  213. 'desc' => '请选择状态',
  214. 'match' => 'is_numeric',
  215. ),
  216. 'audit' => array
  217. (
  218. 'type' => 'int-11',
  219. 'name' => '审核',
  220. 'default' => '1',
  221. 'desc' => '审核',
  222. 'match' => 'is_numeric',
  223. //'update' => 'select',
  224. 'option' => $audit,
  225. //'search' => 'select',
  226. //'list' => true,
  227. //'edit' => true,
  228. ),
  229. 'status' => array
  230. (
  231. 'type' => 'int-11',
  232. 'name' => '上线状态',
  233. 'default' => '1',
  234. 'desc' => '上线状态',
  235. 'match' => 'is_numeric',
  236. //'update' => 'select',
  237. 'option' => $status,
  238. 'search' => 'select',
  239. 'list' => true,
  240. 'edit' => true,
  241. ),
  242. 'admin_founder' => array
  243. (
  244. 'type' => 'int-11',
  245. 'name' => '创建人',
  246. 'default' => '1',
  247. 'desc' => '创建人',
  248. 'match' => 'is_numeric',
  249. ),
  250. 'admin_editor' => array
  251. (
  252. 'type' => 'int-11',
  253. 'name' => '操作人',
  254. 'default' => '1',
  255. 'desc' => '操作人',
  256. 'match' => 'is_numeric',
  257. ),
  258. 'pdate' => array
  259. (
  260. 'type' => 'int-11',
  261. 'name' => '发售时间',
  262. 'match' => array('is_numeric', time()),
  263. 'default' => '',
  264. 'desc' => '',
  265. 'update' => 'date',
  266. 'callback' => 'maketime',
  267. 'insert' => true,
  268. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  269. 'auth' => '"{pdate}" > 0',
  270. ),
  271. 'ydate' => array
  272. (
  273. 'type' => 'int-11',
  274. 'name' => '预售时间',
  275. 'match' => 'option',
  276. 'default' => '',
  277. 'desc' => '',
  278. //'update' => 'date',
  279. 'callback' => 'maketime',
  280. //'insert' => true,
  281. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  282. //'auth' => '"{ydate}" > 0',
  283. ),
  284. 'top' => array
  285. (
  286. 'type' => 'tinyint-11',
  287. 'name' => '是否显示排行榜',
  288. 'default' => '1',
  289. 'desc' => '是否显示排行榜',
  290. 'match' => 'option',
  291. 'update' => 'radio',
  292. 'option' => $top,
  293. 'list' => true,
  294. 'search' => 'select',
  295. 'edit' => true,
  296. ),
  297. 'buy' => array
  298. (
  299. 'type' => 'int-11',
  300. 'name' => '是否收费',
  301. 'default' => '1',
  302. 'desc' => '是否收费',
  303. 'match' => 'option',
  304. 'update' => 'radio',
  305. 'option' => $buy,
  306. 'control' => 'buy',
  307. //'list' => true,
  308. 'search' => 'select',
  309. ),
  310. 'buy_type' => array
  311. (
  312. 'type' => 'int-11',
  313. 'name' => '支付类型',
  314. 'default' => '1',
  315. 'desc' => '支付类型',
  316. 'match' => 'option',
  317. 'update' => 'radio',
  318. 'option' => $buy_type,
  319. 'show' => 'buy=1',
  320. ),
  321. 'hot' => array
  322. (
  323. 'type' => 'tinyint-1',
  324. 'name' => '是否热门电子刊',
  325. 'default' => '2',
  326. 'desc' => '是否热门电子刊',
  327. 'match' => 'option',
  328. //'update' => 'radio',
  329. 'option' => $hot,
  330. 'search' => 'select',
  331. 'list' => true,
  332. 'edit' => true,
  333. ),
  334. 'cash' => array
  335. (
  336. 'type' => 'varchar-50',
  337. 'name' => '单本支付价格-实际的电子刊单本支付价格,单位元,直接填写数字即可',
  338. 'default' => '',
  339. 'desc' => '支付价格',
  340. 'match' => 'is_string',
  341. 'update' => 'text',
  342. 'show' => 'buy=1',
  343. ),
  344. 'buy_content' => array
  345. (
  346. 'type' => 'text-255',
  347. 'name' => '购买说明',
  348. 'default' => '',
  349. 'desc' => '请输入内容',
  350. 'match' => 'is_string',
  351. 'update' => 'editor',
  352. 'key' => 1,
  353. 'show' => 'buy=1',
  354. ),
  355. 'num_ratio_ding' => array
  356. (
  357. 'type' => 'varchar-20',
  358. 'name' => '订阅系数-系数不能小于等于0,支持两位小数,电子刊总订阅量=(用户当前订阅数+订阅基数)*订阅系数。注意:如果设置了明星,这里设置将失效',
  359. 'default' => '1',
  360. 'desc' => '手动增加订阅系数',
  361. 'match' => 'is_string',
  362. 'update' => 'text',
  363. 'show' => 'buy=1&buy_type=1',
  364. ),
  365. 'num_add_ding' => array
  366. (
  367. 'type' => 'int-11',
  368. 'name' => '订阅基数-注意:如果设置了明星,这里设置将失效',
  369. 'default' => '0',
  370. 'desc' => '手动增加阅读数',
  371. 'match' => 'option',
  372. 'update' => 'text',
  373. 'show' => 'buy=1&buy_type=1',
  374. ),
  375. 'share_yes' => array
  376. (
  377. 'type' => 'int-11',
  378. 'name' => '是否显示分享按钮',
  379. 'default' => '1',
  380. 'desc' => '是否显示分享按钮',
  381. 'match' => 'option',
  382. 'update' => 'radio',
  383. 'option' => $share,
  384. 'control' => 'share_yes',
  385. ),
  386. 'share_title' => array
  387. (
  388. 'type' => 'varchar-100',
  389. 'name' => '分享标题',
  390. 'default' => '',
  391. 'desc' => '分享标题',
  392. 'match' => 'option',
  393. 'update' => 'text',
  394. 'show' => 'share_yes=1',
  395. ),
  396. 'share_pic' => array
  397. (
  398. 'type' => 'varchar-150',
  399. 'name' => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  400. 'default' => '',
  401. 'desc' => '分享图片',
  402. 'match' => 'is_string',
  403. 'update' => 'image',
  404. 'key' => '1',
  405. 'place' => '150',
  406. 'show' => 'share_yes=1',
  407. //'upload' => 'qiniu',
  408. //'large' => true,
  409. ),
  410. 'share_content' => array
  411. (
  412. 'type' => 'varchar-200',
  413. 'name' => '分享内容',
  414. 'default' => '',
  415. 'desc' => '分享内容',
  416. 'match' => 'option',
  417. 'update' => 'textarea',
  418. 'show' => 'share_yes=1',
  419. ),
  420. 'reorder' => array
  421. (
  422. 'type' => 'int-11',
  423. 'name' => '排序(数值越大越靠前)',
  424. 'default' => '1',
  425. 'desc' => '请输入排序',
  426. 'match' => 'option',
  427. 'update' => 'text',
  428. 'search' => 'order',
  429. 'list' => true,
  430. 'order' => 'desc',
  431. 'edit' => true,
  432. ),
  433. 'udate' => array
  434. (
  435. 'type' => 'int-11',
  436. 'name' => '更新时间',
  437. 'match' => array('is_numeric', time()),
  438. 'desc' => '',
  439. ),
  440. 'cdate' => array
  441. (
  442. 'type' => 'int-11',
  443. 'name' => '录入时间',
  444. 'match' => array('is_numeric', time()),
  445. 'desc' => '',
  446. # 只有insert时才生效
  447. 'insert' => true,
  448. ),
  449. ),
  450. 'top' => Dever::config('base')->top,
  451. # 增加这个,为了给当前的list增加一个option $admin = Dever::load('manage/auth.info');
  452. 'top_option' => array
  453. (
  454. array
  455. (
  456. 'value' => $auth,
  457. 'col' => 'cate_id',
  458. ),
  459. array
  460. (
  461. 'value' => Dever::load('manage/auth.authData'),
  462. 'col' => 'id',
  463. ),
  464. ),
  465. # 管理功能
  466. 'manage' => array
  467. (
  468. //'insert' => false,
  469. 'delete' => false,
  470. # 列表
  471. 'list_button' => array
  472. (
  473. 'update' => '编辑电子刊',
  474. 'br1' => array('<br />'),
  475. 'edit' => array('电子刊预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=4'))),
  476. 'edit1' => array('活动预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=13')), '{audit} == 1 && {buy} == 1'),
  477. 'br2' => array('<br />'),
  478. 'list10' => array('排行榜', '"journal_num&project=act&search_type=4&search_option_journal_id={id}&oper_parent=info&oper_project=journal"' , '{audit} == 1 && {buy} == 1'),
  479. 'list' => array('内页管理', '"content&search_option_info_id={id}&oper_parent=info&page_type=1"' , '{audit} == 1'),
  480. //'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'),
  481. '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'),
  482. 'list1' => array('购买本数管理', '"buy_num&search_option_info_id={id}&oper_parent=info"' , '{audit} == 1 && {buy} == 1'),
  483. 'list2' => array('购买明星设置', '"star&search_option_info_id={id}&oper_parent=info"' , '{audit} == 1 && {buy} == 1 && {buy_type} == 2'),
  484. ),
  485. ),
  486. # request 请求接口定义
  487. 'request' => array
  488. (
  489. 'search' => array
  490. (
  491. # 匹配的正则或函数 选填项
  492. 'option' => array
  493. (
  494. 'ids' => array('yes-id', 'in'),
  495. 'cate_id' => 'yes',
  496. 'name' => array('yes', 'like'),
  497. 'id' => 'yes',
  498. 'state' => 1,
  499. ),
  500. 'type' => 'all',
  501. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  502. 'limit' => '0,1000',
  503. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  504. ),
  505. 'getAll' => array
  506. (
  507. # 匹配的正则或函数 选填项
  508. 'option' => array
  509. (
  510. //'audit' => 2,
  511. 'buy' => 'yes',
  512. 'buy_type' => 'yes',
  513. 'cate_id' => 'yes',
  514. 'status' => 2,
  515. 'state' => 1,
  516. ),
  517. 'type' => 'all',
  518. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  519. //'page' => array(10, 'list'),
  520. 'col' => $col,
  521. ),
  522. 'getAllByPage' => array
  523. (
  524. # 匹配的正则或函数 选填项
  525. 'option' => array
  526. (
  527. //'audit' => 2,
  528. 'cate_id_1' => array('yes-cate_id', '=', 'and('),
  529. 'time' => array('yes-pdate', '<=', 'or)'),
  530. 'buy' => 'yes',
  531. 'buy_type' => 'yes',
  532. 'cate_id' => 'yes',
  533. 'status' => 2,
  534. 'state' => 1,
  535. ),
  536. 'type' => 'all',
  537. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  538. 'page' => array(10, 'list'),
  539. 'col' => $col,
  540. ),
  541. # 更新阅读数
  542. 'addDing' => array
  543. (
  544. 'type' => 'update',
  545. 'where' => array
  546. (
  547. 'id' => 'yes',
  548. ),
  549. 'set' => array
  550. (
  551. 'num_up' => array('1', '+='),
  552. ),
  553. ),
  554. 'getIds' => array
  555. (
  556. # 匹配的正则或函数 选填项
  557. 'option' => array
  558. (
  559. 'cate_id' => array('yes-cate_id', 'in'),
  560. 'state' => 1,
  561. ),
  562. 'type' => 'all',
  563. 'order' => array('reorder' => 'desc','id' => 'desc'),
  564. 'col' => '*,id as value|id',
  565. ),
  566. 'getOne' => array
  567. (
  568. # 匹配的正则或函数 选填项
  569. 'option' => array
  570. (
  571. 'id' => 'yes',
  572. 'state' => 1,
  573. ),
  574. 'type' => 'one',
  575. 'col' => $col,
  576. ),
  577. # 热门
  578. 'getHot' => array
  579. (
  580. # 匹配的正则或函数 选填项
  581. 'option' => array
  582. (
  583. //'audit' => 2,
  584. 'hot' => 1,
  585. 'buy' => 'yes',
  586. 'buy_type' => 'yes',
  587. 'cate_id' => 'yes',
  588. 'status' => 2,
  589. 'state' => 1,
  590. ),
  591. 'type' => 'all',
  592. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  593. //'page' => array(10, 'list'),
  594. 'col' => $col,
  595. ),
  596. 'getNew' => array
  597. (
  598. # 匹配的正则或函数 选填项
  599. 'option' => array
  600. (
  601. 'cate_id_1' => array('yes-cate_id', '=', 'and('),
  602. 'time' => array('yes-pdate', '<=', 'or)'),
  603. 'cate_id' => 'yes',
  604. 'status' => 2,
  605. 'state' => 1,
  606. ),
  607. 'type' => 'one',
  608. 'order' => array('ssdate' => 'desc'),
  609. 'col' => $col . ',case when cate_id = 1 then pdate else pdate-'.$time.' end as ssdate',
  610. ),
  611. ),
  612. );
  613. /* 由top_option取代
  614. if ($auth) {
  615. $config['request']['list'] = array
  616. (
  617. 'type' => 'all',
  618. 'order' => array('id' => 'desc'),
  619. 'col' => '*|id',
  620. 'page' => array(15, 'list'),
  621. 'option' => array
  622. (
  623. 'cate_id' => array($auth, 'in'),
  624. ),
  625. );
  626. }
  627. */
  628. return $config;