update_system_setting.go
789 字节
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
)
type UpdateSystemSettingCommand struct {
// 设置对应的编码
SettingCode string `json:"settingCode" valid:"Required"`
// 公司id
CompanyId int64 `json:"companyId" valid:"Required"`
//设定的值
Value string `json:"value" valid:"Required"`
}
func (updateSystemSettingCommand *UpdateSystemSettingCommand) Valid(validation *validation.Validation) {
}
func (updateSystemSettingCommand *UpdateSystemSettingCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(updateSystemSettingCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}