|
@@ -376,7 +376,7 @@ func (this *EtaTrainingVideoController) Edit() {
|
|
|
ob := new(eta_training_video.EtaTrainingVideo)
|
|
|
item, e := ob.GetItemById(req.VideoId)
|
|
|
if e != nil {
|
|
|
- if e.Error() != utils.ErrNoRow() {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
br.Msg = "视频不存在, 请刷新页面"
|
|
|
return
|
|
|
}
|
|
@@ -535,7 +535,7 @@ func (this *EtaTrainingVideoController) Publish() {
|
|
|
ob := new(eta_training_video.EtaTrainingVideo)
|
|
|
item, e := ob.GetItemById(req.VideoId)
|
|
|
if e != nil {
|
|
|
- if e.Error() != utils.ErrNoRow() {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
br.Msg = "视频不存在, 请刷新页面"
|
|
|
return
|
|
|
}
|
|
@@ -614,7 +614,7 @@ func (this *EtaTrainingVideoController) Remove() {
|
|
|
ob := new(eta_training_video.EtaTrainingVideo)
|
|
|
item, e := ob.GetItemById(req.VideoId)
|
|
|
if e != nil {
|
|
|
- if e.Error() != utils.ErrNoRow() {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "操作成功"
|
|
@@ -662,3 +662,63 @@ func (this *EtaTrainingVideoController) Remove() {
|
|
|
br.Success = true
|
|
|
br.Msg = "操作成功"
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (this *EtaTrainingVideoController) Detail() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ videoId, _ := this.GetInt("VideoId", 0)
|
|
|
+ if videoId <= 0 {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = fmt.Sprint("参数有误, 视频ID: ", videoId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ ob := new(eta_training_video.EtaTrainingVideo)
|
|
|
+ item, e := ob.GetItemById(videoId)
|
|
|
+ if e != nil {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "视频不存在, 请刷新页面"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取ETA培训视频失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ list := make([]*eta_training_video.EtaTrainingVideo, 0)
|
|
|
+ list = append(list, item)
|
|
|
+ formats, e := etaTrainingVideoService.FormatVideosToVideoItems(list)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "格式化视频信息失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ result := new(eta_training_video.EtaTrainingVideoItem)
|
|
|
+ if len(formats) > 0 {
|
|
|
+ result = formats[0]
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Data = result
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+}
|