Explorar o código

/Bank/GetHybridConfigs 接口优化结果结构

zhouxnsz hai 9 meses
pai
achega
dda7ecf586
Modificáronse 5 ficheiros con 30 adicións e 17 borrados
  1. 4 4
      controllers/guangzuan/tradeService.go
  2. 6 3
      docs/docs.go
  3. 6 3
      docs/swagger.json
  4. 5 3
      docs/swagger.yaml
  5. 9 4
      models/bank.go

+ 4 - 4
controllers/guangzuan/tradeService.go

@@ -18,8 +18,8 @@ import (
 // @Security Group
 // @Param    userid   query    int    true  "用户ID"
 // @Param    executestatus query    int false "执行状态 - 1:未生效 2:进行中 3:已结束"
-// @Param    page          query    int false "页码"
-// @Param    pagesize      query    int false "每页条数"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200           {array}  models.GzcjjcorderM
 // @Failure  500     {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrder [get]
@@ -39,8 +39,8 @@ func QueryGZCJJCOrder(c *gin.Context) {
 // @Security Group
 // @Param    userid        query    int true  "用户ID"
 // @Param    orderid  query    string false "单据ID"
-// @Param    page     query    int    false "页码"
-// @Param    pagesize query    int    false "每页条数"
+// @Param    page          query    int false "页码"
+// @Param    pagesize      query    int false "每页条数"
 // @Success  200      {array}  models.GzcjjcorderdetailM
 // @Failure  500           {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrderDetail [get]

+ 6 - 3
docs/docs.go

@@ -48312,9 +48312,12 @@ const docTemplate = `{
             "properties": {
                 "bank_infos": {
                     "description": "混合支付银行信息列表",
-                    "type": "array",
-                    "items": {
-                        "$ref": "#/definitions/models.Hybridbankinfo"
+                    "type": "object",
+                    "additionalProperties": {
+                        "type": "array",
+                        "items": {
+                            "$ref": "#/definitions/models.Hybridbankinfo"
+                        }
                     }
                 },
                 "can_amt_in": {

+ 6 - 3
docs/swagger.json

@@ -48303,9 +48303,12 @@
             "properties": {
                 "bank_infos": {
                     "description": "混合支付银行信息列表",
-                    "type": "array",
-                    "items": {
-                        "$ref": "#/definitions/models.Hybridbankinfo"
+                    "type": "object",
+                    "additionalProperties": {
+                        "type": "array",
+                        "items": {
+                            "$ref": "#/definitions/models.Hybridbankinfo"
+                        }
                     }
                 },
                 "can_amt_in": {

+ 5 - 3
docs/swagger.yaml

@@ -17901,10 +17901,12 @@ definitions:
   models.PaymentCenterHybridConfig:
     properties:
       bank_infos:
+        additionalProperties:
+          items:
+            $ref: '#/definitions/models.Hybridbankinfo'
+          type: array
         description: 混合支付银行信息列表
-        items:
-          $ref: '#/definitions/models.Hybridbankinfo'
-        type: array
+        type: object
       can_amt_in:
         description: 入金是否可用 0-不可用 1-可用
         type: integer

+ 9 - 4
models/bank.go

@@ -192,7 +192,7 @@ type PaymentCenterHybridConfig struct {
 	CAN_AMT_IN   int32  `json:"can_amt_in"`   // 入金是否可用 0-不可用 1-可用
 	CAN_AMT_OUT  int32  `json:"can_amt_out"`  // 出金是否可用 0-不可用 1-可用
 
-	BankInfos []Hybridbankinfo `json:"bank_infos"` // 混合支付银行信息列表
+	BankInfos map[string][]Hybridbankinfo `json:"bank_infos"` // 混合支付银行信息列表
 }
 
 func GetPaymentCenterHybridConfig() (paymentCenterHybridConfigs []PaymentCenterHybridConfig, err error) {
@@ -212,11 +212,16 @@ func GetPaymentCenterHybridConfig() (paymentCenterHybridConfigs []PaymentCenterH
 			CAN_AMT_OUT:  item.CAN_AMT_OUT,
 		}
 
-		hybridbankinfos := make([]Hybridbankinfo, 0)
-		if err = engine.Where("CHANNEL_CODE = ? AND IS_ENABLED = 1", item.CHANNEL_CODE).Find(&hybridbankinfos); err != nil {
+		datas := make([]Hybridbankinfo, 0)
+		if err = engine.Where("CHANNEL_CODE = ? AND IS_ENABLED = 1", item.CHANNEL_CODE).Find(&datas); err != nil {
 			return
 		}
-		paymentCenterHybridConfig.BankInfos = hybridbankinfos
+		m := make(map[string][]Hybridbankinfo)
+		for _, data := range datas {
+			m[data.METHOD_TYPE] = append(m[data.METHOD_TYPE], data)
+		}
+
+		paymentCenterHybridConfig.BankInfos = m
 
 		paymentCenterHybridConfigs = append(paymentCenterHybridConfigs, paymentCenterHybridConfig)
 	}