コード例 #1
0
        private void DoRun()
        {
            while (true)
            {
                try
                {
                    VipDal _dal = new VipDal();

                    var jobLog = new JobLog
                    {
                        JobName   = "续费通知",
                        StartTime = DateTime.Now,
                        EndTime   = DateTime.Now,
                        Result    = ""
                    };

                    var vips = _dal.GetExpiredVips();

                    foreach (var v in vips)
                    {
                        v.FeeStatus = (int)PayStatus.待支付;
                    }

                    _dal.Update(vips);

                    jobLog.EndTime = DateTime.Now;
                    jobLog.Result  = "成功";
                    _dal.Insert(jobLog);
                }
                catch (Exception ex)
                {
                    Senparc.Weixin.WeixinTrace.SendCustomLog("AutoPayNotifyJob", ex.Message);
                }


                Thread.Sleep(1000 * 60 * 10);
            }
        }