[fix] 修正应用编译时间取值,不能所有情况都从Version计算编译时间,那样可能丢失时分秒
This commit is contained in:
parent
cfcf662b3e
commit
d9769a8e48
|
@ -11,7 +11,6 @@ using NewLife.Reflection;
|
|||
using Stardust.Data.Nodes;
|
||||
using Stardust.Models;
|
||||
using XCode;
|
||||
using XCode.Membership;
|
||||
|
||||
namespace Stardust.Data;
|
||||
|
||||
|
@ -38,7 +37,7 @@ public partial class AppOnline : Entity<AppOnline>
|
|||
/// <param name="isNew">是否插入</param>
|
||||
public override void Valid(Boolean isNew)
|
||||
{
|
||||
if (!Version.IsNullOrEmpty() && !Dirtys[nameof(Compile)])
|
||||
if (Compile.Year < 2000 && !Version.IsNullOrEmpty())
|
||||
{
|
||||
var dt = AssemblyX.GetCompileTime(Version);
|
||||
if (dt.Year > 2000) Compile = dt;
|
||||
|
|
|
@ -48,7 +48,7 @@ public partial class App : Entity<App>
|
|||
if (isNew && !Dirtys[__.AutoActive]) AutoActive = true;
|
||||
if (Period == 0) Period = 60;
|
||||
|
||||
if (!Version.IsNullOrEmpty() && !Dirtys[nameof(Compile)])
|
||||
if (Compile.Year < 2000 && !Version.IsNullOrEmpty())
|
||||
{
|
||||
var dt = AssemblyX.GetCompileTime(Version);
|
||||
if (dt.Year > 2000) Compile = dt;
|
||||
|
|
|
@ -326,7 +326,7 @@ public partial class Node : Entity<Node>
|
|||
/// <returns></returns>
|
||||
public static IList<Node> SearchByIP(String ip)
|
||||
{
|
||||
if (ip.IsNullOrEmpty()) return new List<Node>();
|
||||
if (ip.IsNullOrEmpty()) return [];
|
||||
|
||||
var ips = ip.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
|
|
|
@ -115,10 +115,15 @@ public class AppController : BaseController
|
|||
return rs;
|
||||
}
|
||||
|
||||
/// <summary>应用注册。旧版客户端登录接口,新版已废弃,改用Login</summary>
|
||||
/// <param name="inf"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost(nameof(Register))]
|
||||
public String Register(AppModel inf)
|
||||
{
|
||||
var online = _registryService.SetOnline(_app, inf, UserHost, inf.ClientId, Token);
|
||||
var ip = UserHost;
|
||||
var online = _registryService.SetOnline(_app, inf, ip, inf.ClientId, Token);
|
||||
_app.WriteHistory(nameof(Register), true, inf.ToJson(), inf.Version, ip, inf.ClientId);
|
||||
|
||||
_deployService.UpdateDeployNode(online);
|
||||
|
||||
|
|
|
@ -159,8 +159,6 @@ public class RegistryService
|
|||
app.UpdateIP = ip;
|
||||
app.Update();
|
||||
|
||||
app.WriteHistory(nameof(Register), true, inf.ToJson(), inf.Version, ip, clientId);
|
||||
|
||||
if (!inf.ClientId.IsNullOrEmpty()) clientId = inf.ClientId;
|
||||
|
||||
// 更新在线记录
|
||||
|
@ -173,6 +171,8 @@ public class RegistryService
|
|||
if (node != null) online.NodeId = node.ID;
|
||||
|
||||
if (!inf.Version.IsNullOrEmpty()) online.Version = inf.Version;
|
||||
var compile = inf.Compile.ToDateTime().ToLocalTime();
|
||||
if (compile.Year > 2000) online.Compile = compile;
|
||||
}
|
||||
online.Update();
|
||||
|
||||
|
|
Loading…
Reference in New Issue