|
@@ -2,6 +2,7 @@ package Wx
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
+ "fmt"
|
|
|
"math/rand"
|
|
|
"strconv"
|
|
|
"time"
|
|
@@ -35,7 +36,7 @@ func NewGetWxListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWxLi
|
|
|
|
|
|
func (l *GetWxListLogic) GetWxList(req *types.WxListReq) (*types.WxListResp, error) {
|
|
|
organizationId := l.ctx.Value("organizationId").(uint64)
|
|
|
-
|
|
|
+ isAdmin := l.ctx.Value("isAdmin").(bool)
|
|
|
servers, err := l.svcCtx.DB.Server.Query().All(l.ctx)
|
|
|
serverSet := make(map[uint64]*ent.Server, len(servers))
|
|
|
for _, s := range servers {
|
|
@@ -43,7 +44,9 @@ func (l *GetWxListLogic) GetWxList(req *types.WxListReq) (*types.WxListResp, err
|
|
|
}
|
|
|
|
|
|
var predicates []predicate.Wx
|
|
|
- predicates = append(predicates, wx.OrganizationIDEQ(organizationId))
|
|
|
+ if !isAdmin {
|
|
|
+ predicates = append(predicates, wx.OrganizationIDEQ(organizationId))
|
|
|
+ }
|
|
|
if req.Port != nil {
|
|
|
predicates = append(predicates, wx.PortContains(*req.Port))
|
|
|
}
|
|
@@ -67,7 +70,6 @@ func (l *GetWxListLogic) GetWxList(req *types.WxListReq) (*types.WxListResp, err
|
|
|
// 创建 hookClient 客户端
|
|
|
serverInfo := serverSet[v.ServerID]
|
|
|
hookClient := hook.NewHook(serverInfo.PrivateIP, serverInfo.AdminPort, v.Port)
|
|
|
-
|
|
|
// 获取登录状态
|
|
|
loginInfo, err := hookClient.IsLoginStatus()
|
|
|
var loginStatus uint8 = 0
|
|
@@ -133,7 +135,19 @@ func (l *GetWxListLogic) GetWxList(req *types.WxListReq) (*types.WxListResp, err
|
|
|
Examples: &v.Edges.Agent.Examples,
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ fmt.Printf("---------------------v.ID-------------------: %v\n", v.ID)
|
|
|
+ fmt.Printf("---------------------v.ServerID-------------------: %v\n", v.ServerID)
|
|
|
+ fmt.Printf("---------------------v.Port-------------------: %v\n", v.Port)
|
|
|
+ fmt.Printf("---------------------processID-------------------: %v\n", processID)
|
|
|
+ fmt.Printf("---------------------v.Callback-------------------: %v\n", v.Callback)
|
|
|
+ fmt.Printf("---------------------wxid-------------------: %v\n", wxid)
|
|
|
+ fmt.Printf("---------------------account-------------------: %v\n", account)
|
|
|
+ fmt.Printf("---------------------nickname-------------------: %v\n", nickname)
|
|
|
+ fmt.Printf("---------------------tel-------------------: %v\n", tel)
|
|
|
+ fmt.Printf("---------------------headBig-------------------: %v\n", headBig)
|
|
|
+ fmt.Printf("---------------------v.OrganizationID-------------------: %v\n", v.OrganizationID)
|
|
|
+ fmt.Printf("---------------------v.AgentID-------------------: %v\n", v.AgentID)
|
|
|
+ fmt.Printf("---------------------agent-------------------: %v\n", agent)
|
|
|
resp.Data.Data = append(resp.Data.Data,
|
|
|
types.WxInfo{
|
|
|
BaseIDInfo: types.BaseIDInfo{
|
|
@@ -155,6 +169,9 @@ func (l *GetWxListLogic) GetWxList(req *types.WxListReq) (*types.WxListResp, err
|
|
|
AgentId: &v.AgentID,
|
|
|
AgentInfo: &agent,
|
|
|
})
|
|
|
+ fmt.Printf("---------------------v.Port-------------------: %v\n", v.Port)
|
|
|
+ fmt.Printf("---------------------loginInfo.Onlinestatus-------------------: %v\n", loginInfo.Onlinestatus)
|
|
|
+ fmt.Printf("---------------------loginStatus-------------------: %v\n", loginStatus)
|
|
|
}
|
|
|
|
|
|
return resp, nil
|