Execute函数
public async Task Execute(IJobExecutionContext context) { Stopwatch _time = new Stopwatch(); _time.Start(); string strRe = "开始时间:" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"); string errmsg = string.Empty; string orderNo = string.Empty; try { var res = await DealSomething(orderNo, errmsg); var terst = res.orderNo; var testErrmsg = res.errMsgElk; } catch (Exception ex) { errmsg += ex.Message; } _time.Stop(); var excuteTime = _time.Elapsed.TotalMilliseconds; }
dealSomething方法
public async Task<(string orderNo,string errMsgElk)> DealSomething(string orderNo, string errMsgElk) { var order = await _orderService.GetAirOrder(order); return ("test", ""); }
sercive里异步代码
public async Task<AirOrder> GetAirOrder(T_YW_Orders order) { var ticketInfos = await _orderTicketService.FindAsync(s => s.OrderNo == order.OrderNo); return new AirOrder(); }
标签:core,task,string,示例,time,var,async,orderNo,order From: https://www.cnblogs.com/Lvkang/p/18554411