fix panic

This commit is contained in:
lwl0608 2024-03-21 20:10:30 +08:00
parent 59d9638bef
commit 6f16b754ce
2 changed files with 4 additions and 3 deletions

View File

@ -481,8 +481,9 @@ func ReplyJsonError(ctx *gin.Context, code int, msg string) {
} }
func PrepareOp() gin.HandlerFunc { func PrepareOp() gin.HandlerFunc {
return func(ctx *gin.Context) {
defer logger.Recover() defer logger.Recover()
return func(ctx *gin.Context) {
//if ctx.ClientIP() != "127.0.0.1" { //if ctx.ClientIP() != "127.0.0.1" {
// ReplyJsonError(ctx, http.StatusBadRequest, fmt.Sprintf("not localhost, ip: %s", ctx.ClientIP())) // ReplyJsonError(ctx, http.StatusBadRequest, fmt.Sprintf("not localhost, ip: %s", ctx.ClientIP()))
// return // return

View File

@ -10,7 +10,7 @@ import (
) )
func OpCoinOrderList(ctx *gin.Context) { func OpCoinOrderList(ctx *gin.Context) {
defer logger.Recover() //defer logger.Recover()
req := ctx.MustGet("client_req").(*vasproto.OpCoinOrderListReq) req := ctx.MustGet("client_req").(*vasproto.OpCoinOrderListReq)
if req.Limit <= 0 { if req.Limit <= 0 {
req.Limit = 1000 req.Limit = 1000
@ -28,7 +28,7 @@ func OpCoinOrderList(ctx *gin.Context) {
} }
func OpOrderList(ctx *gin.Context) { func OpOrderList(ctx *gin.Context) {
defer logger.Recover() //defer logger.Recover()
req := ctx.MustGet("client_req").(*vasproto.OpOrderListReq) req := ctx.MustGet("client_req").(*vasproto.OpOrderListReq)
if req.Limit <= 0 { if req.Limit <= 0 {
req.Limit = 1000 req.Limit = 1000