Skip to content
Snippets Groups Projects
Commit 6778b015 authored by Jozef Bugos's avatar Jozef Bugos
Browse files

adding docckerfile and fixing not foudn error

parent e486927f
No related branches found
No related tags found
No related merge requests found
FROM adoptopenjdk/openjdk11:latest
VOLUME /tmp
COPY run.sh .
COPY target/*.jar app.jar
ENTRYPOINT ["run.sh"]
\ No newline at end of file
version: '2'
services:
lol:
container_name: lol
build:
context: docker
dockerfile: Dockerfile
image: lol:latest
ports:
- 18888:8888
networks:
- spring-cloud-network
# product-server:
# container_name: product-server
# build:
# context: docker-product-server
# dockerfile: Dockerfile
# image: product-server:latest
# ports:
# - 19999:9999
# networks:
# - spring-cloud-network
networks:
spring-cloud-network:
driver: bridge
\ No newline at end of file
run.sh 0 → 100644
#!/bin/sh
exec java -jar /app.jar
\ No newline at end of file
...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
@RestController @RestController
...@@ -78,8 +79,12 @@ public class RiotController { ...@@ -78,8 +79,12 @@ public class RiotController {
final String uriHistory = "https://" + server + ".api.riotgames.com/lol/match/v4/matchlists/by-account/" + id + "?endIndex=" + endIndex + "&beginIndex=" + beginIndex + timeParams + "&queue=" + queue + "&api_key=" + key; final String uriHistory = "https://" + server + ".api.riotgames.com/lol/match/v4/matchlists/by-account/" + id + "?endIndex=" + endIndex + "&beginIndex=" + beginIndex + timeParams + "&queue=" + queue + "&api_key=" + key;
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
MatchesBean result = restTemplate.getForObject(uriHistory, MatchesBean.class); try {
return result; MatchesBean result = restTemplate.getForObject(uriHistory, MatchesBean.class);
return result;
} catch (HttpClientErrorException ex) {
return new MatchesBean();
}
} }
private MatchDetailBean getMatchDetail(String server, String id) { private MatchDetailBean getMatchDetail(String server, String id) {
...@@ -94,6 +99,9 @@ public class RiotController { ...@@ -94,6 +99,9 @@ public class RiotController {
private StatsBean getStatsForPlayer(String server, String userId, long timestamp, String summonerName, int team) { private StatsBean getStatsForPlayer(String server, String userId, long timestamp, String summonerName, int team) {
MatchesBean matches = getMatchHistory(server, userId, 1, timestamp); MatchesBean matches = getMatchHistory(server, userId, 1, timestamp);
int games = 0, wins = 0, streak = 0; int games = 0, wins = 0, streak = 0;
if(matches.getMatches() == null) {
return new StatsBean(summonerName, team, games, streak, false, 0);
}
boolean isWinStreak = true; boolean isWinStreak = true;
boolean isStreak = true; boolean isStreak = true;
for (MatchBean match : matches.getMatches()) { for (MatchBean match : matches.getMatches()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment