فهرست منبع

feat:p583 app调整

fuwencai 1 سال پیش
والد
کامیت
087ed52ebd
3فایلهای تغییر یافته به همراه41 افزوده شده و 34 حذف شده
  1. 23 19
      src/jfw/modules/app/src/active.json
  2. 10 8
      src/jfw/modules/app/src/app/config/active.go
  3. 8 7
      src/jfw/modules/app/src/app/front/activity.go

+ 23 - 19
src/jfw/modules/app/src/active.json

@@ -1,46 +1,50 @@
 {
-	"pullnew":{
-		"startTime": 1567390259,
-		"endTime": 1569982259,
-		"url":"https://pan.baidu.com/s/1alKNc4hzuEK3q4XOFfz5Ow",
-		"password":"j2ks",
-		"desc":"拉新活动"
-	},
-	"doubleEleven":{
-		"active_Start":1504505600,
-		"active_End":1605024000
-	},
+  "pullnew": {
+    "startTime": 1567390259,
+    "endTime": 1569982259,
+    "url": "https://pan.baidu.com/s/1alKNc4hzuEK3q4XOFfz5Ow",
+    "password": "j2ks",
+    "desc": "拉新活动"
+  },
+  "doubleEleven": {
+    "active_Start": 1504505600,
+    "active_End": 1605024000
+  },
   "activateInfo": {
     "name": "激活活动",
-    "endTime":  1725120000,
+    "endTime": 1725120000,
     "appID": "wx37f06c38292f7d82",
     "envVersion": "trial",
     "endUrl": "",
+    "url": "/frontRouter/activity/free/open-mini-program.html",
     "to": [
       {
-        "url": "/frontRouter/activity/free/open-mini-program.html",
         "path": {
-          "sub": "/pages/webview/index",
+          "sub": "/pages/index/index",
           "unsub": "/pages/article/bidding/index"
         },
         "query": {
-          "sub": "src=/jyapp/free/al/%s",
+          "sub": "url=/jyapp/free/al/%s",
           "unsub": "id=%s"
         }
       },
       {
-        "url": "/frontRouter/activity/free/open-mini-program.html",
         "path": {
-          "sub": "/pages/webview/index",
+          "sub": "/pages/index/index",
           "unsub": "/pages/article/bidding/index"
         },
         "query": {
-          "sub": "src=/jyapp/free/al/%s",
+          "sub": "url=/jyapp/free/al/%s",
           "unsub": "id=%s"
         }
       },
       {
-        "url": ""
+        "path": {
+          "default": "/pages/index/index"
+        },
+        "query": {
+          "default": "source=ac"
+        }
       }
     ]
   }

+ 10 - 8
src/jfw/modules/app/src/app/config/active.go

@@ -12,19 +12,21 @@ type active struct {
 	ActivateInfo struct {
 		Name       string `json:"name"`
 		EndTime    int64  `json:"endTime"`
-		AppID      string `json:"appID"`      // 要跳转的小程序appid
-		EnvVersion string `json:"envVersion"` // 小程序版本
-		EndUrl     string `json:"endUrl"`     // 结束后跳转到
+		AppID      string `json:"appID"`         // 要跳转的小程序appid
+		EnvVersion string `json:"envVersion"`    // 小程序版本
+		EndUrl     string `json:"endUrl"`        // 结束后跳转到
+		Url        string `json:"url,omitempty"` // 跳的地址
 		To         []struct {
 			Path struct {
-				Sub   string `json:"sub"`   // 关注
-				Unsub string `json:"unsub"` // 未关注
+				Sub     string `json:"sub,omitempty"`   // 关注
+				Unsub   string `json:"unsub,omitempty"` // 未关注
+				Default string `json:"default,omitempty"`
 			} `json:"path,omitempty"`
 			Query struct {
-				Sub   string `json:"sub"`
-				Unsub string `json:"unsub"`
+				Sub     string `json:"sub,omitempty"`
+				Unsub   string `json:"unsub,omitempty"`
+				Default string `json:"default,omitempty"`
 			} `json:"query,omitempty"`
-			Url string `json:"url,omitempty"` // 跳的地址
 		} `json:"to"`
 	} `json:"activateInfo"`
 }

+ 8 - 7
src/jfw/modules/app/src/app/front/activity.go

@@ -52,10 +52,10 @@ func (s *Activity) Mini(args string) {
 	}
 	// 获取用户id
 	userId, positionID := jyutil.GetActivateUser(id)
-	if len(config.Active.ActivateInfo.To[stepIndex].Path.Sub) > 0 { // 有配置跳转地址的 走这块
-		// 判断用户关注未关注
-		s.T["appid"] = config.Active.ActivateInfo.AppID
-		s.T["env_version"] = config.Active.ActivateInfo.EnvVersion
+	// 判断用户关注未关注
+	s.T["appid"] = config.Active.ActivateInfo.AppID
+	s.T["env_version"] = config.Active.ActivateInfo.EnvVersion
+	if config.Active.ActivateInfo.To[stepIndex].Path.Default == "" {
 		if jyutil.IsSubscribe(userId) {
 			s.T["path"] = config.Active.ActivateInfo.To[stepIndex].Path.Sub
 			s.T["query"] = fmt.Sprintf(config.Active.ActivateInfo.To[stepIndex].Query.Sub, encryId)
@@ -63,15 +63,16 @@ func (s *Activity) Mini(args string) {
 			s.T["path"] = config.Active.ActivateInfo.To[stepIndex].Path.Unsub
 			s.T["query"] = fmt.Sprintf(config.Active.ActivateInfo.To[stepIndex].Query.Unsub, encryId)
 		}
-		s.Render(config.Active.ActivateInfo.To[stepIndex].Url, &s.T)
-		return
 	} else {
 		if isFirst {
 			// 没有点过则送7天会员
 			jyutil.GiveVip(userId, positionID, s.Request.UserAgent())
 		}
-		s.Redirect(config.Active.ActivateInfo.To[stepIndex].Url) // 活动的重定向到
+		s.T["path"] = config.Active.ActivateInfo.To[stepIndex].Path.Default
+		s.T["query"] = config.Active.ActivateInfo.To[stepIndex].Query.Default
 	}
+	s.Render(config.Active.ActivateInfo.Url, &s.T)
+	return
 
 }