vod.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <?php
  2. $page = 15;
  3. $cate = function()
  4. {
  5. $array = array();
  6. $info = Dever::db('content/cate')->state();
  7. if($info)
  8. {
  9. $array += $info;
  10. }
  11. return $array;
  12. };
  13. $author = function()
  14. {
  15. $array = array();
  16. $info = Dever::db('content/author')->state();
  17. if($info)
  18. {
  19. $array += $info;
  20. }
  21. return $array;
  22. };
  23. $share = function()
  24. {
  25. $array = array();
  26. $info = Dever::db('poster/template')->state();
  27. if($info)
  28. {
  29. $array += $info;
  30. }
  31. return $array;
  32. };
  33. return array
  34. (
  35. # 表名
  36. 'name' => 'vod',
  37. # 显示给用户看的名称
  38. 'lang' => '点播视频管理',
  39. 'order' => 100,
  40. # 数据结构
  41. 'struct' => array
  42. (
  43. 'id' => array
  44. (
  45. 'type' => 'int-11',
  46. 'name' => 'ID',
  47. 'default' => '',
  48. 'desc' => '',
  49. 'match' => 'is_numeric',
  50. ),
  51. 'name' => array
  52. (
  53. 'type' => 'varchar-80',
  54. 'name' => '标题',
  55. 'default' => '',
  56. 'desc' => '标题',
  57. 'match' => 'is_string',
  58. 'update' => 'text',
  59. 'list' => true,
  60. ),
  61. 'link' => array
  62. (
  63. 'type' => 'varchar-800',
  64. 'name' => '点播地址',
  65. 'default' => '',
  66. 'desc' => '点播地址',
  67. 'match' => 'option',
  68. //'update' => 'text',
  69. //'list' => true,
  70. ),
  71. 'video' => array
  72. (
  73. 'type' => 'varchar-800',
  74. 'name' => '上传视频',
  75. 'default' => '',
  76. 'desc' => '上传点播视频',
  77. 'match' => 'is_string',
  78. 'update' => 'upload',
  79. 'key' => '3',
  80. 'place' => '150',
  81. ),
  82. 'cate_id' => array
  83. (
  84. 'type' => 'int-11',
  85. 'name' => '所属栏目',
  86. 'default' => '1',
  87. 'desc' => '所属栏目',
  88. 'match' => 'is_numeric',
  89. 'update' => 'select',
  90. 'option' => $cate,
  91. 'search' => 'select',
  92. ),
  93. 'author_id' => array
  94. (
  95. 'type' => 'int-11',
  96. 'name' => '作者',
  97. 'default' => '1',
  98. 'desc' => '作者',
  99. 'match' => 'is_numeric',
  100. 'update' => 'select',
  101. 'option' => $author,
  102. 'search' => 'select',
  103. ),
  104. 'pic_cover' => array
  105. (
  106. 'type' => 'varchar-150',
  107. 'name' => '封面图-4:3比例的图片',
  108. 'default' => '',
  109. 'desc' => '封面图',
  110. 'match' => 'option',
  111. 'update' => 'image',
  112. 'key' => '1',
  113. 'place' => '150',
  114. ),
  115. 'num_add_view' => array
  116. (
  117. 'type' => 'int-11',
  118. 'name' => '手动增加浏览量pv数',
  119. 'default' => '0',
  120. 'desc' => '请填写手动增加浏览量pv',
  121. 'match' => 'option',
  122. 'update' => 'text',
  123. ),
  124. 'num_view' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '浏览量pv',
  128. 'default' => '0',
  129. 'desc' => '请填写浏览量pv',
  130. 'match' => 'option',
  131. 'search' => 'order',
  132. //'list' => '{num_view}+{num_add_view}',
  133. ),
  134. 'num_up' => array
  135. (
  136. 'type' => 'int-11',
  137. 'name' => '喜欢数',
  138. 'default' => '0',
  139. 'desc' => '请填写喜欢数',
  140. 'match' => 'option',
  141. //'search' => 'order',
  142. 'list' => '"喜欢数:{num_up}<br />浏览量:{num_view}+{num_add_view}<br />评论数:{num_comment}<br />"',
  143. 'list_name' => '统计数字',
  144. ),
  145. 'num_comment' => array
  146. (
  147. 'type' => 'int-11',
  148. 'name' => '评论数',
  149. 'default' => '0',
  150. 'desc' => '请填写评论数',
  151. 'search' => 'order',
  152. 'match' => 'option',
  153. //'list' => true,
  154. ),
  155. 'state' => array
  156. (
  157. 'type' => 'tinyint-1',
  158. 'name' => '状态',
  159. 'default' => '1',
  160. 'desc' => '请选择状态',
  161. 'match' => 'is_numeric',
  162. ),
  163. 'admin_founder' => array
  164. (
  165. 'type' => 'int-11',
  166. 'name' => '创建人',
  167. 'default' => '1',
  168. 'desc' => '创建人',
  169. 'match' => 'is_numeric',
  170. ),
  171. 'admin_editor' => array
  172. (
  173. 'type' => 'int-11',
  174. 'name' => '操作人',
  175. 'default' => '1',
  176. 'desc' => '操作人',
  177. 'match' => 'is_numeric',
  178. ),
  179. 'pdate' => array
  180. (
  181. 'type' => 'int-11',
  182. 'name' => '发布时间',
  183. 'match' => array('is_numeric', time()),
  184. 'default' => '',
  185. 'desc' => '',
  186. 'update' => 'date',
  187. 'callback' => 'maketime',
  188. 'insert' => true,
  189. 'list' => 'date("Y-m-d H:i:s", {pdate})',
  190. 'auth' => '"{pdate}" > 0',
  191. ),
  192. 'share' => array
  193. (
  194. 'type' => 'text-255',
  195. 'name' => '分享海报-选择海报库中的海报',
  196. 'default' => '',
  197. 'desc' => '分享海报',
  198. 'match' => 'option',
  199. //'update' => 'checkbox',
  200. 'option' => $share,
  201. ),
  202. 'reorder' => array
  203. (
  204. 'type' => 'int-11',
  205. 'name' => '排序(数值越大越靠前)',
  206. 'default' => '1',
  207. 'desc' => '请输入排序',
  208. 'match' => 'option',
  209. 'update' => 'text',
  210. 'search' => 'order',
  211. 'list' => true,
  212. 'order' => 'desc',
  213. 'edit' => true,
  214. ),
  215. 'udate' => array
  216. (
  217. 'type' => 'int-11',
  218. 'name' => '更新时间',
  219. 'match' => array('is_numeric', time()),
  220. 'desc' => '',
  221. ),
  222. 'content' => array
  223. (
  224. 'type' => 'text-255',
  225. 'name' => '内容',
  226. 'default' => '',
  227. 'desc' => '请输入内容',
  228. 'match' => 'is_string',
  229. 'update' => 'editor',
  230. 'key' => 1,
  231. ),
  232. 'cdate' => array
  233. (
  234. 'type' => 'int-11',
  235. 'name' => '录入时间',
  236. 'match' => array('is_numeric', time()),
  237. 'desc' => '',
  238. # 只有insert时才生效
  239. 'insert' => true,
  240. ),
  241. ),
  242. # 索引
  243. 'index' => array
  244. (
  245. 'version' => 1,
  246. 1 => array
  247. (
  248. 'i1' => 'uid,cate_id',
  249. )
  250. ),
  251. # 管理功能
  252. 'manage' => array
  253. (
  254. //'insert' => false,
  255. # 列表
  256. /*
  257. 'list_button' => array
  258. (
  259. 'list' => array('评论列表', '"comment&search_option_data_id={id}&oper_parent=article"'),
  260. ),
  261. */
  262. ),
  263. # request 请求接口定义
  264. 'request' => array
  265. (
  266. 'search' => array
  267. (
  268. # 匹配的正则或函数 选填项
  269. 'option' => array
  270. (
  271. 'ids' => array('yes-id', 'in'),
  272. 'cate_id' => 'yes',
  273. 'name' => array('yes', 'like'),
  274. 'id' => 'yes',
  275. ),
  276. 'type' => 'all',
  277. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  278. 'limit' => '0,1000',
  279. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled',
  280. ),
  281. 'getAll' => array
  282. (
  283. # 匹配的正则或函数 选填项
  284. 'option' => array
  285. (
  286. 'cate_id' => 'yes',
  287. 'cate_ids' => array('yes-cate_id', 'in'),
  288. 'id' => 'yes',
  289. ),
  290. 'type' => 'all',
  291. 'order' => array('id' => 'desc'),
  292. 'page' => array($page, 'list'),
  293. 'col' => '*',
  294. ),
  295. # 获取默认主题,按照置顶和时间排序的
  296. 'default' => array
  297. (
  298. # 匹配的正则或函数 选填项
  299. 'option' => array
  300. (
  301. 'cate_id' => 'yes',
  302. 'uid' => 'yes',
  303. ),
  304. 'type' => 'all',
  305. 'order' => array('id' => 'desc'),
  306. 'page' => array($page, 'list'),
  307. 'col' => '*',
  308. ),
  309. # 获取最新主题
  310. 'new' => array
  311. (
  312. # 匹配的正则或函数 选填项
  313. 'option' => array
  314. (
  315. 'name' => array('yes', 'like'),
  316. 'cate_id' => 'yes',
  317. 'uid' => 'yes',
  318. ),
  319. 'type' => 'all',
  320. 'order' => array('id', 'desc'),
  321. 'page' => array($page, 'list'),
  322. 'col' => '*',
  323. ),
  324. # 获取热门主题
  325. 'hot' => array
  326. (
  327. # 匹配的正则或函数 选填项
  328. 'option' => array
  329. (
  330. 'cate_id' => 'yes',
  331. 'uid' => 'yes',
  332. ),
  333. 'type' => 'all',
  334. 'order' => array('num_view`+`num_add_view' => 'desc', 'id' => 'desc'),
  335. 'page' => array($page, 'list'),
  336. 'col' => '*',
  337. ),
  338. # 获取冷门主题
  339. 'cold' => array
  340. (
  341. # 匹配的正则或函数 选填项
  342. 'option' => array
  343. (
  344. 'cate_id' => 'yes',
  345. 'uid' => 'yes',
  346. ),
  347. 'type' => 'all',
  348. 'order' => array('num_view`+`num_add_view' => 'asc', 'id' => 'desc'),
  349. 'page' => array($page, 'list'),
  350. 'col' => '*',
  351. ),
  352. # 更新浏览量
  353. 'addView' => array
  354. (
  355. 'type' => 'update',
  356. 'where' => array
  357. (
  358. 'id' => 'yes',
  359. ),
  360. 'set' => array
  361. (
  362. 'num_view' => array('1', '+='),
  363. ),
  364. ),
  365. # 更新回复数
  366. 'addComment' => array
  367. (
  368. 'type' => 'update',
  369. 'where' => array
  370. (
  371. 'id' => 'yes',
  372. ),
  373. 'set' => array
  374. (
  375. 'num_comment' => array('1', '+='),
  376. ),
  377. ),
  378. # 更新点赞数
  379. 'addUp' => array
  380. (
  381. 'type' => 'update',
  382. 'where' => array
  383. (
  384. 'id' => 'yes',
  385. ),
  386. 'set' => array
  387. (
  388. 'num_up' => array('1', '+='),
  389. ),
  390. ),
  391. # 更新点赞数
  392. 'desUp' => array
  393. (
  394. 'type' => 'update',
  395. 'where' => array
  396. (
  397. 'id' => 'yes',
  398. ),
  399. 'set' => array
  400. (
  401. 'num_up' => array('1', '-='),
  402. ),
  403. ),
  404. ),
  405. );