info.php 15 KB

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