Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
online-edu-backend
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
online-edu
online-edu-backend
Commits
c3c43641
Commit
c3c43641
authored
May 26, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
暂存
parent
0b174356
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
230 additions
and
18 deletions
+230
-18
AliyunCallbackController.java
...kdata/biz/aliyun/controller/AliyunCallbackController.java
+1
-2
AliyunService.java
...ain/java/com/qkdata/biz/aliyun/service/AliyunService.java
+22
-4
CourseController.java
...om/qkdata/biz/management/controller/CourseController.java
+29
-2
CourseChapterPO.java
...ava/com/qkdata/biz/management/entity/CourseChapterPO.java
+4
-0
ResourcePO.java
...ain/java/com/qkdata/biz/management/entity/ResourcePO.java
+2
-2
CourseSeriesMapper.java
.../com/qkdata/biz/management/mapper/CourseSeriesMapper.java
+6
-0
CourseService.java
...java/com/qkdata/biz/management/service/CourseService.java
+92
-5
ResourceService.java
...va/com/qkdata/biz/management/service/ResourceService.java
+26
-0
CourseChaperModel.java
.../java/com/qkdata/biz/management/vo/CourseChaperModel.java
+8
-0
CourseStep2SaveModel.java
...va/com/qkdata/biz/management/vo/CourseStep2SaveModel.java
+11
-0
QueryCourseSeriesModel.java
.../com/qkdata/biz/management/vo/QueryCourseSeriesModel.java
+11
-0
V1.0.2__update.sql
src/main/resources/db/migration/V1.0.2__update.sql
+3
-0
V1.0.3__update.sql
src/main/resources/db/migration/V1.0.3__update.sql
+3
-0
course_seriesMapper.xml
...main/resources/mappers/management/course_seriesMapper.xml
+8
-0
upload-auth.js
src/main/resources/static/upload-auth.js
+4
-3
No files found.
src/main/java/com/qkdata/biz/aliyun/controller/AliyunCallbackController.java
View file @
c3c43641
...
...
@@ -44,7 +44,6 @@ public class AliyunCallbackController {
@SysLog
(
"video上传回调"
)
@PostMapping
(
"/video/callback"
)
public
Result
<
String
>
videoCallback
(
@RequestBody
String
data
){
log
.
info
(
data
);
AliyunVideoCallbackModel
model
=
JSONObject
.
parseObject
(
data
,
AliyunVideoCallbackModel
.
class
);
String
videoId
=
model
.
getVideoId
();
String
extendStr
=
model
.
getExtend
();
...
...
@@ -58,7 +57,7 @@ public class AliyunCallbackController {
private
Long
saveToResource
(
AliyunCallbackRespModel
model
)
{
ResourcePO
po
=
new
ResourcePO
();
po
.
setName
(
model
.
getFileName
());
po
.
set
Bucket
(
model
.
getBucket
());
po
.
set
VideoId
(
model
.
getBucket
());
po
.
setSize
(
model
.
getSize
());
resourceService
.
save
(
po
);
return
po
.
getId
();
...
...
src/main/java/com/qkdata/biz/aliyun/service/AliyunService.java
View file @
c3c43641
...
...
@@ -7,11 +7,9 @@ import com.aliyun.oss.common.utils.BinaryUtil;
import
com.aliyun.oss.model.MatchMode
;
import
com.aliyun.oss.model.PolicyConditions
;
import
com.aliyuncs.DefaultAcsClient
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.aliyuncs.profile.DefaultProfile
;
import
com.aliyuncs.vod.model.v20170321.CreateUploadVideoRequest
;
import
com.aliyuncs.vod.model.v20170321.CreateUploadVideoResponse
;
import
com.aliyuncs.vod.model.v20170321.RefreshUploadVideoRequest
;
import
com.aliyuncs.vod.model.v20170321.RefreshUploadVideoResponse
;
import
com.aliyuncs.vod.model.v20170321.*
;
import
com.google.common.collect.Maps
;
import
com.qkdata.biz.aliyun.config.AliyunConfig
;
import
com.qkdata.biz.aliyun.vo.AliyunOSSUploadPolicyModel
;
...
...
@@ -157,4 +155,24 @@ public class AliyunService {
public
String
getPublicUrl
()
{
return
"https://"
+
aliyunConfig
.
getBucket
()+
"."
+
aliyunConfig
.
getEndpoint
();
}
public
GetVideoInfoResponse
getVideoInfo
(
String
videoId
)
throws
ClientException
{
GetVideoInfoRequest
request
=
new
GetVideoInfoRequest
();
request
.
setVideoId
(
videoId
);
return
vodClient
.
getAcsResponse
(
request
);
}
public
GetPlayInfoResponse
getVideoPlayInfo
(
String
videoId
)
throws
ClientException
{
GetPlayInfoRequest
request
=
new
GetPlayInfoRequest
();
request
.
setVideoId
(
videoId
);
return
vodClient
.
getAcsResponse
(
request
);
}
public
void
removeVideo
(
String
videoId
)
throws
ClientException
{
DeleteMezzaninesRequest
request
=
new
DeleteMezzaninesRequest
();
request
.
setVideoIds
(
videoId
);
DeleteMezzaninesResponse
response
=
vodClient
.
getAcsResponse
(
request
);
}
}
src/main/java/com/qkdata/biz/management/controller/CourseController.java
View file @
c3c43641
...
...
@@ -2,6 +2,7 @@ package com.qkdata.biz.management.controller;
import
com.qkdata.biz.common.BizConstants
;
import
com.qkdata.biz.management.entity.CourseSeriesPO
;
import
com.qkdata.biz.management.service.CourseService
;
import
com.qkdata.biz.management.vo.*
;
import
com.qkdata.common.annotation.SysLog
;
...
...
@@ -52,6 +53,8 @@ public class CourseController {
courseService
.
modifyStatus
(
model
);
return
Result
.
succeed
(
"ok"
);
}
@ApiOperation
(
"添加课程(第一步保存)"
)
@PostMapping
(
"/saveStep1"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
...
...
@@ -63,10 +66,19 @@ public class CourseController {
@ApiOperation
(
"添加课程(第二步保存)"
)
@PostMapping
(
"/saveStep2"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
public
Result
<
String
>
saveStep2
(
@RequestBody
List
<
CourseChaperModel
>
chaperList
){
courseService
.
saveStep2
(
chaper
List
);
public
Result
<
String
>
saveStep2
(
@RequestBody
CourseStep2SaveModel
chaperModel
){
courseService
.
saveStep2
(
chaper
Model
);
return
Result
.
succeed
(
"ok"
);
}
@ApiOperation
(
"添加课程(第二步中获取章节列表"
)
@GetMapping
(
"/chaperList/{courseId}"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
public
Result
<
List
<
CourseChaperModel
>>
chaperList
(
@PathVariable
Long
courseId
){
List
<
CourseChaperModel
>
modelList
=
courseService
.
chaperList
(
courseId
);
return
Result
.
succeed
(
modelList
);
}
@ApiOperation
(
"修改章节名称"
)
@PostMapping
(
"/modifyChaperName"
)
@SysLog
(
"修改章节名称"
)
...
...
@@ -83,4 +95,19 @@ public class CourseController {
courseService
.
delChaper
(
chaperId
);
return
Result
.
succeed
(
"ok"
);
}
@ApiOperation
(
"获取课程系列列表"
)
@PostMapping
(
"/seriesList"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
public
PageResult
<
CourseSeriesPO
>
seriesList
(
@RequestBody
QueryCourseSeriesModel
model
){
return
courseService
.
querySeriesPageList
(
model
);
}
@ApiOperation
(
"添加系列"
)
@PostMapping
(
"/saveSeries"
)
@SysLog
(
"添加系列"
)
@RequiresRoles
(
value
=
{
BizConstants
.
ROLE_ADMIN
,
BizConstants
.
ROLE_OPERATOR
},
logical
=
Logical
.
OR
)
public
Result
<
String
>
saveSeries
(
@RequestBody
CourseSeriesPO
po
){
courseService
.
saveSeries
(
po
);
return
Result
.
succeed
(
"ok"
);
}
}
src/main/java/com/qkdata/biz/management/entity/CourseChapterPO.java
View file @
c3c43641
...
...
@@ -34,6 +34,10 @@ public class CourseChapterPO extends BasePO {
* 章节标题
*/
private
String
name
;
/**
* 序号
*/
private
Integer
sortNo
;
}
src/main/java/com/qkdata/biz/management/entity/ResourcePO.java
View file @
c3c43641
...
...
@@ -26,9 +26,9 @@ public class ResourcePO extends BasePO {
private
String
name
;
/**
*
bucket名称
*
阿里云视频ID
*/
private
String
bucket
;
private
String
videoId
;
/**
* 资源大小
...
...
src/main/java/com/qkdata/biz/management/mapper/CourseSeriesMapper.java
View file @
c3c43641
package
com
.
qkdata
.
biz
.
management
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.qkdata.biz.management.entity.CourseSeriesPO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.qkdata.biz.management.vo.QueryCourseSeriesModel
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>
...
...
@@ -15,4 +20,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public
interface
CourseSeriesMapper
extends
BaseMapper
<
CourseSeriesPO
>
{
List
<
CourseSeriesPO
>
queryPageList
(
Page
page
,
@Param
(
"p"
)
QueryCourseSeriesModel
model
);
}
src/main/java/com/qkdata/biz/management/service/CourseService.java
View file @
c3c43641
package
com
.
qkdata
.
biz
.
management
.
service
;
import
cn.hutool.core.collection.CollUtil
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.aliyuncs.vod.model.v20170321.GetPlayInfoResponse
;
import
com.aliyuncs.vod.model.v20170321.GetVideoInfoResponse
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.qkdata.biz.aliyun.service.AliyunService
;
import
com.qkdata.biz.enums.CourseAllowEnum
;
import
com.qkdata.biz.enums.CourseChargeModelEnum
;
import
com.qkdata.biz.enums.CourseModelEnum
;
...
...
@@ -16,6 +20,7 @@ import com.qkdata.biz.management.vo.*;
import
com.qkdata.common.base.enums.CodeEnum
;
import
com.qkdata.common.base.exception.BusinessException
;
import
com.qkdata.common.base.model.PageResult
;
import
com.qkdata.common.base.model.Result
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -46,6 +51,10 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
private
CourseTagService
tagService
;
@Autowired
private
TeacherService
teacherService
;
@Autowired
private
AliyunService
aliyunService
;
@Autowired
private
ResourceService
resourceService
;
public
PageResult
<
CourseListItemModel
>
queryPageList
(
QueryCourseModel
param
)
{
Page
page
=
new
Page
(
param
.
getPageIndex
(),
param
.
getPageSize
());
...
...
@@ -109,15 +118,37 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
}
@Transactional
public
void
saveStep2
(
List
<
CourseChaperModel
>
chaperList
)
{
for
(
CourseChaperModel
model
:
chaperList
){
public
void
saveStep2
(
CourseStep2SaveModel
model
)
{
try
{
Long
resourceId
=
saveToResource
(
model
.
getVideoId
());
CourseChapterPO
po
=
new
CourseChapterPO
();
po
.
setCourseId
(
model
.
getCourseId
());
po
.
setName
(
model
.
getName
());
po
.
setResourceId
(
model
.
getResourceId
());
po
.
setName
(
model
.
getChaperName
());
po
.
setResourceId
(
resourceId
);
po
.
setSortNo
(
model
.
getSortNo
());
chapterMapper
.
insert
(
po
);
}
catch
(
ClientException
e
)
{
throw
new
BusinessException
(
"获取视频信息错误"
);
}
}
private
Long
saveToResource
(
String
videoId
)
throws
ClientException
{
//根据视频ID,获取视频信息
GetVideoInfoResponse
videoInfoResponse
=
aliyunService
.
getVideoInfo
(
videoId
);
Float
duration
=
videoInfoResponse
.
getVideo
().
getDuration
();
Long
size
=
videoInfoResponse
.
getVideo
().
getSize
();
String
title
=
videoInfoResponse
.
getVideo
().
getTitle
();
ResourcePO
po
=
resourceService
.
getByVideoId
(
videoId
);
if
(
po
==
null
){
po
=
new
ResourcePO
();
}
po
.
setName
(
title
);
po
.
setSize
(
size
);
po
.
setVideoDuration
(
duration
);
resourceService
.
saveOrUpdate
(
po
);
return
po
.
getId
();
}
public
CourseDetailModel
getCourseDetail
(
Long
id
)
{
...
...
@@ -162,11 +193,66 @@ public class CourseService extends ServiceImpl<CourseMapper, CoursePO> {
chapterMapper
.
updateById
(
po
);
}
@Transactional
public
void
delChaper
(
Long
chaperId
)
{
chapterMapper
.
deleteById
(
chaperId
);
CourseChapterPO
po
=
chapterMapper
.
selectById
(
chaperId
);
if
(
po
!=
null
){
chapterMapper
.
deleteById
(
chaperId
);
//删除资源
resourceService
.
removeById
(
po
.
getResourceId
());
}
}
public
void
modifyStatus
(
ModifyCourseStatusModel
model
)
{
baseMapper
.
updateStatusById
(
model
.
getId
(),
model
.
getStatus
());
}
public
List
<
CourseChaperModel
>
chaperList
(
Long
courseId
)
{
List
<
CourseChaperModel
>
list
=
Lists
.
newArrayList
();
List
<
CourseChapterPO
>
poList
=
chapterMapper
.
selectList
(
Wrappers
.<
CourseChapterPO
>
lambdaQuery
().
eq
(
CourseChapterPO:
:
getCourseId
,
courseId
).
orderByAsc
(
CourseChapterPO:
:
getSortNo
));
if
(
CollUtil
.
isNotEmpty
(
poList
)){
for
(
CourseChapterPO
po
:
poList
){
CourseChaperModel
model
=
new
CourseChaperModel
();
model
.
setId
(
po
.
getId
());
model
.
setName
(
po
.
getName
());
model
.
setCourseId
(
po
.
getCourseId
());
model
.
setSortNo
(
po
.
getSortNo
());
Long
resourceId
=
po
.
getResourceId
();
setVideoInfo
(
resourceId
,
model
);
list
.
add
(
model
);
}
}
return
list
;
}
private
void
setVideoInfo
(
Long
resourceId
,
CourseChaperModel
model
)
{
ResourcePO
resourcePO
=
resourceService
.
getById
(
resourceId
);
if
(
resourcePO
!=
null
){
String
videoId
=
resourcePO
.
getVideoId
();
try
{
GetPlayInfoResponse
response
=
aliyunService
.
getVideoPlayInfo
(
videoId
);
List
<
GetPlayInfoResponse
.
PlayInfo
>
playInfoList
=
response
.
getPlayInfoList
();
if
(
CollUtil
.
isNotEmpty
(
playInfoList
)){
GetPlayInfoResponse
.
PlayInfo
playInfo
=
playInfoList
.
get
(
0
);
model
.
setVideoUrl
(
playInfo
.
getPlayURL
());
GetPlayInfoResponse
.
VideoBase
videoBase
=
response
.
getVideoBase
();
model
.
setSnapshotUrl
(
videoBase
.
getCoverURL
());
}
}
catch
(
ClientException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
public
PageResult
<
CourseSeriesPO
>
querySeriesPageList
(
QueryCourseSeriesModel
model
)
{
Page
page
=
new
Page
(
model
.
getPageIndex
(),
model
.
getPageIndex
());
List
<
CourseSeriesPO
>
list
=
seriesMapper
.
queryPageList
(
page
,
model
);
return
PageResult
.<
CourseSeriesPO
>
builder
().
code
(
CodeEnum
.
SUCCESS
.
getCode
()).
count
(
page
.
getTotal
()).
data
(
list
).
build
();
}
public
void
saveSeries
(
CourseSeriesPO
po
)
{
seriesMapper
.
insert
(
po
);
}
}
\ No newline at end of file
src/main/java/com/qkdata/biz/management/service/ResourceService.java
View file @
c3c43641
...
...
@@ -2,17 +2,23 @@ package com.qkdata.biz.management.service;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.aliyuncs.exceptions.ClientException
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.qkdata.biz.aliyun.service.AliyunService
;
import
com.qkdata.biz.management.entity.ResourcePO
;
import
com.qkdata.biz.management.mapper.ResourceMapper
;
import
com.qkdata.biz.management.vo.ResourceModel
;
import
com.qkdata.common.base.exception.BusinessException
;
import
org.apache.poi.ss.formula.udf.IndexedUDFFinder
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.Serializable
;
/**
* <p>
* $!{table.comment} 服务类
...
...
@@ -49,4 +55,23 @@ public class ResourceService extends ServiceImpl<ResourceMapper, ResourcePO> {
private
String
generateFileName
(){
return
System
.
currentTimeMillis
()
+
RandomUtil
.
randomString
(
4
);
}
public
ResourcePO
getByVideoId
(
String
videoId
)
{
return
getOne
(
Wrappers
.<
ResourcePO
>
lambdaQuery
().
eq
(
ResourcePO:
:
getVideoId
,
videoId
));
}
@Transactional
@Override
public
boolean
removeById
(
Serializable
id
)
{
ResourcePO
po
=
getById
(
id
);
if
(
po
!=
null
){
super
.
removeById
(
id
);
try
{
aliyunService
.
removeVideo
(
po
.
getVideoId
());
}
catch
(
ClientException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
return
true
;
}
}
\ No newline at end of file
src/main/java/com/qkdata/biz/management/vo/CourseChaperModel.java
View file @
c3c43641
...
...
@@ -13,6 +13,10 @@ public class CourseChaperModel {
* 章节名称
*/
private
String
name
;
/**
* 序号
*/
private
Integer
sortNo
;
/**
* 视频ID
*/
...
...
@@ -21,4 +25,8 @@ public class CourseChaperModel {
* 视频URL
*/
private
String
videoUrl
;
/**
* 视频快照URL
*/
private
String
snapshotUrl
;
}
src/main/java/com/qkdata/biz/management/vo/CourseStep2SaveModel.java
0 → 100644
View file @
c3c43641
package
com
.
qkdata
.
biz
.
management
.
vo
;
import
lombok.Data
;
@Data
public
class
CourseStep2SaveModel
{
private
Long
courseId
;
private
String
chaperName
;
private
String
videoId
;
private
Integer
sortNo
;
}
src/main/java/com/qkdata/biz/management/vo/QueryCourseSeriesModel.java
0 → 100644
View file @
c3c43641
package
com
.
qkdata
.
biz
.
management
.
vo
;
import
com.qkdata.common.constants.Constants
;
import
lombok.Data
;
@Data
public
class
QueryCourseSeriesModel
{
private
int
pageIndex
=
Constants
.
DEFAULT_PAGE
;
private
int
pageSize
=
Constants
.
DEFAULT_PAGE_SIZE
;
private
String
name
;
}
src/main/resources/db/migration/V1.0.2__update.sql
0 → 100644
View file @
c3c43641
ALTER
TABLE
`resource`
CHANGE
COLUMN
`bucket`
`video_id`
varchar
(
255
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_general_ci
NULL
DEFAULT
NULL
COMMENT
'阿里云视频ID'
AFTER
`name`
;
\ No newline at end of file
src/main/resources/db/migration/V1.0.3__update.sql
0 → 100644
View file @
c3c43641
ALTER
TABLE
`course_chapter`
ADD
COLUMN
`sort_no`
int
(
11
)
NULL
COMMENT
'序号'
AFTER
`name`
;
\ No newline at end of file
src/main/resources/mappers/management/course_seriesMapper.xml
View file @
c3c43641
...
...
@@ -2,4 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.qkdata.biz.management.mapper.CourseSeriesMapper"
>
<select
id=
"queryPageList"
resultType=
"com.qkdata.biz.management.entity.CourseSeriesPO"
>
select * from course_series
where 1 = 1
<if
test=
"p.name != null and p.name != ''"
>
and `name` like concat ('%',#{p.name},'%')
</if>
order by create_time desc
</select>
</mapper>
src/main/resources/static/upload-auth.js
View file @
c3c43641
...
...
@@ -22,7 +22,7 @@
$
(
document
).
ready
(
function
()
{
if
(
!
userId
&&
!
region
){
var
url
=
"http://
test2.qiankundata.com:60081
/online-edu-backend/api/aliyun/mgr/videoConfig"
;
var
url
=
"http://
localhost:9090
/online-edu-backend/api/aliyun/mgr/videoConfig"
;
$
.
get
(
url
,
function
(
data
){
userId
=
data
.
datas
.
userId
;
region
=
data
.
datas
.
region
;
...
...
@@ -60,7 +60,7 @@
// 如果 uploadInfo.videoId 存在, 调用 刷新视频上传凭证接口(https://help.aliyun.com/document_detail/55408.html)
// 如果 uploadInfo.videoId 不存在,调用 获取视频上传地址和凭证接口(https://help.aliyun.com/document_detail/55407.html)
if
(
!
uploadInfo
.
videoId
)
{
var
createUrl
=
'http://
test2.qiankundata.com:60081
/online-edu-backend/api/aliyun/mgr/videoUploadPolicy?title='
+
'测试视频'
+
'&fileName='
+
uploadInfo
.
file
.
name
var
createUrl
=
'http://
localhost:9090
/online-edu-backend/api/aliyun/mgr/videoUploadPolicy?title='
+
'测试视频'
+
'&fileName='
+
uploadInfo
.
file
.
name
$
.
get
(
createUrl
,
function
(
data
)
{
var
uploadAuth
=
data
.
datas
.
uploadAuth
var
uploadAddress
=
data
.
datas
.
uploadAddress
...
...
@@ -72,7 +72,7 @@
}
else
{
// 如果videoId有值,根据videoId刷新上传凭证
// https://help.aliyun.com/document_detail/55408.html?spm=a2c4g.11186623.6.630.BoYYcY
var
refreshUrl
=
'http://
test2.qiankundata.com:60081
/online-edu-backend/api/aliyun/mgr/refreshVideoUploadPolicy?VideoId='
+
uploadInfo
.
videoId
var
refreshUrl
=
'http://
localhost:9090
/online-edu-backend/api/aliyun/mgr/refreshVideoUploadPolicy?VideoId='
+
uploadInfo
.
videoId
$
.
get
(
refreshUrl
,
function
(
data
)
{
var
uploadAuth
=
data
.
datas
.
uploadAuth
var
uploadAddress
=
data
.
datas
.
uploadAddress
...
...
@@ -83,6 +83,7 @@
},
// 文件上传成功
onUploadSucceed
:
function
(
uploadInfo
)
{
console
.
log
(
uploadInfo
)
console
.
log
(
"onUploadSucceed: "
+
uploadInfo
.
file
.
name
+
", endpoint:"
+
uploadInfo
.
endpoint
+
", bucket:"
+
uploadInfo
.
bucket
+
", object:"
+
uploadInfo
.
object
)
$
(
'#status'
).
text
(
'文件上传成功!'
)
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment