add latitude & longitude
This commit is contained in:
@ -8,7 +8,7 @@ namespace Blahblah.FlowerStory.Server.Data.Model;
|
||||
/// 花草对象
|
||||
/// </summary>
|
||||
[Table("flowers")]
|
||||
public class FlowerItem
|
||||
public class FlowerItem : ILocation
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增 id,主键
|
||||
@ -83,4 +83,22 @@ public class FlowerItem
|
||||
/// 封面相关照片
|
||||
/// </summary>
|
||||
public ICollection<PhotoItem>? Photos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纬度
|
||||
/// </summary>
|
||||
[Column("latitude")]
|
||||
public double? Latitude { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 经度
|
||||
/// </summary>
|
||||
[Column("longitude")]
|
||||
public double? Longitude { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 距离(米)
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public int? Distance { get; set; }
|
||||
}
|
||||
|
17
Server/Data/Model/ILocation.cs
Normal file
17
Server/Data/Model/ILocation.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace Blahblah.FlowerStory.Server.Data.Model;
|
||||
|
||||
/// <summary>
|
||||
/// 实体位置接口
|
||||
/// </summary>
|
||||
public interface ILocation
|
||||
{
|
||||
/// <summary>
|
||||
/// 纬度
|
||||
/// </summary>
|
||||
double? Latitude { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 经度
|
||||
/// </summary>
|
||||
double? Longitude { get; }
|
||||
}
|
@ -82,6 +82,9 @@ public class PhotoItem
|
||||
[JsonIgnore]
|
||||
public DateTimeOffset DateUpload => DateTimeOffset.FromUnixTimeMilliseconds(DateUploadUnixTime);
|
||||
|
||||
/// <summary>
|
||||
/// 前端显示的 URL
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public string Url { get; set; }
|
||||
public string? Url { get; set; }
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Blahblah.FlowerStory.Server.Data.Model;
|
||||
/// 记录对象
|
||||
/// </summary>
|
||||
[Table("records")]
|
||||
public class RecordItem
|
||||
public class RecordItem : ILocation
|
||||
{
|
||||
/// <summary>
|
||||
/// 自增 id,主键
|
||||
@ -90,4 +90,16 @@ public class RecordItem
|
||||
/// 事件关联照片
|
||||
/// </summary>
|
||||
public ICollection<PhotoItem>? Photos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 纬度
|
||||
/// </summary>
|
||||
[Column("latitude")]
|
||||
public double? Latitude { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 经度
|
||||
/// </summary>
|
||||
[Column("longitude")]
|
||||
public double? Longitude { get; set; }
|
||||
}
|
||||
|
Reference in New Issue
Block a user