Commit 3490b573 by dliangx

返回错误不加密不加签

parent b8fd70df
...@@ -17,12 +17,13 @@ func Auth(ctx context.Context, c *app.RequestContext) { ...@@ -17,12 +17,13 @@ func Auth(ctx context.Context, c *app.RequestContext) {
var creq model.CryptHttpBodyReq var creq model.CryptHttpBodyReq
var req model.HttpBodyReq[model.AuthReq] var req model.HttpBodyReq[model.AuthReq]
var resp model.HttpBodyResp[model.AuthResp] var resp model.HttpBodyResp[model.AuthResp]
var cresp model.CryptHttpBodyResp
err = c.BindAndValidate(&creq) err = c.BindAndValidate(&creq)
if err != nil { if err != nil {
resp.Head.Code = nltconst.PARAM_ERROR resp.Head.Code = nltconst.PARAM_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
...@@ -38,7 +39,7 @@ func Auth(ctx context.Context, c *app.RequestContext) { ...@@ -38,7 +39,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
} }
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
...@@ -48,7 +49,7 @@ func Auth(ctx context.Context, c *app.RequestContext) { ...@@ -48,7 +49,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR resp.Head.Code = nltconst.SYS_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
...@@ -65,7 +66,7 @@ func Auth(ctx context.Context, c *app.RequestContext) { ...@@ -65,7 +66,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = string(nltconst.PERSON_INFO_NO_MATCH) resp.Head.Code = string(nltconst.PERSON_INFO_NO_MATCH)
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
...@@ -76,7 +77,7 @@ func Auth(ctx context.Context, c *app.RequestContext) { ...@@ -76,7 +77,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR resp.Head.Code = nltconst.SYS_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
...@@ -85,7 +86,7 @@ func Auth(ctx context.Context, c *app.RequestContext) { ...@@ -85,7 +86,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
resp.Response.DirectURL = nltconst.DURL + "?param=" + req.Request.DuebillNoOrg resp.Response.DirectURL = nltconst.DURL + "?param=" + req.Request.DuebillNoOrg
cresp, _ := model.EncryptAndSign(resp) cresp, _ = model.EncryptAndSign(resp)
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
} }
...@@ -17,11 +17,12 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) { ...@@ -17,11 +17,12 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
var creq model.CryptHttpBodyReq var creq model.CryptHttpBodyReq
var req model.HttpBodyReq[model.PayResultReq] var req model.HttpBodyReq[model.PayResultReq]
var resp model.HttpBodyResp[model.PayResultResp] var resp model.HttpBodyResp[model.PayResultResp]
var cresp model.CryptHttpBodyResp
err = c.BindAndValidate(&creq) err = c.BindAndValidate(&creq)
if err != nil { if err != nil {
resp.Head.Code = nltconst.PARAM_ERROR resp.Head.Code = nltconst.PARAM_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
...@@ -35,7 +36,7 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) { ...@@ -35,7 +36,7 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR resp.Head.Code = nltconst.SYS_ERROR
} }
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
...@@ -50,7 +51,7 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) { ...@@ -50,7 +51,7 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR resp.Head.Code = nltconst.SYS_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
...@@ -68,7 +69,7 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) { ...@@ -68,7 +69,7 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.NODATA resp.Head.Code = nltconst.NODATA
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
...@@ -79,14 +80,14 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) { ...@@ -79,14 +80,14 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR resp.Head.Code = nltconst.SYS_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp) cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
return return
} }
resp.Head.Code = string(nltconst.SUCCESS) resp.Head.Code = string(nltconst.SUCCESS)
resp.Head.ServiceTime = nltconst.GetNowTime() resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp) cresp, _ = model.EncryptAndSign(resp)
c.JSON(consts.StatusOK, cresp) c.JSON(consts.StatusOK, cresp)
} }
...@@ -15,13 +15,13 @@ import ( ...@@ -15,13 +15,13 @@ import (
) )
type CryptHttpBodyReq struct { type CryptHttpBodyReq struct {
Request HttpBodyReq[string] Request HttpBodyReq[string] `json:"request"`
Signature string Signature string `json:"signature"`
} }
type CryptHttpBodyResp struct { type CryptHttpBodyResp struct {
Response HttpBodyResp[string] Response HttpBodyResp[string] `json:"response"`
Signature string Signature string `json:"signature"`
} }
type HttpBodyReq[T any] struct { type HttpBodyReq[T any] struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment