fix:修复bug
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
|||||||
"ArmedPolice/config"
|
"ArmedPolice/config"
|
||||||
"ArmedPolice/serve/orm"
|
"ArmedPolice/serve/orm"
|
||||||
"ArmedPolice/utils"
|
"ArmedPolice/utils"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type synchronized struct {
|
type synchronized struct {
|
||||||
@ -78,7 +79,14 @@ func initModel() {
|
|||||||
_ = db.Migrator().CreateTable(v.iModel)
|
_ = db.Migrator().CreateTable(v.iModel)
|
||||||
|
|
||||||
if v.iValues != nil && v.iValues() != nil {
|
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 {
|
} else if v.Catch != nil && v.Catch() != nil {
|
||||||
v.Catch()
|
v.Catch()
|
||||||
|
@ -53,7 +53,21 @@ func (m *WorkSchedule) CountersignStatus() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *WorkSchedule) GetTargetValueAttribute() []string {
|
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) {
|
func (m *WorkSchedule) SetTargetValueAttribute(value []string) {
|
||||||
|
@ -510,6 +510,10 @@ func (c *Instance) Examine(id uint64, status int, remark string, isAssist int, p
|
|||||||
|
|
||||||
if mWorkProgress.Remark == "" {
|
if mWorkProgress.Remark == "" {
|
||||||
mWorkProgress.Remark = "审批通过"
|
mWorkProgress.Remark = "审批通过"
|
||||||
|
|
||||||
|
if _status == model2.WorkProgressStatusForRefuse {
|
||||||
|
mWorkProgress.Remark = "审批拒绝"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err = model2.Create(mWorkProgress.WorkProgress, tx); err != nil {
|
if err = model2.Create(mWorkProgress.WorkProgress, tx); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -31,25 +31,25 @@ func (m *WorkSchedule) ValidateAuth(uid uint64) (bool, error) {
|
|||||||
auths[v] = true
|
auths[v] = true
|
||||||
}
|
}
|
||||||
// 触发审核对象
|
// 触发审核对象
|
||||||
switch m.Target {
|
//switch m.Target {
|
||||||
case model.WorkScheduleTargetForPerson: // 个人
|
//case model.WorkScheduleTargetForPerson: // 个人
|
||||||
_, has := auths[fmt.Sprintf("%d", uid)]
|
_, has := auths[fmt.Sprintf("%d", uid)]
|
||||||
return has, nil
|
return has, nil
|
||||||
case model.WorkScheduleTargetForRole: // 角色
|
//case model.WorkScheduleTargetForRole: // 角色
|
||||||
// 查询角色信息
|
// // 查询角色信息
|
||||||
roleIDs := make([]uint64, 0)
|
// roleIDs := make([]uint64, 0)
|
||||||
mSysUserRole := model.NewSysUserRole()
|
// mSysUserRole := model.NewSysUserRole()
|
||||||
|
//
|
||||||
if err := model.Pluck(mSysUserRole, "role_id", &roleIDs, model.NewWhere("uid", uid)); err != nil {
|
// if err := model.Pluck(mSysUserRole, "role_id", &roleIDs, model.NewWhere("uid", uid)); err != nil {
|
||||||
return false, err
|
// return false, err
|
||||||
}
|
// }
|
||||||
for _, v := range roleIDs {
|
// for _, v := range roleIDs {
|
||||||
if _, has := auths[fmt.Sprintf("%d", v)]; has {
|
// if _, has := auths[fmt.Sprintf("%d", v)]; has {
|
||||||
return has, nil
|
// return has, nil
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
break
|
// break
|
||||||
}
|
//}
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user