修复redis设置不存在值的参数返回

This commit is contained in:
junleea 2024-06-13 11:23:58 +08:00
parent 97f8935911
commit 2ee51cd957
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,7 @@ func SetQRStatus(c *gin.Context) {
var qrsetReq QRReq var qrsetReq QRReq
if err := c.ShouldBind(&qrsetReq); err == nil || qrsetReq.UUID != "" { if err := c.ShouldBind(&qrsetReq); err == nil || qrsetReq.UUID != "" {
if worker.IsContainKey(qrsetReq.UUID) == false { if worker.IsContainKey(qrsetReq.UUID) == false {
c.JSON(200, gin.H{"code": 18, "message": "uuid not found", "data": "0"}) c.JSON(200, gin.H{"code": 18, "message": "uuid not found in server", "data": "0"})
return return
} }
res := worker.SetHashWithField(qrsetReq.UUID, "status", "1") res := worker.SetHashWithField(qrsetReq.UUID, "status", "1")
@ -85,6 +85,10 @@ func ConfirmQRLogin(c *gin.Context) {
if token == "" { if token == "" {
c.JSON(200, gin.H{"code": 20, "message": "Token不存在", "data": "20"}) c.JSON(200, gin.H{"code": 20, "message": "Token不存在", "data": "20"})
} }
if worker.IsContainKey(qrsetReq.UUID) == false {
c.JSON(200, gin.H{"code": 18, "message": "uuid not found in server", "data": "0"})
return
}
if worker.SetHashWithField(qrsetReq.UUID, "status", token) { if worker.SetHashWithField(qrsetReq.UUID, "status", token) {
c.JSON(200, gin.H{"code": 0, "message": "success", "data": "0"}) c.JSON(200, gin.H{"code": 0, "message": "success", "data": "0"})
} else { } else {