更新本人观看视频信息bug
This commit is contained in:
parent
22c30a47b5
commit
161b1c5457
|
|
@ -43,7 +43,7 @@ const install = (Vue, vm) => {
|
||||||
let getDocument = (params={})=>vm.$u.get('/quality/document/', params);//文档
|
let getDocument = (params={})=>vm.$u.get('/quality/document/', params);//文档
|
||||||
let getVideos = (params={})=>vm.$u.get('/vod/video/', params);//点播视频
|
let getVideos = (params={})=>vm.$u.get('/vod/video/', params);//点播视频
|
||||||
let getDickey = (params={})=>vm.$u.get('/system/dict/', params);//查询字典
|
let getDickey = (params={})=>vm.$u.get('/system/dict/', params);//查询字典
|
||||||
let putMyVideoView =(id)=>vm.$u.post(`/vod/video/${id}/myview/`);//更新本人观看信息
|
let putMyVideoView =(id)=>vm.$u.put(`/vod/video/${id}/myview/`);//更新本人观看信息
|
||||||
vm.$u.api = {getUserInfo,
|
vm.$u.api = {getUserInfo,
|
||||||
getCode,
|
getCode,
|
||||||
codeLogin,
|
codeLogin,
|
||||||
|
|
|
||||||
|
|
@ -103,12 +103,7 @@
|
||||||
if (e.type == 'play') {
|
if (e.type == 'play') {
|
||||||
var playingVideoStr = e.target.id
|
var playingVideoStr = e.target.id
|
||||||
this.list[this.swiperIndex].content[index].showTitle = false
|
this.list[this.swiperIndex].content[index].showTitle = false
|
||||||
if(this.list[this.swiperIndex].content[index]){
|
this.$u.api.putMyVideoView(this.list[this.swiperIndex].content[index].id).then(res=>{})
|
||||||
|
|
||||||
}else{
|
|
||||||
this.$u.api.addVodView(this.list[this.swiperIndex].content[index].id).then(res=>{
|
|
||||||
this.list[this.swiperIndex].content[index].played = true
|
|
||||||
})}
|
|
||||||
//暂停其他视频播放
|
//暂停其他视频播放
|
||||||
if(this.playingVideoStr==null){
|
if(this.playingVideoStr==null){
|
||||||
this.playingVideoStr = playingVideoStr
|
this.playingVideoStr = playingVideoStr
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class MyViewRecordAPIView(APIView):
|
||||||
video = Video.objects.get(pk=id)
|
video = Video.objects.get(pk=id)
|
||||||
except:
|
except:
|
||||||
return Response('视频不存在', status=HTTP_400_BAD_REQUEST)
|
return Response('视频不存在', status=HTTP_400_BAD_REQUEST)
|
||||||
record = ViewRecord.objects.get_or_create(video=video, user=request.user, defaults={'video':video, 'user':request.user})
|
record, _ = ViewRecord.objects.get_or_create(video=video, user=request.user, defaults={'video':video, 'user':request.user})
|
||||||
if request.data.get('current', None):
|
if request.data.get('current', None):
|
||||||
record.current = request.data.get('current')
|
record.current = request.data.get('current')
|
||||||
if timezone.now() > record.update_time + timedelta(hours=6) or record.create_time == record.update_time:
|
if timezone.now() > record.update_time + timedelta(hours=6) or record.create_time == record.update_time:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue