audio.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <?php
  2. $audit = Dever::config('base')->audit;
  3. $status = array
  4. (
  5. 1 => '上架',
  6. 2 => '下架',
  7. );
  8. # 常用的col
  9. $col = 'id,name,pic_cover,price,num_add_view+num_view as num_view,content,`desc`';
  10. return array
  11. (
  12. # 表名
  13. 'name' => 'audio',
  14. # 显示给用户看的名称
  15. 'lang' => '语音课程',
  16. 'order' => 100,
  17. # 数据结构
  18. 'struct' => array
  19. (
  20. 'id' => array
  21. (
  22. 'type' => 'int-11',
  23. 'name' => 'ID',
  24. 'default' => '',
  25. 'desc' => '',
  26. 'match' => 'is_numeric',
  27. 'list' => true,
  28. ),
  29. 'name' => array
  30. (
  31. 'type' => 'varchar-80',
  32. 'name' => '标题',
  33. 'default' => '',
  34. 'desc' => '标题',
  35. 'match' => 'is_string',
  36. 'update' => 'text',
  37. 'list' => true,
  38. 'search' => 'fulltext',
  39. //增加预览
  40. 'preview' => true,
  41. ),
  42. 'desc' => array
  43. (
  44. 'type' => 'varchar-500',
  45. 'name' => '摘要',
  46. 'default' => '',
  47. 'desc' => '摘要',
  48. 'match' => 'is_string',
  49. 'update' => 'textarea',
  50. ),
  51. 'price' => array
  52. (
  53. 'type' => 'varchar-32',
  54. 'name' => '销售价格',
  55. 'default' => '',
  56. 'desc' => '销售价格',
  57. 'match' => 'is_string',
  58. 'update' => 'text',
  59. ),
  60. 'old_price' => array
  61. (
  62. 'type' => 'varchar-32',
  63. 'name' => '原价',
  64. 'default' => '',
  65. 'desc' => '原价',
  66. 'match' => 'is_string',
  67. 'update' => 'text',
  68. ),
  69. 'pic_cover' => array
  70. (
  71. 'type' => 'varchar-150',
  72. 'name' => '1:1封面图-图片尺寸380*380px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  73. 'default' => '',
  74. 'desc' => '封面图',
  75. 'match' => 'is_string',
  76. 'update' => 'image',
  77. 'key' => '1',
  78. 'place' => '150',
  79. //直接上传到云端
  80. //'upload' => 'qiniu',
  81. //上传大数据
  82. //'large' => true,
  83. ),
  84. 'num_add_view' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '浏览量基数',
  88. 'default' => '0',
  89. 'desc' => '浏览量基数',
  90. 'match' => 'option',
  91. //'update' => 'text',
  92. ),
  93. 'num_view' => array
  94. (
  95. 'type' => 'int-11',
  96. 'name' => '浏览量',
  97. 'default' => '0',
  98. 'desc' => '请填写浏览量',
  99. 'match' => 'option',
  100. 'search' => 'order',
  101. 'list' => '{num_view}+{num_add_view}',
  102. ),
  103. 'buy_add_view' => array
  104. (
  105. 'type' => 'int-11',
  106. 'name' => '购买基数',
  107. 'default' => '0',
  108. 'desc' => '购买基数',
  109. 'match' => 'option',
  110. //'update' => 'text',
  111. ),
  112. 'buy_view' => array
  113. (
  114. 'type' => 'int-11',
  115. 'name' => '购买量',
  116. 'default' => '0',
  117. 'desc' => '购买量',
  118. 'match' => 'option',
  119. 'search' => 'order',
  120. 'list' => '{buy_view}+{buy_add_view}',
  121. ),
  122. 'pdate' => array
  123. (
  124. 'type' => 'int-11',
  125. 'name' => '发布时间',
  126. 'match' => array('is_numeric', time()),
  127. 'default' => '',
  128. 'desc' => '',
  129. 'update' => 'date',
  130. 'callback' => 'maketime',
  131. 'insert' => true,
  132. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  133. 'auth' => '"{pdate}" > 0',
  134. ),
  135. 'reorder' => array
  136. (
  137. 'type' => 'int-11',
  138. 'name' => '排序(数值越大越靠前)',
  139. 'default' => '1',
  140. 'desc' => '请输入排序',
  141. 'match' => 'option',
  142. 'update' => 'text',
  143. 'search' => 'order',
  144. 'list' => true,
  145. 'order' => 'desc',
  146. 'edit' => true,
  147. ),
  148. 'udate' => array
  149. (
  150. 'type' => 'int-11',
  151. 'name' => '更新时间',
  152. 'match' => array('is_numeric', time()),
  153. 'desc' => '',
  154. ),
  155. 'content' => array
  156. (
  157. 'type' => 'text-255',
  158. 'name' => '课程介绍',
  159. 'default' => '',
  160. 'desc' => '请输入课程介绍',
  161. 'match' => 'is_string',
  162. 'update' => 'editor',
  163. 'key' => '1',
  164. //'media' => '5',//下面的音视频已经做到了
  165. //直接上传到云端
  166. //'upload' => 'qiniu',
  167. //上传大数据
  168. //'large' => true,
  169. //自定义编辑器右侧按钮
  170. /*
  171. 'editor' => array
  172. (
  173. 'name' => '选择插入模块',
  174. 'button' => array
  175. (
  176. array
  177. (
  178. # 名称
  179. 'name' => '图片',
  180. # 资源库id
  181. 'key' => 1,
  182. # 类型
  183. 'type' => 'image',
  184. ),
  185. array
  186. (
  187. 'name' => '音频',
  188. 'key' => 5,
  189. 'type' => 'media',
  190. ),
  191. array
  192. (
  193. 'name' => '视频',
  194. 'key' => 'video/lib/core.vod',
  195. ),
  196. array
  197. (
  198. 'name' => '直播',
  199. 'key' => 'video/lib/core.live',
  200. ),
  201. array
  202. (
  203. 'name' => '小程序',
  204. 'key' => 'content/lib/applet.update',
  205. 'type' => 'update',
  206. ),
  207. ),
  208. ),
  209. */
  210. ),
  211. 'status' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '状态',
  215. 'default' => '1',
  216. 'desc' => '状态',
  217. 'match' => 'is_numeric',
  218. 'update' => 'radio',
  219. 'option' => $status,
  220. ),
  221. 'state' => array
  222. (
  223. 'type' => 'tinyint-1',
  224. 'name' => '状态',
  225. 'default' => '1',
  226. 'desc' => '请选择状态',
  227. 'match' => 'is_numeric',
  228. ),
  229. 'cdate' => array
  230. (
  231. 'type' => 'int-11',
  232. 'name' => '录入时间',
  233. 'match' => array('is_numeric', time()),
  234. 'desc' => '',
  235. # 只有insert时才生效
  236. 'insert' => true,
  237. ),
  238. ),
  239. # 管理功能
  240. 'manage' => array
  241. (
  242. //'insert' => false,
  243. # 列表
  244. 'list_button' => array
  245. (
  246. 'add' => array('新增章节', '"audio_content&project=content&search_option_audio_id={id}&oper_parent=audio&oper_project=content&oper_save_jump=audio&where_id={id}"'),
  247. 'list1' => array('章节列表', '"audio_content&search_option_audio_id={id}&oper_parent=audio"'),
  248. ),
  249. ),
  250. # request 请求接口定义
  251. 'request' => array
  252. (
  253. 'search' => array
  254. (
  255. # 匹配的正则或函数 选填项
  256. 'option' => array
  257. (
  258. 'ids' => array('yes-id', 'in'),
  259. 'name' => array('yes', 'like'),
  260. 'id' => 'yes',
  261. 'status' => 1,
  262. 'state' => 1,
  263. ),
  264. 'type' => 'all',
  265. 'order' => array('reorder' => 'desc', 'pdate' => 'desc'),
  266. 'limit' => '0,1000',
  267. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  268. ),
  269. 'getAll' => array
  270. (
  271. # 匹配的正则或函数 选填项
  272. 'option' => array
  273. (
  274. 'id' => 'yes',
  275. 'status' => 1,
  276. 'state' => 1,
  277. ),
  278. 'type' => 'all',
  279. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  280. 'page' => array(10, 'list'),
  281. 'col' => $col,
  282. ),
  283. 'getList' => array
  284. (
  285. # 匹配的正则或函数 选填项
  286. 'option' => array
  287. (
  288. 'status' => 1,
  289. 'state' => 1,
  290. ),
  291. 'type' => 'all',
  292. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  293. 'limit' => '0,10',
  294. 'col' => $col,
  295. ),
  296. 'getRelation' => array
  297. (
  298. # 匹配的正则或函数 选填项
  299. 'option' => array
  300. (
  301. 'noid' => array('yes-id', '!='),
  302. 'status' => 1,
  303. 'state' => 1,
  304. ),
  305. 'type' => 'all',
  306. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  307. 'limit' => '0,4',
  308. 'col' => $col,
  309. ),
  310. 'getOne' => array
  311. (
  312. # 匹配的正则或函数 选填项
  313. 'where' => array
  314. (
  315. 'id' => 'yes',
  316. ),
  317. 'type' => 'one',
  318. 'col' => $col,
  319. ),
  320. # 更新浏览量
  321. 'addView' => array
  322. (
  323. 'type' => 'update',
  324. 'where' => array
  325. (
  326. 'id' => 'yes',
  327. ),
  328. 'set' => array
  329. (
  330. 'num_view' => array('1', '+='),
  331. ),
  332. ),
  333. ),
  334. );