소스 검색

/Wallet/QueryWalletAddress 查询钱包地址接口变更

muchinfo 3 주 전
부모
커밋
c24a812b17
6개의 변경된 파일116개의 추가작업 그리고 71개의 파일을 삭제
  1. 4 4
      controllers/guangzuan/tradeService.go
  2. 12 8
      controllers/wallet/address.go
  3. 27 12
      docs/docs.go
  4. 27 12
      docs/swagger.json
  5. 21 11
      docs/swagger.yaml
  6. 25 24
      models/wallet.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]

+ 12 - 8
controllers/wallet/address.go

@@ -8,14 +8,18 @@ import (
 )
 
 // QueryWalletAddress
-// @Summary  查询钱包地址
-// @Produce  json
-// @Security ApiKeyAuth
-// @Param    digitalaccountid query    int true "数字账户ID"
-// @Success  200              {array}  models.DigitalWalletAddress
-// @Failure  500              {object} app.Response
-// @Router   /Wallet/QueryWalletAddress [get]
-// @Tags     钱包
+// @Summary     查询钱包地址
+// @Description /Wallet/QueryWalletAddress 查询钱包地址
+// @Produce     json
+// @Security    ApiKeyAuth
+// @Param       userid       query    int    true  "用户ID"
+// @Param       channel_code query    string false "渠道代码"
+// @Param       addr_type    query    int    false "地址类型:1-充值;2-提现"
+// @Param       chain_id     query    string false "链代码"
+// @Success     200          {array}  models.DigitalWalletAddress
+// @Failure     500          {object} app.Response
+// @Router      /Wallet/QueryWalletAddress [get]
+// @Tags        钱包
 func QueryWalletAddress(c *gin.Context) {
 	a := app.GinUtils{Gin: app.Gin{C: c}}
 	m := models.DigitalWalletAddress{}

+ 27 - 12
docs/docs.go

@@ -21305,6 +21305,7 @@ const docTemplate = `{
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "/Wallet/QueryWalletAddress 查询钱包地址",
                 "produces": [
                     "application/json"
                 ],
@@ -21315,10 +21316,28 @@ const docTemplate = `{
                 "parameters": [
                     {
                         "type": "integer",
-                        "description": "数字账户ID",
-                        "name": "digitalaccountid",
+                        "description": "户ID",
+                        "name": "userid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "渠道代码",
+                        "name": "channel_code",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "地址类型:1-充值;2-提现",
+                        "name": "addr_type",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "链代码",
+                        "name": "chain_id",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -31537,7 +31556,7 @@ const docTemplate = `{
         "models.DigitalWalletAddress": {
             "type": "object",
             "required": [
-                "digitalaccountid"
+                "userid"
             ],
             "properties": {
                 "addr_type": {
@@ -31560,10 +31579,6 @@ const docTemplate = `{
                     "description": "创建时间",
                     "type": "string"
                 },
-                "digitalaccountid": {
-                    "description": "数字账户ID",
-                    "type": "integer"
-                },
                 "id": {
                     "description": "地址ID",
                     "type": "integer"
@@ -31576,13 +31591,13 @@ const docTemplate = `{
                     "description": "状态:0-禁用;1-启用",
                     "type": "integer"
                 },
-                "token_id": {
-                    "description": "代币ID(充值类型必填)",
+                "tag": {
+                    "description": "标签",
                     "type": "string"
                 },
-                "update_time": {
-                    "description": "修改时间",
-                    "type": "string"
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
                 }
             }
         },

+ 27 - 12
docs/swagger.json

@@ -21296,6 +21296,7 @@
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "/Wallet/QueryWalletAddress 查询钱包地址",
                 "produces": [
                     "application/json"
                 ],
@@ -21306,10 +21307,28 @@
                 "parameters": [
                     {
                         "type": "integer",
-                        "description": "数字账户ID",
-                        "name": "digitalaccountid",
+                        "description": "户ID",
+                        "name": "userid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "渠道代码",
+                        "name": "channel_code",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "地址类型:1-充值;2-提现",
+                        "name": "addr_type",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "链代码",
+                        "name": "chain_id",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -31528,7 +31547,7 @@
         "models.DigitalWalletAddress": {
             "type": "object",
             "required": [
-                "digitalaccountid"
+                "userid"
             ],
             "properties": {
                 "addr_type": {
@@ -31551,10 +31570,6 @@
                     "description": "创建时间",
                     "type": "string"
                 },
-                "digitalaccountid": {
-                    "description": "数字账户ID",
-                    "type": "integer"
-                },
                 "id": {
                     "description": "地址ID",
                     "type": "integer"
@@ -31567,13 +31582,13 @@
                     "description": "状态:0-禁用;1-启用",
                     "type": "integer"
                 },
-                "token_id": {
-                    "description": "代币ID(充值类型必填)",
+                "tag": {
+                    "description": "标签",
                     "type": "string"
                 },
-                "update_time": {
-                    "description": "修改时间",
-                    "type": "string"
+                "userid": {
+                    "description": "用户ID",
+                    "type": "integer"
                 }
             }
         },

+ 21 - 11
docs/swagger.yaml

@@ -4960,9 +4960,6 @@ definitions:
       create_time:
         description: 创建时间
         type: string
-      digitalaccountid:
-        description: 数字账户ID
-        type: integer
       id:
         description: 地址ID
         type: integer
@@ -4972,14 +4969,14 @@ definitions:
       status:
         description: 状态:0-禁用;1-启用
         type: integer
-      token_id:
-        description: 代币ID(充值类型必填)
-        type: string
-      update_time:
-        description: 修改时间
+      tag:
+        description: 标签
         type: string
+      userid:
+        description: 用户ID
+        type: integer
     required:
-    - digitalaccountid
+    - userid
     type: object
   models.DigitaltradeOrderdetail:
     properties:
@@ -46351,12 +46348,25 @@ paths:
       - 仓单贸易
   /Wallet/QueryWalletAddress:
     get:
+      description: /Wallet/QueryWalletAddress 查询钱包地址
       parameters:
-      - description: 数字账户ID
+      - description: 户ID
         in: query
-        name: digitalaccountid
+        name: userid
         required: true
         type: integer
+      - description: 渠道代码
+        in: query
+        name: channel_code
+        type: string
+      - description: 地址类型:1-充值;2-提现
+        in: query
+        name: addr_type
+        type: integer
+      - description: 链代码
+        in: query
+        name: chain_id
+        type: string
       produces:
       - application/json
       responses:

+ 25 - 24
models/wallet.go

@@ -7,17 +7,16 @@ import (
 )
 
 type DigitalWalletAddress struct {
-	ID               int64     `json:"id" xorm:"ID"`                                                                        // 地址ID
-	DIGITALACCOUNTID int64     `json:"digitalaccountid" xorm:"DIGITALACCOUNTID" form:"digitalaccountid" binding:"required"` // 数字账户ID
-	CHANNEL_CODE     string    `json:"channel_code" xorm:"CHANNEL_CODE"`                                                    // 渠道代码
-	ADDR_TYPE        int32     `json:"addr_type" xorm:"ADDR_TYPE"`                                                          // 地址类型:1-充值;2-提现
-	CHAIN_ID         string    `json:"chain_id" xorm:"CHAIN_ID"`                                                            // 链代码(如BTC,ETH)
-	ADDRESS          string    `json:"address" xorm:"ADDRESS"`                                                              // 区块链地址
-	MEMO             string    `json:"memo" xorm:"MEMO"`                                                                    // 地址备注(某些链需要)
-	STATUS           int32     `json:"status" xorm:"STATUS"`                                                                // 状态:0-禁用;1-启用
-	CREATE_TIME      time.Time `json:"create_time" xorm:"CREATE_TIME"`                                                      // 创建时间
-	UPDATE_TIME      time.Time `json:"update_time" xorm:"UPDATE_TIME"`                                                      // 修改时间
-	TOKEN_ID         string    `json:"token_id" xorm:"TOKEN_ID"`                                                            // 代币ID(充值类型必填)
+	ID           int64      `json:"id" xorm:"ID"`                                          // 地址ID
+	USERID       int64      `json:"userid" xorm:"USERID" form:"userid" binding:"required"` // 用户ID
+	CHANNEL_CODE string     `json:"channel_code" xorm:"CHANNEL_CODE" form:"channel_code"`  // 渠道代码
+	ADDR_TYPE    int32      `json:"addr_type" xorm:"ADDR_TYPE"  form:"addr_type"`          // 地址类型:1-充值;2-提现
+	CHAIN_ID     string     `json:"chain_id" xorm:"CHAIN_ID"  form:"chain_id"`             // 链代码(如BTC,ETH)
+	ADDRESS      string     `json:"address" xorm:"ADDRESS"`                                // 区块链地址
+	MEMO         string     `json:"memo" xorm:"MEMO"`                                      // 地址备注(某些链需要)
+	STATUS       int32      `json:"status" xorm:"STATUS"`                                  // 状态:0-禁用;1-启用
+	CREATE_TIME  *time.Time `json:"create_time" xorm:"CREATE_TIME"`                        // 创建时间
+	TAG          string     `json:"tag" xorm:"TAG"`                                        // 标签
 }
 
 func (r *DigitalWalletAddress) calc() {
@@ -27,21 +26,23 @@ func (r *DigitalWalletAddress) calc() {
 func (r *DigitalWalletAddress) buildSql() string {
 	var sqlId utils.SQLVal = `
 	SELECT 
-		t.ID              ,
-		t.DIGITALACCOUNTID,
-		t.CHANNEL_CODE    ,
-		t.ADDR_TYPE       ,
-		t.CHAIN_ID        ,
-		t.ADDRESS         ,
-		t.MEMO            ,
-		t.STATUS          ,
-		t.CREATE_TIME     ,
-		t.UPDATE_TIME     ,
-		t.TOKEN_ID        
+		t.ID          ,
+		t.USERID      ,
+		t.CHANNEL_CODE,
+		t.ADDR_TYPE   ,
+		t.CHAIN_ID    ,
+		t.ADDRESS     ,
+		t.MEMO        ,
+		t.STATUS      ,
+		t.CREATE_TIME ,
+		t.TAG         
 	FROM WALLET_ADDRESS t 
-	WHERE t.DIGITALACCOUNTID = %v  
+	WHERE t.USERID = %v  
 	`
-	sqlId.FormatParam(r.DIGITALACCOUNTID)
+	sqlId.FormatParam(r.USERID)
+	sqlId.AndEx("t.CHANNEL_CODE", r.CHANNEL_CODE, r.CHANNEL_CODE != "")
+	sqlId.AndEx("t.ADDR_TYPE", r.ADDR_TYPE, r.ADDR_TYPE != 0)
+	sqlId.AndEx("t.CHAIN_ID", r.CHAIN_ID, r.CHAIN_ID != "")
 
 	return sqlId.String()
 }