Commit 47b34408 authored by shajiaiming's avatar shajiaiming

fix

parent 298c6471
......@@ -53,13 +53,44 @@ func GetCoin(c *gin.Context) {
}
func GetUserChains(c *gin.Context) {
data := make(map[string]interface{})
token := c.Request.Header.Get("Token")
authService := auth_service.Auth{Token: token}
auth, _ := authService.GetUserInfo()
group := auth.Group
coinService := coin_service.Coin{}
if ("administrator" != group) {
platformChainService := platform_chain_service.PlatformChain{
PlatformId: auth.PlatformId,
IsPrimary: 1,
}
platform_chain, err := platformChainService.GetAll()
if err != nil {
handler.SendResponse(c, errno.InternalServerError, nil)
return
}
var platform string
for _, val := range platform_chain {
if nil != val.ChainInfo {
platform = val.ChainInfo.Platform
}
}
if "" == platform {
data["items"] = nil
data["total"] = 0
handler.SendResponse(c, nil, data)
return
}
coinService.Platform = platform
}
platforms, err := coinService.GetAllPlatform()
if err != nil {
handler.SendResponse(c, errno.InternalServerError, nil)
return
}
data := make(map[string]interface{})
data["items"] = platforms
data["total"] = len(platforms)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment