소스 검색

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 년 전
부모
커밋
74f85eff64
4개의 변경된 파일32개의 추가작업 그리고 67개의 파일을 삭제
  1. 18 17
      services/activity.go
  2. 5 12
      services/activity_special.go
  3. 7 4
      services/user_label.go
  4. 2 34
      services/wx_template_msg.go

+ 18 - 17
services/activity.go

@@ -557,6 +557,24 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 		havePower = true
 		return
 	}
+	if activityInfo.ActivityTypeId == 2 || activityInfo.ActivityTypeId == 6 || activityInfo.ActivityTypeId == 7 {
+		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(主观)") {
+			havePower = true
+		} else {
+			havePower = false
+		}
+	} else {
+		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(客观)") {
+			havePower = true
+		} else {
+			havePower = false
+		}
+	}
+	//如果主客观校验不通过,那么直接返回
+	if !havePower {
+		return
+	}
+
 	if activityInfo.LimitPeopleNum > 0 {
 		mapUserType, e := GetActivityCcustomerTypeList()
 		if e != nil {
@@ -640,23 +658,6 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 			}
 		}
 	}
-	if activityInfo.ActivityTypeId == 2 || activityInfo.ActivityTypeId == 6 || activityInfo.ActivityTypeId == 7 {
-		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(主观)") {
-			havePower = true
-		} else {
-			havePower = false
-		}
-	} else {
-		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(客观)") {
-			havePower = true
-		} else {
-			havePower = false
-		}
-	}
-	//如果主客观校验不通过,那么直接返回
-	if !havePower {
-		return
-	}
 
 	permissionShengji, errs := models.GetCompanyPermissionByUserTrip(user.CompanyId)
 	if errs != nil {

+ 5 - 12
services/activity_special.go

@@ -1039,6 +1039,7 @@ func SendWxMsgActivitySpecial10(activityInfo *models.CygxActivitySpecialDetail)
 
 // SendWxMsgActivitySpecialTwoDays  活动开始前两天08:00,提醒报名客户 \提醒报名客户的对口销售
 func SendWxMsgActivitySpecialTwoDays(cont context.Context) (err error) {
+	//func SendWxMsgActivitySpecialTwoDays() (err error) {
 	var msg string
 	defer func() {
 		if err != nil {
@@ -1053,7 +1054,7 @@ func SendWxMsgActivitySpecialTwoDays(cont context.Context) (err error) {
 	endTime := twoDayTime.Format(utils.FormatDate) + " 23:59:59"
 	var condition string
 	var pars []interface{}
-	condition = ` AND  days >0  AND activity_time BETWEEN ? AND  ? `
+	condition = ` AND  days >0  AND activity_time BETWEEN ? AND  ?  `
 	pars = append(pars, startTime, endTime)
 	listActivitySpecial, e := models.GetActivitySpecialListAll(condition, pars, 0, 1000)
 	if e != nil {
@@ -1093,11 +1094,8 @@ func SendWxMsgActivitySpecialTwoDays(cont context.Context) (err error) {
 		first := ""
 		keyword1 := "专项调研【" + v.ResearchTheme + "】"
 		keyword2 := "将在两天后进行,如不能参加,请及时取消报名"
-		keyword3 := v.ActivityTimeTextByDay
-		keyword4 := "线上"
-		if v.SpecialType == 2 {
-			keyword4 = v.City
-		}
+		keyword3 := ""
+		keyword4 := ""
 		remark := "点击查看活动详情"
 		SendWxMsgWithFrequencySpecial(first, keyword1, keyword2, keyword3, keyword4, remark, openIdList, v.ActivityId)
 
@@ -1118,10 +1116,6 @@ func SendWxMsgActivitySpecialTwoDays(cont context.Context) (err error) {
 			if len(listSeller) == 0 {
 				continue
 			}
-			type SllerData struct {
-				Openid  string `description:"Openid"`
-				Keyword string `description:"Keyword "`
-			}
 			mapSller := make(map[string]string)
 			mapSllerOpenid := make(map[string]string)
 			for _, vS := range listSeller {
@@ -1133,8 +1127,7 @@ func SendWxMsgActivitySpecialTwoDays(cont context.Context) (err error) {
 				}
 			}
 			for k, _ := range mapSller {
-				keyword1 = "将在两天后进行,请及时提醒您的报名客户"
-				//keyword2 = vM
+				keyword2 = "将在两天后进行,请及时提醒您的报名客户"
 				openIdList = make([]*models.OpenIdList, 0)
 				openIdList = append(openIdList, &models.OpenIdList{OpenId: mapSllerOpenid[k]})
 				SendWxMsgWithFrequencySpecial(first, keyword1, keyword2, keyword3, keyword4, remark, openIdList, v.ActivityId)

+ 7 - 4
services/user_label.go

@@ -209,7 +209,7 @@ func ArticleHistoryUserLabelLogReduce(log models.CygxUserLabelLogRedis) (err err
 	defer func() {
 		if err != nil {
 			fmt.Println(err)
-			go utils.SendAlarmMsg("用户文章阅读更新相关标签,处理Redis队列消息失败:"+err.Error(), 2)
+			go utils.SendAlarmMsg("用户文章阅读更新相关标签,处理Redis队列消息失败:"+err.Error()+fmt.Sprint("articleId", log.SourceId, "userId", log.UserId), 2)
 		}
 	}()
 
@@ -236,13 +236,16 @@ func ArticleHistoryUserLabelLogReduce(log models.CygxUserLabelLogRedis) (err err
 		source = 2
 		detailArticle, e := models.GetArticleDetailById(articleId)
 		if e != nil {
-			err = errors.New("GetIndustrialArticleGroupManagementList, Err: " + e.Error())
+			err = errors.New("GetArticleDetailById, Err: " + e.Error())
 			return
 		}
 
 		labelDetail, e := models.GetdetailByCategoryIdLabel(detailArticle.CategoryId)
-		if e != nil {
-			err = errors.New("GetIndustrialArticleGroupManagementList, Err: " + e.Error())
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = errors.New("GetdetailByCategoryIdLabel, Err: " + e.Error())
+			return
+		}
+		if labelDetail == nil {
 			return
 		}
 		label := labelDetail.MatchTypeName

+ 2 - 34
services/wx_template_msg.go

@@ -45,7 +45,8 @@ func SendWxMsgWithFrequency(keyword2, activityName, reserveResults, activityTime
 }
 
 // 专项调研活动预开始消息通知
-func SendWxMsgWithFrequencySpecial(first, activityName, reserveResults, activityTime, activityAddress, remark string, openIdList []*models.OpenIdList, activityId int) (err error) {
+// func SendWxMsgWithFrequencySpecial(first, activityName, reserveResults, activityTime, activityAddress, remark string, openIdList []*models.OpenIdList, activityId int) (err error) {
+func SendWxMsgWithFrequencySpecial(first, keyword1, keyword2, keyword3, keyword4, remark string, openIdList []*models.OpenIdList, activityId int) (err error) {
 	var msg string
 	defer func() {
 		if err != nil {
@@ -53,38 +54,6 @@ func SendWxMsgWithFrequencySpecial(first, activityName, reserveResults, activity
 			utils.FileLog.Info("发送模版消息失败,Err:%s", err.Error())
 		}
 	}()
-	//accessToken, err := models.GetWxAccessTokenByXzs()
-	//if err != nil {
-	//	msg = "GetWxAccessToken Err:" + err.Error()
-	//	return
-	//}
-	//if accessToken == "" {
-	//	msg = "accessToken is empty"
-	//	return
-	//}
-	//
-	//sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken
-	//templateId := utils.WxMsgTemplateIdActivityApplyXzs
-	//sendMap := make(map[string]interface{})
-	//sendData := make(map[string]interface{})
-	//sendMap["template_id"] = templateId
-	//sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId, "pagepath": utils.WX_MSG_PATH_ACTIVITY_SPECIAL_DETAIL + strconv.Itoa(activityId)}
-	//sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"}
-	//sendData["keyword1"] = map[string]interface{}{"value": activityName, "color": "#173177"}
-	//sendData["keyword2"] = map[string]interface{}{"value": activityTime, "color": "#173177"}
-	//sendData["remark"] = map[string]interface{}{"value": remark, "color": "#173177"}
-	//sendMap["data"] = sendData
-	//WxSendTemplateMsg(sendUrl, sendMap, openIdList, strconv.Itoa(activityId), utils.TEMPLATE_MSG_CYGX_ACTIVITY_ADD)
-
-	//var first string
-	var keyword1 string
-	var keyword2 string
-	var keyword3 string
-	var keyword4 string
-
-	first = ""
-	keyword1 = activityName
-	keyword3 = activityTime
 	openIdArr := make([]string, 0)
 	for _, v := range openIdList {
 		openIdArr = append(openIdArr, v.OpenId)
@@ -104,7 +73,6 @@ func SendWxMsgWithFrequencySpecial(first, activityName, reserveResults, activity
 	sendInfo.SendType = utils.TEMPLATE_MSG_CYGX_ACTIVITY_ADD
 	sendInfo.OpenIdArr = openIdArr
 	err = PublicSendTemplateMsg(sendInfo)
-
 	return
 }