Răsfoiți Sursa

feat:xiugai

wangchuanjin 9 luni în urmă
părinte
comite
6dc9518b2b
1 a modificat fișierele cu 11 adăugiri și 10 ștergeri
  1. 11 10
      api/internal/service/network.go

+ 11 - 10
api/internal/service/network.go

@@ -23,7 +23,7 @@ import (
 )
 
 const (
-	NetworkManageAllProjectKey = "networkManage_allProject_%d_%s"
+	NetworkManageAllProjectKey = "networkManage_allProject_%d"
 	NetworkManageList          = "networkManage_networkList_%d_%s"
 )
 
@@ -329,12 +329,6 @@ func (n *network) Associate(in *types.AssociateReq) (reply *types.Reply) {
 // 人脉库-全部人脉项目
 func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 	reply = &types.Reply{}
-	key := fmt.Sprintf(NetworkManageAllProjectKey, in.PositionId, GetMd5String(fmt.Sprintf("%+v", in)))
-	rbt, rerr := redis.GetNewBytes("newother", key)
-	if rerr == nil && rbt != nil {
-		json.Unmarshal(*rbt, &reply)
-		return
-	}
 	businessType := strings.Split(FindBusiness(in.EntId, in.MgoUserId), ",")
 	var count int64
 	var list []*networkTree
@@ -374,7 +368,15 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 			sqlAppend1 += ` and a.company_name like ?`
 			args = append(args, "%"+in.Name+"%")
 		}
-		aio := n.AllIntroduceOwner(sqlAppend1, "", args, true, businessType)
+		aio := &introduceOwnerProject{}
+		key := fmt.Sprintf(NetworkManageAllProjectKey, in.PositionId)
+		if rbt, rerr := redis.GetNewBytes("newother", key); rerr == nil && rbt != nil {
+			json.Unmarshal(*rbt, &aio)
+			return
+		} else {
+			aio = n.AllIntroduceOwner(sqlAppend1, "", args, true, businessType)
+			redis.Put("newother", key, aio, C.CacheTimeOut)
+		}
 		firstparty = aio.Firstparty
 		firstpartyChild = aio.FirstpartyNetwork
 		list = []*networkTree{
@@ -675,7 +677,6 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 			"checked": newCheckCode,
 		},
 	}
-	redis.Put("newother", key, reply, C.CacheTimeOut)
 	return reply
 }
 
@@ -1506,7 +1507,7 @@ func (n *network) AllIntroduceOwner(sqlAppend1, sqlAppend2 string, args []interf
 }
 
 func (n *network) DeleteCache(positionId int64) {
-	redis.Del("newother", fmt.Sprintf(NetworkManageAllProjectKey, positionId, "*"))
+	redis.Del("newother", fmt.Sprintf(NetworkManageAllProjectKey, positionId))
 	redis.DelByCodePattern("newother", fmt.Sprintf(NetworkManageList, positionId, "*"))
 	redis.DelByCodePattern("newother", fmt.Sprintf(NetworkManageCoopHistory, positionId, "*"))
 	redis.DelByCodePattern("newother", fmt.Sprintf(NetworkManageOwnerlList, positionId, "*"))