Jelajahi Sumber

/Wallet/QueryWalletTokens 接口增加 require_memo了出参

muchinfo 2 minggu lalu
induk
melakukan
a46a13965a
6 mengubah file dengan 236 tambahan dan 11 penghapusan
  1. 4 4
      controllers/guangzuan/tradeService.go
  2. 1 1
      controllers/wallet/chain.go
  3. 74 1
      docs/docs.go
  4. 74 1
      docs/swagger.json
  5. 55 1
      docs/swagger.yaml
  6. 28 3
      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]

+ 1 - 1
controllers/wallet/chain.go

@@ -51,7 +51,7 @@ type QueryWalletTokensReq struct {
 // @Produce  json
 // @Security ApiKeyAuth
 // @Param       currency query    string true "币种代码"
-// @Success     200      {array}  models.Wallettokens
+// @Success     200      {array}  models.WalletChaintokens
 // @Failure  500         {object} app.Response
 // @Router      /Wallet/QueryWalletTokens [get]
 // @Tags     钱包

+ 74 - 1
docs/docs.go

@@ -21505,7 +21505,7 @@ const docTemplate = `{
                         "schema": {
                             "type": "array",
                             "items": {
-                                "$ref": "#/definitions/models.Wallettokens"
+                                "$ref": "#/definitions/models.WalletChaintokens"
                             }
                         }
                     },
@@ -61941,6 +61941,79 @@ const docTemplate = `{
                 }
             }
         },
+        "models.WalletChaintokens": {
+            "type": "object",
+            "properties": {
+                "asset_id": {
+                    "description": "资产 ID,关联交易所账户中持有资产的唯一标识符",
+                    "type": "string"
+                },
+                "asset_model_type": {
+                    "description": "模型类型",
+                    "type": "string"
+                },
+                "can_deposit": {
+                    "description": "是否可以充值",
+                    "type": "integer"
+                },
+                "can_withdraw": {
+                    "description": "是否可以提现",
+                    "type": "integer"
+                },
+                "chain_id": {
+                    "description": "所属链ID",
+                    "type": "string"
+                },
+                "channel_code": {
+                    "description": "渠道ID",
+                    "type": "string"
+                },
+                "deposit_threshold": {
+                    "description": "最低充值金额",
+                    "type": "string"
+                },
+                "dust_threshold": {
+                    "description": "最低提现金额",
+                    "type": "string"
+                },
+                "enabled": {
+                    "description": "是否可用,0-不可用;1-可用",
+                    "type": "integer"
+                },
+                "fee_token_id": {
+                    "description": "手续费代币ID",
+                    "type": "string"
+                },
+                "icon_url": {
+                    "description": "代币图标URL",
+                    "type": "string"
+                },
+                "id": {
+                    "description": "SEQ_WALLET_TOKENS",
+                    "type": "integer"
+                },
+                "name": {
+                    "description": "代币全名",
+                    "type": "string"
+                },
+                "require_memo": {
+                    "description": "该链条是否需要备注",
+                    "type": "integer"
+                },
+                "symbol": {
+                    "description": "代币符号",
+                    "type": "string"
+                },
+                "token_decimal": {
+                    "description": "小数位",
+                    "type": "integer"
+                },
+                "token_id": {
+                    "description": "代币ID",
+                    "type": "string"
+                }
+            }
+        },
         "models.Wallettokens": {
             "type": "object",
             "properties": {

+ 74 - 1
docs/swagger.json

@@ -21496,7 +21496,7 @@
                         "schema": {
                             "type": "array",
                             "items": {
-                                "$ref": "#/definitions/models.Wallettokens"
+                                "$ref": "#/definitions/models.WalletChaintokens"
                             }
                         }
                     },
@@ -61932,6 +61932,79 @@
                 }
             }
         },
