Sfoglia il codice sorgente

Merge branch 'dev/v4.9.39_fu' of qmx/jy into feature/v4.9.39

fuwencai 1 anno fa
parent
commit
8505d0571f

+ 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"`
 }

+ 11 - 10
src/jfw/modules/app/src/app/front/activity.go

@@ -40,7 +40,7 @@ func (s *Activity) Mini(args string) {
 	}
 	step := common.IntAll(sidStr[len(sidStr)-1:])
 	id := common.IntAll(sidStr[:len(sidStr)-1])
-	encryId := encrypt.SE.EncodeString(sidStr[:len(sidStr)-1])
+	encryId := url.QueryEscape(encrypt.SE.EncodeString(sidStr[:len(sidStr)-1]))
 	if step > len(config.Active.ActivateInfo.To) || id == 0 || common.IntAll(id) == 0 {
 		s.ServeJson(api.NewResult(nil, errors.New("参数异常")))
 		return
@@ -52,26 +52,27 @@ 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"] = url.QueryEscape(fmt.Sprintf(config.Active.ActivateInfo.To[stepIndex].Query.Sub, encryId))
+			s.T["query"] = fmt.Sprintf(config.Active.ActivateInfo.To[stepIndex].Query.Sub, encryId)
 		} else {
 			s.T["path"] = config.Active.ActivateInfo.To[stepIndex].Path.Unsub
-			s.T["query"] = url.QueryEscape(fmt.Sprintf(config.Active.ActivateInfo.To[stepIndex].Query.Unsub, encryId))
+			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
 
 }