Skip to content

Commit

Permalink
[fix] 修正记录应用历史时,应用信息没有带出来的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Dec 9, 2023
1 parent 4c5e3ab commit ba3521d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AntJob.Data/Entity/应用历史.Biz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static IList<AppHistory> Search(Int32 appid, String action, Boolean? succ
/// <returns></returns>
public static AppHistory Create(App app, String action, Boolean success, String remark, String creator, String ip)
{
if (app == null) app = new App();
app ??= new App();

var hi = new AppHistory
{
Expand Down
8 changes: 4 additions & 4 deletions AntJob.Server/AntService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void IActionFilter.OnActionExecuted(ControllerContext filterContext)
else
XTrace.WriteException(ex);

WriteHistory(filterContext.ActionName, false, ex.GetMessage());
WriteHistory(null, filterContext.ActionName, false, ex.GetMessage());
}
}
}
Expand Down Expand Up @@ -132,7 +132,7 @@ public LoginResponse Login(LoginModel model)
// 记录当前用户
Session["App"] = app;

WriteHistory(autoReg ? "注册" : "登录", true, $"[{model.User}/{model.Pass}]在[{model.Machine}@{model.ProcessId}]登录[{app}]成功");
WriteHistory(app, autoReg ? "注册" : "登录", true, $"[{model.User}/{model.Pass}]在[{model.Machine}@{model.ProcessId}]登录[{app}]成功");

var rs = new LoginResponse { Name = app.Name, DisplayName = app.DisplayName };
if (autoReg) rs.Secret = app.Secret;
Expand Down Expand Up @@ -593,7 +593,7 @@ AppOnline CreateOnline(App app, INetSession ns, String machine, Int32 pid)
ns.OnDisposed += (s, e) =>
{
online.Delete();
WriteHistory("下线", true, $"[{online.Name}]登录于{online.CreateTime},最后活跃于{online.UpdateTime}");
WriteHistory(online.App, "下线", true, $"[{online.Name}]登录于{online.CreateTime},最后活跃于{online.UpdateTime}");
};

return online;
Expand Down Expand Up @@ -626,6 +626,6 @@ void UpdateOnline(App app, JobTask ji, INetSession ns)
#endregion

#region 写历史
void WriteHistory(String action, Boolean success, String remark) => AppHistory.Create(_App, action, success, remark, Local + "", _Net.Remote?.Host);
void WriteHistory(App app, String action, Boolean success, String remark) => AppHistory.Create(app ?? _App, action, success, remark, Local + "", _Net.Remote?.Host);
#endregion
}
2 changes: 1 addition & 1 deletion AntJob/Handler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public virtual Boolean Start()

var msg = "开始工作";
var job = Job;
if (job != null) msg += $" {job.Enable} 区间({job.Start}, {job.End}) Offset={job.Offset} Step={job.Step} MaxTask={job.MaxTask}";
if (job != null) msg += $" {job.Enable} 区间({job.Start.ToFullString("")}, {job.End.ToFullString("")}) Offset={job.Offset} Step={job.Step} MaxTask={job.MaxTask}";

using var span = Tracer?.NewSpan($"job:{Name}:Start", msg);
WriteLog(msg);
Expand Down

0 comments on commit ba3521d

Please sign in to comment.