using Autofac; using Bowin.Common.Log; using EMIS.CommonLogic.SystemServices; using EMIS.Web.Controls; using Senparc.Weixin.TenPay.V3; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace EMIS.Services.ScheduleJob { public class SynWeChatPayStatusJob : EAPServiceJob { #region 运行JOB /// /// 重写 MyJob 方法 /// /// protected override bool MyJob() { var result = true; try { LogHelper.WriteLog(LogType.ServiceLog, "----开始根据微信订单同步缴费状态-----"); using (var scop = Program.AutofacContainer.BeginLifetimeScope()) { IWechatPayServices WechatPayServices = scop.Resolve(); var wecharPayList = WechatPayServices.SearchWeChatPayList(); List orderList = new List(); foreach (var wecharPay in wecharPayList) { OrderQueryResult query = WechatHelper.OrderQuery(wecharPay.OrderID); orderList.Add(query); } WechatPayServices.UpdateWeChatPay(orderList); } LogHelper.WriteLog(LogType.ServiceLog, "----结束根据微信订单同步缴费状态-----"); } catch (System.Exception err) { LogHelper.WriteLog(LogType.ServiceLog, "----根据微信订单同步缴费状态处理异常-----"); LogHelper.WriteLog(LogType.ServiceLog, err.Message); result = false; } return result; } #endregion } }