refactor🎨 api业务功能调整

This commit is contained in:
zhangwenjian committed 2021-05-23 17:52:43 +08:00
1 parent 6cbded6241
commit 2ac8f925c9
4 files changed
+39 -68

No files matched your search

+8 -6
View File
@@ -75,11 +75,13 @@ func (e *SysApi) CheckStorageSysApi(c *[]runtime.Router) error {
}
// UpdateSysApi 修改SysApi对象
func (e *SysApi) UpdateSysApi(c *models.SysApi, p *actions.DataPermission) error {
db := e.Orm.Model(c).
Scopes(
actions.Permission(c.TableName(), p),
).Where(c.GetId()).Updates(c)
func (e *SysApi) UpdateSysApi(c *dto.SysApiControl, p *actions.DataPermission) error {
var model = models.SysApi{}
e.Orm.Scopes(
actions.Permission(model.TableName(), p),
).First(&model, c.GetId())
c.Generate(&model)
db := e.Orm.Save(&model)
if err := db.Error; err != nil {
e.Log.Errorf("Service UpdateSysApi error:%s", err)
return err
@@ -106,4 +108,4 @@ func (e *SysApi) RemoveSysApi(d *dto.SysApiById, p *actions.DataPermission) erro
return errors.New("无权删除该数据")
}
return nil
}
}