info.php 15 KB

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