Commit 235064dd by 苗权威

9.25

parent 6f871228
...@@ -82,6 +82,26 @@ public class OkHttp3Utils { ...@@ -82,6 +82,26 @@ public class OkHttp3Utils {
return null; return null;
} }
public static String doPostJsonStr(String url, String requestJsonStr, HashMap<String, String> headers) throws IOException {
Request.Builder builder = new Request.Builder();
Request request = builder.url(url).build();
Headers.Builder headBuilder = request.headers().newBuilder();
Iterator<Map.Entry<String, String>> 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) { public static void backPostAsync(String url, String requestJsonStr) {
Request.Builder builder = new Request.Builder(); Request.Builder builder = new Request.Builder();
// builder.url(url); // builder.url(url);
...@@ -130,6 +150,8 @@ public class OkHttp3Utils { ...@@ -130,6 +150,8 @@ public class OkHttp3Utils {
} }
} }
public static String doPost(String url, Map<String, String> headers, Map<String, String> params, public static String doPost(String url, Map<String, String> headers, Map<String, String> params,
String fileName, byte[] fileByte) throws IOException { String fileName, byte[] fileByte) throws IOException {
Request.Builder builder = new Request.Builder(); Request.Builder builder = new Request.Builder();
......
...@@ -25,15 +25,22 @@ public class CollectHistoryPagePojo { ...@@ -25,15 +25,22 @@ public class CollectHistoryPagePojo {
private String position; private String position;
private String left; private String left;
private String width; private String width;
private String bottom;
private String height; private String height;
private String src; private String src;
private String top; private String top;
private String headerImage; private Boolean hasBackIcon;
private String margin;
private String componentId;
private String headerTitle; private String headerTitle;
@JsonProperty("margin-left") @JsonProperty("margin-left")
private String marginLeft; private String marginLeft;
@JsonProperty("margin-right")
private String marginRight;
@JsonProperty("margin-top") @JsonProperty("margin-top")
private String marginTop; private String marginTop;
@JsonProperty("margin-bottom")
private String marginBottom;
private String padding; private String padding;
private List<CollectHistoryPagePojo> items; private List<CollectHistoryPagePojo> items;
private String direction; private String direction;
...@@ -50,4 +57,17 @@ public class CollectHistoryPagePojo { ...@@ -50,4 +57,17 @@ public class CollectHistoryPagePojo {
@JsonProperty("max-lines") @JsonProperty("max-lines")
private Integer maxLines; private Integer maxLines;
private List<Event> onClick; private List<Event> onClick;
@JsonProperty("border-color")
private String borderColor;
@JsonProperty("border-width")
private String borderWidth;
private List<String> 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;
} }
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<HistoryData> 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;
}
}
...@@ -22,6 +22,7 @@ import ai.qiwu.com.xiaoduhome.pojo.dpl.MyDocument; ...@@ -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.pojo.pageData.HistoryData;
import ai.qiwu.com.xiaoduhome.repository.primary.AppFavoriteTBRepository; import ai.qiwu.com.xiaoduhome.repository.primary.AppFavoriteTBRepository;
import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuHistoryBotTimeRepository; import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuHistoryBotTimeRepository;
import ai.qiwu.com.xiaoduhome.service.DplbotServiceUtil;
import ai.qiwu.com.xiaoduhome.service.ScheduleService; import ai.qiwu.com.xiaoduhome.service.ScheduleService;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -148,10 +149,6 @@ public class TempleUtils { ...@@ -148,10 +149,6 @@ public class TempleUtils {
// return document; // return document;
// } // }
public static RankingDocument getRanking() {
return RankUtil.getRankDocument();
}
public static RecommandDocument getRecommend(int num) { public static RecommandDocument getRecommend(int num) {
RecommandDocument document = JSON.parseObject(getDPLTemple("static/json/recommand2.json"), RecommandDocument.class); RecommandDocument document = JSON.parseObject(getDPLTemple("static/json/recommand2.json"), RecommandDocument.class);
List<RecommandBotInfo> firstRowData = new ArrayList<>(); List<RecommandBotInfo> firstRowData = new ArrayList<>();
...@@ -241,39 +238,6 @@ public class TempleUtils { ...@@ -241,39 +238,6 @@ public class TempleUtils {
return historyDocument; 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<String> favoriteProducts = favorite.getFavoriteBotIds(userId);
if (favoriteProducts == null || favoriteProducts.size() == 0) return null;
ArrayList<HistoryData> 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() { private static MyDocument buildCollectTemple() {
return JSON.parseObject(getDPLTemple("static/json/collect.json"), MyDocument.class); return JSON.parseObject(getDPLTemple("static/json/collect.json"), MyDocument.class);
} }
......
...@@ -25,10 +25,15 @@ public class LunchPojo { ...@@ -25,10 +25,15 @@ public class LunchPojo {
private String width; private String width;
private String left; private String left;
private String top; private String top;
private String right;
private String src; private String src;
private List<LunchPojo> items; private List<LunchPojo> items;
@JsonProperty("padding-right") @JsonProperty("padding-right")
private String paddingRight; private String paddingRight;
@JsonProperty("padding-top")
private String paddingTop;
@JsonProperty("padding-bottom")
private String paddingBottom;
private String componentId; private String componentId;
private String headerTitle; private String headerTitle;
private Boolean hasBackIcon; private Boolean hasBackIcon;
......
...@@ -19,6 +19,9 @@ public class LunchUtils { ...@@ -19,6 +19,9 @@ public class LunchUtils {
private static final LunchPojo LUNCH_LIST_CATEGORY_CON = buildCategoryList(); private static final LunchPojo LUNCH_LIST_CATEGORY_CON = buildCategoryList();
private static final LunchPojo LUNCH_HEAD = buildLunchHead(); private static final LunchPojo LUNCH_HEAD = buildLunchHead();
private static final LunchPojo LUNCH_BACK_IMG = buildLunchBackgroundImg(); 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(); private volatile static LunchDocument lunchDocument = buildLunchDocument();
public static LunchDocument buildLunchDocument() { public static LunchDocument buildLunchDocument() {
...@@ -29,6 +32,7 @@ public class LunchUtils { ...@@ -29,6 +32,7 @@ public class LunchUtils {
LunchPojo conRecommend = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRecommendList(),1)); LunchPojo conRecommend = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRecommendList(),1));
conRecommend.setFirstItem(Collections.singletonList(TempleUtils.getFrameRecommand())); conRecommend.setFirstItem(Collections.singletonList(TempleUtils.getFrameRecommand()));
conRecommend.setMarginTop("30dp");
LunchPojo conRanking = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRankingList(), 11)); LunchPojo conRanking = buildLunchList(TempleUtils.buildDataList(ScheduleService.getRankingList(), 11));
conRanking.setFirstItem(Collections.singletonList(TempleUtils.getFrameRakking())); conRanking.setFirstItem(Collections.singletonList(TempleUtils.getFrameRakking()));
...@@ -39,7 +43,7 @@ public class LunchUtils { ...@@ -39,7 +43,7 @@ public class LunchUtils {
LunchPojo scroll = buildLunchScroll(); LunchPojo scroll = buildLunchScroll();
scroll.setItems(Arrays.asList(conRecommend,conRanking,conCategory)); 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; return document;
} }
...@@ -48,7 +52,7 @@ public class LunchUtils { ...@@ -48,7 +52,7 @@ public class LunchUtils {
scroll.setType("ScrollView"); scroll.setType("ScrollView");
scroll.setDirection("vertical"); scroll.setDirection("vertical");
scroll.setWidth("100%"); scroll.setWidth("100%");
scroll.setMarginBottom("80dp"); scroll.setMarginBottom("10dp");
return scroll; return scroll;
} }
...@@ -79,7 +83,7 @@ public class LunchUtils { ...@@ -79,7 +83,7 @@ public class LunchUtils {
list.setType("List"); list.setType("List");
list.setMarginLeft("30dp"); list.setMarginLeft("30dp");
// list.setMarginRight("15dp"); // list.setMarginRight("15dp");
list.setMarginBottom("70dp"); list.setMarginBottom("65dp");
list.setDirection("horizontal"); list.setDirection("horizontal");
list.setData(data); list.setData(data);
list.setItems(Collections.singletonList(LUNCH_LIST_CON)); list.setItems(Collections.singletonList(LUNCH_LIST_CON));
...@@ -98,7 +102,7 @@ public class LunchUtils { ...@@ -98,7 +102,7 @@ public class LunchUtils {
private static LunchPojo buildImgFrmTxtContainer() { private static LunchPojo buildImgFrmTxtContainer() {
LunchPojo container = new LunchPojo(); LunchPojo container = new LunchPojo();
container.setType("Container"); container.setType("Container");
container.setMarginTop("30dp"); container.setMarginTop("15dp");
container.setWidth("200dp"); container.setWidth("200dp");
container.setMarginRight("33dp"); container.setMarginRight("33dp");
...@@ -161,6 +165,7 @@ public class LunchUtils { ...@@ -161,6 +165,7 @@ public class LunchUtils {
backGroundImg.setLeft("0dp"); backGroundImg.setLeft("0dp");
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg"); backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setScaleType("fitXY");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
return backGroundImg; return backGroundImg;
...@@ -169,12 +174,59 @@ public class LunchUtils { ...@@ -169,12 +174,59 @@ public class LunchUtils {
private static LunchPojo buildLunchHead() { private static LunchPojo buildLunchHead() {
LunchPojo head = new LunchPojo(); LunchPojo head = new LunchPojo();
head.setType("Header"); head.setType("Header");
head.setHeaderTitle("交游天下"); //head.setHeaderTitle("交游天下");
head.setHasBackIcon(false); head.setHasBackIcon(false);
return head; 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() { public static LunchDocument getLunchDocument() {
return lunchDocument; return lunchDocument;
} }
......
...@@ -185,6 +185,7 @@ public class PlayUtils { ...@@ -185,6 +185,7 @@ public class PlayUtils {
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg"); backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
backGroundImg.setScaleType("fitXY");
return backGroundImg; return backGroundImg;
} }
......
...@@ -199,6 +199,7 @@ public class ProductInfoUtils { ...@@ -199,6 +199,7 @@ public class ProductInfoUtils {
ProductInfoPojo flower = new ProductInfoPojo(); ProductInfoPojo flower = new ProductInfoPojo();
flower.setType("Text"); flower.setType("Text");
flower.setComponentId("pft");
flower.setText(flowerText); flower.setText(flowerText);
flower.setMarginTop("10dp"); flower.setMarginTop("10dp");
flower.setFontSize("20dp"); flower.setFontSize("20dp");
...@@ -260,6 +261,7 @@ public class ProductInfoUtils { ...@@ -260,6 +261,7 @@ public class ProductInfoUtils {
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg"); backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
backGroundImg.setScaleType("fitXY");
return backGroundImg; return backGroundImg;
} }
......
...@@ -160,6 +160,7 @@ public class RankUtil { ...@@ -160,6 +160,7 @@ public class RankUtil {
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg"); backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
backGroundImg.setScaleType("fitXY");
return backGroundImg; return backGroundImg;
} }
......
...@@ -95,7 +95,7 @@ public class RecommendUtil { ...@@ -95,7 +95,7 @@ public class RecommendUtil {
count++; count++;
begin = end; 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); botIds.deleteCharAt(botIds.length()-1);
String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes()); String idToken = Base64.getEncoder().encodeToString(botIds.toString().getBytes());
...@@ -211,6 +211,7 @@ public class RecommendUtil { ...@@ -211,6 +211,7 @@ public class RecommendUtil {
backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg"); backGroundImg.setSrc("https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg");
backGroundImg.setHeight("100%"); backGroundImg.setHeight("100%");
backGroundImg.setWidth("100%"); backGroundImg.setWidth("100%");
backGroundImg.setScaleType("fitXY");
return backGroundImg; return backGroundImg;
} }
...@@ -223,4 +224,13 @@ public class RecommendUtil { ...@@ -223,4 +224,13 @@ public class RecommendUtil {
return head; return head;
} }
private static RecommandPojo buildRecommendCollectHead(String category) {
RecommandPojo head = new RecommandPojo();
head.setType("Header");
head.setHeaderTitle(category);
head.setHasBackIcon(false);
return head;
}
} }
...@@ -159,6 +159,7 @@ public class Oauth2Controller { ...@@ -159,6 +159,7 @@ public class Oauth2Controller {
return null; return null;
} }
if (code == null && refresh_token != null) { if (code == null && refresh_token != null) {
refresh_token = refresh_token.substring(refresh_token.lastIndexOf(",")+1);
TokenResponse tokenResponse = LoadBySMS.getTokenByRefreshToken(refresh_token); TokenResponse tokenResponse = LoadBySMS.getTokenByRefreshToken(refresh_token);
if (tokenResponse == null) return null; if (tokenResponse == null) return null;
TokenDuerosResponse response = new TokenDuerosResponse(); TokenDuerosResponse response = new TokenDuerosResponse();
......
...@@ -29,7 +29,7 @@ public class XiaoDuHomeController { ...@@ -29,7 +29,7 @@ public class XiaoDuHomeController {
//service.disableVerify(); //service.disableVerify();
service.enableVerify(); service.enableVerify();
String str = service.run(); String str = service.run();
//log.info("响应信息:{}", str); log.info("响应信息:{}", str);
return str; return str;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -9,8 +9,7 @@ import org.springframework.data.annotation.LastModifiedDate; ...@@ -9,8 +9,7 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.sql.Date; import java.util.Date;
import java.sql.Timestamp;
/** /**
* @author 苗权威 * @author 苗权威
...@@ -37,9 +36,9 @@ public class AppFavoriteTB { ...@@ -37,9 +36,9 @@ public class AppFavoriteTB {
@CreatedDate @CreatedDate
@Column(name = "gmt_create", updatable = false, nullable = false) @Column(name = "gmt_create", updatable = false, nullable = false)
private Timestamp createTime; private Date createTime;
@LastModifiedDate @LastModifiedDate
@Column(name = "gmt_modified", nullable = false) @Column(name = "gmt_modified", nullable = false)
private Timestamp updateTime; private Date updateTime;
} }
...@@ -48,9 +48,9 @@ public class AppFlowerTB { ...@@ -48,9 +48,9 @@ public class AppFlowerTB {
@CreatedDate @CreatedDate
@Column(name = "gmt_create", updatable = false, nullable = false) @Column(name = "gmt_create", updatable = false, nullable = false)
private Timestamp createTime; private Date createTime;
@LastModifiedDate @LastModifiedDate
@Column(name = "gmt_modified", nullable = false) @Column(name = "gmt_modified", nullable = false)
private Timestamp updateTime; private Date updateTime;
} }
...@@ -9,8 +9,7 @@ import org.springframework.data.annotation.LastModifiedDate; ...@@ -9,8 +9,7 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.sql.Date; import java.util.Date;
import java.sql.Timestamp;
/** /**
* @author 苗权威 * @author 苗权威
...@@ -37,9 +36,9 @@ public class XiaoDuHistoryTB { ...@@ -37,9 +36,9 @@ public class XiaoDuHistoryTB {
@CreatedDate @CreatedDate
@Column(name = "create_time", updatable = false, nullable = false) @Column(name = "create_time", updatable = false, nullable = false)
private Timestamp createTime; private Date createTime;
@LastModifiedDate @LastModifiedDate
@Column(name = "update_time") @Column(name = "update_time")
private Timestamp updateTime; private Date updateTime;
} }
package ai.qiwu.com.xiaoduhome.entity.secondary; package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
/** /**
...@@ -62,9 +58,9 @@ public class XiaoDuOrderTB { ...@@ -62,9 +58,9 @@ public class XiaoDuOrderTB {
@CreatedDate @CreatedDate
@Column(name = "create_time", updatable = false, nullable = false) @Column(name = "create_time", updatable = false, nullable = false)
private Timestamp createTime; private Date createTime;
@LastModifiedDate @LastModifiedDate
@Column(name = "update_time", nullable = false) @Column(name = "update_time", nullable = false)
private Timestamp updateTime; private Date updateTime;
} }
package ai.qiwu.com.xiaoduhome.pojo.pageData; package ai.qiwu.com.xiaoduhome.pojo.pageData;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/** /**
* @author 苗权威 * @author 苗权威
* @dateTime 19-8-27 下午6:02 * @dateTime 19-8-27 下午6:02
*/ */
@Data @Getter
@Setter
@AllArgsConstructor
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class HistoryData { public class HistoryData {
private String botAccountId; private String botAccountId;
......
...@@ -33,4 +33,6 @@ public interface XiaoDuHistoryTBRepository extends JpaRepository<XiaoDuHistoryTB ...@@ -33,4 +33,6 @@ public interface XiaoDuHistoryTBRepository extends JpaRepository<XiaoDuHistoryTB
@Query(value = "select bot_id from xiaodu_history_tb where xiaodu_user_id=?1",nativeQuery = true) @Query(value = "select bot_id from xiaodu_history_tb where xiaodu_user_id=?1",nativeQuery = true)
List<String> getUserHostory(String userId); List<String> getUserHostory(String userId);
List<XiaoDuHistoryTB> getByXiaoduUserId(String userId);
} }
...@@ -189,10 +189,10 @@ public class LoadBySMS { ...@@ -189,10 +189,10 @@ public class LoadBySMS {
HashMap<String, String> headers = new HashMap<>(); HashMap<String, String> headers = new HashMap<>();
headers.put("App-Channel-Id", "JIAOYOUTIANXIA"); headers.put("App-Channel-Id", "JIAOYOUTIANXIA");
headers.put("Content-Type", "application/json;charset=utf-8"); headers.put("Content-Type", "application/json;charset=utf-8");
headers.put("Authorization", refreshToken); headers.put("Authorization", XIAOWU_API.BEARER+refreshToken);
String smsStr = null; String smsStr = null;
try { try {
smsStr = OkHttp3Utils.doPost(XIAOWU_API.REFRESH_TOKEN, new HashMap<>(), headers); smsStr = OkHttp3Utils.doPostJsonStr(XIAOWU_API.REFRESH_TOKEN, "", headers);
} catch (Exception e) { } catch (Exception e) {
log.error("通过RefreshToken请求Token出错:{}",e.toString()); log.error("通过RefreshToken请求Token出错:{}",e.toString());
} }
...@@ -207,4 +207,8 @@ public class LoadBySMS { ...@@ -207,4 +207,8 @@ public class LoadBySMS {
// public static ConcurrentHashMap<String, String> getAccesstokenPhonenum() { // public static ConcurrentHashMap<String, String> getAccesstokenPhonenum() {
// return ACCESSTOKEN_PHONENUM; // return ACCESSTOKEN_PHONENUM;
// } // }
public static void main(String[] args) {
System.out.println(getTokenByRefreshToken("4e929ca8-6db1-4224-be1e-e8f5a4f6bdb5"));
}
} }
...@@ -48,10 +48,11 @@ class RequestTerminal { ...@@ -48,10 +48,11 @@ class RequestTerminal {
String url = "http://aws-nx2.chewrobot.com:18082/api/works"; String url = "http://aws-nx2.chewrobot.com:18082/api/works";
HashMap<String, String> params = new HashMap<>(); HashMap<String, String> params = new HashMap<>();
params.put("include", "npcHeadImgUrl"); params.put("include", "npcHeadImgUrl");
params.put("aipioneerUsername","8343905461"); params.put("aipioneerUsername","948644704");
// String str = OkHttp3Utils.doGet(url, params); String str = OkHttp3Utils.doGet(url, params);
// AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class); AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class);
// System.out.println(response.getData().getNpcHeadImgUrl()); System.out.println(response.getData().getNpcHeadImgUrl());
requestTerminate("有科幻类的吗", "2352521agag");
//requestTerminate("有科幻类的吗", "2352521agag");
} }
} }
...@@ -188,14 +188,14 @@ public class ScheduleService implements InitializingBean { ...@@ -188,14 +188,14 @@ public class ScheduleService implements InitializingBean {
List<String> botIds = gameProjectTbRepository.getAllOnTableProductIds(); List<String> botIds = gameProjectTbRepository.getAllOnTableProductIds();
for (String botId: botIds) { for (String botId: botIds) {
try { try {
botId = HZ1_BOT_TO_NX2.get(botId); String nxBotId = HZ1_BOT_TO_NX2.get(botId);
if (botId == null) { if (nxBotId == null) {
log.info("找不到对应关系:{}",botId); log.info("找不到对应关系:{}",botId);
continue; continue;
} }
HashMap<String, String> params = new HashMap<>(); HashMap<String, String> params = new HashMap<>();
params.put("include", "npcHeadImgUrl"); params.put("include", "npcHeadImgUrl");
params.put("aipioneerUsername",botId); params.put("aipioneerUsername",nxBotId);
String str = OkHttp3Utils.doGet(ASIDE_IMG_URL, params); String str = OkHttp3Utils.doGet(ASIDE_IMG_URL, params);
AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class); AsideImageResponse response = JSON.parseObject(str, AsideImageResponse.class);
ASIDE_IMG.put(botId, response.getData().getNpcHeadImgUrl()); ASIDE_IMG.put(botId, response.getData().getNpcHeadImgUrl());
...@@ -223,45 +223,46 @@ public class ScheduleService implements InitializingBean { ...@@ -223,45 +223,46 @@ public class ScheduleService implements InitializingBean {
private void keng() { private void keng() {
NX2_BOT_TO_HZ1.put("6854303973", "612535455"); 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("5741775745", "1586892647");
NX2_BOT_TO_HZ1.put("9159908109", "3899761881"); NX2_BOT_TO_HZ1.put("1483080963", "3899761881");
NX2_BOT_TO_HZ1.put("6035298742", "6559053319"); NX2_BOT_TO_HZ1.put("844142256", "6559053319");
NX2_BOT_TO_HZ1.put("4366487183", "6402164753"); NX2_BOT_TO_HZ1.put("5059399282", "6402164753");
NX2_BOT_TO_HZ1.put("236055939", "6569120969"); NX2_BOT_TO_HZ1.put("2866985233", "6569120969");
NX2_BOT_TO_HZ1.put("9965361790", "9727432426"); NX2_BOT_TO_HZ1.put("1619186778", "9727432426");
NX2_BOT_TO_HZ1.put("2428131253", "9369493482"); NX2_BOT_TO_HZ1.put("82899304", "9369493482");
NX2_BOT_TO_HZ1.put("8343905461", "7667391968"); NX2_BOT_TO_HZ1.put("8343905461", "7667391968");
NX2_BOT_TO_HZ1.put("2675579304", "2167984446"); NX2_BOT_TO_HZ1.put("9395788731", "2167984446");
NX2_BOT_TO_HZ1.put("6259213309", "438155367"); NX2_BOT_TO_HZ1.put("8512764381", "438155367");
NX2_BOT_TO_HZ1.put("4707303948", "2139635657"); NX2_BOT_TO_HZ1.put("573677395", "2139635657");
NX2_BOT_TO_HZ1.put("2090828382", "4731779365"); 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"); NX2_BOT_TO_HZ1.put("7414315062", "1029558688");
} }
private void fan_keng() { private void fan_keng() {
HZ1_BOT_TO_NX2.put("2345541644", "3377841230");
HZ1_BOT_TO_NX2.put("612535455", "6854303973"); 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("1586892647", "5741775745");
HZ1_BOT_TO_NX2.put("3899761881", "9159908109"); HZ1_BOT_TO_NX2.put("3899761881", "1483080963");
HZ1_BOT_TO_NX2.put("6559053319", "6035298742"); HZ1_BOT_TO_NX2.put("6559053319", "844142256");
HZ1_BOT_TO_NX2.put("6402164753", "4366487183"); HZ1_BOT_TO_NX2.put("6402164753", "5059399282");
HZ1_BOT_TO_NX2.put("6569120969", "236055939"); HZ1_BOT_TO_NX2.put("6569120969", "2866985233");
HZ1_BOT_TO_NX2.put("9727432426", "9965361790"); HZ1_BOT_TO_NX2.put("9727432426", "1619186778");
HZ1_BOT_TO_NX2.put("9369493482", "2428131253"); HZ1_BOT_TO_NX2.put("9369493482", "82899304");
HZ1_BOT_TO_NX2.put("7667391968", "8343905461"); HZ1_BOT_TO_NX2.put("7667391968", "8343905461");
HZ1_BOT_TO_NX2.put("2167984446", "2675579304"); HZ1_BOT_TO_NX2.put("2167984446", "9395788731");
HZ1_BOT_TO_NX2.put("438155367", "6259213309"); 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("4731779365", "2090828382");
HZ1_BOT_TO_NX2.put("4577201364", "8907881060"); HZ1_BOT_TO_NX2.put("4577201364", "948644704");
HZ1_BOT_TO_NX2.put("7907720862", "7051119238"); HZ1_BOT_TO_NX2.put("7907720862", "816254767");
HZ1_BOT_TO_NX2.put("1029558688", "7414315062"); HZ1_BOT_TO_NX2.put("1029558688", "7414315062");
} }
......
...@@ -5,14 +5,14 @@ spring: ...@@ -5,14 +5,14 @@ spring:
datasource: datasource:
primary: primary:
#jdbc-url: jdbc:mysql://aws-nx2.chewrobot.com:3306/game_editor_db?useUnicode=true&characterEncoding=utf-8 #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 username: root
#password: YAdqFKlzYho #password: YAdqFKlzYho
password: 3g9^pWQs#ft7 password: 3g9^pWQs#ft7
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
secondary: secondary:
#jdbc-url: jdbc:mysql://aliyun-hz1.chewrobot.com:3306/interface_db?useUnicode=true&characterEncoding=utf-8 #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 username: root
password: 3g9^pWQs#ft7 password: 3g9^pWQs#ft7
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
......
...@@ -17,14 +17,13 @@ ...@@ -17,14 +17,13 @@
}, },
{ {
"type": "Header", "type": "Header",
"headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png", "headerTitle": "收藏",
"headerTitle": "收藏" "hasBackIcon": false
}, },
{ {
"type": "Container", "type": "Container",
"margin": "10dp",
"height": "100%",
"width": "100%", "width": "100%",
"padding-bottom": "120dp",
"items": [ "items": [
{ {
"type": "List", "type": "List",
...@@ -36,6 +35,7 @@ ...@@ -36,6 +35,7 @@
"type": "Container", "type": "Container",
"height": "100dp", "height": "100dp",
"width": "100%", "width": "100%",
"margin-bottom": "20dp",
"flex-direction": "row", "flex-direction": "row",
"componentId": "${data.botAccountId}", "componentId": "${data.botAccountId}",
"onclick": [ "onclick": [
...@@ -54,10 +54,10 @@ ...@@ -54,10 +54,10 @@
}, },
{ {
"type": "Image", "type": "Image",
"width": "75dp", "width": "80dp",
"height": "75dp", "height": "80dp",
"border-radius": "10dp", "border-radius": "10dp",
"margin-left": "1dp", "margin-left": "20dp",
"src": "${data.bannerImgUrl}" "src": "${data.bannerImgUrl}"
}, },
{ {
...@@ -84,13 +84,37 @@ ...@@ -84,13 +84,37 @@
}, },
{ {
"type": "Text", "type": "Text",
"margin-left": "50dp", "margin-left": "200dp",
"font-size": "30dp", "margin-top": "20dp",
"font-size": "25dp",
"text": "${data.authorName}" "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": [
"打开第一个","下一页","上一页","返回"
]
} }
] ]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment