瀏覽代碼

变为非商户型创客,条件设为超过1台机具,不包含1台
增加单个机具激活奖励补发功能,人工手动执行
激活,交易入库,区分金控和开店宝

lichunlei 3 年之前
父節點
當前提交
c8b3841c57

+ 20 - 8
AppStart/Helper/StatService.cs

@@ -160,7 +160,7 @@ namespace MySystem
             foreach (var user in users)
             {
                 int machineCount = db.PosMachinesTwo.Count(m => m.UserId == user.Id && m.PosSnType == 0);
-                if (machineCount >= 3)
+                if (machineCount > 1)
                 {
                     Users edit = db.Users.FirstOrDefault(m => m.Id == user.Id);
                     if (edit != null)
@@ -256,13 +256,21 @@ namespace MySystem
         }
 
         // 3. 前一天的激活记录,根据创客类型,如果是商户型创客,则激活奖励的起始人从此人上级计算。如果不是,则从此人开始计算
-        public void dosomething3()
-        { 
+        public void dosomething3(int posid = 0)
+        {
             WebCMSEntities db = new WebCMSEntities();
             DateTime yesterday = DateTime.Now.AddHours(-3);
             DateTime today = DateTime.Now;
-            List<PosMachinesTwo> posList = db.PosMachinesTwo.Where(m => m.ActivationState == 1 && m.ActivationTime >= yesterday && m.ActivationTime < today && !string.IsNullOrEmpty(m.SeoKeyword)).ToList();
-            foreach (PosMachinesTwo pos in posList)
+            IQueryable<PosMachinesTwo> posList = db.PosMachinesTwo.Where(m => m.ActivationState == 1 && !string.IsNullOrEmpty(m.SeoKeyword));
+            if (posid > 0)
+            { 
+                posList = posList.Where(m => m.Id == posid);
+            }
+            else
+            {
+                posList = posList.Where(m => m.ActivationTime >= yesterday && m.ActivationTime < today);
+            }
+            foreach (PosMachinesTwo pos in posList.ToList())
             {
                 PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
                 if (merchant != null)
@@ -285,7 +293,11 @@ namespace MySystem
                         {
                             TopUserId = int.Parse(ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
                         }
-                        decimal ActPrize = decimal.Parse(function.CheckNum(pos.SeoKeyword)) / 100;
+                        decimal ActPrize = decimal.Parse(function.CheckNum(pos.SeoKeyword));
+                        if (pos.BrandId == 1)
+                        {
+                            ActPrize = ActPrize / 100;
+                        }
                         if (ActPrize > 0)
                         {
                             bool check = db.ActiveReward.Any(m => m.KqSnNo == pos.PosSn);
@@ -377,8 +389,8 @@ namespace MySystem
                                 db.SaveChanges();
                                 RedisDbconn.Instance.Set("UserAccount:" + GetUserId, account);
 
-                                string dateString = yesterday.ToString("yyyyMMdd");
-                                string monthString = yesterday.ToString("yyyyMM");
+                                string dateString = pos.ActivationTime.Value.ToString("yyyyMMdd");
+                                string monthString = pos.ActivationTime.Value.ToString("yyyyMM");
                                 // 激活奖励列表
                                 List<string> dates = RedisDbconn.Instance.GetList<string>("ActiveRewardDay:" + GetUserId + ":" + pos.BrandId);
                                 if (!dates.Contains(dateString))

+ 10 - 1
AppStart/Helper/SycnSpServer/SycnSpActiveService.cs

@@ -32,7 +32,16 @@ namespace MySystem
             acts = acts.OrderByDescending(m => m.Id);
             foreach (ActivateRecord act in acts.ToList())
             {
-                if (act.ActivateStatus == "00")
+                bool op = false;
+                if (act.ActivateStatus == "00" && act.ProductType == "1")
+                { 
+                    op = true;
+                }
+                else if (act.ActivateStatus == "SUCCESS" && act.ProductType == "2")
+                { 
+                    op = true;
+                }
+                if(op)
                 {
                     PxcModels.MachineForMerNo posFor = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == act.MerNo) ?? new PxcModels.MachineForMerNo();
                     PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == posFor.SnId);

+ 22 - 3
AppStart/Helper/SycnSpServer/SycnSpTradeService.cs

@@ -61,8 +61,27 @@ namespace MySystem
                             bool check = db.TradeRecord.Any(m => m.RecordNo == trade.TradeSerialNo);
                             if (!check)
                             {
-                                decimal TradeAmount = trade.TradeAmount / 100;
-                                int BankCardType = int.Parse(trade.BankCardType);
+                                decimal TradeAmount = trade.TradeAmount;
+                                int BankCardType = -1;
+                                int QrPayFlag = 0;
+                                if (pos.BrandId == 1)
+                                {
+                                    TradeAmount = TradeAmount / 100;
+                                    BankCardType = int.Parse(trade.BankCardType);
+                                    if(trade.TradeType == "02") QrPayFlag = 1;
+                                }
+                                else if (pos.BrandId == 2)
+                                {
+                                    if (trade.TradeType == "CREDIT_BY_CARD")
+                                    {
+                                        BankCardType = 1;
+                                    }
+                                    else if (trade.TradeType == "DEBIT_BY_CARD")
+                                    {
+                                        BankCardType = 0;
+                                    }
+                                    if(trade.TradeType == "CLOUD_PAY") QrPayFlag = 1;
+                                }
                                 db.TradeRecord.Add(new PxcModels.TradeRecord()
                                 {
                                     CreateDate = trade.CreateDate,
@@ -79,7 +98,7 @@ namespace MySystem
                                     TradeSerialNo = trade.ChannelSerial, //交易流水号
                                     TradeAmount = TradeAmount, //交易金额
                                     BankCardType = BankCardType, //银行卡类型
-                                    QrPayFlag = trade.TradeType == "02" ? 1 : 0, //云闪付标识
+                                    QrPayFlag = QrPayFlag, //云闪付标识
                                     BrandId = int.Parse(trade.ProductType), //品牌
                                     Remark = trade.Remark, //备注
                                     TopUserId = TopUserId, //顶级创客

+ 74 - 0
AppStart/Timer/TestHelper.cs

@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Linq;
+using System.Data;
+using MySystem;
+using MySystem.PxcModels;
+using Library;
+
+public class TestHelper
+{
+    public readonly static TestHelper Instance = new TestHelper();
+    private TestHelper()
+    {
+    }
+    
+    public void Start()
+    {
+        Thread th = new Thread(DoWorks);
+        th.IsBackground = true;
+        th.Start();
+    }
+
+    private void DoWorks()
+    {
+        // bool op = true;
+        // while (op)
+        // {
+        //     WebCMSEntities db = new WebCMSEntities();
+        //     int StartId = RedisDbconn.Instance.Get<int>("SetCertUserId");
+        //     var list = db.Users.Select(m => new { m.Id, m.CertId }).Where(m => m.Id > StartId && string.IsNullOrEmpty(m.CertId)).OrderBy(m => m.Id).Take(20).ToList();
+        //     if (list.Count > 0)
+        //     {
+        //         foreach (var sub in list)
+        //         {
+        //             Users user = db.Users.FirstOrDefault(m => m.Id == sub.Id && string.IsNullOrEmpty(m.CertId));
+        //             if (user != null)
+        //             {
+        //                 DataTable dt = dbconn.dtable("select CertId from TmpCert where MakerCode='" + user.MakerCode + "'");
+        //                 if (dt.Rows.Count > 0)
+        //                 {
+        //                     string CertId = dt.Rows[0]["CertId"].ToString();
+        //                     user.CertId = CertId;
+        //                 }
+        //                 RedisDbconn.Instance.Set("SetCertUserId", sub.Id);
+        //             }
+        //         }
+        //         db.SaveChanges();
+        //         db.Dispose();
+        //     }
+        //     else
+        //     {
+        //         op = false;
+        //     }
+        //     Thread.Sleep(10);
+        // }
+
+        WebCMSEntities db = new WebCMSEntities();
+        IQueryable<Users> users = db.Users.Where(m => m.AuthFlag == 1).OrderBy(m => m.Id);
+        foreach (Users user in users.ToList())
+        {
+            string path = function.CreateQRCode2(ConfigurationManager.AppSettings["SourceHost"].ToString() + "p/user-inviteregist-1?Id=" + user.Id, function.MD5_16(user.Id.ToString() + "8745"), "/bsserver_com/static/ReferenceQrCode/");
+            path = path.Replace("//", "/");
+            string resultpath = "/bsserver_com/static/ReferenceQrCode/" + function.MD5_16(user.Id.ToString() + "8745") + "Pic.png";
+            MakeReferenceQrCodeService.Instance.MakeQRCode(function.getPath("/static/QrCodeBg.png"), function.getPath(path), function.getPath(resultpath), user);
+            resultpath = resultpath.Replace("bsserver_com/", "");
+            user.ReferenceQrCode = resultpath;
+            db.SaveChanges();
+            RedisDbconn.Instance.Set("Users:" + user.Id, user);
+            function.WriteLog(user.Id.ToString(), "生成邀请二维码");
+        }
+        function.WriteLog("finish", "生成邀请二维码");
+    }
+}

+ 12 - 15
Controllers/HomeController.cs

@@ -68,21 +68,9 @@ namespace MySystem.Controllers
             return "ok";
         }
 
-        public string setqrcode(int uid)
+        public string setqrcode(int uid = 0)
         {
-            WebCMSEntities db = new WebCMSEntities();
-            List<Users> users = db.Users.Where(m => m.Id == uid).ToList();
-            foreach (Users user in users)
-            {
-                string path = function.CreateQRCode2(ConfigurationManager.AppSettings["SourceHost"].ToString() + "p/user-inviteregist-1?Id=" + user.Id, function.MD5_16(user.Id.ToString() + "8745"), "/bsserver_com/static/ReferenceQrCode/");
-                path = path.Replace("//", "/");
-                string resultpath = "/bsserver_com/static/ReferenceQrCode/" + function.MD5_16(user.Id.ToString() + "8745") + "Pic.png";
-                MakeReferenceQrCodeService.Instance.MakeQRCode(function.getPath("/static/QrCodeBg.png"), function.getPath(path), function.getPath(resultpath), user);
-                resultpath = resultpath.Replace("bsserver_com/", "");
-                user.ReferenceQrCode = resultpath;
-                db.SaveChanges();
-                RedisDbconn.Instance.Set("Users:" + user.Id, user);
-            }
+            
             return "ok";
         }
 
@@ -137,7 +125,6 @@ namespace MySystem.Controllers
             db.Dispose();
         }
 
-
         public string chkact(int Id = 0)
         {
             if (Id > 0)
@@ -154,5 +141,15 @@ namespace MySystem.Controllers
             }
             return "ok";
         }
+
+        // 补激活奖励
+        public string chkactprize(int Id = 0)
+        {
+            if (Id > 0)
+            {
+                StatService.Instance.dosomething3(Id);
+            }
+            return "ok";
+        }
     }
 }

+ 2 - 1
Startup.cs

@@ -219,8 +219,9 @@ namespace MySystem
             ActiveRewardTimer.Instance.Start(); //实时处理激活记录
 
             //当前必须打开的
+            RabbitMQClient.Instance.StartReceive("MakeReferenceQrCode");
+
             // RabbitMQClient.Instance.StartReceive("MerchantConfirmList");
-            // RabbitMQClient.Instance.StartReceive("MakeReferenceQrCode");
             // RabbitMQClient.Instance.StartReceive("CheckWeChatSign");
             // RabbitMQClient.Instance.StartReceive("CheckAlipaySign");
             // RabbitMQClient.Instance.StartReceive("DeleteMySqlData");

二進制
bin/Debug/netcoreapp3.0/MySystem.dll


二進制
bin/Debug/netcoreapp3.0/MySystem.pdb


二進制
bin/Debug/netcoreapp3.0/MySystemLib.dll


二進制
bin/Debug/netcoreapp3.0/MySystemLib.pdb


二進制
bin/release/netcoreapp3.0/MySystem.dll


二進制
bin/release/netcoreapp3.0/MySystem.pdb


二進制
bin/release/netcoreapp3.0/MySystemLib.dll


二進制
bin/release/netcoreapp3.0/MySystemLib.pdb


二進制
obj/Debug/netcoreapp3.0/MySystem.csproj.AssemblyReference.cache


二進制
obj/Debug/netcoreapp3.0/MySystem.csprojAssemblyReference.cache


二進制
obj/Debug/netcoreapp3.0/MySystem.dll


二進制
obj/Debug/netcoreapp3.0/MySystem.pdb


二進制
obj/release/netcoreapp3.0/MySystem.csprojAssemblyReference.cache


二進制
obj/release/netcoreapp3.0/MySystem.dll


二進制
obj/release/netcoreapp3.0/MySystem.pdb