|
@@ -0,0 +1,97 @@
|
|
|
+package active
|
|
|
+
|
|
|
+import (
|
|
|
+ "fmt"
|
|
|
+ "jfw/config"
|
|
|
+ . "jfw/front"
|
|
|
+ "jfw/jyutil"
|
|
|
+ "jfw/public"
|
|
|
+ "net/url"
|
|
|
+ "qfw/util"
|
|
|
+)
|
|
|
+
|
|
|
+//数博会H5首页
|
|
|
+func (this *Active) DigitalIndex() error {
|
|
|
+ defer util.Catch()
|
|
|
+ checkIsSubscribeFlag := true
|
|
|
+ openid, _ := this.Session().Get("s_m_openid").(string)
|
|
|
+ if openid == "" {
|
|
|
+ if this.Session().Get("s_m_openid") == nil {
|
|
|
+ if this.GetString("state") == "wx" {
|
|
|
+ //微信跳回来的
|
|
|
+ code := this.GetString("code")
|
|
|
+ if code != "" {
|
|
|
+ openid = jyutil.Getopenid(code)
|
|
|
+ if openid != "" {
|
|
|
+ //是否为关注用户
|
|
|
+ checkIsSubscribeFlag = CheckUserIsSubscribe(openid)
|
|
|
+ if checkIsSubscribeFlag {
|
|
|
+ //关注用户 建session
|
|
|
+ go FindUserAndCreateSess(openid, this.Session())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if public.CheckWxBrowser(this.Request) {
|
|
|
+ //所有参数都不再使用,跳到微信验证用户
|
|
|
+ return this.Redirect(fmt.Sprintf(config.Wxoauth, url.QueryEscape(this.Site()+this.Url()), "wx"), 302)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if this.Session().Get("s_m_openid") == nil {
|
|
|
+ checkIsSubscribeFlag = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //是否为关注用户
|
|
|
+ checkIsSubscribeFlag = CheckUserIsSubscribe(openid)
|
|
|
+ }
|
|
|
+ if checkIsSubscribeFlag {
|
|
|
+ return this.Render("/active/digital/index.html", &this.T)
|
|
|
+ } else {
|
|
|
+ return this.Redirect("/_s/digitalExpo")
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+//数博会H5视频播放
|
|
|
+func (this *Active) DigitalVideo() error {
|
|
|
+ defer util.Catch()
|
|
|
+ checkIsSubscribeFlag := true
|
|
|
+ openid, _ := this.Session().Get("s_m_openid").(string)
|
|
|
+ if openid == "" {
|
|
|
+ if this.Session().Get("s_m_openid") == nil {
|
|
|
+ if this.GetString("state") == "wx" {
|
|
|
+ //微信跳回来的
|
|
|
+ code := this.GetString("code")
|
|
|
+ if code != "" {
|
|
|
+ openid = jyutil.Getopenid(code)
|
|
|
+ if openid != "" {
|
|
|
+ //是否为关注用户
|
|
|
+ checkIsSubscribeFlag = CheckUserIsSubscribe(openid)
|
|
|
+ if checkIsSubscribeFlag {
|
|
|
+ //关注用户 建session
|
|
|
+ go FindUserAndCreateSess(openid, this.Session())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if public.CheckWxBrowser(this.Request) {
|
|
|
+ //所有参数都不再使用,跳到微信验证用户
|
|
|
+ return this.Redirect(fmt.Sprintf(config.Wxoauth, url.QueryEscape(this.Site()+this.Url()), "wx"), 302)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if this.Session().Get("s_m_openid") == nil {
|
|
|
+ checkIsSubscribeFlag = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //是否为关注用户
|
|
|
+ checkIsSubscribeFlag = CheckUserIsSubscribe(openid)
|
|
|
+ }
|
|
|
+ if checkIsSubscribeFlag {
|
|
|
+ return this.Render("/active/digital/video.html", &this.T)
|
|
|
+ } else {
|
|
|
+ return this.Redirect("/_s/digitalExpo")
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|