Forráskód Böngészése

修改路演模板消息

longyu 2 éve
szülő
commit
46cceec889
1 módosított fájl, 80 hozzáadás és 34 törlés
  1. 80 34
      controllers/roadshow/calendar.go

+ 80 - 34
controllers/roadshow/calendar.go

@@ -217,28 +217,40 @@ func (this *CalendarController) Add() {
 		//模板消息通知
 		{
 			go func() {
+				var wxAppPath string
 				sysAdmin, _ := admin.GetAdminWxById(v.ResearcherId)
-				if sysAdmin != nil  {
-					first := "您收到一个新的【" + req.ActivityType + "】申请,请及时处理"
-					keyword1 := sysUser.RealName
-					keyword2 := "--"
-					keyword3 := time.Now().Format(utils.FormatDateTime)
-					startDateSub := v.StartDate[5:]
-					startDateSub = strings.Replace(startDateSub, "-", ".", -1)
-					var keyword4 string
-					if req.ActivityType == "路演" {
-						keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.CompanyName + "(" + req.RoadshowType + req.ActivityType + ")"
-					} else {
-						keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.Theme + "(" + req.RoadshowType + req.ActivityType + ")"
-					}
-					remark := "请尽快完成审批"
-					var wxAppPath string
-					if req.ActivityType != "内部会议" && req.ActivityType != "报告电话会" {
+				if sysAdmin != nil {
+					if req.ActivityType == "路演" || req.ActivityType == "公开会议" {
 						wxAppPath = "pages-approve/activity/detail?RsCalendarId=" + strconv.Itoa(int(rsCalendarId)) + "&RsCalendarResearcherId=" + strconv.Itoa(int(rsCalendarResearcherId))
-					}
-					openIdList, _ := models.GetAdminOpenIdByMobile(sysAdmin.Mobile)
-					if len(openIdList) > 0 {
-						services.SendWxMsgWithRoadshowPending(first, keyword1, keyword2, keyword3, keyword4, remark, wxAppPath, sysAdmin.Mobile)
+						first := "您收到一个新的【" + req.ActivityType + "】申请,请及时处理"
+						keyword1 := sysUser.RealName
+						keyword2 := "--"
+						keyword3 := time.Now().Format(utils.FormatDateTime)
+						startDateSub := v.StartDate[5:]
+						startDateSub = strings.Replace(startDateSub, "-", ".", -1)
+						var keyword4 string
+						if req.ActivityType == "路演" {
+							keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.CompanyName + "(" + req.RoadshowType + req.ActivityType + ")"
+						} else {
+							keyword4 = startDateSub + "(" + v.StartWeek + ")" + " " + v.StartTime[:5] + "~" + v.EndTime[:5] + " ," + req.Theme + "(" + req.RoadshowType + req.ActivityType + ")"
+						}
+						remark := "请尽快完成审批"
+						//wxAppPath := "pages-approve/activity/detail?RsCalendarId=" + strconv.Itoa(int(rsCalendarId)) + "&RsCalendarResearcherId=" + strconv.Itoa(int(rsCalendarResearcherId))
+						openIdList, _ := models.GetAdminOpenIdByMobile(sysAdmin.Mobile)
+						if len(openIdList) > 0 {
+							go services.SendWxMsgWithRoadshowPending(first, keyword1, keyword2, keyword3, keyword4, remark, wxAppPath, sysAdmin.Mobile)
+						}
+					} else {
+						wxAppPath = ""
+						first := sysAdmin.RealName + "为你添加了一场【" + req.ActivityType + "】"
+						startDate := researcher.StartDate[5:]
+						startDate = strings.Replace(startDate, "-", ".", -1)
+						keyword1 := "会议时间:" + startDate + "(" + researcher.StartWeek + ")" + " " + researcher.StartTime[:5] + "-" + researcher.EndTime[:5]
+						keyword2 := "--"
+						openIdList, _ := models.GetAdminOpenIdByMobile(sysAdmin.Mobile)
+						if len(openIdList) > 0 {
+							go services.SendWxMsgWithRoadshowDeleteNotice(first, keyword1, keyword2, "", wxAppPath, sysAdmin.Mobile)
+						}
 					}
 				}
 			}()
@@ -1627,25 +1639,59 @@ func (this *CalendarController) Delete() {
 		if rsCalendarResearcherItem.Status == 1 || rsCalendarResearcherItem.Status == 2 {
 			go rs.DeleteSHCalendar(rsCalendarResearcherItem.RsCalendarResearcherId)
 		}
+		////模板消息通知
+		//{
+		//	go func() {
+		//		if rsCalendarItem != nil && rsCalendarResearcherItem != nil {
+		//			sysAdmin, _ := admin.GetAdminById(rsCalendarResearcherItem.ResearcherId)
+		//			if sysAdmin != nil && sysAdmin.Mobile != "" {
+		//				first := "【" + sysUser.RealName + "】删除了你的【路演】安排"
+		//				var keyword1 string
+		//				if rsCalendarItem.ActivityType == "路演" {
+		//					keyword1 = rsCalendarItem.CompanyName + "," + rsCalendarItem.RoadshowType + rsCalendarItem.ActivityType
+		//				} else {
+		//					keyword1 = rsCalendarItem.Theme + "," + rsCalendarItem.RoadshowType + rsCalendarItem.ActivityType
+		//				}
+		//				keyword2 := "已删除"
+		//				remark := req.DeleteReason
+		//				var wxAppPath string
+		//				if rsCalendarItem.ActivityType == "路演" || rsCalendarItem.ActivityType == "公开会议" {
+		//					wxAppPath = "pages-approve/activity/detail?RsCalendarId=" + strconv.Itoa(rsCalendarItem.RsCalendarId) + "&RsCalendarResearcherId=" + strconv.Itoa(rsCalendarResearcherItem.RsCalendarResearcherId)
+		//				}
+		//				go services.SendWxMsgWithRoadshowDeleteNotice(first, keyword1, keyword2, remark, wxAppPath, sysAdmin.Mobile)
+		//			}
+		//		}
+		//	}()
+		//}
+
 		//模板消息通知
 		{
 			go func() {
 				if rsCalendarItem != nil && rsCalendarResearcherItem != nil {
 					sysAdmin, _ := admin.GetAdminById(rsCalendarResearcherItem.ResearcherId)
-					if sysAdmin != nil && sysAdmin.Mobile != "" {
-						first := "【" + sysUser.RealName + "】删除了你的【路演】安排"
-						var keyword1 string
-						if rsCalendarItem.ActivityType == "路演" {
-							keyword1 = rsCalendarItem.CompanyName + "," + rsCalendarItem.RoadshowType + rsCalendarItem.ActivityType
-						} else {
-							keyword1 = rsCalendarItem.Theme + "," + rsCalendarItem.RoadshowType + rsCalendarItem.ActivityType
-						}
-						keyword2 := "已删除"
-						remark := req.DeleteReason
-						var wxAppPath string
-						if rsCalendarItem.ActivityType == "路演" || rsCalendarItem.ActivityType == "公开会议" {
-							wxAppPath = "pages-approve/activity/detail?RsCalendarId=" + strconv.Itoa(rsCalendarItem.RsCalendarId) + "&RsCalendarResearcherId=" + strconv.Itoa(rsCalendarResearcherItem.RsCalendarResearcherId)
-						}
+					var first string
+					var wxAppPath string
+					if rsCalendarItem.ActivityType == "路演" || rsCalendarItem.ActivityType == "公开会议" {
+						wxAppPath = "pages-approve/activity/detail?RsCalendarId=" + strconv.Itoa(rsCalendarItem.RsCalendarId) + "&RsCalendarResearcherId=" + strconv.Itoa(rsCalendarResearcherItem.RsCalendarResearcherId)
+					}
+
+					first = "【" + sysUser.RealName + "】删除了你的【" + rsCalendarItem.ActivityType + "】安排"
+
+					var keyword1 string
+					if rsCalendarItem.ActivityType == "路演" {
+						keyword1 = rsCalendarItem.CompanyName + "," + rsCalendarItem.RoadshowType + rsCalendarItem.ActivityType
+					} else if rsCalendarItem.ActivityType == "公开会议" {
+						keyword1 = rsCalendarItem.Theme + "," + rsCalendarItem.RoadshowType + rsCalendarItem.ActivityType
+					} else {
+						startDate := rsCalendarResearcherItem.StartDate[5:]
+						startDate = strings.Replace(startDate, "-", ".", -1)
+						keyword1 = "会议时间:" + startDate + "(" + rsCalendarResearcherItem.StartWeek + ")" + " " + rsCalendarResearcherItem.StartTime[:5] + "-" + rsCalendarResearcherItem.EndTime[:5]
+					}
+					keyword2 := "已删除"
+					remark := req.DeleteReason
+
+					openIdList, _ := models.GetAdminOpenIdByMobile(sysAdmin.Mobile)
+					if len(openIdList) > 0 {
 						go services.SendWxMsgWithRoadshowDeleteNotice(first, keyword1, keyword2, remark, wxAppPath, sysAdmin.Mobile)
 					}
 				}