-
Notifications
You must be signed in to change notification settings - Fork 3
/
data.bankbranch2.go
58 lines (53 loc) · 2.09 KB
/
data.bankbranch2.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package leshuazf
import (
"context"
"github.com/dtapps/go-library/utils/gojson"
"github.com/dtapps/go-library/utils/gorequest"
"net/http"
)
type DataBankBranch2Response struct {
RespCode string `json:"respCode"`
RespMsg string `json:"respMsg"`
ReqSerialNo string `json:"reqSerialNo"`
Data struct {
Total int `json:"total"`
Page int `json:"page"`
PageSize int `json:"pageSize"`
List []struct {
UnionpayCode string `json:"unionpayCode"`
FinInstitutionCode string `json:"finInstitutionCode"`
BankArea string `json:"bankArea"`
BankCity string `json:"bankCity"`
BranchName string `json:"branchName"`
CftAreaCode string `json:"cftAreaCode"`
CftCityCode string `json:"cftCityCode"`
UnionAreaCode interface{} `json:"unionAreaCode"`
UnionCityCode interface{} `json:"unionCityCode"`
FinInstitutionName string `json:"finInstitutionName"`
BankName string `json:"bankName"`
} `json:"list"`
} `json:"data"`
}
type DataBankBranch2Result struct {
Result DataBankBranch2Response // 结果
Body []byte // 内容
Http gorequest.Response // 请求
}
func newDataBankBranch2Result(result DataBankBranch2Response, body []byte, http gorequest.Response) *DataBankBranch2Result {
return &DataBankBranch2Result{Result: result, Body: body, Http: http}
}
// DataBankBranch2 代理商通过联行号来查支行信息
// https://www.yuque.com/leshuazf/doc/dbmxyi#QYl0c
func (c *Client) DataBankBranch2(ctx context.Context, notMustParams ...gorequest.Params) (*DataBankBranch2Result, error) {
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
request, err := c.request(ctx, "/data/bankbranch2", params, http.MethodPost)
if err != nil {
return newDataBankBranch2Result(DataBankBranch2Response{}, request.ResponseBody, request), err
}
// 定义
var response DataBankBranch2Response
err = gojson.Unmarshal(request.ResponseBody, &response)
return newDataBankBranch2Result(response, request.ResponseBody, request), err
}