+        "models.WalletChaintokens": {
+            "type": "object",
+            "properties": {
+                "asset_id": {
+                    "description": "资产 ID,关联交易所账户中持有资产的唯一标识符",
+                    "type": "string"
+                },
+                "asset_model_type": {
+                    "description": "模型类型",
+                    "type": "string"
+                },
+                "can_deposit": {
+                    "description": "是否可以充值",
+                    "type": "integer"
+                },
+                "can_withdraw": {
+                    "description": "是否可以提现",
+                    "type": "integer"
+                },
+                "chain_id": {
+                    "description": "所属链ID",
+                    "type": "string"
+                },
+                "channel_code": {
+                    "description": "渠道ID",
+                    "type": "string"
+                },
+                "deposit_threshold": {
+                    "description": "最低充值金额",
+                    "type": "string"
+                },
+                "dust_threshold": {
+                    "description": "最低提现金额",
+                    "type": "string"
+                },
+                "enabled": {
+                    "description": "是否可用,0-不可用;1-可用",
+                    "type": "integer"
+                },
+                "fee_token_id": {
+                    "description": "手续费代币ID",
+                    "type": "string"
+                },
+                "icon_url": {
+                    "description": "代币图标URL",
+                    "type": "string"
+                },
+                "id": {
+                    "description": "SEQ_WALLET_TOKENS",
+                    "type": "integer"
+                },
+                "name": {
+                    "description": "代币全名",
+                    "type": "string"
+                },
+                "require_memo": {
+                    "description": "该链条是否需要备注",
+                    "type": "integer"
+                },
+                "symbol": {
+                    "description": "代币符号",
+                    "type": "string"
+                },
+                "token_decimal": {
+                    "description": "小数位",
+                    "type": "integer"
+                },
+                "token_id": {
+                    "description": "代币ID",
+                    "type": "string"
+                }
+            }
+        },
         "models.Wallettokens": {
             "type": "object",
             "properties": {

+ 55 - 1
docs/swagger.yaml

@@ -27469,6 +27469,60 @@ definitions:
           $ref: '#/definitions/models.Wallettokens'
         type: array
     type: object
+  models.WalletChaintokens:
+    properties:
+      asset_id:
+        description: 资产 ID,关联交易所账户中持有资产的唯一标识符
+        type: string
+      asset_model_type:
+        description: 模型类型
+        type: string
+      can_deposit:
+        description: 是否可以充值
+        type: integer
+      can_withdraw:
+        description: 是否可以提现
+        type: integer
+      chain_id:
+        description: 所属链ID
+        type: string
+      channel_code:
+        description: 渠道ID
+        type: string
+      deposit_threshold:
+        description: 最低充值金额
+        type: string
+      dust_threshold:
+        description: 最低提现金额
+        type: string
+      enabled:
+        description: 是否可用,0-不可用;1-可用
+        type: integer
+      fee_token_id:
+        description: 手续费代币ID
+        type: string
+      icon_url:
+        description: 代币图标URL
+        type: string
+      id:
+        description: SEQ_WALLET_TOKENS
+        type: integer
+      name:
+        description: 代币全名
+        type: string
+      require_memo:
+        description: 该链条是否需要备注
+        type: integer
+      symbol:
+        description: 代币符号
+        type: string
+      token_decimal:
+        description: 小数位
+        type: integer
+      token_id:
+        description: 代币ID
+        type: string
+    type: object
   models.Wallettokens:
     properties:
       asset_id:
@@ -46562,7 +46616,7 @@ paths:
           description: OK
           schema:
             items:
-              $ref: '#/definitions/models.Wallettokens'
+              $ref: '#/definitions/models.WalletChaintokens'
             type: array
         "500":
           description: Internal Server Error

+ 28 - 3
models/wallet.go

@@ -84,8 +84,33 @@ func GetWalletChains(channelCode string) ([]WalletChainRsp, error) {
 	return rsp, nil
 }
 
-func GetWalletTokens(currency string) ([]Wallettokens, error) {
-	rsp := make([]Wallettokens, 0)
-	err := db.GetEngine().Where("SYMBOL = ?", currency).Find(&rsp)
+// WalletChaintokens 数字钱包代币信息表
+type WalletChaintokens struct {
+	ID                int32  `json:"id" xorm:"ID"`                               // SEQ_WALLET_TOKENS
+	CHANNEL_CODE      string `json:"channel_code" xorm:"CHANNEL_CODE"`           // 渠道ID
+	CHAIN_ID          string `json:"chain_id" xorm:"CHAIN_ID"`                   // 所属链ID
+	TOKEN_ID          string `json:"token_id" xorm:"TOKEN_ID"`                   // 代币ID
+	ASSET_ID          string `json:"asset_id" xorm:"ASSET_ID"`                   // 资产 ID,关联交易所账户中持有资产的唯一标识符
+	SYMBOL            string `json:"symbol" xorm:"SYMBOL"`                       // 代币符号
+	NAME              string `json:"name" xorm:"NAME"`                           // 代币全名
+	TOKEN_DECIMAL     int32  `json:"token_decimal" xorm:"TOKEN_DECIMAL"`         // 小数位
+	ICON_URL          string `json:"icon_url" xorm:"ICON_URL"`                   // 代币图标URL
+	FEE_TOKEN_ID      string `json:"fee_token_id" xorm:"FEE_TOKEN_ID"`           // 手续费代币ID
+	CAN_DEPOSIT       int32  `json:"can_deposit" xorm:"CAN_DEPOSIT"`             // 是否可以充值
+	CAN_WITHDRAW      int32  `json:"can_withdraw" xorm:"CAN_WITHDRAW"`           // 是否可以提现
+	DUST_THRESHOLD    string `json:"dust_threshold" xorm:"DUST_THRESHOLD"`       // 最低提现金额
+	DEPOSIT_THRESHOLD string `json:"deposit_threshold" xorm:"DEPOSIT_THRESHOLD"` // 最低充值金额
+	ASSET_MODEL_TYPE  string `json:"asset_model_type" xorm:"ASSET_MODEL_TYPE"`   // 模型类型
+	ENABLED           int32  `json:"enabled" xorm:"ENABLED"`                     // 是否可用,0-不可用;1-可用
+
+	REQUIRE_MEMO int32 `json:"require_memo" xorm:"REQUIRE_MEMO"` // 该链条是否需要备注
+}
+
+func GetWalletTokens(currency string) ([]WalletChaintokens, error) {
+	rsp := make([]WalletChaintokens, 0)
+	err := db.GetEngine().
+		Table("WALLET_TOKENS T").
+		Select("T.*, C.REQUIRE_MEMO").Join("LEFT", "WALLET_CHAINS C", "T.CHANNEL_CODE = C.CHANNEL_CODE AND T.CHAIN_ID = C.CHAIN_ID").
+		Where("T.SYMBOL = ?", currency).Find(&rsp)
 	return rsp, err
 }