fix bug ContentType is wrong range for Check

pull/536/head
skiffer-git 2 years ago committed by BanTanger
parent bbac1d9d6b
commit 71cc165465

@ -18,6 +18,7 @@ const (
///ContentType ///ContentType
//UserRelated //UserRelated
ContentTypeBegin = 100
Text = 101 Text = 101
Picture = 102 Picture = 102
Voice = 103 Voice = 103

@ -26,10 +26,10 @@ func (x *MsgData) Check() error {
if x.Content == nil { if x.Content == nil {
return errs.ErrArgs.Wrap("content is empty") return errs.ErrArgs.Wrap("content is empty")
} }
if x.ContentType < 101 || x.ContentType > 203 { if x.ContentType <= constant.ContentTypeBegin || x.ContentType >= constant.NotificationEnd {
return errs.ErrArgs.Wrap("content is empty") return errs.ErrArgs.Wrap("content type is invalid")
} }
if x.SessionType < 1 || x.SessionType > 4 { if x.SessionType < constant.SingleChatType || x.SessionType > constant.NotificationChatType {
return errs.ErrArgs.Wrap("sessionType is invalid") return errs.ErrArgs.Wrap("sessionType is invalid")
} }
if x.SessionType == constant.SingleChatType || x.SessionType == constant.NotificationChatType { if x.SessionType == constant.SingleChatType || x.SessionType == constant.NotificationChatType {

Loading…
Cancel
Save