Browse Source

盟主申请机具券推送MQ

lcl 11 months ago
parent
commit
791637ebf5
1 changed files with 23 additions and 0 deletions
  1. 23 0
      AppStart/Helper/LeaderApplyCouponsHelper.cs

+ 23 - 0
AppStart/Helper/LeaderApplyCouponsHelper.cs

@@ -35,8 +35,10 @@ namespace MySystem
                         var Id = int.Parse(content);
                         WebCMSEntities db = new WebCMSEntities();
                         var queryList = db.LeaderReserveRecord.FirstOrDefault(m => m.Id == Id) ?? new LeaderReserveRecord();
+                        var user = db.Users.FirstOrDefault(m => m.Id == queryList.UserId) ?? new Users();
 
                         List<int> couponIds = new List<int>();
+                        int BuyCount = 0;
 
                         JsonData ApplyList = JsonMapper.ToObject(queryList.SeoTitle);
                         for (int i = 0; i < ApplyList.Count; i++)
@@ -59,6 +61,7 @@ namespace MySystem
                                     });
                                     couponIds.Add(item.Id);
                                 }
+                                BuyCount += num / 3;
                             }
                             //大机
                             if (type == 2)
@@ -76,12 +79,32 @@ namespace MySystem
                                     });
                                     couponIds.Add(items.Id);
                                 }
+                                BuyCount += num / 2;
                             }
                             db.SaveChanges();
                         }
                         db.SaveChanges();
                         
                         dosomething(Id, couponIds);
+
+                        //推动数据到MQ
+                        Utils.Instance.SendMqOrder(new Orders()
+                        {
+                            Id = queryList.Id,
+                            CreateDate = queryList.CreateDate,
+                            Remark = queryList.Remark,
+                            BuyCount = BuyCount,
+                            PayStatus = 1,
+                            ProductId = 10,
+                            DeliveryType = 0,
+                            PayMode = 4,
+                            PayDate = queryList.CreateDate,
+                            TotalPrice = queryList.ChangeAmt,
+                            Mobile = user.Mobile,
+                            RealName = user.RealName,
+                            OrderNo = queryList.SeoKeyword,
+                            UserId = queryList.UserId,
+                        });
                     }
                     catch (Exception ex)
                     {