news.php 11 KB

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