mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-26 03:39:00 +00:00
28 lines
425 B
Go
28 lines
425 B
Go
|
package api
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
const RET = "ret"
|
||
|
const PLAYER_ID = "playerId"
|
||
|
const TARGET_PLAYER_ID = "targetPlayerId"
|
||
|
const TOKEN = "token"
|
||
|
|
||
|
func CErr(c *gin.Context, err error) {
|
||
|
if err != nil {
|
||
|
c.Error(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func HandleRet() gin.HandlerFunc {
|
||
|
return func(c *gin.Context) {
|
||
|
c.Next()
|
||
|
ret := c.GetInt("ret")
|
||
|
if ret != 0 {
|
||
|
c.JSON(http.StatusOK, gin.H{"ret": ret})
|
||
|
}
|
||
|
}
|
||
|
}
|