浏览代码

Merge branch 'feat-lcl-电签对大机' of kxs-end/main-server into release-mainserver

lichunlei 10 月之前
父节点
当前提交
5701a42987

+ 102 - 0
AppStart/Helper/PosCouponExchangeHelper.cs

@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Linq;
+using System.Data;
+using MySystem;
+using MySystem.PxcModels;
+using Library;
+using LitJson;
+
+public class PosCouponExchangeHelper
+{
+    public readonly static PosCouponExchangeHelper Instance = new PosCouponExchangeHelper();
+    private PosCouponExchangeHelper()
+    {
+    }
+
+    public void Start()
+    {
+        Thread th = new Thread(DoWorks);
+        th.IsBackground = true;
+        th.Start();
+    }
+
+    private void DoWorks()
+    {
+        while (true)
+        {
+            try
+            {
+                string content = RedisDbconn.Instance.RPop<string>("PosCouponExchangeQueue");
+                if(!string.IsNullOrEmpty(content))
+                {
+                    WebCMSEntities db = new WebCMSEntities();
+                    DoSomething(db, content);
+                    db.Dispose();
+                }
+                else
+                {
+                    Thread.Sleep(2000);
+                }
+            }
+            catch (Exception ex)
+            {
+                function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "电签券对大机券异常");
+            }
+        }
+    }
+
+    public void DoSomething(WebCMSEntities db, string content)
+    {
+        JsonData data = JsonMapper.ToObject(content);
+        int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客Id
+        string CouponCodes = data["CouponCodes"].ToString(); //券列表
+        Dictionary<string, object> Obj = new Dictionary<string, object>();
+        List<string> Codes = CouponCodes.Split(',').ToList();
+        List<int> LeaderUserIds = new List<int>();
+        int BeforeUserId = 0;
+        int AfterUserId = 0;
+        int index = 0;
+        IQueryable<PosCoupons> list = db.PosCoupons.Where(m => Codes.Contains(m.ExchangeCode) && m.UserId == UserId && m.IsLock == 0 && m.IsUse == 0).OrderBy(m => m.CreateDate);
+        foreach(PosCoupons sub in list)
+        {
+            index += 1;
+            if(index % 2 == 1) BeforeUserId = sub.LeaderUserId;
+            if(index % 2 == 0)
+            {
+                AfterUserId = sub.LeaderUserId;
+                if(BeforeUserId > 0 && AfterUserId > 0) LeaderUserIds.Add(AfterUserId);
+                if(BeforeUserId == 0 && AfterUserId > 0) LeaderUserIds.Add(AfterUserId);
+                if(BeforeUserId > 0 && AfterUserId == 0) LeaderUserIds.Add(BeforeUserId);
+                if(BeforeUserId == 0 && AfterUserId == 0) LeaderUserIds.Add(0);
+                BeforeUserId = 0;
+                AfterUserId = 0;
+            }
+            sub.UserId = 0;
+        }
+        db.SaveChanges();
+        int Count = Codes.Count / 2;
+        index = 0;
+        string ToCodes = "";
+        IQueryable<PosCoupons> chklist = db.PosCoupons.Where(m => m.QueryCount == 2 && m.UserId == 0 && m.IsLock == 0 && m.IsUse == 0).Take(Count);
+        foreach(PosCoupons sub in chklist)
+        {
+            sub.UserId = UserId;
+            sub.LeaderUserId = LeaderUserIds[index];
+            ToCodes += sub.ExchangeCode + ",";
+            index += 1;
+        }
+        db.PosCouponExchangeRecord.Add(new PosCouponExchangeRecord()
+        {
+            CreateDate = DateTime.Now,
+            Note = "兑换大机",
+            ToCount = Count,
+            SourceCount = Codes.Count,
+            ToCoupons = ToCodes.TrimEnd(','),
+            SourceCoupons = CouponCodes,
+            UserId = UserId,
+        });
+        db.SaveChanges();
+    }
+}

+ 20 - 0
PxcModels/ApiUrlRewrite.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.PxcModels
+{
+    public partial class ApiUrlRewrite
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string UrlPath { get; set; }
+        public int QueryCount { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+    }
+}

+ 14 - 0
PxcModels/JavaApiSet.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.PxcModels
+{
+    public partial class JavaApiSet
+    {
+        public int Id { get; set; }
+        public string ToApiHost { get; set; }
+        public string ToApiUrl { get; set; }
+        public string SourceApiUrl { get; set; }
+        public string ApiName { get; set; }
+    }
+}

