diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ae62fff..67937bf 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,32 +3,20 @@
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
@@ -77,42 +65,40 @@
-
-
+
+
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
@@ -120,28 +106,59 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
@@ -161,14 +178,6 @@
- code
- flex-direction
- data.
- botAccount
- productDetail
- BACK_TRACE
- directives
- LAST_OUTTIME_RESULT
botAcc
POOL
status:{}
@@ -189,8 +198,16 @@
PLAY_DOCUMENT
PRODUCT_NAME_DETAIL
imgPro
- productName
recomList
+ OnLoad
+ productName
+ productDetail
+ CATEGORY_PRODUCT_LIST
+ text-overflow
+ max-lines
+ margin-bottom
+ line-height
+ onClick
OPENID_CACHE
@@ -206,17 +223,6 @@
@@ -289,8 +306,8 @@
-
-
+
+
@@ -302,6 +319,7 @@
+
@@ -387,7 +405,19 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -513,7 +543,6 @@
-
@@ -528,7 +557,7 @@
-
+
@@ -1070,7 +1099,8 @@
-
+
+
@@ -1080,7 +1110,7 @@
-
+
@@ -1092,7 +1122,7 @@
-
+
@@ -1103,7 +1133,7 @@
-
+
@@ -1112,7 +1142,7 @@
-
+
@@ -1132,44 +1162,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1179,135 +1171,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1428,23 +1291,44 @@
-
+
-
-
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -1452,113 +1336,231 @@
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/FrameTemple.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/FrameTemple.java
index 1b32a0e..8444189 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/FrameTemple.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/FrameTemple.java
@@ -1,6 +1,7 @@
package ai.qiwu.com.xiaoduhome.common.temple;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Item;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -31,6 +32,8 @@ public class FrameTemple implements Agent{
private String marginLeft;
@JsonProperty("margin-bottom")
private String marginBottom;
+ @JsonProperty("margin-top")
+ private String marginTop;
private String width;
private String height;
@JsonProperty("border-width")
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java
index ac45436..c5700b9 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java
@@ -9,6 +9,7 @@ import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyUtil;
import ai.qiwu.com.xiaoduhome.common.temple.playUpdate.PlayUpdateDocument;
import ai.qiwu.com.xiaoduhome.common.temple.playUpdate.PlayUpdatePojo;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankBotInfo;
+import ai.qiwu.com.xiaoduhome.common.temple.rank.RankUtil;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankingDocument;
import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandBotInfo;
import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandDocument;
@@ -50,15 +51,18 @@ public class TempleUtils {
private static FrameTemple FRAME_RAKKING;
private static FrameTemple FRAME_RECOMMAND;
private static FrameTemple FRAME_CATEGORY;
- private static RankingDocument RANKING_DOCUMENT;
+// private static RankingDocument RANKING_DOCUMENT;
static {
FRAME_RAKKING = JSON.parseObject(getDPLTemple("static/json/frame.json"), FrameTemple.class);
FRAME_RAKKING.getItems().get(1).getItems().get(0).setText("小度小度,打开排行榜");
+ FRAME_RAKKING.getItems().get(0).setText("排行榜");
FRAME_RECOMMAND = JSON.parseObject(getDPLTemple("static/json/frame.json"), FrameTemple.class);
FRAME_RECOMMAND.getItems().get(1).getItems().get(0).setText("小度小度,打开推荐");
+ FRAME_RECOMMAND.getItems().get(0).setText("推荐作品");
FRAME_CATEGORY = JSON.parseObject(getDPLTemple("static/json/frame.json"), FrameTemple.class);
FRAME_CATEGORY.getItems().get(1).getItems().get(0).setText("小度小度,打开古风");
+ FRAME_CATEGORY.getItems().get(0).setText("作品分类");
}
public static PlayUpdateDocument getPlayUpdate(String audio, String text) {
@@ -91,33 +95,62 @@ public class TempleUtils {
return document;
}
+// public static RankingDocument getRanking() {
+// if (RANKING_DOCUMENT != null) {
+// return RANKING_DOCUMENT;
+// }
+// RANKING_DOCUMENT = JSON.parseObject(getDPLTemple("static/json/ranking.json"), RankingDocument.class);
+// List datas = new ArrayList<>();
+// StringBuilder botIds = new StringBuilder();
+// for (GameProjectTb bot:ScheduleService.getRankingList()) {
+// botIds.append(bot.getBotAccount()).append(File.separator);
+// String imgSrc = new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString();
+// String imageId = new StringBuilder(Constants.PRE_PRODUCT_IMG).append(bot.getName()).toString();
+// RankBotInfo rankBotInfo = new RankBotInfo(imgSrc, imageId, correctName(bot.getName()));
+// datas.add(rankBotInfo);
+// }
+// if (botIds.length() != 0) {
+// botIds.deleteCharAt(botIds.length()-1);
+// String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
+// RANKING_DOCUMENT.setRankBotIds(idToken);
+// }
+// RANKING_DOCUMENT.getMainTemplate().getItems().get(0).getItems().get(2).getItems().get(0).setData(datas);
+// return RANKING_DOCUMENT;
+// }
+
public static RankingDocument getRanking() {
- if (RANKING_DOCUMENT != null) {
- return RANKING_DOCUMENT;
- }
- RANKING_DOCUMENT = JSON.parseObject(getDPLTemple("static/json/ranking.json"), RankingDocument.class);
- List datas = new ArrayList<>();
+ return RankUtil.getRankDocument();
+ }
+
+ public static RecommandDocument getRecommand2(int num) {
+ RecommandDocument document = JSON.parseObject(getDPLTemple("static/json/recommand2.json"), RecommandDocument.class);
+ List firstRowData = new ArrayList<>();
+ List secondRowData = new ArrayList<>();
StringBuilder botIds = new StringBuilder();
- for (GameProjectTb bot:ScheduleService.getRankingList()) {
- botIds.append(bot.getBotAccount()).append(File.separator);
- String imgSrc = new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString();
- String imageId = new StringBuilder(Constants.PRE_PRODUCT_IMG).append(bot.getName()).toString();
- RankBotInfo rankBotInfo = new RankBotInfo(imgSrc, imageId, correctName(bot.getName()));
- datas.add(rankBotInfo);
+ int upBound = num+8 <= ScheduleService.getAllProductCount()? num+8: ScheduleService.getAllProductCount();
+ for (int i = num; i < num+8; i++) {
+ OnProductDetail detail = ScheduleService.getAllOnProduct().get(i);
+ botIds.append(detail.getBotAccount()).append(File.separator);
+ String imgSrc = new StringBuilder(Constants.IMG_PREFIX).append(detail.getBannerImgUrl()).toString();
+ String imageId = new StringBuilder(Constants.PRE_PRODUCT_IMG).append(detail.getName()).toString();
+ if (i < num+4) {
+ RecommandBotInfo recommend = new RecommandBotInfo(imgSrc, imageId, correctName(detail.getName()));
+ firstRowData.add(recommend);
+ }else {
+ RecommandBotInfo recommend = new RecommandBotInfo(imgSrc, imageId, correctName(detail.getName()));
+ secondRowData.add(recommend);
+ }
}
if (botIds.length() != 0) {
botIds.deleteCharAt(botIds.length()-1);
String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
- RANKING_DOCUMENT.setRankBotIds(idToken);
+ document.setRecommendIdList(idToken);
+ document.setCount(String.valueOf(botIds.length()));
}
- RANKING_DOCUMENT.getMainTemplate().getItems().get(0).getItems().get(2).getItems().get(0).setData(datas);
- return RANKING_DOCUMENT;
+ //document.getMainTemplate().getItems().get(0).getItems().get(2).getItems().get(0).setData(datas);
+ return document;
}
-// public static RankingDocument getNextRank() {
-//
-// }
-
public static RecommandDocument getRecommend() {
RecommandDocument document = JSON.parseObject(getDPLTemple("static/json/recommand.json"), RecommandDocument.class);
List datas = new ArrayList<>();
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyUtil.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyUtil.java
index dfebd8d..a4b70b6 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyUtil.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyUtil.java
@@ -50,10 +50,7 @@ public class FunnyUtil {
pager.setHeight("100%");
Event onLoadEvent = new Event("AutoPage", "funnyPage");
onLoadEvent.setDurationInMillisecond(3000);
- Event setPage = new Event("SetPage", "funnyPage");
- setPage.setPosition("relative");
- setPage.setValue("-1");
- pager.setOnLoaded(Arrays.asList(onLoadEvent, setPage));
+ pager.setOnLoaded(Collections.singletonList(onLoadEvent));
pageContainer.setItems(Collections.singletonList(pager));
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankUtil.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankUtil.java
new file mode 100644
index 0000000..ae8eee1
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankUtil.java
@@ -0,0 +1,184 @@
+package ai.qiwu.com.xiaoduhome.common.temple.rank;
+
+import ai.qiwu.com.xiaoduhome.common.BaseHolder;
+import ai.qiwu.com.xiaoduhome.common.Constants;
+import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb;
+import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
+import ai.qiwu.com.xiaoduhome.repository.primary.GameProjectTbRepository;
+import ai.qiwu.com.xiaoduhome.service.ScheduleService;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.File;
+import java.util.*;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-2 下午9:04
+ */
+@Slf4j
+public class RankUtil {
+
+ private static final RankingPojo RANK_FOOTER = buildRankFooter();
+
+ private static final RankingPojo RANK_BACKGROUND_IMG = buildRankBackgroundImg();
+
+ private static final RankingPojo RANK_HEAD = buildRankHead();
+
+ private static final List RANK_CONTAINER_LIST = buildImgTextContainer();
+
+ private static RankingDocument RANKING_DOCUMENT;
+
+ public static RankingDocument getRankDocument() {
+ if (RANKING_DOCUMENT != null) return RANKING_DOCUMENT;
+ RANKING_DOCUMENT = new RankingDocument();
+ RankingMainTemplate mainTemplate = new RankingMainTemplate();
+ RANKING_DOCUMENT.setMainTemplate(mainTemplate);
+
+ List datas = new ArrayList<>();
+ StringBuilder botIds = new StringBuilder();
+ for (GameProjectTb bot: ScheduleService.getRankingList()) {
+ botIds.append(bot.getBotAccount()).append(File.separator);
+ String imgSrc = new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString();
+ String imageId = new StringBuilder(Constants.PRE_PRODUCT_IMG).append(bot.getName()).toString();
+ RankBotInfo rankBotInfo = new RankBotInfo(imgSrc, imageId, correctName(bot.getName()));
+ datas.add(rankBotInfo);
+ }
+ if (botIds.length() != 0) {
+ botIds.deleteCharAt(botIds.length()-1);
+ String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
+ RANKING_DOCUMENT.setRankBotIds(idToken);
+ }
+ buildMainItem(datas, mainTemplate.getItems());
+ return RANKING_DOCUMENT;
+ }
+
+ public static RankingDocument updateRankDocument(int num) {
+ RankingDocument document = new RankingDocument();
+ RankingMainTemplate mainTemplate = new RankingMainTemplate();
+ document.setMainTemplate(mainTemplate);
+ GameProjectTbRepository repository = BaseHolder.getBean("gameProjectTbRepository");
+ List bots;
+ try {
+ bots = repository.postRankBot(num*15);
+ } catch (Exception e) {
+ log.error("查询后续排行榜作品信息出错");
+ return null;
+ }
+ if (bots == null || bots.size() == 0) return null;
+ StringBuilder botIds = new StringBuilder();
+ List datas = new ArrayList<>();
+ for (GameProjectTb bot: bots) {
+ botIds.append(bot.getBotAccount()).append(File.separator);
+ String imgSrc = new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString();
+ String imageId = new StringBuilder(Constants.PRE_PRODUCT_IMG).append(bot.getName()).toString();
+ RankBotInfo rankBotInfo = new RankBotInfo(imgSrc, imageId, correctName(bot.getName()));
+ datas.add(rankBotInfo);
+ }
+ if (botIds.length() != 0) {
+ botIds.deleteCharAt(botIds.length()-1);
+ String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
+ document.setRankBotIds(idToken);
+ document.setCount(String.valueOf(bots.size()));
+ }
+ buildMainItem(datas, mainTemplate.getItems());
+ return document;
+ }
+
+ private static void buildMainItem(List datas, List items) {
+ RankingPojo main = new RankingPojo();
+ main.setType("Container");
+ main.setHeight("100%");
+ main.setWidth("100%");
+ main.setComponentId("whole");
+ main.setMarginTop("65dp");
+
+ RankingPojo list = new RankingPojo();
+ list.setType("List");
+ list.setHeight("100%");
+ list.setWidth("100%");
+ list.setDirection("horizontal");
+ list.setComponentId("scrollToIndex");
+ list.setData(datas);
+ list.setItems(RANK_CONTAINER_LIST);
+
+ main.setItems(Collections.singletonList(list));
+
+ items.add(RANK_BACKGROUND_IMG);
+ items.add(RANK_HEAD);
+ items.add(main);
+ items.add(RANK_FOOTER);
+ }
+
+ private static RankingPojo buildRankFooter() {
+ RankingPojo footerCon = new RankingPojo();
+ footerCon.setType("Container");
+ footerCon.setPosition("absolute");
+ footerCon.setWidth("100%");
+ footerCon.setLeft("0");
+ footerCon.setBottom("0");
+
+ RankingPojo footer = new RankingPojo();
+ footer.setType("Footer");
+ footer.setHints(Arrays.asList("向右滑","向左滑","打开第一个","返回"));
+
+ footerCon.setItems(Collections.singletonList(footer));
+
+ return footerCon;
+ }
+
+ private static RankingPojo buildRankBackgroundImg() {
+ RankingPojo backGroundImg = new RankingPojo();
+ backGroundImg.setType("Image");
+ backGroundImg.setPosition("absolute");
+ backGroundImg.setTop("0dp");
+ backGroundImg.setLeft("0dp");
+ backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
+ backGroundImg.setHeight("100%");
+ backGroundImg.setWidth("100%");
+
+ return backGroundImg;
+ }
+
+ private static RankingPojo buildRankHead() {
+ RankingPojo head = new RankingPojo();
+ head.setType("Header");
+ head.setHeaderTitle("排行榜");
+ head.setHasBackIcon(false);
+
+ return head;
+ }
+
+ private static List buildImgTextContainer() {
+ RankingPojo container = new RankingPojo();
+ container.setType("Container");
+ container.setAlignItems("center");
+ container.setMarginLeft("15dp");
+
+ RankingPojo image = new RankingPojo();
+ image.setType("Image");
+ image.setSrc("${data.imageSrc}");
+ image.setHeight("220dp");
+ image.setWidth("220dp");
+ image.setComponentId("${data.imageId}");
+ image.setScaleType("fitXY");
+ image.setBorderRadius("10dp");
+
+ Event onClickEvent = new Event("SendEvent", "${data.imageId}");
+ image.setOnClick(Collections.singletonList(onClickEvent));
+
+ RankingPojo text = new RankingPojo();
+ text.setType("Text");
+ text.setFontSize("30dp");
+ text.setMarginTop("10dp");
+ text.setText("${data.imageName}");
+
+ container.setItems(Arrays.asList(image, text));
+ return Collections.singletonList(container);
+ }
+
+ private static String correctName(String name) {
+ int brace = name.indexOf("{");
+ if (brace != -1) name = name.substring(0, brace);
+ return name;
+ }
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankingDocument.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankingDocument.java
index dbd4f07..1cfe25a 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankingDocument.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankingDocument.java
@@ -23,5 +23,5 @@ public class RankingDocument extends Document {
private String rankBotIds;
@JsonIgnore
- private String count;
+ private String count = "15";
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandPojo.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandPojo.java
index 1d30abf..1c4a2eb 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandPojo.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandPojo.java
@@ -26,7 +26,6 @@ public class RecommandPojo {
private String top;
private String left;
private String src;
- private String headerImage;
private String headerTitle;
private Boolean hasBackIcon;
private String componentId;
@@ -48,4 +47,7 @@ public class RecommandPojo {
private String bottom;
private List hints;
private List data;
+ @JsonProperty("background-color")
+ private String backgroundColor;
+
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/Oauth2Controller.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/Oauth2Controller.java
index a68e818..6d46efb 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/Oauth2Controller.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/Oauth2Controller.java
@@ -144,7 +144,15 @@ public class Oauth2Controller {
@RequestMapping("/accessToken")
public @ResponseBody TokenDuerosResponse returnTokenToDueros(@RequestParam String grant_type,
@RequestParam(required = false) String code, @RequestParam String client_id,
- @RequestParam String client_secret, @RequestParam String redirect_uri) {
+ @RequestParam String client_secret, @RequestParam String redirect_uri,
+ @RequestParam(required = false) String refresh_token,
+ @RequestParam(required = false) String refreshToken) {
+ log.info("小度请求Token,client_id:{};client_secret:{};redirect_uri:{};code:{}",
+ client_id, client_secret, redirect_uri, code);
+ if (code == null) {
+ log.info("refreshToken:{},{}",refresh_token,refreshToken);
+ return null;
+ }
log.info("小度请求Token,client_id:{};client_secret:{};redirect_uri:{};code:{}",
client_id, client_secret, redirect_uri, code);
// 请求会出现发来的消息每个值重复一遍的情况,待解决?
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Data.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Data.java
index b26afa4..fabc8ea 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Data.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Data.java
@@ -15,6 +15,7 @@ public class Data {
private String imageSrc;
private String imageName;
private String imageId;
+ private Integer num;
public Data() {
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Item.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Item.java
index 7ec1ee4..8a40c22 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Item.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/dpl/Item.java
@@ -98,4 +98,6 @@ public class Item implements Agent {
private String textOverflow;
private List firstItem;
+ @JsonProperty("background-color")
+ private String backgroundColor;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/GameProjectTbRepository.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/GameProjectTbRepository.java
index a2e97d0..5ddb5cf 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/GameProjectTbRepository.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/primary/GameProjectTbRepository.java
@@ -15,7 +15,7 @@ import java.util.List;
@Repository
public interface GameProjectTbRepository extends JpaRepository {
- List findFirst15ByApplyStatusOrderByWatchDesc(Integer applyStatus);
+ List findFirst10ByApplyStatusOrderByWatchDesc(Integer applyStatus);
@Query(value = "select id,intro,name,watch,banner_img_url,apply_status,bot_account,user_nickname from game_project_tb where apply_status = 1 and id >= (select floor(RAND()*(select MAX(id) from game_project_tb))) order by id limit 10", nativeQuery = true)
List recommendList();
@@ -23,5 +23,6 @@ public interface GameProjectTbRepository extends JpaRepository categoryProject(@Param("category") String category);
- GameProjectTb getByBotAccount(String botAccount);
+ @Query(value = "select id,intro,name,watch,banner_img_url,apply_status,bot_account,user_nickname from game_project_tb where apply_status = 1 order by watch desc limit ?1,15", nativeQuery = true)
+ List postRankBot(Integer begin);
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotService.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotService.java
index e1a2737..bc8f367 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotService.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotService.java
@@ -7,6 +7,7 @@ import ai.qiwu.com.xiaoduhome.common.temple.TempleUtils;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyDocument;
import ai.qiwu.com.xiaoduhome.common.temple.play.PlayDocument;
import ai.qiwu.com.xiaoduhome.common.temple.play.PlayUtils;
+import ai.qiwu.com.xiaoduhome.common.temple.rank.RankUtil;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankingDocument;
import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandDocument;
import ai.qiwu.com.xiaoduhome.entity.primary.*;
@@ -101,17 +102,18 @@ public class DplBotService extends BaseBot {
List l1 = new ArrayList<>();
l1.add(TempleUtils.getFrameRakking());
thirdRow.get(0).setFirstItem(l1);
- thirdRow.get(0).getItems().get(0).setData(buildDataList(ScheduleService.RANKING_LIST));
+ thirdRow.get(0).getItems().get(0).setData(buildDataList(ScheduleService.RANKING_LIST, 1));
List l2 = new ArrayList<>();
l2.add(TempleUtils.getFrameRecommand());
thirdRow.get(1).setFirstItem(l2);
- thirdRow.get(1).getItems().get(0).setData(buildDataList(ScheduleService.RECOMMEND_LIST));
+ thirdRow.get(1).getItems().get(0).setData(buildDataList(ScheduleService.RECOMMEND_LIST, 11));
List l3 = new ArrayList<>();
l3.add(TempleUtils.getFrameCategory());
thirdRow.get(2).setFirstItem(l3);
thirdRow.get(2).getItems().get(0).setData(buildCategoryDataList());
+
CATEGORY_PROD = JSON.parseObject(getDPLTemple("static/json/categoryPro.json"), MyDocument.class);
List- container = CATEGORY_PROD.getMainTemplate().getItems().get(0).getItems();
CATEGORY_PROD_LIST = container.get(2).getItems().get(0);
@@ -484,7 +486,7 @@ public class DplBotService extends BaseBot {
RenderDocument renderDocument = new RenderDocument(PROD_INFO);
this.addDirective(renderDocument);
- this.addDirective(new PushStack());
+ //this.addDirective(new PushStack());
String trace = getSessionAttribute(BACK_TRACE);
log.info("before trace------------:{}",trace);
StringBuilder builder = new StringBuilder();
@@ -766,13 +768,14 @@ public class DplBotService extends BaseBot {
return response;
}
- private static List buildDataList(List list) {
+ private static List buildDataList(List list, int begin) {
ArrayList dataList = new ArrayList<>();
for (GameProjectTb projectInfo : list) {
String productName = correctName(projectInfo.getName());
String imageId = new StringBuilder(Constants.PRE_PRODUCT_IMG).append(projectInfo.getName()).toString();
String src = new StringBuilder(Constants.IMG_PREFIX).append(projectInfo.getBannerImgUrl()).toString();
Data data = new Data(src, productName, imageId);
+ data.setNum(begin++);
dataList.add(data);
}
return dataList;
@@ -780,9 +783,11 @@ public class DplBotService extends BaseBot {
private static List buildCategoryDataList() {
ArrayList dataList = new ArrayList<>();
+ int i = 21;
for (String cateName : CATEGORY) {
String imageId = new StringBuilder(PRE_CATEGORY).append(cateName).toString();
Data data = new Data(GU_FENG, cateName, imageId);
+ data.setNum(i++);
dataList.add(data);
}
return dataList;
@@ -1246,18 +1251,27 @@ public class DplBotService extends BaseBot {
CollectHistoryDocument document = TempleUtils.getCollectPage(Integer.parseInt(appUserId));
RenderDocument render = new RenderDocument(document);
dplBotService.addDirective(render);
- dplBotService.addDirective(new PushStack());
+ //dplBotService.addDirective(new PushStack());
dplBotService.setSessionAttribute(PRE_COLLE,document.getIdToken());
dplBotService.setSessionAttribute(BACK_TRACE, "01");
detail.getAttributes().put(PRE_COLLE, document.getIdToken());
detail.getAttributes().put(BACK_TRACE,"01");
detail.getDirectives().add(render);
- detail.getDirectives().add(new PushStack());
+ //detail.getDirectives().add(new PushStack());
//LAST_OUTTIME_RESULT.put(userId, new Response());
LAST_OUTTIME_RESULT.put(userId, detail);
return;
}
} else if ("openNum".equals(intentName)) {
+ String trace = dplBotService.getSessionAttribute("trace");
+ if (trace == null || trace.charAt(1) == '0') {
+ String numStr = getSlot("sys.number");
+ int num = 1;
+ if (numStr != null) num = Integer.parseInt(numStr);
+ detail.setResponse(dealOpenNumInHome(num, detail));
+ LAST_OUTTIME_RESULT.put(userId, detail);
+ return;
+ }
String collectToken = getSessionAttribute(PRE_COLLE);
String rankToken = getSessionAttribute("ranking");
String recommengToken = getSessionAttribute("recommand");
@@ -1310,9 +1324,30 @@ public class DplBotService extends BaseBot {
ExecuteCommands executeCommands = new ExecuteCommands();
ScrollToIndexCommand scroll = new ScrollToIndexCommand();
scroll.setComponentId("scrollToIndex");
+ String updateCount = dplBotService.getSessionAttribute("updateCount");
+ if (intentRequest.getQuery().getOriginal().contains("页") && updateCount != null && !"0".equals(updateCount)) {
+ int update = Integer.valueOf(updateCount);
+ RankingDocument document = RankUtil.updateRankDocument(update-1);
+ if (document == null) {
+ detail.setResponse(buildErrorResponse("排行榜已经被您翻到底啦,没有了"));
+ break;
+ }
+ RenderDocument render = new RenderDocument(document);
+ dplBotService.addDirective(render);
+ detail.getDirectives().add(render);
+ dplBotService.setSessionAttribute("pageIndex",null);
+ detail.getAttributes().put("pageIndex",null);
+ dplBotService.setSessionAttribute("count", document.getCount());
+ detail.getAttributes().put("count", document.getCount());
+ dplBotService.setSessionAttribute("updateCount", String.valueOf(update-1));
+ detail.getAttributes().put("updateCount", String.valueOf(update-1));
+ detail.setResponse(buildErrorResponse(new StringBuilder("为您刷新排行榜,下面是排行")
+ .append(update*15).append("到").append(update*15+15).append("的作品").toString()));
+ break;
+ }
index -= 4;
if (index < 0) index = 0;
- scroll.setIndex(index+4);
+ scroll.setIndex(index);
scroll.setAlign(ScrollToIndexCommand.AlignType.FIRST);
executeCommands.addCommand(scroll);
dplBotService.addDirective(executeCommands);
@@ -1351,8 +1386,9 @@ public class DplBotService extends BaseBot {
break;
}
case 3: {
- index = 4;
+ index = 0;
if (pageIndex != null) index = Integer.parseInt(pageIndex);
+ index += 4;
ExecuteCommands executeCommands = new ExecuteCommands();
ScrollToIndexCommand scroll = new ScrollToIndexCommand();
scroll.setComponentId("scrollToIndex");
@@ -1367,15 +1403,45 @@ public class DplBotService extends BaseBot {
break;
}
case 4: {
- index = 3;
+ int count = 15;
+ String countStr = dplBotService.getSessionAttribute("count");
+ if (countStr != null) count = Integer.parseInt(countStr);
+ if (intentRequest.getQuery().getOriginal().contains("页")) {
+ //update
+ String updateCount = dplBotService.getSessionAttribute("updateCount");
+ int update = 1;
+ if (updateCount != null) update = Integer.valueOf(updateCount);
+ RankingDocument document = RankUtil.updateRankDocument(update);
+ if (document == null) {
+ detail.setResponse(buildErrorResponse("排行榜已经被您翻到底啦,没有了"));
+ break;
+ }
+ count = Integer.parseInt(document.getCount());
+ RenderDocument render = new RenderDocument(document);
+ dplBotService.addDirective(render);
+ detail.getDirectives().add(render);
+ dplBotService.setSessionAttribute("pageIndex",null);
+ detail.getAttributes().put("pageIndex",null);
+ dplBotService.setSessionAttribute("count", document.getCount());
+ detail.getAttributes().put("count", document.getCount());
+ dplBotService.setSessionAttribute("updateCount", String.valueOf(update+1));
+ detail.getAttributes().put("updateCount", String.valueOf(update+1));
+ detail.setResponse(buildErrorResponse(new StringBuilder("为您刷新排行榜,下面是排行")
+ .append(update*15).append("到").append(update*15+count).append("的作品").toString()));
+ break;
+ }
+ index = 0;
if (pageIndex != null) index = Integer.parseInt(pageIndex);
ExecuteCommands executeCommands = new ExecuteCommands();
ScrollToIndexCommand scroll = new ScrollToIndexCommand();
scroll.setComponentId("scrollToIndex");
index += 4;
- if (index >= 15) index = 14;
+ if (index >= count) {
+ detail.setResponse(buildErrorResponse("请说下一页刷新榜单"));
+ break;
+ }
scroll.setIndex(index);
- scroll.setAlign(ScrollToIndexCommand.AlignType.LAST);
+ scroll.setAlign(ScrollToIndexCommand.AlignType.FIRST);
executeCommands.addCommand(scroll);
dplBotService.addDirective(executeCommands);
detail.getDirectives().add(executeCommands);
@@ -1394,14 +1460,14 @@ public class DplBotService extends BaseBot {
CollectHistoryDocument document = TempleUtils.getHistory(getUserId());
RenderDocument render = new RenderDocument(document);
dplBotService.addDirective(render);
- dplBotService.addDirective(new PushStack());
+ //dplBotService.addDirective(new PushStack());
dplBotService.setSessionAttribute(PRE_COLLE,document.getIdToken());
dplBotService.setSessionAttribute("ranking", null);
dplBotService.setSessionAttribute("recommand", null);
dplBotService.setSessionAttribute(BACK_TRACE, "02");
detail.getDirectives().add(render);
- detail.getDirectives().add(new PushStack());
+ //detail.getDirectives().add(new PushStack());
detail.getAttributes().put("ranking", null);
detail.getAttributes().put("recommand", null);
detail.getAttributes().put(PRE_COLLE,document.getIdToken());
@@ -1415,8 +1481,8 @@ public class DplBotService extends BaseBot {
RenderDocument render = new RenderDocument();
render.setDocument(recommandDocument);
dplBotService.addDirective(render);
- dplBotService.addDirective(new PushStack());
- detail.getDirectives().add(new PushStack());
+ //dplBotService.addDirective(new PushStack());
+ //detail.getDirectives().add(new PushStack());
detail.getDirectives().add(render);
String token = recommandDocument.getRecommendIdList();
if (token != null) {
@@ -1442,9 +1508,9 @@ public class DplBotService extends BaseBot {
RenderDocument render = new RenderDocument();
render.setDocument(document);
dplBotService.addDirective(render);
- dplBotService.addDirective(new PushStack());
+ //dplBotService.addDirective(new PushStack());
detail.getDirectives().add(render);
- detail.getDirectives().add(new PushStack());
+ //detail.getDirectives().add(new PushStack());
String token = document.getRankBotIds();
if (token != null) {
dplBotService.setSessionAttribute("ranking", token);
@@ -1455,6 +1521,12 @@ public class DplBotService extends BaseBot {
detail.getAttributes().put("recommand", null);
detail.getAttributes().put(PRE_COLLE, null);
}
+ dplBotService.setSessionAttribute("pageIndex",null);
+ dplBotService.setSessionAttribute("count",null);
+ dplBotService.setSessionAttribute("updateCount",null);
+ detail.getAttributes().put("pageIndex",null);
+ detail.getAttributes().put("count",null);
+ detail.getAttributes().put("updateCount",null);
dplBotService.setSessionAttribute("pageSign", "4");
detail.getAttributes().put("pageSign", "4");
dplBotService.setSessionAttribute(BACK_TRACE, "04");
@@ -1652,6 +1724,8 @@ public class DplBotService extends BaseBot {
document.getMainTemplate().getItems().get(2).setSrc(data.getAudio());
FUNNY_DEFAULT_DOCUMENT = document;
RenderDocument render = new RenderDocument(document);
+ dplBotService.addDirective(new PushStack());
+ detail.getDirectives().add(new PushStack());
dplBotService.addDirective(render);
//detail.getDirectives().add(render);
LAST_OUTTIME_RESULT.put(userId, detail);
@@ -1745,6 +1819,135 @@ public class DplBotService extends BaseBot {
}
}
+ private Response dealOpenNumInHome(int num, OverTimeDetail detail) {
+ if (num > 0 && num <= 10) {
+ GameProjectTb bot = ScheduleService.getRankingList().get(num-1);
+ return enterProductInfo(bot.getName(), detail);
+ } else if (num > 10 && num <= 20) {
+ GameProjectTb bot = ScheduleService.getRecommendList().get(num-11);
+ return enterProductInfo(bot.getName(), detail);
+ } else if (num > 20 && num <= 30) {
+ String categoryName = ScheduleService.CATEGORY[num-21];
+ displayCategoryProd(categoryName);
+ CATEGORY_PROD_HEAD.setHeaderTitle(categoryName);
+ RenderDocument render = new RenderDocument(CATEGORY_PROD);
+ this.addDirective(render);
+ detail.getDirectives().add(render);
+ return buildErrorResponse(new StringBuilder("为您打开").append(categoryName).append("类作品").toString());
+// this.addDirective(new PushStack());
+// detail.getDirectives().add(new PushStack());
+ }
+ else {
+ return buildErrorResponse("这数字超出我的范围了");
+ }
+ }
+
+ private Response enterProductInfo(String productName, OverTimeDetail detail) {
+ OnProductDetail productDetail = ScheduleService.PRODUCT_NAME_DETAIL.get(productName);
+ if (productDetail == null && !productName.equals("清新传")) {
+ return buildErrorResponse("目前不支持该作品");
+ }
+ String imgUrl = new StringBuilder(Constants.IMG_PREFIX).append(productDetail.getBannerImgUrl()).toString();
+
+ List
- content = PROD_INFO.getMainTemplate().getItems().get(2).getItems().get(0).getItems().get(0).getItems();
+
+ // product picture
+ content.get(0).setSrc(imgUrl);
+
+ // text content
+ List
- contentText = content.get(1).getItems();
+ // product name
+ productName = correctName(productName);
+ contentText.get(0).setText(productName);
+
+ // product create time
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+ String dateString = formatter.format(productDetail.getCreateTime());
+ contentText.get(1).getItems().get(0).setText(new StringBuilder(Constants.PRODUCT_INTRO.CREATE_TIME).append(dateString).toString());
+
+ // product author
+ contentText.get(1).getItems().get(1).setText(new StringBuilder(Constants.PRODUCT_INTRO.AUTHOR).append(productDetail.getAuthorName()).toString());
+
+ // product labels
+ StringBuilder labels = new StringBuilder(Constants.PRODUCT_INTRO.LABEL);
+ for (String label: productDetail.getLabels()) {
+ labels.append(Constants.PRODUCT_INTRO.SPACE).append(label);
+ }
+ contentText.get(2).getItems().get(0).setText(labels.toString());
+
+ // product introduction
+ contentText.get(3).getItems().get(0).setText(productDetail.getIntro());
+
+ List
- icons = contentText.get(4).getItems();
+ // "start product" container button
+ String enterProName = new StringBuilder(Constants.PRE_ENTER_PRODUCT).append(productName).toString();
+ icons.get(0).setComponentId(enterProName);
+ icons.get(0).getOnClick().get(0).setComponentId(enterProName);
+
+ String accessToken = getAccessToken();
+ if (accessToken != null) {
+ // flower container button
+ Integer count = getUserSendFlowerNum(productDetail.getBotAccount());
+ Item flower = icons.get(1);
+ flower.getItems().get(1).setText(USER_SEND_FLOWER+count);
+ String flowerReward = new StringBuilder(FLOWE).append(productDetail.getBotAccount()).toString();
+ flower.setComponentId(flowerReward);
+ flower.getOnClick().get(0).setComponentId(flowerReward);
+
+ // collection container button
+ boolean collec = didUserCollecThisProduct(productDetail.getBotAccount());
+ Item collecButton = icons.get(2);
+ if (collec) {
+ collecButton.getItems().get(1).setText(COLLECED);
+ collecButton.getItems().get(0).setSrc(COLLECTED_IMG_URL);
+ String unCollecId = new StringBuilder(UN_COLLEC_ID).append(productDetail.getBotAccount()).toString();
+ collecButton.setComponentId(unCollecId);
+ collecButton.getOnClick().get(0).setComponentId(unCollecId);
+ } else {
+ collecButton.getItems().get(1).setText(UN_COLLEC);
+ collecButton.getItems().get(0).setSrc(UN_COLLECTED_IMG_URL);
+ String collecId = new StringBuilder(COLLEC_ID).append(productDetail.getBotAccount()).toString();
+ collecButton.setComponentId(collecId);
+ collecButton.getOnClick().get(0).setComponentId(collecId);
+ }
+ } else {
+ Item flower = icons.get(1);
+ flower.getItems().get(1).setText(FLOWER);
+ flower.setComponentId(FLOWER_LOAD);
+ flower.getOnClick().get(0).setComponentId(FLOWER_LOAD);
+
+ Item collecButton = icons.get(2);
+ collecButton.getItems().get(1).setText(UN_COLLEC);
+ collecButton.getItems().get(0).setSrc(UN_COLLECTED_IMG_URL);
+ collecButton.setComponentId(FLOWER_LOAD);
+ collecButton.getOnClick().get(0).setComponentId(FLOWER_LOAD);
+ }
+
+ RenderDocument renderDocument = new RenderDocument(PROD_INFO);
+ this.addDirective(renderDocument);
+ this.addDirective(new PushStack());
+ detail.getDirectives().add(renderDocument);
+ detail.getDirectives().add(new PushStack());
+ String trace = getSessionAttribute(BACK_TRACE);
+ log.info("before trace------------:{}",trace);
+ StringBuilder builder = new StringBuilder();
+ if (trace == null || trace.length() < 2) {
+ builder.append("00");
+ } else if (trace.length()>2) {
+ builder.append(trace, 0, 2);
+ } else {
+ builder.append(trace);
+ }
+
+ trace = builder.append(productDetail.getBotAccount()).toString();
+ log.info("after trace------------:{}",trace);
+ this.setSessionAttribute(BACK_TRACE, trace);
+ this.setSessionAttribute("pageSign",null);
+ detail.getAttributes().put(BACK_TRACE, trace);
+ detail.getAttributes().put("pageSign",null);
+ return new Response();
+ }
+
private FunnyDocument displayFunnyRecommandPage(String word) {
try {
List botNames = Utils.getRecommandBotNames(word);
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java
index 815f8c3..82ca0cd 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java
@@ -26,6 +26,7 @@ import java.util.concurrent.ConcurrentHashMap;
@Slf4j
@Component
public class ScheduleService implements InitializingBean {
+ static int allProductCount;
static volatile List RANKING_LIST = new ArrayList<>();
static volatile List RECOMMEND_LIST = new ArrayList<>();
static volatile List ALL_ON_PRODUCT = new ArrayList<>();
@@ -64,7 +65,7 @@ public class ScheduleService implements InitializingBean {
@Scheduled(cron = "0 0 19 * * ?")
public void initRankingList() {
new Thread(() -> {
- RANKING_LIST = gameProjectTbRepository.findFirst15ByApplyStatusOrderByWatchDesc(1);
+ RANKING_LIST = gameProjectTbRepository.findFirst10ByApplyStatusOrderByWatchDesc(1);
//log.info("排行榜:{}", RANKING_LIST);
}).start();
//log.error("更新排行榜出错:{}", e.getMessage());
@@ -83,6 +84,7 @@ public class ScheduleService implements InitializingBean {
public void initAllOnTableProductInfo() {
new Thread(() -> {
ALL_ON_PRODUCT = allOnProductInfoRepository.findAllByApplyStatus(1);
+ allProductCount = ALL_ON_PRODUCT.size();
for (OnProductDetail item : ALL_ON_PRODUCT) {
String productName = item.getName();
String botAccount = item.getBotAccount();
@@ -190,4 +192,12 @@ public class ScheduleService implements InitializingBean {
public static List getExceptBotAccount() {
return EXCEPT_BOT_ACCOUNT;
}
+
+ public static List getAllOnProduct() {
+ return ALL_ON_PRODUCT;
+ }
+
+ public static int getAllProductCount() {
+ return allProductCount;
+ }
}
diff --git a/xiaoduhome/src/main/resources/static/json/categoryPro.json b/xiaoduhome/src/main/resources/static/json/categoryPro.json
index d36ccab..5e19cad 100644
--- a/xiaoduhome/src/main/resources/static/json/categoryPro.json
+++ b/xiaoduhome/src/main/resources/static/json/categoryPro.json
@@ -22,9 +22,8 @@
},
{
"type": "Header",
- "headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "横向列表",
- "hasBackIcon": true
+ "hasBackIcon": false
},
{
"type": "Container",
diff --git a/xiaoduhome/src/main/resources/static/json/frame.json b/xiaoduhome/src/main/resources/static/json/frame.json
index 0683269..fef0278 100644
--- a/xiaoduhome/src/main/resources/static/json/frame.json
+++ b/xiaoduhome/src/main/resources/static/json/frame.json
@@ -2,27 +2,27 @@
"type": "Container",
"flex-direction": "row",
"margin-bottom": "15dp",
+ "margin-top": "15dp",
"items": [
{
"type": "Text",
- "text": "作品排行榜",
- "font-size": "35dp",
+ "text": "排行榜",
+ "font-size": "38dp",
"margin-left": "30dp"
},
{
"type": "Frame",
"margin-left": "15dp",
- "border-width": "1dp",
"border-top-left-radius": "25dp",
"border-top-right-radius": "15dp",
"border-bottom-right-radius": "15dp",
"padding-vertical": "8dp",
"padding-horizontal": "15dp",
- "border-color": "rgb(255,255,255)",
+ "background-color": "rgb(105,105,105)",
"items": [
{
"type": "Text",
- "font-size": "15dp",
+ "font-size": "28dp",
"color": "rgb(255,255,255)"
}
]
diff --git a/xiaoduhome/src/main/resources/static/json/onLunch2.json b/xiaoduhome/src/main/resources/static/json/onLunch2.json
index 52e9b4f..d60bc93 100644
--- a/xiaoduhome/src/main/resources/static/json/onLunch2.json
+++ b/xiaoduhome/src/main/resources/static/json/onLunch2.json
@@ -25,7 +25,8 @@
{
"type": "Header",
"headerImage": "https://aliyun-hz1.chewrobot.com/xiaodu/image/5b2d0a11/lvzhou/15640330891628686.jpg",
- "headerTitle": "交游天下"
+ "headerTitle": "交游天下",
+ "hasBackIcon": false
},
{
"type": "ScrollView",
@@ -33,43 +34,34 @@
"height": "100%",
"width": "100%",
"componentId": "scrollCom",
- "onLoaded": [
- {
- "type": "ScrollToIndex",
- "componentId": "rankScroll",
- "index": 7,
- "align": "center"
- },
- {
- "type": "ScrollToIndex",
- "componentId": "recomScroll",
- "index": 6,
- "align": "center"
- }
- ],
"items": [
{
"type": "Container",
"height": "250dp",
"width": "100%",
+ "margin-bottom": "20dp",
"items": [
{
"type": "List",
"height": "250dp",
+ "margin-left": "15dp",
"width": "100%",
"direction": "horizontal",
- "componentId": "rankScroll",
"items": [
{
"type": "Container",
- "align-items": "center",
- "margin-left": "30dp",
+ "height":"200dp",
+ "width":"200dp",
+ "margin-left": "15dp",
"items": [
{
"type": "Image",
"componentId": "${data.imageId}",
- "width": "160dp",
- "height": "160dp",
+ "width": "180dp",
+ "height": "180dp",
+ "margin-left": "7dp",
+ "margin-top": "7dp",
+ "position": "absolute",
"border-radius": "15dp",
"src": "${data.imageSrc}",
"scale-type": "fitXY",
@@ -81,9 +73,32 @@
]
},
{
+ "type": "Frame",
+ "width": "35dp",
+ "height": "35dp",
+ "background-color": "rgb(0,0,0)",
+ "border-radius": "10dp",
+ "items": [
+ {
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "align-items":"center",
+ "items": [
+ {
+ "type": "Text",
+ "text": "${data.num}",
+ "font-size": "22dp"
+ }
+ ]
+ }
+ ]
+ },
+ {
"type": "Text",
- "font-size": "24dp",
- "margin-top": "10dp",
+ "font-size": "28dp",
+ "margin-top": "157dp",
+ "margin-left": "7dp",
"text": "${data.imageName}"
}
]
@@ -96,25 +111,30 @@
"type": "Container",
"height": "250dp",
"width": "100%",
- "margin-top": "30dp",
+ "margin-top": "50dp",
+ "margin-bottom": "20dp",
"items": [
{
"type": "List",
"height": "100%",
"width": "100%",
- "componentId": "recomScroll",
+ "margin-left": "15dp",
"direction": "horizontal",
"items": [
{
"type": "Container",
- "margin-left": "30dp",
- "align-items": "center",
+ "margin-left": "15dp",
+ "height":"200dp",
+ "width":"200dp",
"items": [
{
"type": "Image",
"componentId": "${data.imageId}",
- "width": "160dp",
- "height": "160dp",
+ "width": "180dp",
+ "height": "180dp",
+ "margin-left": "7dp",
+ "margin-top": "7dp",
+ "position": "absolute",
"border-radius": "15dp",
"src": "${data.imageSrc}",
"scale-type": "fitXY",
@@ -126,9 +146,32 @@
]
},
{
+ "type": "Frame",
+ "width": "35dp",
+ "height": "35dp",
+ "background-color": "rgb(0,0,0)",
+ "border-radius": "10dp",
+ "items": [
+ {
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "align-items":"center",
+ "items": [
+ {
+ "type": "Text",
+ "text": "${data.num}",
+ "font-size": "22dp"
+ }
+ ]
+ }
+ ]
+ },
+ {
"type": "Text",
- "font-size": "24dp",
- "margin-top": "10dp",
+ "font-size": "28dp",
+ "margin-left": "7dp",
+ "margin-top": "157dp",
"text": "${data.imageName}"
}
]
@@ -141,25 +184,30 @@
"type": "Container",
"height": "250dp",
"width": "100%",
- "margin-top": "30dp",
- "margin-bottom": "60dp",
+ "margin-top": "50dp",
+ "margin-bottom": "70dp",
"items": [
{
"type": "List",
"height": "100%",
"width": "100%",
+ "margin-left": "15dp",
"direction": "horizontal",
"items": [
{
"type": "Container",
- "align-items": "center",
- "margin-left": "30dp",
+ "margin-left": "15dp",
+ "height":"200dp",
+ "width":"200dp",
"items": [
{
"type": "Image",
"componentId": "${data.imageId}",
"width": "160dp",
"height": "160dp",
+ "margin-left": "7dp",
+ "margin-top": "7dp",
+ "position": "absolute",
"border-radius": "15dp",
"src": "${data.imageSrc}",
"scale-type": "fitXY",
@@ -171,9 +219,34 @@
]
},
{
+ "type": "Frame",
+ "width": "35dp",
+ "height": "35dp",
+ "background-color": "rgb(0,0,0)",
+ "border-radius": "10dp",
+ "items": [
+ {
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "align-items":"center",
+ "items": [
+ {
+ "type": "Text",
+ "text-overflow": "ellipsis",
+ "max-lines": 1,
+ "text": "${data.num}",
+ "font-size": "22dp"
+ }
+ ]
+ }
+ ]
+ },
+ {
"type": "Text",
- "font-size": "24dp",
- "margin-top": "10dp",
+ "font-size": "28dp",
+ "margin-left": "7dp",
+ "margin-top": "137dp",
"text": "${data.imageName}"
}
]
@@ -184,7 +257,7 @@
},
{
"type": "Container",
- "height": "50dp",
+ "height": "80dp",
"width": "100%"
}
]
diff --git a/xiaoduhome/src/main/resources/static/json/productInfo.json b/xiaoduhome/src/main/resources/static/json/productInfo.json
index 9304207..193d64b 100644
--- a/xiaoduhome/src/main/resources/static/json/productInfo.json
+++ b/xiaoduhome/src/main/resources/static/json/productInfo.json
@@ -17,9 +17,8 @@
},
{
"type": "Header",
- "headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "交游天下",
- "hasBackIcon": true
+ "hasBackIcon": false
},
{
"type": "Container",
@@ -114,7 +113,7 @@
{
"type": "Text",
"font-size": "25dp",
- "line-height": "5dp",
+ "line-height": "20dp",
"margin-top": "30dp",
"max-lines": 3,
"text-overflow": "ellipsis",
diff --git a/xiaoduhome/src/main/resources/static/json/ranking.json b/xiaoduhome/src/main/resources/static/json/ranking.json
index 67e7c6e..ae5bd20 100644
--- a/xiaoduhome/src/main/resources/static/json/ranking.json
+++ b/xiaoduhome/src/main/resources/static/json/ranking.json
@@ -7,65 +7,58 @@
],
"items": [
{
+ "type": "Image",
+ "position": "absolute",
+ "top": "0dp",
+ "left": "0dp",
+ "src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg",
+ "height": "100%",
+ "width": "100%"
+ },
+ {
+ "type": "Header",
+ "headerTitle": "排行榜",
+ "hasBackIcon": false
+ },
+ {
"type": "Container",
"height": "100%",
"width": "100%",
+ "componentId": "whole",
+ "margin-top": "65dp",
"items": [
{
- "type": "Image",
- "position": "absolute",
- "top": "0dp",
- "left": "0dp",
- "src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg",
- "height": "100%",
- "width": "100%"
- },
- {
- "type": "Header",
- "headerTitle": "排行榜",
- "hasBackIcon": false
- },
- {
- "type": "Container",
+ "type": "List",
"height": "100%",
"width": "100%",
- "componentId": "whole",
- "margin-top": "65dp",
+ "direction": "horizontal",
+ "componentId": "scrollToIndex",
"items": [
{
- "type": "List",
- "height": "100%",
- "width": "100%",
- "direction": "horizontal",
- "componentId": "scrollToIndex",
+ "type": "Container",
+ "align-items": "center",
+ "margin-left": "15dp",
"items": [
{
- "type": "Container",
- "align-items": "center",
- "margin-left": "15dp",
- "items": [
+ "type": "Image",
+ "width": "220dp",
+ "height": "220dp",
+ "componentId": "${data.imageId}",
+ "scale-type": "fitXY",
+ "border-radius": "10dp",
+ "src": "${data.imageSrc}",
+ "onClick": [
{
- "type": "Image",
- "width": "220dp",
- "height": "220dp",
- "componentId": "${data.imageId}",
- "scale-type": "fitXY",
- "border-radius": "10dp",
- "src": "${data.imageSrc}",
- "onClick": [
- {
- "type": "SendEvent",
- "componentId": "${data.imageId}"
- }
- ]
- },
- {
- "type": "Text",
- "font-size": "30dp",
- "margin-top": "10dp",
- "text": "${data.imageName}"
+ "type": "SendEvent",
+ "componentId": "${data.imageId}"
}
]
+ },
+ {
+ "type": "Text",
+ "font-size": "30dp",
+ "margin-top": "10dp",
+ "text": "${data.imageName}"
}
]
}
@@ -83,7 +76,7 @@
{
"type": "Footer",
"hints": [
- "打开推荐作品","下一个分类","打开排行榜"
+ "向右滑","向左滑","打开第一个","返回"
]
}
]
diff --git a/xiaoduhome/src/main/resources/static/json/recommand.json b/xiaoduhome/src/main/resources/static/json/recommand.json
index 3e66859..ee435b1 100644
--- a/xiaoduhome/src/main/resources/static/json/recommand.json
+++ b/xiaoduhome/src/main/resources/static/json/recommand.json
@@ -83,7 +83,7 @@
{
"type": "Footer",
"hints": [
- "打开推荐作品","下一个分类","打开排行榜"
+ "打开第一个","下一页","返回"
]
}
]
diff --git a/xiaoduhome/src/main/resources/static/json/recommand2.json b/xiaoduhome/src/main/resources/static/json/recommand2.json
new file mode 100644
index 0000000..978642f
--- /dev/null
+++ b/xiaoduhome/src/main/resources/static/json/recommand2.json
@@ -0,0 +1,173 @@
+{
+ "type": "DPL",
+ "version": "1.0",
+ "mainTemplate": {
+ "parameters": [
+ "payload"
+ ],
+ "items": [
+ {
+ "type": "Image",
+ "position": "absolute",
+ "top": "0dp",
+ "left": "0dp",
+ "src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg",
+ "height": "100%",
+ "width": "100%"
+ },
+ {
+ "type": "Header",
+ "headerTitle": "推荐页",
+ "hasBackIcon": false
+ },
+ {
+ "type": "Container",
+ "height": "100%",
+ "width": "100%",
+ "items": [
+ {
+ "type": "List",
+ "height": "50%",
+ "width": "100%",
+ "margin-left": "15dp",
+ "direction": "horizontal",
+ "items": [
+ {
+ "type": "Container",
+ "margin-left": "15dp",
+ "items": [
+ {
+ "type": "Image",
+ "width": "220dp",
+ "height": "220dp",
+ "margin-left": "7dp",
+ "margin-top": "7dp",
+ "position": "absolute",
+ "componentId": "${data.imageId}",
+ "scale-type": "fitXY",
+ "border-radius": "10dp",
+ "src": "${data.imageSrc}",
+ "onClick": [
+ {
+ "type": "SendEvent",
+ "componentId": "${data.imageId}"
+ }
+ ]
+ },
+ {
+ "type": "Frame",
+ "width": "45dp",
+ "height": "45dp",
+ "background-color": "rgb(0,0,0)",
+ "border-radius": "10dp",
+ "items": [
+ {
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "align-items":"center",
+ "items": [
+ {
+ "type": "Text",
+ "text": "${data.num}",
+ "font-size": "28dp",
+ "margin-top": "157dp",
+ "margin-left": "7dp"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "type": "Text",
+ "font-size": "30dp",
+ "margin-top": "10dp",
+ "text": "${data.imageName}"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "type": "List",
+ "height": "50%",
+ "width": "100%",
+ "margin-left": "15dp",
+ "direction": "horizontal",
+ "items": [
+ {
+ "type": "Container",
+ "margin-left": "15dp",
+ "items": [
+ {
+ "type": "Image",
+ "width": "220dp",
+ "height": "220dp",
+ "margin-left": "7dp",
+ "margin-top": "7dp",
+ "position": "absolute",
+ "componentId": "${data.imageId}",
+ "scale-type": "fitXY",
+ "border-radius": "10dp",
+ "src": "${data.imageSrc}",
+ "onClick": [
+ {
+ "type": "SendEvent",
+ "componentId": "${data.imageId}"
+ }
+ ]
+ },
+ {
+ "type": "Frame",
+ "width": "45dp",
+ "height": "45dp",
+ "background-color": "rgb(0,0,0)",
+ "border-radius": "10dp",
+ "items": [
+ {
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "align-items":"center",
+ "items": [
+ {
+ "type": "Text",
+ "text": "${data.num}",
+ "font-size": "28dp",
+ "margin-top": "157dp",
+ "margin-left": "7dp"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "type": "Text",
+ "font-size": "30dp",
+ "margin-top": "10dp",
+ "text": "${data.imageName}"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "type": "Container",
+ "position": "absolute",
+ "width": "100%",
+ "left": "0",
+ "bottom": "0",
+ "items": [
+ {
+ "type": "Footer",
+ "hints": [
+ "打开第一个","下一页","返回"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file