代码优化及错误返回改进 (#1969)
* Makefile: 使用 '?=' 替代 if-else 的判断 * 移除多余的类型转换 * 移除多余的nil判断 * map 使用简化以及错误处理优化
This commit is contained in:
@@ -3,12 +3,13 @@ package system
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
|
||||
systemRes "github.com/flipped-aurora/gin-vue-admin/server/model/system/response"
|
||||
"gorm.io/gorm"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
@@ -135,7 +136,7 @@ func (apiService *ApiService) IgnoreApi(ignoreApi system.SysIgnoreApi) (err erro
|
||||
func (apiService *ApiService) EnterSyncApi(syncApis systemRes.SysSyncApis) (err error) {
|
||||
return global.GVA_DB.Transaction(func(tx *gorm.DB) error {
|
||||
var txErr error
|
||||
if syncApis.NewApis != nil && len(syncApis.NewApis) > 0 {
|
||||
if len(syncApis.NewApis) > 0 {
|
||||
txErr = tx.Create(&syncApis.NewApis).Error
|
||||
if txErr != nil {
|
||||
return txErr
|
||||
|
Reference in New Issue
Block a user