移除多余的nil判断

nil 值的 slice 长度本身就为 0
This commit is contained in:
huiyifyj 2024-12-21 11:39:17 +08:00
parent aed259ac1f
commit eeb8f08e19
No known key found for this signature in database
GPG Key ID: 67D4F264AF9D2C4C
1 changed files with 3 additions and 2 deletions

View File

@ -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