fix:修复bug

This commit is contained in:
henry
2021-11-25 13:53:18 +08:00
parent c6b37755b9
commit a90a7880de
4 changed files with 47 additions and 21 deletions

View File

@ -5,6 +5,7 @@ import (
"ArmedPolice/config"
"ArmedPolice/serve/orm"
"ArmedPolice/utils"
"fmt"
)
type synchronized struct {
@ -78,7 +79,14 @@ func initModel() {
_ = db.Migrator().CreateTable(v.iModel)
if v.iValues != nil && v.iValues() != nil {
db.Table(v.iModel.TableName()).Create(v.iValues())
err := db.Table(v.iModel.TableName()).Create(v.iValues()).Error
if err != nil {
fmt.Println("=======================================")
fmt.Println(err)
fmt.Println("=======================================")
}
}
} else if v.Catch != nil && v.Catch() != nil {
v.Catch()

View File

@ -53,7 +53,21 @@ func (m *WorkSchedule) CountersignStatus() bool {
}
func (m *WorkSchedule) GetTargetValueAttribute() []string {
return strings.Split(m.TargetValue, ",")
if m.Target == WorkScheduleTargetForPerson {
return strings.Split(m.TargetValue, ",")
} else if m.Target == WorkScheduleTargetForRole {
// 查询角色绑定的用户信息
mSysUserRole := NewSysUserRole()
roleIDs := strings.Split(m.TargetValue, ",")
uids := make([]string, 0)
_ = Pluck(mSysUserRole, "uid", &uids, NewWhereIn("role_id", roleIDs))
return uids
}
return []string{}
}
func (m *WorkSchedule) SetTargetValueAttribute(value []string) {