+ 15 - 0
PxcModels/JavaApiSetFields.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.PxcModels
+{
+    public partial class JavaApiSetFields
+    {
+        public int Id { get; set; }
+        public string TargetFieldType { get; set; }
+        public string TargetFieldName { get; set; }
+        public string SourceFieldTitle { get; set; }
+        public string SourceFieldName { get; set; }
+        public int ApiId { get; set; }
+    }
+}

+ 18 - 0
PxcModels/LiShuaFeeSetRecord.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.PxcModels
+{
+    public partial class LiShuaFeeSetRecord
+    {
+        public int Id { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string TradeFeeAmt { get; set; }
+        public string TradeFeeRate { get; set; }
+        public string MerNo { get; set; }
+        public int MerId { get; set; }
+        public string PosSn { get; set; }
+        public int PosId { get; set; }
+    }
+}

+ 27 - 0
PxcModels/PosCouponExchangeRecord.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.PxcModels
+{
+    public partial class PosCouponExchangeRecord
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int Status { get; set; }
+        public int Version { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string Note { get; set; }
+        public int ToCount { get; set; }
+        public int SourceCount { get; set; }
+        public string ToCoupons { get; set; }
+        public string SourceCoupons { get; set; }
+        public int UserId { get; set; }
+        public int QueryCount { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+    }
+}

+ 4 - 0
PxcModels/PrizeFlowRecord.cs

@@ -14,5 +14,9 @@ namespace MySystem.PxcModels
         public string Detail { get; set; }
         public string CodeNumber { get; set; }
         public int Kind { get; set; }
+        public int QueryCount { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
     }
 }

+ 270 - 1
PxcModels/WebCMSEntities.cs

@@ -25,6 +25,7 @@ namespace MySystem.PxcModels
         public virtual DbSet<AdminMoveInfo> AdminMoveInfo { get; set; }
         public virtual DbSet<Advertisment> Advertisment { get; set; }
         public virtual DbSet<AgentLevelSet> AgentLevelSet { get; set; }
+        public virtual DbSet<ApiUrlRewrite> ApiUrlRewrite { get; set; }
         public virtual DbSet<AppBottomNavs> AppBottomNavs { get; set; }
         public virtual DbSet<AppVersion> AppVersion { get; set; }
         public virtual DbSet<AppVideo> AppVideo { get; set; }
@@ -70,6 +71,8 @@ namespace MySystem.PxcModels
         public virtual DbSet<HelpProfitRewardDetail> HelpProfitRewardDetail { get; set; }
         public virtual DbSet<HelpProfitUserTradeSummay> HelpProfitUserTradeSummay { get; set; }
         public virtual DbSet<IndexIconList> IndexIconList { get; set; }
+        public virtual DbSet<JavaApiSet> JavaApiSet { get; set; }
+        public virtual DbSet<JavaApiSetFields> JavaApiSetFields { get; set; }
         public virtual DbSet<KqProductBrand> KqProductBrand { get; set; }
         public virtual DbSet<KqProductOrgs> KqProductOrgs { get; set; }
         public virtual DbSet<KqProductRuleSet> KqProductRuleSet { get; set; }
@@ -87,6 +90,7 @@ namespace MySystem.PxcModels
         public virtual DbSet<LeaderReconRecord> LeaderReconRecord { get; set; }
         public virtual DbSet<LeaderReserveRecord> LeaderReserveRecord { get; set; }
         public virtual DbSet<Leaders> Leaders { get; set; }
+        public virtual DbSet<LiShuaFeeSetRecord> LiShuaFeeSetRecord { get; set; }
         public virtual DbSet<MachineApply> MachineApply { get; set; }
         public virtual DbSet<MachineApplyDetail> MachineApplyDetail { get; set; }
         public virtual DbSet<MachineChange> MachineChange { get; set; }
@@ -143,6 +147,7 @@ namespace MySystem.PxcModels
         public virtual DbSet<PageUpdateInfo> PageUpdateInfo { get; set; }
         public virtual DbSet<PosChannelSet> PosChannelSet { get; set; }
         public virtual DbSet<PosChannelSetRecord> PosChannelSetRecord { get; set; }
+        public virtual DbSet<PosCouponExchangeRecord> PosCouponExchangeRecord { get; set; }
         public virtual DbSet<PosCouponForUser> PosCouponForUser { get; set; }
         public virtual DbSet<PosCouponOrders> PosCouponOrders { get; set; }
         public virtual DbSet<PosCouponRecord> PosCouponRecord { get; set; }
@@ -992,6 +997,56 @@ namespace MySystem.PxcModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<ApiUrlRewrite>(entity =>
+            {
+                entity.HasComment("拦截接口配置");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort)
+                    .HasColumnType("int(11)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("修改时间");
+
+                entity.Property(e => e.UrlPath)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("路由地址")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<AppBottomNavs>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -4160,6 +4215,72 @@ namespace MySystem.PxcModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<JavaApiSet>(entity =>
+            {
+                entity.HasComment("java接口对接");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.ApiName)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("接口名称")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SourceApiUrl)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("来源地址")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ToApiHost)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("接收主机头")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.ToApiUrl)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("接收地址")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+            });
+
+            modelBuilder.Entity<JavaApiSetFields>(entity =>
+            {
+                entity.HasComment("java接口对接字段配置");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.ApiId)
+                    .HasColumnType("int(11)")
+                    .HasComment("父Id");
+
+                entity.Property(e => e.SourceFieldName)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("来源字段名")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SourceFieldTitle)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("来源字段说明")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.TargetFieldName)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("对应字段名")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.TargetFieldType)
+                    .HasColumnType("varchar(20)")
+                    .HasComment("对应字段类型")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+            });
+
             modelBuilder.Entity<KqProductBrand>(entity =>
             {
                 entity.HasComment("产品品牌");
@@ -5436,6 +5557,53 @@ namespace MySystem.PxcModels
                 entity.Property(e => e.UserId).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<LiShuaFeeSetRecord>(entity =>
+            {
+                entity.HasComment("立刷费率查询");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.MerId)
+                    .HasColumnType("int(11)")
+                    .HasComment("商户Id");
+
+                entity.Property(e => e.MerNo)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("商户号")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.PosId)
+                    .HasColumnType("int(11)")
+                    .HasComment("机具Id");
+
+                entity.Property(e => e.PosSn)
+                    .HasColumnType("varchar(50)")
+                    .HasComment("机具SN")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.TradeFeeAmt)
+                    .HasColumnType("varchar(10)")
+                    .HasComment("交易秒到费")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.TradeFeeRate)
+                    .HasColumnType("varchar(10)")
+                    .HasComment("交易费率")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("修改时间");
+            });
+
             modelBuilder.Entity<MachineApply>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -9928,6 +10096,90 @@ namespace MySystem.PxcModels
                     .HasComment("修改时间");
             });
 
