news.php 13 KB

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