mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 18:12:27 +08:00
1.MongoDB、Redis兼容集群模式
2.离线数据接口化访问
This commit is contained in:
@@ -3,6 +3,7 @@ package controller
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"hk4e/pkg/logger"
|
||||
|
||||
@@ -51,12 +52,7 @@ func (c *Controller) gateTokenVerify(context *gin.Context) {
|
||||
verifyFail(account.PlayerID)
|
||||
return
|
||||
}
|
||||
if account.ComboTokenUsed {
|
||||
verifyFail(account.PlayerID)
|
||||
return
|
||||
}
|
||||
_, err = c.dao.UpdateAccountFieldByFieldName("AccountID", account.AccountID, "ComboTokenUsed", true)
|
||||
if err != nil {
|
||||
if time.Now().UnixMilli()-int64(account.ComboTokenCreateTime) > time.Minute.Milliseconds()*5 {
|
||||
verifyFail(account.PlayerID)
|
||||
return
|
||||
}
|
||||
@@ -67,32 +63,3 @@ func (c *Controller) gateTokenVerify(context *gin.Context) {
|
||||
PlayerID: account.PlayerID,
|
||||
})
|
||||
}
|
||||
|
||||
type TokenResetReq struct {
|
||||
PlayerId uint32 `json:"playerId"`
|
||||
}
|
||||
|
||||
type TokenResetRsp struct {
|
||||
Result bool `json:"result"`
|
||||
}
|
||||
|
||||
func (c *Controller) gateTokenReset(context *gin.Context) {
|
||||
req := new(TokenResetReq)
|
||||
err := context.ShouldBindJSON(req)
|
||||
if err != nil {
|
||||
context.JSON(http.StatusOK, &TokenResetRsp{
|
||||
Result: false,
|
||||
})
|
||||
return
|
||||
}
|
||||
_, err = c.dao.UpdateAccountFieldByFieldName("PlayerID", req.PlayerId, "ComboTokenUsed", false)
|
||||
if err != nil {
|
||||
context.JSON(http.StatusOK, &TokenResetRsp{
|
||||
Result: false,
|
||||
})
|
||||
return
|
||||
}
|
||||
context.JSON(http.StatusOK, &TokenResetRsp{
|
||||
Result: true,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user