Browse Source

Merge branch 'fix_bug_2021_11_24_10_25' of hongze/hongze_cygx into master

hongze 3 năm trước cách đây
mục cha
commit
80e49f7a13
2 tập tin đã thay đổi với 34 bổ sung32 xóa
  1. 28 30
      services/task.go
  2. 6 2
      utils/config.go

+ 28 - 30
services/task.go

@@ -14,8 +14,7 @@ import (
 
 func Task() {
 	fmt.Println("start")
-	//同步数据
-	if utils.RunMode == "release" {
+	if utils.RunMode == "release" && utils.IsTask {
 		//syncTacticsListAddreport := task.NewTask("syncTacticsListAddreport", "0 */5 * * * *", SyncTacticsListAddreport) //同步文章
 		//task.AddTask("syncTacticsListAddreport", syncTacticsListAddreport)
 		getSummarytoEs := task.NewTask("getSummarytoEs", "0 */30 * * * *", GetSummarytoEs) //同步纪要库内容到Es
@@ -27,35 +26,34 @@ func Task() {
 		task.AddTask("sendActivityBeginMsg", sendActivityBeginMsg)
 		sendActivityBeginMsgMeeting := task.NewTask("sendActivityBeginMsgMeeting", "0 */5 8-22 * * *", SendActivityBeginMsgMeeting) //会议前15分钟的提醒
 		task.AddTask("sendActivityBeginMsgMeeting", sendActivityBeginMsgMeeting)
+
+		//预约外呼名单,会前1小时自动发送邮件给专家组
+		sendEmailFileToExpert := task.NewTask("sendEmailFileToExpert", "0 */5 8-22 * * *", SendEmailFileToExpert) //预约外呼名单,会前1小时自动发送邮件给专家组
+		task.AddTask("sendEmailFileToExpert", sendEmailFileToExpert)
+
+		sendEmailFileForAskMsgResearch := task.NewTask("sendEmailFileForAskMsgResearch", "0 */5 8-22 * * *", SendEmailFileForAskMsgResearch) //研选系列专家电话会,会前1小时将问题列表发送给邮箱
+		task.AddTask("sendEmailFileForAskMsgResearch", sendEmailFileForAskMsgResearch)
+
+		sendEmailFileForAskMsg := task.NewTask("sendEmailFileForAskMsg", "0 */5 8-22 * * *", SendEmailFileForAskMsg) //非研选系列专家电话会,根据主持人姓名,会前15分钟将问题列表发送给至该主持人对应邮箱
+		task.AddTask("sendEmailFileForAskMsg", sendEmailFileForAskMsg)
+
+		sendEmailUserWhiteListChange := task.NewTask("sendEmailUserWhiteListChange", "0 00 17 * * *", SendEmailUserWhiteListChange) //新增 和冻结的客户白名单
+		task.AddTask("sendEmailUserWhiteListChange", sendEmailUserWhiteListChange)
+	}
+
+	if utils.IsTask {
+		//修改任务状
+		updateActivitySattus := task.NewTask("syncTacticsListAddreport", "0 */1 8-22 * * *", UpdateActivitySattus)
+		task.AddTask("updateActivitySattus", updateActivitySattus)
+
+		//更新深 和新的标签
+		updateIndustrialManagementLabel := task.NewTask("updateIndustrialManagementLabel", "0 */30 * * * *", UpdateIndustrialManagementLabel)
+		task.AddTask("updateIndustrialManagementLabel", updateIndustrialManagementLabel)
+
+		//更改对应产业的文章阅读数量
+		chageIndustrialArticleNum := task.NewTask("chageIndustrialArticleNum", "0 01 00 * * *", ChageIndustrialArticleNum) //更改对应产业的文章阅读数量
+		task.AddTask("chageIndustrialArticleNum", chageIndustrialArticleNum)
 	}
-	//修改任务状态
-	updateActivitySattus := task.NewTask("syncTacticsListAddreport", "0 */1 8-22 * * *", UpdateActivitySattus)
-	task.AddTask("updateActivitySattus", updateActivitySattus)
-	//更新深 和新的标签
-	updateIndustrialManagementLabel := task.NewTask("updateIndustrialManagementLabel", "0 */30 * * * *", UpdateIndustrialManagementLabel)
-	task.AddTask("updateIndustrialManagementLabel", updateIndustrialManagementLabel)
-	//更新报告的搜索栏内容
-	//UpdateIndustrialManagementSubjectNnames()
-
-	//预约外呼名单,会前1小时自动发送邮件给专家组
-	sendEmailFileToExpert := task.NewTask("sendEmailFileToExpert", "0 */5 8-22 * * *", SendEmailFileToExpert) //预约外呼名单,会前1小时自动发送邮件给专家组
-	task.AddTask("sendEmailFileToExpert", sendEmailFileToExpert)
-
-	sendEmailFileForAskMsgResearch := task.NewTask("sendEmailFileForAskMsgResearch", "0 */5 8-22 * * *", SendEmailFileForAskMsgResearch) //研选系列专家电话会,会前1小时将问题列表发送给邮箱
-	task.AddTask("sendEmailFileForAskMsgResearch", sendEmailFileForAskMsgResearch)
-
-	sendEmailFileForAskMsg := task.NewTask("sendEmailFileForAskMsg", "0 */5 8-22 * * *", SendEmailFileForAskMsg) //非研选系列专家电话会,根据主持人姓名,会前15分钟将问题列表发送给至该主持人对应邮箱
-	task.AddTask("sendEmailFileForAskMsg", sendEmailFileForAskMsg)
-
-	//白名单发送2
-	sendEmailUserWhiteListChange := task.NewTask("sendEmailUserWhiteListChange", "0 00 17 * * *", SendEmailUserWhiteListChange) //新增 和冻结的客户白名单
-	task.AddTask("sendEmailUserWhiteListChange", sendEmailUserWhiteListChange)
-
-	//更改对应产业的文章阅读数量
-	chageIndustrialArticleNum := task.NewTask("chageIndustrialArticleNum", "0 01 00 * * *", ChageIndustrialArticleNum) //更改对应产业的文章阅读数量
-	task.AddTask("chageIndustrialArticleNum", chageIndustrialArticleNum)
-
-	//IndustrialArticleNum()
 
 	//GetAddpArticle() //同步日度点评数据
 	task.StartTask()

+ 6 - 2
utils/config.go

@@ -58,10 +58,12 @@ var (
 	EmailZhizao       string //智造行业专家邮箱
 	EmailStrategy     string //策略行业专家邮箱
 	EmaiWhiteUserList string //白名单邮箱
+	IsTask            bool   //是否执行定时任务
 )
 
 func init() {
 	RunMode = beego.AppConfig.String("run_mode")
+
 	config, err := beego.AppConfig.GetSection(RunMode)
 	if err != nil {
 		panic("配置文件读取错误 " + err.Error())
@@ -80,7 +82,10 @@ func init() {
 		fmt.Println(Re)
 		panic(Re)
 	}
-
+	IsTask, err = beego.AppConfig.Bool("IsTask")
+	if err != nil {
+		panic("定时任务配置文件读取错误 " + err.Error())
+	}
 	OnlineTime = "2021-06-01 00:00:01" //上线时间
 	SummaryArticleId = 1000000         //手动添加的纪要库开始ID
 	WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829"
@@ -153,7 +158,6 @@ func init() {
 		WxMsgTemplateIdApplyXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA"         //申请待处理(小助手)
 		WxMsgTemplateIdApplyCancelXzs = "gCSCAWNNhjkzE2V1cjbIV_Ex68R_8LM_u25qDlSKWyM"   ////预约取消提醒(小助手)
 	}
-
 }
 
 //http://webapi.brilliantstart.cn/api/