소스 검색

数博会H5

wangshan 4 년 전
부모
커밋
3f7cf95297
6개의 변경된 파일108개의 추가작업 그리고 4개의 파일을 삭제
  1. 3 0
      src/jfw/active/active.go
  2. 97 0
      src/jfw/active/digitalexpo.go
  3. 2 1
      src/jfw/front/frontRouter.go
  4. 2 1
      src/jfw/front/singleLogin.go
  5. 2 1
      src/jfw/modules/weixin/src/config.json
  6. 2 1
      src/seo.json

+ 3 - 0
src/jfw/active/active.go

@@ -38,6 +38,9 @@ type Active struct {
 	subStatus  xweb.Mapper `xweb:"/active/livePage/status"`     //预约状态等信息
 	subInfo    xweb.Mapper `xweb:"/active/livePage/subInfo"`    //保存预约信息
 	updateInfo xweb.Mapper `xweb:"/active/livePage/updateInfo"` //修改直播时间等信息
+	//数博会活动
+	digitalIndex xweb.Mapper `xweb:"/active/digital/index"` //数博会H5首页
+	digitalVideo xweb.Mapper `xweb:"/active/digital/video"` //数博会视频播放页面
 }
 
 var mongodb = public.MQFW

+ 97 - 0
src/jfw/active/digitalexpo.go

@@ -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
+}

+ 2 - 1
src/jfw/front/frontRouter.go

@@ -2,12 +2,13 @@ package front
 
 import (
 	"fmt"
-	"github.com/go-xweb/xweb"
 	"jfw/config"
 	"jfw/public"
 	"qfw/util/jy"
 	"regexp"
 	"strings"
+
+	"github.com/go-xweb/xweb"
 )
 
 //前端通用路由

+ 2 - 1
src/jfw/front/singleLogin.go

@@ -46,7 +46,8 @@ func (this *SingleLogin) SingleLogin() error {
 		"toHref": this.GetString("toHref"),
 		"unHref": this.GetString("unHref"),
 	}
-	if openid == "" {
+	//没有用户session 或  有session但是没有关注(刚刚取关 session信息存留)
+	if openid == "" || (openid != "" && !CheckUserIsSubscribe(openid)) {
 		stateKey := this.GetString("state")
 		if stateKey == "" { //公众号回调
 			stateKey = getTmpKey()

+ 2 - 1
src/jfw/modules/weixin/src/config.json

@@ -127,6 +127,7 @@
 	"cookieSource":{
 		"jywkzmt":"jydocs",
 		"jywkseo":"jydocs",
-		"bidCourse":"bidCourse"
+		"bidCourse":"bidCourse",
+		"digitalExpoCoupon":"jycoupon",
 	}
 }

+ 2 - 1
src/seo.json

@@ -486,6 +486,7 @@
 		"jywkseo":"jydocs"
 	},
 	"urlSource":{
-		"bidCourse":"/jyxsapp/"
+		"bidCourse":"/jyxsapp/",
+		"digitalExpoCoupon":"?Rg=="
 	}
 }