Commit c3ee99b0 authored by duanjinfei's avatar duanjinfei

change return json struct

parent 9d015429
Pipeline #655 canceled with stages
...@@ -13,10 +13,10 @@ func (d *BaseController) ResponseInfo(code int, msg interface{}, result interfac ...@@ -13,10 +13,10 @@ func (d *BaseController) ResponseInfo(code int, msg interface{}, result interfac
switch code { switch code {
case 500: case 500:
logs.Error(msg, result) logs.Error(msg, result)
d.Data["json"] = map[string]interface{}{"code": "500", "msg": msg, "data": result} d.Data["json"] = result
case 200: case 200:
logs.Info(msg, result) logs.Info(msg, result)
d.Data["json"] = map[string]interface{}{"code": "200", "msg": msg, "data": result} d.Data["json"] = result
} }
d.ServeJSON() d.ServeJSON()
} }
...@@ -15,23 +15,23 @@ type TokenController struct { ...@@ -15,23 +15,23 @@ type TokenController struct {
func (c *TokenController) GetTokenUri() { func (c *TokenController) GetTokenUri() {
param := c.Ctx.Input.Param(":file") param := c.Ctx.Input.Param(":file")
if param == "" { if param == "" {
c.ResponseInfo(500, "Param invalid failed", nil) c.ResponseInfo(500, "Param invalid failed", "Param invalid failed")
return return
} }
split := strings.Split(param, ".") split := strings.Split(param, ".")
if len(split) != 2 { if len(split) != 2 {
c.ResponseInfo(500, "Param invalid failed", nil) c.ResponseInfo(500, "Param invalid failed", "Param invalid failed")
return return
} }
tokenIdStr := split[0] tokenIdStr := split[0]
tokenIdInt64, err := strconv.ParseInt(tokenIdStr, 10, 64) tokenIdInt64, err := strconv.ParseInt(tokenIdStr, 10, 64)
if err != nil { if err != nil {
c.ResponseInfo(500, "Param invalid failed", nil) c.ResponseInfo(500, "Param invalid failed", "Param invalid failed")
return return
} }
suffix := split[1] suffix := split[1]
if suffix != "json" { if suffix != "json" {
c.ResponseInfo(500, "Param invalid failed", nil) c.ResponseInfo(500, "Param invalid failed", "Param invalid failed")
return return
} }
imageUri := beego.AppConfig.String("imageUri") imageUri := beego.AppConfig.String("imageUri")
......
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