news.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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' => 'collection/lib/content.updateTypeId',
  31. //'update' => 'collection/lib/content.updateTypeId',
  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' => array
  134. (
  135. 'type' => 'varchar-300',
  136. 'name' => '标签',
  137. 'default' => '',
  138. 'desc' => '标签',
  139. 'match' => 'option',
  140. 'update' => 'text',
  141. //如果要输入带有自动提示的,就打开这个,update=>'text'即可
  142. 'autocomplete' => array('tag/manage.getByName', 'id', 'tag/info-one#name'),
  143. //'list' => true,
  144. //显示
  145. //'show' => 'cate=tag/manage.getByCate?cate=',
  146. ),
  147. 'share_title' => array
  148. (
  149. 'type' => 'varchar-100',
  150. 'name' => '分享标题',
  151. 'default' => '',
  152. 'desc' => '分享标题',
  153. 'match' => 'option',
  154. 'update' => 'text',
  155. ),
  156. 'share_pic' => array
  157. (
  158. 'type' => 'varchar-150',
  159. 'name' => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  160. 'default' => '',
  161. 'desc' => '分享图片',
  162. 'match' => 'option',
  163. 'update' => 'image',
  164. 'key' => '1',
  165. 'place' => '150',
  166. //'upload' => 'qiniu',
  167. //'large' => true,
  168. ),
  169. 'share_content' => array
  170. (
  171. 'type' => 'varchar-200',
  172. 'name' => '分享内容',
  173. 'default' => '',
  174. 'desc' => '分享内容',
  175. 'match' => 'option',
  176. 'update' => 'textarea',
  177. ),
  178. 'content' => array
  179. (
  180. 'type' => 'text-255',
  181. 'name' => '内容',
  182. 'default' => '',
  183. 'desc' => '请输入内容',
  184. 'match' => 'is_string',
  185. 'update' => 'editor',
  186. 'key' => '1',
  187. ),
  188. 'beizhu' => array
  189. (
  190. 'type' => 'varchar-500',
  191. 'name' => '备注',
  192. 'default' => '',
  193. 'desc' => '备注',
  194. 'match' => 'option',
  195. 'update' => 'textarea',
  196. ),
  197. 'pdate' => array
  198. (
  199. 'type' => 'int-11',
  200. 'name' => '发布时间-选择未来时间将不会显示',
  201. 'match' => array('is_numeric', time()),
  202. 'default' => '',
  203. 'desc' => '',
  204. 'update' => 'date',
  205. 'callback' => 'maketime',
  206. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  207. ),
  208. 'reorder' => array
  209. (
  210. 'type' => 'int-11',
  211. 'name' => '排序(数值越大越靠前)',
  212. 'default' => '1',
  213. 'desc' => '请输入排序',
  214. 'match' => 'option',
  215. //'update' => 'text',
  216. 'search' => 'order',
  217. 'list' => true,
  218. 'order' => 'desc',
  219. 'edit' => true,
  220. ),
  221. 'top' => array
  222. (
  223. 'type' => 'int-11',
  224. 'name' => '是否推荐到首页',
  225. 'default' => '1',
  226. 'desc' => '是否推荐到首页',
  227. 'match' => 'is_numeric',
  228. 'update' => 'select',
  229. 'option' => $top,
  230. 'search' => 'select',
  231. 'list' => true,
  232. 'edit' => true,
  233. ),
  234. 'status' => array
  235. (
  236. 'type' => 'int-11',
  237. 'name' => '发布状态',
  238. 'default' => '1',
  239. 'desc' => '发布状态',
  240. 'match' => 'is_numeric',
  241. 'update' => 'select',
  242. 'option' => $status,
  243. 'search' => 'select',
  244. 'list' => true,
  245. 'edit' => true,
  246. ),
  247. 'state' => array
  248. (
  249. 'type' => 'tinyint-1',
  250. 'name' => '状态',
  251. 'default' => '1',
  252. 'desc' => '请选择状态',
  253. 'match' => 'is_numeric',
  254. ),
  255. 'cdate' => array
  256. (
  257. 'type' => 'int-11',
  258. 'name' => '创建时间',
  259. 'match' => array('is_numeric', time()),
  260. 'desc' => '',
  261. # 只有insert时才生效
  262. 'insert' => true,
  263. //'search' => 'time',
  264. ),
  265. ),
  266. # 管理功能
  267. 'manage' => array
  268. (
  269. ),
  270. # request 请求接口定义
  271. 'request' => array
  272. (
  273. 'search' => array
  274. (
  275. # 匹配的正则或函数 选填项
  276. 'option' => array
  277. (
  278. 'ids' => array('yes-id', 'in'),
  279. 'name' => array('yes', 'like'),
  280. 'id' => 'yes',
  281. 'type' => 'yes',
  282. 'status' => 1,
  283. 'state' => 1,
  284. ),
  285. 'type' => 'all',
  286. 'order' => array('reorder' => 'desc', 'cdate' => 'desc'),
  287. 'limit' => '0,1000',
  288. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  289. ),
  290. 'getHome' => array
  291. (
  292. # 匹配的正则或函数 选填项
  293. 'option' => array
  294. (
  295. 'ids' => array('yes-id', 'in'),
  296. 'name' => array('yes', 'like'),
  297. 'id' => 'yes',
  298. 'type' => 'yes',
  299. 'status' => 1,
  300. 'state' => 1,
  301. ),
  302. 'type' => 'all',
  303. 'order' => array('top' => 'desc', 'reorder' => 'desc', 'cdate' => 'desc'),
  304. 'limit' => '0,10',
  305. 'col' => '*',
  306. ),
  307. 'getOne' => array
  308. (
  309. # 匹配的正则或函数 选填项
  310. 'option' => array
  311. (
  312. 'ids' => array('yes-id', 'in'),
  313. 'name' => array('yes', 'like'),
  314. 'id' => 'yes',
  315. 'type' => 'yes',
  316. 'status' => 1,
  317. 'state' => 1,
  318. ),
  319. 'type' => 'one',
  320. 'col' => '*',
  321. ),
  322. 'getAll' => array
  323. (
  324. # 匹配的正则或函数 选填项
  325. 'option' => array
  326. (
  327. 'type' => 'yes',
  328. 'name' => array('yes', 'like'),
  329. 'status' => 1,
  330. 'state' => 1,
  331. ),
  332. 'type' => 'all',
  333. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  334. 'page' => array(10, 'list'),
  335. 'col' => '*',
  336. ),
  337. ),
  338. );