Roc 3 år sedan
förälder
incheckning
3ea44e9adb
1 ändrade filer med 10 tillägg och 5 borttagningar
  1. 10 5
      services/task.go

+ 10 - 5
services/task.go

@@ -255,7 +255,14 @@ func AddEdbTask(cont context.Context) (err error) {
 	//失败列表
 	failList := make([]string, 0)
 
-	wxUser, _ := models.GetWxUserByMobile("17634786714")
+	debugNoticeUserId := 0 //测试环境,需要发送消息的用户
+	if utils.RunMode == "debug" {
+		tmpWxUser, tmpErr := models.GetWxUserByMobile("17634786714")
+		if tmpErr == nil && tmpWxUser != nil {
+			//debugNoticeUserId = 44078 //测试环境的话,发送邮箱给颜鹏
+			debugNoticeUserId = int(tmpWxUser.UserId) //测试环境的话,发送邮箱给嘉豪
+		}
+	}
 	//task.globalTaskManager.adminTaskList
 	for _, edb := range list {
 		tmpEdb := edb            //指标信息
@@ -391,10 +398,8 @@ func AddEdbTask(cont context.Context) (err error) {
 						return
 					}
 				}
-				if utils.RunMode == "debug" && wxUser != nil {
-					//tmpEdb.UserId = 44078 //测试环境的话,发送邮箱给颜鹏
-					tmpEdb.UserId = int(wxUser.UserId) //测试环境的话,发送邮箱给嘉豪
-
+				if utils.RunMode == "debug" && debugNoticeUserId > 0 {
+					tmpEdb.UserId = debugNoticeUserId //测试环境的话,发送邮箱给嘉豪
 				}
 
 				//数据过期时间