1
This commit is contained in:
parent
f2cc140a95
commit
e1bb4b963d
@ -12,7 +12,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type InGameApi struct {
|
||||
type InGameApi struct {
|
||||
}
|
||||
|
||||
func (this *InGameApi) PreOrder(c *gin.Context) {
|
||||
@ -129,6 +129,12 @@ func (this *InGameApi) PayDone(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
sessionkeytime := q5.SafeToInt64(data["update_time"])
|
||||
if service.Wxpay.CheckExpireCache(accountId, sessionkeytime) {
|
||||
f5.RspErr(c, 402, "session expired")
|
||||
return
|
||||
}
|
||||
|
||||
status := orderModel.Status
|
||||
rspObj := struct {
|
||||
ErrorCode int32 `json:"errcode"`
|
||||
@ -140,7 +146,7 @@ func (this *InGameApi) PayDone(c *gin.Context) {
|
||||
}
|
||||
for status < 2 {
|
||||
gameid := q5.SafeToInt64(strs[1])
|
||||
openid := strs[2]
|
||||
openid := q5.SafeToString(data["openid"])
|
||||
sessionkey := q5.SafeToString(data["session_key"])
|
||||
userip := this.getIP(c)
|
||||
balance, errcode, err := int64(0), int32(0), error(nil)
|
||||
@ -160,6 +166,8 @@ func (this *InGameApi) PayDone(c *gin.Context) {
|
||||
status = 1
|
||||
orderModel.Status = 3
|
||||
orderModel.UpdateFields([]string{"status"})
|
||||
|
||||
rspObj.Diamond = balance
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,8 +176,6 @@ func (this *InGameApi) PayDone(c *gin.Context) {
|
||||
rspObj.ErrMsg = "session overtime"
|
||||
}
|
||||
|
||||
rspObj.Diamond = balance
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
@ -226,10 +232,12 @@ func (this *InGameApi) OrderInfo(c *gin.Context) {
|
||||
ErrMsg string `json:"errmsg"`
|
||||
OrderId string `json:"order_id"`
|
||||
GoodsId int32 `json:"goods_id"`
|
||||
Count int32 `json:"count"`
|
||||
Status int32 `json:"status"`
|
||||
}{
|
||||
OrderId: orderModel.OrderId,
|
||||
GoodsId: orderModel.ItemId,
|
||||
Count: orderModel.SpAmount,
|
||||
Status: orderModel.Status,
|
||||
}
|
||||
|
||||
@ -255,7 +263,8 @@ func (this *InGameApi) OrderInfo(c *gin.Context) {
|
||||
errcode = service.Wxpay.QueryPay(openid, gameid, userip, sessionkey, int32(count), orderModel.OrderId)
|
||||
if errcode == constant.WX_ERRCODE_OK {
|
||||
orderModel.Status = 1
|
||||
orderModel.UpdateFields([]string{"status"})
|
||||
orderModel.SpAmount = int32(count)
|
||||
orderModel.UpdateFields([]string{"status", "sp_amount"})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user