From a92cca188dfca95ec97b9ea79686cfa919cb64d9 Mon Sep 17 00:00:00 2001 From: jjxu <428192774@qq.com> Date: Fri, 13 Jun 2025 10:44:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E7=94=A8=E6=88=B7=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/common/ws/wsMessageHandle.go | 15 +++++++++++---- pkg/e/code.go | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/common/ws/wsMessageHandle.go b/pkg/common/ws/wsMessageHandle.go index 0b9fb76..5f4fb95 100644 --- a/pkg/common/ws/wsMessageHandle.go +++ b/pkg/common/ws/wsMessageHandle.go @@ -9,6 +9,7 @@ package ws import ( "context" "encoding/json" + "fmt" "fonchain-fiee/api/account" "fonchain-fiee/api/accountFiee" "fonchain-fiee/pkg/config" @@ -47,7 +48,7 @@ func AuthorizationVerify(sourceData []byte) (userInfo *accountFiee.ChatUserData, accountInfo.OriginId = int64(fieeJwtInfo.ID) accountInfo.Account = fieeJwtInfo.Account accountInfo.NickName = fieeJwtInfo.NickName - case "fontree": + case e.ErpDomain: //erp token校验 msg.Content.Auth, err = secret.GetJwtFromStr(msg.Content.Auth) if err != nil { @@ -75,19 +76,25 @@ func AuthorizationVerify(sourceData []byte) (userInfo *accountFiee.ChatUserData, if err != nil || chatUserQuery.Total == 0 { //注册客服 var createUserRes *accountFiee.CreateChatUserResp - createUserRes, err = service.AccountFieeProvider.CreateChatUser(ctx, &accountFiee.ChatUserData{ + var createChatUserReq = &accountFiee.ChatUserData{ NickName: accountInfo.NickName, Account: accountInfo.Account, - Role: 2, + Role: 1, Origin: msg.Content.Domain, OriginId: int64(accountInfo.ID), - }) + } + if msg.Content.Domain == e.ErpDomain { + createChatUserReq.Role = 2 + } + fmt.Printf("注册聊天用户:%#v\n", createChatUserReq) + createUserRes, err = service.AccountFieeProvider.CreateChatUser(ctx, createChatUserReq) if err != nil { return } userInfo = createUserRes.GetData() } else { userInfo = chatUserQuery.List[0] + fmt.Printf("获取聊天用户:%#v\n", userInfo) } ok = true return diff --git a/pkg/e/code.go b/pkg/e/code.go index ef37fb0..21b3df9 100644 --- a/pkg/e/code.go +++ b/pkg/e/code.go @@ -13,6 +13,7 @@ const ( const ( DomainAdmin = "blockchain" + ErpDomain = "fontree" ) const (