Эх сурвалжийг харах

Merge branch 'feature/v4.9.31' into dev/v4.9.31_zsy

zhangsiya 1 жил өмнө
parent
commit
00988a2770

+ 11 - 7
src/jfw/modules/bigmember/src/service/use/custom.go

@@ -14,21 +14,22 @@ 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) || bigPower.EntName == "" {
 				return ""
 			}
-			info := db.MysqlSubject.FindOne("dwd_f_csm_customer_info", map[string]interface{}{
-				"is_transfer":  1,
-				"company_name": bigPower.EntName,
-			}, "name", "id desc")
-			if info != nil && len(*info) > 0 {
-				customName = qu.ObjToString((*info)["name"])
+			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 i.is_transfer=1", positionId)
+			if res != nil || len(*res) != 0 {
+				for _, m := range *res {
+					if customName = qu.ObjToString(m["customer_name"]); customName != "" {
+						return
+					}
+				}
 			}
 			return
 		}()
@@ -75,5 +76,8 @@ func getWxm(name string) (customEwm interface{}) {
 			redis.Put("other", cacheKey, rMap, -1)
 		}
 	}
+	if rMap[name] == nil {
+		return rMap[""]
+	}
 	return rMap[name]
 }