Commit a1aa3fa5 by 苗权威

8.29

parent fda1e77c
......@@ -56,6 +56,7 @@ public class CallPython {
StringBuilder builder = new StringBuilder();
Process process = null;
try {
//long startTime = System.currentTimeMillis();
process = processBuilder.start();
process.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
......@@ -72,8 +73,11 @@ public class CallPython {
while ((line = reader.readLine()) != null) {
builder.append(line);
}
log.info("sox返回信息:{}", builder.toString());
if (builder.length() != 0){
log.info("sox返回信息:{}", builder.toString());
}
}
//log.info(Thread.currentThread().getName()+"耗时:"+(System.currentTimeMillis()-startTime));
} catch (IOException e) {
log.info("Error while running Sox. {}",e.getMessage());
return "0";
......@@ -91,6 +95,7 @@ public class CallPython {
InputStream inputStream = null;
InputStream errorStream = null;
try {
long startTime = System.currentTimeMillis();
Process process = Runtime.getRuntime().exec(arg);
inputStream = process.getInputStream();
......@@ -137,6 +142,7 @@ public class CallPython {
// }
// }).start();
process.waitFor();
log.info(Thread.currentThread().getName()+"耗时:"+(System.currentTimeMillis()-startTime));
process.destroy();
} catch (Exception e) {
log.error("调用sox出错:{}",e.toString());
......@@ -187,7 +193,9 @@ public class CallPython {
log.error("读取Process error流出错:{}",e.toString());
}
}).start();
long startTime = System.currentTimeMillis();
process.waitFor();
log.info(Thread.currentThread().getName()+"耗时:"+(System.currentTimeMillis()-startTime));
process.destroy();
} catch (Exception e) {
try {
......@@ -200,9 +208,9 @@ public class CallPython {
log.error("关闭Process的流出错:{}",e1.toString());
}
}
if (successResult.length() != 0) return successResult.toString();
if (successResult.length() == 0) return successResult.toString();
else {
log.error("打印Process的错误流信息:{}", failResult.toString());
log.error("打印Process的错误流信息:fsfs-{}-sfs, successResult:sfd-{}-sgs", failResult.toString(), successResult.toString());
return null;
}
}
......@@ -259,4 +267,15 @@ public class CallPython {
}
}
public static void main(String[] args) {
int i = 7;
// while (i-- >= 0) {
// new Thread(() -> processUtilInJava("sleep 3")).start();
// }
// i = 7;
while (i-- >= 0) {
new Thread(() -> execute("sleep 3")).start();
}
}
}
......@@ -71,4 +71,14 @@ public class TTSController {
public ChatBotResponse chatbot(@RequestBody ChatBotRequest request) {
return ttService.chatbot(request);
}
@PostMapping("/api/update_db_var")
public void updateCache(HttpServletResponse response) {
try {
ttService.updateCache();
} catch (Exception e) {
response.setStatus(555);
}
response.setStatus(200);
}
}
......@@ -171,6 +171,7 @@ public class TTService {
for (TextInfo info : infoList) {
// person没有值或是不存在则赋予init_person
String person = info.getPerson();
//log.info("person:{}", person);
// text 字段不为空
String text = info.getText();
......@@ -678,4 +679,8 @@ public class TTService {
}
return new ResponseCodeWithData(555, "调用第三方生成wav文件失败");
}
public void updateCache() throws Exception {
initialize.afterPropertiesSet();
}
}
......@@ -19,16 +19,16 @@ spring:
ansi:
enabled: detect
logging:
#path: /home/ubuntu/project/tts/logs
path: /root/GameEditor/mqw/project/ttsTest/logs
path: /home/ubuntu/project/tts/logs
#path: /root/GameEditor/mqw/project/ttsTest/logs
level:
root: info
server:
#port: 9663
port: 8188
port: 9663
#port: 8188
tomcat:
accesslog:
enabled: true
pattern: '%h %l %u %t "%r" %s %b bytes %D ms'
#directory: /home/ubuntu/project/tts/tomcat
directory: /root/GameEditor/mqw/project/ttsTest/tomcat
\ No newline at end of file
directory: /home/ubuntu/project/tts/tomcat
#directory: /root/GameEditor/mqw/project/ttsTest/tomcat
\ No newline at end of file
server_name=hz1
#server_name=aws-nx2
#server_url=http://aws-nx2.chewrobot.com:9663
server_url=http://aliyun-hz1.chewrobot.com:9663
#audio_dir=/root/TTS-service/audio
audio_dir=/root/GameEditor/mqw/project/tts/audio
#server_name=hz1
server_name=aws-nx2
server_url=http://aws-nx2.chewrobot.com:9663
#server_url=http://aliyun-hz1.chewrobot.com:9663
audio_dir=/root/TTS-service/audio
#audio_dir=/root/GameEditor/mqw/project/tts/audio
online_sever=http://dev01.centaurstech.com
offline_server=http://dev01.centaurstech.com:9001
#offline_server=http://aliyun-hz1.chewrobot.com:9001
......
......@@ -40,10 +40,11 @@ public interface Constants {
String UN_COLLEC_ID = "colleUn";
String COLLECT_IMAGE_ID = "collectImage";
String COLLECT_TEXT_ID = "collectText";
String BACK_TRACE = "trace";
String PRE_CATEGORY = "categ";
String CLICK_PATTERN = "[{\"type\": \"SendEvent\",\"componentId\":\"%s\"}]";
String CLICK_PATTERN = "[{type: SendEvent,componentId:%s}]";
String COLLECTED_IMG_URL = "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/collec.png";
String UN_COLLECTED_IMG_URL = "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/uncollec.png";
......@@ -60,6 +61,10 @@ public interface Constants {
String UN_COLLEC = "收藏";
String CHAT_COLLECT = "我要收藏";
String CHAT_UN_COLLECT = "取消收藏";
String COLLECT_BOT_WORD = "已为您收藏该作品";
String COLLECT_BOT_WORD_MG = "已将%s加入您的收藏";
String UN_COLLECT_BOT_WORD = "已将该作品移出您的收藏列表";
String UN_COLLECT_BOT_WORD_MG = "已将%s移出您的收藏列表";
}
interface CATEGORY_IMG_URL {
......@@ -97,11 +102,14 @@ public interface Constants {
}
interface ErrorMsg {
String SORRY_UNCATCH = "我好意思我没听清,请再说一遍吧";
String SORRY_UNCATCH = "不好意思我没听清,请再说一遍吧";
String INTERNAL_ERROR = "其他DuerOS系统错误";
String INVALID_RESPONSE = "技能返回了无效的响应,可能技能响应数据量超过24KB,或是技能在request的dialogState为COMPLETED时仍然发送Dialog.Delegate指令等";
String DEVICE_COMMUNICATION_ERROR = "DuerOS与端通信异常";
String COLLECT_FAIL = "你可以在作品介绍页收藏该作品";
String UN_COLLECT_FAIL = "你可以在该作品的介绍页进行取消操作";
String INTERFACE_ERROR = "终端接口请求出错";
String HTTP_CONNECTION_CLOSE_FAILED = "与终端的链接关闭错误";
}
......
package ai.qiwu.com.xiaoduhome.common;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @author 苗权威
* @dateTime 19-7-18 上午10:54
*/
@Slf4j
public class OkHttp3Utils {
private static OkHttpClient client = new OkHttpClient();
private static final OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(15, TimeUnit.SECONDS)
.build();
public static String doGet(String url) throws IOException {
return doGet(url, new HashMap<>());
......@@ -53,19 +61,49 @@ public class OkHttp3Utils {
return doPost(url , new HashMap<>(), new HashMap<>(), file);
}
public static String doPostJsonStr(String url, Map<String, String> headers, String requestJsonStr) throws IOException {
public static String doPostJsonStr(String url, String requestJsonStr) throws IOException {
Request.Builder builder = new Request.Builder();
Request request = builder.url(url).build();
Headers.Builder headBuilder = request.headers().newBuilder();
headBuilder.add("Content-Type", "application/json;charset=utf-8");
Iterator<Map.Entry<String, String>> headIterator = headers.entrySet().iterator();
headIterator.forEachRemaining(e -> headBuilder.add(e.getKey(), e.getValue()));
// 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) {
Request.Builder builder = new Request.Builder();
// builder.url(url);
// builder.addHeader("Content-Type", "application/json;charset=utf-8");
Request request = builder.url(url).build();
Headers.Builder headBuilder = request.headers().newBuilder();
headBuilder.add("Content-Type", "application/json;charset=utf-8");
//RequestBody requestBody = FormBody.create(MediaType.parse("application/json; charset=utf-8"), requestJsonStr);
builder.post(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), requestJsonStr));
client.newCall(builder.build()).enqueue(new Callback() {
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
log.info("退出失败");
}
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
log.info("退出成功");
}
});
}
public static String doPost(String url, Map<String, String> headers, Map<String, String> params, File file) throws IOException {
......
package ai.qiwu.com.xiaoduhome.common;
import ai.qiwu.com.xiaoduhome.repository.primary.AppFavoriteTBRepository;
import ai.qiwu.com.xiaoduhome.repository.primary.AppFlowerTBRepository;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author 苗权威
* @dateTime 19-8-19 下午9:19
*/
@Component
public class ServiceUtil implements InitializingBean {
private final AppFlowerTBRepository appFlowerTBRepository;
private final AppFavoriteTBRepository appFavoriteTBRepository;
@Autowired
public ServiceUtil(AppFavoriteTBRepository appFavoriteTBRepository, AppFlowerTBRepository appFlowerTBRepository) {
this.appFavoriteTBRepository = appFavoriteTBRepository;
this.appFlowerTBRepository = appFlowerTBRepository;
}
public void insertAfterBuyFlower(String userId, String botId,
String baiduOrderReferenceId, String timeStamp) {
new Thread(() -> appFlowerTBRepository.insertOrder(botId, userId, baiduOrderReferenceId, timeStamp)).start();
}
public void insertAfterCollect(final String userId, final String botId) {
//new Thread(() -> appFavoriteTBRepository.insertFavorite(botId, userId)).start();
}
public void deleteAfterUnCollect(final String userId, final String botId) {
//new Thread(() -> appFavoriteTBRepository.deleteFavorite(botId, userId)).start();
}
@Override
public void afterPropertiesSet() throws Exception {
}
}
package ai.qiwu.com.xiaoduhome.common.temple;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-24 下午3:11
*/
public interface Agent {
}
package ai.qiwu.com.xiaoduhome.common.temple;
import com.baidu.dueros.data.response.directive.dpl.Document;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-8-24 下午5:38
*/
@Getter
@Setter
@ToString
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class CollectHistoryDocument extends Document{
private CollectHistoryMainTemplate mainTemplate;
@JsonIgnore
private String idToken;
}
package ai.qiwu.com.xiaoduhome.common.temple;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.ArrayList;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-24 下午5:42
*/
@Getter
@Setter
@ToString
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class CollectHistoryMainTemplate implements CustomMainTemplateInterface{
private List<String> parameters = new ArrayList<>();
private List<CollectHistoryPagePojo> items;
public CollectHistoryMainTemplate() {
this.parameters.add("payload");
this.items = new ArrayList<>();
}
}
package ai.qiwu.com.xiaoduhome.common.temple;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
import ai.qiwu.com.xiaoduhome.pojo.pageData.HistoryData;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-24 下午4:57
*/
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class CollectHistoryPagePojo {
private String type;
private String position;
private String left;
private String width;
private String height;
private String src;
private String top;
private String headerImage;
private String headerTitle;
@JsonProperty("margin-left")
private String marginLeft;
@JsonProperty("margin-top")
private String marginTop;
private String padding;
private List<CollectHistoryPagePojo> items;
private String direction;
@JsonProperty("font-size")
private String fontSize;
@JsonProperty("flex-direction")
private String flexDirection;
private String text;
@JsonProperty("border-radius")
private String borderRadius;
private List<HistoryData> data;
@JsonProperty("text-overflow")
private String textOverflow;
@JsonProperty("max-lines")
private Integer maxLines;
private List<Event> onClick;
}
package ai.qiwu.com.xiaoduhome.common.temple;
/**
* @author 苗权威
* @dateTime 19-8-24 下午5:41
*/
public interface CustomMainTemplateInterface {
}
package ai.qiwu.com.xiaoduhome.common.temple;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Item;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-24 下午2:54
*/
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class FrameTemple implements Agent{
private String type;
@JsonProperty("flex-direction")
private String flexDirection;
private List<FrameTemple> items;
private String text;
@JsonProperty("font-size")
private String fontSize;
@JsonProperty("margin-left")
private String marginLeft;
@JsonProperty("margin-bottom")
private String marginBottom;
private String width;
private String height;
@JsonProperty("border-width")
private String borderWidth;
@JsonProperty("border-top-left-radius")
private String borderTopLeftRadius;
@JsonProperty("border-top-right-radius")
private String borderTopRightRadius;
@JsonProperty("border-bottom-right-radius")
private String borderBottomRightRadius;
@JsonProperty("padding-vertical")
private String paddingVertical;
@JsonProperty("padding-horizontal")
private String paddingHorizontal;
@JsonProperty("border-color")
private String borderColor;
@JsonProperty("background-color")
private String backgroundColor;
private String color;
}
package ai.qiwu.com.xiaoduhome.common.temple;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Data;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Item;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-24 下午1:57
*/
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class collectIcon {
private String type;
private String width;
private String height;
private String src;
@JsonProperty("scale-type")
private String scaleType;
private String text;
@JsonProperty("margin-left")
private String marginLeft;
@JsonProperty("align-items")
private String alignItems;
@JsonProperty("justify-content")
private String justify;
private List<Event> onClick;
private List<Item> items;
@JsonProperty("margin-bottom")
private String marginBo;
private String componentId;
@JsonProperty("margin-top")
private String marginTop;
@JsonProperty("font-size")
private String fontSize;
@JsonProperty("letter-spacing")
private String LetterSpace;
}
package ai.qiwu.com.xiaoduhome.common.temple.playUpdate;
import com.baidu.dueros.data.response.directive.dpl.Document;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
/**
* @author 苗权威
* @dateTime 19-8-28 下午6:39
*/
@Data
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class PlayUpdateDocument extends Document {
private PlayUpdateMainTemplate mainTemplate;
}
package ai.qiwu.com.xiaoduhome.common.temple.playUpdate;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankingPojo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-28 下午6:38
*/
@Data
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class PlayUpdateMainTemplate {
private List<String> parameters = new ArrayList<>();
private List<PlayUpdatePojo> items;
public PlayUpdateMainTemplate() {
this.parameters.add("payload");
this.items = new ArrayList<>();
}
}
package ai.qiwu.com.xiaoduhome.common.temple.playUpdate;
import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandBotInfo;
import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandPojo;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-28 下午6:31
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class PlayUpdatePojo {
private String type;
private String height;
private String width;
private String componentId;
private List<PlayUpdatePojo> items;
private String padding;
private String position;
private String bottom;
private String text;
@JsonProperty("font-size")
private String fontSize;
@JsonProperty("font-style")
private String fontStyle;
private String looping;
private String autoplay;
private String src;
private List<Event> onEnd;
}
package ai.qiwu.com.xiaoduhome.common.temple.rank;
import lombok.Data;
/**
* @author 苗权威
* @dateTime 19-8-27 上午10:35
*/
@Data
public class RankBotInfo {
private String imageSrc;
private String imageId;
private String imageName;
public RankBotInfo(String imageSrc, String imageId, String imageName) {
this.imageSrc = imageSrc;
this.imageId = imageId;
this.imageName = imageName;
}
}
package ai.qiwu.com.xiaoduhome.common.temple.rank;
import com.baidu.dueros.data.response.directive.dpl.Document;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-8-27 上午10:23
*/
@Getter
@Setter
@ToString
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class RankingDocument extends Document {
private RankingMainTemplate mainTemplate;
@JsonIgnore
private String rankBotIds;
}
package ai.qiwu.com.xiaoduhome.common.temple.rank;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-27 上午10:21
*/
@Data
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class RankingMainTemplate {
private List<String> parameters = new ArrayList<>();
private List<RankingPojo> items;
public RankingMainTemplate() {
this.parameters.add("payload");
this.items = new ArrayList<>();
}
}
package ai.qiwu.com.xiaoduhome.common.temple.rank;
import ai.qiwu.com.xiaoduhome.common.temple.CollectHistoryPagePojo;
import ai.qiwu.com.xiaoduhome.common.temple.recommand.RecommandBotInfo;
import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-27 上午10:13
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class RankingPojo {
private String type;
private String height;
private String width;
private List<RankingPojo> items;
private String position;
private String top;
private String left;
private String src;
private String headerImage;
private String headerTitle;
private Boolean hasBackIcon;
private String componentId;
@JsonProperty("margin-top")
private String marginTop;
private String direction;
@JsonProperty("align-items")
private String alignItems;
@JsonProperty("margin-left")
private String marginLeft;
@JsonProperty("scale-type")
private String scaleType;
@JsonProperty("border-radius")
private String borderRadius;
private List<Event> onClick;
@JsonProperty("font-size")
private String fontSize;
private String text;
private String bottom;
private List<String> hints;
private List<RankBotInfo> data;
}
package ai.qiwu.com.xiaoduhome.common.temple.recommand;
import lombok.Data;
/**
* @author 苗权威
* @dateTime 19-8-27 上午10:52
*/
@Data
public class RecommandBotInfo {
private String imageSrc;
private String imageId;
private String imageName;
public RecommandBotInfo(String imageSrc, String imageId, String imageName) {
this.imageSrc = imageSrc;
this.imageId = imageId;
this.imageName = imageName;
}
}
package ai.qiwu.com.xiaoduhome.common.temple.recommand;
import com.baidu.dueros.data.response.directive.dpl.Document;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-8-27 上午10:50
*/
@Getter
@Setter
@ToString
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class RecommandDocument extends Document {
private RecommandMainTemplate mainTemplate;
@JsonIgnore
private String recommendIdList;
}
package ai.qiwu.com.xiaoduhome.common.temple.recommand;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-27 上午10:49
*/
@Data
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class RecommandMainTemplate {
private List<String> parameters = new ArrayList<>();
private List<RecommandPojo> items;
public RecommandMainTemplate() {
this.parameters.add("payload");
this.items = new ArrayList<>();
}
}
package ai.qiwu.com.xiaoduhome.common.temple.recommand;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankBotInfo;
import ai.qiwu.com.xiaoduhome.common.temple.rank.RankingPojo;
import ai.qiwu.com.xiaoduhome.pojo.dpl.Event;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-27 上午10:48
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class RecommandPojo {
private String type;
private String height;
private String width;
private List<RecommandPojo> items;
private String position;
private String top;
private String left;
private String src;
private String headerImage;
private String headerTitle;
private Boolean hasBackIcon;
private String componentId;
@JsonProperty("margin-top")
private String marginTop;
private String direction;
@JsonProperty("align-items")
private String alignItems;
@JsonProperty("margin-left")
private String marginLeft;
@JsonProperty("scale-type")
private String scaleType;
@JsonProperty("border-radius")
private String borderRadius;
private List<Event> onClick;
@JsonProperty("font-size")
private String fontSize;
private String text;
private String bottom;
private List<String> hints;
private List<RecommandBotInfo> data;
}
......@@ -143,7 +143,7 @@ public class Oauth2Controller {
*/
@RequestMapping("/accessToken")
public @ResponseBody TokenDuerosResponse returnTokenToDueros(@RequestParam String grant_type,
@RequestParam String code, @RequestParam String client_id,
@RequestParam(required = false) String code, @RequestParam String client_id,
@RequestParam String client_secret, @RequestParam String redirect_uri) {
log.info("小度请求Token,client_id:{};client_secret:{};redirect_uri:{};code:{}",
client_id, client_secret, redirect_uri, code);
......
......@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.util.Map;
/**
* @author 苗权威
......@@ -21,6 +22,7 @@ public class XiaoDuHomeController {
@RequestMapping("/xiaoduhome/chat")
public String chat() {
try {
log.info("--------------分界线-------------------");
DplBotService service = new DplBotService(Utils.getHttpServletRequest());
log.info("请求信息中的attributes:{}", service.getRequest().getSession().getAttributes());
//service.disableVerify();
......
......@@ -35,4 +35,10 @@ public class GameProjectTb {
@Column(name = "apply_status")
private Integer applyStatus;
@Column(name = "bot_account")
private String botAccount;
@Column(name = "user_nickname")
private String authorName;
}
......@@ -43,8 +43,8 @@ public class OnProductDetail {
@Column(name = "user_nickname")
private String authorName;
@Column(name = "bot_id")
private Integer botId;
@Column(name = "bot_account")
private String botAccount;
@Transient
private List<String> labels;
......
package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
/**
* @author 苗权威
* @dateTime 19-8-27 下午5:28
*/
@Entity
@Table(name = "xiaodu_history_tb")
@Data
public class XiaoDuHistoryBotIdTime {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "bot_id")
private String botId;
@Column(name = "last_time")
private Long lastTime;
@Column(name = "xiaodu_user_id")
private String xiaoduUserId;
}
package ai.qiwu.com.xiaoduhome.entity.secondary;
import lombok.Data;
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.util.Date;
/**
* @author 苗权威
* @dateTime 19-8-26 下午2:19
*/
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "xiaodu_history_tb")
@Data
public class XiaoDuHistoryTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "bot_id")
private String botId;
@Column(name = "xiaodu_user_id")
private String xiaoduUserId;
@Column(name = "last_time")
private Long lastTime;
@CreatedDate
@Column(name = "create_time",nullable = false,updatable = false)
private Date createTime;
@Column(name = "update_time")
@LastModifiedDate
private Date updateTime;
}
package ai.qiwu.com.xiaoduhome.pojo;
import com.baidu.dueros.data.response.directive.Directive;
import com.baidu.dueros.model.Response;
import lombok.Data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author 苗权威
* @dateTime 19-8-28 下午3:22
*/
@Data
public class OverTimeDetail {
private final List<Directive> directives = new ArrayList<>();
private final Map<String, String> attributes = new HashMap<>();
private Response response = new Response();
}
......@@ -13,4 +13,5 @@ public class QiWuResponse {
private String audio;
private String text;
private String length;
private String aipioneerUsername;
}
package ai.qiwu.com.xiaoduhome.pojo.dpl;
import ai.qiwu.com.xiaoduhome.common.temple.Agent;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
......@@ -18,7 +19,7 @@ import java.util.List;
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class Item {
public class Item implements Agent {
private Integer duration;
private String type;
private String width;
......@@ -27,18 +28,19 @@ public class Item {
@JsonProperty("scale-type")
private String scaleType;
@JsonProperty("border-bottom-right-radius")
private String borderBrr;
private String borderBottomRightRadius;
private Double opacity;
private String text;
@JsonProperty("line-height")
private String lineHeight;
@JsonProperty("letter-spacing")
private String LetterSpace;
private String LetterSpacing;
private String color;
@JsonProperty("padding-left")
private String paddingLeft;
@JsonProperty("padding-right")
private String paddingRight;
private String padding;
@JsonProperty("margin-left")
private String marginLeft;
@JsonProperty("margin-right")
......@@ -46,7 +48,7 @@ public class Item {
@JsonProperty("margin-top")
private String marginTop;
@JsonProperty("margin-bottom")
private String marginBo;
private String marginBottom;
private Boolean looping;
private Boolean autoPlay;
private String audioType;
......@@ -91,7 +93,9 @@ public class Item {
@JsonProperty("align-items")
private String alignItems;
@JsonProperty("justify-content")
private String justify;
private String justifyContent;
@JsonProperty("text-overflow")
private String overflow;
private String textOverflow;
private List<Agent> firstItem;
}
package ai.qiwu.com.xiaoduhome.pojo.dpl;
import ai.qiwu.com.xiaoduhome.common.temple.Agent;
import ai.qiwu.com.xiaoduhome.common.temple.CustomMainTemplateInterface;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
......@@ -14,7 +16,7 @@ import java.util.List;
@Getter
@Setter
@ToString
public class MyMainTemplate {
public class MyMainTemplate implements CustomMainTemplateInterface {
private List<String> parameters = new ArrayList<>();
private List<Item> items;
......
package ai.qiwu.com.xiaoduhome.pojo.pageData;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
/**
* @author 苗权威
* @dateTime 19-8-27 下午6:02
*/
@Data
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class HistoryData {
private String botAccountId;
private Integer collectPageLeftNum;
private String bannerImgUrl;
private String name;
private String intro;
private String lastTime;
private String authorName;
public HistoryData() {
}
public HistoryData(String botAccountId, Integer collectPageLeftNum,
String bannerImgUrl, String name, String intro) {
this.botAccountId = botAccountId;
this.collectPageLeftNum = collectPageLeftNum;
this.bannerImgUrl = bannerImgUrl;
this.name = name;
this.intro = intro;
}
}
......@@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-21 下午4:04
......@@ -31,4 +33,10 @@ public interface AppFavoriteTBRepository extends JpaRepository<AppFavoriteTB, In
@Transactional
void deleteByBotIdAndUserId(String botId, Integer userId);
@Query(value="SELECT bot_username from app_favorite_tb where user_id=?1", nativeQuery = true)
List<String> getFavoriteBotIds(Integer userId);
@Override
<S extends AppFavoriteTB> long count(Example<S> example);
}
......@@ -17,9 +17,11 @@ public interface GameProjectTbRepository extends JpaRepository<GameProjectTb, In
List<GameProjectTb> findFirst15ByApplyStatusOrderByWatchDesc(Integer applyStatus);
@Query(value = "select id,intro,name,watch,banner_img_url,apply_status from game_project_tb where apply_status = 1 and id >= (select floor(RAND()*(select MAX(id) from game_project_tb))) order by id limit 10", nativeQuery = true)
@Query(value = "select id,intro,name,watch,banner_img_url,apply_status,bot_account,user_nickname from game_project_tb where apply_status = 1 and id >= (select floor(RAND()*(select MAX(id) from game_project_tb))) order by id limit 10", nativeQuery = true)
List<GameProjectTb> recommendList();
@Query(value = "select p.id,p.intro,p.name,p.watch,p.banner_img_url,p.apply_status from game_project_tb as p,game_project_label_tb as l where l.name= :category and p.id = l.project_id and p.apply_status=1", nativeQuery = true)
@Query(value = "select p.id,p.intro,p.name,p.watch,p.banner_img_url,p.apply_status,p.bot_account,p.user_nickname from game_project_tb as p,game_project_label_tb as l where l.name= :category and p.id = l.project_id and p.apply_status=1", nativeQuery = true)
List<GameProjectTb> categoryProject(@Param("category") String category);
GameProjectTb getByBotAccount(String botAccount);
}
package ai.qiwu.com.xiaoduhome.repository.secondary;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryBotIdTime;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-27 下午5:30
*/
public interface XiaoDuHistoryBotTimeRepository extends JpaRepository<XiaoDuHistoryBotIdTime, Integer> {
List<XiaoDuHistoryBotIdTime> getByXiaoduUserId(String xiaoduUserId);
}
package ai.qiwu.com.xiaoduhome.repository.secondary;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuHistoryTB;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-26 下午2:21
*/
public interface XiaoDuHistoryTBRepository extends JpaRepository<XiaoDuHistoryTB, Integer> {
@Query(value = "SELECT bot_id FROM xiaodu_history_tb WHERE xiaodu_user_id=?1 ORDER BY last_time LIMIT 15", nativeQuery = true)
List<String> getHistory(String xiaoduUserId);
@Query(value = "SELECT DISTINCT xiaodu_user_id FROM xiaodu_history_tb", nativeQuery = true)
List<String> getAllUser();
@Transactional
@Query(value = "delete from xiaodu_history_tb where xiaodu_user_id=?1 and last_time < (select last_time from xiaodu_history_tb where xiaodu_user_id=?1 order by last_time limit 14,1)", nativeQuery = true)
void deleteOverTime(String userId);
@Transactional
@Query(value = "delete from xiaodu_history_tb where last_time <?1", nativeQuery = true)
void deletePasted(Long boundTime);
@Transactional
@Override
<S extends XiaoDuHistoryTB> S save(S s);
XiaoDuHistoryTB getByXiaoduUserIdAndBotId(String xiaoduUserId, String botId);
}
......@@ -9,7 +9,6 @@ import org.springframework.transaction.annotation.Transactional;
* @author 苗权威
* @dateTime 19-8-22 下午4:28
*/
@Repository(value = "xiaoDuOrderTBIdRepository")
public interface XiaoDuOrderTBIdRepository extends JpaRepository<XiaoDuOrderIdTB, Integer> {
XiaoDuOrderIdTB getByXiaoduUserIdAndBotIdAndUnitPrice(String xiaoduUserId, String botId, Integer unitPrice);
......
......@@ -10,7 +10,6 @@ import org.springframework.transaction.annotation.Transactional;
* @author 苗权威
* @dateTime 19-8-22 下午3:59
*/
@Repository(value = "xiaoDuOrderTbRepository")
public interface XiaoDuOrderTbRepository extends JpaRepository<XiaoDuOrderTB, Integer> {
@Override
<S extends XiaoDuOrderTB> boolean exists(Example<S> example);
......
......@@ -25,11 +25,23 @@ class RequestTerminal {
requestPojo.setAccess(Constants.SERVICE_NAME);
requestPojo.setText(userWord);
String requestJsonStr = JSON.toJSONString(requestPojo);
HashMap<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json;charset=utf-8");
log.info("向小悟发送的请求信息:{}", requestJsonStr);
String resStr = OkHttp3Utils.doPostJsonStr(Constants.QI_WU_INTERFACE, headers, requestJsonStr);
String resStr = OkHttp3Utils.doPostJsonStr(Constants.QI_WU_INTERFACE, requestJsonStr);
if (resStr == null) return null;
log.info("返回信息:{}", resStr);
return JSON.parseObject(resStr, QiWuResponse.class);
}
static void backRequest(String userId) {
QiWuRequest requestPojo = new QiWuRequest();
requestPojo.setUser_id(userId);
requestPojo.setAccess(Constants.SERVICE_NAME);
requestPojo.setText("退出");
String requestJsonStr = JSON.toJSONString(requestPojo);
OkHttp3Utils.backPostAsync(Constants.QI_WU_INTERFACE, requestJsonStr);
}
public static void main(String[] args) throws IOException {
backRequest("2353461");
}
}
......@@ -5,6 +5,7 @@ import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
import ai.qiwu.com.xiaoduhome.repository.primary.AllOnProductInfoRepository;
import ai.qiwu.com.xiaoduhome.repository.primary.GameProjectTbRepository;
import ai.qiwu.com.xiaoduhome.repository.primary.ProjectLabelRepository;
import ai.qiwu.com.xiaoduhome.repository.secondary.XiaoDuHistoryTBRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -27,7 +28,11 @@ public class ScheduleService implements InitializingBean {
static volatile List<GameProjectTb> RECOMMEND_LIST = new ArrayList<>();
static volatile List<OnProductDetail> ALL_ON_PRODUCT = new ArrayList<>();
static final HashMap<String, OnProductDetail> PRODUCT_NAME_DETAIL = new HashMap<>();
//static final Map<String, List<String>> PRODUCT_LABELS = new HashMap<>();
static final HashMap<String, OnProductDetail> PRODUCT_ID_DETAIL = new HashMap<>();
static final HashMap<String, String> NX2_BOT_TO_HZ1 = new HashMap<>();
static final List<String> EXCEPT_BOT_ACCOUNT = new ArrayList<>();
static final String[] CATEGORY = {"古风", "科幻", "占星", "恋爱", "灾难", "架空", "儿童", "经营", "冒险", "武侠"};
static final ConcurrentHashMap<String, List<GameProjectTb>> CATEGORY_PRODUCT_LIST = new ConcurrentHashMap<>();
......@@ -37,16 +42,19 @@ public class ScheduleService implements InitializingBean {
private final AllOnProductInfoRepository allOnProductInfoRepository;
private final XiaoDuHistoryTBRepository xiaoDuHistoryTBRepository;
@Autowired
public ScheduleService(GameProjectTbRepository gameProjectTbRepository,
ProjectLabelRepository projectLabelRepository, AllOnProductInfoRepository allOnProductInfoRepository) {
ProjectLabelRepository projectLabelRepository, AllOnProductInfoRepository allOnProductInfoRepository, XiaoDuHistoryTBRepository xiaoDuHistoryTBRepository) {
this.gameProjectTbRepository = gameProjectTbRepository;
this.projectLabelRepository = projectLabelRepository;
this.allOnProductInfoRepository = allOnProductInfoRepository;
this.xiaoDuHistoryTBRepository = xiaoDuHistoryTBRepository;
}
@Scheduled(cron = "0 0 19 * * ?")
public void getRankingList() {
public void initRankingList() {
try {
new Thread(() -> {
RANKING_LIST = gameProjectTbRepository.findFirst15ByApplyStatusOrderByWatchDesc(1);
......@@ -58,7 +66,7 @@ public class ScheduleService implements InitializingBean {
}
@Scheduled(cron = "0 0 18 * * ?")
public void getRecommendList() {
public void initRecommendList() {
try {
new Thread(() -> {
RECOMMEND_LIST = gameProjectTbRepository.recommendList();
......@@ -67,20 +75,21 @@ public class ScheduleService implements InitializingBean {
} catch (Exception e) {
log.error("更新推荐页出错:{}", e.getMessage());
}
}
@Scheduled(cron = "0 0 17 * * ?")
public void getAllOnTableProductInfo() {
public void initAllOnTableProductInfo() {
try {
new Thread(() -> {
ALL_ON_PRODUCT = allOnProductInfoRepository.findAllByApplyStatus(1);
for (OnProductDetail item : ALL_ON_PRODUCT) {
String productName = item.getName();
String botAccount = item.getBotAccount();
List<String> labels = projectLabelRepository.productLabels(item.getId());
//PRODUCT_LABELS.put(productName, labels);
item.setLabels(labels);
PRODUCT_NAME_DETAIL.put(productName, item);
PRODUCT_ID_DETAIL.put(botAccount, item);
}
//log.info("作品详细信息:{}", PRODUCT_NAME_DETAIL);
}).start();
......@@ -90,7 +99,7 @@ public class ScheduleService implements InitializingBean {
}
@Scheduled(cron = "0 0 1 ? * 7")
public void getProductList() {
public void initProductList() {
try {
new Thread(() -> {
for (String category: CATEGORY) {
......@@ -104,13 +113,77 @@ public class ScheduleService implements InitializingBean {
}
}
@Scheduled(cron = "0 0 2 * * ?")
public void deleteOverTimeHistory() {
try {
new Thread(() -> {
xiaoDuHistoryTBRepository.deletePasted((long) (System.currentTimeMillis()-2592E5));
List<String> userIds = xiaoDuHistoryTBRepository.getAllUser();
for (String userId: userIds) {
xiaoDuHistoryTBRepository.deleteOverTime(userId);
}
}).start();
}catch (Exception e) {
log.error("清理历史记录数据库出错:{}", e.toString());
}
}
@Override
public void afterPropertiesSet() throws Exception {
getAllOnTableProductInfo();
getRecommendList();
getRankingList();
getProductList();
initAllOnTableProductInfo();
initRecommendList();
initRankingList();
initProductList();
tian();
keng();
}
private void keng() {
NX2_BOT_TO_HZ1.put("6854303973", "612535455");
NX2_BOT_TO_HZ1.put("1814141710", "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("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("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("2090828382", "4731779365");
NX2_BOT_TO_HZ1.put("8907881060", "4577201364");
NX2_BOT_TO_HZ1.put("7051119238", "7907720862");
NX2_BOT_TO_HZ1.put("7414315062", "1029558688");
}
private void tian(){
EXCEPT_BOT_ACCOUNT.add("682031219");
EXCEPT_BOT_ACCOUNT.add("963477460");
EXCEPT_BOT_ACCOUNT.add("9256014607");
EXCEPT_BOT_ACCOUNT.add("1778815830");
EXCEPT_BOT_ACCOUNT.add("6823941516");
EXCEPT_BOT_ACCOUNT.add("4151097686");
}
public static HashMap<String, OnProductDetail> getProductIdDetail() {
return PRODUCT_ID_DETAIL;
}
public static List<GameProjectTb> getRankingList() {
return RANKING_LIST;
}
public static List<GameProjectTb> getRecommendList() {
return RECOMMEND_LIST;
}
public static HashMap<String, String> getNx2BotToHz1() {
return NX2_BOT_TO_HZ1;
}
public static List<String> getExceptBotAccount() {
return EXCEPT_BOT_ACCOUNT;
}
}
......@@ -4,11 +4,14 @@ server:
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
username: root
#password: YAdqFKlzYho
password: 3g9^pWQs#ft7
driver-class-name: com.mysql.cj.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
username: root
password: 3g9^pWQs#ft7
......
......@@ -42,8 +42,7 @@
{
"type": "Container",
"align-items": "center",
"justify-content": "center",
"margin-left": "40dp",
"margin-left": "15dp",
"items": [
{
"type": "Image",
......@@ -63,7 +62,6 @@
{
"type": "Text",
"font-size": "30dp",
"letter-spacing": "3dp",
"margin-top": "10dp",
"text": "${data.imageName}"
}
......
{
"type": "DPL",
"version": "1.0",
"mainTemplate": {
"parameters": [
"payload"
],
"items": [
{
"type": "Container",
"margin-left": "120dp",
"align-items": "center",
"onClick": [
{
"type": "SendEvent"
}
],
"items": [
{
"type": "Image",
"height": "60dp",
"width": "60dp",
"componentId": "collectImage",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/share.png",
"scale-type": "fitCenter"
},
{
"type": "Text",
"componentId": "collectText",
"margin-top": "10dp",
"text": "收藏",
"font-size": "20dp"
}
]
}
]
}
}
\ No newline at end of file
{
"type": "DPL",
"version": "1.0",
"mainTemplate": {
"parameters": [
"payload"
],
"items": [
{
"type": "Image",
"position": "absolute",
"top": "0dp",
"left": "0dp",
"height": "100%",
"width": "100%",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg"
},
{
"type": "Header",
"headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "收藏"
},
{
"type": "Container",
"margin": "10dp",
"height": "100%",
"width": "100%",
"items": [
{
"type": "List",
"height": "100%",
"width": "100%",
"direction": "vertical",
"items": [
{
"type": "Container",
"height": "100dp",
"width": "100%",
"flex-direction": "row",
"componentId": "${data.botAccountId}",
"onclick": [
{
"type": "SendEvent",
"componentId": "${data.botAccountId}"
}
],
"items": [
{
"type": "Text",
"font-size": "40dp",
"margin-left": "40dp",
"margin-top": "7dp",
"text": "${data.collectPageLeftNum}"
},
{
"type": "Image",
"width": "75dp",
"height": "75dp",
"border-radius": "10dp",
"margin-left": "1dp",
"src": "${data.bannerImgUrl}"
},
{
"type": "Container",
"height": "75dp",
"width": "45%",
"flex-direction": "column",
"margin-left": "20dp",
"items": [
{
"type": "Text",
"font-size": "30dp",
"text": "${data.name}"
},
{
"type": "Text",
"font-size": "20dp",
"margin-top": "8dp",
"text": "${data.intro}",
"text-overflow": "ellipsis",
"max-lines": 1
}
]
},
{
"type": "Text",
"margin-left": "50dp",
"font-size": "30dp",
"text": "${data.authorName}"
}
]
}
]
}
]
}
]
}
}
\ No newline at end of file
{
"type": "Container",
"flex-direction": "row",
"margin-bottom": "15dp",
"items": [
{
"type": "Text",
"text": "作品排行榜",
"font-size": "35dp",
"margin-left": "30dp"
},
{
"type": "Frame",
"margin-left": "15dp",
"border-width": "1dp",
"border-top-left-radius": "25dp",
"border-top-right-radius": "15dp",
"border-bottom-right-radius": "15dp",
"padding-vertical": "5dp",
"padding-horizontal": "15dp",
"border-color": "rgb(255,255,255)",
"items": [
{
"type": "Text",
"font-size": "15dp",
"color": "rgb(255,255,255,0.4)"
}
]
}
]
}
\ No newline at end of file
{
"type": "DPL",
"version": "1.0",
"mainTemplate": {
"parameters": [
"payload"
],
"items": [
{
"type": "Image",
"position": "absolute",
"top": "0dp",
"left": "0dp",
"height": "100%",
"width": "100%",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg"
},
{
"type": "Header",
"headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "历史"
},
{
"type": "Container",
"margin": "10dp",
"height": "100%",
"width": "100%",
"items": [
{
"type": "List",
"height": "100%",
"width": "100%",
"direction": "vertical",
"items": [
{
"type": "Container",
"height": "100dp",
"width": "100%",
"flex-direction": "row",
"componentId": "${data.botAccountId}",
"onclick": [
{
"type": "SendEvent",
"componentId": "${data.botAccountId}"
}
],
"items": [
{
"type": "Text",
"font-size": "40dp",
"margin-left": "40dp",
"margin-top": "7dp",
"text": "${data.collectPageLeftNum}"
},
{
"type": "Image",
"width": "20%",
"height": "75dp",
"border-radius": "5%",
"margin-left": "1dp",
"src": "${data.bannerImgUrl}"
},
{
"type": "Container",
"height": "75dp",
"width": "45%",
"flex-direction": "column",
"margin-left": "20dp",
"items": [
{
"type": "Text",
"font-size": "30dp",
"text": "${data.name}"
},
{
"type": "Text",
"font-size": "20dp",
"margin-top": "8dp",
"text": "${data.intro}",
"text-overflow": "ellipsis",
"max-lines": 1
}
]
},
{
"type": "Text",
"margin-left": "40dp",
"font-size": "20dp",
"text": "${data.lastTime}"
}
]
}
]
}
]
}
]
}
}
\ No newline at end of file
......@@ -47,7 +47,6 @@
{
"type": "Container",
"align-items": "center",
"justify-content": "center",
"margin-left": "30dp",
"items": [
{
......@@ -68,7 +67,6 @@
{
"type": "Text",
"font-size": "24dp",
"letter-spacing": "3dp",
"margin-top": "10dp",
"text": "${data.imageName}"
}
......@@ -82,6 +80,7 @@
"type": "Container",
"height": "250dp",
"width": "100%",
"margin-top": "30dp",
"items": [
{
"type": "List",
......@@ -93,7 +92,6 @@
"type": "Container",
"margin-left": "30dp",
"align-items": "center",
"justify-content": "center",
"items": [
{
"type": "Image",
......@@ -113,7 +111,6 @@
{
"type": "Text",
"font-size": "24dp",
"letter-spacing": "3dp",
"margin-top": "10dp",
"text": "${data.imageName}"
}
......@@ -127,6 +124,8 @@
"type": "Container",
"height": "250dp",
"width": "100%",
"margin-top": "30dp",
"margin-bottom": "60dp",
"items": [
{
"type": "List",
......@@ -137,7 +136,6 @@
{
"type": "Container",
"align-items": "center",
"justify-content": "center",
"margin-left": "30dp",
"items": [
{
......@@ -158,7 +156,6 @@
{
"type": "Text",
"font-size": "24dp",
"letter-spacing": "3dp",
"margin-top": "10dp",
"text": "${data.imageName}"
}
......
......@@ -26,37 +26,24 @@
"height": "100%",
"width": "100%",
"componentId": "whole",
"onClick": [
{
"type": "SendEvent",
"componentId": "continues"
}
],
"items": [
{
"type": "Container",
"width": "100%",
"height": "100%",
"padding":"35dp",
"position": "absolute",
"bottom": "120dp",
"items": [
{
"type": "Container",
"height": "280dp",
"width": "90%",
"align-items": "flex-end",
"items": [
{
"type": "Text",
"font-size": "35dp",
"font-style": "normal",
"letter-spacing": "3dp"
}
]
"type": "Text",
"componentId": "text",
"font-size": "28dp",
"font-style": "normal"
}
]
},
{
"type": "Audio",
"componentId": "audio",
"componentId": "audioCom",
"looping": "false",
"autoplay": "true",
"onEnd": [
......
{
"type": "DPL",
"version": "1.0",
"mainTemplate": {
"parameters": [
"payload"
],
"items": [
{
"type": "Container",
"height": "100%",
"width": "100%",
"componentId": "whole",
"items": [
{
"type": "Container",
"padding":"35dp",
"position": "absolute",
"bottom": "120dp",
"items": [
{
"type": "Text",
"text": "fff",
"componentId": "text",
"font-size": "28dp",
"font-style": "normal"
}
]
},
{
"type": "Audio",
"componentId": "audioCom",
"looping": "false",
"autoplay": "true",
"src": "ggg",
"onEnd": [
{
"type": "SendEvent",
"componentId": "audio"
}
]
}
]
}
]
}
}
\ No newline at end of file
......@@ -57,7 +57,6 @@
"type": "Text",
"margin-top": "10dp",
"font-size": "38dp",
"letter-spacing": "15dp",
"margin-left": "5%"
},
{
......@@ -69,14 +68,12 @@
"type": "Text",
"text": "发表时间:2019.5.8",
"font-size": "22dp",
"letter-spacing": "14dp",
"margin-left": "5%"
},
{
"type": "Text",
"text": "作者:小艾",
"font-size": "22dp",
"letter-spacing": "14dp",
"margin-left": "10%"
}
]
......@@ -91,7 +88,6 @@
"max-lines": 1,
"text": "相关标签: 都市 社会 生活",
"font-size": "22dp",
"letter-spacing": "14dp",
"margin-left": "5%"
}
]
......@@ -104,8 +100,7 @@
{
"type": "Text",
"font-size": "25dp",
"line-height": "50dp",
"letter-spacing": "50dp",
"line-height": "5dp",
"margin-top": "30dp",
"max-lines": 3,
"text-overflow": "ellipsis",
......@@ -116,12 +111,13 @@
{
"type": "Container",
"flex-direction": "row",
"position": "absolute",
"bottom": "160dp",
"items": [
{
"type": "Container",
"margin-left": "50dp",
"align-items": "center",
"justify-content": "center",
"onClick": [
{
"type": "SendEvent"
......@@ -132,7 +128,6 @@
"type": "Image",
"height": "60dp",
"width": "60dp",
"margin-bottom": "20dp",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/feel.png",
"scale-type": "fitCenter"
},
......@@ -140,8 +135,7 @@
"type": "Text",
"text": "开始体验",
"margin-top": "10dp",
"font-size": "20dp",
"letter-spacing": "12dp"
"font-size": "20dp"
}
]
},
......@@ -149,7 +143,6 @@
"type": "Container",
"margin-left": "130dp",
"align-items": "center",
"justify-content": "center",
"onClick": [
{
"type": "SendEvent"
......@@ -160,7 +153,6 @@
"type": "Image",
"height": "60dp",
"width": "60dp",
"margin-bottom": "20dp",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/flower.png",
"scale-type": "fitCenter"
},
......@@ -168,16 +160,14 @@
"type": "Text",
"text": "打赏鲜花",
"margin-top": "10dp",
"font-size": "20dp",
"letter-spacing": "12dp"
"font-size": "20dp"
}
]
},
{
"type": "Container",
"margin-left": "130dp",
"margin-left": "120dp",
"align-items": "center",
"justify-content": "center",
"onClick": [
{
"type": "SendEvent"
......@@ -188,7 +178,6 @@
"type": "Image",
"height": "60dp",
"width": "60dp",
"margin-bottom": "20dp",
"componentId": "collectImage",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/share.png",
"scale-type": "fitCenter"
......@@ -198,8 +187,7 @@
"componentId": "collectText",
"margin-top": "10dp",
"text": "收藏",
"font-size": "20dp",
"letter-spacing": "49dp"
"font-size": "20dp"
}
]
}
......
{
"type": "DPL",
"version": "1.0",
"mainTemplate": {
"parameters": [
"payload"
],
"items": [
{
"type": "Container",
"height": "100%",
"width": "100%",
"items": [
{
"type": "Image",
"position": "absolute",
"top": "0dp",
"left": "0dp",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg",
"height": "100%",
"width": "100%"
},
{
"type": "Header",
"headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "排行榜",
"hasBackIcon": true
},
{
"type": "Container",
"height": "100%",
"width": "100%",
"componentId": "whole",
"margin-top": "65dp",
"items": [
{
"type": "List",
"height": "100%",
"width": "100%",
"direction": "horizontal",
"items": [
{
"type": "Container",
"align-items": "center",
"margin-left": "15dp",
"items": [
{
"type": "Image",
"width": "220dp",
"height": "220dp",
"componentId": "${data.imageId}",
"scale-type": "fitXY",
"border-radius": "10dp",
"src": "${data.imageSrc}",
"onClick": [
{
"type": "SendEvent",
"componentId": "${data.imageId}"
}
]
},
{
"type": "Text",
"font-size": "30dp",
"margin-top": "10dp",
"text": "${data.imageName}"
}
]
}
]
}
]
}
]
},
{
"type": "Container",
"position": "absolute",
"width": "100%",
"left": "0",
"bottom": "0",
"items": [
{
"type": "Footer",
"hints": [
"打开推荐作品","下一个分类","打开排行榜"
]
}
]
}
]
}
}
\ No newline at end of file
{
"type": "DPL",
"version": "1.0",
"mainTemplate": {
"parameters": [
"payload"
],
"items": [
{
"type": "Container",
"height": "100%",
"width": "100%",
"items": [
{
"type": "Image",
"position": "absolute",
"top": "0dp",
"left": "0dp",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg",
"height": "100%",
"width": "100%"
},
{
"type": "Header",
"headerImage": "https://skillstore.cdn.bcebos.com/icon/23/fc7581b7-b505-1f44-ab52-3d9f5e567dfd.png",
"headerTitle": "推荐页",
"hasBackIcon": true
},
{
"type": "Container",
"height": "100%",
"width": "100%",
"componentId": "whole",
"margin-top": "65dp",
"items": [
{
"type": "List",
"height": "100%",
"width": "100%",
"direction": "horizontal",
"items": [
{
"type": "Container",
"align-items": "center",
"margin-left": "15dp",
"items": [
{
"type": "Image",
"width": "220dp",
"height": "220dp",
"componentId": "${data.imageId}",
"scale-type": "fitXY",
"border-radius": "10dp",
"src": "${data.imageSrc}",
"onClick": [
{
"type": "SendEvent",
"componentId": "${data.imageId}"
}
]
},
{
"type": "Text",
"font-size": "30dp",
"margin-top": "10dp",
"text": "${data.imageName}"
}
]
}
]
}
]
}
]
},
{
"type": "Container",
"position": "absolute",
"width": "100%",
"left": "0",
"bottom": "0",
"items": [
{
"type": "Footer",
"hints": [
"打开推荐作品","下一个分类","打开排行榜"
]
}
]
}
]
}
}
\ No newline at end of file
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