Commit 3490b573 by dliangx

返回错误不加密不加签

parent b8fd70df
......@@ -17,12 +17,13 @@ func Auth(ctx context.Context, c *app.RequestContext) {
var creq model.CryptHttpBodyReq
var req model.HttpBodyReq[model.AuthReq]
var resp model.HttpBodyResp[model.AuthResp]
var cresp model.CryptHttpBodyResp
err = c.BindAndValidate(&creq)
if err != nil {
resp.Head.Code = nltconst.PARAM_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
......@@ -38,7 +39,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
}
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
......@@ -48,7 +49,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
......@@ -65,7 +66,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = string(nltconst.PERSON_INFO_NO_MATCH)
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
......@@ -76,7 +77,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
......@@ -85,7 +86,7 @@ func Auth(ctx context.Context, c *app.RequestContext) {
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
resp.Response.DirectURL = nltconst.DURL + "?param=" + req.Request.DuebillNoOrg
cresp, _ := model.EncryptAndSign(resp)
cresp, _ = model.EncryptAndSign(resp)
c.JSON(consts.StatusOK, cresp)
}
......@@ -17,11 +17,12 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
var creq model.CryptHttpBodyReq
var req model.HttpBodyReq[model.PayResultReq]
var resp model.HttpBodyResp[model.PayResultResp]
var cresp model.CryptHttpBodyResp
err = c.BindAndValidate(&creq)
if err != nil {
resp.Head.Code = nltconst.PARAM_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime()
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
......@@ -35,7 +36,7 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR
}
resp.Head.ServiceTime = nltconst.GetNowTime()
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
......@@ -50,7 +51,7 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
......@@ -68,7 +69,7 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.NODATA
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
......@@ -79,14 +80,14 @@ func QueryPayResult(ctx context.Context, c *app.RequestContext) {
resp.Head.Code = nltconst.SYS_ERROR
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp)
cresp.Response.Head = resp.Head
c.JSON(consts.StatusOK, cresp)
return
}
resp.Head.Code = string(nltconst.SUCCESS)
resp.Head.ServiceTime = nltconst.GetNowTime()
resp.Head.ServiceSn = req.Head.ServiceSn
cresp, _ := model.EncryptAndSign(resp)
cresp, _ = model.EncryptAndSign(resp)
c.JSON(consts.StatusOK, cresp)
}
......@@ -15,13 +15,13 @@ import (
)
type CryptHttpBodyReq struct {
Request HttpBodyReq[string]
Signature string
Request HttpBodyReq[string] `json:"request"`
Signature string `json:"signature"`
}
type CryptHttpBodyResp struct {
Response HttpBodyResp[string]
Signature string
Response HttpBodyResp[string] `json:"response"`
Signature string `json:"signature"`
}
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