course.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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' => true,
  87. ),
  88. 'audio' => array
  89. (
  90. 'type' => 'varchar-300',
  91. 'name' => '音频地址',
  92. 'default' => '',
  93. 'desc' => '请输入音频地址',
  94. 'match' => 'is_string',
  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_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_review' => array
  130. (
  131. 'type' => 'int-11',
  132. 'name' => '回复数',
  133. 'default' => '0',
  134. 'desc' => '请填写回复数',
  135. 'search' => 'order',
  136. 'match' => 'option',
  137. //'list' => true,
  138. ),
  139. 'pic' => array
  140. (
  141. 'type' => 'varchar-150',
  142. 'name' => '封面',
  143. 'default' => '',
  144. 'desc' => '请选择封面',
  145. 'match' => 'is_string',
  146. 'update' => 'image',
  147. 'key' => '1',
  148. 'place' => '150',
  149. ),
  150. 'top' => array
  151. (
  152. 'type' => 'varchar-150',
  153. 'name' => '头图',
  154. 'default' => '',
  155. 'desc' => '请选择头图',
  156. 'match' => 'is_string',
  157. 'update' => 'image',
  158. 'key' => '1',
  159. 'place' => '150',
  160. ),
  161. 'content' => array
  162. (
  163. 'type' => 'text-800',
  164. 'name' => '内容',
  165. 'default' => '',
  166. 'desc' => '请输入内容',
  167. 'match' => 'is_string',
  168. 'update' => 'editor',
  169. 'key' => 1,
  170. ),
  171. 'reorder' => array
  172. (
  173. 'type' => 'int-11',
  174. 'name' => '排序(数值越大越靠前)',
  175. 'default' => '1',
  176. 'desc' => '请输入排序',
  177. 'match' => 'option',
  178. 'update' => 'text',
  179. 'search' => 'order',
  180. 'list_name' => '排序',
  181. 'list' => true,
  182. 'order' => 'desc',
  183. 'edit' => true,
  184. ),
  185. 'state' => array
  186. (
  187. 'type' => 'tinyint-1',
  188. 'name' => '状态',
  189. 'default' => '1',
  190. 'desc' => '请选择状态',
  191. 'match' => 'is_numeric',
  192. ),
  193. 'cdate' => array
  194. (
  195. 'type' => 'int-11',
  196. 'name' => '录入时间',
  197. 'match' => array('is_numeric', time()),
  198. 'desc' => '',
  199. # 只有insert时才生效
  200. 'insert' => true,
  201. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  202. ),
  203. ),
  204. # 索引
  205. 'index' => array
  206. (
  207. ),
  208. # 管理功能
  209. 'manage' => array
  210. (
  211. //'insert' => false,
  212. # 列表
  213. 'list_button' => array
  214. (
  215. 'list' => array('评论', '"review&project=comment&search_option_source_table=1&search_option_source_id={id}&oper_parent=course&oper_project=content"'),
  216. ),
  217. ),
  218. # request 请求接口定义
  219. 'request' => array
  220. (
  221. 'getAll' => array
  222. (
  223. # 匹配的正则或函数 选填项
  224. 'option' => array
  225. (
  226. 'info_id' => 'yes',
  227. ),
  228. 'type' => 'all',
  229. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  230. 'page' => array(10, 'list'),
  231. 'col' => 'id, name, pic, top, info_id, author_id, content, (num_view+num_add_view) as num_view, cdate',
  232. ),
  233. # 更新浏览量
  234. 'addView' => array
  235. (
  236. 'type' => 'update',
  237. 'where' => array
  238. (
  239. 'id' => 'yes',
  240. ),
  241. 'set' => array
  242. (
  243. 'num_view' => array('1', '+='),
  244. ),
  245. ),
  246. # 更新回复数
  247. 'addReview' => array
  248. (
  249. 'type' => 'update',
  250. 'where' => array
  251. (
  252. 'id' => 'yes',
  253. ),
  254. 'set' => array
  255. (
  256. 'num_review' => array('1', '+='),
  257. ),
  258. ),
  259. # 更新点赞数
  260. 'addUp' => array
  261. (
  262. 'type' => 'update',
  263. 'where' => array
  264. (
  265. 'id' => 'yes',
  266. ),
  267. 'set' => array
  268. (
  269. 'num_up' => array('1', '+='),
  270. ),
  271. ),
  272. # 更新点赞数
  273. 'desUp' => array
  274. (
  275. 'type' => 'update',
  276. 'where' => array
  277. (
  278. 'id' => 'yes',
  279. ),
  280. 'set' => array
  281. (
  282. 'num_up' => array('1', '-='),
  283. ),
  284. ),
  285. ),
  286. );