1.MongoDB、Redis兼容集群模式

2.离线数据接口化访问
This commit is contained in:
flswld
2023-02-26 23:03:13 +08:00
parent 01cb17d4a9
commit 0395dc0bc2
60 changed files with 1298 additions and 464 deletions

View File

@@ -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,
})
}