小程序经纬度接口,临时主页接口

This commit is contained in:
张松
2025-02-14 14:39:15 +08:00
parent 0efbb1e747
commit b8f5448a7b
6 changed files with 387 additions and 1 deletions

View File

@@ -54,7 +54,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
// 重置根路径防止satoken切割根路径导致匹配不到路径
ApplicationInfo.routePrefix = "";
SaRouter.match("/user/**").notMatch("/user/login", "/user/test")
SaRouter.match("/user/**").notMatch("/user/login", "/user/test", "/user/geo/**", "/user/home/**")
.check(r -> StpKit.USER.checkMiniUser())
.setHit(true)
// .match("/**")

View File

@@ -0,0 +1,10 @@
package com.czg.account.service;
import jakarta.validation.constraints.NotEmpty;
/**
* @author Administrator
*/
public interface GeoService {
Object getAddress(@NotEmpty String lat, @NotEmpty String lng);
}

View File

@@ -1,8 +1,15 @@
package com.czg.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
/**
* @author Administrator
*/
@Component
public class GeoUtil {
// 地球半径,单位:公里
private static final double EARTH_RADIUS = 6371.0;
@@ -30,4 +37,5 @@ public class GeoUtil {
// 计算距离(米)
return EARTH_RADIUS * c * 1000;
}
}