mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-02-04 14:22:26 +08:00
完善重连流程
This commit is contained in:
@@ -139,6 +139,7 @@ func (c *Controller) registerRouter() {
|
||||
}
|
||||
engine.Use(c.authorize())
|
||||
engine.POST("/gate/token/verify", c.gateTokenVerify)
|
||||
engine.POST("/gate/token/reset", c.gateTokenReset)
|
||||
port := config.CONF.HttpPort
|
||||
addr := ":" + strconv.Itoa(int(port))
|
||||
err := engine.Run(addr)
|
||||
|
||||
@@ -67,3 +67,32 @@ func (c *Controller) gateTokenVerify(context *gin.Context) {
|
||||
PlayerID: uint32(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