浏览代码

Merge branch 'cygx/7.6' into debug

# Conflicts:
#	models/db.go
ziwen 2 年之前
父节点
当前提交
bfdeaaefb1
共有 3 个文件被更改,包括 5 次插入4 次删除
  1. 1 1
      controllers/micro_roadshow.go
  2. 1 0
      models/db.go
  3. 3 3
      models/micro_roadshow.go

+ 1 - 1
controllers/micro_roadshow.go

@@ -172,7 +172,7 @@ func (this *MicroRoadShowController) VideoHistoryAdd() {
 	}
 
 	if playSeconds != "" {
-		lastItem, err := models.GetLastCygxMicroRoadshowVideoHistory(videoId)
+		lastItem, err := models.GetLastCygxMicroRoadshowVideoHistory(videoId, user.UserId)
 		if err != nil {
 			br.Msg = "操作失败"
 			br.ErrMsg = "操作失败,GetLastCygxMicroRoadshowVideoHistory Err:" + err.Error()

+ 1 - 0
models/db.go

@@ -120,6 +120,7 @@ func init() {
 		new(CygxThreeApiLog),
 		new(CygxIndustrialArticleGroupManagement),
 		new(ArticleTopHistoryRecord),
+		new(CygxMicroRoadshowVideoHistory),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 3 - 3
models/micro_roadshow.go

@@ -113,10 +113,10 @@ type CygxMicroRoadshowVideoHistory struct {
 	ModifyTime  time.Time `description:"视频修改时间"`
 }
 
-func GetLastCygxMicroRoadshowVideoHistory(videoId int) (item *CygxMicroRoadshowVideoHistory, err error) {
+func GetLastCygxMicroRoadshowVideoHistory(videoId, userId int) (item *CygxMicroRoadshowVideoHistory, err error) {
 	o := orm.NewOrm()
-	sql := ` SELECT * FROM cygx_micro_roadshow_video_history WHERE video_id=? ORDER BY create_time DESC limit 1 `
-	err = o.Raw(sql, videoId).QueryRow(&item)
+	sql := ` SELECT * FROM cygx_micro_roadshow_video_history WHERE video_id=? AND user_id=? ORDER BY create_time DESC limit 1 `
+	err = o.Raw(sql, videoId, userId).QueryRow(&item)
 	return
 }