Alan a9e2b55f6a
Feat/parameter check (#465)
Co-authored-by: ‘hanzhixiao’ <‘709674996@qq.com’>
2023-07-03 22:51:56 +08:00

31 lines
642 B
Go

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
}