소스 검색

Merge branch 'feature/v4.10.31' of https://jygit.jydev.jianyu360.cn/qmx/jy into feature/v4.10.31

wangshan 3 주 전
부모
커밋
fd2b546caf
3개의 변경된 파일58개의 추가작업 그리고 24개의 파일을 삭제
  1. 2 1
      src/jfw/modules/bigmember/src/config/config.go
  2. 4 0
      src/jfw/modules/bigmember/src/go.mod
  3. 52 23
      src/jfw/modules/bigmember/src/service/use/custom.go

+ 2 - 1
src/jfw/modules/bigmember/src/config/config.go

@@ -84,7 +84,7 @@ type config struct {
 	FreeUserCollLimit   int64    `json:"freeUserCollLimit"` //免费用户收藏数量最大限制
 	FollowCustomer      struct {
 		Member map[string]int //大会员 default 10个,商机版2.0 100个,专家版2.0 500个
-		Vip    struct {       //超级订阅 新老版都是10个
+		Vip    struct { //超级订阅 新老版都是10个
 			New int
 			Old int
 		}
@@ -101,6 +101,7 @@ type config struct {
 	RestrictionWaitPool   int
 	BidSearchOldUserLimit int64 // p480  原/publicapply/bidcoll/power 接口返回值的isOld添加到isAdd接口
 	OssUrl                string
+	CustomerServiceUrl    string // 获取客成信息 没有客成有销售返回销售 都没有返回空
 }
 
 type CustomerInfo struct {

+ 4 - 0
src/jfw/modules/bigmember/src/go.mod

@@ -10,6 +10,7 @@ require (
 	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.21
 	github.com/donnie4w/go-logger v0.0.0-20230316073421-36a48f87a69a
 	github.com/gogf/gf/v2 v2.7.0
+	github.com/levigross/grequests v0.0.0-20231203190023-9c307ef1f48d
 	github.com/olivere/elastic/v7 v7.0.32
 	go.mongodb.org/mongo-driver v1.14.0
 	jygit.jydev.jianyu360.cn/BaseService/ossClient v0.0.0-20250617080435-854a73d39d01
@@ -50,6 +51,7 @@ require (
 	github.com/gomodule/redigo v2.0.0+incompatible // indirect
 	github.com/google/gnostic-models v0.6.8 // indirect
 	github.com/google/go-cmp v0.6.0 // indirect
+	github.com/google/go-querystring v1.1.0 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
 	github.com/google/uuid v1.6.0 // indirect
 	github.com/gorilla/websocket v1.5.0 // indirect
@@ -151,3 +153,5 @@ require (
 	sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
 	sigs.k8s.io/yaml v1.3.0 // indirect
 )
+
+replace github.com/go-xorm/xorm v0.7.9 => gitea.com/xorm/xorm v0.7.9

+ 52 - 23
src/jfw/modules/bigmember/src/service/use/custom.go

@@ -4,38 +4,67 @@ import (
 	. "app.yhyue.com/moapp/jybase/api"
 	qu "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/redis"
-	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 	"fmt"
+	"github.com/levigross/grequests"
 	"jy/src/jfw/modules/bigmember/src/config"
 	"jy/src/jfw/modules/bigmember/src/db"
+	"log"
+)
+
+const (
+	KFPhone = "400-108-6670"
 )
 
 func (u *Use) GetCustom() {
-	r := func() Result {
-		cName := func() (customName string) {
-			userid := qu.ObjToString(u.GetSession("userId"))
-			positionId := qu.Int64All(u.GetSession("positionId"))
-			t := u.GetString("type") // kf 直接返回客服 不查询客成
-			if userid == "" || t == "kf" {
-				return
-			}
-			bigPower := jy.GetBigVipUserBaseMsg(u.Session(), *config.Middleground)
-			if bigPower.Status <= 0 && bigPower.EntnicheStatus <= 0 {
-				return ""
-			}
-			res := db.MysqlSubject.SelectBySql("SELECT i.name as customer_name FROM dwd_f_data_equity_info e INNER JOIN dwd_f_crm_clue_info  c on (e.uid=c.uid) INNER JOIN dwd_f_csm_customer_info i on( c.id = i.clue_id) WHERE e.position_id=? AND e.product_type in ('大会员','商机管理') AND c.is_transfer=1", positionId)
-			if res != nil || len(*res) != 0 {
-				for _, m := range *res {
-					if customName = qu.ObjToString(m["customer_name"]); customName != "" {
-						return
-					}
+	data := func() (customInfo map[string]interface{}) {
+		defaultCustomerServiceInfo := getWxm("") //  默认的客服
+		if customInfo, b := defaultCustomerServiceInfo.(map[string]interface{}); b {
+			customInfo["phone"] = KFPhone
+		}
+		userid := qu.ObjToString(u.GetSession("userId"))
+		positionId := qu.Int64All(u.GetSession("positionId"))
+		t := u.GetString("type") // kf 直接返回客服 不查询客成
+		if userid == "" || t == "kf" {
+			return
+		}
+		//  调用王浩的接口获取客服信息
+		//调用王浩的接口 获取客服信息  替换结果
+		data := map[string]interface{}{
+			"position_id": positionId,
+		}
+		geq := &grequests.RequestOptions{
+			JSON: data,
+		}
+		resp, err := grequests.Post(config.Config.CustomerServiceUrl, geq)
+		if err != nil {
+			log.Println("调用接口失败:", data, err)
+		}
+		if resp != nil {
+			csiData := map[string]interface{}{}
+			err = resp.JSON(&csiData)
+			if err != nil {
+				log.Println("序列化失败:", resp, err)
+			} else {
+				if qu.InterfaceToStr(csiData["phone"]) != "" && qu.InterfaceToStr(csiData["wxer"]) != "" {
+					customInfo = csiData
 				}
 			}
-			return
-		}()
-		return Result{Data: getWxm(cName)}
+		}
+		//bigPower := jy.GetBigVipUserBaseMsg(u.Session(), *config.Middleground)
+		//if bigPower.Status <= 0 && bigPower.EntnicheStatus <= 0 {
+		//	return ""
+		//}
+		//res := db.MysqlSubject.SelectBySql("SELECT i.name as customer_name FROM dwd_f_data_equity_info e INNER JOIN dwd_f_crm_clue_info  c on (e.uid=c.uid) INNER JOIN dwd_f_csm_customer_info i on( c.id = i.clue_id) WHERE e.position_id=? AND e.product_type in ('大会员','商机管理') AND c.is_transfer=1", positionId)
+		//if res != nil || len(*res) != 0 {
+		//	for _, m := range *res {
+		//		if customName = qu.ObjToString(m["customer_name"]); customName != "" {
+		//			return
+		//		}
+		//	}
+		//}
+		return
 	}()
-	u.ServeJson(r)
+	u.ServeJson(Result{Data: data})
 }
 
 func getWxm(name string) (customEwm interface{}) {