|
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.lottery.api.mapper.ApiIFundingMapper; |
|
|
|
import com.lottery.api.service.ApiIFundingService; |
|
|
|
import com.lottery.config.ApiConfig; |
|
|
|
import com.lottery.dto.FundingRecordDto; |
|
|
|
import com.lottery.result.Result; |
|
|
|
import com.lottery.utils.HttpUtils; |
|
|
@ -38,6 +39,8 @@ public class ApiFundingServiceImpl implements ApiIFundingService { |
|
|
|
@Autowired |
|
|
|
ObjectMapper objectMapper = new ObjectMapper(); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
ApiConfig apiConfig; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result getActivityDetailOne(String token) { |
|
|
@ -49,17 +52,13 @@ public class ApiFundingServiceImpl implements ApiIFundingService { |
|
|
|
if (count == null || count == 0 || count > 1) { |
|
|
|
// 根据业务逻辑,这里可以分别处理count为null、小于0和大于1的情况 |
|
|
|
// 但为了简化示例,我们统一返回一个失败结果 |
|
|
|
return Result.failure(200,"操作成功"); |
|
|
|
return Result.failure(400,"活动未开启"); |
|
|
|
} |
|
|
|
|
|
|
|
Integer activityId = fundingMapper.selectStatus(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据活动id查询俩个市场,俩个市场是一条数据 |
|
|
|
ApiFundingTimeVo data= fundingMapper.getMarket(activityId); |
|
|
|
|
|
|
|
|
|
|
|
Integer marketOne = data.getMarketOne(); |
|
|
|
Integer marketTwo = data.getMarketTwo(); |
|
|
|
LocalDate startTime = (LocalDate) data.getStartTime(); |
|
|
@ -70,7 +69,7 @@ public class ApiFundingServiceImpl implements ApiIFundingService { |
|
|
|
|
|
|
|
try { |
|
|
|
// 1. 定义请求 URL |
|
|
|
String url = "http://39.101.133.168:8828/hljw/api/v2/member/info"; |
|
|
|
String url = apiConfig.getHljwUrl() +"/api/v2/member/info"; |
|
|
|
|
|
|
|
// 准备请求参数 |
|
|
|
Map<String, String> params = new HashMap<>(); |
|
|
@ -78,6 +77,9 @@ public class ApiFundingServiceImpl implements ApiIFundingService { |
|
|
|
// 调用接口 |
|
|
|
String response = HttpUtils.postUrlencoded(url, params); |
|
|
|
JsonNode rootNode = objectMapper.readTree(response); |
|
|
|
if(rootNode.path("code").asInt() == 401){ |
|
|
|
return Result.failure("登录凭证错误"); |
|
|
|
} |
|
|
|
// 提取 username |
|
|
|
username = rootNode.path("data").path("username").asText(); |
|
|
|
jwcode = rootNode.path("data").path("jwcode").asText(); |
|
|
@ -169,7 +171,7 @@ public class ApiFundingServiceImpl implements ApiIFundingService { |
|
|
|
|
|
|
|
try { |
|
|
|
// 1. 定义请求 URL |
|
|
|
String url = "http://39.101.133.168:8828/hljw/api/v2/member/info"; |
|
|
|
String url = apiConfig.getHljwUrl() + "/api/v2/member/info"; |
|
|
|
|
|
|
|
// 准备请求参数 |
|
|
|
Map<String, String> params = new HashMap<>(); |
|
|
|