瀏覽代碼

调整接口

lcl 1 年之前
父節點
當前提交
1d1de2163a

+ 46 - 1
AppStart/PublicFunction.cs

@@ -3,6 +3,10 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using MySystem.MainModels;
 using MySystem.MainModels;
 using Library;
 using Library;
+using Microsoft.IdentityModel.Tokens;
+using System.IdentityModel.Tokens.Jwt;
+using System.Security.Claims;
+using System.Text;
 
 
 
 
 namespace MySystem
 namespace MySystem
@@ -107,7 +111,6 @@ namespace MySystem
 
 
         #endregion
         #endregion
 
 
-
         #region 设置押金添加记录公共方法
         #region 设置押金添加记录公共方法
         public static void MerchantDepositSet(int BrandId, int UserId, int SnId, string SnNo, int BeforeDeposit, decimal DepositAmount, string ReturnNote)
         public static void MerchantDepositSet(int BrandId, int UserId, int SnId, string SnNo, int BeforeDeposit, decimal DepositAmount, string ReturnNote)
         {
         {
@@ -135,6 +138,48 @@ namespace MySystem
         }
         }
         #endregion
         #endregion
 
 
+
+
+        #region 获取jwt的token
+
+        public static string AppToken(int UserId, string JwtSecret, string JwtIss, string tag = "")
+        {
+            string Token = RedisDbconn.Instance.Get<string>("apptoken:" + UserId);
+            if(!string.IsNullOrEmpty(Token))
+            {
+                return Token;
+            }
+            string issuer = "new_" + UserId + tag;
+            string test = function.get_Random(10);
+            var securityKey = new SigningCredentials(new SymmetricSecurityKey(Encoding.ASCII.GetBytes(JwtSecret)), SecurityAlgorithms.HmacSha256);
+            var claims = new Claim[] {
+                new Claim(JwtRegisteredClaimNames.Iss,JwtIss),
+                new Claim(JwtRegisteredClaimNames.Aud,test),
+                new Claim("Guid", Guid.NewGuid().ToString("D")),
+                new Claim(ClaimTypes.Role, "system"),
+                new Claim(ClaimTypes.Role, "admin"),
+            };
+            SecurityToken securityToken = new JwtSecurityToken(
+                signingCredentials: securityKey,
+                expires: DateTime.Now.AddDays(10),//过期时间
+                claims: claims,
+                audience: test,
+                issuer: issuer
+            );
+            RedisDbconn.Instance.Set("utoken:" + issuer, test);
+            RedisDbconn.Instance.SetExpire("utoken:" + issuer, 3600 * 24 * 10);
+            //生成jwt令牌
+            Token = new JwtSecurityTokenHandler().WriteToken(securityToken);
+            RedisDbconn.Instance.Set("apptoken:" + UserId + tag, Token);
+            RedisDbconn.Instance.SetExpire("apptoken:" + UserId + tag, 3600 * 24 * 10 - 60);
+            //生成jwt令牌
+            return new JwtSecurityTokenHandler().WriteToken(securityToken);
+        }
+
+        #endregion
+
+
+
         //收支明细类别结合
         //收支明细类别结合
         public static List<int> IncomeTypes()
         public static List<int> IncomeTypes()
         {
         {

+ 0 - 11
AppStart/Redis/Mysql/MachineForQrCodeDbconn.cs

@@ -12,21 +12,10 @@ namespace MySystem
         #region 获取单个字段
         #region 获取单个字段
         public MachineForQrCode Get(string DataId)
         public MachineForQrCode Get(string DataId)
         {
         {
-            string key = "MachineForQrCode:" + DataId;
-            if (RedisDbconn.Instance.Exists(key))
-            {
-                MachineForQrCode obj = RedisDbconn.Instance.Get<MachineForQrCode>(key);
-                if (obj != null)
-                {
-                    return obj;
-                }
-            }
             WebCMSEntities db = new WebCMSEntities();
             WebCMSEntities db = new WebCMSEntities();
             MachineForQrCode order = db.MachineForQrCode.FirstOrDefault(m => m.DataId == DataId);
             MachineForQrCode order = db.MachineForQrCode.FirstOrDefault(m => m.DataId == DataId);
             if (order != null)
             if (order != null)
             {
             {
-                RedisDbconn.Instance.Set(key, order);
-                RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400));
             }
             }
             return order;
             return order;
         }
         }

