|
@@ -4,16 +4,14 @@ import (
|
|
|
"context"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
- "log"
|
|
|
"sort"
|
|
|
"strings"
|
|
|
"time"
|
|
|
|
|
|
- "app.yhyue.com/moapp/jybase/redis"
|
|
|
-
|
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
|
elastic "app.yhyue.com/moapp/jybase/es"
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
|
. "bp.jydev.jianyu360.cn/CRM/networkManage/api/common"
|
|
|
"bp.jydev.jianyu360.cn/CRM/networkManage/entity"
|
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
@@ -22,8 +20,11 @@ import (
|
|
|
)
|
|
|
|
|
|
const (
|
|
|
- EntINDEX = "ent_info"
|
|
|
- EntTYPE = "ent_info"
|
|
|
+ EntINDEX = "ent_info"
|
|
|
+ EntTYPE = "ent_info"
|
|
|
+ NetworkManageOwnerlList = "networkManage_ownerlList_%d_%s"
|
|
|
+ NetworkManageOwnerlCount = "networkManage_ownerlCount_%d_%s"
|
|
|
+ NetworkManageCompanyList = "networkManage_companyList_%d_%s"
|
|
|
)
|
|
|
|
|
|
type OwnerService struct {
|
|
@@ -102,22 +103,20 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
|
|
|
"connectionsNumber": connectionsNumber,
|
|
|
}
|
|
|
}
|
|
|
- key := fmt.Sprintf("%+v", t)
|
|
|
- key = fmt.Sprintf("%s%s", key, fmt.Sprintf(" business:%s", businessStr))
|
|
|
- listKey := "ownerlList-" + common.GetMd5String(fmt.Sprintf("%+v", key))
|
|
|
- countKey := "ownerlCount-" + common.GetMd5String(fmt.Sprintf("%+v", key))
|
|
|
+ comKey := common.GetMd5String(fmt.Sprintf("%+v business:%s", t, businessStr))
|
|
|
+ listKey := fmt.Sprintf(NetworkManageOwnerlList, t.PositionId, comKey)
|
|
|
+ countKey := fmt.Sprintf(NetworkManageOwnerlCount, t.PositionId, comKey)
|
|
|
// 检查 Redis 中是否存在列表缓存
|
|
|
if ok, err := redis.Exists("newother", listKey); ok && err == nil && t.SourceType != "2" {
|
|
|
returnData = handleRedisCache(listKey)
|
|
|
connectionsNumber = gconv.Int64(redis.GetInt("newother", countKey))
|
|
|
// 处理监控状态
|
|
|
} else {
|
|
|
- log.Println("111", fmt.Sprintf("%+v", key))
|
|
|
- key = "companyList-" + common.GetMd5String(fmt.Sprintf("%+v", key))
|
|
|
+ clKey := fmt.Sprintf(NetworkManageCompanyList, t.PositionId, comKey)
|
|
|
// 检查 Redis 中是否存在公司缓存
|
|
|
- if ok, err := redis.Exists("newother", key); ok && err == nil && t.SourceType != "2" {
|
|
|
+ if ok, err := redis.Exists("newother", clKey); ok && err == nil && t.SourceType != "2" {
|
|
|
// 处理可介绍业主人脉
|
|
|
- returnData = handleRedisCache(key)
|
|
|
+ returnData = handleRedisCache(clKey)
|
|
|
sortAndPaginateReturnData(&returnData, startIndex, endIndex)
|
|
|
} else {
|
|
|
// 没有缓存时的处理逻辑
|
|
@@ -151,7 +150,7 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
|
|
|
a2 := time.Now().Unix()
|
|
|
fmt.Println("组合数据", a2-a1)
|
|
|
if len(returnData) > 0 {
|
|
|
- redis.Put("newother", key, returnData, C.CacheTimeOut)
|
|
|
+ redis.Put("newother", comKey, returnData, C.CacheTimeOut)
|
|
|
sort.Slice(returnData, func(i, j int) bool {
|
|
|
aa := fmt.Sprintf("%d%s", (returnData)[i].Zbtime, (returnData)[i].BuyerId)
|
|
|
bb := fmt.Sprintf("%d%s", (returnData)[j].Zbtime, (returnData)[j].BuyerId)
|