用于测试swagger的接口

This commit is contained in:
longpeng 2025-06-27 12:10:54 +08:00
parent a2bf792823
commit e1beee6478
4 changed files with 1008 additions and 1 deletions

View File

@ -280,6 +280,90 @@ const docTemplate = `{
}
}
},
"/test/core-transfer": {
"post": {
"description": "Core transfer endpoint for handling core banking transfer operations",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"test"
],
"summary": "Core transfer endpoint",
"parameters": [
{
"description": "Core transfer request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.CoreTransfer"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/test/test-endpoint": {
"post": {
"description": "Test endpoint for API functionality verification",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"test"
],
"summary": "Test endpoint",
"parameters": [
{
"description": "Test request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.Endpoint"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/workflows/start": {
"post": {
"description": "Start a new workflow",
@ -401,6 +485,382 @@ const docTemplate = `{
}
},
"definitions": {
"handlers.CoreTransfer": {
"type": "object",
"properties": {
"service": {
"type": "object",
"properties": {
"APP_HEAD": {
"type": "object",
"properties": {
"BranchId": {
"type": "string"
},
"TlrNo": {
"type": "string"
},
"array": {
"type": "object",
"properties": {
"AuthTlrInf": {
"type": "object",
"properties": {
"ApprTellerNo": {
"type": "string"
}
}
}
}
}
}
},
"QryRcrdNo": {
"type": "string"
},
"SYS_HEAD": {
"type": "object",
"properties": {
"PrvdSysSeqNo": {
"type": "string"
},
"SvcCd": {
"type": "string"
},
"SvcScn": {
"type": "string"
},
"TranDt": {
"type": "string"
},
"TranRetSt": {
"type": "string"
},
"array": {
"type": "object",
"properties": {
"RetInf": {
"type": "object",
"properties": {
"RetCd": {
"type": "string"
},
"RetMsg": {
"type": "string"
}
}
}
}
}
}
},
"TxnStrtNo": {
"type": "string"
},
"array": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnInfArray": {
"type": "object",
"properties": {
"AcctNm": {
"type": "string"
},
"CnclRvrsFlg": {
"type": "string"
},
"CnlNo": {
"type": "string"
},
"CntprAcctNoOrCardNo": {
"type": "string"
},
"ImprtBlkVchrNo": {
"type": "string"
},
"ImprtBlkVchrTp": {
"type": "string"
},
"OrigTxnSeqNo": {
"type": "string"
},
"OthrBnkBnkNo": {
"type": "string"
},
"RmkInf": {
"type": "string"
},
"SubBrId": {
"type": "string"
},
"TxnAfBal": {
"type": "string"
},
"TxnAmt": {
"type": "string"
},
"TxnCcy": {
"type": "string"
},
"TxnCd": {
"type": "string"
},
"TxnSmyDsc": {
"type": "string"
},
"TxnSysDt": {
"type": "string"
},
"TxnSysTm": {
"type": "string"
},
"TxnTlrNo": {
"type": "string"
}
}
}
}
}
}
}
}
}
},
"handlers.Endpoint": {
"type": "object",
"properties": {
"BODY": {
"type": "object",
"properties": {
"BASE_ACCT_NO": {
"type": "string"
},
"CARD_NO": {
"type": "array",
"items": {
"type": "object",
"properties": {
"DOCUMENT_ID": {
"type": "string"
},
"DOCUMENT_TYPE": {
"type": "string"
},
"LINKMAN_NAME": {
"type": "string"
},
"LINKMAN_TYPE": {
"type": "string"
},
"PHONE_NO1": {
"type": "string"
},
"PHONE_NO2": {
"type": "string"
}
}
}
},
"HANG_SEQ_NO": {
"type": "array",
"items": {
"type": "string"
}
},
"SERV_DETAIL": {
"type": "object",
"properties": {
"CHARGE_MODE": {
"type": "string"
},
"DISC_FEE_AMT": {
"type": "string"
},
"DISC_RATE": {
"type": "object",
"properties": {
"CHARGE_MODE": {
"type": "string"
},
"PHONE_NO2": {
"type": "object",
"properties": {
"DOCUMENT_TYPE": {
"type": "array",
"items": {
"type": "object",
"properties": {
"DOCUMENT_ID": {
"type": "object",
"properties": {
"LINKMAN_TYPE": {
"type": "string"
},
"PHONE_NO2": {
"type": "string"
}
}
},
"DOCUMENT_TYPE": {
"type": "string"
},
"LINKMAN_NAME": {
"type": "string"
},
"LINKMAN_TYPE": {
"type": "string"
}
}
}
},
"LINKMAN_NAME": {
"type": "string"
},
"LINKMAN_TYPE": {
"type": "string"
}
}
}
}
},
"DISC_TYPE": {
"type": "string"
},
"FEE_AMT": {
"type": "string"
},
"FEE_TYPE": {
"type": "string"
},
"ORIG_FEE_AMT": {
"type": "string"
}
}
},
"SETTLEMENT_DATE": {
"type": "string"
},
"TRAN_AMT": {
"type": "string"
},
"TRAN_CCY": {
"type": "string"
},
"TRAN_TYPE": {
"type": "string"
}
}
},
"PUB_DOMAIN": {
"type": "object",
"properties": {
"AUTH_FLAG": {
"type": "string"
},
"AUTH_INFO_NUM": {
"type": "string"
},
"AUTH_STATUS": {
"type": "string"
},
"AUTH_TELLER": {
"type": "string"
},
"BRANCH_ID": {
"type": "string"
},
"CHANNEL_CODE": {
"type": "string"
},
"CONFIRM_FLAG": {
"type": "string"
},
"CONFIRM_STATUS": {
"type": "string"
},
"CONSUM_TRAN_DATE": {
"type": "string"
},
"CONSUM_TRAN_TIME": {
"type": "string"
},
"CURR_PAGE_NUM": {
"type": "string"
},
"LEGAL_CODE": {
"type": "string"
},
"PAGE_UP_DOWN": {
"type": "string"
},
"PER_PAGE_NUM": {
"type": "string"
},
"PROVID_TRAN_DATE": {
"type": "string"
},
"PUB_EXTEND": {
"type": "string"
},
"TRAN_TELLER": {
"type": "string"
}
}
},
"SYS_HEAD": {
"type": "object",
"properties": {
"CHARACTER_SET": {
"type": "string"
},
"COMM_TYPE": {
"type": "string"
},
"CONSUM_REQ_DATE": {
"type": "string"
},
"CONSUM_REQ_TIME": {
"type": "string"
},
"CONSUM_SYS_CODE": {
"type": "string"
},
"FILE_FLAG": {
"type": "string"
},
"GLOBAL_SEQ": {
"type": "string"
},
"LOCAL_LANG": {
"type": "string"
},
"PROVID_SYS_CODE": {
"type": "string"
},
"SCENES_CODE": {
"type": "string"
},
"SCENES_VERSION": {
"type": "string"
},
"SERVICE_NAME": {
"type": "string"
},
"SERVICE_REQ_SEQ": {
"type": "string"
},
"SERVICE_VERSION": {
"type": "string"
},
"SRC_ENC_NODE": {
"type": "string"
}
}
}
}
},
"models.CreateCompositeCaseRequest": {
"type": "object",
"required": [

View File

@ -274,6 +274,90 @@
}
}
},
"/test/core-transfer": {
"post": {
"description": "Core transfer endpoint for handling core banking transfer operations",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"test"
],
"summary": "Core transfer endpoint",
"parameters": [
{
"description": "Core transfer request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.CoreTransfer"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/test/test-endpoint": {
"post": {
"description": "Test endpoint for API functionality verification",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"test"
],
"summary": "Test endpoint",
"parameters": [
{
"description": "Test request body",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.Endpoint"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/workflows/start": {
"post": {
"description": "Start a new workflow",
@ -395,6 +479,382 @@
}
},
"definitions": {
"handlers.CoreTransfer": {
"type": "object",
"properties": {
"service": {
"type": "object",
"properties": {
"APP_HEAD": {
"type": "object",
"properties": {
"BranchId": {
"type": "string"
},
"TlrNo": {
"type": "string"
},
"array": {
"type": "object",
"properties": {
"AuthTlrInf": {
"type": "object",
"properties": {
"ApprTellerNo": {
"type": "string"
}
}
}
}
}
}
},
"QryRcrdNo": {
"type": "string"
},
"SYS_HEAD": {
"type": "object",
"properties": {
"PrvdSysSeqNo": {
"type": "string"
},
"SvcCd": {
"type": "string"
},
"SvcScn": {
"type": "string"
},
"TranDt": {
"type": "string"
},
"TranRetSt": {
"type": "string"
},
"array": {
"type": "object",
"properties": {
"RetInf": {
"type": "object",
"properties": {
"RetCd": {
"type": "string"
},
"RetMsg": {
"type": "string"
}
}
}
}
}
}
},
"TxnStrtNo": {
"type": "string"
},
"array": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnInfArray": {
"type": "object",
"properties": {
"AcctNm": {
"type": "string"
},
"CnclRvrsFlg": {
"type": "string"
},
"CnlNo": {
"type": "string"
},
"CntprAcctNoOrCardNo": {
"type": "string"
},
"ImprtBlkVchrNo": {
"type": "string"
},
"ImprtBlkVchrTp": {
"type": "string"
},
"OrigTxnSeqNo": {
"type": "string"
},
"OthrBnkBnkNo": {
"type": "string"
},
"RmkInf": {
"type": "string"
},
"SubBrId": {
"type": "string"
},
"TxnAfBal": {
"type": "string"
},
"TxnAmt": {
"type": "string"
},
"TxnCcy": {
"type": "string"
},
"TxnCd": {
"type": "string"
},
"TxnSmyDsc": {
"type": "string"
},
"TxnSysDt": {
"type": "string"
},
"TxnSysTm": {
"type": "string"
},
"TxnTlrNo": {
"type": "string"
}
}
}
}
}
}
}
}
}
},
"handlers.Endpoint": {
"type": "object",
"properties": {
"BODY": {
"type": "object",
"properties": {
"BASE_ACCT_NO": {
"type": "string"
},
"CARD_NO": {
"type": "array",
"items": {
"type": "object",
"properties": {
"DOCUMENT_ID": {
"type": "string"
},
"DOCUMENT_TYPE": {
"type": "string"
},
"LINKMAN_NAME": {
"type": "string"
},
"LINKMAN_TYPE": {
"type": "string"
},
"PHONE_NO1": {
"type": "string"
},
"PHONE_NO2": {
"type": "string"
}
}
}
},
"HANG_SEQ_NO": {
"type": "array",
"items": {
"type": "string"
}
},
"SERV_DETAIL": {
"type": "object",
"properties": {
"CHARGE_MODE": {
"type": "string"
},
"DISC_FEE_AMT": {
"type": "string"
},
"DISC_RATE": {
"type": "object",
"properties": {
"CHARGE_MODE": {
"type": "string"
},
"PHONE_NO2": {
"type": "object",
"properties": {
"DOCUMENT_TYPE": {
"type": "array",
"items": {
"type": "object",
"properties": {
"DOCUMENT_ID": {
"type": "object",
"properties": {
"LINKMAN_TYPE": {
"type": "string"
},
"PHONE_NO2": {
"type": "string"
}
}
},
"DOCUMENT_TYPE": {
"type": "string"
},
"LINKMAN_NAME": {
"type": "string"
},
"LINKMAN_TYPE": {
"type": "string"
}
}
}
},
"LINKMAN_NAME": {
"type": "string"
},
"LINKMAN_TYPE": {
"type": "string"
}
}
}
}
},
"DISC_TYPE": {
"type": "string"
},
"FEE_AMT": {
"type": "string"
},
"FEE_TYPE": {
"type": "string"
},
"ORIG_FEE_AMT": {
"type": "string"
}
}
},
"SETTLEMENT_DATE": {
"type": "string"
},
"TRAN_AMT": {
"type": "string"
},
"TRAN_CCY": {
"type": "string"
},
"TRAN_TYPE": {
"type": "string"
}
}
},
"PUB_DOMAIN": {
"type": "object",
"properties": {
"AUTH_FLAG": {
"type": "string"
},
"AUTH_INFO_NUM": {
"type": "string"
},
"AUTH_STATUS": {
"type": "string"
},
"AUTH_TELLER": {
"type": "string"
},
"BRANCH_ID": {
"type": "string"
},
"CHANNEL_CODE": {
"type": "string"
},
"CONFIRM_FLAG": {
"type": "string"
},
"CONFIRM_STATUS": {
"type": "string"
},
"CONSUM_TRAN_DATE": {
"type": "string"
},
"CONSUM_TRAN_TIME": {
"type": "string"
},
"CURR_PAGE_NUM": {
"type": "string"
},
"LEGAL_CODE": {
"type": "string"
},
"PAGE_UP_DOWN": {
"type": "string"
},
"PER_PAGE_NUM": {
"type": "string"
},
"PROVID_TRAN_DATE": {
"type": "string"
},
"PUB_EXTEND": {
"type": "string"
},
"TRAN_TELLER": {
"type": "string"
}
}
},
"SYS_HEAD": {
"type": "object",
"properties": {
"CHARACTER_SET": {
"type": "string"
},
"COMM_TYPE": {
"type": "string"
},
"CONSUM_REQ_DATE": {
"type": "string"
},
"CONSUM_REQ_TIME": {
"type": "string"
},
"CONSUM_SYS_CODE": {
"type": "string"
},
"FILE_FLAG": {
"type": "string"
},
"GLOBAL_SEQ": {
"type": "string"
},
"LOCAL_LANG": {
"type": "string"
},
"PROVID_SYS_CODE": {
"type": "string"
},
"SCENES_CODE": {
"type": "string"
},
"SCENES_VERSION": {
"type": "string"
},
"SERVICE_NAME": {
"type": "string"
},
"SERVICE_REQ_SEQ": {
"type": "string"
},
"SERVICE_VERSION": {
"type": "string"
},
"SRC_ENC_NODE": {
"type": "string"
}
}
}
}
},
"models.CreateCompositeCaseRequest": {
"type": "object",
"required": [

View File

@ -12,6 +12,16 @@ func NewTestHandler() *TestHandler {
return &TestHandler{}
}
// TestEndpoint godoc
// @Summary Test endpoint
// @Description Test endpoint for API functionality verification
// @Tags test
// @Accept json
// @Produce json
// @Param body body Endpoint true "Test request body"
// @Success 200 {object} map[string]interface{}
// @Failure 400 {object} map[string]interface{}
// @Router /test/test-endpoint [post]
func (h *TestHandler) TestEndpoint(c *gin.Context) {
var req Endpoint
if err := c.ShouldBindJSON(&req); err != nil {
@ -27,6 +37,31 @@ func (h *TestHandler) TestEndpoint(c *gin.Context) {
})
}
// CoreTransferEndpoint godoc
// @Summary Core transfer endpoint
// @Description Core transfer endpoint for handling core banking transfer operations
// @Tags test
// @Accept json
// @Produce json
// @Param body body CoreTransfer true "Core transfer request body"
// @Success 200 {object} map[string]interface{}
// @Failure 400 {object} map[string]interface{}
// @Router /test/core-transfer [post]
func (h *TestHandler) CoreTransferEndpoint(c *gin.Context) {
var req CoreTransfer
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, gin.H{
"error": "请求参数错误",
"details": err.Error(),
})
return
}
c.JSON(200, gin.H{
"message": "Test endpoint is working",
})
}
type Endpoint struct {
BODY struct {
BASEACCTNO string `json:"BASE_ACCT_NO"`
@ -105,3 +140,54 @@ type Endpoint struct {
SRCENCNODE string `json:"SRC_ENC_NODE"`
} `json:"SYS_HEAD"`
}
type CoreTransfer struct {
Service struct {
SYSHEAD struct {
SvcCd string `json:"SvcCd"`
SvcScn string `json:"SvcScn"`
PrvdSysSeqNo string `json:"PrvdSysSeqNo"`
TranDt string `json:"TranDt"`
TranRetSt string `json:"TranRetSt"`
Array struct {
RetInf struct {
RetCd string `json:"RetCd"`
RetMsg string `json:"RetMsg"`
} `json:"RetInf"`
} `json:"array"`
} `json:"SYS_HEAD"`
APPHEAD struct {
BranchId string `json:"BranchId"`
TlrNo string `json:"TlrNo"`
Array struct {
AuthTlrInf struct {
ApprTellerNo string `json:"ApprTellerNo"`
} `json:"AuthTlrInf"`
} `json:"array"`
} `json:"APP_HEAD"`
TxnStrtNo string `json:"TxnStrtNo"`
QryRcrdNo string `json:"QryRcrdNo"`
Array []struct {
TxnInfArray struct {
TxnSysDt string `json:"TxnSysDt,omitempty"`
TxnSysTm string `json:"TxnSysTm,omitempty"`
OrigTxnSeqNo string `json:"OrigTxnSeqNo,omitempty"`
CnlNo string `json:"CnlNo,omitempty"`
SubBrId string `json:"SubBrId,omitempty"`
TxnTlrNo string `json:"TxnTlrNo,omitempty"`
TxnCd string `json:"TxnCd"`
TxnSmyDsc string `json:"TxnSmyDsc"`
TxnAmt string `json:"TxnAmt"`
TxnAfBal string `json:"TxnAfBal"`
TxnCcy string `json:"TxnCcy"`
CntprAcctNoOrCardNo string `json:"CntprAcctNoOrCardNo"`
AcctNm string `json:"AcctNm"`
OthrBnkBnkNo string `json:"OthrBnkBnkNo"`
ImprtBlkVchrTp string `json:"ImprtBlkVchrTp"`
ImprtBlkVchrNo string `json:"ImprtBlkVchrNo"`
RmkInf string `json:"RmkInf,omitempty"`
CnclRvrsFlg string `json:"CnclRvrsFlg,omitempty"`
} `json:"TxnInfArray"`
} `json:"array"`
} `json:"service"`
}

View File

@ -132,6 +132,7 @@ func SetupTestRoutes(group *gin.RouterGroup) {
testHandler := handlers.NewTestHandler()
api := group.Group("/api")
{
api.GET("/test", testHandler.TestEndpoint)
api.POST("/test/test-endpoint", testHandler.TestEndpoint)
api.POST("/test/core-transfer", testHandler.CoreTransferEndpoint)
}
}