|
@@ -25,6 +25,7 @@ import com.cyksj.model.request.UserReq;
|
|
|
import com.cyksj.model.request.WorkOrderReq;
|
|
import com.cyksj.model.request.WorkOrderReq;
|
|
|
import com.cyksj.model.response.UserAuthLoginResp;
|
|
import com.cyksj.model.response.UserAuthLoginResp;
|
|
|
import com.cyksj.model.views.*;
|
|
import com.cyksj.model.views.*;
|
|
|
|
|
+import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.corp.CropChatService;
|
|
import com.cyksj.service.corp.CropChatService;
|
|
|
import com.cyksj.service.exchange.ExchangeCodeService;
|
|
import com.cyksj.service.exchange.ExchangeCodeService;
|
|
|
import com.cyksj.service.order.UserRealOrderBenefitsService;
|
|
import com.cyksj.service.order.UserRealOrderBenefitsService;
|
|
@@ -78,6 +79,8 @@ public class UserController {
|
|
|
|
|
|
|
|
private final UserPageLanguageMapper userPageLanguageMapper;
|
|
private final UserPageLanguageMapper userPageLanguageMapper;
|
|
|
|
|
|
|
|
|
|
+ private final RedisService redisService;
|
|
|
|
|
+
|
|
|
@GetMapping(value = "/wx/whoami")
|
|
@GetMapping(value = "/wx/whoami")
|
|
|
public Result<UserWhoami> whoami() {
|
|
public Result<UserWhoami> whoami() {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
@@ -401,4 +404,18 @@ public class UserController {
|
|
|
public Result<String> getUserIp(){
|
|
public Result<String> getUserIp(){
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(HttpUtil.get("http://whois.pconline.com.cn/ipJson.jsp?ip=" + ServletUtil.getClientIP(request) + "&json=true"));
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(HttpUtil.get("http://whois.pconline.com.cn/ipJson.jsp?ip=" + ServletUtil.getClientIP(request) + "&json=true"));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取当日汇率
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/latest/exchangerate")
|
|
|
|
|
+ public Result<String> latestExchangerate() {
|
|
|
|
|
+ String url = "https://api.exchangerate-api.com/v4/latest/USD";
|
|
|
|
|
+ String exchangeRate = redisService.getStr(RedisService.key.EXCHANGE_RATE_KEY.getName());
|
|
|
|
|
+ if (StrUtil.isBlank(exchangeRate)) {
|
|
|
|
|
+ exchangeRate = HttpUtil.get(url);
|
|
|
|
|
+ redisService.set(RedisService.key.EXCHANGE_RATE_KEY.getName(),exchangeRate);
|
|
|
|
|
+ }
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(exchangeRate);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|