+ 22 - 20
Areas/Api/Controllers/v1/MainServer/MerchantAddInfoController.cs

@@ -51,6 +51,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             string IdCardNational = data["IdCardNational"].ToString(); //身份证国徽面照片
             string IdCardNational = data["IdCardNational"].ToString(); //身份证国徽面照片
             string IdCardName = data["IdCardName"].ToString(); //身份证姓名
             string IdCardName = data["IdCardName"].ToString(); //身份证姓名
             string IdCardNumber = data["IdCardNumber"].ToString(); //身份证号码
             string IdCardNumber = data["IdCardNumber"].ToString(); //身份证号码
+            string IdCardAddress = data["IdCardAddress"].ToString(); //身份证号码
             string CardPeriodBeginString = data["CardPeriodBegin"].ToString();
             string CardPeriodBeginString = data["CardPeriodBegin"].ToString();
             if (string.IsNullOrEmpty(CardPeriodBeginString))
             if (string.IsNullOrEmpty(CardPeriodBeginString))
             {
             {
@@ -140,6 +141,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             query.IdCardNational = IdCardNational; //身份证国徽面照片
             query.IdCardNational = IdCardNational; //身份证国徽面照片
             query.IdCardName = IdCardName; //身份证姓名
             query.IdCardName = IdCardName; //身份证姓名
             query.IdCardNumber = IdCardNumber; //身份证号码
             query.IdCardNumber = IdCardNumber; //身份证号码
+            query.IdCardAddress = IdCardAddress; //身份证居住地址
             query.CardPeriodBegin = CardPeriodBegin; //身份证有效期开始时间
             query.CardPeriodBegin = CardPeriodBegin; //身份证有效期开始时间
             query.CardPeriodEnd = CardPeriodEnd; //身份证有效期结束时间
             query.CardPeriodEnd = CardPeriodEnd; //身份证有效期结束时间
             query.MerchantShortname = MerchantShortname;
             query.MerchantShortname = MerchantShortname;
@@ -456,26 +458,26 @@ namespace MySystem.Areas.Api.Controllers.v1
             dic.Add(new SettleData() { ptext = "宗教组织", text = "其他宗教服务", code = "P_P04_8999", value = "716", special = 1});
             dic.Add(new SettleData() { ptext = "宗教组织", text = "其他宗教服务", code = "P_P04_8999", value = "716", special = 1});
             dic.Add(new SettleData() { ptext = "文物经营/文物复制品销售", text = "文物经营/文物复制品销售", code = "C_C10_5971", value = "716", special = 1});
             dic.Add(new SettleData() { ptext = "文物经营/文物复制品销售", text = "文物经营/文物复制品销售", code = "C_C10_5971", value = "716", special = 1});
             dic.Add(new SettleData() { ptext = "拍卖典当", text = "典当行", code = "S_S04_5933", value = "716", special = 1});
             dic.Add(new SettleData() { ptext = "拍卖典当", text = "典当行", code = "S_S04_5933", value = "716", special = 1});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "公共交通", code = "A_A01_4121", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "旅行住宿", code = "A_A04_7011", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "公共仓储、集装整理", code = "A_A02_4225", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "商业服务", code = "S_S05_7338", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "汽车租赁和服务", code = "S_S10_7512", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "生活服务", code = "S_S08_7295", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "百货商城", code = "C_C04_5411", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "服饰鞋包", code = "C_C06_5699", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "家居家纺建材", code = "C_C03_5211", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "母婴玩具", code = "C_C02_5641", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "数码家电", code = "C_C07_5732", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "图书音像", code = "C_C09_5942", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "文化玩乐宠物", code = "C_C10_5995", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "彩票", code = "D_D03_7995", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "娱乐票务", code = "D_D01_7999", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "法律咨询和律师事务所", code = "P_P04_8111", value = "716", special = 1});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "办公用品", code = "B_B01_5943", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "工业产品", code = "B_B02_5065", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "汽车和运输工具", code = "B_B03_5599", value = "716", special = 0});
