| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package wallet
- import (
- "mtp2_if/global/app"
- "mtp2_if/global/e"
- "mtp2_if/logger"
- "mtp2_if/models"
- "net/http"
- "github.com/gin-gonic/gin"
- )
- type QueryWalletChainsReq struct {
- ChannelCode string `form:"channelCode" binding:"required"` // 渠道代码
- }
- // QueryWalletChains
- // @Summary 查询钱包链
- // @Produce json
- // @Security ApiKeyAuth
- // @Param channelCode query string true "渠道代码"
- // @Success 200 {array} models.WalletChainRsp
- // @Failure 500 {object} app.Response
- // @Router /Wallet/QueryWalletChains [get]
- // @Tags 钱包
- func QueryWalletChains(c *gin.Context) {
- appG := app.Gin{C: c}
- // 获取请求参数
- var req QueryWalletChainsReq
- if err := appG.C.ShouldBindQuery(&req); err != nil {
- logger.GetLogger().Errorf("QueryWalletChains failed: %s", err.Error())
- appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
- return
- }
- if rsp, err := models.GetWalletChains(req.ChannelCode); err == nil {
- appG.Response(http.StatusOK, e.SUCCESS, rsp)
- } else {
- appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
- }
- }
|