Эх сурвалжийг харах

fix:超前项目推送增加开关限制

duxin 8 сар өмнө
parent
commit
9e2b61a25e

+ 4 - 0
entity/mananger/customManager.go

@@ -80,6 +80,10 @@ func (this *CustomManager) GetData(userId, keyWords string, isNew bool) map[stri
 
 // ScheduledTasks 定时任务
 func (this *CustomManager) ScheduledTasks() {
+	if !vars.Config.IsEnable {
+		log.Println("定时任务开关未开启")
+		return
+	}
 	// 定时圈用户
 	if this.Conf.UpdateCron != "" {
 		c := cron.New(cron.WithSeconds())

+ 11 - 9
services/action.go

@@ -6,6 +6,7 @@ import (
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"leadGeneration/entity/mananger"
+	"leadGeneration/vars"
 	"log"
 	"time"
 )
@@ -27,15 +28,16 @@ func (this *LeadGeneration) GetDate() {
 		keyWords := this.GetString("keyWords")
 		t, _ := this.GetInt("dType")
 		rData := map[string]interface{}{}
-
-		if t != 0 || keyWords != "" {
-			//获取超前项目
-			if aheadData := mananger.JyAheadManager.GetData(userId, keyWords, isNewUser, t); aheadData != nil && len(aheadData) > 0 {
-				rData["ahead"] = aheadData
-			}
-			//获取定制化报告数据
-			if customData := mananger.JyCustomManager.GetData(userId, keyWords, isNewUser); customData != nil && len(customData) > 0 {
-				rData["custom"] = customData
+		if vars.Config.IsEnable {
+			if t != 0 || keyWords != "" {
+				//获取超前项目
+				if aheadData := mananger.JyAheadManager.GetData(userId, keyWords, isNewUser, t); aheadData != nil && len(aheadData) > 0 {
+					rData["ahead"] = aheadData
+				}
+				//获取定制化报告数据
+				if customData := mananger.JyCustomManager.GetData(userId, keyWords, isNewUser); customData != nil && len(customData) > 0 {
+					rData["custom"] = customData
+				}
 			}
 		}
 		return rData, nil

+ 1 - 0
vars/config.go

@@ -8,6 +8,7 @@ var Config *config
 
 type config struct {
 	WebPort            string       `json:"webPort"`            //服务端口
+	IsEnable           bool         `json:"isEnable"`           //开关
 	Ahead              AheadConfig  `json:"ahead"`              //超前项目配置
 	Custom             CustomConfig `json:"custom"`             //定制化报告配置
 	TestUid            []string     `json:"testUid"`            //测试用户id