|
@@ -7,6 +7,7 @@ import (
|
|
|
"github.com/silenceper/wechat/v2/credential"
|
|
|
"github.com/silenceper/wechat/v2/officialaccount"
|
|
|
"github.com/silenceper/wechat/v2/officialaccount/config"
|
|
|
+ "github.com/silenceper/wechat/v2/officialaccount/js"
|
|
|
"github.com/silenceper/wechat/v2/officialaccount/user"
|
|
|
"hongze/hongze_yb/global"
|
|
|
"hongze/hongze_yb/models/tables/wx_token"
|
|
@@ -34,7 +35,7 @@ var (
|
|
|
WxPublicSecretXzs string //查研观向小助手公众号
|
|
|
)
|
|
|
|
|
|
-func init() {
|
|
|
+func initConf() {
|
|
|
if global.CONFIG.Serve.RunMode == "debug" {
|
|
|
WxAppId = "wx9b5d7291e581233a"
|
|
|
WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
|
|
@@ -50,22 +51,24 @@ func init() {
|
|
|
|
|
|
WxMsgTemplateIdAskByUser = `qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo`
|
|
|
} else {
|
|
|
- //WxAppId = "wx4a844c734d8c8e56"
|
|
|
- //WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
|
|
|
- //WxId = "gh_b67e0049fb8c"
|
|
|
- //TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84"
|
|
|
- //TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id="
|
|
|
- //DayReportTemplateRedirectUrl = "https://report.hzinsights.com/#/allindex/" //晨报模板跳转url
|
|
|
- //TemplateIdByCompanyApply = "ZKcOfNIWBpwHJxpptufHIK1mp2nIwkT3cxub-35cFqI"
|
|
|
- //TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list"
|
|
|
- //WxMsgTemplateIdActivityChangeApply = "dYg6iHooRq74PyCXmw_Ns7qdJZmbtLoKS2p2FKeaXl0"
|
|
|
- ////销售跨部门领取客户通知
|
|
|
- //TemplateIdByCompanyReceive = "A5fV-XWBcu-LIj_W-tBiOJ-D39a9WDd9GOB0WGbpoBg"
|
|
|
- //TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list"
|
|
|
+ WxAppId = "wx4a844c734d8c8e56"
|
|
|
+ WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
|
|
|
+ WxId = "gh_b67e0049fb8c"
|
|
|
+ TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84"
|
|
|
+ TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id="
|
|
|
+ DayReportTemplateRedirectUrl = "https://report.hzinsights.com/#/allindex/" //晨报模板跳转url
|
|
|
+ TemplateIdByCompanyApply = "ZKcOfNIWBpwHJxpptufHIK1mp2nIwkT3cxub-35cFqI"
|
|
|
+ TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list"
|
|
|
+ WxMsgTemplateIdActivityChangeApply = "dYg6iHooRq74PyCXmw_Ns7qdJZmbtLoKS2p2FKeaXl0"
|
|
|
+ //销售跨部门领取客户通知
|
|
|
+ TemplateIdByCompanyReceive = "A5fV-XWBcu-LIj_W-tBiOJ-D39a9WDd9GOB0WGbpoBg"
|
|
|
+ TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func GetWxChat() (officialAccount *officialaccount.OfficialAccount) {
|
|
|
+ initConf() //初始化参数
|
|
|
+
|
|
|
wc := wechat.NewWechat()
|
|
|
memory := cache.NewMemory()
|
|
|
conf := &config.Config{
|
|
@@ -90,6 +93,14 @@ func GetUserInfo(openid string) (userInfo *user.Info, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// GetJsConfig 获取公众号jsConfig
|
|
|
+func GetJsConfig(signUrl string) (jsConf *js.Config, err error) {
|
|
|
+ wechatClient := GetWxChat()
|
|
|
+ j := wechatClient.GetJs()
|
|
|
+ jsConf, err = j.GetConfig(signUrl)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
type WechatAccessToken struct {
|
|
|
}
|
|
|
|