Browse Source

no message

xingzai 2 months ago
parent
commit
31e3ba2f84

+ 19 - 0
models/cygx_seller_mobile_map.go

@@ -0,0 +1,19 @@
+package models
+
+import "github.com/beego/beego/v2/client/orm"
+
+//权益销售手机号映射关系表
+
+type CygxSellerMobileMap struct {
+	RealName       string `description:"销售姓名"`
+	Mobile         string `description:"销售手机号"`
+	ServerRealName string `description:"服务销售姓名"`
+	ServerMobile   string `description:"服务销售手机号"`
+}
+
+func GetCygxSellerMobileMap() (items []*CygxSellerMobileMap, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM cygx_seller_mobile_map  LIMIT  100 `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 15 - 4
services/wechat_send_category_template_msg.go

@@ -509,7 +509,7 @@ func SendPermissionApplyTemplateMsgAdminByYxCategory(req models.ApplyTryReq, com
 	}()
 
 	//潜在客户、未开权益,已开FICC的客户推给王芳,开通权益的客户推给对应销售
-	mobileOpneid := utils.WxMsgTemplateIdAskMsgMobilePublic
+	mobileOpenid := utils.WxMsgTemplateIdAskMsgMobilePublic
 	if companyId > 1 {
 		raiCount, e := models.GetCompanyProductCount(companyId, utils.COMPANY_PRODUCT_RAI_ID)
 		if e != nil {
@@ -529,14 +529,25 @@ func SendPermissionApplyTemplateMsgAdminByYxCategory(req models.ApplyTryReq, com
 					err = errors.New("GetSellerByAdminId, Err: " + e.Error())
 					return
 				}
-				mobileOpneid = sealldetail.Mobile + "," + adminShare.Mobile
+				listSellerMobile, e := models.GetCygxSellerMobileMap()
+				if e != nil {
+					err = errors.New("GetCygxSellerMobileMap, Err: " + e.Error())
+					return
+				}
+				//mapMobile := make(map[string]string)
+				for _, vm := range listSellerMobile {
+					if adminShare.Mobile == vm.ServerMobile {
+						adminShare.Mobile = vm.Mobile
+					}
+				}
+				mobileOpenid = sealldetail.Mobile + "," + adminShare.Mobile
 			} else {
-				mobileOpneid = sealldetail.Mobile
+				mobileOpenid = sealldetail.Mobile
 			}
 		}
 	}
 
-	openIdList, e := models.GetMfyxWxOpenIdByMobileList(mobileOpneid)
+	openIdList, e := models.GetMfyxWxOpenIdByMobileList(mobileOpenid)
 	if e != nil {
 		err = errors.New("GetMfyxWxOpenIdByMobileList, Err: " + e.Error())
 		return err

+ 11 - 0
services/wechat_send_msg.go

@@ -108,6 +108,17 @@ func SendPermissionApplyTemplateMsg(realName, companyName, mobile, applyMethod,
 				err = errors.New("GetSellerByAdminId, Err: " + e.Error())
 				return
 			}
+			listSellerMobile, e := models.GetCygxSellerMobileMap()
+			if e != nil {
+				err = errors.New("GetCygxSellerMobileMap, Err: " + e.Error())
+				return
+			}
+			//mapMobile := make(map[string]string)
+			for _, vm := range listSellerMobile {
+				if adminShare.Mobile == vm.ServerMobile {
+					adminShare.Mobile = vm.Mobile
+				}
+			}
 			mobileOpenid = sealldetail.Mobile + "," + adminShare.Mobile
 		} else {
 			mobileOpenid = sealldetail.Mobile