mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-16 23:09:01 +08:00
Feat/parameter check (#465)
Co-authored-by: ‘hanzhixiao’ <‘709674996@qq.com’>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package auth
|
||||
|
||||
import "github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
|
||||
|
||||
func (x *UserTokenReq) Check() error {
|
||||
if x.UserID == "" {
|
||||
return errs.ErrArgs.Wrap("userID is empty")
|
||||
}
|
||||
if x.PlatformID > 9 || x.PlatformID < 1 {
|
||||
return errs.ErrArgs.Wrap("platform is invalidate")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ForceLogoutReq) Check() error {
|
||||
if x.UserID == "" {
|
||||
return errs.ErrArgs.Wrap("userID is empty")
|
||||
}
|
||||
if x.PlatformID > 9 || x.PlatformID < 1 {
|
||||
return errs.ErrArgs.Wrap("platformID is invalidate")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ParseTokenReq) Check() error {
|
||||
if x.Token == "" {
|
||||
return errs.ErrArgs.Wrap("userID is empty")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user