Skip to content

Commit 6780149

Browse files
committed
fix
1 parent f9916f3 commit 6780149

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

service/handler/bot.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ func SolveCaptcha(c *gin.Context) {
129129
}
130130

131131
func FetchQrCode(c *gin.Context) {
132+
if bot.Cli != nil && bot.Cli.Online {
133+
c.String(http.StatusBadRequest, "already online")
134+
return
135+
}
136+
132137
log.Infof("开始初始化设备信息")
133138
bot.InitDevice(0)
134139
log.Infof("设备信息 %+v", string(client.SystemDeviceInfo.ToJson()))
@@ -153,18 +158,18 @@ func FetchQrCode(c *gin.Context) {
153158
}
154159

155160
func QueryQRCodeStatus(c *gin.Context) {
161+
if bot.Cli != nil && bot.Cli.Online {
162+
c.String(http.StatusBadRequest, "already online")
163+
return
164+
}
165+
156166
req := &dto.QueryQRCodeStatusReq{}
157167
err := c.Bind(req)
158168
if err != nil {
159169
c.String(http.StatusBadRequest, fmt.Sprintf("failed to bind, %+v", err))
160170
return
161171
}
162172

163-
if bot.Cli.Online {
164-
c.String(http.StatusBadRequest, "already online")
165-
return
166-
}
167-
168173
queryQRCodeStatusResp, err := bot.Cli.QueryQRCodeStatus(req.Sig)
169174
if err != nil {
170175
c.String(http.StatusInternalServerError, fmt.Sprintf("failed to query qrcode status, %+v", err))

0 commit comments

Comments
 (0)