|
@@ -22,11 +22,12 @@ func init() {
|
|
|
}
|
|
|
|
|
|
func (m *Mobile) Guide() error {
|
|
|
- m.T["shareData"] = getShareData(m.Url())
|
|
|
- return m.Render("/swordfish/wxindex.html")
|
|
|
+ m.T["signature"] = getSignature(m.Url())
|
|
|
+ return m.Render("/swordfish/wxindex.html", &m.T)
|
|
|
}
|
|
|
func (m *Mobile) Share() error {
|
|
|
- return m.Render("/swordfish/wxshare.html")
|
|
|
+ m.T["signature"] = getSignature(m.Url())
|
|
|
+ return m.Render("/swordfish/wxshare.html", &m.T)
|
|
|
}
|
|
|
|
|
|
func (m *Mobile) Wxrssset() error {
|
|
@@ -43,6 +44,7 @@ func (m *Mobile) Wxrssset() error {
|
|
|
}
|
|
|
}()
|
|
|
if m.Session().Get("userId") != nil {
|
|
|
+ m.T["signature"] = getSignature(m.Url())
|
|
|
userInfo := mongodb.FindById("user", m.GetSession("userId").(string), nil)
|
|
|
if i_m_guide := (*userInfo)["i_m_guide"]; util.IntAll(i_m_guide) == 0 {
|
|
|
mongodb.Update("user", `{"_id":"`+m.GetSession("userId").(string)+`"}`, map[string]interface{}{
|
|
@@ -71,7 +73,6 @@ func (m *Mobile) Wxrssset() error {
|
|
|
}
|
|
|
}
|
|
|
//m.T["mid"] = openid
|
|
|
- m.T["shareData"] = getShareData(m.Url())
|
|
|
return m.Render("/swordfish/wxrssset.html", &m.T)
|
|
|
} else {
|
|
|
return m.Render("_err.html")
|
|
@@ -243,7 +244,7 @@ func (m *Mobile) WxpushList(s_m_openid string, _id string, msgid string) error {
|
|
|
**/
|
|
|
m.T["data"] = *mongodb.FindById("wxpush", _id, `{"s_content":1,"s_words":1,"a_visitedindex":1,"a_publishtime":1,"s_type":1}`)
|
|
|
m.T["_id"] = _id
|
|
|
- m.T["shareData"] = getShareData(m.Url())
|
|
|
+ m.T["signature"] = getSignature(m.Url())
|
|
|
return m.Render("/swordfish/wxpush.html", &m.T)
|
|
|
}
|
|
|
|
|
@@ -254,17 +255,18 @@ func (m *Mobile) WxpushAjaxReq() error {
|
|
|
}, false, false)
|
|
|
return nil
|
|
|
}
|
|
|
-func getShareData(action string) []string {
|
|
|
+func getSignature(action string) []string {
|
|
|
url := coreconfig.SysConfig.DomainName + action
|
|
|
- log.Println(url)
|
|
|
- var shareData []string
|
|
|
- if ret := redis.Get("other", "signature-"+url); ret != nil {
|
|
|
- if d, err := json.Marshal(ret); err != nil || json.Unmarshal(d, &shareData) != nil {
|
|
|
- shareData = coreutil.GetJSInterfaceParam(url)
|
|
|
+ var signature []string
|
|
|
+ if ret := redis.Get("other", "wxshare-"+url); ret != nil {
|
|
|
+ if d, err := json.Marshal(ret); err == nil {
|
|
|
+ json.Unmarshal(d, &signature)
|
|
|
}
|
|
|
- } else {
|
|
|
- shareData = coreutil.GetJSInterfaceParam(url)
|
|
|
- redis.Put("other", "signature-"+url, shareData, 60*1000)
|
|
|
}
|
|
|
- return shareData
|
|
|
+ if len(signature) == 0 {
|
|
|
+ signature = coreutil.GetJSInterfaceParam(url)
|
|
|
+ redis.Put("other", "wxshare-"+url, signature, 60*1000)
|
|
|
+ }
|
|
|
+ log.Println(url, "------", signature)
|
|
|
+ return signature
|
|
|
}
|