|
@@ -22,7 +22,7 @@ public class CardGeneratorServiceImpl implements CardGeneratorService {
|
|
|
@ApolloJsonValue("${miniMap:{}}")
|
|
|
private JSONObject miniProgramMap;
|
|
|
|
|
|
- public CardData generateCards(String ghId, String response, Integer miniprogramUseType) throws UnsupportedEncodingException {
|
|
|
+ public CardData generateCards(String ghId, String response, Integer miniprogramUseType) {
|
|
|
JSONArray jsonArray = JSONArray.parseArray(response);
|
|
|
CardData cardData = new CardData();
|
|
|
List<JSONObject> cardList = new ArrayList<>();
|
|
@@ -40,7 +40,7 @@ public class CardGeneratorServiceImpl implements CardGeneratorService {
|
|
|
}
|
|
|
|
|
|
public JSONObject generateSingleCard(Integer index, String ghId, Integer miniId, JSONObject item,
|
|
|
- Integer miniprogramUseType) throws UnsupportedEncodingException {
|
|
|
+ Integer miniprogramUseType) {
|
|
|
String strMiniId = String.valueOf(miniId);
|
|
|
JSONObject miniInfo = miniProgramMap.getJSONObject(strMiniId);
|
|
|
String avatar = miniInfo.getString("avatar");
|
|
@@ -74,37 +74,42 @@ public class CardGeneratorServiceImpl implements CardGeneratorService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public JSONObject createGzhPath(String videoId, String sharedUid, String ghId, Integer miniProgramType) throws UnsupportedEncodingException {
|
|
|
- String rootShareId = UUID.randomUUID().toString();
|
|
|
- String rootSourceId;
|
|
|
- switch (miniProgramType) {
|
|
|
- case 1:
|
|
|
- rootSourceId = "longArticles_" + generateSourceId();
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- rootSourceId = "touliu_tencentGzhArticle_" + ghId + "_" + generateSourceId();
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- rootSourceId = "WeCom_" + generateSourceId();
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- rootSourceId = "DaiTou_" + ghId + "_" + generateSourceId();
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- rootSourceId = "gzhhzdx_" + generateSourceId();
|
|
|
- break;
|
|
|
- default:
|
|
|
- rootSourceId = "Error mini_program_type " + miniProgramType;
|
|
|
- }
|
|
|
+ public JSONObject createGzhPath(String videoId, String sharedUid, String ghId, Integer miniProgramType) {
|
|
|
+ try {
|
|
|
+ String rootShareId = UUID.randomUUID().toString();
|
|
|
+ String rootSourceId;
|
|
|
+ switch (miniProgramType) {
|
|
|
+ case 1:
|
|
|
+ rootSourceId = "longArticles_" + generateSourceId();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ rootSourceId = "touliu_tencentGzhArticle_" + ghId + "_" + generateSourceId();
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ rootSourceId = "WeCom_" + generateSourceId();
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ rootSourceId = "DaiTou_" + ghId + "_" + generateSourceId();
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ rootSourceId = "gzhhzdx_" + generateSourceId();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ rootSourceId = "Error mini_program_type " + miniProgramType;
|
|
|
+ }
|
|
|
|
|
|
- String url = String.format("pages/user-videos?id=%s&su=%s&fromGzh=1&rootShareId=%s&shareId=%s&rootSourceId=%s",
|
|
|
- videoId, sharedUid, rootShareId, rootShareId, rootSourceId);
|
|
|
- String productionPath = String.format("pages/category?jumpPage=%s", URLEncoder.encode(url, StandardCharsets.UTF_8.toString()));
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("rootShareId", rootShareId);
|
|
|
- jsonObject.put("rootSourceId", rootSourceId);
|
|
|
- jsonObject.put("productionPath", productionPath);
|
|
|
- return jsonObject;
|
|
|
+ String url = String.format("pages/user-videos?id=%s&su=%s&fromGzh=1&rootShareId=%s&shareId=%s&rootSourceId=%s",
|
|
|
+ videoId, sharedUid, rootShareId, rootShareId, rootSourceId);
|
|
|
+ String productionPath = String.format("pages/category?jumpPage=%s", URLEncoder.encode(url, StandardCharsets.UTF_8.toString()));
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("rootShareId", rootShareId);
|
|
|
+ jsonObject.put("rootSourceId", rootSourceId);
|
|
|
+ jsonObject.put("productionPath", productionPath);
|
|
|
+ return jsonObject;
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ log.error("createGzhPath error", e);
|
|
|
+ }
|
|
|
+ return new JSONObject();
|
|
|
}
|
|
|
|
|
|
private String generateSourceId() {
|