-            dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "专业咨询", code = "P_P04_8999", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "公共交通", code = "A_A01_4121", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "旅行住宿", code = "A_A04_7011", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "公共仓储、集装整理", code = "A_A02_4225", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "商业服务", code = "S_S05_7338", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "汽车租赁和服务", code = "S_S10_7512", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "生活服务", code = "S_S08_7295", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "百货商城", code = "C_C04_5411", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "服饰鞋包", code = "C_C06_5699", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "家居家纺建材", code = "C_C03_5211", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "母婴玩具", code = "C_C02_5641", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "数码家电", code = "C_C07_5732", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "图书音像", code = "C_C09_5942", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "文化玩乐宠物", code = "C_C10_5995", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "彩票", code = "D_D03_7995", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "娱乐票务", code = "D_D01_7999", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "法律咨询和律师事务所", code = "P_P04_8111", value = "716", special = 1});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "办公用品", code = "B_B01_5943", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "工业产品", code = "B_B02_5065", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "汽车和运输工具", code = "B_B03_5599", value = "716", special = 0});
+            // dic.Add(new SettleData() { ptext = "零售批发/生活娱乐/网上商城/其他", text = "专业咨询", code = "P_P04_8999", value = "716", special = 0});
             dic.Add(new SettleData() { ptext = "话费通讯", text = "话费充值与缴费", code = "D_D04_4815", value = "728", special = 1});
             dic.Add(new SettleData() { ptext = "话费通讯", text = "话费充值与缴费", code = "D_D04_4815", value = "728", special = 1});
             dic.Add(new SettleData() { ptext = "婚介平台/就业信息平台/其他", text = "婚介服务", code = "S_S08_7273", value = "728", special = 0});
             dic.Add(new SettleData() { ptext = "婚介平台/就业信息平台/其他", text = "婚介服务", code = "S_S08_7273", value = "728", special = 0});
             dic.Add(new SettleData() { ptext = "门户论坛/网络广告及推广/软件开发/其他", text = "计算机服务/其他", code = "D_D05_7372", value = "711", special = 0});
             dic.Add(new SettleData() { ptext = "门户论坛/网络广告及推广/软件开发/其他", text = "计算机服务/其他", code = "D_D05_7372", value = "711", special = 0});

+ 5 - 4
Areas/Api/Controllers/v1/MainServer/MerchantInfoController.cs

@@ -627,14 +627,14 @@ namespace MySystem.Areas.Api.Controllers.v1
         {
         {
             JsonData data = JsonMapper.ToObject(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             Dictionary<string, object> Obj = new Dictionary<string, object>();
-            MerchantInfo query = new MerchantInfo();
             int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
             int Id = int.Parse(function.CheckInt(data["Id"].ToString()));
-            query = MerchantInfoDbconn.Instance.Get(Id) ?? new MerchantInfo();
+            MerchantInfo query = MerchantInfoDbconn.Instance.Get(Id) ?? new MerchantInfo();
+            MerchantAddInfo merchantAddInfo = maindb.MerchantAddInfo.FirstOrDefault(m => m.Id == Id) ?? new MerchantAddInfo();
             Obj.Add("Name", query.Name); //名称
             Obj.Add("Name", query.Name); //名称
             Obj.Add("Mobile", query.Mobile); //手机号
             Obj.Add("Mobile", query.Mobile); //手机号
             Obj.Add("IsAuth", query.IsAuth); //是否认证
             Obj.Add("IsAuth", query.IsAuth); //是否认证
             Obj.Add("Logo", DefaultPic(query.Logo)); //Logo图片
             Obj.Add("Logo", DefaultPic(query.Logo)); //Logo图片
-            Obj.Add("Status", query.Status);
+            Obj.Add("Status", merchantAddInfo.Status);
             Obj.Add("CreateDate", query.CreateDate == null ? "" : query.CreateDate.Value.ToString("yyyy-MM-dd"));
             Obj.Add("CreateDate", query.CreateDate == null ? "" : query.CreateDate.Value.ToString("yyyy-MM-dd"));
             return Obj;
             return Obj;
         }
         }
@@ -725,7 +725,7 @@ namespace MySystem.Areas.Api.Controllers.v1
 
 
 
 
         #region 商户-登录
         #region 商户-登录
-        [Authorize]
+        // [Authorize]
         public JsonResult Login(string value)
         public JsonResult Login(string value)
         {
         {
             value = DesDecrypt(value);
             value = DesDecrypt(value);
@@ -753,6 +753,7 @@ namespace MySystem.Areas.Api.Controllers.v1
                 return Json(new AppResultJson() { Status = "-1", Info = "登录密码不正确" });
                 return Json(new AppResultJson() { Status = "-1", Info = "登录密码不正确" });
             }
             }
             Obj.Add("Id", query.Id); //Id
             Obj.Add("Id", query.Id); //Id
+            Obj.Add("Token", PublicFunction.AppToken(query.Id, JwtSecret, JwtIss, "merchant"));
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
         }
         }
         #endregion
         #endregion

