|
@@ -5,24 +5,24 @@ import (
|
|
|
"fmt"
|
|
|
"log"
|
|
|
"math/rand"
|
|
|
+ "qfw/coreconfig"
|
|
|
"qfw/coreutil"
|
|
|
"qfw/util"
|
|
|
"qfw/util/consts"
|
|
|
"qfw/util/mongodb"
|
|
|
+ "qfw/util/redis"
|
|
|
"runtime"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
var se util.SimpleEncrypt
|
|
|
|
|
|
-const ShareUrl string = "http://www.qimingxing.info/swordfish/share"
|
|
|
-
|
|
|
func init() {
|
|
|
se = util.SimpleEncrypt{Key: "topnet"}
|
|
|
}
|
|
|
|
|
|
func (m *Mobile) Guide() error {
|
|
|
- m.T["shareData"] = coreutil.GetJSInterfaceParam(ShareUrl)
|
|
|
+ m.T["shareData"] = getShareData(m.Url())
|
|
|
return m.Render("/swordfish/wxindex.html")
|
|
|
}
|
|
|
func (m *Mobile) Share() error {
|
|
@@ -71,7 +71,7 @@ func (m *Mobile) Wxrssset() error {
|
|
|
}
|
|
|
}
|
|
|
//m.T["mid"] = openid
|
|
|
- m.T["shareData"] = coreutil.GetJSInterfaceParam(ShareUrl)
|
|
|
+ m.T["shareData"] = getShareData(m.Url())
|
|
|
return m.Render("/swordfish/wxrssset.html", &m.T)
|
|
|
} else {
|
|
|
return m.Render("_err.html")
|
|
@@ -243,7 +243,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"] = coreutil.GetJSInterfaceParam(ShareUrl)
|
|
|
+ m.T["shareData"] = getShareData(m.Url())
|
|
|
return m.Render("/swordfish/wxpush.html", &m.T)
|
|
|
}
|
|
|
|
|
@@ -254,3 +254,17 @@ func (m *Mobile) WxpushAjaxReq() error {
|
|
|
}, false, false)
|
|
|
return nil
|
|
|
}
|
|
|
+func getShareData(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)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ shareData = coreutil.GetJSInterfaceParam(url)
|
|
|
+ redis.Put("other", "signature-"+url, shareData, 60*1000)
|
|
|
+ }
|
|
|
+ return shareData
|
|
|
+}
|