|
@@ -43,23 +43,30 @@ type Newscont struct {
|
|
|
getJsonList xweb.Mapper `xweb:"POST /front/(\\w+)list/list"`
|
|
|
//微信端使用通用信息展示页
|
|
|
weixincontent xweb.Mapper `xweb:"GET /front/weixincontent/(\\w+)"`
|
|
|
- //微信分享内容
|
|
|
- weixinshare xweb.Mapper `xweb:"GET /front/weixinshare"`
|
|
|
+ //取微信分享图片
|
|
|
+ weixinshare xweb.Mapper `xweb:"GET /front/weixinshare/([^.]*)"`
|
|
|
}
|
|
|
|
|
|
-//微信分享内容
|
|
|
+//取微信分享图片
|
|
|
|
|
|
-func (e *Newscont) Weixinshare() error {
|
|
|
- id := coreutil.GetShareId(coreutil.TYPE_INVITE)
|
|
|
- var pngdata = ""
|
|
|
- if ret := redis.Get("sso", fmt.Sprintf("p_share_%d", id)); ret != nil {
|
|
|
- return e.SetBody([]byte(ret.(string)))
|
|
|
+func (e *Newscont) Weixinshare(pid string) error {
|
|
|
+ var pngdata = []byte{}
|
|
|
+ if ret, _ := redis.GetBytes("sso", fmt.Sprintf("p_share_%s", pid)); ret != nil {
|
|
|
+ pngdata = *ret
|
|
|
} else {
|
|
|
- pngdata = coreutil.GetShareQR(id)
|
|
|
- }
|
|
|
- e.T["pngdata"] = pngdata
|
|
|
- fmt.Println("pngdata:", pngdata, "000000:", fmt.Sprintf("p_share_%d", id))
|
|
|
- return e.Render("/manage/web_weixinshare.html", &e.T)
|
|
|
+ id := coreutil.GetShareId(coreutil.TYPE_INVITE)
|
|
|
+ coreutil.GetShareQR(id)
|
|
|
+ tmp, _ := redis.GetBytes("sso", fmt.Sprintf("p_share_%d", id))
|
|
|
+ pngdata = *tmp
|
|
|
+ }
|
|
|
+ w := e.ResponseWriter
|
|
|
+ w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
|
|
+ w.Header().Set("Pragma", "no-cache")
|
|
|
+ w.Header().Set("Expires", "0")
|
|
|
+ w.Header().Set("Content-Type", "image/png")
|
|
|
+ w.Write(pngdata)
|
|
|
+ return nil
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//文章点赞
|