Commit fda1e77c by 苗权威

8.24

parent 42683448
...@@ -26,7 +26,7 @@ public class CallPython { ...@@ -26,7 +26,7 @@ public class CallPython {
String result = processUtilInJava(command); String result = processUtilInJava(command);
if ("1".equals(result)) { if ("1".equals(result)) {
if (!TTSUtils.doesFileExist(filename)) { if (!TTSUtils.doesFileExist(filename)) {
log.error("检测到mp3文件不存在:{}", filename); log.error("检测到mp3文件不存在:{},command{}", filename,command);
result = "0"; result = "0";
} }
} }
......
...@@ -37,4 +37,8 @@ public class Config { ...@@ -37,4 +37,8 @@ public class Config {
if (StringUtils.isBlank(value)) return defaultValue; if (StringUtils.isBlank(value)) return defaultValue;
return value.trim(); return value.trim();
} }
public static void main(String[] args) {
}
} }
...@@ -32,7 +32,7 @@ public class OfflineService { ...@@ -32,7 +32,7 @@ public class OfflineService {
/** /**
* 根据请求信息找到对应的wav文件,路径是servername/botname/person/mood/xxx.wav. * 根据请求信息找到对应的wav文件,路径是servername/botname/person/mood/xxx.wav.
* 文件存在,若format字段等与wav则返回该wav文件的内容,否则返回servername/botname/person/mood/xxx.mp3文件内容 * 文件存在,若format字段等与wav则返回该wav文件的内容,否则返回servername/botname/person/mood/xxx.mp3
* @param request * @param request
* @param response * @param response
* @param requestMethod * @param requestMethod
......
...@@ -74,6 +74,10 @@ ...@@ -74,6 +74,10 @@
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions> </exclusions>
<version>4.11.3</version> <version>4.11.3</version>
</dependency> </dependency>
......
...@@ -17,14 +17,12 @@ public class CallPython { ...@@ -17,14 +17,12 @@ public class CallPython {
private static String INTERPRETER ; private static String INTERPRETER ;
private static final String COMBINE_FILE = ""; private static final String COMBINE_FILE = "";
public static String changeSound(String wav_filename, Double volume, Double speed, Double pitch, String filename) { public static String changeSound(String wav_filename, Double volume, Double speed, Double pitch, String filename) {
String command = ChangeSound.changeSound(wav_filename, volume, speed, pitch, filename); String command = ChangeSound.changeSound(wav_filename, volume, speed, pitch, filename);
log.info("命令:{}", command); String result = execute(command);
String result = processUtilInJava(command);
if ("1".equals(result)) { if ("1".equals(result)) {
if (!TTSUtils.doesFileExist(filename)) { if (!TTSUtils.doesFileExist(filename)) {
log.error("检测到mp3文件不存在:{}", filename); log.error("检测到mp3文件不存在:{},命令:{}", filename,command);
result = "0"; result = "0";
} }
} }
...@@ -52,54 +50,107 @@ public class CallPython { ...@@ -52,54 +50,107 @@ public class CallPython {
INTERPRETER = interpreter; INTERPRETER = interpreter;
} }
private static String execute(String arg) {
ProcessBuilder processBuilder = new ProcessBuilder(arg.split(" "));
processBuilder.redirectErrorStream(true); //错误输出流合并到标准输出流中
StringBuilder builder = new StringBuilder();
Process process = null;
try {
process = processBuilder.start();
process.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
if (process.exitValue() != 0) {
while ((line = reader.readLine()) != null) {
builder.append(line);
}
if (builder.length() > 0) {
log.error("sox执行出错:{}",builder.toString());
return "0";
}
}else {
while ((line = reader.readLine()) != null) {
builder.append(line);
}
log.info("sox返回信息:{}", builder.toString());
}
} catch (IOException e) {
log.info("Error while running Sox. {}",e.getMessage());
return "0";
} catch (InterruptedException e) {
log.info("Error while running Sox. {}",e.getMessage());
} finally {
if (process != null) process.destroy();
}
return "1";
}
private static String processUtilInJava(String arg) { private static String processUtilInJava(String arg) {
final StringBuilder successResult = new StringBuilder(); final StringBuilder successResult = new StringBuilder();
final StringBuilder failResult = new StringBuilder(); final StringBuilder failResult = new StringBuilder();
Process process = null; InputStream inputStream = null;
InputStream errorStream = null;
try { try {
process = Runtime.getRuntime().exec(arg); Process process = Runtime.getRuntime().exec(arg);
final InputStream inputStream = process.getInputStream();
final InputStream errorStream = process.getErrorStream();
new Thread(() -> { inputStream = process.getInputStream();
errorStream = process.getErrorStream();
//final InputStream inputStream = process.getInputStream();
//final InputStream errorStream = process.getErrorStream();
String line; String line;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));){ try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))){
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
successResult.append(line); successResult.append(line);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("读取Process输入流出错:{}",e.toString()); log.error("读取Process输入流出错:{}",e.toString());
} }
}).start();
new Thread(() -> {
String line; try (BufferedReader reader = new BufferedReader(new InputStreamReader(errorStream))){
try (BufferedReader reader = new BufferedReader(new InputStreamReader(errorStream));){
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
failResult.append(line); failResult.append(line);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("读取Process error流出错:{}",e.toString()); log.error("读取Process error流出错:{}",e.toString());
} }
}).start();
// new Thread(() -> {
// String line;
// try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));){
// while ((line = reader.readLine()) != null) {
// successResult.append(line);
// }
// } catch (Exception e) {
// log.error("读取Process输入流出错:{}",e.toString());
// }
// }).start();
// new Thread(() -> {
//
// String lines;
// try (BufferedReader reader = new BufferedReader(new InputStreamReader(errorStream));){
// while ((lines = reader.readLine()) != null) {
// failResult.append(lines);
// }
// } catch (Exception e) {
// log.error("读取Process error流出错:{}",e.toString());
// }
// }).start();
process.waitFor(); process.waitFor();
process.destroy(); process.destroy();
} catch (Exception e) { } catch (Exception e) {
log.error("调用sox出错:{}",e.toString());
} finally {
try { try {
if (process != null) { if (inputStream != null) inputStream.close();
process.getInputStream().close(); if (errorStream != null) errorStream.close();
process.getErrorStream().close(); } catch (IOException e) {
process.getOutputStream().close(); log.error("关闭process的流出错:{}",e.toString());
}
} catch (Exception e1) {
log.error("关闭Process的流出错:{}",e1.toString());
} }
} }
if (successResult.length() == 0) return "1"; if (successResult.length() == 0) return "1";
else { else {
log.error("打印Process的错误流信息:{}", failResult.toString()); log.error("打印Process的错误流信息:{},输入流信息:{}", failResult.toString(), successResult.toString());
return null; return null;
} }
} }
......
...@@ -109,8 +109,4 @@ public class ChangeSound { ...@@ -109,8 +109,4 @@ public class ChangeSound {
Call call = new Call(wavFile, outFile, OFOPTS); Call call = new Call(wavFile, outFile, OFOPTS);
return call(call, selfCommand); return call(call, selfCommand);
} }
public static void main(String[] args) {
System.out.println(Double.parseDouble("0.0") != 0);
}
} }
...@@ -136,17 +136,20 @@ public class OkHttp3Utils { ...@@ -136,17 +136,20 @@ public class OkHttp3Utils {
try (Response response = timeoutClient.newCall(builder.build()).execute()){ try (Response response = timeoutClient.newCall(builder.build()).execute()){
//log.info("doPostTimeout请求返回:{}", response.code()); //log.info("doPostTimeout请求返回:{}", response.code());
// log.info("response3333333 :{}",response.header("usetime")); // log.info("response3333333 :{}",response.header("usetime"));
if (response.code() == 200) { int code = response.code();
if (code == 200) {
if (file != null) { if (file != null) {
try (BufferedSink sink = Okio.buffer(Okio.sink(file))){ try (BufferedSink sink = Okio.buffer(Okio.sink(file))){
sink.writeAll(Objects.requireNonNull(response.body()).source()); sink.writeAll(Objects.requireNonNull(response.body()).source());
codeWithData = new ResponseCodeWithData(response.code()); codeWithData = new ResponseCodeWithData(code);
} }
} else { } else {
codeWithData = new ResponseCodeWithData(response.code(), response.body().string()); codeWithData = new ResponseCodeWithData(code, response.body().string());
}
} }
return codeWithData; return codeWithData;
}
//log.info("response code:{}", code);
return new ResponseCodeWithData(code, "返回响应码不为200");
}catch (SocketTimeoutException e) { }catch (SocketTimeoutException e) {
log.error("捕获到SocketTimeoutException:{}", e.toString()); log.error("捕获到SocketTimeoutException:{}", e.toString());
client.dispatcher().cancelAll(); client.dispatcher().cancelAll();
......
...@@ -53,10 +53,14 @@ public class TTSUtils { ...@@ -53,10 +53,14 @@ public class TTSUtils {
public static File createFileReturnIts(String path) throws IOException { public static File createFileReturnIts(String path) throws IOException {
File file = new File(path); File file = new File(path);
if (!file.exists() || file.isDirectory()) { if (file.exists()) {
if (!file.createNewFile()) return null; if (file.delete()) {
if (file.createNewFile()) return new File(path);
} }
return file; }else {
if (file.createNewFile()) return new File(path);
}
return null;
} }
public static String createFile(String dir, String fileName) { public static String createFile(String dir, String fileName) {
...@@ -96,17 +100,32 @@ public class TTSUtils { ...@@ -96,17 +100,32 @@ public class TTSUtils {
public static String pythonlistToStr(List<String> file_ls) { public static String pythonlistToStr(List<String> file_ls) {
StringBuilder builder = new StringBuilder("['"); StringBuilder builder = new StringBuilder("['");
int ln = file_ls.size();
for (String str : file_ls) { for (String str : file_ls) {
if (--ln == 0) {
builder.append(str).append("']");
} else {
builder.append(str).append("', '"); builder.append(str).append("', '");
} }
String bStr = builder.toString(); }
String res = bStr.substring(0, bStr.length()-3)+"]"; return buildMP3Filename(builder.toString());
return buildMP3Filename(res);
} }
public static boolean doesFileExist(String filePath) { public static boolean doesFileExist(String filePath) {
File file = new File(filePath); File file = new File(filePath);
return file.exists(); if (file.exists()) {
//log.info("文件:{},大小为:{}", filePath, file.length());
if (file.length() == 0) {
if (file.delete()) {
log.info("大小为0的文件:{}, 删除成功",filePath);
} else {
log.info("大小为0的文件:{}, 删除失败",filePath);
}
return false;
}
return true;
}
return false;
} }
...@@ -195,7 +214,7 @@ public class TTSUtils { ...@@ -195,7 +214,7 @@ public class TTSUtils {
public static void combineMp3File(List<String> filePathList, String targetFilepath) public static void combineMp3File(List<String> filePathList, String targetFilepath)
throws IOException { throws IOException {
try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(new File(targetFilepath)));){ try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(new File(targetFilepath)))){
AudioEnumeration<InputStream> audioEnumeration = new AudioEnumeration<>(); AudioEnumeration<InputStream> audioEnumeration = new AudioEnumeration<>();
for (String filepath : filePathList) { for (String filepath : filePathList) {
if (filepath.equals(Initialize.getThirdParty())) { if (filepath.equals(Initialize.getThirdParty())) {
...@@ -262,4 +281,13 @@ public class TTSUtils { ...@@ -262,4 +281,13 @@ public class TTSUtils {
return result; return result;
} }
} }
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<>();
list.add("sagwsahah");
list.add("sgahh");
list.add("wrte2323");
list.add("wrt67868e2323");
pythonlistToStr(list);
}
} }
...@@ -197,7 +197,7 @@ public class Initialize implements InitializingBean { ...@@ -197,7 +197,7 @@ public class Initialize implements InitializingBean {
return SERVER_URL; return SERVER_URL;
} }
static String getAudioDir() { public static String getAudioDir() {
return AUDIO_DIR; return AUDIO_DIR;
} }
......
...@@ -40,7 +40,7 @@ public class LieHuSchedule { ...@@ -40,7 +40,7 @@ public class LieHuSchedule {
LieHuTokenResponse response = JSON.parseObject(liehuTokenRes, LieHuTokenResponse.class); LieHuTokenResponse response = JSON.parseObject(liehuTokenRes, LieHuTokenResponse.class);
if ("success".equals(response.getCode())) { if ("success".equals(response.getCode())) {
LIE_HU_TOKEN = response.getToken(); LIE_HU_TOKEN = response.getToken();
log.info("成功获取到猎户Token:{}", LIE_HU_TOKEN); //log.info("成功获取到猎户Token:{}", LIE_HU_TOKEN);
}else { }else {
log.error("请求猎户Token失败:{}", response.getError()); log.error("请求猎户Token失败:{}", response.getError());
} }
......
spring: spring:
datasource: datasource:
username: root username: tts
password: 3g9^pWQs#ft7 #password: 3g9^pWQs#ft7
password: qiwu@123234aA~
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/TTS url: jdbc:mysql://aliyun-hz1.chewrobot.com:3306/TTS?characterEncoding=utf-8
# username: tts # username: tts
# password: qiwu@123234aA~ # password: qiwu@123234aA~
# driver-class-name: com.mysql.cj.jdbc.Driver # driver-class-name: com.mysql.cj.jdbc.Driver
...@@ -17,9 +18,17 @@ spring: ...@@ -17,9 +18,17 @@ spring:
output: output:
ansi: ansi:
enabled: detect enabled: detect
#logging: logging:
# level: info #path: /home/ubuntu/project/tts/logs
# path: /usr/mqw/logs/tts path: /root/GameEditor/mqw/project/ttsTest/logs
level:
root: info
server: server:
port: 9663 #port: 9663
#port: 8188 port: 8188
\ No newline at end of file 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
server_name=hz1 server_name=hz1
#server_name=aws-nx2 #server_name=aws-nx2
#server_url=http://aws-nx2.chewrobot.com:9663
server_url=http://aliyun-hz1.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 audio_dir=/root/GameEditor/mqw/project/tts/audio
#audio_dir=/usr/GameEditor/mqw/tts/audio
online_sever=http://dev01.centaurstech.com online_sever=http://dev01.centaurstech.com
offline_server=http://aliyun-hz1.chewrobot.com:9001 offline_server=http://dev01.centaurstech.com:9001
#offline_server=http://aliyun-hz1.chewrobot.com:9001
#第三方tts标记 #第三方tts标记
third_party_tts_text =third_party_tts third_party_tts_text =third_party_tts
......
...@@ -25,9 +25,9 @@ public class XiaoAiController { ...@@ -25,9 +25,9 @@ public class XiaoAiController {
@RequestMapping("/xiaoai") @RequestMapping("/xiaoai")
public @ResponseBody XiaoAiResponse xiaoai(@RequestBody XiaoAiRequest request) { public @ResponseBody XiaoAiResponse xiaoai(@RequestBody XiaoAiRequest request) {
log.info("请求:"+request); //log.info("请求:"+request);
XiaoAiResponse response = xiaoAiService.getResponse(request); XiaoAiResponse response = xiaoAiService.getResponse(request);
//log.info("响应:"+response); log.info("响应:"+response);
return response; return response;
// return xiaoAiService.getResponse(request); // return xiaoAiService.getResponse(request);
} }
......
...@@ -27,8 +27,8 @@ public interface Constants { ...@@ -27,8 +27,8 @@ public interface Constants {
interface SKILL_SECURITY { interface SKILL_SECURITY {
//String REDIRECT_URI = "https://xiaodu.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b"; //String REDIRECT_URI = "https://xiaodu.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b";
//String REDIRECT_URI_TEST = "https://xiaodu-dbp.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b"; //String REDIRECT_URI_TEST = "https://xiaodu-dbp.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b";
String REDIRECT_URI = "https://xiaodu.baidu.com/saiya/auth/4fbc7b9112e3a43dc7dbf43fd556929e"; String REDIRECT_URI = "https://xiaodu.baidu.com/saiya/auth/15966f1c8158104bd82712f95d8a1150";
String REDIRECT_URI_TEST = "https://xiaodu-dbp.baidu.com/saiya/auth/4fbc7b9112e3a43dc7dbf43fd556929e"; String REDIRECT_URI_TEST = "https://xiaodu-dbp.baidu.com/saiya/auth/15966f1c8158104bd82712f95d8a1150";
String CLIENT_ID = "aiqiwucom"; String CLIENT_ID = "aiqiwucom";
String CLIENT_SECRET = "miaoquanwei"; String CLIENT_SECRET = "miaoquanwei";
} }
......
...@@ -2,6 +2,7 @@ package ai.qiwu.baidu.xiaodu.controller; ...@@ -2,6 +2,7 @@ package ai.qiwu.baidu.xiaodu.controller;
import ai.qiwu.baidu.xiaodu.common.Constants; import ai.qiwu.baidu.xiaodu.common.Constants;
import ai.qiwu.baidu.xiaodu.common.ProductError; import ai.qiwu.baidu.xiaodu.common.ProductError;
import ai.qiwu.baidu.xiaodu.pojo.product.Pricing;
import ai.qiwu.baidu.xiaodu.pojo.product.Product; import ai.qiwu.baidu.xiaodu.pojo.product.Product;
import ai.qiwu.baidu.xiaodu.pojo.product.UpdateRequestBody; import ai.qiwu.baidu.xiaodu.pojo.product.UpdateRequestBody;
import ai.qiwu.baidu.xiaodu.pojo.product.response.PubDelUpdResponse; import ai.qiwu.baidu.xiaodu.pojo.product.response.PubDelUpdResponse;
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
var name = document.getElementById("name").value; var name = document.getElementById("name").value;
var summary = document.getElementById("summary").value; var summary = document.getElementById("summary").value;
var description = document.getElementById("description").value; var description = document.getElementById("description").value;
var originalPrice = document.getElementById("originalPrice").value; var originalPrice = document.getElementById("originalPrice").value*100;
var price = document.getElementById("price").value; var price = document.getElementById("price").value*100;
var skillId = document.getElementById("skillId").value; var skillId = document.getElementById("skillId").value;
var smallIconUri = document.getElementById("smallIconUri").value; var smallIconUri = document.getElementById("smallIconUri").value;
var largeIconUri = document.getElementById("largeIconUri").value; var largeIconUri = document.getElementById("largeIconUri").value;
...@@ -180,7 +180,7 @@ ...@@ -180,7 +180,7 @@
<p class="introl">商品所属技能</p> <p class="introl">商品所属技能</p>
<select id="skillId" th:value="*{skillId}"> <select id="skillId" th:value="*{skillId}">
<option value="a1d0618b-e1ee-9901-df9d-81179b4006e2">互动小说</option> <option value="a1d0618b-e1ee-9901-df9d-81179b4006e2">互动小说</option>
<option value="3f1ca0e0-5b2d-0a11-7472-b27eaae0fca3">互动天地</option> <option value="f7acbca6-36f7-31b8-1ede-bef78b2127c8">互动天地</option>
</select><br> </select><br>
<p class="introl">版本,默认1.0</p> <p class="introl">版本,默认1.0</p>
......
...@@ -50,6 +50,11 @@ ...@@ -50,6 +50,11 @@
<version>1.2.0</version> <version>1.2.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>2.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.58</version> <version>1.2.58</version>
......
...@@ -3,13 +3,15 @@ package ai.qiwu.com.xiaoduhome; ...@@ -3,13 +3,15 @@ package ai.qiwu.com.xiaoduhome;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
@EntityScan(basePackages = {"ai.qiwu.com.xiaoduhome.entity"}) //@EntityScan(basePackages = {"ai.qiwu.com.xiaoduhome.entity"})
@EnableJpaRepositories(basePackages = {"ai.qiwu.com.xiaoduhome.repository"}) //@EnableJpaRepositories(basePackages = {"ai.qiwu.com.xiaoduhome.repository"})
@EnableScheduling @EnableScheduling
@EnableJpaAuditing
public class XiaoduhomeApplication { public class XiaoduhomeApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
package ai.qiwu.com.xiaoduhome.common;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* @author 苗权威
* @dateTime 19-8-21 下午8:42
*/
@Component
public class BaseHolder implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
BaseHolder.applicationContext = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
public static <T> T getBean(String beanName) {
return (T) applicationContext.getBean(beanName);
}
}
package ai.qiwu.com.xiaoduhome.common;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Properties;
/**
* @author 苗权威
* @dateTime 19-7-30 下午2:40
*/
@Slf4j
public class Config {
private static Properties properties;
static {
String filename = "xiaodu.properties";
properties = new Properties();
try {
properties.load(new InputStreamReader(Config.class.getClassLoader().getResourceAsStream(filename), StandardCharsets.UTF_8));
} catch (Exception e) {
log.error("获取配置文件对象出错:{}", e.toString());
System.exit(1);
}
}
public static String getProperty(String key) {
String value = properties.getProperty(key.trim());
if (StringUtils.isBlank(value)) return null;
return value.trim();
}
public static String getProperty(String key, String defaultValue) {
String value = properties.getProperty(key.trim());
if (StringUtils.isBlank(value)) return defaultValue;
return value.trim();
}
}
...@@ -28,16 +28,57 @@ public interface Constants { ...@@ -28,16 +28,57 @@ public interface Constants {
String PRE_ENTER_PRODUCT = "enter"; String PRE_ENTER_PRODUCT = "enter";
String PRE_PRODUCT_PLAY = "我要玩"; String PRE_PRODUCT_PLAY = "我要玩";
String LOAD_INTRO = "扫描二维码输入手机号获取验证码登录";
String REWARD_FLOWER = "请扫码支付";
interface DPL_COMPONENT_ID {
String FLOWE = "flowe";
String FLOWER_PRODUCT_ID = "190817185926388308";
String FLOWER_LOAD = "flowerLoad";
String PRE_COLLE = "colle";
String COLLEC_ID = "colleAL";
String UN_COLLEC_ID = "colleUn";
String COLLECT_IMAGE_ID = "collectImage";
String COLLECT_TEXT_ID = "collectText";
String PRE_CATEGORY = "categ";
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";
}
interface PRODUCT_INTRO { interface PRODUCT_INTRO {
String CREATE_TIME = "发表时间: "; String CREATE_TIME = "发表时间: ";
String AUTHOR = "作者: "; String AUTHOR = "作者: ";
String LABEL = "相关标签: "; String LABEL = "相关标签: ";
String SPACE = " "; String SPACE = " ";
String USER_SEND_FLOWER = "已赏朵数:";
String FLOWER = "打赏鲜花";
String COLLECED = "已收藏";
String UN_COLLEC = "收藏";
String CHAT_COLLECT = "我要收藏";
String CHAT_UN_COLLECT = "取消收藏";
}
interface CATEGORY_IMG_URL {
String NAME_GU_FENG = "古风";
String NAME_KE_HUAN = "科幻";
String NAME_ZHAN_XING = "占星";
String NAME_LOVE = "恋爱";
String NAME_ZAI_NAN = "灾难";
String NAME_JIA_KONG = "架空";
String NAME_CHILD = "儿童";
String NAME_JING_YING = "经营";
String NAME_MAO_XIAN = "冒险";
String NAME_WU_XIA = "武侠";
String GU_FENG = "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/category1.png";
} }
interface SKILL_SECURITY { interface SKILL_SECURITY {
String REDIRECT_URI = "https://xiaodu.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b"; String REDIRECT_URI = "https://xiaodu.baidu.com/saiya/auth/15966f1c8158104bd82712f95d8a1150";
String REDIRECT_URI_TEST = "https://xiaodu-dbp.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b"; String REDIRECT_URI_TEST = "https://xiaodu-dbp.baidu.com/saiya/auth/15966f1c8158104bd82712f95d8a1150";
String CLIENT_ID = "aiqiwucom"; String CLIENT_ID = "aiqiwucom";
String CLIENT_SECRET = "miaoquanwei"; String CLIENT_SECRET = "miaoquanwei";
} }
...@@ -46,6 +87,7 @@ public interface Constants { ...@@ -46,6 +87,7 @@ public interface Constants {
String WELCOME = "欢迎来到互动天地,这里有海量的作品在这等您"; String WELCOME = "欢迎来到互动天地,这里有海量的作品在这等您";
String BEGIN_NO_RESPONSE = "咋还没开始就停住了,我们这里可有很多好玩的作品哦"; String BEGIN_NO_RESPONSE = "咋还没开始就停住了,我们这里可有很多好玩的作品哦";
String GUIDE_WORD = "请点击或者直接说出您想要玩的作品名"; String GUIDE_WORD = "请点击或者直接说出您想要玩的作品名";
String FAIL_COLLECT = "好像出了什么问题,请再说一遍吧";
} }
interface EndMsg { interface EndMsg {
...@@ -81,6 +123,9 @@ public interface Constants { ...@@ -81,6 +123,9 @@ public interface Constants {
String CAPTCHA_SMS = "https://account-center-test.chewrobot.com/api/captcha/sms"; String CAPTCHA_SMS = "https://account-center-test.chewrobot.com/api/captcha/sms";
String SDK_TOKEN = "https://account-center-test.chewrobot.com/api/sdk/token"; String SDK_TOKEN = "https://account-center-test.chewrobot.com/api/sdk/token";
String GET_USER_INFO_BY_TOKEN ="https://account-center-test.chewrobot.com/api/sdk/user/info"; String GET_USER_INFO_BY_TOKEN ="https://account-center-test.chewrobot.com/api/sdk/user/info";
String FLOWER_INTERFACE = "http://aws-nx2.chewrobot.com:18082/api/flower/count";
String USER_CLOOEC_LIST = "http://aliyun-hz1.chewrobot.com:18082/api/favorite";
String USER_ID_BY_TOKEN = "https://account-center-test.chewrobot.com/api/sdk/user/info";
} }
interface BAI_DU { interface BAI_DU {
...@@ -89,5 +134,4 @@ public interface Constants { ...@@ -89,5 +134,4 @@ public interface Constants {
String BAIDU_AUTHORIZE = "https://openapi.baidu.com/oauth/2.0/authorize?response_type=code&client_id=dSG525LMr887uLlfAyK1C1ag&redirect_uri=https%3A%2F%2Fwww.miaoshop.top%2Fxiaodu%2Fbaidu%2Fcode&confirm_login=1&state=mqw"; String BAIDU_AUTHORIZE = "https://openapi.baidu.com/oauth/2.0/authorize?response_type=code&client_id=dSG525LMr887uLlfAyK1C1ag&redirect_uri=https%3A%2F%2Fwww.miaoshop.top%2Fxiaodu%2Fbaidu%2Fcode&confirm_login=1&state=mqw";
} }
} }
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;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-7-17 下午5:59
*/
@Getter
@Setter
@ToString
public class TokenHolder {
private volatile String userId;
private volatile String accessToken;
private volatile String refreshToken;
private volatile String timestamp;
// private volatile String state;
private volatile Integer expire;
}
package ai.qiwu.com.xiaoduhome.common; package ai.qiwu.com.xiaoduhome.common;
import ai.qiwu.com.xiaoduhome.pojo.Payload;
import ai.qiwu.com.xiaoduhome.pojo.UserInfoByTokenResult;
import com.alibaba.fastjson.JSON;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
...@@ -95,4 +98,9 @@ public class Utils { ...@@ -95,4 +98,9 @@ public class Utils {
str = Base64.encodeBase64String(str.getBytes(StandardCharsets.UTF_8)); str = Base64.encodeBase64String(str.getBytes(StandardCharsets.UTF_8));
return Constants.XIAOWU_API.BASIC_PREFIX + str; return Constants.XIAOWU_API.BASIC_PREFIX + str;
} }
public static void main(String[] args) {
String s = "[{\"type\": \"SendEvent\",\"componentId\":\"%s\"}]";
System.out.println(String.format(s, "gsagh"));
}
} }
package ai.qiwu.com.xiaoduhome.common.config;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
/**
* @author 苗权威
* @dateTime 19-8-22 下午2:23
*/
@Configuration
public class DataSourceConfig {
// @Primary
// @Bean(name = "primaryDatasourceProperties")
// @Qualifier("primaryDatasourceProperties")
// @ConfigurationProperties(prefix = "spring.datasource.primary")
// public DataSourceProperties primaryDatasourceProperties() {
// return new DataSourceProperties();
// }
@Bean("primaryDataSource")
@Primary
@Qualifier("primaryDataSource")
@ConfigurationProperties(prefix = "spring.datasource.primary")
public DataSource primaryDataSource() {
return DataSourceBuilder.create().build();
}
@Bean("secondaryDataSource")
@Qualifier("secondaryDataSource")
@ConfigurationProperties(prefix = "spring.datasource.secondary")
public DataSource secondaryDataSource() {
return DataSourceBuilder.create().build();
}
}
package ai.qiwu.com.xiaoduhome.common.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.util.Map;
/**
* @author 苗权威
* @dateTime 19-8-22 下午2:30
*/
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactoryPrimary",
transactionManagerRef = "transactionManagerPrimary",
basePackages = {"ai.qiwu.com.xiaoduhome.repository.primary"})
public class PrimaryConfig {
@Autowired
@Qualifier("primaryDataSource")
private DataSource primaryDataSource;
@Primary
@Bean(name = "entityManagerFactoryPrimary")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(EntityManagerFactoryBuilder builder,
JpaProperties jpaProperties,
HibernateProperties hibernateProperties) {
Map<String, Object> properties = hibernateProperties.determineHibernateProperties(jpaProperties.getProperties(),
new HibernateSettings());
return builder
.dataSource(primaryDataSource)
.properties(properties)
.packages("ai.qiwu.com.xiaoduhome.entity.primary")
.persistenceUnit("primaryPersistenceUnit")
.build();
}
@Primary
@Bean(name = "entityManagerPrimary")
public EntityManager entityManager(EntityManagerFactoryBuilder builder,
JpaProperties jpaProperties,HibernateProperties hibernateProperties) {
return entityManagerFactoryPrimary(builder, jpaProperties,hibernateProperties).getObject().createEntityManager();
}
@Primary
@Bean(name = "transactionManagerPrimary")
public PlatformTransactionManager transactionManager(EntityManagerFactoryBuilder builder,
JpaProperties jpaProperties,HibernateProperties hibernateProperties) {
return new JpaTransactionManager(entityManagerFactoryPrimary(builder, jpaProperties, hibernateProperties).getObject());
}
}
package ai.qiwu.com.xiaoduhome.common.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManager;
import javax.sql.DataSource;
import java.util.Map;
/**
* @author 苗权威
* @dateTime 19-8-22 下午3:21
*/
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactorySecondary",
transactionManagerRef = "transactionManagerSecondary",
basePackages = {"ai.qiwu.com.xiaoduhome.repository.secondary"})
public class SecondaryConfig {
@Autowired
@Qualifier("secondaryDataSource")
private DataSource secondaryDataSource;
@Bean(name = "entityManagerFactorySecondary")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(EntityManagerFactoryBuilder builder,
JpaProperties jpaProperties,
HibernateProperties hibernateProperties) {
Map<String, Object> properties = hibernateProperties.determineHibernateProperties(jpaProperties.getProperties(),
new HibernateSettings());
return builder
.dataSource(secondaryDataSource)
.properties(properties)
.packages("ai.qiwu.com.xiaoduhome.entity.secondary")
.persistenceUnit("secondaryPersistenceUnit")
.build();
}
@Bean(name = "entityManagerSecondary")
public EntityManager entityManager(EntityManagerFactoryBuilder builder,
JpaProperties jpaProperties, HibernateProperties hibernateProperties) {
return entityManagerFactoryPrimary(builder, jpaProperties,hibernateProperties).getObject().createEntityManager();
}
@Bean(name = "transactionManagerSecondary")
public PlatformTransactionManager transactionManager(EntityManagerFactoryBuilder builder,
JpaProperties jpaProperties, HibernateProperties hibernateProperties) {
return new JpaTransactionManager(entityManagerFactoryPrimary(builder, jpaProperties, hibernateProperties).getObject());
}
}
package ai.qiwu.com.xiaoduhome.controller;
import ai.qiwu.com.xiaoduhome.common.TokenHolder;
import ai.qiwu.com.xiaoduhome.common.Utils;
import ai.qiwu.com.xiaoduhome.pojo.TokenDuerosResponse;
import ai.qiwu.com.xiaoduhome.pojo.User;
import ai.qiwu.com.xiaoduhome.service.LoadBySMS;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;
/**
* 百度的第三方登录基于OAuth2.0的授权码模式,由于郊游天下平台还没有实现该种授权模式给第三方,
* 所以这里便根据OAuth2协议的内容来实现,从而满足Dueros的要求
* 切忌:验证方法enableVerify()一定要开启,否则回调地址会拒绝你
* @author 苗权威
* @dateTime 19-7-18 下午5:55
*/
@Controller
@RequestMapping(value = "/xiaodu/security")
@Slf4j
public class Oauth2Controller {
@Autowired
private LoadBySMS loadBySMS;
/**
* /xiaodu/security/load:这是小度授权信息配置里的“授权地址”,也就是登录卡片点击后跳转到的登录页面地址
* @param state 状态,例如在测试时传来的值是“debug”,在回调时该值若有需要原样返回
* @param scope 用户权限范围
* @param response_type code
* @param redirect_uri 回调地址
* @param client_id 我们设置的Client_id
* @param modelMap 用于传值
* @param request 测试时使用来查看请求头信息的
* @return 返回结果页
*/
@GetMapping("/load")
public String load(@RequestParam(required = false) String state, @RequestParam(required = false) String scope,
@RequestParam String response_type, @RequestParam String redirect_uri,
@RequestParam String client_id, ModelMap modelMap, HttpServletRequest request) {
//Dueros发来的登录请求信息
//HttpRequestUtils.getLoadPageInfo(request);
boolean verifyResult = Utils.verifyLoadRequest(client_id, redirect_uri);
if (!verifyResult) {
log.error("该登录请求不合规:client_id:{},redirect_uri:{}",client_id, redirect_uri);
return "LoadFailed";
}
User user = new User();
user.setState(state);
modelMap.put("userInfo", user);
return "Oauth2_load";
}
@GetMapping("/home")
public String homeLoad(@RequestParam(required = false) String state, @RequestParam(required = false) String scope,
@RequestParam String response_type, @RequestParam String redirect_uri,
@RequestParam String client_id, ModelMap modelMap, HttpServletRequest request) {
//Dueros发来的登录请求信息
//HttpRequestUtils.getLoadPageInfo(request);
boolean verifyResult = Utils.verifyLoadRequest(client_id, redirect_uri);
if (!verifyResult) {
log.error("该登录请求不合规:client_id:{},redirect_uri:{}",client_id, redirect_uri);
return "LoadFailed";
}
User user = new User();
user.setState(state);
modelMap.put("userInfo", user);
return "home_load";
}
/**
* 用户点击获取短信验证码
* @param phoneNumber 电话号码
*/
@RequestMapping("/captcha")
public @ResponseBody
void getCaptcha(@RequestParam String phoneNumber) {
// 校验手机号
// log.info("电话号码:"+phoneNumber);
try {
loadBySMS.requireCaptcha(phoneNumber);
} catch (Exception e) {
log.error("获取验证码出错:{}", e.toString());
}
}
/**
* 用户点击登录后调用该方法,利用电话号码与短信验证码从郊游天下平台获取AccessToken与RefreshToken,
* 之后Oauth2_load页会重定向到回调地址,回调地址在收到后会请求我们设置的Token地址,
* 即/xiaodu/security/accessToken
* @param phoneNumber 电话号码
* @param captcha 短信验证码
* @return 1代表从郊游天下平台获取验证码成功
*/
@RequestMapping("/token")
public @ResponseBody String getAccessToken(@RequestParam String phoneNumber, @RequestParam String captcha) {
// log.info("电话号码:"+phoneNumber+",captcha:"+captcha);
if (StringUtils.isNotEmpty(captcha)) {
// 获取token
boolean result;
try {
result = loadBySMS.requireCodeToken(phoneNumber, captcha);
} catch (IOException e) {
log.error("获取Token出错:{}", e.toString());
result = false;
}
log.info("请求郊游天下Token返回结果:"+result);
if (result) {
return "1";
}else {
log.warn("请求郊游天下Token失败");
return "0";
}
}
else {
return "0";
}
}
/**
* 回调地址会主动请求该地址,我们返回给他Token
* @param grant_type authorization_code
* @param code 授权码
* @param client_id 我们设置的Client_id
* @param client_secret 我们设置的Client_secret
* @param redirect_uri 回调地址
* @return 按规定我们需要返回的信息格式如下:
* {
* "access_token": "ACCESS_TOKEN",
* "expires_in": 1234,
* "refresh_token":"REFRESH_TOKEN"
* }
*/
@RequestMapping("/accessToken")
public @ResponseBody TokenDuerosResponse returnTokenToDueros(@RequestParam String grant_type,
@RequestParam 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);
// 请求会出现发来的消息每个值重复一遍的情况,待解决?
client_id = client_id.substring(client_id.lastIndexOf(",")+1);
client_secret = client_secret.substring(client_secret.lastIndexOf(",")+1);
redirect_uri = redirect_uri.substring(redirect_uri.lastIndexOf(",")+1);
code = code.substring(code.lastIndexOf(",")+1);
boolean verifyResult = Utils.verifyTokenRequest(client_id, client_secret, redirect_uri);
if (!verifyResult) {
log.error("不合规的Token请求");
return null;
}
ConcurrentHashMap<String, TokenHolder> cache = LoadBySMS.getCodeToken();
TokenHolder holder = cache.get(code);
String accessToken;
if (holder == null || (accessToken =holder.getAccessToken())==null) {
log.error("没有对应的令牌");
return null;
}
cache.remove(code);
TokenDuerosResponse response = new TokenDuerosResponse();
response.setAccess_token(accessToken);
response.setRefresh_token(holder.getRefreshToken());
response.setExpires_in(holder.getExpire());
return response;
}
}
...@@ -17,18 +17,20 @@ import java.io.File; ...@@ -17,18 +17,20 @@ import java.io.File;
@RestController @RestController
@Slf4j @Slf4j
public class XiaoDuHomeController { public class XiaoDuHomeController {
@RequestMapping("/xiaoduhome/chat") @RequestMapping("/xiaoduhome/chat")
public String chat() { public String chat() {
try { try {
DplBotService service = new DplBotService(Utils.getHttpServletRequest()); DplBotService service = new DplBotService(Utils.getHttpServletRequest());
//log.info("请求信息:{}", service.getStrRequest()); log.info("请求信息中的attributes:{}", service.getRequest().getSession().getAttributes());
//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) {
log.error("出现错误 "+e.toString()); e.printStackTrace();
//log.error("出现错误 "+e.toString());
} }
return null; return null;
} }
......
package ai.qiwu.com.xiaoduhome.entity.primary;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
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-21 下午4:00
*/
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "app_favorite_tb")
@Data
public class AppFavoriteTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "bot_username")
private String botId;
@Column(name = "user_id")
private Integer userId;
@Column
private Integer module;
@CreatedDate
@Column(name = "gmt_create",nullable = false,updatable = false)
private Date createTime;
@Column(name = "gmt_modified")
@LastModifiedDate
private Date updateTime;
}
package ai.qiwu.com.xiaoduhome.entity.primary;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
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-19 下午8:27
*/
@Entity
@Table(name = "app_flower_tb")
@EntityListeners(AuditingEntityListener.class)
@Data
public class AppFlowerTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column
private Integer module;
@Column(name = "bot_username")
private String botName;
@Column(name = "user_id")
private Integer userId;
@Column(name = "unit_price")
private Double unitPrice;
@Column
private Integer number;
@Column(name = "order_id")
private Integer orderId;
@Column
private Integer status;
@Column(name = "gmt_create")
private Date createTime;
@Column(name = "gmt_modified")
@LastModifiedDate
private Date updateTime;
}
package ai.qiwu.com.xiaoduhome.entity.primary;
import lombok.Data;
import javax.persistence.*;
/**
* @author 苗权威
* @dateTime 19-8-22 下午5:12
*/
@Entity
@Table(name = "app_flower_tb")
@Data
public class AppFlowerTBTiny {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "user_id")
private Integer userId;
@Column(name = "unit_price")
private Double unitPrice;
@Column(name = "bot_username")
private String botId;
@Column
private Integer number;
}
package ai.qiwu.com.xiaoduhome.entity.primary;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.*;
import java.util.Date;
/**
* @author 苗权威
* @dateTime 19-8-19 下午4:20
*/
@Entity
@Table(name = "app_user_tb")
@Getter
@Setter
@ToString
public class AppUserTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "info_id")
private Integer infoId;
@Column(name = "user_phone")
private String phone;
@Column(name = "gmt_create")
private Date createTime;
}
package ai.qiwu.com.xiaoduhome.entity; package ai.qiwu.com.xiaoduhome.entity.primary;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
......
package ai.qiwu.com.xiaoduhome.entity; package ai.qiwu.com.xiaoduhome.entity.primary;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
...@@ -43,6 +43,9 @@ public class OnProductDetail { ...@@ -43,6 +43,9 @@ public class OnProductDetail {
@Column(name = "user_nickname") @Column(name = "user_nickname")
private String authorName; private String authorName;
@Column(name = "bot_id")
private Integer botId;
@Transient @Transient
private List<String> labels; private List<String> labels;
} }
package ai.qiwu.com.xiaoduhome.entity; package ai.qiwu.com.xiaoduhome.entity.primary;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
......
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-22 下午4:23
*/
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "xiaodu_order_tb")
@Data
public class XiaoDuOrderIdTB {
@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 = "unit_price")
private Integer unitPrice;
@Column
private Integer number;
}
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-22 下午3:45
*/
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "xiaodu_order_tb")
@Data
public class XiaoDuOrderTB {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "bot_id")
private String botId;
@Column(name = "app_user_id")
private String appUserId;
@Column(name = "xiaodu_user_id")
private String xiaoduUserId;
@Column(name = "unit_price")
private Integer unitPrice;
@Column
private Integer number;
@Column(name = "order_id")
private String orderId;
@Column
private String timestamp;
@Column(name = "is_buy")
private Boolean isBuy;
@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 lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-7-17 下午6:33
*/
@Getter
@Setter
@ToString
public class CaptchaSmsResponse {
private String message;
private String payload;
private Integer retcode;
private Integer status;
private Long timestamp;
}
package ai.qiwu.com.xiaoduhome.pojo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-8-17 下午5:05
*/
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class CodeMsgData {
private Integer code;
private String msg;
private XiaoWuData data;
}
package ai.qiwu.com.xiaoduhome.pojo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-8-19 上午10:56
*/
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class CollecProduct {
private String worksName; // 作品名称
private String authorName;
private String aipioneerUsername; //作品用户名
}
package ai.qiwu.com.xiaoduhome.pojo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-8-19 下午1:06
*/
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class Payload {
private String infoId;
private String userPhone;
}
package ai.qiwu.com.xiaoduhome.pojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-7-18 下午7:44
*/
@Getter
@Setter
@ToString
public class TokenDuerosResponse {
private String access_token;
private Integer expires_in;
private String refresh_token;
}
package ai.qiwu.com.xiaoduhome.pojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-7-17 下午7:34
*/
@Getter
@Setter
@ToString
public class TokenResponse {
private String accessToken;
private String message;
private String payload;
private String refreshToken;
private String tokenType;
private Integer expire;
private Integer retcode;
private Integer status;
private Long timestamp;
}
package ai.qiwu.com.xiaoduhome.pojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-7-12 下午8:47
*/
@Getter
@Setter
@ToString
public class User {
private String userId;
private String userName;
private String password;
private String phoneNumber;
private String captcha;
private String state;
}
package ai.qiwu.com.xiaoduhome.pojo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-19 上午10:55
*/
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserCollecResult {
private Integer code;
private String msg;
private List<CollecProduct> data;
}
package ai.qiwu.com.xiaoduhome.pojo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-8-19 下午1:03
*/
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserInfoByTokenResult {
private Integer status;
private Integer retcode;
private String message;
private String payload;
}
package ai.qiwu.com.xiaoduhome.pojo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* @author 苗权威
* @dateTime 19-8-17 下午5:07
*/
@Getter
@Setter
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class XiaoWuData {
private String worksName;
private String authorName;
private String aipioneerUsername;
private Integer count;
}
...@@ -17,4 +17,12 @@ public class Event { ...@@ -17,4 +17,12 @@ public class Event {
private String type; private String type;
private String componentId; private String componentId;
private Integer durationInMillisecond; private Integer durationInMillisecond;
public Event() {
}
public Event(String type, String componentId) {
this.type = type;
this.componentId = componentId;
}
} }
...@@ -37,10 +37,16 @@ public class Item { ...@@ -37,10 +37,16 @@ public class Item {
private String color; private String color;
@JsonProperty("padding-left") @JsonProperty("padding-left")
private String paddingLeft; private String paddingLeft;
@JsonProperty("padding-right")
private String paddingRight;
@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 marginBo;
private Boolean looping; private Boolean looping;
private Boolean autoPlay; private Boolean autoPlay;
private String audioType; private String audioType;
...@@ -58,6 +64,8 @@ public class Item { ...@@ -58,6 +64,8 @@ public class Item {
private String position; private String position;
private String top; private String top;
private String left; private String left;
private String bottom;
private String right;
private String headerImage; private String headerImage;
@JsonProperty("flex-direction") @JsonProperty("flex-direction")
private String flexDirection; private String flexDirection;
...@@ -77,4 +85,13 @@ public class Item { ...@@ -77,4 +85,13 @@ public class Item {
private Boolean hasBackIcon; private Boolean hasBackIcon;
private String initialPage; private String initialPage;
@JsonProperty("max-lines")
private Integer maxLines;
@JsonProperty("align-items")
private String alignItems;
@JsonProperty("justify-content")
private String justify;
@JsonProperty("text-overflow")
private String overflow;
} }
package ai.qiwu.com.xiaoduhome.repository; package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.OnProductDetail; import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -9,6 +10,7 @@ import java.util.List; ...@@ -9,6 +10,7 @@ import java.util.List;
* @author 苗权威 * @author 苗权威
* @dateTime 19-8-16 下午6:26 * @dateTime 19-8-16 下午6:26
*/ */
@Repository
public interface AllOnProductInfoRepository extends JpaRepository<OnProductDetail, Integer> { public interface AllOnProductInfoRepository extends JpaRepository<OnProductDetail, Integer> {
List<OnProductDetail> findAllByApplyStatus(Integer applyStatus); List<OnProductDetail> findAllByApplyStatus(Integer applyStatus);
......
package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFavoriteTB;
import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
/**
* @author 苗权威
* @dateTime 19-8-21 下午4:04
*/
@Repository
public interface AppFavoriteTBRepository extends JpaRepository<AppFavoriteTB, Integer> {
@Query(value = "INSERT INTO app_favorite_tb (bot_username,module,user_id,gmt_create,gmt_modified) VALUES (?1, 0, ?2, now(), now())",nativeQuery = true)
void insertFavorite(String botId, Integer userId);
@Query(value = "DELETE FROM app_favorite_tb WHERE bot_username=?1 AND user_id=?2",nativeQuery = true)
void deleteFavorite(String botId, Integer userId);
AppFavoriteTB getByUserId(Integer userId);
@Override
<S extends AppFavoriteTB> boolean exists(Example<S> example);
@Transactional
@Override
<S extends AppFavoriteTB> S save(S s);
@Transactional
void deleteByBotIdAndUserId(String botId, Integer userId);
}
package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFlowerTB;
import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
/**
* @author 苗权威
* @dateTime 19-8-19 下午8:36
*/
@Repository
public interface AppFlowerTBRepository extends JpaRepository<AppFlowerTB, Integer> {
@Query(value = "INSERT INTO app_flower_tb (module,bot_username,user_id,unit_price,number,order_id,status,gmt_create,gmt_modified) VALUES (0,?1,?2,1,1,?3,1,?4,?4)",nativeQuery = true)
void insertOrder(String botId, String userId, String orderId, String time);
@Override
<S extends AppFlowerTB> S save(S s);
@Override
<S extends AppFlowerTB> boolean exists(Example<S> example);
}
package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppFlowerTBTiny;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author 苗权威
* @dateTime 19-8-22 下午5:18
*/
@Repository
public interface AppFlowerTBTintRepository extends JpaRepository<AppFlowerTBTiny, Integer> {
AppFlowerTBTiny getByUserIdAndBotIdAndUnitPrice(Integer userId, String botId, Double unitPrice);
List<AppFlowerTBTiny> getByUserIdAndBotId(Integer userId, String botId);
}
package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.primary.AppUserTB;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
/**
* @author 苗权威
* @dateTime 19-8-19 下午7:29
*/
@Repository
public interface AppUserTBRepository extends JpaRepository<AppUserTB, Integer> {
AppUserTB getByPhone(String phone);
@Query(value = "INSERT INTO app_user_tb (user_phone,gmt_create) VALUES (?1, now())", nativeQuery = true)
void insertUser(String phone);
}
package ai.qiwu.com.xiaoduhome.repository; package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.GameProjectTb; import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -11,6 +12,7 @@ import java.util.List; ...@@ -11,6 +12,7 @@ import java.util.List;
* @author 苗权威 * @author 苗权威
* @dateTime 19-8-14 下午9:05 * @dateTime 19-8-14 下午9:05
*/ */
@Repository
public interface GameProjectTbRepository extends JpaRepository<GameProjectTb, Integer> { public interface GameProjectTbRepository extends JpaRepository<GameProjectTb, Integer> {
List<GameProjectTb> findFirst15ByApplyStatusOrderByWatchDesc(Integer applyStatus); List<GameProjectTb> findFirst15ByApplyStatusOrderByWatchDesc(Integer applyStatus);
......
package ai.qiwu.com.xiaoduhome.repository; package ai.qiwu.com.xiaoduhome.repository.primary;
import ai.qiwu.com.xiaoduhome.entity.ProjectLabel; import ai.qiwu.com.xiaoduhome.entity.primary.ProjectLabel;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -11,6 +12,7 @@ import java.util.List; ...@@ -11,6 +12,7 @@ import java.util.List;
* @author 苗权威 * @author 苗权威
* @dateTime 19-8-15 下午4:03 * @dateTime 19-8-15 下午4:03
*/ */
@Repository
public interface ProjectLabelRepository extends JpaRepository<ProjectLabel, Integer> { public interface ProjectLabelRepository extends JpaRepository<ProjectLabel, Integer> {
@Query(value = "SELECT name FROM game_project_label_tb WHERE project_id = :productId", nativeQuery = true) @Query(value = "SELECT name FROM game_project_label_tb WHERE project_id = :productId", nativeQuery = true)
......
package ai.qiwu.com.xiaoduhome.repository.secondary;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuOrderIdTB;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
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);
@Transactional
@Override
<S extends XiaoDuOrderIdTB> S save(S s);
}
\ No newline at end of file
package ai.qiwu.com.xiaoduhome.repository.secondary;
import ai.qiwu.com.xiaoduhome.entity.secondary.XiaoDuOrderTB;
import org.springframework.data.domain.Example;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
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);
@Transactional
@Override
<S extends XiaoDuOrderTB> S save(S s);
}
package ai.qiwu.com.xiaoduhome.service;
import ai.qiwu.com.xiaoduhome.common.Constants.XIAOWU_API;
import ai.qiwu.com.xiaoduhome.common.OkHttp3Utils;
import ai.qiwu.com.xiaoduhome.common.TokenHolder;
import ai.qiwu.com.xiaoduhome.common.Utils;
import ai.qiwu.com.xiaoduhome.entity.primary.AppUserTB;
import ai.qiwu.com.xiaoduhome.pojo.CaptchaSmsResponse;
import ai.qiwu.com.xiaoduhome.pojo.TokenResponse;
import ai.qiwu.com.xiaoduhome.repository.primary.AppUserTBRepository;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
/**
* 处理验证码,令牌的请求
* @author 苗权威
* @dateTime 19-7-17 下午5:53
*/
@Service
@Slf4j
public class LoadBySMS {
// private static final ConcurrentHashMap<String, TokenHolder> USER_TOKEN = new ConcurrentHashMap<>();
private final AppUserTBRepository appUserTBRepository;
/**
* 手机号到TOKEN信息之间的映射
*/
private static final ConcurrentHashMap<String, TokenHolder> CODE_TOKEN = new ConcurrentHashMap<>();
@Autowired
public LoadBySMS(AppUserTBRepository appUserTBRepository) {
this.appUserTBRepository = appUserTBRepository;
}
// /**
// * 登录成功后每次请求都会携带AccessToken,这里存储AccessToken到手机号的映射,用于之后令牌过期取RefreshToken使用
// */
// private static final ConcurrentHashMap<String, String> ACCESSTOKEN_PHONENUM = new ConcurrentHashMap<>();
/**
* 通过电话号码获取短信验证码
* @param phoneNumber
* @return 是否成功获取
* @throws IOException
*/
public Boolean requireCaptcha(String phoneNumber) throws IOException {
// 校验手机号
phoneNumber = phoneNumber.trim();
if (!Utils.verifyPhoneNumber(phoneNumber)) {
return false;
}
String authorization = Utils.captchaAuthorization(phoneNumber);
int retCode = getCaptchaRequest(authorization);
if (retCode == 0) {
new Thread(new InsertUserInfoToAppUserTB(phoneNumber)).start();
}
return retCode == 0;
}
class InsertUserInfoToAppUserTB implements Runnable {
String phone;
InsertUserInfoToAppUserTB(String phone) {
this.phone = phone;
}
@Override
public void run() {
AppUserTB userInfo = appUserTBRepository.getByPhone(phone);
if (userInfo == null) {
appUserTBRepository.insertUser(phone);
}
}
}
// 该方法用于TextCard触发登录以绕过小度的第三方登录模式
// public Boolean requireToken(String phoneNumber, String captcha, String userId) throws IOException {
// // 获取token
// Request request = new Request.Builder().url(XIAOWU_API.SDK_TOKEN)
// .addHeader("App-Channel-Id", "JIAOYOUTIANXIA")
// .addHeader("Authorization", tokenAuthorization(phoneNumber, captcha))
// .addHeader("Content-Type","application/json; charset=utf-8")
// .get().build();
// try (Response response = client.newCall(request).execute()){
// log.info("获取Token返回");
// TokenResponse tokenResponse = JSON.parseObject(response.body().string(), TokenResponse.class);
// log.info("获取Token返回信息:{}", tokenResponse);
// if (tokenResponse.getRetcode() == 0) {
// updateUserToken(userId, tokenResponse);
// return true;
// }else {
// return false;
// }
// }
// }
/**
* Oauth2Controller类调用的方法,根据电话号码与短信验证码向郊游天下请求令牌
* 我们将令牌信息与电话号码间构成map,用于之后Dueros请求Token时查找
* @param phoneNumber
* @param captcha 验证码
* @return 是否成功从平台获取到令牌信息
* @throws IOException
*/
public boolean requireCodeToken(String phoneNumber, String captcha) throws IOException {
HashMap<String, String> headers = new HashMap<>();
headers.put("App-Channel-Id", "JIAOYOUTIANXIA");
headers.put("Content-Type", "application/json;charset=utf-8");
headers.put("Authorization", Utils.tokenAuthorization(phoneNumber, captcha));
String tokenStr = OkHttp3Utils.doGet(XIAOWU_API.SDK_TOKEN, new HashMap<>(), headers);
// log.info("获取Token返回");
TokenResponse tokenResponse = JSON.parseObject(tokenStr, TokenResponse.class);
log.info("获取Token返回信息:{}", tokenResponse);
if (tokenResponse.getRetcode() == 0) {
updateCodeToken(phoneNumber, tokenResponse);
return true;
}else {
return false;
}
}
/**
* 发起验证码获取请求
* @param authorization
* @throws IOException
*/
private Integer getCaptchaRequest(String authorization) throws IOException {
HashMap<String, String> headers = new HashMap<>();
headers.put("App-Channel-Id", "JIAOYOUTIANXIA");
headers.put("Content-Type", "application/json;charset=utf-8");
headers.put("Authorization", authorization);
String smsStr = OkHttp3Utils.doGet(XIAOWU_API.CAPTCHA_SMS, new HashMap<>(), headers);
// log.info("发送验证码成功");
CaptchaSmsResponse captchaResponse = JSON.parseObject(smsStr, CaptchaSmsResponse.class);
// log.info("获取验证码返回信息:{}", captchaResponse);
return captchaResponse.getRetcode();
}
//该方法是更新USER_TOKEN的
// private void updateUserToken(String userId, TokenResponse tokenResponse) {
// TokenHolder tokenHolder = USER_TOKEN.get(userId);
// if (tokenHolder == null) {
// tokenHolder = new TokenHolder();
// }
// tokenHolder.setUserId(userId);
// tokenHolder.setAccessToken(tokenResponse.getAccessToken());
// tokenHolder.setRefreshToken(tokenResponse.getRefreshToken());
// }
/**
* 更新token缓存信息
* @param phoneNumber
* @param tokenResponse
*/
private void updateCodeToken(String phoneNumber, TokenResponse tokenResponse) {
TokenHolder tokenHolder = CODE_TOKEN.get(phoneNumber);
if (tokenHolder == null) {
tokenHolder = new TokenHolder();
CODE_TOKEN.put(phoneNumber, tokenHolder);
}
tokenHolder.setExpire(tokenResponse.getExpire());
tokenHolder.setAccessToken(tokenResponse.getAccessToken());
tokenHolder.setRefreshToken(tokenResponse.getRefreshToken());
}
// static ConcurrentHashMap<String, TokenHolder> getUserToken() {
// return USER_TOKEN;
// }
/**
* 获取code-token的缓存map
* @return
*/
public static ConcurrentHashMap<String, TokenHolder> getCodeToken() {
return CODE_TOKEN;
}
// /**
// * 获取accesstoken-phonenumber的缓存map
// * @return
// */
// public static ConcurrentHashMap<String, String> getAccesstokenPhonenum() {
// return ACCESSTOKEN_PHONENUM;
// }
}
...@@ -29,6 +29,7 @@ class RequestTerminal { ...@@ -29,6 +29,7 @@ class RequestTerminal {
headers.put("Content-Type", "application/json;charset=utf-8"); headers.put("Content-Type", "application/json;charset=utf-8");
log.info("向小悟发送的请求信息:{}", requestJsonStr); log.info("向小悟发送的请求信息:{}", requestJsonStr);
String resStr = OkHttp3Utils.doPostJsonStr(Constants.QI_WU_INTERFACE, headers, requestJsonStr); String resStr = OkHttp3Utils.doPostJsonStr(Constants.QI_WU_INTERFACE, headers, requestJsonStr);
log.info("返回信息:{}", resStr);
return JSON.parseObject(resStr, QiWuResponse.class); return JSON.parseObject(resStr, QiWuResponse.class);
} }
} }
package ai.qiwu.com.xiaoduhome.service; package ai.qiwu.com.xiaoduhome.service;
import ai.qiwu.com.xiaoduhome.entity.GameProjectTb; import ai.qiwu.com.xiaoduhome.entity.primary.GameProjectTb;
import ai.qiwu.com.xiaoduhome.entity.OnProductDetail; import ai.qiwu.com.xiaoduhome.entity.primary.OnProductDetail;
import ai.qiwu.com.xiaoduhome.repository.AllOnProductInfoRepository; import ai.qiwu.com.xiaoduhome.repository.primary.AllOnProductInfoRepository;
import ai.qiwu.com.xiaoduhome.repository.GameProjectTbRepository; import ai.qiwu.com.xiaoduhome.repository.primary.GameProjectTbRepository;
import ai.qiwu.com.xiaoduhome.repository.ProjectLabelRepository; import ai.qiwu.com.xiaoduhome.repository.primary.ProjectLabelRepository;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -28,8 +28,8 @@ public class ScheduleService implements InitializingBean { ...@@ -28,8 +28,8 @@ public class ScheduleService implements InitializingBean {
static volatile List<OnProductDetail> ALL_ON_PRODUCT = new ArrayList<>(); static volatile List<OnProductDetail> ALL_ON_PRODUCT = new ArrayList<>();
static final HashMap<String, OnProductDetail> PRODUCT_NAME_DETAIL = new HashMap<>(); static final HashMap<String, OnProductDetail> PRODUCT_NAME_DETAIL = new HashMap<>();
//static final Map<String, List<String>> PRODUCT_LABELS = new HashMap<>(); //static final Map<String, List<String>> PRODUCT_LABELS = new HashMap<>();
private static final String[] CATEGORY = {"古风", "科幻", "占星", "恋爱", "灾难", "架空", "儿童", "经营", "冒险", "武侠"}; static final String[] CATEGORY = {"古风", "科幻", "占星", "恋爱", "灾难", "架空", "儿童", "经营", "冒险", "武侠"};
private static final ConcurrentHashMap<String, List<GameProjectTb>> CATEGORY_PRODUCT_LIST = new ConcurrentHashMap<>(); static final ConcurrentHashMap<String, List<GameProjectTb>> CATEGORY_PRODUCT_LIST = new ConcurrentHashMap<>();
private final GameProjectTbRepository gameProjectTbRepository; private final GameProjectTbRepository gameProjectTbRepository;
......
...@@ -3,10 +3,17 @@ server: ...@@ -3,10 +3,17 @@ server:
spring: spring:
datasource: datasource:
primary:
jdbc-url: jdbc:mysql://localhost:3306/game_editor_db?useUnicode=true&characterEncoding=utf-8
username: root username: root
password: 3g9^pWQs#ft7 password: 3g9^pWQs#ft7
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/game_editor_db?characterEncoding=utf-8 secondary:
jdbc-url: jdbc:mysql://localhost:3306/interface_db?useUnicode=true&characterEncoding=utf-8
username: root
password: 3g9^pWQs#ft7
driver-class-name: com.mysql.cj.jdbc.Driver
# username: root # username: root
# password: mysql # password: mysql
# driver-class-name: com.mysql.cj.jdbc.Driver # driver-class-name: com.mysql.cj.jdbc.Driver
......
{
"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",
"justify-content": "center",
"margin-left": "40dp",
"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",
"letter-spacing": "3dp",
"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": "Image",
"position": "absolute",
"componentId": "loadingPage",
"top": "0dp",
"left": "0dp",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/Loading.png",
"height": "100%",
"width": "100%",
"onLoaded": [
{
"type": "SendEvent",
"componentId": "loadingPage"
}
]
}
]
}
}
\ No newline at end of file
...@@ -13,6 +13,13 @@ ...@@ -13,6 +13,13 @@
"width": "100%", "width": "100%",
"initialPage":"0", "initialPage":"0",
"componentId": "whole", "componentId": "whole",
"onLoaded": [
{
"type": "AutoPage",
"componentId": "whole",
"durationInMillisecond": 3000
}
],
"items": [ "items": [
{ {
"type": "Image", "type": "Image",
...@@ -34,7 +41,6 @@ ...@@ -34,7 +41,6 @@
"type": "Image", "type": "Image",
"position": "absolute", "position": "absolute",
"left": "0dp", "left": "0dp",
"opacity": "0.5",
"top": "0dp", "top": "0dp",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg", "src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg",
"height": "100%", "height": "100%",
......
{
"type": "DPL",
"version": "1.0",
"mainTemplate": {
"parameters": [
"payload"
],
"items": [
{
"type": "Image",
"position": "absolute",
"top": "0dp",
"left": "0dp",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg",
"height": "100%",
"width": "100%"
},
{
"type": "Container",
"height": "100%",
"width": "100%",
"padding-right": "20dp",
"componentId": "whole",
"items": [
{
"type": "Header",
"headerImage": "https://aliyun-hz1.chewrobot.com/xiaodu/image/5b2d0a11/lvzhou/15640330891628686.jpg",
"headerTitle": "交游天下"
},
{
"type": "ScrollView",
"direction": "vertical",
"height": "100%",
"width": "100%",
"items": [
{
"type": "Container",
"height": "250dp",
"width": "100%",
"items": [
{
"type": "List",
"height": "250dp",
"width": "100%",
"direction": "horizontal",
"items": [
{
"type": "Container",
"align-items": "center",
"justify-content": "center",
"margin-left": "30dp",
"items": [
{
"type": "Image",
"componentId": "${data.imageId}",
"width": "160dp",
"height": "160dp",
"border-radius": "15dp",
"src": "${data.imageSrc}",
"scale-type": "fitXY",
"onClick": [
{
"type": "SendEvent",
"componentId": "${data.imageId}"
}
]
},
{
"type": "Text",
"font-size": "24dp",
"letter-spacing": "3dp",
"margin-top": "10dp",
"text": "${data.imageName}"
}
]
}
]
}
]
},
{
"type": "Container",
"height": "250dp",
"width": "100%",
"items": [
{
"type": "List",
"height": "100%",
"width": "100%",
"direction": "horizontal",
"items": [
{
"type": "Container",
"margin-left": "30dp",
"align-items": "center",
"justify-content": "center",
"items": [
{
"type": "Image",
"componentId": "${data.imageId}",
"width": "160dp",
"height": "160dp",
"border-radius": "15dp",
"src": "${data.imageSrc}",
"scale-type": "fitXY",
"onClick": [
{
"type": "SendEvent",
"componentId": "${data.imageId}"
}
]
},
{
"type": "Text",
"font-size": "24dp",
"letter-spacing": "3dp",
"margin-top": "10dp",
"text": "${data.imageName}"
}
]
}
]
}
]
},
{
"type": "Container",
"height": "250dp",
"width": "100%",
"items": [
{
"type": "List",
"height": "100%",
"width": "100%",
"direction": "horizontal",
"items": [
{
"type": "Container",
"align-items": "center",
"justify-content": "center",
"margin-left": "30dp",
"items": [
{
"type": "Image",
"componentId": "${data.imageId}",
"width": "160dp",
"height": "160dp",
"border-radius": "15dp",
"src": "${data.imageSrc}",
"scale-type": "fitXY",
"onClick": [
{
"type": "SendEvent",
"componentId": "${data.imageId}"
}
]
},
{
"type": "Text",
"font-size": "24dp",
"letter-spacing": "3dp",
"margin-top": "10dp",
"text": "${data.imageName}"
}
]
}
]
}
]
},
{
"type": "Container",
"height": "50dp",
"width": "100%"
}
]
}
]
}
]
}
}
\ No newline at end of file
...@@ -7,27 +7,15 @@ ...@@ -7,27 +7,15 @@
], ],
"items": [ "items": [
{ {
"type": "Container",
"height": "100%",
"width": "100%",
"componentId": "whole",
"items": [
{
"type": "Image", "type": "Image",
"position": "absolute", "position": "absolute",
"top": "0dp", "top": "0dp",
"left": "0dp", "left": "0dp",
"opacity":"0.4",
"src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg", "src": "https://aliyun-hz1.chewrobot.com/xiaoduhome/image/backend.jpg",
"height": "100%", "height": "100%",
"width": "100%" "width": "100%"
}, },
{ {
"type": "Container",
"width": "100%",
"height": "100%",
"items": [
{
"type": "Header", "type": "Header",
"headerTitle": "交游天下", "headerTitle": "交游天下",
"headerImage": "https://aliyun-hz1.chewrobot.com/xiaodu/image/5b2d0a11/lvzhou/15640330891628686.jpg", "headerImage": "https://aliyun-hz1.chewrobot.com/xiaodu/image/5b2d0a11/lvzhou/15640330891628686.jpg",
...@@ -35,14 +23,30 @@ ...@@ -35,14 +23,30 @@
}, },
{ {
"type": "Container", "type": "Container",
"height": "80%", "height": "100%",
"width": "100%",
"componentId": "whole",
"onClick": [
{
"type": "SendEvent",
"componentId": "continues"
}
],
"items": [
{
"type": "Container",
"width": "100%",
"height": "100%",
"items": [
{
"type": "Container",
"height": "280dp",
"width": "90%", "width": "90%",
"margin-left": "5%", "align-items": "flex-end",
"margin-top": "5%",
"items": [ "items": [
{ {
"type": "Text", "type": "Text",
"font-size": "45dp", "font-size": "35dp",
"font-style": "normal", "font-style": "normal",
"letter-spacing": "3dp" "letter-spacing": "3dp"
} }
...@@ -55,7 +59,7 @@ ...@@ -55,7 +59,7 @@
"componentId": "audio", "componentId": "audio",
"looping": "false", "looping": "false",
"autoplay": "true", "autoplay": "true",
"onPrepared": [ "onEnd": [
{ {
"type": "SendEvent", "type": "SendEvent",
"componentId": "audio" "componentId": "audio"
...@@ -63,6 +67,21 @@ ...@@ -63,6 +67,21 @@
] ]
} }
] ]
},
{
"type": "Container",
"position": "absolute",
"width": "100%",
"left": "0",
"bottom": "0",
"items": [
{
"type": "Footer",
"hints": [
"送花","收藏作品","回到首页"
]
}
]
} }
] ]
} }
......
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Title</title>
</head>
<body>
<span>登录失败,请返回</span>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>登录</title>
<script type="text/javascript">
function getToken() {
var state = document.getElementById("state").value;
var phoneNum = document.getElementById("phoneNum").value;
var captcha = document.getElementById("getCaptcha").value;
// alert("phone:"+phoneNum+",captcha:"+captcha);
var ajaxObj = new XMLHttpRequest();
//var uri = '/xiaodu/security/token?phoneNumber='+phoneNum+'&captcha='+captcha;
ajaxObj.open('get', '/xiaodu/security/token?phoneNumber='+phoneNum+'&captcha='+captcha);
ajaxObj.send();
ajaxObj.onreadystatechange = function () {
if (ajaxObj.readyState === 4 && ajaxObj.status === 200) {
if (ajaxObj.responseText === "1") {
// alert(1);
//var redirectUri = "https://xiaodu-dbp.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b?code="+phoneNum;
//var redirectUri = "https://xiaodu.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b?code="+phoneNum;
var redirectUri = "https://xiaodu-dbp.baidu.com/saiya/auth/15966f1c8158104bd82712f95d8a1150?code="+phoneNum;
if (state !== undefined && state !== null && state !== "") {
redirectUri = redirectUri + "&state"+state;
}
window.location.href = redirectUri;
}
}
}
}
function getCaptcha() {
var phoneNum = document.getElementById("phoneNum").value;
var ajaxObj = new XMLHttpRequest();
ajaxObj.open('get', '/xiaodu/security/captcha?phoneNumber='+phoneNum);
ajaxObj.send();
ajaxObj.onreadystatechange = function () {
if (ajaxObj.readyState === 4 && ajaxObj.status === 200) {
document.getElementById("captchaView").hidden = true;
document.getElementById("tokenView").hidden = false;
}
}
}
</script>
<style type="text/css">
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #eee;
margin:0;
}
.container {
width: 80%;
padding-left: 15px;
padding-right: 15px;
margin-right: auto;
margin-left: auto;
}
.whole {
text-align: center;
padding: 10px;
margin: 0 auto;
}
.title {
margin-top: 20px;
margin-bottom: 10px;
font-size: 26px;
}
.input {
margin-bottom: -1px;
border-radius: 4px;
height: auto;
width: 88%;
padding: 10px;
font-size: 16px;
color: #555;
background-color: #fff;
border:1px solid #ccc;
}
.click {
display: block;
font-size: 16px;
border-radius: 4px;
color: #fff;
background-color: #337ab7;
padding: 6px 12px;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
border: 1px solid transparent;
margin:10px auto;
width: 96%;
}
</style>
</head>
<body>
<div class="container">
<input type="text" id="state" th:hidden="true" th:default="*{userInfo.state}"/>
<div class="whole" th:hidden="false" id="captchaView">
<h2 class="title">获取验证码</h2>
<input type="text" id="phoneNum" name="phone" class="input" placeholder="请输入手机号"/>
<input type="button" onclick="getCaptcha()" name="captcha" id="captcha" class="click" value="点击获取验证码"/>
</div>
<div class="whole" th:hidden="true" id="tokenView">
<h2 class="title">请输入验证码</h2>
<input type="text" id="getCaptcha" name="phone" class="input" placeholder="请输入短信验证码"/>
<input type="button" id="toLoad" name="to_load" class="click" value="点击登录" onclick="getToken()"/>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>登录</title>
<script type="text/javascript">
function getToken() {
var state = document.getElementById("state").value;
var phoneNum = document.getElementById("phoneNum").value;
var captcha = document.getElementById("getCaptcha").value;
// alert("phone:"+phoneNum+",captcha:"+captcha);
var ajaxObj = new XMLHttpRequest();
//var uri = '/xiaodu/security/token?phoneNumber='+phoneNum+'&captcha='+captcha;
ajaxObj.open('get', '/xiaodu/security/token?phoneNumber='+phoneNum+'&captcha='+captcha);
ajaxObj.send();
ajaxObj.onreadystatechange = function () {
if (ajaxObj.readyState === 4 && ajaxObj.status === 200) {
if (ajaxObj.responseText === "1") {
// alert(1);
//var redirectUri = "https://xiaodu-dbp.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b?code="+phoneNum;
//var redirectUri = "https://xiaodu.baidu.com/saiya/auth/3428011e7f55ec4c10b2da1b00a1675b?code="+phoneNum;
var redirectUri = "https://xiaodu-dbp.baidu.com/saiya/auth/15966f1c8158104bd82712f95d8a1150?code="+phoneNum;
if (state !== undefined && state !== null && state !== "") {
redirectUri = redirectUri + "&state"+state;
}
window.location.href = redirectUri;
}
}
}
}
function getCaptcha() {
var phoneNum = document.getElementById("phoneNum").value;
var ajaxObj = new XMLHttpRequest();
ajaxObj.open('get', '/xiaodu/security/captcha?phoneNumber='+phoneNum);
ajaxObj.send();
ajaxObj.onreadystatechange = function () {
if (ajaxObj.readyState === 4 && ajaxObj.status === 200) {
document.getElementById("captchaView").hidden = true;
document.getElementById("tokenView").hidden = false;
}
}
}
</script>
<style type="text/css">
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #eee;
margin:0;
}
.container {
margin-top: 200px;
width: 80%;
padding-left: 15px;
padding-right: 15px;
margin-right: auto;
margin-left: auto;
}
.whole {
text-align: center;
padding: 10px;
margin: 0 auto;
}
.title {
margin-top: 20px;
margin-bottom: 30px;
font-size: 40px;
}
.input {
margin-bottom: -1px;
border-radius: 4px;
height: 80px;
width: 88%;
padding: 10px;
font-size: 40px;
color: #555;
background-color: #fff;
border:1px solid #ccc;
}
.click {
display: block;
font-size: 40px;
border-radius: 4px;
color: #fff;
background-color: #337ab7;
padding: 6px 12px;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
border: 1px solid transparent;
margin: 50px auto;
width: 90%;
height: 80px;
}
</style>
</head>
<body>
<div class="container">
<input type="text" id="state" th:hidden="true" th:default="*{userInfo.state}"/>
<div class="whole" th:hidden="false" id="captchaView">
<h2 class="title">获取验证码</h2>
<input type="text" id="phoneNum" name="phone" class="input" placeholder="请输入手机号"/>
<input type="button" onclick="getCaptcha()" name="captcha" id="captcha" class="click" value="点击获取验证码"/>
</div>
<div class="whole" th:hidden="true" id="tokenView">
<h2 class="title">请输入验证码</h2>
<input type="text" id="getCaptcha" name="phone" class="input" placeholder="请输入短信验证码"/>
<input type="button" id="toLoad" name="to_load" class="click" value="点击登录" onclick="getToken()"/>
</div>
</div>
</body>
</html>
\ No newline at end of file
unitPrice=1
\ 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