+ 26 - 21
Areas/Api/Controllers/v1/MainServer/MerchantQrCodeController.cs

@@ -78,19 +78,20 @@ namespace MySystem.Areas.Api.Controllers.v1
             string MachineNo = data["Machine"].ToString(); //音箱码
             string MachineNo = data["Machine"].ToString(); //音箱码
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             MerchantQrCode query = new MerchantQrCodeService().Query(SnNo);
             MerchantQrCode query = new MerchantQrCodeService().Query(SnNo);
-            if (query != null)
+            if (query.Id > 0)
             {
             {
                 if (query.MerchantId > 0)
                 if (query.MerchantId > 0)
                 {
                 {
                     return new AppResultJson() { Status = "-1", Info = "此二维码已被绑定,请勿重复绑定" };
                     return new AppResultJson() { Status = "-1", Info = "此二维码已被绑定,请勿重复绑定" };
                 }
                 }
             }
             }
-            query = new MerchantQrCode();
-            // query.Id = PublicFunction.MakeMerchantQrCodeId();
-            query.CreateDate = DateTime.Now; //绑定时间
-            query.MerchantId = MerchantId; //商户
-            query.SnNo = SnNo;
-            PosMachines machine = PosMachinesDbconn.Instance.Get(MachineNo);
+            query = maindb.MerchantQrCode.Add(new MerchantQrCode(){
+                CreateDate = DateTime.Now, //绑定时间
+                MerchantId = MerchantId, //商户
+                SnNo = SnNo,
+            }).Entity;
+            maindb.SaveChanges();
+            PosMachines machine = maindb.PosMachines.FirstOrDefault(m => m.PosSn == MachineNo);
             if (machine != null)
             if (machine != null)
             {
             {
                 if (machine.BindMerchantId > 0)
                 if (machine.BindMerchantId > 0)
@@ -101,23 +102,25 @@ namespace MySystem.Areas.Api.Controllers.v1
             }
             }
             else if (!string.IsNullOrEmpty(MachineNo))
             else if (!string.IsNullOrEmpty(MachineNo))
             {
             {
-                machine = new PosMachines();
-                // machine.Id = PublicFunction.MakeMachineId();
-                machine.PosSn = MachineNo;
-                machine.BindMerchantId = MerchantId;
-                machine.BindingState = 1;
-                machine.BindingTime = DateTime.Now;
+                machine = maindb.PosMachines.Add(new PosMachines(){
+                    PosSn = MachineNo,
+                    BindMerchantId = MerchantId,
+                    BindingState = 1,
+                    BindingTime = DateTime.Now,
+                }).Entity;
+                maindb.SaveChanges();
 
 
                 string DataId = query.Id + "_" + machine.Id;
                 string DataId = query.Id + "_" + machine.Id;
-                MachineForQrCode forQrCode = MachineForQrCodeDbconn.Instance.Get(DataId);
+                MachineForQrCode forQrCode = maindb.MachineForQrCode.FirstOrDefault(m => m.DataId == DataId);
                 if (forQrCode == null)
                 if (forQrCode == null)
                 {
                 {
-                    forQrCode = new MachineForQrCode();
-                    forQrCode.DataId = DataId;
-                    forQrCode.SnNo = SnNo;
-                    forQrCode.MachineSnNo = MachineNo;
-                    forQrCode.BindDate = DateTime.Now;
-                    forQrCode.MerchantId = MerchantId;
+                    forQrCode = maindb.MachineForQrCode.Add(new MachineForQrCode(){
+                        DataId = DataId,
+                        SnNo = SnNo,
+                        MachineSnNo = MachineNo,
+                        BindDate = DateTime.Now,
+                        MerchantId = MerchantId,
+                    }).Entity;
                 }
                 }
                 else
                 else
                 { 
                 { 
@@ -126,8 +129,10 @@ namespace MySystem.Areas.Api.Controllers.v1
                     forQrCode.BindDate = DateTime.Now;
                     forQrCode.BindDate = DateTime.Now;
                     forQrCode.MerchantId = MerchantId;
                     forQrCode.MerchantId = MerchantId;
                 }
                 }
+                maindb.SaveChanges();
+                return new AppResultJson() { Status = "2", Info = "", Data = Obj };
             }
             }
