news.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <?php
  2. $time = time();
  3. $status = array
  4. (
  5. 1 => '已发布',
  6. 2 => '未发布',
  7. );
  8. $top = array
  9. (
  10. 1 => '不推荐',
  11. 2 => '首页推荐',
  12. );
  13. $type = array
  14. (
  15. 1 => '资讯',
  16. 2 => '专题',
  17. 3 => '视频',
  18. 4 => '活动',
  19. );
  20. $type_value = Dever::input('search_option_type', 1);
  21. if ($type_value == 2) {
  22. # 专题
  23. $small_pic_name = '首页专题封面图';
  24. $small_pic_size = '700*460';
  25. $small_pic_update = 'image';
  26. $small_pic_match = 'is_string';
  27. } elseif ($type_value == 4) {
  28. # 活动
  29. $small_pic_name = '活动封面小图';
  30. $small_pic_size = '288*384';
  31. $small_pic_update = 'image';
  32. $small_pic_match = 'is_string';
  33. } else {
  34. $small_pic_name = '活动封面小图';
  35. $small_pic_size = '288*384';
  36. $small_pic_update = 'hidden';
  37. $small_pic_match = 'option';
  38. }
  39. $name = $type[$type_value];
  40. return array
  41. (
  42. # 表名
  43. 'name' => 'news',
  44. # 显示给用户看的名称
  45. 'lang' => $name . '管理',
  46. 'order' => 98,
  47. 'end' => array
  48. (
  49. //'insert' => 'tag/api.update',
  50. //'update' => 'tag/api.update',
  51. ),
  52. # 数据结构
  53. 'struct' => array
  54. (
  55. 'id' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => 'ID',
  59. 'default' => '',
  60. 'desc' => '',
  61. 'match' => 'is_numeric',
  62. 'list' => true,
  63. ),
  64. 'type' => array
  65. (
  66. 'type' => 'int-11',
  67. 'name' => '类型',
  68. 'default' => '1',
  69. 'desc' => '类型',
  70. 'match' => 'is_numeric',
  71. 'update' => 'hidden',
  72. 'value' => $type_value,
  73. 'search' => 'hidden',
  74. ),
  75. 'name' => array
  76. (
  77. 'type' => 'varchar-80',
  78. 'name' => '主标题-最大长度50个字符',
  79. 'default' => '',
  80. 'desc' => '主标题',
  81. 'match' => 'is_string',
  82. 'update' => 'text',
  83. 'list' => true,
  84. 'search' => 'fulltext',
  85. ),
  86. 'desc' => array
  87. (
  88. 'type' => 'varchar-50',
  89. 'name' => '副标题-最大长度50个字符',
  90. 'default' => '',
  91. 'desc' => '副标题',
  92. 'match' => 'option',
  93. 'update' => 'text',
  94. 'list' => true,
  95. 'search' => 'fulltext',
  96. ),
  97. 'info' => array
  98. (
  99. 'type' => 'varchar-500',
  100. 'name' => '简介-最大长度100个字符',
  101. 'default' => '',
  102. 'desc' => '简介',
  103. 'match' => 'is_string',
  104. 'update' => 'textarea',
  105. ),
  106. 'author' => array
  107. (
  108. 'type' => 'varchar-50',
  109. 'name' => '作者-最大长度20个字符',
  110. 'default' => '',
  111. 'desc' => '作者',
  112. 'match' => 'is_string',
  113. 'update' => 'text',
  114. 'list' => true,
  115. 'search' => 'fulltext',
  116. ),
  117. 'pic' => array
  118. (
  119. 'type' => 'varchar-150',
  120. 'name' => '封面图-图片尺寸'.($type_value == 3 ? '1200*670' : '1200*530').'px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  121. 'default' => '',
  122. 'desc' => '封面图',
  123. 'match' => 'is_string',
  124. 'update' => 'image',
  125. 'key' => '1',
  126. 'place' => $type_value == 3 ? '1200*670' : '1200*530',
  127. ),
  128. 'small_pic' => array
  129. (
  130. 'type' => 'varchar-150',
  131. 'name' => $small_pic_name . '-图片尺寸'.$small_pic_size.'px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  132. 'default' => '',
  133. 'desc' => '封面图',
  134. 'match' => $small_pic_match,
  135. 'update' => $small_pic_update,
  136. 'key' => '1',
  137. 'place' => $small_pic_size,
  138. ),
  139. 'video' => array
  140. (
  141. 'type' => 'varchar-800',
  142. 'name' => '上传视频-视频格式为MP4,上传大小不能超过4M。如需添加腾讯视频,请将腾讯视频分享链接添加至【上传视频】按钮下方地址输入框中',
  143. 'default' => '',
  144. 'desc' => '上传推荐视频',
  145. 'match' => $type_value == 3 ? 'is_string' : 'option',
  146. 'update' => $type_value == 3 ? 'upload' : 'hidden',
  147. 'key' => '3',
  148. 'place' => '150',
  149. 'upload' => 'yun',
  150. 'large' => true,
  151. ),
  152. 'tag_name' => array
  153. (
  154. 'type' => 'varchar-100',
  155. 'name' => '标签标题',
  156. 'default' => '',
  157. 'desc' => '标签标题',
  158. 'match' => 'option',
  159. 'update' => 'text',
  160. ),
  161. 'tag' => array
  162. (
  163. 'type' => 'varchar-1000',
  164. 'name' => '标签-多个用半角逗号,隔开',
  165. 'default' => '',
  166. 'desc' => '标签',
  167. 'match' => 'option',
  168. 'update' => 'text',
  169. //如果要输入带有自动提示的,就打开这个,update=>'text'即可
  170. //'autocomplete' => array('tag/manage.getByName', 'id', 'tag/info-one#name'),
  171. //'list' => true,
  172. //显示
  173. //'show' => 'cate=tag/manage.getByCate?cate=',
  174. ),
  175. 'share_title' => array
  176. (
  177. 'type' => 'varchar-100',
  178. 'name' => '分享标题',
  179. 'default' => '',
  180. 'desc' => '分享标题',
  181. 'match' => 'option',
  182. //'update' => 'text',
  183. ),
  184. 'share_pic' => array
  185. (
  186. 'type' => 'varchar-150',
  187. 'name' => '分享图片-图片尺寸200*200px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  188. 'default' => '',
  189. 'desc' => '分享图片',
  190. 'match' => 'option',
  191. //'update' => 'image',
  192. 'key' => '1',
  193. 'place' => '200*200',
  194. //'upload' => 'qiniu',
  195. //'large' => true,
  196. ),
  197. 'share_content' => array
  198. (
  199. 'type' => 'varchar-200',
  200. 'name' => '分享内容',
  201. 'default' => '',
  202. 'desc' => '分享内容',
  203. 'match' => 'option',
  204. //'update' => 'textarea',
  205. ),
  206. 'content' => array
  207. (
  208. 'type' => 'text-255',
  209. 'name' => '内容',
  210. 'default' => '',
  211. 'desc' => '请输入内容',
  212. 'match' => 'is_string',
  213. 'update' => 'editor',
  214. 'key' => '1',
  215. ),
  216. 'content_video' => array
  217. (
  218. 'type' => 'varchar-800',
  219. 'name' => '上传内容视频-视频格式为MP4,上传大小不能超过4M。如需添加腾讯视频,请将腾讯视频分享链接添加至【上传视频】按钮下方地址输入框中',
  220. 'default' => '',
  221. 'desc' => '上传推荐视频',
  222. 'match' => $type_value != 3 ? 'option' : 'option',
  223. 'update' => $type_value != 3 ? 'upload' : 'hidden',
  224. 'key' => '3',
  225. 'place' => '150',
  226. 'upload' => 'yun',
  227. 'large' => true,
  228. ),
  229. 'content_video_pic' => array
  230. (
  231. 'type' => 'varchar-150',
  232. 'name' => '内容视频封面图-图片尺寸1200*670px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  233. 'default' => '',
  234. 'desc' => '封面图',
  235. 'match' => $type_value != 3 ? 'option' : 'option',
  236. 'update' => $type_value != 3 ? 'image' : 'hidden',
  237. 'key' => '1',
  238. 'place' => '1200*670',
  239. ),
  240. 'beizhu' => array
  241. (
  242. 'type' => 'varchar-500',
  243. 'name' => '备注',
  244. 'default' => '',
  245. 'desc' => '备注',
  246. 'match' => 'option',
  247. 'update' => 'textarea',
  248. ),
  249. 'pdate' => array
  250. (
  251. 'type' => 'int-11',
  252. 'name' => '发布时间-选择未来时间将不会显示',
  253. 'match' => 'option',
  254. 'default' => '',
  255. 'desc' => '',
  256. 'update' => 'date',
  257. 'callback' => 'maketime',
  258. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  259. ),
  260. 'reorder' => array
  261. (
  262. 'type' => 'int-11',
  263. 'name' => '排序(数值越大越靠前)',
  264. 'default' => '1',
  265. 'desc' => '请输入排序',
  266. 'match' => 'option',
  267. //'update' => 'text',
  268. 'search' => 'order',
  269. 'list' => true,
  270. 'order' => 'desc',
  271. 'edit' => true,
  272. ),
  273. 'top' => array
  274. (
  275. 'type' => 'int-11',
  276. 'name' => '是否推荐到首页',
  277. 'default' => '1',
  278. 'desc' => '是否推荐到首页',
  279. 'match' => 'is_numeric',
  280. 'update' => 'select',
  281. 'option' => $top,
  282. 'search' => 'select',
  283. 'list' => true,
  284. 'edit' => true,
  285. ),
  286. 'status' => array
  287. (
  288. 'type' => 'int-11',
  289. 'name' => '发布状态',
  290. 'default' => '1',
  291. 'desc' => '发布状态',
  292. 'match' => 'is_numeric',
  293. 'update' => 'select',
  294. 'option' => $status,
  295. 'search' => 'select',
  296. 'list' => true,
  297. 'edit' => true,
  298. ),
  299. 'state' => array
  300. (
  301. 'type' => 'tinyint-1',
  302. 'name' => '状态',
  303. 'default' => '1',
  304. 'desc' => '请选择状态',
  305. 'match' => 'is_numeric',
  306. ),
  307. 'cdate' => array
  308. (
  309. 'type' => 'int-11',
  310. 'name' => '创建时间',
  311. 'match' => array('is_numeric', time()),
  312. 'desc' => '',
  313. # 只有insert时才生效
  314. 'insert' => true,
  315. //'search' => 'time',
  316. ),
  317. ),
  318. # 管理功能
  319. 'manage' => array
  320. (
  321. ),
  322. # request 请求接口定义
  323. 'request' => array
  324. (
  325. 'search' => array
  326. (
  327. # 匹配的正则或函数 选填项
  328. 'option' => array
  329. (
  330. 'ids' => array('yes-id', 'in'),
  331. 'name' => array('yes', 'like'),
  332. 'id' => 'yes',
  333. 'type' => 'yes',
  334. 'status' => 1,
  335. 'state' => 1,
  336. ),
  337. 'type' => 'all',
  338. 'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
  339. 'limit' => '0,1000',
  340. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  341. ),
  342. 'getHome' => array
  343. (
  344. # 匹配的正则或函数 选填项
  345. 'option' => array
  346. (
  347. 'ids' => array('yes-id', 'in'),
  348. 'name' => array('yes', 'like'),
  349. 'pdate' => array($time, '<='),
  350. 'id' => 'yes',
  351. 'type' => 'yes',
  352. 'status' => 1,
  353. 'state' => 1,
  354. ),
  355. 'type' => 'all',
  356. 'order' => array('top' => 'desc', 'reorder' => 'desc', 'cdate' => 'desc'),
  357. 'limit' => '0,10',
  358. 'col' => '*',
  359. ),
  360. 'getOne' => array
  361. (
  362. # 匹配的正则或函数 选填项
  363. 'option' => array
  364. (
  365. 'ids' => array('yes-id', 'in'),
  366. 'name' => array('yes', 'like'),
  367. 'pdate' => array($time, '<='),
  368. 'id' => 'yes',
  369. 'type' => 'yes',
  370. 'status' => 1,
  371. 'state' => 1,
  372. ),
  373. 'type' => 'one',
  374. 'col' => '*',
  375. ),
  376. 'getAll' => array
  377. (
  378. # 匹配的正则或函数 选填项
  379. 'option' => array
  380. (
  381. 'type' => 'yes',
  382. 'name' => array('yes', 'like', 'and('),
  383. 'tag' => array('yes', 'like', 'or)'),
  384. 'pdate' => array($time, '<='),
  385. 'status' => 1,
  386. 'state' => 1,
  387. ),
  388. 'type' => 'all',
  389. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  390. 'page' => array(5, 'list'),
  391. 'col' => '*',
  392. ),
  393. 'getAllVideo' => array
  394. (
  395. # 匹配的正则或函数 选填项
  396. 'option' => array
  397. (
  398. 'type' => 'yes',
  399. 'name' => array('yes', 'like', 'and('),
  400. 'tag' => array('yes', 'like', 'or)'),
  401. 'pdate' => array($time, '<='),
  402. 'status' => 1,
  403. 'state' => 1,
  404. ),
  405. 'type' => 'all',
  406. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  407. 'page' => array(12, 'list'),
  408. 'col' => '*',
  409. ),
  410. ),
  411. );