wangfei 6 years ago
parent
commit
2757d1ccf4
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      controllers/component.go

+ 5
- 2
controllers/component.go View File

204
 
204
 
205
 // GetPreAuthCode 获取预授权码
205
 // GetPreAuthCode 获取预授权码
206
 func (c *WechatController) GetPreAuthCode() {
206
 func (c *WechatController) GetPreAuthCode() {
207
-	beego.Error(utils.Component.GetToken())
208
 	code, err := utils.Component.GetPreAuthCode()
207
 	code, err := utils.Component.GetPreAuthCode()
209
 	if err != nil {
208
 	if err != nil {
210
 		utils.LogError("获取预授权码错误: " + err.Error())
209
 		utils.LogError("获取预授权码错误: " + err.Error())
211
 		c.ResponseError(err)
210
 		c.ResponseError(err)
212
 	}
211
 	}
213
-	c.ResponseJSON(code)
212
+	appid := utils.Component.GetCertificate()["appid"]
213
+	c.ResponseJSON(map[string]string{
214
+		"appid": appid,
215
+		"code":  code,
216
+	})
214
 }
217
 }