|
@@ -6,6 +6,7 @@ import (
|
|
|
"hongze/hongze_cygx/models"
|
|
|
"hongze/hongze_cygx/utils"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -43,7 +44,7 @@ func AddCygxBannerYxSurvey(user *models.WxUserItem, content string) (err error)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// 用户提交研选调研需求,向对应销售发送模版消息
|
|
|
+// 用户提交研选调研需求,给汪洋、对口销售、内容组全员发模板消息
|
|
|
func SendCygxBannerYxSurveyTemplateMsg(user *models.WxUserItem, content string, articleId int) (err error) {
|
|
|
var msg string
|
|
|
msg = fmt.Sprint(user, articleId)
|
|
@@ -52,19 +53,39 @@ func SendCygxBannerYxSurveyTemplateMsg(user *models.WxUserItem, content string,
|
|
|
go utils.SendAlarmMsg("SendCygxBannerYxSurveyTemplateMsg Err"+msg, 2)
|
|
|
}
|
|
|
}()
|
|
|
+
|
|
|
+ var mobiles []string
|
|
|
//获取权益销售
|
|
|
- sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetAdminByRoleName, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
- if sellerItem == nil {
|
|
|
+ //内容组全员手机号
|
|
|
+ configCode := utils.TPL_MSG_NEI_RONG_ZU
|
|
|
+ cnf, e := models.GetConfigByCode(configCode)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- //销售对应的Openid
|
|
|
- openIdList, e := models.GetWxOpenIdByMobileList(sellerItem.Mobile)
|
|
|
+ //汪洋手机号
|
|
|
+ cnfWangYang, e := models.GetConfigByCode(utils.TPL_MSG_WANG_YANG)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mobiles = append(mobiles, sellerItem.Mobile)
|
|
|
+ mobiles = append(mobiles, cnfWangYang.ConfigValue)
|
|
|
+ listMobile := strings.Split(cnf.ConfigValue, ",")
|
|
|
+ for _, v := range listMobile {
|
|
|
+ mobiles = append(mobiles, v)
|
|
|
+ }
|
|
|
+
|
|
|
+ openIdList, e := models.GetWxOpenIdByMobileSliceList(mobiles)
|
|
|
if e != nil {
|
|
|
- err = errors.New("GetWxOpenIdByMobileList, Err: " + e.Error())
|
|
|
+ err = errors.New("GetWxOpenIdByMobileSliceList, Err: " + e.Error() + configCode)
|
|
|
return
|
|
|
}
|
|
|
if len(openIdList) == 0 {
|