|
@@ -244,7 +244,7 @@ namespace MySystem
|
|
|
List<int> orderids = new List<int>();
|
|
|
while (CurDiviPersons > 0)
|
|
|
{
|
|
|
- ConsumerOrders suborder = RedisDbconn.Instance.RPop<ConsumerOrders>("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId);
|
|
|
+ ConsumerOrders suborder = RedisDbconn.Instance.RPopLPush<ConsumerOrders>("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, "ConsumerOrders:Divi:" + PayMode + ":" + MerchantId);
|
|
|
if (suborder != null)
|
|
|
{
|
|
|
MerchantParamSet subset = Newtonsoft.Json.JsonConvert.DeserializeObject<MerchantParamSet>(order.SeoDescription);
|
|
@@ -270,29 +270,35 @@ namespace MySystem
|
|
|
{
|
|
|
OtherMoney += DiffMoney;
|
|
|
}
|
|
|
- ConsumerProfit cprofit = db.ConsumerProfit.Add(new ConsumerProfit()
|
|
|
- {
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- ConsumerId = suborder.ConsumerId,
|
|
|
- MerchantId = suborder.MerchantId,
|
|
|
- OrderId = suborder.Id,
|
|
|
- GetMoney = Math.Round(GetMoney, 2),
|
|
|
- QueryCount = PayMode,
|
|
|
- Sort = OrderId,
|
|
|
- SeoTitle = suborder.OrderNo,
|
|
|
- SeoKeyword = suborder.PayMoney.ToString(),
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
MerchantAddInfo merchantAdd = db.MerchantAddInfo.FirstOrDefault(m => m.Id == suborder.MerchantId) ?? new MerchantAddInfo();
|
|
|
if(!orderids.Contains(suborder.Id))
|
|
|
{
|
|
|
+ string RefundNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
|
|
|
+ int Status = 0;
|
|
|
if(order.PayMode == 1)
|
|
|
{
|
|
|
- AlipayFunction.Instance.Refund(suborder.SeoTitle, Math.Round(GetMoney, 2).ToString(), "门店消费补贴", merchantAdd.AlipayAuthToken);
|
|
|
+ string result = AlipayFunction.Instance.Refund(suborder.SeoTitle, RefundNo, Math.Round(GetMoney, 2).ToString(), "门店消费补贴", merchantAdd.AlipayAuthToken);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Dictionary<string, string> dic = WeChatFunction.Instance.Refund(merchantAdd.SubMchid, Math.Round(GetMoney, 2), suborder.PayMoney, suborder.OrderNo, DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), "门店消费补贴");
|
|
|
+ Dictionary<string, string> dic = WeChatFunction.Instance.Refund(merchantAdd.SubMchid, Math.Round(GetMoney, 2), suborder.PayMoney, suborder.OrderNo, RefundNo, "门店消费补贴");
|
|
|
+ }
|
|
|
+ if(Status == 1)
|
|
|
+ {
|
|
|
+ db.ConsumerProfit.Add(new ConsumerProfit()
|
|
|
+ {
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ ConsumerId = suborder.ConsumerId,
|
|
|
+ MerchantId = suborder.MerchantId,
|
|
|
+ OrderId = suborder.Id,
|
|
|
+ GetMoney = Math.Round(GetMoney, 2),
|
|
|
+ QueryCount = PayMode,
|
|
|
+ Sort = OrderId,
|
|
|
+ SeoTitle = suborder.OrderNo,
|
|
|
+ SeoKeyword = suborder.PayMoney.ToString(),
|
|
|
+ SeoDescription = RefundNo,
|
|
|
+ });
|
|
|
+ db.SaveChanges();
|
|
|
}
|
|
|
orderids.Add(suborder.Id);
|
|
|
}
|
|
@@ -301,10 +307,11 @@ namespace MySystem
|
|
|
|
|
|
if (suborder.CurDivi < suborder.MaxDivi)
|
|
|
{
|
|
|
- RedisDbconn.Instance.AddList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);
|
|
|
+ // RedisDbconn.Instance.AddList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ RedisDbconn.Instance.DelFromList("ConsumerOrders:Divi:" + PayMode + ":" + MerchantId, suborder);
|
|
|
OutCount += 1;
|
|
|
}
|
|
|
RedisDbconn.Instance.AddList("ConsumerOrdersSetDivi", "{\"OrderId\":\"" + suborder.Id + "\",\"DiviAmt\":\"" + suborder.CurDivi + "\"}");
|