소스 검색

Merge branch 'cygx_10.12.1' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 년 전
부모
커밋
ec343ce76c
2개의 변경된 파일33개의 추가작업 그리고 22개의 파일을 삭제
  1. 1 1
      controllers/banner.go
  2. 32 21
      services/activity.go

+ 1 - 1
controllers/banner.go

@@ -31,7 +31,7 @@ func (this *BannerController) List() {
 	resp := new(models.CygxBannerListResp)
 	var condition string
 	var pars []interface{}
-	condition += " AND art.show_type IN (0,1)	 AND art.status = 1 ORDER BY art. list_type ASC   , art.sort ASC  "
+	condition += " AND art.show_type IN (0,1)	 AND art.status = 1 ORDER BY art.list_type ASC   , art.sort ASC  "
 	list, err := models.GetCygxBannerList(condition, pars, 0, 99999)
 	if err != nil {
 		br.Msg = "获取失败"

+ 32 - 21
services/activity.go

@@ -2144,12 +2144,31 @@ func ActivityUserRemind(user *models.WxUserItem, activityDetail *models.Activity
 			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "GetCeLueArticlePv ErrMsg:"+err.Error(), utils.EmailSendToUsers)
 		}
 	}()
-	countUser, err := models.GetUserRemind(user.UserId)
-	if err != nil {
-		return err
+	countUser, e := models.GetUserRemind(user.UserId)
+	if e != nil {
+		err = errors.New("GetUserRemind, Err: " + e.Error())
+		return
 	}
-	if countUser == 0 {
-		return err
+	//获取销售手机号
+	sellerItemQy, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetSellerByCompanyIdCheckFicc, Err: " + e.Error())
+		return
+	}
+	if sellerItemQy == nil {
+		err = nil
+		return
+	}
+	//某销售下的所有客户活动报名/预约外呼时,模板消息提醒该销售(可设置销售范围,随时增减销售)
+	conf, e := models.GetConfigByCode("tpl_msg_seller_mobile")
+	if e != nil {
+		err = errors.New("GetConfigByCode, Err: " + e.Error())
+		return
+	}
+	//如果用户没有设置消息提醒,而且销售的手机号也没有添加到配置中,那么就不推送模版消息
+	if countUser == 0 && !strings.Contains(conf.ConfigValue, sellerItemQy.Mobile) {
+		err = nil
+		return
 	}
 	var sourceMsg string
 	if source == 1 {
@@ -2161,24 +2180,16 @@ func ActivityUserRemind(user *models.WxUserItem, activityDetail *models.Activity
 	} else if source == 4 {
 		sourceMsg = "活动报名"
 	}
-
-	//获取销售手机号
-	sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	openIdList, e := models.GetUserRecordListByMobile(4, sellerItemQy.Mobile)
+	if e != nil {
+		err = errors.New("GetUserRecordListByMobile, Err: " + e.Error())
 		return err
 	}
-	if sellerItemQy != nil {
-		openIdList, err := models.GetUserRecordListByMobile(4, sellerItemQy.Mobile)
-		if err != nil {
-			fmt.Println(err)
-			return err
-		}
-		var keyword1 string
-		var keyword2 string
-		keyword1 = activityDetail.ActivityName
-		keyword2 = fmt.Sprint("互动:", sourceMsg, ",", user.RealName, "--", user.CompanyName)
-		SendWxMsgWithActivityUserRemind(keyword1, keyword2, openIdList, activityDetail.ActivityId)
-	}
+	var keyword1 string
+	var keyword2 string
+	keyword1 = activityDetail.ActivityName
+	keyword2 = fmt.Sprint("互动:", sourceMsg, ",", user.RealName, "--", user.CompanyName)
+	SendWxMsgWithActivityUserRemind(keyword1, keyword2, openIdList, activityDetail.ActivityId)
 	return
 }