news.php 11 KB

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