Commit 57a2467f authored by liming's avatar liming

增加自动创建比赛接口

parent 319da40b
......@@ -10,6 +10,7 @@ import com.antai.sport.http.server.repository.sport.entity.SportUser;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.client.RestTemplate;
......@@ -28,6 +29,8 @@ import java.util.List;
public class MatchBicycleService extends ServiceImpl<MatchBicycleMapper, MatchBicycle> {
@Resource
private MatchBicycleBusinessMapper matchBicycleBusinessMapper;
@Value("${game-server-address}")
private String gameServerAddress;
public Long saveMatchBicycle(@RequestBody ReqMatchBicycleSave data) {
if (StringUtils.isBlank(data.getName())) {
......@@ -96,7 +99,7 @@ public class MatchBicycleService extends ServiceImpl<MatchBicycleMapper, MatchBi
}
//调用游戏服务端的暂停接口
RestTemplate restTemplate = new RestTemplate();
restTemplate.getForObject("http://47.100.168.51:3333/close?MatchId=force",String.class);
restTemplate.getForObject(gameServerAddress,String.class);
//创建一场新的比赛 创建比赛规则:进入时间=当前时间+1分钟 开始时间=进入时间+1分钟 结束时间=开始时间+20分钟
MatchBicycle match = new MatchBicycle();
......
......@@ -12,3 +12,5 @@ spring:
swagger:
enable: true
game-server-address: http://47.100.168.51:3333/close?MatchId=force
\ No newline at end of file
server:
port: 8080
spring:
profiles:
include:
- common-db-local
redis:
database: 1
host: 127.0.0.1
port: 6379
password: 123456
swagger:
enable: true
game-server-address: http://127.0.0.1:3333/close?MatchId=force
\ No newline at end of file
......@@ -6,4 +6,6 @@ spring:
database: 0
host: 127.0.0.1
port: 6379
password: ENC(yKZoKLWfAj6BRglq4C2HWWjsL64maeCm)
\ No newline at end of file
password: ENC(yKZoKLWfAj6BRglq4C2HWWjsL64maeCm)
game-server-address: http://47.100.168.51:3333/close?MatchId=force
\ No newline at end of file
......@@ -12,3 +12,5 @@ spring:
swagger:
enable: true
game-server-address: http://47.100.168.51:3333/close?MatchId=force
\ No newline at end of file
spring:
profiles:
include:
- common-db
datasource:
url: jdbc:mysql://127.0.0.1:3306/antaisport${project.mysql-url-params}
username: root
password: 123456
logging:
level:
root: info
com.antai.sport.http.server.repository: debug
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