浏览代码

Merge branch 'need/cygx_999' of http://8.136.199.33:3000/cxzhang/hongze_web_mfyx into debug

xingzai 5 月之前
父节点
当前提交
23e72f7249
共有 4 个文件被更改,包括 53 次插入17 次删除
  1. 2 0
      models/seller.go
  2. 13 3
      services/wechat_send_category_template_msg.go
  3. 11 1
      services/wechat_send_msg.go
  4. 27 13
      utils/config.go

+ 2 - 0
models/seller.go

@@ -18,6 +18,7 @@ type AdminItem struct {
 	OpenId         string `description:"openId"`
 	CompanyName    string `description:"客户名称"`
 	UserId         int    `description:"联系人id"`
+	ShareSellerId  int    `description:"共享销售ID"`
 }
 
 func GetSellerByCompanyId(companyId int) (item *AdminItem, err error) {
@@ -95,6 +96,7 @@ func GetAdminListByGroupId(groupId int) (items []*Admin, err error) {
 func GetRaiSellerByCompanyId(companyId int) (item *AdminItem, err error) {
 	o := orm.NewOrmUsingDB("weekly_report")
 	sql := ` SELECT
+            a.share_seller_id,
      		b.admin_id,
 			b.real_name,
 			b.mobile 

+ 13 - 3
services/wechat_send_category_template_msg.go

@@ -776,7 +776,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 {
@@ -789,11 +789,21 @@ func SendPermissionApplyTemplateMsgAdminByYxCategory(req models.ApplyTryReq, com
 				err = errors.New("GetRaiSellerByCompanyId, Err: " + e.Error())
 				return
 			}
-			mobileOpneid = sealldetail.Mobile
+			//如果有共享销售给共享销售也推模版消息
+			if sealldetail.ShareSellerId > 0 {
+				adminShare, e := models.GetSellerByAdminId(sealldetail.ShareSellerId)
+				if e != nil {
+					err = errors.New("GetSellerByAdminId, Err: " + e.Error())
+					return
+				}
+				mobileOpenid = sealldetail.Mobile + "," + adminShare.Mobile
+			} else {
+				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 - 1
services/wechat_send_msg.go

@@ -129,7 +129,17 @@ func SendPermissionApplyTemplateMsg(realName, companyName, mobile, applyMethod,
 			err = errors.New("GetRaiSellerByCompanyId, Err: " + e.Error())
 			return
 		}
-		mobileOpenid = sealldetail.Mobile
+		//如果有共享销售给共享销售也推模版消息
+		if sealldetail.ShareSellerId > 0 {
+			adminShare, e := models.GetSellerByAdminId(sealldetail.ShareSellerId)
+			if e != nil {
+				err = errors.New("GetSellerByAdminId, Err: " + e.Error())
+				return
+			}
+			mobileOpenid = sealldetail.Mobile + "," + adminShare.Mobile
+		} else {
+			mobileOpenid = sealldetail.Mobile
+		}
 	}
 
 	openIdList, e := models.GetWxOpenIdByMobileList(mobileOpenid)

+ 27 - 13
utils/config.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"github.com/beego/beego/v2/server/web"
 	"github.com/rdlucklib/rdluck_tools/cache"
+	"strconv"
 )
 
 var (
@@ -75,6 +76,19 @@ var (
 	WxMsgCategoryTemplateIdAddMessage                string //专栏文章留言-类目模板ID
 )
 
+// 日志配置
+var (
+	LogPath     string //调用过程中的日志存放地址
+	LogFile     string
+	LogDataPath string //调用过程中图表相关的日志存放地址
+	LogDataFile string
+	BinLogPath  string //数据库相关的日志存放地址
+	BinLogFile  string
+	ApiLogPath  string //接口请求地址和接口返回值日志存放地址
+	ApiLogFile  string
+	LogMaxDays  int //日志最大保留天数
+)
+
 func init() {
 	tmpRunMode, err := web.AppConfig.String("run_mode")
 	if err != nil {
@@ -189,6 +203,19 @@ func init() {
 	}
 	HeadimgurlDefault = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202202/20220225/XFBBOUmDC5AXkfxnHiuqKpPtoofH.png"
 
+	//日志配置
+	{
+		LogPath = config["log_path"]
+		LogFile = config["log_file"]
+		LogDataPath = config["log_data_path"]
+		LogDataFile = config["log_data_file"]
+		BinLogPath = config["binlog_path"]
+		BinLogFile = config["binlog_file"]
+		ApiLogPath = config["apilog_path"]
+		ApiLogFile = config["apilog_file"]
+		logMaxDaysStr := config["log_max_day"]
+		LogMaxDays, _ = strconv.Atoi(logMaxDaysStr)
+	}
 	//易董开放api配置
 	YiDongApiConfig()
 }
@@ -213,16 +240,3 @@ func YiDongApiConfig() {
 //http://webapi.brilliantstart.cn/api/
 //http://webapi.brilliantstart.cn/swagger/
 //http://139.196.122.219:8603/swagger/
-
-// 日志配置
-var (
-	LogPath     string //调用过程中的日志存放地址
-	LogFile     string
-	LogDataPath string //调用过程中图表相关的日志存放地址
-	LogDataFile string
-	BinLogPath  string //数据库相关的日志存放地址
-	BinLogFile  string
-	ApiLogPath  string //接口请求地址和接口返回值日志存放地址
-	ApiLogFile  string
-	LogMaxDays  int //日志最大保留天数
-)