+            modelBuilder.Entity<PosCouponExchangeRecord>(entity =>
+            {
+                entity.HasComment("电签券兑换记录");
+
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("创建时间");
+
+                entity.Property(e => e.CreateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Note)
+                    .HasColumnType("varchar(200)")
+                    .HasComment("备注")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort)
+                    .HasColumnType("int(11)")
+                    .HasComment("排序序号");
+
+                entity.Property(e => e.SourceCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("来源券数量");
+
+                entity.Property(e => e.SourceCoupons)
+                    .HasColumnType("mediumtext")
+                    .HasComment("来源券")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Status)
+                    .HasColumnType("int(11)")
+                    .HasComment("状态");
+
+                entity.Property(e => e.ToCount)
+                    .HasColumnType("int(11)")
+                    .HasComment("兑换券数量");
+
+                entity.Property(e => e.ToCoupons)
+                    .HasColumnType("mediumtext")
+                    .HasComment("兑换券")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate)
+                    .HasColumnType("datetime")
+                    .HasComment("修改时间");
+
+                entity.Property(e => e.UpdateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UserId)
+                    .HasColumnType("int(11)")
+                    .HasComment("创客");
+
+                entity.Property(e => e.Version)
+                    .HasColumnType("int(11)")
+                    .HasComment("版本号");
+            });
+
             modelBuilder.Entity<PosCouponForUser>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -10640,7 +10892,7 @@ namespace MySystem.PxcModels
                 entity.Property(e => e.MatchTime).HasColumnType("datetime");
 
                 entity.Property(e => e.MerIdcardNo)
-                    .HasColumnType("varchar(30)")
+                    .HasColumnType("varchar(18)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
@@ -11104,6 +11356,23 @@ namespace MySystem.PxcModels
                     .HasColumnType("int(11)")
                     .HasComment("分类");
 
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.Sort)
                     .HasColumnType("int(11)")
                     .HasComment("排序序号");

+ 1 - 0
Startup.cs

@@ -245,6 +245,7 @@ namespace MySystem
                 UpUserSaveService.Instance.Start(); //每天凌晨保存头一天的创客关系数据
                 HyfAddPrizeService.Instance.Start(); //盒力四射加码奖励发放
                 PrizeFlowRecordService.Instance.Start(); //奖励返现逻辑日志记录
+                PosCouponExchangeHelper.Instance.Start(); //电签券兑换大机券
             // }