|
|
@@ -37,6 +37,7 @@ import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.util.*;
|
|
|
@@ -433,22 +434,23 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
|
|
|
param.setTestId(experimentId);
|
|
|
Map<String, String> requestParam = new HashMap<>();
|
|
|
String experimentIdParam = (experimentId != null && !experimentId.isEmpty()) ? "&experimentId=" + experimentId : "";
|
|
|
- String growthExtDataParam = "";
|
|
|
- if (experimentId != null && !experimentId.isEmpty()) {
|
|
|
- JSONObject growthExtData = new JSONObject();
|
|
|
- growthExtData.put("experimentId", experimentId);
|
|
|
- growthExtDataParam = "&growthExtData=" + growthExtData.toJSONString();
|
|
|
- }
|
|
|
String jumpPage = "pages/user-videos?fromGzh=1&rootShareId=${uuid}&id=${videoId}&shareId=${uuid}&rootSourceId=[rootSourceId]"
|
|
|
.replace("${videoId}", "" + videoId)
|
|
|
.replace("${uuid}", "" + UUID.randomUUID())
|
|
|
- + experimentIdParam + growthExtDataParam;
|
|
|
+ + experimentIdParam;
|
|
|
requestParam.put("jumpPage", jumpPage);
|
|
|
param.setRequestParam(requestParam);
|
|
|
String res = httpPoolClient.post(POST_ADD_TENCENT, JSONObject.toJSONString(param));
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- return data.getString("url");
|
|
|
+ String pageUrl = data.getString("url");
|
|
|
+ // 在返回的url字段后拼接growthExtData参数(URL编码,作为jumpPage内部参数)
|
|
|
+ if (experimentId != null && !experimentId.isEmpty() && pageUrl != null) {
|
|
|
+ JSONObject growthExtData = new JSONObject();
|
|
|
+ growthExtData.put("experimentId", experimentId);
|
|
|
+ pageUrl = pageUrl + "%26growthExtData%3D" + URLEncoder.encode(growthExtData.toJSONString(), "UTF-8");
|
|
|
+ }
|
|
|
+ return pageUrl;
|
|
|
}
|
|
|
|
|
|
public String selectPage(String putScene, String channel, Long videoId, String carrierId, String typeOne, String typeTwo) {
|
|
|
@@ -518,24 +520,25 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
|
|
|
param.setTestId(experimentId);
|
|
|
Map<String, String> requestParam = new HashMap<>();
|
|
|
String experimentIdParam = (experimentId != null && !experimentId.isEmpty()) ? "&experimentId=" + experimentId : "";
|
|
|
- String growthExtDataParam = "";
|
|
|
- if (experimentId != null && !experimentId.isEmpty()) {
|
|
|
- JSONObject growthExtData = new JSONObject();
|
|
|
- growthExtData.put("experimentId", experimentId);
|
|
|
- growthExtDataParam = "&growthExtData=" + growthExtData.toJSONString();
|
|
|
- }
|
|
|
String jumpPage = "pages/user-videos?fromGzh=1&rootShareId=${uuid}&id=${videoId}&shareId=${uuid}&rootSourceId=[rootSourceId]"
|
|
|
.replace("${videoId}", "" + videoId)
|
|
|
.replace("${uuid}", "" + UUID.randomUUID())
|
|
|
- + experimentIdParam + growthExtDataParam;
|
|
|
+ + experimentIdParam;
|
|
|
requestParam.put("jumpPage", jumpPage);
|
|
|
param.setRequestParam(requestParam);
|
|
|
try {
|
|
|
String res = httpPoolClient.post(POST_ADD_TENCENT, JSONObject.toJSONString(param));
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- return data.getString("url");
|
|
|
- } catch (IOException e) {
|
|
|
+ String pageUrl = data.getString("url");
|
|
|
+ // 在返回的url字段后拼接growthExtData参数(URL编码,作为jumpPage内部参数)
|
|
|
+ if (experimentId != null && !experimentId.isEmpty() && pageUrl != null) {
|
|
|
+ JSONObject growthExtData = new JSONObject();
|
|
|
+ growthExtData.put("experimentId", experimentId);
|
|
|
+ pageUrl = pageUrl + "%26growthExtData%3D" + URLEncoder.encode(growthExtData.toJSONString(), "UTF-8");
|
|
|
+ }
|
|
|
+ return pageUrl;
|
|
|
+ } catch (Exception e) {
|
|
|
log.error("MessageAttachmentService getPage error", e);
|
|
|
}
|
|
|
return null;
|