|
@@ -11,6 +11,7 @@ import (
|
11
|
11
|
"wechat-conf/service/wechat"
|
12
|
12
|
"wechat-conf/utils"
|
13
|
13
|
|
|
14
|
+ "github.com/astaxie/beego/config"
|
14
|
15
|
"github.com/kinisky564477/wechat/component"
|
15
|
16
|
|
16
|
17
|
"github.com/zjxpcyc/wechat/core"
|
|
@@ -43,8 +44,12 @@ func (c *WechatController) ComponentPush() {
|
43
|
44
|
r := c.Ctx.Request
|
44
|
45
|
defer r.Body.Close()
|
45
|
46
|
con, _ := ioutil.ReadAll(r.Body)
|
|
47
|
+ conf, err := config.NewConfig("ini", utils.GetAppRoot()+"/conf/wechat.conf")
|
|
48
|
+ if err != nil {
|
|
49
|
+ utils.LogError("读取微信配置文件失败")
|
|
50
|
+ }
|
46
|
51
|
|
47
|
|
- EncodingAESKey := "key"
|
|
52
|
+ EncodingAESKey := conf.String("wechat::aeskey")
|
48
|
53
|
|
49
|
54
|
AESKey, err := base64.StdEncoding.DecodeString(EncodingAESKey + "=")
|
50
|
55
|
if err != nil {
|
|
@@ -68,6 +73,7 @@ func (c *WechatController) ComponentPush() {
|
68
|
73
|
utils.LogError("msgxml解析失败:", err)
|
69
|
74
|
c.ResponseRaw([]byte(""))
|
70
|
75
|
}
|
|
76
|
+ utils.LogError("接收微信推送消息:", msg)
|
71
|
77
|
switch msg["InfoType"] {
|
72
|
78
|
case INFOTYPE_TICKET:
|
73
|
79
|
// 更新ticket
|
|
@@ -177,6 +183,7 @@ func (c *WechatController) getReplayMessage(replay *model.TaAutoReply, openid st
|
177
|
183
|
|
178
|
184
|
// GetPreAuthCode 获取预授权码
|
179
|
185
|
func (c *WechatController) GetPreAuthCode() {
|
|
186
|
+ utils.LogError(utils.Component.GetToken())
|
180
|
187
|
code, err := utils.Component.GetPreAuthCode()
|
181
|
188
|
if err != nil {
|
182
|
189
|
utils.LogError("获取预授权码错误: " + err.Error())
|