修复可能产生数据库锁死的事务错误

修复菜单参数无法修改的错误
This commit is contained in:
pixel
2020-11-11 10:59:46 +08:00
parent 68677e1b5b
commit bf6f469dad
4 changed files with 17 additions and 17 deletions

View File

@@ -46,7 +46,7 @@ func AutoCreateApi(api model.SysApi) (err error) {
fxErr := tx.Where("path = ? AND method = ?", api.Path, api.Method).First(&fApi).Error
if errors.Is(fxErr, gorm.ErrRecordNotFound) {
txErr = tx.Create(&api).Error
if txErr != nil{
if txErr != nil {
return txErr
}
}