wanshenmean
2026-03-04 17e5dbd7bd0364e27a33f1a7dab91cf33d5dcabc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
namespace WIDESEAWCS_RedisService.Geo
{
    public interface IGeoLocationService
    {
        /// <summary>
        /// 添加地理位置
        /// </summary>
        bool Add(string key, double longitude, double latitude, string member);
 
        /// <summary>
        /// 获取成员位置
        /// </summary>
        GeoPosition? GetPosition(string key, string member);
 
        /// <summary>
        /// 计算两个成员之间的距离(米)
        /// </summary>
        double? GetDistance(string key, string member1, string member2);
 
        /// <summary>
        /// 搜索指定半径内的成员
        /// </summary>
        List<GeoRadiusResult> SearchRadius(string key, double longitude, double latitude, double radiusMeters, int count = 10);
 
        /// <summary>
        /// 移除成员
        /// </summary>
        bool Remove(string key, string member);
    }
 
    public class GeoPosition
    {
        public double Longitude { get; set; }
        public double Latitude { get; set; }
    }
 
    public class GeoRadiusResult
    {
        public string Member { get; set; } = string.Empty;
        public double? Distance { get; set; }
        public GeoPosition? Position { get; set; }
    }
}