浏览代码

设置有效时间为30天,失效后该活动就不再支持音频回放

xingzai 2 年之前
父节点
当前提交
e2400c84d3
共有 2 个文件被更改,包括 5 次插入4 次删除
  1. 0 4
      controllers/user.go
  2. 5 0
      services/micro_roadshow.go

+ 0 - 4
controllers/user.go

@@ -837,10 +837,6 @@ func (this *UserController) ApplyTryOut() {
 			return
 		}
 		title = microVideo.VideoName
-	} else {
-		br.Msg = "提交类型有误"
-		br.ErrMsg = "提交类型有误, 当前提交类型: " + tryType
-		return
 	}
 
 	fmt.Println(title)

+ 5 - 0
services/micro_roadshow.go

@@ -9,6 +9,7 @@ import (
 	"strconv"
 	"strings"
 	"sync"
+	"time"
 )
 
 // GetMicroRoadShowPageList 获取微路演列表
@@ -49,6 +50,10 @@ func GetMicroRoadShowPageList(pageSize, currentIndex, audioId, videoId int, keyw
 		var audioPars []interface{}
 		// 活动已发布且已结束
 		audioCond += ` AND b.publish_status = 1 AND b.active_state = 3`
+		//活动音频,设置有效时间为30天,失效后该活动就不再支持音频回放。有效期起始时间为活动的开始时间
+		endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
+		audioCond += ` AND b.activity_time > ? `
+		audioPars = append(audioPars, endTime)
 		if keywords != "" {
 			audioCond += ` AND a.voice_name LIKE ? OR b.label LIKE ?`
 			audioPars = append(audioPars, keywords, keywords)