fix
This commit is contained in:
parent
33f8742ad1
commit
4c4e1c1cc6
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"sync"
|
||||
|
||||
"fusenapi/server/websocket/internal/svc"
|
||||
"fusenapi/server/websocket/internal/types"
|
||||
|
@ -28,11 +29,14 @@ func NewGetStatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStatLo
|
|||
// 处理进入前逻辑w,r
|
||||
// func (l *GetStatLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||
// }
|
||||
var GetStatMutex sync.Mutex
|
||||
|
||||
func (l *GetStatLogic) GetStat(req *types.GetStatReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||
if req.Password != "fusen1314" {
|
||||
return resp.SetStatusWithMessage(basic.CodeOK, "你干嘛,哎哟")
|
||||
}
|
||||
GetStatMutex.Lock()
|
||||
defer GetStatMutex.Unlock()
|
||||
userStat := make(map[string]int)
|
||||
mapUserWsStat.Range(func(key, value any) bool {
|
||||
userStat[key.(string)] = value.(int)
|
||||
|
|
Loading…
Reference in New Issue
Block a user