🎨 优化机器人查询
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package bot
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"git.echol.cn/loser/lckt/global"
|
||||
"git.echol.cn/loser/lckt/model/bot"
|
||||
botReq "git.echol.cn/loser/lckt/model/bot/request"
|
||||
@@ -9,6 +10,7 @@ import (
|
||||
"git.echol.cn/loser/lckt/utils/user_jwt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -188,6 +190,13 @@ func (btApi *BotApi) FindKey(c *gin.Context) {
|
||||
userId := user_jwt.GetUserID(c)
|
||||
|
||||
bt, err := btService.GetBotPublic(req, userId)
|
||||
// 判断是否查询为空
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
// 没有找到记录的处理逻辑
|
||||
response.OkWithData(bt, c)
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("获取失败!", zap.Error(err))
|
||||
response.FailWithMessage("获取失败:"+err.Error(), c)
|
||||
|
Reference in New Issue
Block a user