This commit is contained in:
yangduo 2025-04-30 16:40:00 +08:00
parent 07c8eda8dc
commit 5a78d63c9e

View File

@ -292,7 +292,7 @@ func (gca *GiftCodeApi) QueryCode(c *gin.Context) {
Code string `binding:"required" json:"code"`
}{}
if err := c.ShouldBindJSON(&req); err != nil {
f5.RspErr2(c, 1, err.Error())
f5.RspErr(c, 1, err.Error())
return
}
@ -307,7 +307,7 @@ func (gca *GiftCodeApi) QueryCode(c *gin.Context) {
err := db.Error
if err != nil {
if !f5.IsOrmErrRecordNotFound(err) {
f5.RspErr2(c, 1, err.Error())
f5.RspErr(c, 1, err.Error())
return
}
rspObj.CodeStatus = 2
@ -327,20 +327,20 @@ func (gca *GiftCodeApi) UseCode(c *gin.Context) {
Code string `binding:"required" json:"code"`
}{}
if err := c.ShouldBindJSON(&req); err != nil {
f5.RspErr2(c, 1, err.Error())
f5.RspErr(c, 1, err.Error())
return
}
_, exist := gca.accountlocks.LoadOrStore(req.AccountId, 1)
if exist {
f5.RspErr2(c, 2, "system busy")
f5.RspErr(c, 2, "system busy")
return
}
defer gca.accountlocks.Delete(req.AccountId)
_, exist = gca.codelocks.LoadOrStore(req.Code, 1)
if exist {
f5.RspErr2(c, 3, "system busy 2")
f5.RspErr(c, 3, "system busy 2")
}
defer gca.codelocks.Delete(req.Code)