-            return new AppResultJson() { Status = "2", Info = "", Data = Obj };
+            return new AppResultJson() { Status = "-1", Info = "绑定失败" };
         }
         }
         #endregion
         #endregion
 
 

+ 109 - 0
Areas/Api/Controllers/v1/MainServer/ProfitRewardRecordController.cs

@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using Microsoft.AspNetCore.Authorization;
+using System.Web;
+using MySystem.MainModels;
+using LitJson;
+using Library;
+
+namespace MySystem.Areas.Api.Controllers.v1.pos
+{
+    [Area("Api")]
+    [Route("Api/v1/pos/[controller]/[action]")]
+    public class ProfitRewardRecordController : BaseController
+    {
+        public ProfitRewardRecordController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+        }
+
+
+
+
+        #region 首页-客小爽产品-收益查看-交易分润
+        [Authorize]
+        public JsonResult TradeProfitList(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            List<Dictionary<string, object>> dataList = TradeProfitListDo(value);
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });
+        }
+        public List<Dictionary<string, object>> TradeProfitListDo(string value)
+        {
+            JsonData data = JsonMapper.ToObject(value);
+            int UserId = int.Parse(function.CheckInt(data["UserId"].ToString())); //创客
+            int ProductType = int.Parse(function.CheckInt(data["ProductType"].ToString()));//产品类型
+            int PageSize = int.Parse(function.CheckInt(data["PageSize"].ToString()));
+            int PageNum = int.Parse(function.CheckInt(data["PageNum"].ToString()));
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            IQueryable<ProfitRecord> query = maindb.ProfitRecord.Where(m => m.UserId == UserId && m.BrandId == ProductType).OrderByDescending(m => m.Id);
+            if (PageNum == 1)
+            {
+                query = query.Take(PageSize);
+            }
+            else
+            {
+                int skipNum = PageSize * (PageNum - 1);
+                query = query.Skip(skipNum).Take(PageSize);
+            }
+            Dictionary<string, string> items = new Dictionary<string, string>();
+            foreach (var subdata in query.ToList())
+            {
+                if(!items.ContainsKey(subdata.SeoTitle))
+                {
+                    string CreateDate = subdata.CreateDate == null ? "" : subdata.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
+                    items.Add(subdata.SeoTitle, subdata.ProfitAmount + "|" + CreateDate);
+                }
+                else
+                {
+                    string[] datalist = items[subdata.SeoTitle].Split('|');
+                    decimal ProfitAmount = decimal.Parse(datalist[0]) + subdata.ProfitAmount;
+                    items[subdata.SeoTitle] = ProfitAmount + "|" + datalist[1];
+                }
+            }
+            foreach (string MonthString in items.Keys)
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                string[] datalist = items[MonthString].Split('|');
+                curData.Add("TradeProfit", datalist[0]); //交易分润
+                string Month = MonthString.Substring(0, 4) + "-" + MonthString.Substring(4);
+                curData.Add("TradeMonth", Month); //交易月
+                curData.Add("CreateDate", datalist[1]); //CreateDate
+                dataList.Add(curData);
+            }
+            return dataList;
+        }
+        #endregion
+
+
+
+
+        #region 检查签名是否合法,合法返回1,不合法返回提示信息
+
+        /// <summary>
+        /// 检查签名是否合法,合法返回1,不合法返回提示信息
+        /// </summary>
+        /// <param name="value">请求的参数(json字符串)</param>
+        /// <param name="signField">要签名的字段</param>
+        /// <returns></returns>
+        private string CheckSign(string value, string[] signField)
+        {
+            JsonData json = JsonMapper.ToObject(value);
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            for (int i = 0; i < signField.Length; i++)
+            {
+                dic.Add(signField[i], json[signField[i]].ToString());
+            }
+            string sign = json["sign"].ToString(); //客户端签名字符串
+            return new Sign().sign(dic, sign);
+        }
+
+        #endregion
+
+    }
+}

+ 1 - 38
Areas/Api/Controllers/v1/MainServer/UsersController.cs

@@ -11,10 +11,6 @@ using System.Web;
 using MySystem.MainModels;
 using MySystem.MainModels;
 using LitJson;
 using LitJson;
 using Library;
 using Library;
