更新自动化代码api层代码混入service层代码
This commit is contained in:
@@ -33,28 +33,6 @@ func DeleteApi(api model.SysApi) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: CreateApi
|
||||
//@description: 自动创建api数据,
|
||||
//@param: api model.SysApi
|
||||
//@return: err error
|
||||
|
||||
func AutoCreateApi(api model.SysApi) (err error) {
|
||||
err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
|
||||
var fApi model.SysApi
|
||||
var txErr 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 {
|
||||
return txErr
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: GetAPIInfoList
|
||||
//@description: 分页获取数据,
|
||||
|
||||
Reference in New Issue
Block a user