vod.php 8.0 KB

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