diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 19b0965..0baa8eb 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,24 +3,24 @@
-
+
+
+
+
+
+
-
+
+
-
-
-
-
-
-
-
-
+
-
+
+
@@ -67,42 +67,61 @@
-
-
+
+
-
+
-
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
@@ -110,26 +129,58 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
@@ -148,9 +199,6 @@
- new Thread
- position
- direction
POOL.submit
AppFavoriteTBRepository
xiaoDuOrderTbRepository
@@ -178,6 +226,9 @@
uploadImage
RANKING_LIST
max
+ DU_ID_2_US_ID
+ position
+ LunchUtils
OPENID_CACHE
@@ -193,21 +244,6 @@
@@ -276,8 +327,8 @@
-
-
+
+
@@ -289,7 +340,6 @@
-
@@ -300,6 +350,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -375,7 +488,7 @@
-
+
@@ -513,6 +626,7 @@
+
@@ -527,7 +641,7 @@
-
+
@@ -579,7 +693,7 @@
-
+
@@ -593,12 +707,12 @@
-
-
+
+
-
+
@@ -957,7 +1071,6 @@
-
@@ -979,14 +1092,15 @@
+
+
-
@@ -1073,7 +1187,8 @@
-
+
+
@@ -1083,7 +1198,7 @@
-
+
@@ -1095,7 +1210,7 @@
-
+
@@ -1108,14 +1223,14 @@
-
-
+
+
-
+
@@ -1126,7 +1241,7 @@
-
+
@@ -1144,382 +1259,433 @@
-
-
-
-
-
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
-
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSConstants.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSConstants.java
index 7ca0565..aecc20f 100644
--- a/tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSConstants.java
+++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/common/TTSConstants.java
@@ -20,6 +20,9 @@ public interface TTSConstants {
String DELETE_FAIL = "删除文件失败";
String DELETE_OFFLINE_FAIL = "对线下测试服务器的删除指令调用失败";
+ String TTS_REMOTE_ADDR = "127.0.0.1";
+ String TTS_REMOTE_LOCALHOST = "localhost";
+
interface BAI_DU {
String APP_ID = "16998411";
String API_KEY = "bHlKRYe9d5o7Ad2z2D5aGiVw";
diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java
index 8d729de..421a09f 100644
--- a/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java
+++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/controller/TTSController.java
@@ -7,8 +7,11 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import static ai.qiwu.com.tts_service.common.TTSConstants.TTS_REMOTE_ADDR;
+
/**
* @author 苗权威
@@ -38,16 +41,18 @@ public class TTSController {
@GetMapping("/api/tts")
public void tts_get(@RequestParam(required = false) String person, @RequestParam(required = false) String tone,
- @RequestParam(required = false) String text, @RequestParam(required = false) String botname,
- @RequestParam(required = false) String _type, @RequestParam(required = false) String volume,
- @RequestParam(required = false) String pitch, @RequestParam(required = false) String speed,
- HttpServletResponse servletResponse) {
- TTSRequest ttsRequest = new TTSRequest(person, text, _type, pitch, tone, botname, volume, speed);
+ @RequestParam(required = false) String text, @RequestParam(required = false) String botname,
+ @RequestParam(required = false) String _type, @RequestParam(required = false) String volume,
+ @RequestParam(required = false) String pitch, @RequestParam(required = false) String speed,
+ @RequestParam(required = false) String get_online, HttpServletResponse servletResponse) {
+ TTSRequest ttsRequest = new TTSRequest(person, text, _type, pitch, tone, botname, volume, speed,get_online);
ttService.tts(ttsRequest, "GET", servletResponse);
}
@PostMapping("/api/tts")
public void tts_post(@RequestBody TTSRequest ttsRequest, HttpServletResponse response) {
+// String remoteAddr = request.getRemoteAddr();
+// if (!TTS_REMOTE_ADDR.equals(remoteAddr) && !TTS_REMOTE_ADDR.equals(remoteAddr))
ttService.tts(ttsRequest, "POST", response);
}
diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/TTSRequest.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/TTSRequest.java
index 8e402ef..e6463e2 100644
--- a/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/TTSRequest.java
+++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/pojo/TTSRequest.java
@@ -22,9 +22,10 @@ public class TTSRequest {
private String botname;
private String volume;
private String speed;
+ private String get_online;
public TTSRequest(String person, String text, String _type, String pitch,
- String tone, String botname, String volume, String speed) {
+ String tone, String botname, String volume, String speed,String get_online) {
this.person = person;
this.text = text;
this._type = _type;
@@ -33,5 +34,6 @@ public class TTSRequest {
this.botname = botname;
this.volume = volume;
this.speed = speed;
+ this.get_online = get_online;
}
}
diff --git a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/Initialize.java b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/Initialize.java
index 2823757..8b39b30 100644
--- a/tts_service/src/main/java/ai/qiwu/com/tts_service/service/Initialize.java
+++ b/tts_service/src/main/java/ai/qiwu/com/tts_service/service/Initialize.java
@@ -36,7 +36,7 @@ public class Initialize implements InitializingBean {
private static final String SERVER_NAME;
private static final String SERVER_URL;
private static final String AUDIO_DIR;
- private static final String ONLINE_SERVER;
+ private static final Map ONLINE_SERVER = new HashMap<>();
private static final String OFFLINE_SERVER;
private static final String THIRD_PARTY;
private static final String CHANGE_SOUND;
@@ -53,7 +53,14 @@ public class Initialize implements InitializingBean {
SERVER_NAME = Config.getProperty("server_name");
SERVER_URL = Config.getProperty("server_url");
AUDIO_DIR = Config.getProperty("audio_dir");
- ONLINE_SERVER = Config.getProperty("online_sever");
+
+ String[] online_sever_list = Config.getProperty("online_sever").split(",");
+ for (String serverAdd: online_sever_list) {
+ int key = Integer.parseInt(serverAdd.substring(0,1));
+ String value = serverAdd.substring(2);
+ ONLINE_SERVER.put(key, value);
+ }
+
OFFLINE_SERVER = Config.getProperty("offline_server");
THIRD_PARTY = Config.getProperty("third_party_tts_text");
CHANGE_SOUND = Config.getProperty("change_sound_path");
@@ -93,7 +100,7 @@ public class Initialize implements InitializingBean {
return;
}
if (withOnLine != null && withOnLine != 0) {
- String url = String.format("%s:9%03d/synthesize", Initialize.getOnlineServer(), speakerInfo.getId());
+ String url = String.format("%s:9%03d/synthesize", Initialize.getOnlineServer(withOnLine), speakerInfo.getId());
URL_LS.add(url);
if (StringUtils.isBlank(init_person)) {
init_person = person;
@@ -201,8 +208,8 @@ public class Initialize implements InitializingBean {
return AUDIO_DIR;
}
- private static String getOnlineServer() {
- return ONLINE_SERVER;
+ private static String getOnlineServer(int withOnline) {
+ return ONLINE_SERVER.get(withOnline);
}
static String getOfflineServer() {
diff --git a/tts_service/src/main/resources/tts.properties b/tts_service/src/main/resources/tts.properties
index 9ccfad7..793084f 100644
--- a/tts_service/src/main/resources/tts.properties
+++ b/tts_service/src/main/resources/tts.properties
@@ -4,7 +4,7 @@ server_url=http://aws-nx2.chewrobot.com:9663
#server_url=http://aliyun-hz1.chewrobot.com:9663
audio_dir=/root/TTS-service/audio
#audio_dir=/root/GameEditor/mqw/project/tts/audio
-online_sever=http://dev01.centaurstech.com
+online_sever=1:http://dev01.centaurstech.com,2:http://dev01.centaurstech.com
offline_server=http://dev01.centaurstech.com:9001
#offline_server=http://aliyun-hz1.chewrobot.com:9001
#第三方tts标记
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java
index eb9b104..28a109b 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/Constants.java
@@ -24,6 +24,7 @@ public interface Constants {
"9AWUhbas+LG9mds=";
Integer GET_PRODUCT_TOKEN_FAIL_STATUS = 10086;
String IMG_PREFIX = "https://aliyun-hz1.chewrobot.com";
+ String IMG_CUSTOM_PREFIX = "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/";
String PRE_PRODUCT_IMG = "prod:";
String PRE_ENTER_PRODUCT = "enter";
String PRE_PRODUCT_PLAY = "我要玩";
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 8444189..dcb9f9b 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
@@ -53,4 +53,5 @@ public class FrameTemple implements Agent{
@JsonProperty("background-color")
private String backgroundColor;
private String color;
+ private String position;
}
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 8c639f1..8ef8928 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
@@ -6,6 +6,7 @@ import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyDocument;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyPageItemData;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyPojo;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyUtil;
+import ai.qiwu.com.xiaoduhome.common.temple.onLunch.LunchBotData;
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;
@@ -17,6 +18,7 @@ import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandPojo;
import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb;
import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryBotIdTime;
+import ai.qiwu.com.xiaoduhome.pojo.dpl.Data;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Item;
import ai.qiwu.com.xiaoduhome.pojo.dpl.MyDocument;
import ai.qiwu.com.xiaoduhome.pojo.pageData.HistoryData;
@@ -41,6 +43,10 @@ import java.util.Base64;
import java.util.Date;
import java.util.List;
+import static ai.qiwu.com.xiaoduhome.common.Constants.CATEGORY_IMG_URL.GU_FENG;
+import static ai.qiwu.com.xiaoduhome.common.Constants.DPL_COMPONENT_ID.PRE_CATEGORY;
+import static ai.qiwu.com.xiaoduhome.common.Constants.IMG_CUSTOM_PREFIX;
+import static ai.qiwu.com.xiaoduhome.common.Constants.IMG_PREFIX;
import static ai.qiwu.com.xiaoduhome.common.temple.play.PlayUtils.getPlayDocument;
/**
@@ -83,7 +89,7 @@ public class TempleUtils {
page.setItems(dataList);
for (OnProductDetail bot : bots) {
FunnyPageItemData data = new FunnyPageItemData();
- data.setImgSrc(new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString());
+ data.setImgSrc(new StringBuilder(IMG_PREFIX).append(bot.getBannerImgUrl()).toString());
String intro = bot.getIntro();
if (StringUtils.isBlank(intro)) intro = "作者太懒,啥都没写";
data.setText(intro);
@@ -120,35 +126,35 @@ public class TempleUtils {
// return RANKING_DOCUMENT;
// }
- public static RankingDocument getRankingFirst() {
- RankingDocument document = JSON.parseObject(getDPLTemple("static/json/rankFirst.json"), RankingDocument.class);
- List bots = ScheduleService.getRankingList();
- List datas = new ArrayList<>();
- for (int i = 0; i < 3; i++) {
- GameProjectTb bot = bots.get(i);
- RankBotInfo data = new RankBotInfo(new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString(),
- new StringBuilder(Constants.PRE_PRODUCT_IMG).append(bot.getName()).toString(), correctName(bot.getName()));
- if (i == 0) data.setLogo("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/first.png");
- else if (i == 1) data.setLogo("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/second.png");
- else data.setLogo("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/third.png");
- OnProductDetail detail = ScheduleService.getProductIdDetail().get(bot.getBotAccount());
- Date createTime = detail.getCreateTime();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- String time = sdf.format(createTime);
- data.setTime(new StringBuilder(Constants.PRODUCT_INTRO.CREATE_TIME).append(time).toString());
- data.setWatches(new StringBuilder("点击数: ").append(bot.getWatch()).toString());
- data.setAuth(new StringBuilder(Constants.PRODUCT_INTRO.AUTHOR).append(bot.getAuthorName()).toString());
- StringBuilder labels = new StringBuilder(Constants.PRODUCT_INTRO.LABEL);
- for (String label: detail.getLabels()) {
- labels.append(Constants.PRODUCT_INTRO.SPACE).append(label);
- }
- data.setLabel(labels.toString());
- data.setIntro(detail.getIntro());
- datas.add(data);
- }
- document.getMainTemplate().getItems().get(2).setData(datas);
- return document;
- }
+// public static RankingDocument getRankingFirst() {
+// RankingDocument document = JSON.parseObject(getDPLTemple("static/json/rankFirst.json"), RankingDocument.class);
+// List bots = ScheduleService.getRankingList();
+// List datas = new ArrayList<>();
+// for (int i = 0; i < 3; i++) {
+// GameProjectTb bot = bots.get(i);
+// RankBotInfo data = new RankBotInfo(new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString(),
+// new StringBuilder(Constants.PRE_PRODUCT_IMG).append(bot.getName()).toString(), correctName(bot.getName()));
+// if (i == 0) data.setLogo("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/first.png");
+// else if (i == 1) data.setLogo("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/second.png");
+// else data.setLogo("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/third.png");
+// OnProductDetail detail = ScheduleService.getProductIdDetail().get(bot.getBotAccount());
+// Date createTime = detail.getCreateTime();
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+// String time = sdf.format(createTime);
+// data.setTime(new StringBuilder(Constants.PRODUCT_INTRO.CREATE_TIME).append(time).toString());
+// data.setWatches(new StringBuilder("点击数: ").append(bot.getWatch()).toString());
+// data.setAuth(new StringBuilder(Constants.PRODUCT_INTRO.AUTHOR).append(bot.getAuthorName()).toString());
+// StringBuilder labels = new StringBuilder(Constants.PRODUCT_INTRO.LABEL);
+// for (String label: detail.getLabels()) {
+// labels.append(Constants.PRODUCT_INTRO.SPACE).append(label);
+// }
+// data.setLabel(labels.toString());
+// data.setIntro(detail.getIntro());
+// datas.add(data);
+// }
+// document.getMainTemplate().getItems().get(2).setData(datas);
+// return document;
+// }
public static RankingDocument getRanking() {
return RankUtil.getRankDocument();
@@ -163,7 +169,7 @@ public class TempleUtils {
for (int i = num; i < upBound; 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 imgSrc = new StringBuilder(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()));
@@ -193,7 +199,7 @@ public class TempleUtils {
StringBuilder botIds = new StringBuilder();
for (GameProjectTb bot:ScheduleService.getRecommendList()) {
botIds.append(bot.getBotAccount()).append(File.separator);
- String imgSrc = new StringBuilder(Constants.IMG_PREFIX).append(bot.getBannerImgUrl()).toString();
+ String imgSrc = new StringBuilder(IMG_PREFIX).append(bot.getBannerImgUrl()).toString();
String imageId = new StringBuilder(Constants.PRE_PRODUCT_IMG).append(bot.getName()).toString();
RecommandBotInfo recommend = new RecommandBotInfo(imgSrc, imageId, correctName(bot.getName()));
datas.add(recommend);
@@ -224,7 +230,7 @@ public class TempleUtils {
String intro = productDetail.getIntro();
if (StringUtils.isBlank(intro)) intro = "作者太懒没写介绍";
- String imgUrl = new StringBuilder(Constants.IMG_PREFIX).append(productDetail.getBannerImgUrl()).toString();
+ String imgUrl = new StringBuilder(IMG_PREFIX).append(productDetail.getBannerImgUrl()).toString();
String botAccountId = new StringBuilder(Constants.PRE_ENTER_PRODUCT).append(correctName(productDetail.getName())).toString();
String lastTime = sdf.format(new java.sql.Date(historyInfo.getLastTime()));
String name = productDetail.getName();
@@ -258,7 +264,7 @@ public class TempleUtils {
String intro = productDetail.getIntro();
if (StringUtils.isBlank(intro)) intro = "作者太懒没写介绍";
- String imgUrl = new StringBuilder(Constants.IMG_PREFIX).append(productDetail.getBannerImgUrl()).toString();
+ String imgUrl = new StringBuilder(IMG_PREFIX).append(productDetail.getBannerImgUrl()).toString();
String botAccountId = new StringBuilder(Constants.PRE_PRODUCT_IMG).append(correctName(productDetail.getName())).toString();
String name = productDetail.getName();
HistoryData data = new HistoryData(botAccountId, i++, imgUrl, correctName(name), intro);
@@ -292,7 +298,34 @@ public class TempleUtils {
return collect;
}
- private static String correctName(String name) {
+ public 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(IMG_PREFIX).append(projectInfo.getBannerImgUrl()).toString();
+ LunchBotData data = new LunchBotData(src, imageId,productName);
+ data.setNum(begin++);
+ dataList.add(data);
+ }
+ return dataList;
+ }
+
+ public static List buildCategoryDataList() {
+ ArrayList dataList = new ArrayList<>();
+ int i = 21;
+ for (String cateName : ScheduleService.getCATEGORY()) {
+ String imageId = new StringBuilder(PRE_CATEGORY).append(cateName).toString();
+ String imgSrc = new StringBuilder(IMG_CUSTOM_PREFIX)
+ .append(ScheduleService.getCategoryCharac()[i-21]).append(".png").toString();
+ LunchBotData data = new LunchBotData(imgSrc, imageId, cateName);
+ data.setNum(i++);
+ dataList.add(data);
+ }
+ return dataList;
+ }
+
+ public 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/funny/FunnyMainTemplate.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyMainTemplate.java
index c591f98..837dbd6 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyMainTemplate.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyMainTemplate.java
@@ -3,6 +3,8 @@ package ai.qiwu.com.xiaoduhome.common.temple.funny;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankingPojo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
@@ -11,7 +13,8 @@ import java.util.List;
* @author 苗权威
* @dateTime 19-8-30 上午11:28
*/
-@Data
+@Getter
+@Setter
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class FunnyMainTemplate {
private List parameters = new ArrayList<>();
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPojo.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPojo.java
index 60527c6..6080ad6 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPojo.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/funny/FunnyPojo.java
@@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
import java.util.List;
@@ -12,7 +14,8 @@ import java.util.List;
* @author 苗权威
* @dateTime 19-8-30 上午11:18
*/
-@Data
+@Getter
+@Setter
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class FunnyPojo {
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchBotData.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchBotData.java
new file mode 100644
index 0000000..58b65cf
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchBotData.java
@@ -0,0 +1,23 @@
+package ai.qiwu.com.xiaoduhome.common.temple.onLunch;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-5 下午5:05
+ */
+@Getter
+@Setter
+public class LunchBotData {
+ private String imageSrc;
+ private String imageId;
+ private String imageName;
+ private Integer num;
+
+ public LunchBotData(String imageSrc, String imageId, String imageName) {
+ this.imageSrc = imageSrc;
+ this.imageId = imageId;
+ this.imageName = imageName;
+ }
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchDocument.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchDocument.java
new file mode 100644
index 0000000..49ad14d
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchDocument.java
@@ -0,0 +1,19 @@
+package ai.qiwu.com.xiaoduhome.common.temple.onLunch;
+
+import com.baidu.dueros.data.response.directive.dpl.Document;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-5 下午4:32
+ */
+@Getter
+@Setter
+@ToString
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class LunchDocument extends Document {
+ private LunchMainTemplate mainTemplate;
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchMainTemplate.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchMainTemplate.java
new file mode 100644
index 0000000..675ca3f
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchMainTemplate.java
@@ -0,0 +1,26 @@
+package ai.qiwu.com.xiaoduhome.common.temple.onLunch;
+
+import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyPojo;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-5 下午4:33
+ */
+@Getter
+@Setter
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class LunchMainTemplate {
+ private List parameters = new ArrayList<>();
+ private List items;
+
+ public LunchMainTemplate() {
+ this.parameters.add("payload");
+ this.items = new ArrayList<>();
+ }
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchPojo.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchPojo.java
new file mode 100644
index 0000000..2de4f1e
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchPojo.java
@@ -0,0 +1,58 @@
+package ai.qiwu.com.xiaoduhome.common.temple.onLunch;
+
+import ai.qiwu.com.xiaoduhome.common.temple.FrameTemple;
+import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-5 下午4:34
+ */
+@Getter
+@Setter
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+public class LunchPojo {
+ private String type;
+ private String position;
+ private String height;
+ private String width;
+ private String left;
+ private String top;
+ private String src;
+ private List items;
+ @JsonProperty("padding-right")
+ private String paddingRight;
+ private String componentId;
+ private String headerTitle;
+ private Boolean hasBackIcon;
+ private String direction;
+ @JsonProperty("margin-bottom")
+ private String marginBottom;
+ @JsonProperty("margin-left")
+ private String marginLeft;
+ @JsonProperty("margin-right")
+ private String marginRight;
+ @JsonProperty("margin-top")
+ private String marginTop;
+ @JsonProperty("border-radius")
+ private String borderRadius;
+ @JsonProperty("scale-type")
+ private String scaleType;
+ private List onClick;
+ @JsonProperty("background-color")
+ private String backgroundColor;
+ @JsonProperty("align-items")
+ private String alignItems;
+ private String text;
+ @JsonProperty("font-size")
+ private String fontSize;
+ private List data;
+ private List firstItem;
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchUtils.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchUtils.java
new file mode 100644
index 0000000..ebc5fa8
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchUtils.java
@@ -0,0 +1,188 @@
+package ai.qiwu.com.xiaoduhome.common.temple.onLunch;
+
+import ai.qiwu.com.xiaoduhome.common.temple.TempleUtils;
+import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
+import ai.qiwu.com.xiaoduhome.service.ScheduleService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-5 下午4:48
+ */
+@Slf4j
+public class LunchUtils {
+
+ private static final LunchPojo LUNCH_LIST_CON = buildImgFrmTxtContainer();
+ private static final LunchPojo LUNCH_LIST_CATEGORY_CON = buildCategoryList();
+ private static final LunchPojo LUNCH_HEAD = buildLunchHead();
+ private static final LunchPojo LUNCH_BACK_IMG = buildLunchBackgroundImg();
+ private volatile static LunchDocument lunchDocument = buildLunchDocument();
+
+ public static LunchDocument buildLunchDocument() {
+ LunchDocument document = new LunchDocument();
+ LunchMainTemplate mainTemplate = new LunchMainTemplate();
+ document.setMainTemplate(mainTemplate);
+
+ LunchPojo conRecommend = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRecommendList(),1));
+ conRecommend.setFirstItem(Collections.singletonList(TempleUtils.getFrameRecommand()));
+
+ LunchPojo conRanking = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRankingList(), 11));
+ conRanking.setFirstItem(Collections.singletonList(TempleUtils.getFrameRakking()));
+
+ LunchPojo conCategory = buildLunchCategoryList(TempleUtils.buildCategoryDataList());
+ conCategory.setFirstItem(Collections.singletonList(TempleUtils.getFrameCategory()));
+
+ LunchPojo scroll = buildLunchScroll();
+ scroll.setItems(Arrays.asList(conRecommend,conRanking,conCategory));
+
+ mainTemplate.getItems().addAll(Arrays.asList(LUNCH_BACK_IMG,LUNCH_HEAD,scroll));
+ return document;
+ }
+
+ private static LunchPojo buildLunchScroll() {
+ LunchPojo scroll = new LunchPojo();
+ scroll.setType("ScrollView");
+ scroll.setDirection("vertical");
+ scroll.setWidth("100%");
+ scroll.setMarginBottom("80dp");
+ return scroll;
+ }
+
+ private static LunchPojo buildLunchCategoryList(List data) {
+ LunchPojo container = new LunchPojo();
+ container.setType("Container");
+ container.setWidth("100%");
+
+ LunchPojo list = new LunchPojo();
+ list.setType("List");
+ list.setHeight("310dp");
+ list.setMarginLeft("15dp");
+ list.setMarginRight("15dp");
+ list.setDirection("horizontal");
+ list.setData(data);
+ list.setItems(Collections.singletonList(LUNCH_LIST_CATEGORY_CON));
+
+ container.setItems(Collections.singletonList(list));
+
+ return container;
+ }
+
+ private static LunchPojo buildLunchList(List data) {
+ LunchPojo container = new LunchPojo();
+ container.setType("Container");
+ container.setWidth("100%");
+
+ LunchPojo list = new LunchPojo();
+ list.setType("List");
+ list.setMarginLeft("15dp");
+ list.setMarginRight("15dp");
+ list.setMarginBottom("70dp");
+ list.setDirection("horizontal");
+ list.setData(data);
+ list.setItems(Collections.singletonList(LUNCH_LIST_CON));
+
+ container.setItems(Collections.singletonList(list));
+
+ return container;
+ }
+
+ private static LunchPojo buildCategoryList() {
+ LunchPojo category = buildImgFrmTxtContainer();
+ category.getItems().remove(2);
+ return category;
+ }
+
+ private static LunchPojo buildImgFrmTxtContainer() {
+ LunchPojo container = new LunchPojo();
+ container.setType("Container");
+ container.setMarginTop("40dp");
+ container.setWidth("200dp");
+ container.setMarginLeft("20dp");
+
+ //image
+ LunchPojo image = new LunchPojo();
+ image.setType("Image");
+ image.setWidth("190dp");
+ image.setHeight("190dp");
+ image.setMarginLeft("7dp");
+ image.setMarginTop("7dp");
+ image.setPosition("absolute");
+ image.setScaleType("fitXY");
+ image.setBorderRadius("22dp");
+ image.setSrc("${data.imageSrc}");
+ image.setOnClick(Collections.singletonList(new Event("SendEvent", "${data.imageId}")));
+
+ //frame
+ LunchPojo frame = new LunchPojo();
+ frame.setType("Frame");
+ frame.setWidth("35dp");
+ frame.setHeight("35dp");
+ frame.setBackgroundColor("rgba(0,0,0,0.9)");
+ frame.setBorderRadius("13dp");
+
+ LunchPojo frmCon = new LunchPojo();
+ frmCon.setType("Container");
+ frmCon.setWidth("100%");
+ frmCon.setHeight("100%");
+ frmCon.setAlignItems("center");
+
+ LunchPojo frmText = new LunchPojo();
+ frmText.setType("Text");
+ frmText.setText("${data.num}");
+ frmText.setFontSize("22dp");
+
+ frmCon.setItems(Collections.singletonList(frmText));
+ frame.setItems(Collections.singletonList(frmCon));
+
+ //text
+ LunchPojo text = new LunchPojo();
+ text.setType("Text");
+ text.setFontSize("23dp");
+ text.setMarginTop("160dp");
+ text.setMarginLeft("7dp");
+ text.setText("${data.imageName}");
+
+ List list = new ArrayList<>();
+ list.add(image);
+ list.add(frame);
+ list.add(text);
+ container.setItems(list);
+ return container;
+ }
+
+ private static LunchPojo buildLunchBackgroundImg() {
+ LunchPojo backGroundImg = new LunchPojo();
+ 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 LunchPojo buildLunchHead() {
+ LunchPojo head = new LunchPojo();
+ head.setType("Header");
+ head.setHeaderTitle("交游天下");
+ head.setHasBackIcon(false);
+
+ return head;
+ }
+
+ public static LunchDocument getLunchDocument() {
+ return lunchDocument;
+ }
+
+ public static void setLunchDocument(LunchDocument lunchDocument) {
+ LunchUtils.lunchDocument = lunchDocument;
+ }
+}
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
index 8506908..a9160bb 100644
--- 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
@@ -77,18 +77,18 @@ public class RankUtil {
StringBuilder botIds = new StringBuilder();
List dataFirst = new ArrayList<>();
List dataSec = new ArrayList<>();
- int i = 0;
+ int i = 1;
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()));
- if (i < 3) {
- rankBotInfo.setNum();
+ rankBotInfo.setNum(i);
+ if (i < 4) {
dataFirst.add(rankBotInfo);
} else if (i == 4) {
dataFirst.add(rankBotInfo);
- } else if (i < 8) {
+ } else if (i < 9) {
dataSec.add(rankBotInfo);
} else {
break;
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandBotInfo.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandBotInfo.java
index f235c0b..4aa45f2 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandBotInfo.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommandBotInfo.java
@@ -1,12 +1,15 @@
package ai.qiwu.com.xiaoduhome.common.temple.recommand;
import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
/**
* @author 苗权威
* @dateTime 19-8-27 上午10:52
*/
-@Data
+@Getter
+@Setter
public class RecommandBotInfo {
private String imageSrc;
private String imageId;
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommendUtil.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommendUtil.java
new file mode 100644
index 0000000..b3a3843
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommendUtil.java
@@ -0,0 +1,182 @@
+package ai.qiwu.com.xiaoduhome.common.temple.recommand;
+
+
+import ai.qiwu.com.xiaoduhome.common.Constants;
+import ai.qiwu.com.xiaoduhome.common.temple.TempleUtils;
+import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb;
+import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
+import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
+import ai.qiwu.com.xiaoduhome.service.ScheduleService;
+
+import java.io.File;
+import java.util.*;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-5 上午11:25
+ */
+public class RecommendUtil {
+
+ private static final RecommandPojo RECOM_BACK_IMG = buildRecomendBackgroundImg();
+ private static final RecommandPojo RECOM_HEAD = buildRecommendHead();
+ private static final RecommandPojo RECOM_FOOTER = buildRecommendFooter();
+ private static final RecommandPojo RECOM_LIST_CON = buildImgFrmTxtContainer();
+
+ public static RecommandDocument getRecommendDocument(int num) {
+ RecommandDocument document = new RecommandDocument();
+ RecommandMainTemplate mainTemplate = new RecommandMainTemplate();
+ document.setMainTemplate(mainTemplate);
+
+ RecommandPojo scrollView = new RecommandPojo();
+ scrollView.setType("ScrollView");
+ scrollView.setWidth("100%");
+ scrollView.setMarginBottom("93dp");
+ scrollView.setDirection("vertical");
+ List scrollList = new ArrayList<>();
+ scrollView.setItems(scrollList);
+
+ int bound = ScheduleService.getAllProductCount();
+ List bots = ScheduleService.getAllOnProduct();
+ StringBuilder botIds = new StringBuilder();
+ int begin = num*16;
+
+ int end;
+ if (begin >= bound) return null;
+ bound = begin+16 <= bound ? begin+16 : bound;
+
+ int count = 0;
+ while (begin < bound) {
+ end = begin+4 <= bound ? begin+4 : bound;
+ scrollList.add(buildRecommendList(getListData(count,begin, end, bots, botIds)));
+ count++;
+ begin = end;
+ }
+ mainTemplate.getItems().addAll(Arrays.asList(RECOM_BACK_IMG,RECOM_HEAD,scrollView,RECOM_FOOTER));
+
+ botIds.deleteCharAt(botIds.length()-1);
+ String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
+ document.setRecommendIdList(idToken);
+ return document;
+ }
+
+ private static List getListData(int row,int begin, int end, List bots, StringBuilder botIds) {
+ List data = new ArrayList<>();
+ int n = 1+row*4;
+ for (int i = begin; i < end; i++) {
+ OnProductDetail bot = bots.get(i);
+ 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();
+ RecommandBotInfo detail = new RecommandBotInfo(imgSrc,imageId, TempleUtils.correctName(bot.getName()));
+ detail.setNum(i-begin+n);
+ data.add(detail);
+ }
+ return data;
+ }
+
+ private static RecommandPojo buildRecommendList(List data) {
+ RecommandPojo list = new RecommandPojo();
+ list.setType("List");
+ list.setWidth("100%");
+ list.setHeight("240dp");
+ list.setMarginLeft("20dp");
+ list.setMarginBottom("35dp");
+ list.setDirection("horizontal");
+ list.setData(data);
+ list.setItems(Collections.singletonList(RECOM_LIST_CON));
+
+ return list;
+ }
+
+ private static RecommandPojo buildImgFrmTxtContainer() {
+ RecommandPojo container = new RecommandPojo();
+ container.setType("Container");
+ container.setWidth("220dp");
+ container.setMarginLeft("15dp");
+
+ //image
+ RecommandPojo image = new RecommandPojo();
+ image.setType("Image");
+ image.setWidth("190dp");
+ image.setHeight("190dp");
+ image.setMarginLeft("7dp");
+ image.setMarginTop("7dp");
+ image.setPosition("absolute");
+ image.setScaleType("fitXY");
+ image.setBorderRadius("15dp");
+ image.setSrc("${data.imageSrc}");
+ image.setOnClick(Collections.singletonList(new Event("SendEvent", "${data.imageId}")));
+
+ //frame
+ RecommandPojo frame = new RecommandPojo();
+ frame.setType("Frame");
+ frame.setWidth("40dp");
+ frame.setHeight("40dp");
+ frame.setBackgroundColor("rgba(0,0,0,0.9)");
+ frame.setBorderRadius("12dp");
+
+ RecommandPojo frmCon = new RecommandPojo();
+ frmCon.setType("Container");
+ frmCon.setWidth("100%");
+ frmCon.setHeight("100%");
+ frmCon.setAlignItems("center");
+
+ RecommandPojo frmText = new RecommandPojo();
+ frmText.setType("Text");
+ frmText.setText("${data.num}");
+ frmText.setFontSize("28dp");
+
+ frmCon.setItems(Collections.singletonList(frmText));
+ frame.setItems(Collections.singletonList(frmCon));
+
+ //text
+ RecommandPojo text = new RecommandPojo();
+ text.setType("Text");
+ text.setFontSize("25dp");
+ text.setMarginTop("160dp");
+ text.setMarginLeft("7dp");
+ text.setText("${data.imageName}");
+
+ container.setItems(Arrays.asList(image,frame,text));
+ return container;
+ }
+
+ private static RecommandPojo buildRecommendFooter() {
+ RecommandPojo footerCon = new RecommandPojo();
+ footerCon.setType("Container");
+ footerCon.setPosition("absolute");
+ footerCon.setWidth("100%");
+ footerCon.setLeft("0");
+ footerCon.setBottom("0");
+
+ RecommandPojo footer = new RecommandPojo();
+ footer.setType("Footer");
+ footer.setHints(Arrays.asList("打开第一个","下一页","上一页","返回"));
+
+ footerCon.setItems(Collections.singletonList(footer));
+
+ return footerCon;
+ }
+
+ private static RecommandPojo buildRecomendBackgroundImg() {
+ RecommandPojo backGroundImg = new RecommandPojo();
+ 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 RecommandPojo buildRecommendHead() {
+ RecommandPojo head = new RecommandPojo();
+ head.setType("Header");
+ head.setHeaderTitle("推荐页");
+ head.setHasBackIcon(false);
+
+ return head;
+ }
+}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuHistoryTBRepository.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuHistoryTBRepository.java
index 2bc71af..c6ba8fa 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuHistoryTBRepository.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuHistoryTBRepository.java
@@ -21,7 +21,7 @@ public interface XiaoDuHistoryTBRepository extends JpaRepository S save(S s);
XiaoDuHistoryTB getByXiaoduUserIdAndBotId(String xiaoduUserId, String botId);
+
+ @Query(value = "select distinct bot_id from xiaodu_history_tb where xiaodu_user_id=?1",nativeQuery = true)
+ List getUserHostory(String userId);
}
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 41b92bd..9886b61 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
@@ -5,11 +5,13 @@ import ai.qiwu.com.xiaoduhome.common.temple.Agent;
import ai.qiwu.com.xiaoduhome.common.temple.CollectHistoryDocument;
import ai.qiwu.com.xiaoduhome.common.temple.TempleUtils;
import ai.qiwu.com.xiaoduhome.common.temple.funny.FunnyDocument;
+import ai.qiwu.com.xiaoduhome.common.temple.onLunch.LunchUtils;
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.common.temple.recommand.RecommendUtil;
import ai.qiwu.com.xiaoduhome.entity.primary.*;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryTB;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuOrderTB;
@@ -75,7 +77,7 @@ import static ai.qiwu.com.xiaoduhome.service.ScheduleService.CATEGORY_PRODUCT_LI
*/
@Slf4j
public class DplBotService extends BaseBot {
- private static final MyDocument LOAD_DOCUMENT;
+ //private static final MyDocument LOAD_DOCUMENT;
private static final MyDocument PROD_INFO;
@@ -96,23 +98,25 @@ public class DplBotService extends BaseBot {
private static volatile FunnyDocument FUNNY_DEFAULT_DOCUMENT;
+ private static final ConcurrentHashMap> USER_HISTORY = new ConcurrentHashMap<>();
+
static {
- LOAD_DOCUMENT = JSON.parseObject(getDPLTemple("static/json/onLunch2.json"), MyDocument.class);
- List- thirdRow = LOAD_DOCUMENT.getMainTemplate().getItems().get(1).getItems().get(1).getItems();
- List l1 = new ArrayList<>();
- l1.add(TempleUtils.getFrameRakking());
- thirdRow.get(0).setFirstItem(l1);
- 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, 11));
-
- List l3 = new ArrayList<>();
- l3.add(TempleUtils.getFrameCategory());
- thirdRow.get(2).setFirstItem(l3);
- thirdRow.get(2).getItems().get(0).setData(buildCategoryDataList());
+// LOAD_DOCUMENT = JSON.parseObject(getDPLTemple("static/json/onLunch2.json"), MyDocument.class);
+// List
- thirdRow = LOAD_DOCUMENT.getMainTemplate().getItems().get(1).getItems().get(1).getItems();
+// List l1 = new ArrayList<>();
+// l1.add(TempleUtils.getFrameRakking());
+// thirdRow.get(0).setFirstItem(l1);
+// 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, 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();
@@ -132,6 +136,10 @@ public class DplBotService extends BaseBot {
RenderDocument renderDocument = new RenderDocument(FIRST_PAGE);
this.addDirective(renderDocument);
OutputSpeech outputSpeech = new OutputSpeech(OutputSpeech.SpeechType.PlainText, Constants.WelcomeWord.WELCOME);
+ POOL.submit(() -> {
+ XiaoDuHistoryTBRepository repository = BaseHolder.getBean("xiaoDuHistoryTBRepository");
+ USER_HISTORY.put(getUserId(), repository.getUserHostory(getUserId()));
+ });
return new Response(outputSpeech);
}
@@ -317,11 +325,11 @@ public class DplBotService extends BaseBot {
OverTimeDetail detail;
if ((detail = LAST_OUTTIME_RESULT.remove(userId)) != null) {
for (Directive directive : detail.getDirectives()) {
- log.info("上次超时保存的Directive:{}",directive.getClass().getName());
+ //log.info("上次超时保存的Directive:{}",directive.getClass().getName());
this.addDirective(directive);
}
for (String key : detail.getAttributes().keySet()) {
- log.info("上次超时保存的key:{}",key);
+ //log.info("上次超时保存的key:{}",key);
this.setSessionAttribute(key, detail.getAttributes().get(key));
}
return detail.getResponse();
@@ -553,7 +561,7 @@ public class DplBotService extends BaseBot {
return new Response(outputSpeech);
}
} else if ("loadingPage".equals(componentId)) {
- RenderDocument renderDocument = new RenderDocument(LOAD_DOCUMENT);
+ RenderDocument renderDocument = new RenderDocument(LunchUtils.getLunchDocument());
this.addDirective(new PushStack());
this.addDirective(renderDocument);
return new Response();
@@ -1121,7 +1129,7 @@ public class DplBotService extends BaseBot {
char second;
if (trace == null || trace.length() <= 2 || getQuery().contains("首")) {
// home page
- RenderDocument renderDocument = new RenderDocument(LOAD_DOCUMENT);
+ RenderDocument renderDocument = new RenderDocument(LunchUtils.getLunchDocument());
dplBotService.addDirective(renderDocument);
dplBotService.setSessionAttribute(BACK_TRACE,null);
detail.getDirectives().add(renderDocument);
@@ -1139,7 +1147,7 @@ public class DplBotService extends BaseBot {
second = trace.charAt(1);
switch (second){
case '0':{
- RenderDocument renderDocument = new RenderDocument(LOAD_DOCUMENT);
+ RenderDocument renderDocument = new RenderDocument(LunchUtils.getLunchDocument());
dplBotService.addDirective(renderDocument);
dplBotService.setSessionAttribute(BACK_TRACE,null);
detail.getAttributes().put(BACK_TRACE,null);
@@ -1150,7 +1158,7 @@ public class DplBotService extends BaseBot {
//collect
String appUserId = getSessionAttribute("userId");
if (appUserId == null) {
- RenderDocument renderDocument = new RenderDocument(LOAD_DOCUMENT);
+ RenderDocument renderDocument = new RenderDocument(LunchUtils.getLunchDocument());
dplBotService.addDirective(renderDocument);
dplBotService.setSessionAttribute(BACK_TRACE,null);
detail.getAttributes().put(BACK_TRACE,null);
@@ -1192,8 +1200,7 @@ public class DplBotService extends BaseBot {
String recommendNextCount = dplBotService.getSessionAttribute("comCnt");
int count = 1;
if (recommendNextCount != null) count = Integer.parseInt(recommendNextCount);
- int begin = (count-1)*8;
- RecommandDocument recommandDocument = TempleUtils.getRecommend(begin);
+ RecommandDocument recommandDocument = RecommendUtil.getRecommendDocument(count-1);
RenderDocument render = new RenderDocument();
render.setDocument(recommandDocument);
dplBotService.addDirective(render);
@@ -1289,10 +1296,10 @@ public class DplBotService extends BaseBot {
detail.setResponse(dealOpenNum(rankToken,detail));
//LAST_OUTTIME_RESULT.put(userId, dealOpenNum(rankToken));
} else if (recommengToken != null) {
- detail.setResponse(dealOpenNum(recommengToken,detail));
+ detail.setResponse(dealOpenNumInRecommend(recommengToken,detail));
//LAST_OUTTIME_RESULT.put(userId, dealOpenNum(recommengToken));
} else {
- OutputSpeech outputSpeech = new OutputSpeech(OutputSpeech.SpeechType.PlainText, "似乎出了什么问题,请点击屏幕吧");
+ OutputSpeech outputSpeech = new OutputSpeech(OutputSpeech.SpeechType.PlainText, "屏幕上的图标都是可以点击的哦");
detail.getResponse().setOutputSpeech(outputSpeech);
//LAST_OUTTIME_RESULT.put(userId, new Response(outputSpeech));
}
@@ -1328,8 +1335,7 @@ public class DplBotService extends BaseBot {
break;
}
int count = Integer.parseInt(recommendNextCount);
- int begin = (count-2)*8;
- RecommandDocument document = TempleUtils.getRecommend(begin);
+ RecommandDocument document = RecommendUtil.getRecommendDocument(count-2);
RenderDocument render = new RenderDocument(document);
dplBotService.addDirective(render);
detail.getDirectives().add(render);
@@ -1411,20 +1417,19 @@ public class DplBotService extends BaseBot {
String recommendNextCount = dplBotService.getSessionAttribute("comCnt");
int count = 1;
if (recommendNextCount != null) count = Integer.parseInt(recommendNextCount);
- int begin = count*8;
- if (begin >= ScheduleService.getAllProductCount()) {
- detail.setResponse(buildErrorResponse("客观你已经翻到底啦,没有更多了"));
- }else {
- RecommandDocument document = TempleUtils.getRecommend(begin);
- RenderDocument render = new RenderDocument(document);
- dplBotService.addDirective(render);
- detail.getDirectives().add(render);
- String token = document.getRecommendIdList();
- dplBotService.setSessionAttribute("recommand", token);
- detail.getAttributes().put("recommand",token);
- dplBotService.setSessionAttribute("comCnt",String.valueOf(count+1));
- detail.getAttributes().put("comCnt",String.valueOf(count+1));
+ RecommandDocument document = RecommendUtil.getRecommendDocument(count);
+ if (document == null) {
+ detail.setResponse(buildErrorResponse("客观你已经翻到底了,没有更多了"));
+ break;
}
+ RenderDocument render = new RenderDocument(document);
+ dplBotService.addDirective(render);
+ detail.getDirectives().add(render);
+ String token = document.getRecommendIdList();
+ dplBotService.setSessionAttribute("recommand", token);
+ detail.getAttributes().put("recommand",token);
+ dplBotService.setSessionAttribute("comCnt",String.valueOf(count+1));
+ detail.getAttributes().put("comCnt",String.valueOf(count+1));
break;
}
case 4: {
@@ -1502,7 +1507,8 @@ public class DplBotService extends BaseBot {
LAST_OUTTIME_RESULT.put(userId, detail);
return;
} else if ("recommand".equals(intentName)) {
- RecommandDocument recommandDocument = TempleUtils.getRecommend(0);
+ //RecommandDocument recommandDocument = TempleUtils.getRecommend(0);
+ RecommandDocument recommandDocument = RecommendUtil.getRecommendDocument(0);
RenderDocument render = new RenderDocument();
render.setDocument(recommandDocument);
dplBotService.addDirective(render);
@@ -1838,13 +1844,28 @@ public class DplBotService extends BaseBot {
}
}
+ private Response dealOpenNumInRecommend(String idsToken, OverTimeDetail overDetail) {
+ int collectNum = Integer.parseInt(getSlot("sys.number"));
+ String[] tokenList = new String(Base64.getDecoder().decode(idsToken)).split(File.separator);
+ if (collectNum > tokenList.length) return buildErrorResponse("这个数字超出了范围");
+ OnProductDetail detail = ScheduleService.PRODUCT_ID_DETAIL.get(tokenList[collectNum-1]);
+ if (doesUserPlayed(detail.getBotAccount())) {
+ String productName = correctName(detail.getName());
+ return directInProduct(productName, detail.getBotAccount(), overDetail);
+ } else {
+ return enterProductInfo(detail.getName(), overDetail);
+ }
+ }
+
private Response dealOpenNumInHome(int num, OverTimeDetail detail) {
if (num > 0 && num <= 10) {
GameProjectTb bot = ScheduleService.getRankingList().get(num-1);
- return enterProductInfo(bot.getName(), detail);
+ if (doesUserPlayed(bot.getBotAccount())) return enterProductInfo(bot.getName(), detail);
+ else return directInProduct(bot.getName(), bot.getBotAccount(), detail);
} else if (num > 10 && num <= 20) {
GameProjectTb bot = ScheduleService.getRecommendList().get(num-11);
- return enterProductInfo(bot.getName(), detail);
+ if (doesUserPlayed(bot.getBotAccount())) return enterProductInfo(bot.getName(), detail);
+ else return directInProduct(bot.getName(), bot.getBotAccount(), detail);
} else if (num > 20 && num <= 30) {
String categoryName = ScheduleService.CATEGORY[num-21];
displayCategoryProd(categoryName);
@@ -1861,6 +1882,42 @@ public class DplBotService extends BaseBot {
}
}
+ private Response directInProduct(String name,String botId,OverTimeDetail detail) {
+ String productName = correctName(name);
+ String enterProductWord = new StringBuilder(Constants.PRE_PRODUCT_PLAY).append(productName).toString();
+ log.info("进入作品语句:{}", enterProductWord);
+ QiWuResponse data = null;
+ try {
+ data = RequestTerminal.requestTerminate(enterProductWord, getCustomerId());
+ } catch (IOException e) {
+ log.error("请求终端接口出错:", e.toString());
+ }
+ if (data == null) {
+ return buildErrorResponse(SORRY_UNCATCH);
+ }
+ String text = data.getText();
+ text = text.substring(text.indexOf("】")+1);
+ PlayDocument document = PlayUtils.getPlayDocument(productName, data.getAudio(), text);
+
+ RenderDocument render = new RenderDocument(document);
+ this.setSessionAttribute(PRE_COLLE, null);
+ detail.getAttributes().put(PRE_COLLE, null);
+ String trace = getSessionAttribute(BACK_TRACE);
+ if (trace == null || trace.length() != 2) trace = "00";
+ String backTrace = new StringBuilder(trace).append(botId).toString();
+ this.setSessionAttribute(BACK_TRACE, backTrace);
+ detail.getAttributes().put(BACK_TRACE,backTrace);
+ this.addDirective(render);
+ detail.getDirectives().add(render);
+ return new Response();
+ }
+
+ private boolean doesUserPlayed(String botAccount) {
+ List playedBotIds = USER_HISTORY.get(getUserId());
+ if (playedBotIds != null) return playedBotIds.contains(botAccount);
+ return false;
+ }
+
private Response enterProductInfo(String productName, OverTimeDetail detail) {
OnProductDetail productDetail = ScheduleService.PRODUCT_NAME_DETAIL.get(productName);
if (productDetail == null && !productName.equals("清新传")) {
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 82ca0cd..be1f11c 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
@@ -1,5 +1,6 @@
package ai.qiwu.com.xiaoduhome.service;
+import ai.qiwu.com.xiaoduhome.common.temple.onLunch.LunchUtils;
import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb;
import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
import ai.qiwu.com.xiaoduhome.repository.primary.AllOnProductInfoRepository;
@@ -8,16 +9,19 @@ import ai.qiwu.com.xiaoduhome.repository.primary.ProjectLabelRepository;
import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuHistoryTBRepository;
import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuOrderTbRepository;
import lombok.extern.slf4j.Slf4j;
+import okhttp3.OkHttpClient;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
-import java.sql.Date;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* @author 苗权威
@@ -32,11 +36,12 @@ public class ScheduleService implements InitializingBean {
static volatile List ALL_ON_PRODUCT = new ArrayList<>();
static final HashMap PRODUCT_NAME_DETAIL = new HashMap<>();
static final HashMap PRODUCT_ID_DETAIL = new HashMap<>();
- static final HashMap NX2_BOT_TO_HZ1 = new HashMap<>();
+ static final HashMap NX2_BOT_TO_HZ1 = new HashMap<>();
static final List EXCEPT_BOT_ACCOUNT = new ArrayList<>();
- static final String[] CATEGORY = {"古风", "科幻", "占星", "恋爱", "灾难", "架空", "儿童", "经营", "冒险", "武侠"};
+ static final String[] CATEGORY = {"古风", "儿童", "科幻", "占星", "恋爱", "灾难", "架空", "经营", "冒险", "武侠"};
+ static final String[] CATEGORY_CHARAC={"gufeng","child","kehuan","zhanxing","lianai","zainan","jiakong","jingying","maoxian","wuxia"};
static final ConcurrentHashMap> CATEGORY_PRODUCT_LIST = new ConcurrentHashMap<>();
private final GameProjectTbRepository gameProjectTbRepository;
@@ -71,7 +76,7 @@ public class ScheduleService implements InitializingBean {
//log.error("更新排行榜出错:{}", e.getMessage());
}
- @Scheduled(cron = "0 0 18 * * ?")
+ @Scheduled(cron = "0 0 */1 * * ?")
public void initRecommendList() {
new Thread(() -> {
RECOMMEND_LIST = gameProjectTbRepository.recommendList();
@@ -132,6 +137,14 @@ public class ScheduleService implements InitializingBean {
}).start();
}
+ @Scheduled(cron = "0 0 */1 * * ?")
+ public void shuffleAllProList() {
+ new Thread(() -> {
+ Collections.shuffle(ALL_ON_PRODUCT);
+ LunchUtils.setLunchDocument(LunchUtils.buildLunchDocument());
+ }).start();
+ }
+
@Override
public void afterPropertiesSet() throws Exception {
initAllOnTableProductInfo();
@@ -142,6 +155,7 @@ public class ScheduleService implements InitializingBean {
deleteUnPayedOrder();
tian();
keng();
+ Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);
}
private void keng() {
@@ -200,4 +214,12 @@ public class ScheduleService implements InitializingBean {
public static int getAllProductCount() {
return allProductCount;
}
+
+ public static String[] getCATEGORY() {
+ return CATEGORY;
+ }
+
+ public static String[] getCategoryCharac() {
+ return CATEGORY_CHARAC;
+ }
}
diff --git a/xiaoduhome/src/main/resources/static/json/frame.json b/xiaoduhome/src/main/resources/static/json/frame.json
index 42fd79f..415d6dd 100644
--- a/xiaoduhome/src/main/resources/static/json/frame.json
+++ b/xiaoduhome/src/main/resources/static/json/frame.json
@@ -1,28 +1,26 @@
{
"type": "Container",
"flex-direction": "row",
- "margin-bottom": "15dp",
- "margin-top": "30dp",
+ "height": "50dp",
"items": [
{
"type": "Text",
- "text": "排行榜",
- "font-size": "34dp",
+ "font-size": "31dp",
"margin-left": "30dp"
},
{
"type": "Frame",
"margin-left": "15dp",
"border-top-left-radius": "25dp",
- "border-top-right-radius": "15dp",
- "border-bottom-right-radius": "15dp",
+ "border-top-right-radius": "18dp",
+ "border-bottom-right-radius": "18dp",
"padding-vertical": "8dp",
"padding-horizontal": "15dp",
- "background-color": "rgba(0,0,0,0.2)",
+ "background-color": "rgba(0,0,0,0.3)",
"items": [
{
"type": "Text",
- "font-size": "24dp",
+ "font-size": "23dp",
"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 befe210..ccb7573 100644
--- a/xiaoduhome/src/main/resources/static/json/onLunch2.json
+++ b/xiaoduhome/src/main/resources/static/json/onLunch2.json
@@ -16,251 +16,242 @@
"width": "100%"
},
{
- "type": "Container",
+ "type": "Header",
+ "headerImage": "https://aliyun-hz1.chewrobot.com/xiaodu/image/5b2d0a11/lvzhou/15640330891628686.jpg",
+ "headerTitle": "交游天下",
+ "hasBackIcon": false
+ },
+ {
+ "type": "ScrollView",
+ "direction": "vertical",
"height": "100%",
"width": "100%",
- "padding-right": "20dp",
- "componentId": "whole",
+ "componentId": "scrollCom",
"items": [
{
- "type": "Header",
- "headerImage": "https://aliyun-hz1.chewrobot.com/xiaodu/image/5b2d0a11/lvzhou/15640330891628686.jpg",
- "headerTitle": "交游天下",
- "hasBackIcon": false
- },
- {
- "type": "ScrollView",
- "direction": "vertical",
- "height": "100%",
+ "type": "Container",
+ "height": "250dp",
"width": "100%",
- "componentId": "scrollCom",
+ "margin-bottom": "20dp",
"items": [
{
- "type": "Container",
+ "type": "List",
"height": "250dp",
+ "margin-left": "15dp",
"width": "100%",
- "margin-bottom": "20dp",
+ "direction": "horizontal",
"items": [
{
- "type": "List",
- "height": "250dp",
+ "type": "Container",
+ "height":"200dp",
+ "width":"200dp",
"margin-left": "15dp",
- "width": "100%",
- "direction": "horizontal",
"items": [
{
- "type": "Container",
- "height":"200dp",
- "width":"200dp",
- "margin-left": "15dp",
- "items": [
+ "type": "Image",
+ "componentId": "${data.imageId}",
+ "width": "180dp",
+ "height": "180dp",
+ "margin-left": "7dp",
+ "margin-top": "7dp",
+ "position": "absolute",
+ "border-radius": "15dp",
+ "src": "${data.imageSrc}",
+ "scale-type": "fitXY",
+ "onClick": [
{
- "type": "Image",
- "componentId": "${data.imageId}",
- "width": "180dp",
- "height": "180dp",
- "margin-left": "7dp",
- "margin-top": "7dp",
- "position": "absolute",
- "border-radius": "15dp",
- "src": "${data.imageSrc}",
- "scale-type": "fitXY",
- "onClick": [
- {
- "type": "SendEvent",
- "componentId": "${data.imageId}"
- }
- ]
- },
+ "type": "SendEvent",
+ "componentId": "${data.imageId}"
+ }
+ ]
+ },
+ {
+ "type": "Frame",
+ "width": "35dp",
+ "height": "35dp",
+ "background-color": "rgb(0,0,0)",
+ "border-radius": "10dp",
+ "items": [
{
- "type": "Frame",
- "width": "35dp",
- "height": "35dp",
- "background-color": "rgb(0,0,0)",
- "border-radius": "10dp",
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "align-items":"center",
"items": [
{
- "type": "Container",
- "width": "100%",
- "height": "100%",
- "align-items":"center",
- "items": [
- {
- "type": "Text",
- "text": "${data.num}",
- "font-size": "22dp"
- }
- ]
+ "type": "Text",
+ "text": "${data.num}",
+ "font-size": "22dp"
}
]
- },
- {
- "type": "Text",
- "font-size": "24dp",
- "margin-top": "159dp",
- "margin-left": "7dp",
- "text": "${data.imageName}"
}
]
+ },
+ {
+ "type": "Text",
+ "font-size": "24dp",
+ "margin-top": "159dp",
+ "margin-left": "7dp",
+ "text": "${data.imageName}"
}
]
}
]
- },
+ }
+ ]
+ },
+ {
+ "type": "Container",
+ "height": "250dp",
+ "width": "100%",
+ "margin-top": "50dp",
+ "margin-bottom": "20dp",
+ "items": [
{
- "type": "Container",
- "height": "250dp",
+ "type": "List",
+ "height": "100%",
"width": "100%",
- "margin-top": "50dp",
- "margin-bottom": "20dp",
+ "margin-left": "15dp",
+ "direction": "horizontal",
"items": [
{
- "type": "List",
- "height": "100%",
- "width": "100%",
+ "type": "Container",
"margin-left": "15dp",
- "direction": "horizontal",
+ "height":"200dp",
+ "width":"200dp",
"items": [
{
- "type": "Container",
- "margin-left": "15dp",
- "height":"200dp",
- "width":"200dp",
- "items": [
+ "type": "Image",
+ "componentId": "${data.imageId}",
+ "width": "180dp",
+ "height": "180dp",
+ "margin-left": "7dp",
+ "margin-top": "7dp",
+ "position": "absolute",
+ "border-radius": "15dp",
+ "src": "${data.imageSrc}",
+ "scale-type": "fitXY",
+ "onClick": [
{
- "type": "Image",
- "componentId": "${data.imageId}",
- "width": "180dp",
- "height": "180dp",
- "margin-left": "7dp",
- "margin-top": "7dp",
- "position": "absolute",
- "border-radius": "15dp",
- "src": "${data.imageSrc}",
- "scale-type": "fitXY",
- "onClick": [
- {
- "type": "SendEvent",
- "componentId": "${data.imageId}"
- }
- ]
- },
+ "type": "SendEvent",
+ "componentId": "${data.imageId}"
+ }
+ ]
+ },
+ {
+ "type": "Frame",
+ "width": "35dp",
+ "height": "35dp",
+ "background-color": "rgb(0,0,0)",
+ "border-radius": "10dp",
+ "items": [
{
- "type": "Frame",
- "width": "35dp",
- "height": "35dp",
- "background-color": "rgb(0,0,0)",
- "border-radius": "10dp",
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "align-items":"center",
"items": [
{
- "type": "Container",
- "width": "100%",
- "height": "100%",
- "align-items":"center",
- "items": [
- {
- "type": "Text",
- "text": "${data.num}",
- "font-size": "22dp"
- }
- ]
+ "type": "Text",
+ "text": "${data.num}",
+ "font-size": "22dp"
}
]
- },
- {
- "type": "Text",
- "font-size": "28dp",
- "margin-left": "7dp",
- "margin-top": "157dp",
- "text": "${data.imageName}"
}
]
+ },
+ {
+ "type": "Text",
+ "font-size": "28dp",
+ "margin-left": "7dp",
+ "margin-top": "157dp",
+ "text": "${data.imageName}"
}
]
}
]
- },
+ }
+ ]
+ },
+ {
+ "type": "Container",
+ "height": "250dp",
+ "width": "100%",
+ "margin-top": "50dp",
+ "margin-bottom": "70dp",
+ "items": [
{
- "type": "Container",
- "height": "250dp",
+ "type": "List",
+ "height": "100%",
"width": "100%",
- "margin-top": "50dp",
- "margin-bottom": "70dp",
+ "margin-left": "15dp",
+ "direction": "horizontal",
"items": [
{
- "type": "List",
- "height": "100%",
- "width": "100%",
+ "type": "Container",
"margin-left": "15dp",
- "direction": "horizontal",
+ "height":"200dp",
+ "width":"200dp",
"items": [
{
- "type": "Container",
- "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",
+ "onClick": [
{
- "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",
- "onClick": [
- {
- "type": "SendEvent",
- "componentId": "${data.imageId}"
- }
- ]
- },
+ "type": "SendEvent",
+ "componentId": "${data.imageId}"
+ }
+ ]
+ },
+ {
+ "type": "Frame",
+ "width": "35dp",
+ "height": "35dp",
+ "background-color": "rgb(0,0,0)",
+ "border-radius": "10dp",
+ "items": [
{
- "type": "Frame",
- "width": "35dp",
- "height": "35dp",
- "background-color": "rgb(0,0,0)",
- "border-radius": "10dp",
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "align-items":"center",
"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",
+ "text-overflow": "ellipsis",
+ "max-lines": 1,
+ "text": "${data.num}",
+ "font-size": "22dp"
}
]
- },
- {
- "type": "Text",
- "font-size": "28dp",
- "margin-left": "7dp",
- "margin-top": "137dp",
- "text": "${data.imageName}"
}
]
+ },
+ {
+ "type": "Text",
+ "font-size": "28dp",
+ "margin-left": "7dp",
+ "margin-top": "137dp",
+ "text": "${data.imageName}"
}
]
}
]
- },
- {
- "type": "Container",
- "height": "80dp",
- "width": "100%"
}
]
+ },
+ {
+ "type": "Container",
+ "height": "80dp",
+ "width": "100%"
}
]
}
diff --git a/xiaoduhome/src/main/resources/static/json/rankFirst.json b/xiaoduhome/src/main/resources/static/json/rankFirst.json
index fe23e34..8f11157 100644
--- a/xiaoduhome/src/main/resources/static/json/rankFirst.json
+++ b/xiaoduhome/src/main/resources/static/json/rankFirst.json
@@ -21,110 +21,98 @@
"hasBackIcon": false
},
{
- "type": "List",
- "width": "100%",
+ "type": "Container",
"height": "100%",
- "direction": "vertical",
+ "width": "100%",
"items": [
{
"type": "Container",
- "flex-direction": "row",
+ "width": "100%",
+ "margin-left": "15dp",
+ "direction": "horizontal",
+ "items": [
+
+ ]
+ },
+ {
+ "type": "List",
+ "width": "100%",
+ "margin-left": "15dp",
+ "direction": "horizontal",
"items": [
- {
- "type": "Image",
- "width": "230dp",
- "height": "230dp",
- "src": "${data.imageSrc}",
- "position": "absolute",
- "border-radius": "15dp",
- "onClick": [
- {
- "type": "SendEvent",
- "componentId": "${data.imageId}"
- }
- ]
- },
- {
- "type": "Image",
- "src": "${data.logo}",
- "width": "30dp",
- "height": "30dp",
- "border-radius": "5dp"
- },
{
"type": "Container",
- "margin-left": "250dp",
- "flex-direction": "column",
+ "width":"220dp",
+ "margin-bottom": "35dp",
+ "margin-left": "15dp",
"items": [
{
- "type": "Text",
- "margin-top": "10dp",
- "text": "${data.imageName}",
- "font-size": "38dp",
- "margin-left": "5%"
- },
- {
- "type": "Text",
- "text": "${data.watches}",
- "margin-top": "10dp",
- "font-size": "25dp",
- "margin-left": "5%"
- },
- {
- "type": "Container",
- "margin-top": "10dp",
- "flex-direction":"row",
- "items":[
+ "type": "Image",
+ "width": "170dp",
+ "height": "170dp",
+ "margin-left": "7dp",
+ "margin-top": "7dp",
+ "position": "absolute",
+ "componentId": "${data.imageId}",
+ "scale-type": "fitXY",
+ "border-radius": "10dp",
+ "src": "${data.imageSrc}",
+ "onClick": [
{
- "type": "Text",
- "text": "${data.time}",
- "font-size": "22dp",
- "margin-left": "5%"
- },
- {
- "type": "Text",
- "text": "${data.auth}",
- "font-size": "22dp",
- "margin-left": "10%"
+ "type": "SendEvent",
+ "componentId": "${data.imageId}"
}
]
},
{
- "type": "Container",
- "margin-top": "6dp",
- "flex-direction":"row",
- "items":[
+ "type": "Frame",
+ "width": "40dp",
+ "height": "40dp",
+ "background-color": "rgba(0,0,0,0.9)",
+ "border-radius": "12dp",
+ "items": [
{
- "type": "Text",
- "max-lines": 1,
- "text": "${data.label}",
- "font-size": "22dp",
- "margin-left": "5%"
+ "type": "Container",
+ "width": "100%",
+ "height": "100%",
+ "align-items":"center",
+ "items": [
+ {
+ "type": "Text",
+ "text": "${data.num}",
+ "font-size": "25dp"
+ }
+ ]
}
]
},
{
- "type": "Container",
- "margin-top": "9dp",
- "margin-right": "26dp",
- "items": [
- {
- "type": "Text",
- "font-size": "25dp",
- "line-height": "20dp",
- "text": "${data.intro}",
- "margin-top": "30dp",
- "max-lines": 3,
- "text-overflow": "ellipsis",
- "margin-left": "5%"
- }
- ]
+ "type": "Text",
+ "font-size": "25dp",
+ "margin-top": "140dp",
+ "margin-left": "7dp",
+ "text": "${data.imageName}"
}
]
}
]
}
]
+ },
+ {
+ "type": "Container",
+ "position": "absolute",
+ "width": "100%",
+ "left": "0",
+ "bottom": "0",
+ "items": [
+ {
+ "type": "Footer",
+ "hints": [
+ "打开第一个","下一页","上一页","返回"
+ ]
+ }
+ ]
}
]
}
diff --git a/xiaoduhome/src/main/resources/static/json/recommand2.json b/xiaoduhome/src/main/resources/static/json/recommand2.json
index 13a7016..9eff5fc 100644
--- a/xiaoduhome/src/main/resources/static/json/recommand2.json
+++ b/xiaoduhome/src/main/resources/static/json/recommand2.json
@@ -21,7 +21,7 @@
"hasBackIcon": false
},
{
- "type": "Container",
+ "type": "ScrollView",
"height": "100%",
"width": "100%",
"items": [