Bladeren bron

Merge branch 'mfyx_3.6' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 7 maanden geleden
bovenliggende
commit
17cc386db4
3 gewijzigde bestanden met toevoegingen van 47 en 2 verwijderingen
  1. 9 1
      models/activity_video.go
  2. 8 0
      models/activity_voice.go
  3. 30 1
      services/activity_points.go

+ 9 - 1
models/activity_video.go

@@ -81,7 +81,15 @@ func GetCygxActivityVideoByActivityId(activityId int) (item *CygxActivityVideo,
 	return
 }
 
-// GetCygxActivityVideoByActivityId 获取活动视频
+// 获取数量
+func GetCygxActivityVideoCount(activityId int) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_activity_video   WHERE activity_id = ? `
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, activityId).QueryRow(&count)
+	return
+}
+
+// GetCygxActivityVideoReqByActivityId 获取活动视频
 func GetCygxActivityVideoReqByActivityId(activityId int) (item *CygxActivityVideoReq, err error) {
 	sql := `SELECT * FROM cygx_activity_video WHERE video_id = ? LIMIT 1 `
 	err = orm.NewOrm().Raw(sql, activityId).QueryRow(&item)

+ 8 - 0
models/activity_voice.go

@@ -103,6 +103,14 @@ func GetCygxActivityVoiceByActivityId(activityId int) (item *CygxActivityVoice,
 	return
 }
 
+// 获取数量
+func GetCygxActivityVoiceCount(activityId int) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_activity_voice   WHERE activity_id = ? `
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, activityId).QueryRow(&count)
+	return
+}
+
 // 列表
 func GetActivityVoiceList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityVoiceResp, err error) {
 	o := orm.NewOrm()

+ 30 - 1
services/activity_points.go

@@ -1119,11 +1119,40 @@ func YanXuanActivityVivoPointsBillSignupReduce(log models.YanXuanActivityPointsR
 		return
 	}
 
+	var vivoName string
+
 	activityInfo, e := models.GetAddActivityInfoByActivityId(activityId)
 	if e != nil {
 		err = errors.New("GetAddActivityInfoByActivityId" + e.Error())
 		return
 	}
+	totalVi, e := models.GetCygxActivityVideoCount(activityId)
+	if e != nil {
+		err = errors.New("GetCygxActivityVideoCount" + e.Error())
+		return
+	}
+	if totalVi > 0 {
+		activityVideoInfo, e := models.GetCygxActivityVideoByActivityId(activityId)
+		if e != nil {
+			err = errors.New("GetCygxActivityVideoByActivityId, Err: " + e.Error())
+			return
+		}
+		vivoName = activityVideoInfo.VideoName // 视频名称
+	} else {
+		totalVo, e := models.GetCygxActivityVoiceCount(activityId)
+		if e != nil {
+			err = errors.New("GetCygxActivityVoiceCount" + e.Error())
+			return
+		}
+		if totalVo > 0 {
+			activityVoiceInfo, e := models.GetCygxActivityVoiceByActivityId(activityId)
+			if e != nil {
+				err = errors.New("GetCygxActivityVoiceByActivityId, Err: " + e.Error())
+				return
+			}
+			vivoName = activityVoiceInfo.VoiceName // 音频名称
+		}
+	}
 
 	user, e := models.GetWxUserItemByUserId(userId)
 	if e != nil {
@@ -1155,7 +1184,7 @@ func YanXuanActivityVivoPointsBillSignupReduce(log models.YanXuanActivityPointsR
 	item.Source = log.Source
 	item.ChartPermissionId = activityInfo.ChartPermissionId
 	item.DoType = 1
-	item.Content = "查看活动回放"
+	item.Content = "查看活动回放-" + vivoName
 	item.Points = companyPointsNum - vivoPointsSetDetail.PointsNum
 	items = append(items, item)