优化小程序
This commit is contained in:
1 parent
2e2b837a20
commit
727319a6eb
24 files changed
+1509
-200
No files matched your search
@@ -163,20 +163,30 @@ func (c *PlatformWechatMpController) TestConnection() {
|
||||
c.jsonErr(400, 400, "请先保存 AppID 与 AppSecret")
|
||||
return
|
||||
}
|
||||
// 出口 IP 一并返回:40164(IP 不在白名单)时管理员可直接复制去微信后台配置
|
||||
outboundIP := wechatmp.OutboundIP()
|
||||
token, err := wechatmp.GetAccessToken(cfg)
|
||||
if err != nil {
|
||||
msg := "连接失败:" + err.Error()
|
||||
if hint, ok := wechatmp.ExplainError(err); ok {
|
||||
msg += ";" + hint
|
||||
}
|
||||
if outboundIP != "" {
|
||||
msg += ";本服务器出口 IP:" + outboundIP
|
||||
}
|
||||
c.jsonErr(400, 400, msg)
|
||||
return
|
||||
}
|
||||
msg := "连接成功:AppID 与 AppSecret 校验通过"
|
||||
if outboundIP != "" {
|
||||
msg += "(本服务器出口 IP:" + outboundIP + ")"
|
||||
}
|
||||
c.ok(map[string]interface{}{
|
||||
"access_token_suffix": wechatmp.MaskSecret(token),
|
||||
"callback_url": wechatmp.CallbackURL(),
|
||||
"verified": boolToInt8(cfg.Verified),
|
||||
}, "连接成功:AppID 与 AppSecret 校验通过")
|
||||
"outbound_ip": outboundIP,
|
||||
}, msg)
|
||||
}
|
||||
|
||||
// ============================ 绑定(当前平台用户) ============================
|
||||
|
||||
Reference in new issue
Block a user