sync_employee_callback.go
926 字节
package command
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type SyncEmployeeCallbackCommand struct {
// position:职位,department:部门,employee:员工,company:公司,profile员工档案
Module string `json:"module" valid:"Required"`
// add:添加,edit:编辑,delete删除,batchDelete:批量删除,setCompanyCharge:更改公司主管,batchForbid:批量禁用用户,batchRemove:批量更改用户部门,changeAdmin换管理员
Action string `json:"action" valid:"Required"`
// 具体的对象JSON数据
Data string `json:"data" valid:"Required"`
}
func (syncEmployeeCallbackCommand *SyncEmployeeCallbackCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(syncEmployeeCallbackCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}