-using Microsoft.IdentityModel.Tokens;
-using System.IdentityModel.Tokens.Jwt;
-using System.Security.Claims;
-using System.Text;
 
 
 namespace MySystem.Areas.Api.Controllers.v1
 namespace MySystem.Areas.Api.Controllers.v1
 {
 {
@@ -417,42 +413,9 @@ namespace MySystem.Areas.Api.Controllers.v1
                 maindb.SaveChanges();
                 maindb.SaveChanges();
             }
             }
             Obj.Add("Id", user.Id);
             Obj.Add("Id", user.Id);
-            Obj.Add("Token", AppToken(user.Id));
+            Obj.Add("Token", PublicFunction.AppToken(user.Id, JwtSecret, JwtIss));
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
         }
         }
-        public string AppToken(int UserId)
-        {
-            string Token = RedisDbconn.Instance.Get<string>("apptoken:" + UserId);
-            if(!string.IsNullOrEmpty(Token))
-            {
-                return Token;
-            }
-            string issuer = "new_" + UserId;
-            string test = function.get_Random(10);
-            var securityKey = new SigningCredentials(new SymmetricSecurityKey(Encoding.ASCII.GetBytes(JwtSecret)), SecurityAlgorithms.HmacSha256);
-            var claims = new Claim[] {
-                new Claim(JwtRegisteredClaimNames.Iss,JwtIss),
-                new Claim(JwtRegisteredClaimNames.Aud,test),
-                new Claim("Guid", Guid.NewGuid().ToString("D")),
-                new Claim(ClaimTypes.Role, "system"),
-                new Claim(ClaimTypes.Role, "admin"),
-            };
-            SecurityToken securityToken = new JwtSecurityToken(
-                signingCredentials: securityKey,
-                expires: DateTime.Now.AddDays(10),//过期时间
-                claims: claims,
-                audience: test,
-                issuer: issuer
-            );
-            RedisDbconn.Instance.Set("utoken:" + issuer, test);
-            RedisDbconn.Instance.SetExpire("utoken:" + issuer, 3600 * 24 * 10);
-            //生成jwt令牌
-            Token = new JwtSecurityTokenHandler().WriteToken(securityToken);
-            RedisDbconn.Instance.Set("apptoken:" + UserId, Token);
-            RedisDbconn.Instance.SetExpire("apptoken:" + UserId, 3600 * 24 * 10 - 60);
-            //生成jwt令牌
-            return new JwtSecurityTokenHandler().WriteToken(securityToken);
-        }
         #endregion
         #endregion
 
 
 
 

+ 1 - 0
MainModels/MerchantAddInfo.cs

@@ -96,5 +96,6 @@ namespace MySystem.MainModels
         public string ContactIdNumber { get; set; }
         public string ContactIdNumber { get; set; }
         public string ContactName { get; set; }
         public string ContactName { get; set; }
         public string BusinessCode { get; set; }
         public string BusinessCode { get; set; }
+        public string IdCardAddress { get; set; }
     }
     }
 }
 }

+ 7 - 2
MainModels/WebCMSEntities.cs

@@ -5067,6 +5067,11 @@ namespace MySystem.MainModels
                     .HasCharSet("utf8")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
                     .HasCollation("utf8_general_ci");
 
 
+                entity.Property(e => e.IdCardAddress)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.IdCardCopy)
                 entity.Property(e => e.IdCardCopy)
                     .HasColumnType("varchar(200)")
                     .HasColumnType("varchar(200)")
                     .HasCharSet("utf8")
                     .HasCharSet("utf8")
@@ -10071,9 +10076,9 @@ namespace MySystem.MainModels
                     .HasCharSet("utf8")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
                     .HasCollation("utf8_general_ci");
 
 
-                entity.Property(e => e.DebitAddProfitVal).HasColumnType("decimal(18,2)");
+                entity.Property(e => e.DebitAddProfitVal).HasColumnType("decimal(18,6)");
 
 
-                entity.Property(e => e.DebitPercents).HasColumnType("decimal(18,2)");
+                entity.Property(e => e.DebitPercents).HasColumnType("decimal(18,6)");
 
 
                 entity.Property(e => e.KindId).HasColumnType("int(11)");
                 entity.Property(e => e.KindId).HasColumnType("int(11)");