Explorar o código

增加根据source区分微信渠道

wangkaiyue %!s(int64=6) %!d(string=hai) anos
pai
achega
720e856256
Modificáronse 1 ficheiros con 12 adicións e 2 borrados
  1. 12 2
      src/jfw/front/front.go

+ 12 - 2
src/jfw/front/front.go

@@ -1129,15 +1129,25 @@ func (f *Front) DownloadJyApp() error {
 	}
 	domain, _ := jyapp["domain"].(string)
 	apkurl, _ := jyapp["apkurl"].(string)
-	return f.Redirect(getDownloadUri(code, domain+apkurl))
+	return f.Redirect(getDownloadUri(code, source, domain+apkurl))
 }
 
-func getDownloadUri(code, download string) string {
+//获取app下载地址,不通code对应不通渠道的app包
+func getDownloadUri(code, source, download string) string {
 	jyapp := config.Sysconfig["jyapp"].(map[string]interface{})
 	channelMap := jyapp["channelDir"].(map[string]interface{})
 	if dir, ok := channelMap[code]; ok {
 		return fmt.Sprintf(download, dir)
 	}
+	//渠道信息未匹配上 根据source判断微信
+	if source == "wx_othershare" || source == "wx_infocontentshare" || source == "weixinAutoRpl" || source == "weixinAapplySub" {
+		//微信下载地址
+		wxdir, ok := jyapp["wx01"]
+		if ok {
+			return fmt.Sprintf(download, wxdir)
+		}
+	}
+	//全部未匹配上 取默认
 	return fmt.Sprintf(download, channelMap["default"])
 }