Эх сурвалжийг харах

删除代码多余分号
添加列表返回总数

DuGuYang 2 жил өмнө
parent
commit
700f37e036

+ 4 - 5
Areas/Api/Controllers/SysAdminController.cs

@@ -24,7 +24,6 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
 
         #region 登录
-
         public JsonResult Login(string value)
         {
             value = PublicFunction.DesDecrypt(value);
@@ -32,7 +31,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             string userName = jsonObj["userName"].ToString(); //账号
             string pwd = jsonObj["pwd"].ToString(); //密码
             SysAdmin sys = SysAdminService.Query(userName, function.MD5_32(pwd));
-            if(sys.Id == 0)
+            if (sys.Id == 0)
             {
                 return Json(new AppResultJson() { Status = "-1", Info = "账号或密码不正确" });
             }
@@ -45,7 +44,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             obj.Add("apiTokenExpiredDate", DateTime.Now.AddDays(10).ToString("yyyy-MM-dd HH:mm:ss"));
             string token = dbconn.Encrypt3DES(sys.Id.ToString() + "-" + function.ConvertDateTimeInt(DateTime.Now));
             RefreshTokens check = RefreshTokensService.Query(sys.Id);
-            if(check.UserId == 0)
+            if (check.UserId == 0)
             {
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("UserId", sys.Id);
@@ -84,7 +83,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             string[] data = dbconn.Decrypt3DES(refreshToken).Split('-');
             int Id = int.Parse(data[0]);
             SysAdmin sys = SysAdminService.Query(Id);
-            if(sys.Id == 0)
+            if (sys.Id == 0)
             {
                 return Json(new AppResultJson() { Status = "-1", Info = "刷新失败" });
             }
@@ -92,7 +91,7 @@ namespace MySystem.Areas.Api.Controllers.v1
             obj.Add("apiTokenExpiredDate", DateTime.Now.AddDays(10));
             string token = dbconn.Encrypt3DES(sys.Id.ToString() + "-" + function.ConvertDateTimeInt(DateTime.Now));
             RefreshTokens check = RefreshTokensService.Query(sys.Id);
-            if(check.UserId == 0)
+            if (check.UserId == 0)
             {
                 Dictionary<string, object> Fields = new Dictionary<string, object>();
                 Fields.Add("UserId", sys.Id);

+ 84 - 0
Areas/Api/Controllers/TestController.cs

@@ -0,0 +1,84 @@
+/*
+ * 测试
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using MySystem.Models.Bs;
+using Library;
+using LitJson;
+using Microsoft.AspNetCore.Authorization;
+using MySystem.Service.Bs;
+
+namespace MySystem.Areas.Api.Controllers.v1
+{
+    [Area("Api")]
+    [Route("Api/v1/[controller]/[action]")]
+    public class TestController : BaseController
+    {
+        public TestController(IHttpContextAccessor accessor) : base(accessor)
+        {
+        }
+
+        #region 测试方法
+
+        /// <summary>
+        /// 产品库列表
+        /// </summary>
+        /// <returns></returns>
+        // [HttpPost]
+        // [Authorize]
+        [Route("/main/test/all")]
+        public JsonResult List(string value)
+        {
+            value = PublicFunction.DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            string userName = "root"; //账号
+            string pwd = "123456"; //密码
+            SysAdmin sys = SysAdminService.Query(userName, function.MD5_32(pwd));
+            if (sys.Id == 0)
+            {
+                return Json(new AppResultJson() { Status = "-1", Info = "账号或密码不正确" });
+            }
+            int RoleId = int.Parse(function.CheckInt(sys.Role));
+            SysAdminRole Role = SysAdminRoleService.Query(RoleId);
+            string RightInfo = function.CheckNull(Role.RightInfo);
+            Dictionary<string, object> obj = new Dictionary<string, object>(); //返回字段
+            obj.Add("rightList", new AdminRightList().GetRight(sys.Role, RightInfo)); //权限列表
+            obj.Add("apiToken", PublicFunction.AppToken(sys.AdminName)); //后台所有接口API所需的token
+            obj.Add("apiTokenExpiredDate", DateTime.Now.AddDays(10).ToString("yyyy-MM-dd HH:mm:ss"));
+            string token = dbconn.Encrypt3DES(sys.Id.ToString() + "-" + function.ConvertDateTimeInt(DateTime.Now));
+            RefreshTokens check = RefreshTokensService.Query(sys.Id);
+            if (check.UserId == 0)
+            {
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("UserId", sys.Id);
+                Fields.Add("ExpiredDate", DateTime.Now.AddDays(10));
+                Fields.Add("RefreshToken", token);
+                RefreshTokensService.Add(Fields);
+            }
+            else
+            {
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("ExpiredDate", DateTime.Now.AddDays(10));
+                Fields.Add("RefreshToken", token);
+                RefreshTokensService.Edit(Fields, sys.Id);
+            }
+            List<string> roles = new List<string>();
+            roles.Add(sys.Role);
+            obj.Add("roles", roles);
+            obj.Add("realName", sys.RealName);
+            obj.Add("refreshToken", token); //主token,用于刷新apiToken
+            AppConfig.LoginSession.sysId = sys.Id;
+            AppConfig.LoginSession.sysAdminName = sys.AdminName;
+            AppConfig.LoginSession.sysRealName = sys.RealName;
+            return Json(new AppResultJson() { Status = "1", Info = "", Data = obj });
+        }
+
+        #endregion
+
+    }
+}

+ 3 - 2
Areas/Api/Controllers/v1/Main1/ConsumerOrdersController.cs

@@ -26,7 +26,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectConsumerOrdersList(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Other = new Dictionary<string, object>();
             List<Dictionary<string, object>> dataList = DirectConsumerOrdersListDo(value, out Other);
@@ -109,6 +109,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
                 curData.Add("SubjectType", subdata["SubjectType"].ToString()); //主体类型(1 企业 2 个体)
                 dataList.Add(curData);
             }
+            Other.Add("Count", count); //总数
             return dataList;
         }
         #endregion
@@ -119,7 +120,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectQueryDivideAccounts(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             List<Dictionary<string, object>> dataList = DirectQueryDivideAccountsDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });

+ 7 - 6
Areas/Api/Controllers/v1/Main1/MerchantAddInfoController.cs

@@ -27,7 +27,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectList(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Other = new Dictionary<string, object>();
             List<Dictionary<string, object>> dataList = DirectListDo(value, out Other);
@@ -108,6 +108,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
 
                 dataList.Add(curData);
             }
+            Other.Add("Count", count); //总数
             return dataList;
         }
         #endregion
@@ -118,7 +119,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectQueryFailReason(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = DirectQueryFailReasonDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
@@ -151,7 +152,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectDetail(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = DirectDetailDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
@@ -172,7 +173,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectSubmit(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             AppResultJson result = DirectSubmitDo(value);
             return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
@@ -199,7 +200,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectQueryMerchantTradeInfo(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = DirectQueryMerchantTradeInfoDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
@@ -226,7 +227,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectAddPIDOrWeChatNo(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             AppResultJson result = DirectAddPIDOrWeChatNoDo(value);
             return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });

+ 3 - 3
Areas/Api/Controllers/v1/Main1/MerchantDepositBackController.cs

@@ -26,7 +26,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectBatchImport(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             AppResultJson result = DirectBatchImportDo(value);
             return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
@@ -53,7 +53,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectBatchExport(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             AppResultJson result = DirectBatchExportDo(value);
             return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
@@ -77,7 +77,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectMerchantDepositBack(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             List<Dictionary<string, object>> dataList = DirectMerchantDepositBackDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });

+ 1 - 1
Areas/Api/Controllers/v1/Main1/MerchantDepositOrderController.cs

@@ -26,7 +26,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectActRecord(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             List<Dictionary<string, object>> dataList = DirectActRecordDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });

+ 1 - 1
Areas/Api/Controllers/v1/Main1/MerchantInfoController.cs

@@ -26,7 +26,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main1
         [Authorize]
         public JsonResult DirectQualifiedMerchants(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             List<Dictionary<string, object>> dataList = DirectQualifiedMerchantsDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });

+ 3 - 2
Areas/Api/Controllers/v1/Main2/ConsumerOrdersController.cs

@@ -26,7 +26,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayConsumerOrdersList(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Other = new Dictionary<string, object>();
             List<Dictionary<string, object>> dataList = UnionPayConsumerOrdersListDo(value, out Other);
@@ -109,6 +109,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
                 curData.Add("MaxDivi", subdata["MaxDivi"].ToString()); //分账金额
                 curData.Add("SubjectType", subdata["SubjectType"].ToString()); //主体类型(1 企业 2 个体 3 小微)
             }
+            Other.Add("Count", count); //总数
             return dataList;
         }
         #endregion
@@ -119,7 +120,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayQueryDivideAccounts(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             List<Dictionary<string, object>> dataList = UnionPayQueryDivideAccountsDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });

+ 5 - 4
Areas/Api/Controllers/v1/Main2/MerchantAddInfoController.cs

@@ -27,7 +27,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayList(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Other = new Dictionary<string, object>();
             List<Dictionary<string, object>> dataList = UnionPayListDo(value, out Other);
@@ -111,6 +111,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
 
                 dataList.Add(curData);
             }
+            Other.Add("Count", count); //总数
             return dataList;
         }
         #endregion
@@ -121,7 +122,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayQueryFailReason(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = UnionPayQueryFailReasonDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
@@ -154,7 +155,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayDetail(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             Dictionary<string, object> Obj = UnionPayDetailDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
@@ -175,7 +176,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPaySubmit(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             AppResultJson result = UnionPaySubmitDo(value);
             return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });

+ 3 - 3
Areas/Api/Controllers/v1/Main2/MerchantDepositBackController.cs

@@ -26,7 +26,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayBatchImport(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             AppResultJson result = UnionPayBatchImportDo(value);
             return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
@@ -52,7 +52,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayBatchExport(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             AppResultJson result = UnionPayBatchExportDo(value);
             return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
@@ -76,7 +76,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayMerchantDepositBack(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             List<Dictionary<string, object>> dataList = UnionPayMerchantDepositBackDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });

+ 1 - 1
Areas/Api/Controllers/v1/Main2/MerchantDepositOrderController.cs

@@ -26,7 +26,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayActRecord(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             List<Dictionary<string, object>> dataList = UnionPayActRecordDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });

+ 1 - 1
Areas/Api/Controllers/v1/Main2/MerchantInfoController.cs

@@ -26,7 +26,7 @@ namespace MySystem.Areas.Api.Controllers.v1.Main2
         [Authorize]
         public JsonResult UnionPayQualifiedMerchants(string value)
         {
-            value = PublicFunction.DesDecrypt(value); ;
+            value = PublicFunction.DesDecrypt(value);
             JsonData data = JsonMapper.ToObject(value);
             List<Dictionary<string, object>> dataList = UnionPayQualifiedMerchantsDo(value);
             return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList });