|
@@ -204,13 +204,13 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
int Id = int.Parse(function.CheckInt(data["id"].ToString()));
|
|
|
ConsumerOrders order = maindb.ConsumerOrders.FirstOrDefault(m => m.Id == Id);
|
|
|
- if(order != null)
|
|
|
+ if (order != null)
|
|
|
{
|
|
|
List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId);
|
|
|
- if(suborders.Count > 0)
|
|
|
+ if (suborders.Count > 0)
|
|
|
{
|
|
|
ConsumerOrders suborder = suborders.FirstOrDefault(m => m.Id == Id);
|
|
|
- if(suborder != null)
|
|
|
+ if (suborder != null)
|
|
|
{
|
|
|
order.CurDivi = suborder.CurDivi;
|
|
|
maindb.SaveChanges();
|
|
@@ -235,19 +235,25 @@ namespace MySystem.Areas.Api.Controllers.v1
|
|
|
AppResultJson result = RestoreDiviDo(value);
|
|
|
return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
|
|
|
}
|
|
|
- private AppResultJson RestoreDiviDo(string value)
|
|
|
+ public AppResultJson RestoreDiviDo(string value)
|
|
|
{
|
|
|
JsonData data = JsonMapper.ToObject(value);
|
|
|
Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
int Id = int.Parse(function.CheckInt(data["id"].ToString()));
|
|
|
ConsumerOrders order = maindb.ConsumerOrders.FirstOrDefault(m => m.Id == Id);
|
|
|
- if(order != null)
|
|
|
+ if (order != null)
|
|
|
{
|
|
|
+ JsonData ProfitInfo = JsonMapper.ToObject(order.SeoDescription);
|
|
|
+ int ProfitDays = int.Parse(function.CheckInt(ProfitInfo["ProfitDays"].ToString())); //活动有效时间
|
|
|
+ if (order.IsAct == 0) return new AppResultJson() { Status = "-1", Info = "恢复失败,非活动订单不能进行该操作", Data = Obj };
|
|
|
+ if (DateTime.Parse(order.UpdateDate.ToString()).AddMinutes(10) >= DateTime.Now) return new AppResultJson() { Status = "-1", Info = "恢复失败,订单完成支付10分钟内不能进行该操作", Data = Obj };
|
|
|
+ if (order.MaxDivi == order.CurDivi) return new AppResultJson() { Status = "-1", Info = "恢复失败,订单已完成所有返现", Data = Obj };
|
|
|
+ if (DateTime.Parse(order.UpdateDate.ToString()).AddDays(ProfitDays) < DateTime.Now) return new AppResultJson() { Status = "-1", Info = "恢复失败,非活动订单不能进行该操作", Data = Obj };
|
|
|
List<ConsumerOrders> suborders = RedisDbconn.Instance.GetList<ConsumerOrders>("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId);
|
|
|
- if(suborders.Count > 0)
|
|
|
+ if (suborders.Count > 0)
|
|
|
{
|
|
|
ConsumerOrders suborder = suborders.FirstOrDefault(m => m.Id == Id);
|
|
|
- if(suborder == null)
|
|
|
+ if (suborder == null)
|
|
|
{
|
|
|
RedisDbconn.Instance.AddRightList("ConsumerOrdersHd:Divi:" + order.PayMode + ":" + order.MerchantId, order);
|
|
|
function.WriteLog(DateTime.Now.ToString() + "\r\n" + "订单Id:" + Id + "\r\n\r\n", "银联订单恢复返现");
|