Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nlt-pufa-interface
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邓梁
nlt-pufa-interface
Commits
3490b573
Commit
3490b573
authored
Sep 30, 2024
by
dliangx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
返回错误不加密不加签
parent
b8fd70df
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
16 deletions
+18
-16
handler/auth.go
+7
-6
handler/pay_result.go
+7
-6
model/http_body.go
+4
-4
No files found.
handler/auth.go
View file @
3490b573
...
@@ -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
)
}
}
handler/pay_result.go
View file @
3490b573
...
@@ -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
)
}
}
model/http_body.go
View file @
3490b573
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment