fix: 修复租户ID和创建者覆盖逻辑
This commit is contained in:
@@ -179,17 +179,21 @@ func insertHook(ctx context.Context, in *gdb.HookInsertInput) (result sql.Result
|
|||||||
in.Data[i]["id"] = node.Generate().Int64()
|
in.Data[i]["id"] = node.Generate().Int64()
|
||||||
}
|
}
|
||||||
if _, ok := in.Data[i]["tenant_id"]; ok {
|
if _, ok := in.Data[i]["tenant_id"]; ok {
|
||||||
if !g.IsEmpty(userInfo.TenantId) {
|
if g.IsEmpty(in.Data[i]["tenant_id"]) {
|
||||||
in.Data[i]["tenant_id"] = userInfo.TenantId
|
if !g.IsEmpty(userInfo.TenantId) {
|
||||||
} else {
|
in.Data[i]["tenant_id"] = userInfo.TenantId
|
||||||
return nil, fmt.Errorf("tenantId cannot be empty")
|
} else {
|
||||||
|
return nil, fmt.Errorf("tenantId cannot be empty")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, ok := in.Data[i]["creator"]; ok {
|
if _, ok := in.Data[i]["creator"]; ok {
|
||||||
if !g.IsEmpty(userInfo.UserName) {
|
if g.IsEmpty(in.Data[i]["tenant_id"]) {
|
||||||
in.Data[i]["creator"] = userInfo.UserName
|
if !g.IsEmpty(userInfo.UserName) {
|
||||||
} else {
|
in.Data[i]["creator"] = userInfo.UserName
|
||||||
return nil, fmt.Errorf("user info cannot be empty")
|
} else {
|
||||||
|
return nil, fmt.Errorf("user info cannot be empty")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, ok := in.Data[i]["updater"]; ok {
|
if _, ok := in.Data[i]["updater"]; ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user