adjust
This commit is contained in:
parent
07c8eda8dc
commit
5a78d63c9e
@ -292,7 +292,7 @@ func (gca *GiftCodeApi) QueryCode(c *gin.Context) {
|
|||||||
Code string `binding:"required" json:"code"`
|
Code string `binding:"required" json:"code"`
|
||||||
}{}
|
}{}
|
||||||
if err := c.ShouldBindJSON(&req); err != nil {
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
f5.RspErr2(c, 1, err.Error())
|
f5.RspErr(c, 1, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ func (gca *GiftCodeApi) QueryCode(c *gin.Context) {
|
|||||||
err := db.Error
|
err := db.Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !f5.IsOrmErrRecordNotFound(err) {
|
if !f5.IsOrmErrRecordNotFound(err) {
|
||||||
f5.RspErr2(c, 1, err.Error())
|
f5.RspErr(c, 1, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
rspObj.CodeStatus = 2
|
rspObj.CodeStatus = 2
|
||||||
@ -327,20 +327,20 @@ func (gca *GiftCodeApi) UseCode(c *gin.Context) {
|
|||||||
Code string `binding:"required" json:"code"`
|
Code string `binding:"required" json:"code"`
|
||||||
}{}
|
}{}
|
||||||
if err := c.ShouldBindJSON(&req); err != nil {
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
f5.RspErr2(c, 1, err.Error())
|
f5.RspErr(c, 1, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, exist := gca.accountlocks.LoadOrStore(req.AccountId, 1)
|
_, exist := gca.accountlocks.LoadOrStore(req.AccountId, 1)
|
||||||
if exist {
|
if exist {
|
||||||
f5.RspErr2(c, 2, "system busy")
|
f5.RspErr(c, 2, "system busy")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer gca.accountlocks.Delete(req.AccountId)
|
defer gca.accountlocks.Delete(req.AccountId)
|
||||||
|
|
||||||
_, exist = gca.codelocks.LoadOrStore(req.Code, 1)
|
_, exist = gca.codelocks.LoadOrStore(req.Code, 1)
|
||||||
if exist {
|
if exist {
|
||||||
f5.RspErr2(c, 3, "system busy 2")
|
f5.RspErr(c, 3, "system busy 2")
|
||||||
}
|
}
|
||||||
defer gca.codelocks.Delete(req.Code)
|
defer gca.codelocks.Delete(req.Code)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user