system_notice.go
944 字节
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
)
//发送系统消息
type SystemNoticeCommand struct {
// 接收方用户id
UserId int64 `json:"userId"`
UserBaseId int64 `json:"userBaseId" valid:"Required"`
CompanyId int64 `json:"companyId"`
OrgId int64 `json:"orgId"`
Content string `json:"content"` //消息内容
Extend map[string]interface{} `json:"extend"` //内容扩展字段
}
func (systemNoticeCommand *SystemNoticeCommand) Valid(validation *validation.Validation) {
}
func (systemNoticeCommand *SystemNoticeCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(systemNoticeCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}