course.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <?php
  2. $author = function()
  3. {
  4. $array = array();
  5. $author = Dever::load('set/author-state');
  6. if($author)
  7. {
  8. $array += $author;
  9. }
  10. return $array;
  11. };
  12. $info = function()
  13. {
  14. $array = array();
  15. $info = Dever::load('set/info-state');
  16. if($info)
  17. {
  18. $array += $info;
  19. }
  20. return $array;
  21. };
  22. return array
  23. (
  24. # 表名
  25. 'name' => 'course',
  26. # 显示给用户看的名称
  27. 'lang' => '课程管理',
  28. 'order' => 180,
  29. # 数据结构
  30. 'struct' => array
  31. (
  32. 'id' => array
  33. (
  34. 'type' => 'int-11',
  35. 'name' => 'ID',
  36. 'default' => '',
  37. 'desc' => '',
  38. 'match' => 'is_numeric',
  39. 'search' => 'order',
  40. 'list' => true,
  41. ),
  42. 'name' => array
  43. (
  44. 'type' => 'varchar-80',
  45. 'name' => '标题',
  46. 'default' => '',
  47. 'desc' => '请输入标题',
  48. 'match' => 'is_string',
  49. 'update' => 'text',
  50. 'search' => 'fulltext',
  51. 'list' => true,
  52. ),
  53. 'info_id' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '所属小程序',
  57. 'default' => '1',
  58. 'desc' => '请选择所属小程序',
  59. 'match' => 'is_numeric',
  60. 'update' => 'select',
  61. 'option' => $info,
  62. 'search' => 'select',
  63. 'list' => '{info_id} > 0 ? Dever::load("set/info-one#name", {info_id}) : "未知"',
  64. ),
  65. 'author_id' => array
  66. (
  67. 'type' => 'int-11',
  68. 'name' => '作者',
  69. 'default' => '1',
  70. 'desc' => '请选择作者',
  71. 'match' => 'is_numeric',
  72. 'update' => 'select',
  73. 'option' => $author,
  74. //'search' => 'select',
  75. //'list' => '{author_id} > 0 ? Dever::load("set/author-one#name", {author_id}) : "未知"',
  76. ),
  77. 'video' => array
  78. (
  79. 'type' => 'varchar-300',
  80. 'name' => '视频地址-腾讯视频直接输入网址即可,如https://v.qq.com/x/page/j0515xuxz37.html',
  81. 'default' => '',
  82. 'desc' => '请输入视频地址',
  83. 'match' => 'is_string',
  84. 'update' => 'textarea',
  85. //'search' => 'fulltext',
  86. 'list' => 'Dever::load("content/v1/video.html", "{video}")',
  87. ),
  88. 'audio' => array
  89. (
  90. 'type' => 'varchar-300',
  91. 'name' => '音频地址',
  92. 'default' => '',
  93. 'desc' => '请输入音频地址',
  94. 'match' => 'option',
  95. 'update' => 'textarea',
  96. //'search' => 'fulltext',
  97. //'list' => true,
  98. ),
  99. 'num_add_view' => array
  100. (
  101. 'type' => 'int-11',
  102. 'name' => '手动增加浏览量pv',
  103. 'default' => '0',
  104. 'desc' => '请填写手动增加浏览量pv',
  105. 'match' => 'option',
  106. 'update' => 'text',
  107. ),
  108. 'num_up' => array
  109. (
  110. 'type' => 'int-11',
  111. 'name' => '赞数',
  112. 'default' => '0',
  113. 'desc' => '请填写赞数',
  114. 'match' => 'option',
  115. //'search' => 'order',
  116. 'list' => '"赞数:{num_up}<br />浏览量:{num_view}+{num_add_view}<br />观看人数:{num_watch}<br />回复数:{num_review}<br />"',
  117. 'list_name' => '统计数字',
  118. ),
  119. 'num_view' => array
  120. (
  121. 'type' => 'int-11',
  122. 'name' => '浏览量pv',
  123. 'default' => '0',
  124. 'desc' => '请填写浏览量pv',
  125. 'match' => 'option',
  126. //'search' => 'order',
  127. //'list' => '{num_view}+{num_add_view}',
  128. ),
  129. 'num_watch' => array
  130. (
  131. 'type' => 'int-11',
  132. 'name' => '观看数',
  133. 'default' => '0',
  134. 'desc' => '观看数',
  135. 'match' => 'option',
  136. //'search' => 'order',
  137. //'list' => '{num_view}+{num_add_view}',
  138. ),
  139. 'num_review' => array
  140. (
  141. 'type' => 'int-11',
  142. 'name' => '回复数',
  143. 'default' => '0',
  144. 'desc' => '请填写回复数',
  145. //'search' => 'order',
  146. 'match' => 'option',
  147. //'list' => true,
  148. ),
  149. 'pic' => array
  150. (
  151. 'type' => 'varchar-150',
  152. 'name' => '封面',
  153. 'default' => '',
  154. 'desc' => '请选择封面',
  155. 'match' => 'is_string',
  156. 'update' => 'image',
  157. 'key' => '1',
  158. 'place' => '150',
  159. ),
  160. 'top' => array
  161. (
  162. 'type' => 'varchar-150',
  163. 'name' => '头图',
  164. 'default' => '',
  165. 'desc' => '请选择头图',
  166. 'match' => 'is_string',
  167. 'update' => 'image',
  168. 'key' => '1',
  169. 'place' => '150',
  170. ),
  171. 'content' => array
  172. (
  173. 'type' => 'text-800',
  174. 'name' => '内容',
  175. 'default' => '',
  176. 'desc' => '请输入内容',
  177. 'match' => 'is_string',
  178. 'update' => 'editor',
  179. 'key' => 1,
  180. ),
  181. 'reorder' => array
  182. (
  183. 'type' => 'int-11',
  184. 'name' => '排序(数值越大越靠前)',
  185. 'default' => '1',
  186. 'desc' => '请输入排序',
  187. 'match' => 'option',
  188. 'update' => 'text',
  189. 'search' => 'order',
  190. 'list_name' => '排序',
  191. 'list' => true,
  192. 'order' => 'desc',
  193. 'edit' => true,
  194. ),
  195. 'state' => array
  196. (
  197. 'type' => 'tinyint-1',
  198. 'name' => '状态',
  199. 'default' => '1',
  200. 'desc' => '请选择状态',
  201. 'match' => 'is_numeric',
  202. ),
  203. 'cdate' => array
  204. (
  205. 'type' => 'int-11',
  206. 'name' => '录入时间',
  207. 'match' => array('is_numeric', time()),
  208. 'desc' => '',
  209. # 只有insert时才生效
  210. 'insert' => true,
  211. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  212. ),
  213. ),
  214. # 索引
  215. 'index' => array
  216. (
  217. ),
  218. # 管理功能
  219. 'manage' => array
  220. (
  221. //'insert' => false,
  222. # 列表
  223. 'list_button' => array
  224. (
  225. 'list' => array('评论', '"review&project=comment&search_option_source_table=1&search_option_source_id={id}&oper_parent=course&oper_project=content"'),
  226. ),
  227. ),
  228. # request 请求接口定义
  229. 'request' => array
  230. (
  231. 'getAll' => array
  232. (
  233. # 匹配的正则或函数 选填项
  234. 'option' => array
  235. (
  236. 'info_id' => 'yes',
  237. ),
  238. 'type' => 'all',
  239. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  240. 'page' => array(10, 'list'),
  241. 'col' => 'id, name, pic, top, info_id, author_id, content, (num_view+num_add_view) as num_view,num_review,num_up,num_watch, cdate',
  242. ),
  243. # 更新浏览量
  244. 'addView' => array
  245. (
  246. 'type' => 'update',
  247. 'where' => array
  248. (
  249. 'id' => 'yes',
  250. ),
  251. 'set' => array
  252. (
  253. 'num_view' => array('1', '+='),
  254. ),
  255. ),
  256. # 更新回复数
  257. 'addReview' => array
  258. (
  259. 'type' => 'update',
  260. 'where' => array
  261. (
  262. 'id' => 'yes',
  263. ),
  264. 'set' => array
  265. (
  266. 'num_review' => array('1', '+='),
  267. ),
  268. ),
  269. # 更新点赞数
  270. 'addUp' => array
  271. (
  272. 'type' => 'update',
  273. 'where' => array
  274. (
  275. 'id' => 'yes',
  276. ),
  277. 'set' => array
  278. (
  279. 'num_up' => array('1', '+='),
  280. ),
  281. ),
  282. # 更新观看数
  283. 'addWatch' => array
  284. (
  285. 'type' => 'update',
  286. 'where' => array
  287. (
  288. 'id' => 'yes',
  289. ),
  290. 'set' => array
  291. (
  292. 'num_watch' => array('1', '+='),
  293. ),
  294. ),
  295. # 更新点赞数
  296. 'desUp' => array
  297. (
  298. 'type' => 'update',
  299. 'where' => array
  300. (
  301. 'id' => 'yes',
  302. ),
  303. 'set' => array
  304. (
  305. 'num_up' => array('1', '-='),
  306. ),
  307. ),
  308. ),
  309. );