70 lines
2.8 KiB
C#
70 lines
2.8 KiB
C#
|
|
using Quartz;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Web;
|
|||
|
|
|
|||
|
|
namespace dccdc.jobs
|
|||
|
|
{
|
|||
|
|
public class WeiXinHongBaoJob : IJob
|
|||
|
|
{
|
|||
|
|
public Task Execute(IJobExecutionContext context)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Info("红包作业开始执行:" + DateTime.Now);
|
|||
|
|
var bll = new BLL.InfectionRedBll();
|
|||
|
|
List<Models.InfectionRedModel> list = bll.GetUnreceived();
|
|||
|
|
//log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Info("红包准备循环:" + DateTime.Now);
|
|||
|
|
foreach (Models.InfectionRedModel red in list)
|
|||
|
|
{
|
|||
|
|
//log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Info("红包实体:" + red.mch_billno);
|
|||
|
|
string receive_date = "";
|
|||
|
|
int status = 0;
|
|||
|
|
string statusStr = new Controllers.InfectionWXController().checkRedPack(red.mch_billno);
|
|||
|
|
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Info("statusStr===============" + statusStr);
|
|||
|
|
if (!string.IsNullOrEmpty(statusStr)) {
|
|||
|
|
if (statusStr.Equals("SENDING")) {
|
|||
|
|
status = 0;
|
|||
|
|
}else if (statusStr.Equals("SENT"))
|
|||
|
|
{
|
|||
|
|
status = 1;
|
|||
|
|
}
|
|||
|
|
else if (statusStr.Equals("FAILED"))
|
|||
|
|
{
|
|||
|
|
status = 2;
|
|||
|
|
}
|
|||
|
|
else if (statusStr.Equals("RECEIVED"))
|
|||
|
|
{
|
|||
|
|
status = 3;
|
|||
|
|
receive_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|||
|
|
}
|
|||
|
|
else if (statusStr.Equals("RFUND_ING"))
|
|||
|
|
{
|
|||
|
|
status = 4;
|
|||
|
|
}
|
|||
|
|
else if (statusStr.Equals("REFUND"))
|
|||
|
|
{
|
|||
|
|
status = 5;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Info("status===============" + status);
|
|||
|
|
bll.UpdateStatus(red.id, status, receive_date);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType).Info(ex.Message + ex.StackTrace);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return new Task(() =>
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|