@@ -21,7 +21,7 @@ public long GeoAdd(string cacheKey, List<(double longitude, double latitude, str
21
21
22
22
foreach ( var item in values )
23
23
{
24
- list . Add ( new GeoEntry ( item . longitude , item . latitude , item . member ) ) ;
24
+ list . Add ( new GeoEntry ( item . longitude , item . latitude , item . member ) ) ;
25
25
}
26
26
27
27
var res = _cache . GeoAdd ( cacheKey , list . ToArray ( ) ) ;
@@ -115,12 +115,17 @@ public async Task<List<string>> GeoHashAsync(string cacheKey, List<string> membe
115
115
{
116
116
if ( item . HasValue )
117
117
{
118
- tuple . Add ( ( Convert . ToDecimal ( item . Value . Longitude . ToString ( ) ) , Convert . ToDecimal ( item . Value . Latitude . ToString ( ) ) ) ) ;
119
- }
120
- else
121
- {
122
- tuple . Add ( null ) ;
118
+ var longitude = Convert . ToDecimal ( item . Value . Longitude . ToString ( ) ) ;
119
+ var latitude = Convert . ToDecimal ( item . Value . Latitude . ToString ( ) ) ;
120
+ // returns { Longitude = 0,Latitude = 0 } if it does not exist
121
+ if ( longitude != 0 && latitude != 0 )
122
+ {
123
+ tuple . Add ( ( longitude , latitude ) ) ;
124
+ continue ;
125
+ }
123
126
}
127
+
128
+ tuple . Add ( null ) ;
124
129
}
125
130
126
131
return tuple ;
@@ -145,13 +150,17 @@ public async Task<List<string>> GeoHashAsync(string cacheKey, List<string> membe
145
150
{
146
151
if ( item . HasValue )
147
152
{
148
- tuple . Add ( ( Convert . ToDecimal ( item . Value . Longitude . ToString ( ) ) , Convert . ToDecimal ( item . Value . Latitude . ToString ( ) ) ) ) ;
149
- }
150
- else
151
- {
152
- tuple . Add ( null ) ;
153
+ var longitude = Convert . ToDecimal ( item . Value . Longitude . ToString ( ) ) ;
154
+ var latitude = Convert . ToDecimal ( item . Value . Latitude . ToString ( ) ) ;
155
+ // returns { Longitude = 0,Latitude = 0 } if it does not exist
156
+ if ( longitude != 0 && latitude != 0 )
157
+ {
158
+ tuple . Add ( ( longitude , latitude ) ) ;
159
+ continue ;
160
+ }
153
161
}
154
162
163
+ tuple . Add ( null ) ;
155
164
}
156
165
157
166
return tuple ;
0 commit comments