Compare commits

..

No commits in common. "f9921d2ba0d25a2f67b0d57b6079bb744f307e20" and "f3e0ae8672fc65d6e9ca01ea3014f62513384e5c" have entirely different histories.

3 changed files with 29 additions and 41 deletions

View File

@ -191,14 +191,12 @@ func (o *ChatRoom) Register(c *Client) (sessionId string) {
// msgType 消息类型
// message: 消息内容
func (o *ChatRoom) SendSessionMessage(chatUser *accountFiee.ChatUserData, sessionId string, msgType WsType, message any) (userIdInSession []int64, err error) {
fmt.Println("ChatRoom.SendSessionMessage ------------------1")
o.clientsRwLocker.Lock()
defer o.clientsRwLocker.Unlock()
var msg = WsSessionInfo{
Type: msgType,
Content: message,
}
fmt.Println("ChatRoom.SendSessionMessage ------------------2")
msgBytes, _ := json.Marshal(msg)
if o.Session[sessionId] == nil {
err = fmt.Errorf("该会话不存在或已失效")

View File

@ -21,75 +21,65 @@ import (
)
func AuthorizationVerify(sourceData []byte) (userInfo *accountFiee.ChatUserData, ok bool, err error) {
fmt.Println("AuthorizationVerify ----------------1")
var msg AuthorizationInfo
err = json.Unmarshal(sourceData, &msg)
if err != nil {
return
}
fmt.Println("AuthorizationVerify ----------------2")
if msg.Type != AuthorizationType {
return
}
fmt.Println("AuthorizationVerify ----------------3")
if msg.Content.Auth == "" {
return
}
fmt.Println("AuthorizationVerify ----------------4")
var check = true
var ctx = context.Background()
var accountInfo accountFiee.ChatUserData
//fiee token校验
var fieeJwtInfo *jwt.Claims
fieeJwtInfo, err = jwt.ParseToken(msg.Content.Auth, m.JWTSecret)
if err != nil {
check = false
fmt.Printf("fiee token parse err:%v\n", err)
} else {
fmt.Printf("fieeJwtInfo :%#v\n", fieeJwtInfo)
accountInfo.Origin = config.AppConfig.System.Domain
//accountInfo.OriginId = int64(fieeJwtInfo.ID)
switch msg.Content.Domain {
case config.AppConfig.System.Domain:
//fiee token校验
var fieeJwtInfo *jwt.Claims
fieeJwtInfo, err = jwt.ParseToken(msg.Content.Auth, m.JWTSecret)
if err != nil {
fmt.Printf("fiee token parse err:%v\n", err)
return
}
accountInfo.Origin = msg.Content.Domain
accountInfo.OriginId = int64(fieeJwtInfo.ID)
accountInfo.Account = fieeJwtInfo.Account
accountInfo.NickName = fieeJwtInfo.NickName
infoReq := &accountFiee.UserByTelRequest{
Tel: fieeJwtInfo.Phone,
Domain: config.AppConfig.System.Domain,
Domain: fieeJwtInfo.Domain,
}
var accInfo *accountFiee.UserInfoResponse
accInfo, err = service.AccountFieeProvider.UserByTel(ctx, infoReq)
if err != nil {
check = false
fmt.Printf("err:%#v\n", err)
} else if accInfo != nil {
fmt.Printf("fiee accInfo :%#v\n", accInfo)
accountInfo.OriginId = int64(accInfo.Id)
return
}
if accInfo != nil {
accountInfo.Account = accInfo.TelNum
accountInfo.Avatar = accInfo.GroupPhoto
if accInfo.Name != "" {
accountInfo.NickName = accInfo.Name
}
}
}
if !check {
case e.ErpDomain:
//erp token校验
msg.Content.Auth, err = secret.GetJwtFromStr(msg.Content.Auth)
if err != nil {
check = false
} else {
var fontreeJwtInfo *account.DecryptJwtResponse
fontreeJwtInfo, err = service.AccountProvider.DecryptJwt(ctx, &account.DecryptJwtRequest{Token: msg.Content.Auth, Domain: e.ErpDomain})
if err != nil || fontreeJwtInfo.IsOffline {
check = false
} else {
fmt.Printf("fontreeJwtInfo is %#v\n", fontreeJwtInfo)
accountInfo.Origin = e.ErpDomain
accountInfo.OriginId = int64(fontreeJwtInfo.ID)
accountInfo.Account = fontreeJwtInfo.Account
accountInfo.NickName = fontreeJwtInfo.NickName
}
return
}
}
if !check {
return
var fontreeJwtInfo *account.DecryptJwtResponse
fontreeJwtInfo, err = service.AccountProvider.DecryptJwt(ctx, &account.DecryptJwtRequest{Token: msg.Content.Auth, Domain: msg.Content.Domain})
if err != nil || fontreeJwtInfo.IsOffline {
return
}
fmt.Printf("fontreeJwtInfo is %#v\n", fontreeJwtInfo)
accountInfo.Origin = msg.Content.Domain
accountInfo.OriginId = int64(fontreeJwtInfo.ID)
accountInfo.Account = fontreeJwtInfo.Account
accountInfo.NickName = fontreeJwtInfo.NickName
}
//查询是否已经注册

View File

@ -337,7 +337,7 @@ func UploadWithBuffer(fileBuffer *bytes.Buffer, cloudStoreSubPath string) (url s
return
}
cloudStoreSubPath = getEnvDir(cloudStoreSubPath)
url, err = Client.PutObjectFromBytes(config.ConfigData.Oss.BucketName, cloudStoreSubPath, fileBuffer.Bytes())
_, err = Client.PutObjectFromBytes(config.ConfigData.Oss.BucketName, cloudStoreSubPath, fileBuffer.Bytes())
return
}
func getEnvDir(cloudStoreSubPath string) (ep string) {