From 235064ddba6d6e22c0f2c229add320fafb851fcb Mon Sep 17 00:00:00 2001
From: 苗权威 <1160292058@qq.com>
Date: Wed, 25 Sep 2019 21:07:11 +0800
Subject: [PATCH] 9.25
---
.idea/workspace.xml | 643 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java | 22 ++++++++++++++++++++++
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryPagePojo.java | 22 +++++++++++++++++++++-
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryUtils.java | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/TempleUtils.java | 38 +-------------------------------------
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchPojo.java | 5 +++++
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/onLunch/LunchUtils.java | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java | 1 +
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/productInfo/ProductInfoUtils.java | 2 ++
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/rank/RankUtil.java | 1 +
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/recommand/RecommendUtil.java | 12 +++++++++++-
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/Oauth2Controller.java | 1 +
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java | 2 +-
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFavoriteTB.java | 7 +++----
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFlowerTB.java | 4 ++--
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuHistoryTB.java | 7 +++----
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderTB.java | 8 ++------
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/pageData/HistoryData.java | 7 ++++++-
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/repository/secondary/XiaoDuHistoryTBRepository.java | 2 ++
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplBotService.java | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplbotServiceUtil.java | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/LoadBySMS.java | 8 ++++++--
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/RequestTerminal.java | 11 ++++++-----
xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/ScheduleService.java | 55 ++++++++++++++++++++++++++++---------------------------
xiaoduhome/src/main/resources/application.yml | 4 ++--
xiaoduhome/src/main/resources/static/json/collectPage.json | 42 +++++++++++++++++++++++++++++++++---------
26 files changed, 1001 insertions(+), 456 deletions(-)
create mode 100644 xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryUtils.java
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index be9c92b..c7752d4 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -3,36 +3,30 @@
-
-
-
+
+
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
@@ -78,54 +72,78 @@
-
-
+
+
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -134,10 +152,23 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -156,19 +187,6 @@
- allRepeateName2Id
- nameRepeats
- allRepeateId2Info
- record_dir
- filePath
- dirs
- offlineCallback:
- filename
- getOnline
- url
- folder
- allOldname2Id
- id2Info
allRepeateName2Info
repeateName2Ids
del_record_callback_url
@@ -186,6 +204,19 @@
price
appUserId
asideText
+ 2139635657
+ onUserIntent
+ productName
+ 4151097686
+ doesUserPlayed
+ data
+ margin
+ 2167984446
+ setTextOverflow
+ padding-left
+ correctName
+ onChargeEvent
+ Task
OPENID_CACHE
@@ -201,21 +232,6 @@
@@ -284,8 +315,8 @@
-
-
+
+
@@ -297,6 +328,7 @@
+
@@ -440,7 +472,9 @@
-
+
+
+
@@ -450,7 +484,7 @@
-
+
@@ -461,7 +495,6 @@
-
@@ -472,7 +505,7 @@
-
+
@@ -524,11 +557,19 @@
+
+
+
+
+
+
+
+
+
-
@@ -542,7 +583,7 @@
-
+
@@ -550,7 +591,7 @@
-
+
@@ -594,7 +635,7 @@
-
+
@@ -608,12 +649,12 @@
-
-
+
+
-
+
@@ -969,10 +1010,10 @@
-
+
@@ -993,15 +1034,15 @@
-
+
+
-
@@ -1106,6 +1147,8 @@
+
+
@@ -1115,7 +1158,7 @@
-
+
@@ -1127,17 +1170,18 @@
-
+
+
-
+
-
-
-
+
+
+
@@ -1146,7 +1190,7 @@
-
+
@@ -1166,6 +1210,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1175,391 +1257,390 @@
-
+
-
-
+
+
-
+
-
-
+
+
-
+
+
+
+
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
-
-
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java
index 0c00561..dcc1bab 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/OkHttp3Utils.java
@@ -82,6 +82,26 @@ public class OkHttp3Utils {
return null;
}
+ public static String doPostJsonStr(String url, String requestJsonStr, HashMap headers) throws IOException {
+ Request.Builder builder = new Request.Builder();
+ Request request = builder.url(url).build();
+
+ Headers.Builder headBuilder = request.headers().newBuilder();
+
+ Iterator> headIterator = headers.entrySet().iterator();
+ headIterator.forEachRemaining(e -> headBuilder.add(e.getKey(), e.getValue()));
+
+ builder.headers(headBuilder.build()).post(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), requestJsonStr));
+ try (Response response = client.newCall(builder.build()).execute()){
+ return response.body().string();
+ }catch (SocketTimeoutException e) {
+ log.error("捕获到SocketTimeoutException:{}", e.toString());
+ client.dispatcher().cancelAll();
+ client.connectionPool().evictAll();
+ }
+ return null;
+ }
+
public static void backPostAsync(String url, String requestJsonStr) {
Request.Builder builder = new Request.Builder();
// builder.url(url);
@@ -130,6 +150,8 @@ public class OkHttp3Utils {
}
}
+
+
public static String doPost(String url, Map headers, Map params,
String fileName, byte[] fileByte) throws IOException {
Request.Builder builder = new Request.Builder();
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryPagePojo.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryPagePojo.java
index e8b2c20..0e4b6fe 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryPagePojo.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryPagePojo.java
@@ -25,15 +25,22 @@ public class CollectHistoryPagePojo {
private String position;
private String left;
private String width;
+ private String bottom;
private String height;
private String src;
private String top;
- private String headerImage;
+ private Boolean hasBackIcon;
+ private String margin;
+ private String componentId;
private String headerTitle;
@JsonProperty("margin-left")
private String marginLeft;
+ @JsonProperty("margin-right")
+ private String marginRight;
@JsonProperty("margin-top")
private String marginTop;
+ @JsonProperty("margin-bottom")
+ private String marginBottom;
private String padding;
private List items;
private String direction;
@@ -50,4 +57,17 @@ public class CollectHistoryPagePojo {
@JsonProperty("max-lines")
private Integer maxLines;
private List onClick;
+ @JsonProperty("border-color")
+ private String borderColor;
+ @JsonProperty("border-width")
+ private String borderWidth;
+ private List hints;
+ @JsonProperty("padding-bottom")
+ private String paddingBottom;
+ @JsonProperty("padding-right")
+ private String paddingRight;
+ @JsonProperty("padding-left")
+ private String paddingLeft;
+ @JsonProperty("scale-type")
+ private String scaleType;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryUtils.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryUtils.java
new file mode 100644
index 0000000..5700fc3
--- /dev/null
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/CollectHistoryUtils.java
@@ -0,0 +1,167 @@
+package ai.qiwu.com.xiaoduhome.common.temple;
+
+import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
+import ai.qiwu.com.xiaoduhome.pojo.pageData.HistoryData;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author 苗权威
+ * @dateTime 19-9-25 下午3:38
+ */
+public class CollectHistoryUtils {
+
+ private static final CollectHistoryPagePojo MAIN_CON = buildMainContainer();
+ private static final CollectHistoryPagePojo BACK_IMG = buildLunchBackgroundImg();
+ private static final CollectHistoryPagePojo COLLECT_HEAD = buildLunchHead();
+ private static final CollectHistoryPagePojo HISTORY_HEAD = buildHistoryHead();
+ private static final CollectHistoryPagePojo FOOTER = buildFooter();
+
+ public static CollectHistoryDocument getDocument(List datas, boolean collect) {
+ CollectHistoryDocument document = new CollectHistoryDocument();
+ document.setDuration(120000);
+ CollectHistoryMainTemplate mainTemplate = new CollectHistoryMainTemplate();
+ document.setMainTemplate(mainTemplate);
+
+ CollectHistoryPagePojo allContainer = new CollectHistoryPagePojo();
+ allContainer.setType("Container");
+ allContainer.setWidth("100%");
+ allContainer.setPaddingRight("15dp");
+ allContainer.setPaddingLeft("15dp");
+ allContainer.setPaddingBottom("120dp");
+
+ CollectHistoryPagePojo list = new CollectHistoryPagePojo();
+ list.setType("List");
+ list.setHeight("100%");
+ list.setWidth("100%");
+ list.setDirection("vertical");
+ list.setItems(Collections.singletonList(MAIN_CON));
+ list.setData(datas);
+
+ allContainer.setItems(Collections.singletonList(list));
+
+ CollectHistoryPagePojo head;
+ if (collect) head = COLLECT_HEAD;
+ else head = HISTORY_HEAD;
+ mainTemplate.getItems().addAll(Arrays.asList(BACK_IMG, head, allContainer, FOOTER));
+ return document;
+ }
+
+ private static CollectHistoryPagePojo buildMainContainer() {
+ CollectHistoryPagePojo main = new CollectHistoryPagePojo();
+ main.setType("Container");
+ main.setHeight("100dp");
+ main.setWidth("100%");
+ main.setMarginBottom("20dp");
+ main.setFlexDirection("row");
+ main.setComponentId("${data.botAccountId}");
+ main.setOnClick(Collections.singletonList(new Event("SendEvent", "${data.botAccountId}")));
+
+ // num
+ CollectHistoryPagePojo num = new CollectHistoryPagePojo();
+ num.setType("Text");
+ num.setFontSize("40dp");
+ num.setMarginLeft("40dp");
+ num.setMarginTop("7dp");
+ num.setText("${data.collectPageLeftNum}");
+
+ // image
+ CollectHistoryPagePojo image = new CollectHistoryPagePojo();
+ image.setType("Image");
+ image.setWidth("80dp");
+ image.setHeight("80dp");
+ image.setBorderRadius("10dp");
+ image.setMarginLeft("20dp");
+ image.setSrc("${data.bannerImgUrl}");
+
+ // name,intro container
+ CollectHistoryPagePojo nameIntroCon = new CollectHistoryPagePojo();
+ nameIntroCon.setType("Container");
+ nameIntroCon.setHeight("75dp");
+ nameIntroCon.setWidth("50%");
+ nameIntroCon.setMarginLeft("20dp");
+ nameIntroCon.setFlexDirection("column");
+
+ CollectHistoryPagePojo name = new CollectHistoryPagePojo();
+ name.setType("Text");
+ name.setFontSize("30dp");
+ name.setText("${data.name}");
+
+ CollectHistoryPagePojo intro = new CollectHistoryPagePojo();
+ intro.setType("Text");
+ intro.setFontSize("20dp");
+ intro.setMarginTop("8dp");
+ intro.setText("${data.intro}");
+ intro.setTextOverflow("ellipsis");
+ intro.setMaxLines(1);
+
+ nameIntroCon.setItems(Arrays.asList(name, intro));
+
+ // author
+ CollectHistoryPagePojo author = new CollectHistoryPagePojo();
+ author.setType("Text");
+ author.setFontSize("25dp");
+ author.setMarginTop("20dp");
+ author.setText("${data.authorName}");
+ author.setMarginLeft("100dp");
+ author.setTextOverflow("ellipsis");
+
+ // divide
+ CollectHistoryPagePojo divide = new CollectHistoryPagePojo();
+ divide.setType("Frame");
+ divide.setPosition("absolute");
+ divide.setMarginTop("90dp");
+ divide.setWidth("100%");
+ divide.setBorderColor("rgba(255,255,255,0.5)");
+ divide.setBorderWidth("1dp");
+
+ main.setItems(Arrays.asList(num,image, nameIntroCon, author, divide));
+ return main;
+ }
+
+ private static CollectHistoryPagePojo buildFooter() {
+ CollectHistoryPagePojo footerCon = new CollectHistoryPagePojo();
+ footerCon.setType("Container");
+ footerCon.setPosition("absolute");
+ footerCon.setWidth("100%");
+ footerCon.setLeft("0");
+ footerCon.setBottom("0");
+
+ CollectHistoryPagePojo footer = new CollectHistoryPagePojo();
+ footer.setType("Footer");
+ footer.setHints(Arrays.asList("打开第一个","下一页","上一页","返回"));
+ footerCon.setItems(Collections.singletonList(footer));
+ return footerCon;
+ }
+
+ private static CollectHistoryPagePojo buildLunchBackgroundImg() {
+ CollectHistoryPagePojo backGroundImg = new CollectHistoryPagePojo();
+ 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.setScaleType("fitXY");
+ backGroundImg.setWidth("100%");
+ return backGroundImg;
+ }
+
+ private static CollectHistoryPagePojo buildLunchHead() {
+ CollectHistoryPagePojo head = new CollectHistoryPagePojo();
+ head.setType("Header");
+ head.setHeaderTitle("收藏");
+ head.setHasBackIcon(false);
+ return head;
+ }
+
+ private static CollectHistoryPagePojo buildHistoryHead() {
+ CollectHistoryPagePojo head = new CollectHistoryPagePojo();
+ head.setType("Header");
+ head.setHeaderTitle("历史记录");
+ head.setHasBackIcon(false);
+ return head;
+ }
+}
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 14fb1ce..55162fb 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
@@ -22,6 +22,7 @@ import ai.qiwu.com.xiaoduhome.pojo.dpl.MyDocument;
import ai.qiwu.com.xiaoduhome.pojo.pageData.HistoryData;
import ai.qiwu.com.xiaoduhome.repository.primary.AppFavoriteTBRepository;
import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuHistoryBotTimeRepository;
+import ai.qiwu.com.xiaoduhome.service.DplbotServiceUtil;
import ai.qiwu.com.xiaoduhome.service.ScheduleService;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
@@ -148,10 +149,6 @@ public class TempleUtils {
// return document;
// }
- public static RankingDocument getRanking() {
- return RankUtil.getRankDocument();
- }
-
public static RecommandDocument getRecommend(int num) {
RecommandDocument document = JSON.parseObject(getDPLTemple("static/json/recommand2.json"), RecommandDocument.class);
List firstRowData = new ArrayList<>();
@@ -241,39 +238,6 @@ public class TempleUtils {
return historyDocument;
}
- public static CollectHistoryDocument getCollectPage(Long userId) {
- CollectHistoryDocument collectHistoryDocument = JSON.parseObject(getDPLTemple("static/json/collectPage.json"), CollectHistoryDocument.class);
- AppFavoriteTBRepository favorite = BaseHolder.getBean("appFavoriteTBRepository");
- List favoriteProducts = favorite.getFavoriteBotIds(userId);
- if (favoriteProducts == null || favoriteProducts.size() == 0) return null;
- ArrayList projectInfoList = new ArrayList<>();
- int i = 1;
- log.info("id list:{}", favoriteProducts);
- final StringBuilder build = new StringBuilder();
- for (String botAccount :favoriteProducts) {
- build.append(botAccount).append(File.separator);
- OnProductDetail productDetail = ScheduleService.getProductIdDetail().get(botAccount);
-
- String intro = productDetail.getIntro();
- if (StringUtils.isBlank(intro)) intro = "作者太懒没写介绍";
- 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);
- data.setAuthorName(productDetail.getAuthorName());
- projectInfoList.add(data);
- }
- String idToken;
- if (build.length() != 0) {
- build.deleteCharAt(build.length()-1);
- idToken = Base64.getEncoder().encodeToString(build.toString().getBytes());
- collectHistoryDocument.setIdToken(idToken);
- }
- CollectHistoryMainTemplate collectHistoryMainTemplate = collectHistoryDocument.getMainTemplate();
- collectHistoryMainTemplate.getItems().get(2).getItems().get(0).setData(projectInfoList);
- return collectHistoryDocument;
- }
-
private static MyDocument buildCollectTemple() {
return JSON.parseObject(getDPLTemple("static/json/collect.json"), MyDocument.class);
}
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
index 2de4f1e..3eae042 100644
--- 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
@@ -25,10 +25,15 @@ public class LunchPojo {
private String width;
private String left;
private String top;
+ private String right;
private String src;
private List items;
@JsonProperty("padding-right")
private String paddingRight;
+ @JsonProperty("padding-top")
+ private String paddingTop;
+ @JsonProperty("padding-bottom")
+ private String paddingBottom;
private String componentId;
private String headerTitle;
private Boolean hasBackIcon;
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
index 3dd5d92..f23b696 100644
--- 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
@@ -19,6 +19,9 @@ public class LunchUtils {
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 static final LunchPojo LUNCH_LOGO_IMG = buildLogoImage();
+ private static final LunchPojo LUNCH_HSITORY_IMG = buildHistoryImg();
+ private static final LunchPojo LUNCH_COLLECT_IMG = buildCollectImg();
private volatile static LunchDocument lunchDocument = buildLunchDocument();
public static LunchDocument buildLunchDocument() {
@@ -29,6 +32,7 @@ public class LunchUtils {
LunchPojo conRecommend = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRecommendList(),1));
conRecommend.setFirstItem(Collections.singletonList(TempleUtils.getFrameRecommand()));
+ conRecommend.setMarginTop("30dp");
LunchPojo conRanking = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRankingList(), 11));
conRanking.setFirstItem(Collections.singletonList(TempleUtils.getFrameRakking()));
@@ -39,7 +43,7 @@ public class LunchUtils {
LunchPojo scroll = buildLunchScroll();
scroll.setItems(Arrays.asList(conRecommend,conRanking,conCategory));
- mainTemplate.getItems().addAll(Arrays.asList(LUNCH_BACK_IMG,LUNCH_HEAD,scroll));
+ mainTemplate.getItems().addAll(Arrays.asList(LUNCH_BACK_IMG,LUNCH_HEAD,LUNCH_LOGO_IMG,LUNCH_HSITORY_IMG,LUNCH_COLLECT_IMG,scroll));
return document;
}
@@ -48,7 +52,7 @@ public class LunchUtils {
scroll.setType("ScrollView");
scroll.setDirection("vertical");
scroll.setWidth("100%");
- scroll.setMarginBottom("80dp");
+ scroll.setMarginBottom("10dp");
return scroll;
}
@@ -79,7 +83,7 @@ public class LunchUtils {
list.setType("List");
list.setMarginLeft("30dp");
// list.setMarginRight("15dp");
- list.setMarginBottom("70dp");
+ list.setMarginBottom("65dp");
list.setDirection("horizontal");
list.setData(data);
list.setItems(Collections.singletonList(LUNCH_LIST_CON));
@@ -98,7 +102,7 @@ public class LunchUtils {
private static LunchPojo buildImgFrmTxtContainer() {
LunchPojo container = new LunchPojo();
container.setType("Container");
- container.setMarginTop("30dp");
+ container.setMarginTop("15dp");
container.setWidth("200dp");
container.setMarginRight("33dp");
@@ -161,6 +165,7 @@ public class LunchUtils {
backGroundImg.setLeft("0dp");
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%");
+ backGroundImg.setScaleType("fitXY");
backGroundImg.setWidth("100%");
return backGroundImg;
@@ -169,12 +174,59 @@ public class LunchUtils {
private static LunchPojo buildLunchHead() {
LunchPojo head = new LunchPojo();
head.setType("Header");
- head.setHeaderTitle("交游天下");
+ //head.setHeaderTitle("交游天下");
head.setHasBackIcon(false);
return head;
}
+ private static LunchPojo buildLogoImage() {
+ LunchPojo logoCon = new LunchPojo();
+ logoCon.setType("Container");
+ logoCon.setPaddingTop("5dp");
+ logoCon.setPosition("absolute");
+ logoCon.setHeight("78dp");
+ logoCon.setTop("10dp");
+ logoCon.setLeft("390dp");
+ logoCon.setPaddingBottom("10dp");
+
+ LunchPojo logo = new LunchPojo();
+ logo.setType("Image");
+ logo.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/logo.png");
+ logo.setWidth("200dp");
+ logo.setHeight("58dp");
+ logoCon.setItems(Collections.singletonList(logo));
+ return logoCon;
+ }
+
+ private static LunchPojo buildHistoryImg() {
+ LunchPojo logo = new LunchPojo();
+ logo.setType("Image");
+ logo.setPosition("absolute");
+ logo.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/history.png");
+ logo.setWidth("40dp");
+ logo.setHeight("40dp");
+ logo.setScaleType("centerInside");
+ logo.setTop("20dp");
+ logo.setRight("30dp");
+ logo.setOnClick(Collections.singletonList(new Event("SendEvent", "lunchHistory")));
+ return logo;
+ }
+
+ private static LunchPojo buildCollectImg() {
+ LunchPojo logo = new LunchPojo();
+ logo.setType("Image");
+ logo.setPosition("absolute");
+ logo.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/uncollec.png");
+ logo.setWidth("40dp");
+ logo.setHeight("40dp");
+ logo.setScaleType("centerInside");
+ logo.setTop("20dp");
+ logo.setRight("120dp");
+ logo.setOnClick(Collections.singletonList(new Event("SendEvent", "lunchCollect")));
+ return logo;
+ }
+
public static LunchDocument getLunchDocument() {
return lunchDocument;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java
index 4f026c4..7c2cec8 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/play/PlayUtils.java
@@ -185,6 +185,7 @@ public class PlayUtils {
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%");
+ backGroundImg.setScaleType("fitXY");
return backGroundImg;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/productInfo/ProductInfoUtils.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/productInfo/ProductInfoUtils.java
index 781bd2a..84bc5d7 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/productInfo/ProductInfoUtils.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/common/temple/productInfo/ProductInfoUtils.java
@@ -199,6 +199,7 @@ public class ProductInfoUtils {
ProductInfoPojo flower = new ProductInfoPojo();
flower.setType("Text");
+ flower.setComponentId("pft");
flower.setText(flowerText);
flower.setMarginTop("10dp");
flower.setFontSize("20dp");
@@ -260,6 +261,7 @@ public class ProductInfoUtils {
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%");
+ backGroundImg.setScaleType("fitXY");
return backGroundImg;
}
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 a9160bb..317667b 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
@@ -160,6 +160,7 @@ public class RankUtil {
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%");
+ backGroundImg.setScaleType("fitXY");
return backGroundImg;
}
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
index f4b012b..ad679fa 100644
--- 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
@@ -95,7 +95,7 @@ public class RecommendUtil {
count++;
begin = end;
}
- mainTemplate.getItems().addAll(Arrays.asList(RECOM_BACK_IMG,RECOM_HEAD,scrollView,RECOM_FOOTER));
+ mainTemplate.getItems().addAll(Arrays.asList(RECOM_BACK_IMG,buildRecommendCollectHead(category),scrollView,RECOM_FOOTER));
botIds.deleteCharAt(botIds.length()-1);
String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
@@ -211,6 +211,7 @@ public class RecommendUtil {
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%");
+ backGroundImg.setScaleType("fitXY");
return backGroundImg;
}
@@ -223,4 +224,13 @@ public class RecommendUtil {
return head;
}
+
+ private static RecommandPojo buildRecommendCollectHead(String category) {
+ RecommandPojo head = new RecommandPojo();
+ head.setType("Header");
+ head.setHeaderTitle(category);
+ head.setHasBackIcon(false);
+
+ return head;
+ }
}
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 a19876a..e2fd670 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
@@ -159,6 +159,7 @@ public class Oauth2Controller {
return null;
}
if (code == null && refresh_token != null) {
+ refresh_token = refresh_token.substring(refresh_token.lastIndexOf(",")+1);
TokenResponse tokenResponse = LoadBySMS.getTokenByRefreshToken(refresh_token);
if (tokenResponse == null) return null;
TokenDuerosResponse response = new TokenDuerosResponse();
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java
index 84f5bd6..9caca18 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/controller/XiaoDuHomeController.java
@@ -29,7 +29,7 @@ public class XiaoDuHomeController {
//service.disableVerify();
service.enableVerify();
String str = service.run();
- //log.info("响应信息:{}", str);
+ log.info("响应信息:{}", str);
return str;
} catch (Exception e) {
e.printStackTrace();
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFavoriteTB.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFavoriteTB.java
index 06d6e11..3fb2eb8 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFavoriteTB.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFavoriteTB.java
@@ -9,8 +9,7 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import java.sql.Date;
-import java.sql.Timestamp;
+import java.util.Date;
/**
* @author 苗权威
@@ -37,9 +36,9 @@ public class AppFavoriteTB {
@CreatedDate
@Column(name = "gmt_create", updatable = false, nullable = false)
- private Timestamp createTime;
+ private Date createTime;
@LastModifiedDate
@Column(name = "gmt_modified", nullable = false)
- private Timestamp updateTime;
+ private Date updateTime;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFlowerTB.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFlowerTB.java
index 39e5bbd..d0e9cdc 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFlowerTB.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/primary/AppFlowerTB.java
@@ -48,9 +48,9 @@ public class AppFlowerTB {
@CreatedDate
@Column(name = "gmt_create", updatable = false, nullable = false)
- private Timestamp createTime;
+ private Date createTime;
@LastModifiedDate
@Column(name = "gmt_modified", nullable = false)
- private Timestamp updateTime;
+ private Date updateTime;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuHistoryTB.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuHistoryTB.java
index 5861de4..6f87462 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuHistoryTB.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuHistoryTB.java
@@ -9,8 +9,7 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import java.sql.Date;
-import java.sql.Timestamp;
+import java.util.Date;
/**
* @author 苗权威
@@ -37,9 +36,9 @@ public class XiaoDuHistoryTB {
@CreatedDate
@Column(name = "create_time", updatable = false, nullable = false)
- private Timestamp createTime;
+ private Date createTime;
@LastModifiedDate
@Column(name = "update_time")
- private Timestamp updateTime;
+ private Date updateTime;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderTB.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderTB.java
index 72d5236..d104194 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderTB.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/entity/secondary/XiaoDuOrderTB.java
@@ -1,16 +1,12 @@
package ai.qiwu.com.xiaoduhome.entity.secondary;
-import lombok.Data;
import lombok.Getter;
import lombok.Setter;
-import org.hibernate.annotations.CreationTimestamp;
-import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import java.sql.Timestamp;
import java.util.Date;
/**
@@ -62,9 +58,9 @@ public class XiaoDuOrderTB {
@CreatedDate
@Column(name = "create_time", updatable = false, nullable = false)
- private Timestamp createTime;
+ private Date createTime;
@LastModifiedDate
@Column(name = "update_time", nullable = false)
- private Timestamp updateTime;
+ private Date updateTime;
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/pageData/HistoryData.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/pageData/HistoryData.java
index d9c0379..4ae1cef 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/pageData/HistoryData.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/pojo/pageData/HistoryData.java
@@ -1,13 +1,18 @@
package ai.qiwu.com.xiaoduhome.pojo.pageData;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
/**
* @author 苗权威
* @dateTime 19-8-27 下午6:02
*/
-@Data
+@Getter
+@Setter
+@AllArgsConstructor
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class HistoryData {
private String botAccountId;
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 0b54d4c..d7400f2 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
@@ -33,4 +33,6 @@ public interface XiaoDuHistoryTBRepository extends JpaRepository getUserHostory(String userId);
+
+ List getByXiaoduUserId(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 52792ba..364a9ce 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
@@ -104,7 +104,6 @@ public class DplBotService extends BaseBot {
// 初次进入时创建用户的行为信息,包括历史记录,送花数,收藏记录
// 历史记录,收藏记录,送花数,郊游天下id
if (DplbotServiceUtil.USER_HISTORY.get(getUserId()) == null) {
- log.info("onLunch:空");
DplbotServiceUtil.onLunchFillUserBehaviorData(getAccessToken(), getUserId());
}
return new Response(outputSpeech);
@@ -196,7 +195,7 @@ public class DplBotService extends BaseBot {
protected Response onUserEvent(UserEvent userEvent) {
log.info("onUserEvent事件触发,token:{}, componentId:{}",userEvent.getToken(),userEvent.getPayload().getComponentId());
if (getAccessToken() != null && getSessionAttribute("userId") == null) {
- String userId = DplbotServiceUtil.getUsUserId(getAccessToken(), getUserId());
+ String userId = DplbotServiceUtil.getUsUserId(getUserId(),getAccessToken());
setSessionAttribute("userId", userId);
}
String componentId = userEvent.getPayload().getComponentId();
@@ -257,7 +256,7 @@ public class DplBotService extends BaseBot {
collectComId = FLOWER_LOAD;
}
- ProductInfoDocument document = ProductInfoUtils.getProductINfoDocument(imgUrl, productName, time, author, labels.toString(),
+ ProductInfoDocument document = ProductInfoUtils.getProductINfoDocument(imgUrl, correctName(productName), time, author, labels.toString(),
intro, enterProName, flowerReward, flowers, collectComId, collectUrl, collectText);
RenderDocument renderDocument = new RenderDocument(document);
@@ -356,11 +355,14 @@ public class DplBotService extends BaseBot {
RenderDocument render = new RenderDocument(document);
this.setSessionAttribute("category",category);
this.addDirective(render);
- this.addDirective(new PushStack());
this.setSessionAttribute("pageSign","5");
this.setSessionAttribute("trace","05");
} else if ("playButton".equals(componentId)) {
return buildErrorResponse("您可以直接对我说我要送花或者我要收藏或取消收藏");
+ } else if ("lunchCollect".equals(componentId)) {
+ return dealOpenCollectClick();
+ } else if ("lunchHistory".equals(componentId)) {
+ return dealHistoryClick();
}
// else if ("funnyChange".equals(componentId)) {
// ExecuteCommands executeCommands = new ExecuteCommands();
@@ -380,6 +382,44 @@ public class DplBotService extends BaseBot {
return new Response();
}
+ private Response dealHistoryClick() {
+ CollectHistoryDocument document = DplbotServiceUtil.getHistory(getUserId(), getAccessToken());
+ if (document == null) return new Response();
+ RenderDocument render = new RenderDocument(document);
+ addDirective(render);
+ setSessionAttribute(PRE_COLLE,document.getIdToken());
+ setSessionAttribute("ranking", null);
+ setSessionAttribute("recommand", null);
+ setSessionAttribute(BACK_TRACE, "02");
+ OutputSpeech outputSpeech = new OutputSpeech(OutputSpeech.SpeechType.PlainText, "正在为您打开历史记录");
+ return new Response(outputSpeech);
+ }
+
+ private Response dealOpenCollectClick() {
+ if (getAccessToken() == null) {
+ OutputSpeech outputSpeech = new OutputSpeech(OutputSpeech.SpeechType.PlainText, "该功能需要登录,请说小度小度,登录");
+ return new Response(outputSpeech);
+ } else {
+ String appUserId = getSessionAttribute("userId");
+ if (appUserId == null) {
+ appUserId = DplbotServiceUtil.getUsUserId(getUserId(), getAccessToken());
+ if (appUserId == null) {
+ return new Response();
+ }
+ }
+ CollectHistoryDocument document = DplbotServiceUtil.getCollectPage(getUserId(), getAccessToken(), appUserId);
+ if (document != null) {
+ RenderDocument render = new RenderDocument(document);
+ addDirective(render);
+ setSessionAttribute(PRE_COLLE,document.getIdToken());
+ setSessionAttribute(BACK_TRACE, "01");
+ OutputSpeech outputSpeech = new OutputSpeech(OutputSpeech.SpeechType.PlainText, "正在为您打开收藏夹");
+ return new Response(outputSpeech);
+ }
+ }
+ return new Response();
+ }
+
// @Override
// protected Response onBuyEvent(BuyEvent buyEvent) {
// com.baidu.dueros.data.request.buy.event.JYTUserResponse payload = buyEvent.getPayload();
@@ -583,7 +623,7 @@ public class DplBotService extends BaseBot {
collectComId = FLOWER_LOAD; // 提示登录
}
- ProductInfoDocument document = ProductInfoUtils.getProductINfoDocument(imgUrl, productName, createTime, author, labels.toString(),
+ ProductInfoDocument document = ProductInfoUtils.getProductINfoDocument(imgUrl, correctName(productName), createTime, author, labels.toString(),
intro, enterProName, flowerReward, flowers, collectComId, collectUrl, collectText);
RenderDocument renderDocument = new RenderDocument(document);
this.addDirective(renderDocument);
@@ -852,7 +892,11 @@ public class DplBotService extends BaseBot {
}
private void dealHistoryIntent(OverTimeDetail detail, String userId) {
- CollectHistoryDocument document = TempleUtils.getHistory(getUserId());
+ CollectHistoryDocument document = DplbotServiceUtil.getHistory(getUserId(), getAccessToken());
+ if (document == null) {
+ LAST_OUTTIME_RESULT.put(userId, detail);
+ return;
+ }
RenderDocument render = new RenderDocument(document);
addDirective(render);
//dplBotService.addDirective(new PushStack());
@@ -1131,7 +1175,7 @@ public class DplBotService extends BaseBot {
return;
}
}
- CollectHistoryDocument document = TempleUtils.getCollectPage(Long.parseLong(appUserId));
+ CollectHistoryDocument document = DplbotServiceUtil.getCollectPage(userId, getAccessToken(), appUserId);
if (document == null) {
backToHome(detail);
detail.setResponse(buildErrorResponse("您还未收藏过任何作品,快去收藏吧"));
@@ -1183,7 +1227,7 @@ public class DplBotService extends BaseBot {
break;
}
}
- CollectHistoryDocument document = TempleUtils.getCollectPage(Long.parseLong(appUserId));
+ CollectHistoryDocument document = DplbotServiceUtil.getCollectPage(userId, getAccessToken(), appUserId);
if (document == null) {
backToHome(detail);
detail.setResponse(buildErrorResponse("您还未收藏过任何作品,快去收藏吧"));
@@ -1200,7 +1244,7 @@ public class DplBotService extends BaseBot {
}
case '2': {
//history
- CollectHistoryDocument document = TempleUtils.getHistory(getUserId());
+ CollectHistoryDocument document = DplbotServiceUtil.getHistory(getUserId(), getAccessToken());
if (document == null) {
backToHome(detail);
detail.setResponse(buildErrorResponse("哎呀,可能是您太久没玩了,历史记录已被清空"));
@@ -1237,7 +1281,7 @@ public class DplBotService extends BaseBot {
}
case '4': {
//rank
- RankingDocument document = TempleUtils.getRanking();
+ RankingDocument document = RankUtil.getRankDocument();
RenderDocument render = new RenderDocument();
render.setDocument(document);
addDirective(render);
@@ -1312,9 +1356,10 @@ public class DplBotService extends BaseBot {
FUNNY_DEFAULT_DOCUMENT = document;
RenderDocument render = new RenderDocument(document);
addDirective(render);
- LAST_OUTTIME_RESULT.put(userId, detail);
setSessionAttribute("pageSign", "6");
detail.getAttributes().put("pageSign", "6");
+ detail.getDirectives().add(render);
+ LAST_OUTTIME_RESULT.put(userId, detail);
return;
}
log.info("funny出现问题");
@@ -1338,7 +1383,7 @@ public class DplBotService extends BaseBot {
}
String beforeBotAccount = getSessionAttribute("botAcc");
if (!botAccount.equals(beforeBotAccount)) {
- DplbotServiceUtil. updateTheUserBehaviorDataMark(userId);
+ DplbotServiceUtil. updateTheUserBehaviorDataMark(userId, botAccount, getAccessToken());
String productName = ScheduleService.PRODUCT_ID_DETAIL.get(botAccount).getName();
PlayDocument document = PlayUtils.getPlayDocument(correctName(productName), aside,
@@ -1357,45 +1402,47 @@ public class DplBotService extends BaseBot {
detail.getAttributes().put(BACK_TRACE,trace);
LAST_OUTTIME_RESULT.put(userId, detail);
} else {
- ExecuteCommands executeCommands = new ExecuteCommands();
- SetStateCommand audio = new SetStateCommand();
- SetStateCommand textState = new SetStateCommand();
- audio.setComponentId("audioCom");
- audio.setState("src");
- audio.setValue(data.getAudio());
- textState.setComponentId("text");
- textState.setState("text");
- textState.setValue(text);
-
- SetStateCommand asideImg = new SetStateCommand();
- asideImg.setComponentId("asideImg");
- asideImg.setState("src");
- asideImg.setValue(ScheduleService.getAsideImgUrl(botAccount, aside));
-
- SetStateCommand asideText = new SetStateCommand();
- asideText.setComponentId("asideText");
- asideText.setState("text");
- asideText.setValue(aside);
-
- executeCommands.addCommand(audio);
- executeCommands.addCommand(textState);
- executeCommands.addCommand(asideImg);
- executeCommands.addCommand(asideText);
+// ExecuteCommands executeCommands = new ExecuteCommands();
+// SetStateCommand audio = new SetStateCommand();
+// SetStateCommand textState = new SetStateCommand();
+// audio.setComponentId("audioCom");
+// audio.setState("src");
+// audio.setValue(data.getAudio());
+// textState.setComponentId("text");
+// textState.setState("text");
+// textState.setValue(text);
+//
+// SetStateCommand asideImg = new SetStateCommand();
+// asideImg.setComponentId("asideImg");
+// asideImg.setState("src");
+// asideImg.setValue(ScheduleService.getAsideImgUrl(botAccount, aside));
+//
+// SetStateCommand asideText = new SetStateCommand();
+// asideText.setComponentId("asideText");
+// asideText.setState("text");
+// asideText.setValue(aside);
+//
+// executeCommands.addCommand(audio);
+// executeCommands.addCommand(textState);
+// executeCommands.addCommand(asideImg);
+// executeCommands.addCommand(asideText);
// UpdateComponentCommand update = new UpdateComponentCommand();
// update.setComponentId("whole");
// update.setDocument(TempleUtils.getPlayUpdate(data.getAudio(), text));
// executeCommands.addCommand(update);
- addDirective(executeCommands);
- detail.getDirectives().add(executeCommands);
-// String productName = ScheduleService.PRODUCT_ID_DETAIL.get(botAccount).getName();
-// PlayDocument document = PlayUtils.getPlayDocument(correctName(productName), data.getAudio(), text);
-// RenderDocument render = new RenderDocument(document);
-// addDirective(render);
-// detail.getDirectives().add(render);
+// addDirective(executeCommands);
+// detail.getDirectives().add(executeCommands);
+
+ String productName = ScheduleService.PRODUCT_ID_DETAIL.get(botAccount).getName();
+ PlayDocument document = PlayUtils.getPlayDocument(correctName(productName), aside,
+ ScheduleService.getAsideImgUrl(botAccount, aside),
+ data.getAudio(), text,DplbotServiceUtil.doesUserCollectThisBot(botAccount, getAccessToken(), userId));
+ RenderDocument render = new RenderDocument(document);
+ addDirective(render);
+ detail.getDirectives().add(render);
LAST_OUTTIME_RESULT.put(userId, detail);
- //LAST_OUTTIME_RESULT.put(userId, new Response());
}
}
@@ -1551,7 +1598,7 @@ public class DplBotService extends BaseBot {
collectComId = FLOWER_LOAD; // 提示登录
}
- ProductInfoDocument document = ProductInfoUtils.getProductINfoDocument(imgUrl, productName, createTime, author, labels.toString(),
+ ProductInfoDocument document = ProductInfoUtils.getProductINfoDocument(imgUrl, correctName(productName), createTime, author, labels.toString(),
intro, enterProName, flowerReward, flowers, collectComId, collectUrl, collectText);
RenderDocument renderDocument = new RenderDocument(document);
@@ -1612,8 +1659,27 @@ public class DplBotService extends BaseBot {
@Override
protected Response onChargeEvent(ChargeEvent chargeEvent) {
- String response = DplbotServiceUtil.dealChargeCallback(chargeEvent, getUserId(), getAccessToken(),
+ String token = chargeEvent.getToken();
+ int sepIndex = token.indexOf(File.separator);
+ final String botAccount = token.substring(0, sepIndex);
+ boolean response = DplbotServiceUtil.dealChargeCallback(chargeEvent, getUserId(), getAccessToken(),
getSessionAttribute("userId"));
- return buildErrorResponse(response);
+ String str = "恭喜您支付成功,开始体验吧";
+ if (response) {
+ HashMap flowerRecords = DplbotServiceUtil.USER_HISTORY.get(getUserId()).getUserBotId2Flowers();
+ Long before = flowerRecords.get(botAccount);
+ if (before == null) before = 0L;
+ flowerRecords.put(botAccount, before+1);
+ ExecuteCommands executeCommands = new ExecuteCommands();
+ SetStateCommand stateCommand = new SetStateCommand();
+ stateCommand.setComponentId("pft");
+ stateCommand.setState("text");
+ stateCommand.setValue(USER_SEND_FLOWER+before);
+ executeCommands.addCommand(stateCommand);
+ addDirective(executeCommands);
+ } else {
+ str = "很抱歉,您没有支付成功";
+ }
+ return buildErrorResponse(str);
}
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplbotServiceUtil.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplbotServiceUtil.java
index e06fe95..1dc757a 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplbotServiceUtil.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/DplbotServiceUtil.java
@@ -4,18 +4,23 @@ import ai.qiwu.com.xiaoduhome.common.BaseHolder;
import ai.qiwu.com.xiaoduhome.common.Config;
import ai.qiwu.com.xiaoduhome.common.Constants;
import ai.qiwu.com.xiaoduhome.common.OkHttp3Utils;
+import ai.qiwu.com.xiaoduhome.common.temple.CollectHistoryDocument;
+import ai.qiwu.com.xiaoduhome.common.temple.CollectHistoryUtils;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFavoriteTB;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFlowerTB;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFlowerTBTiny;
import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
+import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryBotIdTime;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryTB;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuOrderTB;
import ai.qiwu.com.xiaoduhome.pojo.JYTUserResponse;
import ai.qiwu.com.xiaoduhome.pojo.UserBehaviorData;
import ai.qiwu.com.xiaoduhome.pojo.UserInfoByTokenResult;
+import ai.qiwu.com.xiaoduhome.pojo.pageData.HistoryData;
import ai.qiwu.com.xiaoduhome.repository.primary.AppFavoriteTBRepository;
import ai.qiwu.com.xiaoduhome.repository.primary.AppFlowerTBRepository;
import ai.qiwu.com.xiaoduhome.repository.primary.AppFlowerTBTintRepository;
+import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuHistoryBotTimeRepository;
import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuHistoryTBRepository;
import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuOrderTbRepository;
import com.alibaba.fastjson.JSON;
@@ -32,14 +37,14 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
+import static ai.qiwu.com.xiaoduhome.common.Constants.IMG_PREFIX;
import static ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API.*;
import static ai.qiwu.com.xiaoduhome.service.ScheduleService.curTime;
@@ -59,7 +64,7 @@ public class DplbotServiceUtil {
static final ConcurrentHashMap USER_HISTORY = new ConcurrentHashMap<>();
- static void getUserFavorite(String userId, String usUserId) {
+ private static void getUserFavorite(String userId, String usUserId) {
AppFavoriteTBRepository favoriteTBRepository = BaseHolder.getBean("appFavoriteTBRepository");
try {
UserBehaviorData data = USER_HISTORY.computeIfAbsent(userId, s -> new UserBehaviorData());
@@ -79,7 +84,7 @@ public class DplbotServiceUtil {
long sum = 0;
List nums = repository.getFlowerNumByUserIdAndBotAccount(Long.parseLong(jytUserId), detail.getBotAccount());
for (Long num: nums) sum += num;
- data.getUserBotId2Flowers().put(detail.getBotAccount(), sum);
+ if (sum != 0) data.getUserBotId2Flowers().put(detail.getBotAccount(), sum);
}
}
@@ -87,6 +92,7 @@ public class DplbotServiceUtil {
UserBehaviorData data = USER_HISTORY.computeIfAbsent(userId, s -> new UserBehaviorData());
String usId = data.getJytUserId();
if (usId == null) {
+ log.info("getUsUserId:请求getUserIdByToken");
usId = getUserIdByToken(accessToken);
data.setJytUserId(usId);
}
@@ -120,8 +126,8 @@ public class DplbotServiceUtil {
XiaoDuHistoryTBRepository repository = BaseHolder.getBean("xiaoDuHistoryTBRepository");
UserBehaviorData data = USER_HISTORY.computeIfAbsent(userId, s -> new UserBehaviorData());
HashMap userBotId2History = data.getUserBotId2History();
- for (String botId: repository.getUserHostory(userId)) {
- userBotId2History.put(botId, ScheduleService.curTime);
+ for (XiaoDuHistoryTB historyTB: repository.getByXiaoduUserId(userId)) {
+ userBotId2History.put(historyTB.getBotId(), historyTB.getLastTime());
}
//log.info("用户历史记录:{}",USER_HISTORY);
});
@@ -132,10 +138,11 @@ public class DplbotServiceUtil {
XiaoDuHistoryTBRepository repository = BaseHolder.getBean("xiaoDuHistoryTBRepository");
UserBehaviorData data = USER_HISTORY.computeIfAbsent(userId, s -> new UserBehaviorData());
HashMap userBotId2History = data.getUserBotId2History();
- for (String botId: repository.getUserHostory(userId)) {
- userBotId2History.put(botId, ScheduleService.curTime);
+ for (XiaoDuHistoryTB historyTB: repository.getByXiaoduUserId(userId)) {
+ userBotId2History.put(historyTB.getBotId(), historyTB.getLastTime());
}
if (accessToken != null) {
+ log.info("onLunchFillUserBehaviorData:请求getUserIdByToken");
String jytUserId = DplbotServiceUtil.getUserIdByToken(accessToken);
if (jytUserId != null) {
data.setJytUserId(jytUserId);
@@ -147,7 +154,7 @@ public class DplbotServiceUtil {
}
- public static ThreadPoolExecutor getPOOL() {
+ static ThreadPoolExecutor getPOOL() {
return POOL;
}
@@ -232,7 +239,10 @@ public class DplbotServiceUtil {
return count != null;
} else {
onLunchFillUserBehaviorData(accessToken, userID);
- if (jytUserId == null) jytUserId = getUserIdByToken(accessToken);
+ if (jytUserId == null) {
+ log.info("didUserCollecThisProduct:请求getUserIdByToken");
+ jytUserId = getUserIdByToken(accessToken);
+ }
if (jytUserId == null) return false;
AppFavoriteTBRepository repository = BaseHolder.getBean("appFavoriteTBRepository");
AppFavoriteTB favorite = new AppFavoriteTB();
@@ -247,7 +257,7 @@ public class DplbotServiceUtil {
POOL.submit(() -> userUnCollectTheBot(userId, botAccount, accessToken));
}
- static void userUnCollectTheBot(String userId, String botAccount, String accessToken) {
+ private static void userUnCollectTheBot(String userId, String botAccount, String accessToken) {
String jytUserId = getUsUserId(userId, accessToken);
if (jytUserId != null) {
AppFavoriteTBRepository repository = BaseHolder.getBean("appFavoriteTBRepository");
@@ -271,7 +281,7 @@ public class DplbotServiceUtil {
POOL.submit(() -> userCollectTheBot(userId, botAccount, accessToken));
}
- static void userCollectTheBot(String userId, String botAccount, String accessToken) {
+ private static void userCollectTheBot(String userId, String botAccount, String accessToken) {
String jytUserId = getUsUserId(userId, accessToken);
if (jytUserId != null) {
AppFavoriteTBRepository repository = BaseHolder.getBean("appFavoriteTBRepository");
@@ -389,6 +399,7 @@ public class DplbotServiceUtil {
historyTB.setBotId(botId);
historyTB.setXiaoduUserId(userId);
} else {
+ if (historyTB.getLastTime().equals(time)) continue;
historyTB.setLastTime(time);
}
repository.saveAndFlush(historyTB);
@@ -397,7 +408,8 @@ public class DplbotServiceUtil {
});
}
- static String dealChargeCallback(ChargeEvent chargeEvent, final String userId, final String accessToken, final String jytUserId) {
+ static boolean dealChargeCallback(ChargeEvent chargeEvent, final String userId, final String accessToken,
+ final String jytUserId) {
Payload payload = chargeEvent.getPayload();
final String chOrderId = chargeEvent.getSellerOrderId();
String token = chargeEvent.getToken();
@@ -436,16 +448,13 @@ public class DplbotServiceUtil {
flowerTB.setStatus(1);
flowerTB.setUnitPrice(Double.parseDouble(Config.getProperty("unitPrice", Constants.UNIT_PRICE))/100);
flowerTB.setUserId(Long.parseLong(appUserId));
- Timestamp timestamp = new Timestamp(System.currentTimeMillis());
- flowerTB.setCreateTime(timestamp);
- flowerTB.setUpdateTime(timestamp);
flower.save(flowerTB);
} catch (Exception e) {
log.error("像app_flower_tb中添加数据失败,{},数据信息:botAccount:{},num:{},xiaoduUserId:{}",
e.toString(),botAccount,num,userId);
}
});
- return "恭喜您支付成功,开始体验吧";
+ return true;
}else {
log.info("支付发生错误,"+payload.getMessage());
POOL.submit(() -> {
@@ -455,14 +464,127 @@ public class DplbotServiceUtil {
pojo.setChOrderId(chOrderId);
repository.delete(pojo);
});
- return "很抱歉,您没有支付成功";
+ return false;
}
}
- static void updateTheUserBehaviorDataMark(final String userId) {
+ static void updateTheUserBehaviorDataMark(final String userId, final String botAccount, final String accessToken) {
POOL.submit(() -> {
UserBehaviorData data = USER_HISTORY.get(userId);
- if (data != null) data.setMark((byte) 1);
+ if (data != null) {
+ data.setMark((byte) 1);
+ data.getUserBotId2History().put(botAccount, curTime);
+ } else {
+ XiaoDuHistoryTBRepository repository = BaseHolder.getBean("xiaoDuHistoryTBRepository");
+ UserBehaviorData behaviorData = USER_HISTORY.computeIfAbsent(userId, s -> new UserBehaviorData());
+ HashMap userBotId2History = behaviorData.getUserBotId2History();
+ for (XiaoDuHistoryTB historyTB: repository.getByXiaoduUserId(userId)) {
+ userBotId2History.put(historyTB.getBotId(), historyTB.getLastTime());
+ }
+ userBotId2History.put(botAccount, curTime);
+ behaviorData.setMark((byte) 1);
+ if (accessToken != null) {
+ log.info("onLunchFillUserBehaviorData:请求getUserIdByToken");
+ String jytUserId = DplbotServiceUtil.getUserIdByToken(accessToken);
+ if (jytUserId != null) {
+ behaviorData.setJytUserId(jytUserId);
+ getUserFavorite(userId, jytUserId);
+ getUserSendFlowerInfo(userId,jytUserId);
+ }
+ }
+ }
});
}
+
+ static CollectHistoryDocument getCollectPage(String userId, String accessToken, String jytId) {
+ Collection favoriteProducts;
+ UserBehaviorData behaviorData = USER_HISTORY.get(userId);
+ if (behaviorData == null) {
+ onLunchFillUserBehaviorData(accessToken, userId);
+ AppFavoriteTBRepository favorite = BaseHolder.getBean("appFavoriteTBRepository");
+ favoriteProducts = favorite.getFavoriteBotIds(Long.parseLong(jytId));
+ }else {
+ favoriteProducts = behaviorData.getUserBotId2Collected().keySet();
+ }
+ if (favoriteProducts.size() == 0) return null;
+ ArrayList projectInfoList = new ArrayList<>();
+ int i = 1;
+ //log.info("id list:{}", favoriteProducts);
+ final StringBuilder build = new StringBuilder();
+ for (String botAccount :favoriteProducts) {
+ build.append(botAccount).append(File.separator);
+ OnProductDetail productDetail = ScheduleService.getProductIdDetail().get(botAccount);
+
+ String intro = productDetail.getIntro();
+ if (StringUtils.isBlank(intro)) intro = "作者太懒没写介绍";
+ 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);
+ data.setAuthorName(productDetail.getAuthorName());
+ projectInfoList.add(data);
+ }
+ CollectHistoryDocument collectHistoryDocument = CollectHistoryUtils.getDocument(projectInfoList, true);
+ String idToken;
+ if (build.length() != 0) {
+ build.deleteCharAt(build.length()-1);
+ idToken = Base64.getEncoder().encodeToString(build.toString().getBytes());
+ collectHistoryDocument.setIdToken(idToken);
+ }
+ return collectHistoryDocument;
+ }
+
+ static CollectHistoryDocument getHistory(String userId, String accessToken) {
+ List historyProducts = new ArrayList<>();
+ UserBehaviorData behaviorData = USER_HISTORY.get(userId);
+ if (behaviorData == null) {
+ onLunchFillUserBehaviorData(accessToken, userId);
+ XiaoDuHistoryBotTimeRepository historyRepository = BaseHolder.getBean("xiaoDuHistoryBotTimeRepository");
+ historyProducts = historyRepository.getByXiaoduUserId(userId);
+ } else {
+ try {
+ for (Map.Entry entry: behaviorData.getUserBotId2History().entrySet()) {
+ XiaoDuHistoryBotIdTime history = new XiaoDuHistoryBotIdTime();
+ history.setBotId(entry.getKey());
+ history.setLastTime(entry.getValue());
+ historyProducts.add(history);
+ }
+ } catch (Exception e){}
+ }
+ if (historyProducts.size() == 0) return null;
+
+ ArrayList projectInfoList = new ArrayList<>();
+ int i = 1;
+ final StringBuilder build = new StringBuilder();
+ SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");
+ for (XiaoDuHistoryBotIdTime historyInfo: historyProducts) {
+ String botAccount = historyInfo.getBotId();
+ build.append(botAccount).append(File.separator);
+ OnProductDetail productDetail = ScheduleService.getProductIdDetail().get(botAccount);
+
+ String intro = productDetail.getIntro();
+ if (StringUtils.isBlank(intro)) intro = "作者太懒没写介绍";
+ 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();
+ HistoryData data = new HistoryData(botAccountId, i++, imgUrl, correctName(name), intro);
+ data.setAuthorName(lastTime);
+ projectInfoList.add(data);
+ }
+ CollectHistoryDocument document = CollectHistoryUtils.getDocument(projectInfoList, false);
+ String idToken;
+ if (build.length() != 0) {
+ build.deleteCharAt(build.length()-1);
+ idToken = Base64.getEncoder().encodeToString(build.toString().getBytes());
+ document.setIdToken(idToken);
+ }
+ return document;
+ }
+
+ 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/service/LoadBySMS.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/LoadBySMS.java
index 2100adb..a4ff962 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/LoadBySMS.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/LoadBySMS.java
@@ -189,10 +189,10 @@ public class LoadBySMS {
HashMap headers = new HashMap<>();
headers.put("App-Channel-Id", "JIAOYOUTIANXIA");
headers.put("Content-Type", "application/json;charset=utf-8");
- headers.put("Authorization", refreshToken);
+ headers.put("Authorization", XIAOWU_API.BEARER+refreshToken);
String smsStr = null;
try {
- smsStr = OkHttp3Utils.doPost(XIAOWU_API.REFRESH_TOKEN, new HashMap<>(), headers);
+ smsStr = OkHttp3Utils.doPostJsonStr(XIAOWU_API.REFRESH_TOKEN, "", headers);
} catch (Exception e) {
log.error("通过RefreshToken请求Token出错:{}",e.toString());
}
@@ -207,4 +207,8 @@ public class LoadBySMS {
// public static ConcurrentHashMap getAccesstokenPhonenum() {
// return ACCESSTOKEN_PHONENUM;
// }
+
+ public static void main(String[] args) {
+ System.out.println(getTokenByRefreshToken("4e929ca8-6db1-4224-be1e-e8f5a4f6bdb5"));
+ }
}
diff --git a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/RequestTerminal.java b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/RequestTerminal.java
index 101668a..c1275e8 100644
--- a/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/RequestTerminal.java
+++ b/xiaoduhome/src/main/java/ai/qiwu/com/xiaoduhome/service/RequestTerminal.java
@@ -48,10 +48,11 @@ class RequestTerminal {
String url = "http://aws-nx2.chewrobot.com:18082/api/works";
HashMap params = new HashMap<>();
params.put("include", "npcHeadImgUrl");
- params.put("aipioneerUsername","8343905461");
-// String str = OkHttp3Utils.doGet(url, params);
-// AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class);
-// System.out.println(response.getData().getNpcHeadImgUrl());
- requestTerminate("有科幻类的吗", "2352521agag");
+ params.put("aipioneerUsername","948644704");
+ String str = OkHttp3Utils.doGet(url, params);
+ AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class);
+ System.out.println(response.getData().getNpcHeadImgUrl());
+
+ //requestTerminate("有科幻类的吗", "2352521agag");
}
}
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 d6807f1..9ffbb1e 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
@@ -188,14 +188,14 @@ public class ScheduleService implements InitializingBean {
List botIds = gameProjectTbRepository.getAllOnTableProductIds();
for (String botId: botIds) {
try {
- botId = HZ1_BOT_TO_NX2.get(botId);
- if (botId == null) {
+ String nxBotId = HZ1_BOT_TO_NX2.get(botId);
+ if (nxBotId == null) {
log.info("找不到对应关系:{}",botId);
continue;
}
HashMap params = new HashMap<>();
params.put("include", "npcHeadImgUrl");
- params.put("aipioneerUsername",botId);
+ params.put("aipioneerUsername",nxBotId);
String str = OkHttp3Utils.doGet(ASIDE_IMG_URL, params);
AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class);
ASIDE_IMG.put(botId, response.getData().getNpcHeadImgUrl());
@@ -223,45 +223,46 @@ public class ScheduleService implements InitializingBean {
private void keng() {
NX2_BOT_TO_HZ1.put("6854303973", "612535455");
- NX2_BOT_TO_HZ1.put("1814141710", "9828137390");
+ NX2_BOT_TO_HZ1.put("6350303840", "9828137390");
NX2_BOT_TO_HZ1.put("5741775745", "1586892647");
- NX2_BOT_TO_HZ1.put("9159908109", "3899761881");
- NX2_BOT_TO_HZ1.put("6035298742", "6559053319");
+ NX2_BOT_TO_HZ1.put("1483080963", "3899761881");
+ NX2_BOT_TO_HZ1.put("844142256", "6559053319");
- NX2_BOT_TO_HZ1.put("4366487183", "6402164753");
- NX2_BOT_TO_HZ1.put("236055939", "6569120969");
- NX2_BOT_TO_HZ1.put("9965361790", "9727432426");
- NX2_BOT_TO_HZ1.put("2428131253", "9369493482");
+ NX2_BOT_TO_HZ1.put("5059399282", "6402164753");
+ NX2_BOT_TO_HZ1.put("2866985233", "6569120969");
+ NX2_BOT_TO_HZ1.put("1619186778", "9727432426");
+ NX2_BOT_TO_HZ1.put("82899304", "9369493482");
NX2_BOT_TO_HZ1.put("8343905461", "7667391968");
- NX2_BOT_TO_HZ1.put("2675579304", "2167984446");
- NX2_BOT_TO_HZ1.put("6259213309", "438155367");
- NX2_BOT_TO_HZ1.put("4707303948", "2139635657");
+ NX2_BOT_TO_HZ1.put("9395788731", "2167984446");
+ NX2_BOT_TO_HZ1.put("8512764381", "438155367");
+ NX2_BOT_TO_HZ1.put("573677395", "2139635657");
NX2_BOT_TO_HZ1.put("2090828382", "4731779365");
- NX2_BOT_TO_HZ1.put("8907881060", "4577201364");
+ NX2_BOT_TO_HZ1.put("948644704", "4577201364");
- NX2_BOT_TO_HZ1.put("7051119238", "7907720862");
+ NX2_BOT_TO_HZ1.put("816254767", "7907720862");
NX2_BOT_TO_HZ1.put("7414315062", "1029558688");
}
private void fan_keng() {
+ HZ1_BOT_TO_NX2.put("2345541644", "3377841230");
HZ1_BOT_TO_NX2.put("612535455", "6854303973");
- HZ1_BOT_TO_NX2.put("9828137390", "1814141710");
+ HZ1_BOT_TO_NX2.put("9828137390", "6350303840");
HZ1_BOT_TO_NX2.put("1586892647", "5741775745");
- HZ1_BOT_TO_NX2.put("3899761881", "9159908109");
- HZ1_BOT_TO_NX2.put("6559053319", "6035298742");
- HZ1_BOT_TO_NX2.put("6402164753", "4366487183");
- HZ1_BOT_TO_NX2.put("6569120969", "236055939");
- HZ1_BOT_TO_NX2.put("9727432426", "9965361790");
- HZ1_BOT_TO_NX2.put("9369493482", "2428131253");
+ HZ1_BOT_TO_NX2.put("3899761881", "1483080963");
+ HZ1_BOT_TO_NX2.put("6559053319", "844142256");
+ HZ1_BOT_TO_NX2.put("6402164753", "5059399282");
+ HZ1_BOT_TO_NX2.put("6569120969", "2866985233");
+ HZ1_BOT_TO_NX2.put("9727432426", "1619186778");
+ HZ1_BOT_TO_NX2.put("9369493482", "82899304");
HZ1_BOT_TO_NX2.put("7667391968", "8343905461");
- HZ1_BOT_TO_NX2.put("2167984446", "2675579304");
- HZ1_BOT_TO_NX2.put("438155367", "6259213309");
+ HZ1_BOT_TO_NX2.put("2167984446", "9395788731");
+ HZ1_BOT_TO_NX2.put("438155367", "8512764381");
- HZ1_BOT_TO_NX2.put("2139635657", "4707303948");
+ HZ1_BOT_TO_NX2.put("2139635657", "573677395");
HZ1_BOT_TO_NX2.put("4731779365", "2090828382");
- HZ1_BOT_TO_NX2.put("4577201364", "8907881060");
- HZ1_BOT_TO_NX2.put("7907720862", "7051119238");
+ HZ1_BOT_TO_NX2.put("4577201364", "948644704");
+ HZ1_BOT_TO_NX2.put("7907720862", "816254767");
HZ1_BOT_TO_NX2.put("1029558688", "7414315062");
}
diff --git a/xiaoduhome/src/main/resources/application.yml b/xiaoduhome/src/main/resources/application.yml
index 6cad026..80643b6 100644
--- a/xiaoduhome/src/main/resources/application.yml
+++ b/xiaoduhome/src/main/resources/application.yml
@@ -5,14 +5,14 @@ spring:
datasource:
primary:
#jdbc-url: jdbc:mysql://aws-nx2.chewrobot.com:3306/game_editor_db?useUnicode=true&characterEncoding=utf-8
- jdbc-url: jdbc:mysql://localhost:3306/game_editor_db?useUnicode=true&characterEncoding=utf-8
+ jdbc-url: jdbc:mysql://localhost:3306/game_editor_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Hongkong&useSSL=false
username: root
#password: YAdqFKlzYho
password: 3g9^pWQs#ft7
driver-class-name: com.mysql.jdbc.Driver
secondary:
#jdbc-url: jdbc:mysql://aliyun-hz1.chewrobot.com:3306/interface_db?useUnicode=true&characterEncoding=utf-8
- jdbc-url: jdbc:mysql://localhost:3306/interface_db?useUnicode=true&characterEncoding=utf-8
+ jdbc-url: jdbc:mysql://localhost:3306/interface_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Hongkong&useSSL=false
username: root
password: 3g9^pWQs#ft7
driver-class-name: com.mysql.jdbc.Driver
diff --git a/xiaoduhome/src/main/resources/static/json/collectPage.json b/xiaoduhome/src/main/resources/static/json/collectPage.json
index 545e726..36d8359 100644
--- a/xiaoduhome/src/main/resources/static/json/collectPage.json
+++ b/xiaoduhome/src/main/resources/static/json/collectPage.json
@@ -17,14 +17,13 @@
},
{
"type": "Header",
- "headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
- "headerTitle": "收藏"
+ "headerTitle": "收藏",
+ "hasBackIcon": false
},
{
"type": "Container",
- "margin": "10dp",
- "height": "100%",
"width": "100%",
+ "padding-bottom": "120dp",
"items": [
{
"type": "List",
@@ -36,6 +35,7 @@
"type": "Container",
"height": "100dp",
"width": "100%",
+ "margin-bottom": "20dp",
"flex-direction": "row",
"componentId": "${data.botAccountId}",
"onclick": [
@@ -54,10 +54,10 @@
},
{
"type": "Image",
- "width": "75dp",
- "height": "75dp",
+ "width": "80dp",
+ "height": "80dp",
"border-radius": "10dp",
- "margin-left": "1dp",
+ "margin-left": "20dp",
"src": "${data.bannerImgUrl}"
},
{
@@ -84,15 +84,39 @@
},
{
"type": "Text",
- "margin-left": "50dp",
- "font-size": "30dp",
+ "margin-left": "200dp",
+ "margin-top": "20dp",
+ "font-size": "25dp",
"text": "${data.authorName}"
+ },
+ {
+ "type":"Frame",
+ "position":"absolute",
+ "margin-top":"90dp",
+ "width":"100%",
+ "border-color":"rgba(255,255,255,0.5)",
+ "border-width":"1dp"
}
]
}
]
}
]
+ },
+ {
+ "type": "Container",
+ "position": "absolute",
+ "width": "100%",
+ "left": "0",
+ "bottom": "0",
+ "items": [
+ {
+ "type": "Footer",
+ "hints": [
+ "打开第一个","下一页","上一页","返回"
+ ]
+ }
+ ]
}
]
}
--
libgit2 0.27.1