- redirect added.

This commit is contained in:
gazebo
2018-09-04 16:31:00 +08:00
parent 5966b397d0
commit 1dda77ee3a

View File

@@ -3,10 +3,10 @@ package controllers
import ( import (
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"net/http"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxcallback/auth/weixin" "git.rosy.net.cn/jx-callback/business/jxcallback/auth/weixin"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego" "github.com/astaxie/beego"
) )
@@ -32,7 +32,6 @@ func (c *WeiXinController) GetUserInfo() {
code := c.GetString("code") code := c.GetString("code")
block := c.GetString("block") block := c.GetString("block")
state := c.GetString("state") state := c.GetString("state")
str := ""
if block != "" { if block != "" {
if code != "" { if code != "" {
result, err2 := weixin.GetUserInfo(code, state) result, err2 := weixin.GetUserInfo(code, state)
@@ -46,9 +45,8 @@ func (c *WeiXinController) GetUserInfo() {
} else { } else {
retVal.Msg = "code为空" retVal.Msg = "code为空"
} }
c.Ctx.Output.Header("Location", fmt.Sprintf("%s?info=%s", block, base64.StdEncoding.EncodeToString(utils.MustMarshal(retVal))))
} else { } else {
str = "没有block" retVal.Msg = "没有block"
} }
globals.SugarLogger.Debug(str) c.Redirect(fmt.Sprintf("%s?info=%s", block, base64.StdEncoding.EncodeToString(utils.MustMarshal(retVal))), http.StatusTemporaryRedirect)
} }