zhoufan лет назад: 4
Сommit
c33d7c7be9
47 измененных файлов с 6180 добавлено и 0 удалено
  1. 25 0
      RMYY_CallCenter_Api.Bll/PagerBLL.cs
  2. 36 0
      RMYY_CallCenter_Api.Bll/Properties/AssemblyInfo.cs
  3. 63 0
      RMYY_CallCenter_Api.Bll/RMYY_CallCenter_Api.Bll.csproj
  4. 149 0
      RMYY_CallCenter_Api.Bll/T_Sys_UserAccount.cs
  5. 75 0
      RMYY_CallCenter_Api.DB/CommandInfo.cs
  6. 1455 0
      RMYY_CallCenter_Api.DB/DbHelperSQL.cs
  7. 36 0
      RMYY_CallCenter_Api.DB/Properties/AssemblyInfo.cs
  8. 56 0
      RMYY_CallCenter_Api.DB/RMYY_CallCenter_Api.DB.csproj
  9. 26 0
      RMYY_CallCenter_Api.Dal/PagerDAL.cs
  10. 36 0
      RMYY_CallCenter_Api.Dal/Properties/AssemblyInfo.cs
  11. 59 0
      RMYY_CallCenter_Api.Dal/RMYY_CallCenter_Api.Dal.csproj
  12. 409 0
      RMYY_CallCenter_Api.Dal/T_Sys_UserAccount.cs
  13. 36 0
      RMYY_CallCenter_Api.Model/Properties/AssemblyInfo.cs
  14. 48 0
      RMYY_CallCenter_Api.Model/RMYY_CallCenter_Api.Model.csproj
  15. 184 0
      RMYY_CallCenter_Api.Model/T_Sys_UserAccount.cs
  16. 43 0
      RMYY_CallCenter_Api.Utility/Extention/Json.cs
  17. 113 0
      RMYY_CallCenter_Api.Utility/Extention/Object.cs
  18. 351 0
      RMYY_CallCenter_Api.Utility/Extention/String.cs
  19. 130 0
      RMYY_CallCenter_Api.Utility/Helper/CacheHelper.cs
  20. 68 0
      RMYY_CallCenter_Api.Utility/Helper/ConfigHelper.cs
  21. 262 0
      RMYY_CallCenter_Api.Utility/Helper/HttpHelper.cs
  22. 90 0
      RMYY_CallCenter_Api.Utility/Helper/LogHelper.cs
  23. 212 0
      RMYY_CallCenter_Api.Utility/Helper/NPOIHelper.cs
  24. 815 0
      RMYY_CallCenter_Api.Utility/Helper/RedisHelper.cs
  25. 90 0
      RMYY_CallCenter_Api.Utility/Models/AjaxResult.cs
  26. 36 0
      RMYY_CallCenter_Api.Utility/Properties/AssemblyInfo.cs
  27. 86 0
      RMYY_CallCenter_Api.Utility/RMYY_CallCenter_Api.Utility.csproj
  28. 8 0
      RMYY_CallCenter_Api.Utility/packages.config
  29. 55 0
      RMYY_CallCenter_Api.sln
  30. 15 0
      RMYY_CallCenter_Api/App_Start/FilterConfig.cs
  31. 23 0
      RMYY_CallCenter_Api/App_Start/RouteConfig.cs
  32. 129 0
      RMYY_CallCenter_Api/Configs/log4net.config
  33. 52 0
      RMYY_CallCenter_Api/Configs/system.config
  34. 118 0
      RMYY_CallCenter_Api/Controllers/BaseController.cs
  35. 57 0
      RMYY_CallCenter_Api/Controllers/HomeController.cs
  36. 99 0
      RMYY_CallCenter_Api/Controllers/System/UserAccountController.cs
  37. 76 0
      RMYY_CallCenter_Api/Filter/AuthorizeFilter.cs
  38. 35 0
      RMYY_CallCenter_Api/Filter/ExceptionFilter.cs
  39. 1 0
      RMYY_CallCenter_Api/Global.asax
  40. 45 0
      RMYY_CallCenter_Api/Global.asax.cs
  41. 77 0
      RMYY_CallCenter_Api/Models/FormsPrincipal.cs
  42. 35 0
      RMYY_CallCenter_Api/Properties/AssemblyInfo.cs
  43. 210 0
      RMYY_CallCenter_Api/RMYY_CallCenter_Api.csproj
  44. 30 0
      RMYY_CallCenter_Api/Web.Debug.config
  45. 31 0
      RMYY_CallCenter_Api/Web.Release.config
  46. 77 0
      RMYY_CallCenter_Api/Web.config
  47. 18 0
      RMYY_CallCenter_Api/packages.config

+ 25 - 0
RMYY_CallCenter_Api.Bll/PagerBLL.cs

@@ -0,0 +1,25 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Data;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace RMYY_CallCenter_Api.Bll
9
+{
10
+    public class PagerBll
11
+    {
12
+        /// <summary>
13
+        /// 分页获取数据
14
+        /// </summary>
15
+        /// <param name="PageSize"></param>
16
+        /// <param name="PageIndex"></param>
17
+        /// <param name="strWhere"></param>
18
+        /// <returns></returns>
19
+        public static DataTable GetListPager(string TableName, string PK, string Fields, string WhereStr, string OrderStr, int PageSize, int PageIndex, bool IsCount, out int RecordCount)
20
+        {
21
+            DataTable dt = Dal.PagerDAL.GetListPager(TableName, PK, Fields, WhereStr, OrderStr, PageSize, PageIndex, IsCount, out RecordCount);
22
+            return dt;
23
+        }
24
+    }
25
+}

+ 36 - 0
RMYY_CallCenter_Api.Bll/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// 有关程序集的一般信息由以下
6
+// 控制。更改这些特性值可修改
7
+// 与程序集关联的信息。
8
+[assembly: AssemblyTitle("RMYY_CallCenter_Api.Bll")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("RMYY_CallCenter_Api.Bll")]
13
+[assembly: AssemblyCopyright("Copyright ©  2021")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// 将 ComVisible 设置为 false 会使此程序集中的类型
18
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19
+//请将此类型的 ComVisible 特性设置为 true。
20
+[assembly: ComVisible(false)]
21
+
22
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23
+[assembly: Guid("7cc643a2-983d-4bdf-a9b1-6d169a026b76")]
24
+
25
+// 程序集的版本信息由下列四个值组成: 
26
+//
27
+//      主版本
28
+//      次版本
29
+//      生成号
30
+//      修订号
31
+//
32
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
33
+//通过使用 "*",如下所示:
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 63 - 0
RMYY_CallCenter_Api.Bll/RMYY_CallCenter_Api.Bll.csproj

@@ -0,0 +1,63 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{7CC643A2-983D-4BDF-A9B1-6D169A026B76}</ProjectGuid>
8
+    <OutputType>Library</OutputType>
9
+    <AppDesignerFolder>Properties</AppDesignerFolder>
10
+    <RootNamespace>RMYY_CallCenter_Api.Bll</RootNamespace>
11
+    <AssemblyName>RMYY_CallCenter_Api.Bll</AssemblyName>
12
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13
+    <FileAlignment>512</FileAlignment>
14
+    <Deterministic>true</Deterministic>
15
+  </PropertyGroup>
16
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17
+    <DebugSymbols>true</DebugSymbols>
18
+    <DebugType>full</DebugType>
19
+    <Optimize>false</Optimize>
20
+    <OutputPath>bin\Debug\</OutputPath>
21
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
22
+    <ErrorReport>prompt</ErrorReport>
23
+    <WarningLevel>4</WarningLevel>
24
+  </PropertyGroup>
25
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26
+    <DebugType>pdbonly</DebugType>
27
+    <Optimize>true</Optimize>
28
+    <OutputPath>bin\Release\</OutputPath>
29
+    <DefineConstants>TRACE</DefineConstants>
30
+    <ErrorReport>prompt</ErrorReport>
31
+    <WarningLevel>4</WarningLevel>
32
+  </PropertyGroup>
33
+  <ItemGroup>
34
+    <Reference Include="System" />
35
+    <Reference Include="System.Core" />
36
+    <Reference Include="System.Xml.Linq" />
37
+    <Reference Include="System.Data.DataSetExtensions" />
38
+    <Reference Include="Microsoft.CSharp" />
39
+    <Reference Include="System.Data" />
40
+    <Reference Include="System.Net.Http" />
41
+    <Reference Include="System.Xml" />
42
+  </ItemGroup>
43
+  <ItemGroup>
44
+    <Compile Include="PagerBll.cs" />
45
+    <Compile Include="T_Sys_UserAccount.cs" />
46
+    <Compile Include="Properties\AssemblyInfo.cs" />
47
+  </ItemGroup>
48
+  <ItemGroup>
49
+    <ProjectReference Include="..\RMYY_CallCenter_Api.Dal\RMYY_CallCenter_Api.Dal.csproj">
50
+      <Project>{ffb706a9-6108-4a3b-8959-4f81c414c590}</Project>
51
+      <Name>RMYY_CallCenter_Api.Dal</Name>
52
+    </ProjectReference>
53
+    <ProjectReference Include="..\RMYY_CallCenter_Api.Model\RMYY_CallCenter_Api.Model.csproj">
54
+      <Project>{7eaa6abf-89f4-4ee0-b8d8-db953eff3e4c}</Project>
55
+      <Name>RMYY_CallCenter_Api.Model</Name>
56
+    </ProjectReference>
57
+    <ProjectReference Include="..\RMYY_CallCenter_Api.Utility\RMYY_CallCenter_Api.Utility.csproj">
58
+      <Project>{4e6a4fe2-c305-48e6-a1bf-b939b9252e24}</Project>
59
+      <Name>RMYY_CallCenter_Api.Utility</Name>
60
+    </ProjectReference>
61
+  </ItemGroup>
62
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
63
+</Project>

+ 149 - 0
RMYY_CallCenter_Api.Bll/T_Sys_UserAccount.cs

@@ -0,0 +1,149 @@
1
+using System;
2
+using System.Data;
3
+using System.Collections.Generic;
4
+using RMYY_CallCenter_Api.Model;
5
+using RMYY_CallCenter_Api.Utility;
6
+
7
+namespace RMYY_CallCenter_Api.Bll
8
+{
9
+    /// <summary>
10
+    /// T_Sys_UserAccount
11
+    /// </summary>
12
+    public partial class T_Sys_UserAccount
13
+    {
14
+        private readonly RMYY_CallCenter_Api.Dal.T_Sys_UserAccount dal = new RMYY_CallCenter_Api.Dal.T_Sys_UserAccount();
15
+        public T_Sys_UserAccount()
16
+        { }
17
+        #region  BasicMethod
18
+
19
+        /// <summary>
20
+        /// 是否存在该记录
21
+        /// </summary>
22
+        public bool Exists(string F_UserCode)
23
+        {
24
+            return dal.Exists(F_UserCode);
25
+        }
26
+
27
+        /// <summary>
28
+        /// 增加一条数据
29
+        /// </summary>
30
+        public int Add(RMYY_CallCenter_Api.Model.T_Sys_UserAccount model)
31
+        {
32
+            CacheHelper.Remove(model.F_UserCode);
33
+            return dal.Add(model);
34
+        }
35
+
36
+        /// <summary>
37
+        /// 更新一条数据
38
+        /// </summary>
39
+        public bool Update(RMYY_CallCenter_Api.Model.T_Sys_UserAccount model)
40
+        {
41
+            CacheHelper.Remove(model.F_UserCode);
42
+            return dal.Update(model);
43
+        }
44
+
45
+        /// <summary>
46
+        /// 删除一条数据
47
+        /// </summary>
48
+        public bool Delete(int F_UserId)
49
+        {
50
+            return dal.Delete(F_UserId);
51
+        }
52
+        /// <summary>
53
+        /// 删除一条数据
54
+        /// </summary>
55
+        public bool DeleteList(string F_UserIdlist)
56
+        {
57
+            return dal.DeleteList(F_UserIdlist);
58
+        }
59
+
60
+        /// <summary>
61
+        /// 得到一个对象实体
62
+        /// </summary>
63
+        public RMYY_CallCenter_Api.Model.T_Sys_UserAccount GetModel(int F_UserId)
64
+        {
65
+            return dal.GetModel(F_UserId);
66
+        }
67
+
68
+        /// <summary>
69
+        /// 得到一个对象实体
70
+        /// </summary>
71
+        public RMYY_CallCenter_Api.Model.T_Sys_UserAccount GetModel(string F_UserCode)
72
+        {
73
+            var user=CacheHelper.Get(F_UserCode);
74
+            if (user != null)
75
+            {
76
+                return user as Model.T_Sys_UserAccount;
77
+            }
78
+            else
79
+            {
80
+                var user1 = dal.GetModel(F_UserCode);
81
+                CacheHelper.Insert(F_UserCode, user1, 10);
82
+                return user1;
83
+            }
84
+        }
85
+
86
+        /// <summary>
87
+        /// 获得数据列表
88
+        /// </summary>
89
+        public DataSet GetList(string strWhere)
90
+        {
91
+            return dal.GetList(strWhere);
92
+        }
93
+        /// <summary>
94
+        /// 获得前几行数据
95
+        /// </summary>
96
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
97
+        {
98
+            return dal.GetList(Top, strWhere, filedOrder);
99
+        }
100
+        /// <summary>
101
+        /// 获得数据列表
102
+        /// </summary>
103
+        public List<RMYY_CallCenter_Api.Model.T_Sys_UserAccount> GetModelList(string strWhere)
104
+        {
105
+            DataSet ds = dal.GetList(strWhere);
106
+            return DataTableToList(ds.Tables[0]);
107
+        }
108
+        /// <summary>
109
+        /// 获得数据列表
110
+        /// </summary>
111
+        public List<RMYY_CallCenter_Api.Model.T_Sys_UserAccount> DataTableToList(DataTable dt)
112
+        {
113
+            List<RMYY_CallCenter_Api.Model.T_Sys_UserAccount> modelList = new List<RMYY_CallCenter_Api.Model.T_Sys_UserAccount>();
114
+            int rowsCount = dt.Rows.Count;
115
+            if (rowsCount > 0)
116
+            {
117
+                RMYY_CallCenter_Api.Model.T_Sys_UserAccount model;
118
+                for (int n = 0; n < rowsCount; n++)
119
+                {
120
+                    model = dal.DataRowToModel(dt.Rows[n]);
121
+                    if (model != null)
122
+                    {
123
+                        modelList.Add(model);
124
+                    }
125
+                }
126
+            }
127
+            return modelList;
128
+        }
129
+
130
+        /// <summary>
131
+        /// 获得数据列表
132
+        /// </summary>
133
+        public DataSet GetAllList()
134
+        {
135
+            return GetList("");
136
+        }
137
+
138
+        /// <summary>
139
+        /// 分页获取数据列表
140
+        /// </summary>
141
+        public int GetRecordCount(string strWhere)
142
+        {
143
+            return dal.GetRecordCount(strWhere);
144
+        }
145
+
146
+        #endregion  BasicMethod
147
+    }
148
+}
149
+

+ 75 - 0
RMYY_CallCenter_Api.DB/CommandInfo.cs

@@ -0,0 +1,75 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Data.SqlClient;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace RMYY_CallCenter_Api.DB
9
+{
10
+    public enum EffentNextType
11
+    {
12
+        /// <summary>
13
+        /// 对其他语句无任何影响 
14
+        /// </summary>
15
+        None,
16
+        /// <summary>
17
+        /// 当前语句必须为"select count(1) from .."格式,如果存在则继续执行,不存在回滚事务
18
+        /// </summary>
19
+        WhenHaveContine,
20
+        /// <summary>
21
+        /// 当前语句必须为"select count(1) from .."格式,如果不存在则继续执行,存在回滚事务
22
+        /// </summary>
23
+        WhenNoHaveContine,
24
+        /// <summary>
25
+        /// 当前语句影响到的行数必须大于0,否则回滚事务
26
+        /// </summary>
27
+        ExcuteEffectRows,
28
+        /// <summary>
29
+        /// 引发事件-当前语句必须为"select count(1) from .."格式,如果不存在则继续执行,存在回滚事务
30
+        /// </summary>
31
+        SolicitationEvent
32
+    }
33
+    public class CommandInfo
34
+    {
35
+        public object ShareObject = null;
36
+        public object OriginalData = null;
37
+        event EventHandler _solicitationEvent;
38
+        public event EventHandler SolicitationEvent
39
+        {
40
+            add
41
+            {
42
+                _solicitationEvent += value;
43
+            }
44
+            remove
45
+            {
46
+                _solicitationEvent -= value;
47
+            }
48
+        }
49
+        public void OnSolicitationEvent()
50
+        {
51
+            if (_solicitationEvent != null)
52
+            {
53
+                _solicitationEvent(this, new EventArgs());
54
+            }
55
+        }
56
+        public string CommandText;
57
+        public System.Data.Common.DbParameter[] Parameters;
58
+        public EffentNextType EffentNextType = EffentNextType.None;
59
+        public CommandInfo()
60
+        {
61
+
62
+        }
63
+        public CommandInfo(string sqlText, SqlParameter[] para)
64
+        {
65
+            this.CommandText = sqlText;
66
+            this.Parameters = para;
67
+        }
68
+        public CommandInfo(string sqlText, SqlParameter[] para, EffentNextType type)
69
+        {
70
+            this.CommandText = sqlText;
71
+            this.Parameters = para;
72
+            this.EffentNextType = type;
73
+        }
74
+    }
75
+}

Разница между файлами не показана из-за своего большого размера
+ 1455 - 0
RMYY_CallCenter_Api.DB/DbHelperSQL.cs


+ 36 - 0
RMYY_CallCenter_Api.DB/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// 有关程序集的一般信息由以下
6
+// 控制。更改这些特性值可修改
7
+// 与程序集关联的信息。
8
+[assembly: AssemblyTitle("RMYY_CallCenter_Api.DB")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("RMYY_CallCenter_Api.DB")]
13
+[assembly: AssemblyCopyright("Copyright ©  2021")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// 将 ComVisible 设置为 false 会使此程序集中的类型
18
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19
+//请将此类型的 ComVisible 特性设置为 true。
20
+[assembly: ComVisible(false)]
21
+
22
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23
+[assembly: Guid("f5e242c5-4f08-45cb-bfe7-e3b304fcce1f")]
24
+
25
+// 程序集的版本信息由下列四个值组成: 
26
+//
27
+//      主版本
28
+//      次版本
29
+//      生成号
30
+//      修订号
31
+//
32
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
33
+//通过使用 "*",如下所示:
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 56 - 0
RMYY_CallCenter_Api.DB/RMYY_CallCenter_Api.DB.csproj

@@ -0,0 +1,56 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{F5E242C5-4F08-45CB-BFE7-E3B304FCCE1F}</ProjectGuid>
8
+    <OutputType>Library</OutputType>
9
+    <AppDesignerFolder>Properties</AppDesignerFolder>
10
+    <RootNamespace>RMYY_CallCenter_Api.DB</RootNamespace>
11
+    <AssemblyName>RMYY_CallCenter_Api.DB</AssemblyName>
12
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13
+    <FileAlignment>512</FileAlignment>
14
+    <Deterministic>true</Deterministic>
15
+  </PropertyGroup>
16
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17
+    <DebugSymbols>true</DebugSymbols>
18
+    <DebugType>full</DebugType>
19
+    <Optimize>false</Optimize>
20
+    <OutputPath>bin\Debug\</OutputPath>
21
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
22
+    <ErrorReport>prompt</ErrorReport>
23
+    <WarningLevel>4</WarningLevel>
24
+  </PropertyGroup>
25
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26
+    <DebugType>pdbonly</DebugType>
27
+    <Optimize>true</Optimize>
28
+    <OutputPath>bin\Release\</OutputPath>
29
+    <DefineConstants>TRACE</DefineConstants>
30
+    <ErrorReport>prompt</ErrorReport>
31
+    <WarningLevel>4</WarningLevel>
32
+  </PropertyGroup>
33
+  <ItemGroup>
34
+    <Reference Include="System" />
35
+    <Reference Include="System.Configuration" />
36
+    <Reference Include="System.Core" />
37
+    <Reference Include="System.Xml.Linq" />
38
+    <Reference Include="System.Data.DataSetExtensions" />
39
+    <Reference Include="Microsoft.CSharp" />
40
+    <Reference Include="System.Data" />
41
+    <Reference Include="System.Net.Http" />
42
+    <Reference Include="System.Xml" />
43
+  </ItemGroup>
44
+  <ItemGroup>
45
+    <Compile Include="CommandInfo.cs" />
46
+    <Compile Include="DbHelperSQL.cs" />
47
+    <Compile Include="Properties\AssemblyInfo.cs" />
48
+  </ItemGroup>
49
+  <ItemGroup>
50
+    <ProjectReference Include="..\RMYY_CallCenter_Api.Utility\RMYY_CallCenter_Api.Utility.csproj">
51
+      <Project>{4E6A4FE2-C305-48E6-A1BF-B939B9252E24}</Project>
52
+      <Name>RMYY_CallCenter_Api.Utility</Name>
53
+    </ProjectReference>
54
+  </ItemGroup>
55
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
56
+</Project>

+ 26 - 0
RMYY_CallCenter_Api.Dal/PagerDAL.cs

@@ -0,0 +1,26 @@
1
+using RMYY_CallCenter_Api.DB;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Data;
5
+using System.Linq;
6
+using System.Text;
7
+using System.Threading.Tasks;
8
+
9
+namespace RMYY_CallCenter_Api.Dal
10
+{
11
+    public class PagerDAL
12
+    {
13
+        /// <summary>
14
+        /// 分页获取数据
15
+        /// </summary>
16
+        /// <param name="PageSize"></param>
17
+        /// <param name="PageIndex"></param>
18
+        /// <param name="strWhere"></param>
19
+        /// <returns></returns>
20
+        public static DataTable GetListPager(string TableName, string PK, string Fields, string WhereStr, string OrderStr, int PageSize, int PageIndex, bool IsCount, out int RecordCount)
21
+        {
22
+            DataTable dt = DbHelperSQL.RunPagination(TableName, PK, Fields, WhereStr, OrderStr, PageSize, PageIndex, IsCount, out RecordCount);
23
+            return dt;
24
+        }
25
+    }
26
+}

+ 36 - 0
RMYY_CallCenter_Api.Dal/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// 有关程序集的一般信息由以下
6
+// 控制。更改这些特性值可修改
7
+// 与程序集关联的信息。
8
+[assembly: AssemblyTitle("RMYY_CallCenter_Api.Dal")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("RMYY_CallCenter_Api.Dal")]
13
+[assembly: AssemblyCopyright("Copyright ©  2021")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// 将 ComVisible 设置为 false 会使此程序集中的类型
18
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19
+//请将此类型的 ComVisible 特性设置为 true。
20
+[assembly: ComVisible(false)]
21
+
22
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23
+[assembly: Guid("ffb706a9-6108-4a3b-8959-4f81c414c590")]
24
+
25
+// 程序集的版本信息由下列四个值组成: 
26
+//
27
+//      主版本
28
+//      次版本
29
+//      生成号
30
+//      修订号
31
+//
32
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
33
+//通过使用 "*",如下所示:
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 59 - 0
RMYY_CallCenter_Api.Dal/RMYY_CallCenter_Api.Dal.csproj

@@ -0,0 +1,59 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{FFB706A9-6108-4A3B-8959-4F81C414C590}</ProjectGuid>
8
+    <OutputType>Library</OutputType>
9
+    <AppDesignerFolder>Properties</AppDesignerFolder>
10
+    <RootNamespace>RMYY_CallCenter_Api.Dal</RootNamespace>
11
+    <AssemblyName>RMYY_CallCenter_Api.Dal</AssemblyName>
12
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13
+    <FileAlignment>512</FileAlignment>
14
+    <Deterministic>true</Deterministic>
15
+  </PropertyGroup>
16
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17
+    <DebugSymbols>true</DebugSymbols>
18
+    <DebugType>full</DebugType>
19
+    <Optimize>false</Optimize>
20
+    <OutputPath>bin\Debug\</OutputPath>
21
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
22
+    <ErrorReport>prompt</ErrorReport>
23
+    <WarningLevel>4</WarningLevel>
24
+  </PropertyGroup>
25
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26
+    <DebugType>pdbonly</DebugType>
27
+    <Optimize>true</Optimize>
28
+    <OutputPath>bin\Release\</OutputPath>
29
+    <DefineConstants>TRACE</DefineConstants>
30
+    <ErrorReport>prompt</ErrorReport>
31
+    <WarningLevel>4</WarningLevel>
32
+  </PropertyGroup>
33
+  <ItemGroup>
34
+    <Reference Include="System" />
35
+    <Reference Include="System.Core" />
36
+    <Reference Include="System.Xml.Linq" />
37
+    <Reference Include="System.Data.DataSetExtensions" />
38
+    <Reference Include="Microsoft.CSharp" />
39
+    <Reference Include="System.Data" />
40
+    <Reference Include="System.Net.Http" />
41
+    <Reference Include="System.Xml" />
42
+  </ItemGroup>
43
+  <ItemGroup>
44
+    <Compile Include="PagerDal.cs" />
45
+    <Compile Include="T_Sys_UserAccount.cs" />
46
+    <Compile Include="Properties\AssemblyInfo.cs" />
47
+  </ItemGroup>
48
+  <ItemGroup>
49
+    <ProjectReference Include="..\RMYY_CallCenter_Api.DB\RMYY_CallCenter_Api.DB.csproj">
50
+      <Project>{f5e242c5-4f08-45cb-bfe7-e3b304fcce1f}</Project>
51
+      <Name>RMYY_CallCenter_Api.DB</Name>
52
+    </ProjectReference>
53
+    <ProjectReference Include="..\RMYY_CallCenter_Api.Model\RMYY_CallCenter_Api.Model.csproj">
54
+      <Project>{7eaa6abf-89f4-4ee0-b8d8-db953eff3e4c}</Project>
55
+      <Name>RMYY_CallCenter_Api.Model</Name>
56
+    </ProjectReference>
57
+  </ItemGroup>
58
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
59
+</Project>

+ 409 - 0
RMYY_CallCenter_Api.Dal/T_Sys_UserAccount.cs

@@ -0,0 +1,409 @@
1
+using System;
2
+using System.Data;
3
+using System.Text;
4
+using System.Data.SqlClient;
5
+using RMYY_CallCenter_Api.DB;
6
+namespace RMYY_CallCenter_Api.Dal
7
+{
8
+    /// <summary>
9
+    /// 数据访问类:T_Sys_UserAccount
10
+    /// </summary>
11
+    public partial class T_Sys_UserAccount
12
+    {
13
+        public T_Sys_UserAccount()
14
+        { }
15
+        #region  BasicMethod
16
+
17
+        /// <summary>
18
+        /// 是否存在该记录
19
+        /// </summary>
20
+        public bool Exists(string F_UserCode)
21
+        {
22
+            StringBuilder strSql = new StringBuilder();
23
+            strSql.Append("select  count(1) from T_Sys_UserAccount with(nolock) ");
24
+            strSql.Append(" where F_UserCode=@F_UserCode");
25
+            SqlParameter[] parameters = {
26
+                    new SqlParameter("@F_UserCode", SqlDbType.VarChar,50)
27
+            };
28
+            parameters[0].Value = F_UserCode;
29
+
30
+            return DbHelperSQL.Exists(strSql.ToString(), parameters);
31
+        }
32
+
33
+        /// <summary>
34
+        /// 增加一条数据
35
+        /// </summary>
36
+        public int Add(RMYY_CallCenter_Api.Model.T_Sys_UserAccount model)
37
+        {
38
+            StringBuilder strSql = new StringBuilder();
39
+            strSql.Append("insert into T_Sys_UserAccount(");
40
+            strSql.Append("F_UserCode,F_Password,F_ExtensionNumber,F_UserName,F_DeptCode,F_RoleCode,F_Sex,F_Telephone,F_WxOpenId,F_Remark,F_SeatFlag,F_EnableFlag,F_CreateUser,F_CreateTime,F_DeleteFlag,F_DeleteUser,F_DeleteTime)");
41
+            strSql.Append(" values (");
42
+            strSql.Append("@F_UserCode,@F_Password,@F_ExtensionNumber,@F_UserName,@F_DeptCode,@F_RoleCode,@F_Sex,@F_Telephone,@F_WxOpenId,@F_Remark,@F_SeatFlag,@F_EnableFlag,@F_CreateUser,@F_CreateTime,@F_DeleteFlag,@F_DeleteUser,@F_DeleteTime)");
43
+            strSql.Append(";select @@IDENTITY");
44
+            SqlParameter[] parameters = {
45
+                    new SqlParameter("@F_UserCode", SqlDbType.VarChar,50),
46
+                    new SqlParameter("@F_Password", SqlDbType.VarChar,50),
47
+                    new SqlParameter("@F_ExtensionNumber", SqlDbType.VarChar,50),
48
+                    new SqlParameter("@F_UserName", SqlDbType.VarChar,50),
49
+                    new SqlParameter("@F_DeptCode", SqlDbType.VarChar,50),
50
+                    new SqlParameter("@F_RoleCode", SqlDbType.VarChar,50),
51
+                    new SqlParameter("@F_Sex", SqlDbType.VarChar,50),
52
+                    new SqlParameter("@F_Telephone", SqlDbType.VarChar,50),
53
+                    new SqlParameter("@F_WxOpenId", SqlDbType.VarChar,50),
54
+                    new SqlParameter("@F_Remark", SqlDbType.NVarChar,200),
55
+                    new SqlParameter("@F_SeatFlag", SqlDbType.Int,4),
56
+                    new SqlParameter("@F_EnableFlag", SqlDbType.Int,4),
57
+                    new SqlParameter("@F_CreateUser", SqlDbType.VarChar,50),
58
+                    new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
59
+                    new SqlParameter("@F_DeleteFlag", SqlDbType.Int,4),
60
+                    new SqlParameter("@F_DeleteUser", SqlDbType.VarChar,50),
61
+                    new SqlParameter("@F_DeleteTime", SqlDbType.DateTime)};
62
+            parameters[0].Value = model.F_UserCode;
63
+            parameters[1].Value = model.F_Password;
64
+            parameters[2].Value = model.F_ExtensionNumber;
65
+            parameters[3].Value = model.F_UserName;
66
+            parameters[4].Value = model.F_DeptCode;
67
+            parameters[5].Value = model.F_RoleCode;
68
+            parameters[6].Value = model.F_Sex;
69
+            parameters[7].Value = model.F_Telephone;
70
+            parameters[8].Value = model.F_WxOpenId;
71
+            parameters[9].Value = model.F_Remark;
72
+            parameters[10].Value = model.F_SeatFlag;
73
+            parameters[11].Value = model.F_EnableFlag;
74
+            parameters[12].Value = model.F_CreateUser;
75
+            parameters[13].Value = model.F_CreateTime;
76
+            parameters[14].Value = model.F_DeleteFlag;
77
+            parameters[15].Value = model.F_DeleteUser;
78
+            parameters[16].Value = model.F_DeleteTime;
79
+
80
+            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
81
+            if (obj == null)
82
+            {
83
+                return 0;
84
+            }
85
+            else
86
+            {
87
+                return Convert.ToInt32(obj);
88
+            }
89
+        }
90
+        /// <summary>
91
+        /// 更新一条数据
92
+        /// </summary>
93
+        public bool Update(RMYY_CallCenter_Api.Model.T_Sys_UserAccount model)
94
+        {
95
+            StringBuilder strSql = new StringBuilder();
96
+            strSql.Append("update T_Sys_UserAccount set ");
97
+            strSql.Append("F_UserCode=@F_UserCode,");
98
+            strSql.Append("F_Password=@F_Password,");
99
+            strSql.Append("F_ExtensionNumber=@F_ExtensionNumber,");
100
+            strSql.Append("F_UserName=@F_UserName,");
101
+            strSql.Append("F_DeptCode=@F_DeptCode,");
102
+            strSql.Append("F_RoleCode=@F_RoleCode,");
103
+            strSql.Append("F_Sex=@F_Sex,");
104
+            strSql.Append("F_Telephone=@F_Telephone,");
105
+            strSql.Append("F_WxOpenId=@F_WxOpenId,");
106
+            strSql.Append("F_Remark=@F_Remark,");
107
+            strSql.Append("F_SeatFlag=@F_SeatFlag,");
108
+            strSql.Append("F_EnableFlag=@F_EnableFlag,");
109
+            strSql.Append("F_CreateUser=@F_CreateUser,");
110
+            strSql.Append("F_CreateTime=@F_CreateTime,");
111
+            strSql.Append("F_DeleteFlag=@F_DeleteFlag,");
112
+            strSql.Append("F_DeleteUser=@F_DeleteUser,");
113
+            strSql.Append("F_DeleteTime=@F_DeleteTime");
114
+            strSql.Append(" where F_UserId=@F_UserId");
115
+            SqlParameter[] parameters = {
116
+                    new SqlParameter("@F_UserCode", SqlDbType.VarChar,50),
117
+                    new SqlParameter("@F_Password", SqlDbType.VarChar,50),
118
+                    new SqlParameter("@F_ExtensionNumber", SqlDbType.VarChar,50),
119
+                    new SqlParameter("@F_UserName", SqlDbType.VarChar,50),
120
+                    new SqlParameter("@F_DeptCode", SqlDbType.VarChar,50),
121
+                    new SqlParameter("@F_RoleCode", SqlDbType.VarChar,50),
122
+                    new SqlParameter("@F_Sex", SqlDbType.VarChar,50),
123
+                    new SqlParameter("@F_Telephone", SqlDbType.VarChar,50),
124
+                    new SqlParameter("@F_WxOpenId", SqlDbType.VarChar,50),
125
+                    new SqlParameter("@F_Remark", SqlDbType.NVarChar,200),
126
+                    new SqlParameter("@F_SeatFlag", SqlDbType.Int,4),
127
+                    new SqlParameter("@F_EnableFlag", SqlDbType.Int,4),
128
+                    new SqlParameter("@F_CreateUser", SqlDbType.VarChar,50),
129
+                    new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
130
+                    new SqlParameter("@F_DeleteFlag", SqlDbType.Int,4),
131
+                    new SqlParameter("@F_DeleteUser", SqlDbType.VarChar,50),
132
+                    new SqlParameter("@F_DeleteTime", SqlDbType.DateTime),
133
+                    new SqlParameter("@F_UserId", SqlDbType.Int,4)};
134
+            parameters[0].Value = model.F_UserCode;
135
+            parameters[1].Value = model.F_Password;
136
+            parameters[2].Value = model.F_ExtensionNumber;
137
+            parameters[3].Value = model.F_UserName;
138
+            parameters[4].Value = model.F_DeptCode;
139
+            parameters[5].Value = model.F_RoleCode;
140
+            parameters[6].Value = model.F_Sex;
141
+            parameters[7].Value = model.F_Telephone;
142
+            parameters[8].Value = model.F_WxOpenId;
143
+            parameters[9].Value = model.F_Remark;
144
+            parameters[10].Value = model.F_SeatFlag;
145
+            parameters[11].Value = model.F_EnableFlag;
146
+            parameters[12].Value = model.F_CreateUser;
147
+            parameters[13].Value = model.F_CreateTime;
148
+            parameters[14].Value = model.F_DeleteFlag;
149
+            parameters[15].Value = model.F_DeleteUser;
150
+            parameters[16].Value = model.F_DeleteTime;
151
+            parameters[17].Value = model.F_UserId;
152
+
153
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
154
+            if (rows > 0)
155
+            {
156
+                return true;
157
+            }
158
+            else
159
+            {
160
+                return false;
161
+            }
162
+        }
163
+
164
+        /// <summary>
165
+        /// 删除一条数据
166
+        /// </summary>
167
+        public bool Delete(int F_UserId)
168
+        {
169
+
170
+            StringBuilder strSql = new StringBuilder();
171
+            strSql.Append("delete from T_Sys_UserAccount ");
172
+            strSql.Append(" where F_UserId=@F_UserId");
173
+            SqlParameter[] parameters = {
174
+                    new SqlParameter("@F_UserId", SqlDbType.Int,4)
175
+            };
176
+            parameters[0].Value = F_UserId;
177
+
178
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
179
+            if (rows > 0)
180
+            {
181
+                return true;
182
+            }
183
+            else
184
+            {
185
+                return false;
186
+            }
187
+        }
188
+        /// <summary>
189
+        /// 批量删除数据
190
+        /// </summary>
191
+        public bool DeleteList(string F_UserIdlist)
192
+        {
193
+            StringBuilder strSql = new StringBuilder();
194
+            strSql.Append("delete from T_Sys_UserAccount ");
195
+            strSql.Append(" where F_UserId in (" + F_UserIdlist + ")  ");
196
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
197
+            if (rows > 0)
198
+            {
199
+                return true;
200
+            }
201
+            else
202
+            {
203
+                return false;
204
+            }
205
+        }
206
+
207
+
208
+        /// <summary>
209
+        /// 得到一个对象实体
210
+        /// </summary>
211
+        public RMYY_CallCenter_Api.Model.T_Sys_UserAccount GetModel(int F_UserId)
212
+        {
213
+
214
+            StringBuilder strSql = new StringBuilder();
215
+            strSql.Append("select  top 1 F_UserId,F_UserCode,F_Password,F_ExtensionNumber,F_UserName,F_DeptCode,F_RoleCode,F_Sex,F_Telephone,F_WxOpenId,F_Remark,F_SeatFlag,F_EnableFlag,F_CreateUser,F_CreateTime,F_DeleteFlag,F_DeleteUser,F_DeleteTime from T_Sys_UserAccount with(nolock) ");
216
+            strSql.Append(" where F_UserId=@F_UserId");
217
+            SqlParameter[] parameters = {
218
+                    new SqlParameter("@F_UserId", SqlDbType.Int,4)
219
+            };
220
+            parameters[0].Value = F_UserId;
221
+
222
+            RMYY_CallCenter_Api.Model.T_Sys_UserAccount model = new RMYY_CallCenter_Api.Model.T_Sys_UserAccount();
223
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
224
+            if (ds.Tables[0].Rows.Count > 0)
225
+            {
226
+                return DataRowToModel(ds.Tables[0].Rows[0]);
227
+            }
228
+            else
229
+            {
230
+                return null;
231
+            }
232
+        }
233
+
234
+        /// <summary>
235
+        /// 得到一个对象实体
236
+        /// </summary>
237
+        public RMYY_CallCenter_Api.Model.T_Sys_UserAccount GetModel(string F_UserCode)
238
+        {
239
+
240
+            StringBuilder strSql = new StringBuilder();
241
+            strSql.Append("select  top 1 F_UserId,F_UserCode,F_Password,F_ExtensionNumber,F_UserName,F_DeptCode,F_RoleCode,F_Sex,F_Telephone,F_WxOpenId,F_Remark,F_SeatFlag,F_EnableFlag,F_CreateUser,F_CreateTime,F_DeleteFlag,F_DeleteUser,F_DeleteTime from T_Sys_UserAccount with(nolock) ");
242
+            strSql.Append(" where F_UserCode=@F_UserCode");
243
+            SqlParameter[] parameters = {
244
+                    new SqlParameter("@F_UserCode", SqlDbType.VarChar,50)
245
+            };
246
+            parameters[0].Value = F_UserCode;
247
+
248
+            RMYY_CallCenter_Api.Model.T_Sys_UserAccount model = new RMYY_CallCenter_Api.Model.T_Sys_UserAccount();
249
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
250
+            if (ds.Tables[0].Rows.Count > 0)
251
+            {
252
+                return DataRowToModel(ds.Tables[0].Rows[0]);
253
+            }
254
+            else
255
+            {
256
+                return null;
257
+            }
258
+        }
259
+
260
+
261
+        /// <summary>
262
+        /// 得到一个对象实体
263
+        /// </summary>
264
+        public RMYY_CallCenter_Api.Model.T_Sys_UserAccount DataRowToModel(DataRow row)
265
+        {
266
+            RMYY_CallCenter_Api.Model.T_Sys_UserAccount model = new RMYY_CallCenter_Api.Model.T_Sys_UserAccount();
267
+            if (row != null)
268
+            {
269
+                if (row["F_UserId"] != null && row["F_UserId"].ToString() != "")
270
+                {
271
+                    model.F_UserId = int.Parse(row["F_UserId"].ToString());
272
+                }
273
+                if (row["F_UserCode"] != null)
274
+                {
275
+                    model.F_UserCode = row["F_UserCode"].ToString();
276
+                }
277
+                if (row["F_Password"] != null)
278
+                {
279
+                    model.F_Password = row["F_Password"].ToString();
280
+                }
281
+                if (row["F_ExtensionNumber"] != null)
282
+                {
283
+                    model.F_ExtensionNumber = row["F_ExtensionNumber"].ToString();
284
+                }
285
+                if (row["F_UserName"] != null)
286
+                {
287
+                    model.F_UserName = row["F_UserName"].ToString();
288
+                }
289
+                if (row["F_DeptCode"] != null)
290
+                {
291
+                    model.F_DeptCode = row["F_DeptCode"].ToString();
292
+                }
293
+                if (row["F_RoleCode"] != null)
294
+                {
295
+                    model.F_RoleCode = row["F_RoleCode"].ToString();
296
+                }
297
+                if (row["F_Sex"] != null)
298
+                {
299
+                    model.F_Sex = row["F_Sex"].ToString();
300
+                }
301
+                if (row["F_Telephone"] != null)
302
+                {
303
+                    model.F_Telephone = row["F_Telephone"].ToString();
304
+                }
305
+                if (row["F_WxOpenId"] != null)
306
+                {
307
+                    model.F_WxOpenId = row["F_WxOpenId"].ToString();
308
+                }
309
+                if (row["F_Remark"] != null)
310
+                {
311
+                    model.F_Remark = row["F_Remark"].ToString();
312
+                }
313
+                if (row["F_SeatFlag"] != null && row["F_SeatFlag"].ToString() != "")
314
+                {
315
+                    model.F_SeatFlag = int.Parse(row["F_SeatFlag"].ToString());
316
+                }
317
+                if (row["F_EnableFlag"] != null && row["F_EnableFlag"].ToString() != "")
318
+                {
319
+                    model.F_EnableFlag = int.Parse(row["F_EnableFlag"].ToString());
320
+                }
321
+                if (row["F_CreateUser"] != null)
322
+                {
323
+                    model.F_CreateUser = row["F_CreateUser"].ToString();
324
+                }
325
+                if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
326
+                {
327
+                    model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
328
+                }
329
+                if (row["F_DeleteFlag"] != null && row["F_DeleteFlag"].ToString() != "")
330
+                {
331
+                    model.F_DeleteFlag = int.Parse(row["F_DeleteFlag"].ToString());
332
+                }
333
+                if (row["F_DeleteUser"] != null)
334
+                {
335
+                    model.F_DeleteUser = row["F_DeleteUser"].ToString();
336
+                }
337
+                if (row["F_DeleteTime"] != null && row["F_DeleteTime"].ToString() != "")
338
+                {
339
+                    model.F_DeleteTime = DateTime.Parse(row["F_DeleteTime"].ToString());
340
+                }
341
+            }
342
+            return model;
343
+        }
344
+
345
+        /// <summary>
346
+        /// 获得数据列表
347
+        /// </summary>
348
+        public DataSet GetList(string strWhere)
349
+        {
350
+            StringBuilder strSql = new StringBuilder();
351
+            strSql.Append("select F_UserId,F_UserCode,F_Password,F_ExtensionNumber,F_UserName,F_DeptCode,F_RoleCode,F_Sex,F_Telephone,F_WxOpenId,F_Remark,F_SeatFlag,F_EnableFlag,F_CreateUser,F_CreateTime,F_DeleteFlag,F_DeleteUser,F_DeleteTime ");
352
+            strSql.Append(" FROM T_Sys_UserAccount with(nolock) ");
353
+            if (strWhere.Trim() != "")
354
+            {
355
+                strSql.Append(" where " + strWhere);
356
+            }
357
+            return DbHelperSQL.Query(strSql.ToString());
358
+        }
359
+
360
+        /// <summary>
361
+        /// 获得前几行数据
362
+        /// </summary>
363
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
364
+        {
365
+            StringBuilder strSql = new StringBuilder();
366
+            strSql.Append("select ");
367
+            if (Top > 0)
368
+            {
369
+                strSql.Append(" top " + Top.ToString());
370
+            }
371
+            strSql.Append(" F_UserId,F_UserCode,F_Password,F_ExtensionNumber,F_UserName,F_DeptCode,F_RoleCode,F_Sex,F_Telephone,F_WxOpenId,F_Remark,F_SeatFlag,F_EnableFlag,F_CreateUser,F_CreateTime,F_DeleteFlag,F_DeleteUser,F_DeleteTime ");
372
+            strSql.Append(" FROM T_Sys_UserAccount with(nolock) ");
373
+            if (strWhere.Trim() != "")
374
+            {
375
+                strSql.Append(" where " + strWhere);
376
+            }
377
+            strSql.Append(" order by " + filedOrder);
378
+            return DbHelperSQL.Query(strSql.ToString());
379
+        }
380
+
381
+        /// <summary>
382
+        /// 获取记录总数
383
+        /// </summary>
384
+        public int GetRecordCount(string strWhere)
385
+        {
386
+            StringBuilder strSql = new StringBuilder();
387
+            strSql.Append("select count(1) FROM T_Sys_UserAccount with(nolock) ");
388
+            if (strWhere.Trim() != "")
389
+            {
390
+                strSql.Append(" where " + strWhere);
391
+            }
392
+            object obj = DbHelperSQL.GetSingle(strSql.ToString());
393
+            if (obj == null)
394
+            {
395
+                return 0;
396
+            }
397
+            else
398
+            {
399
+                return Convert.ToInt32(obj);
400
+            }
401
+        }
402
+
403
+        #endregion  BasicMethod
404
+        #region  ExtensionMethod
405
+
406
+        #endregion  ExtensionMethod
407
+    }
408
+}
409
+

+ 36 - 0
RMYY_CallCenter_Api.Model/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// 有关程序集的一般信息由以下
6
+// 控制。更改这些特性值可修改
7
+// 与程序集关联的信息。
8
+[assembly: AssemblyTitle("RMYY_CallCenter_Api.Model")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("RMYY_CallCenter_Api.Model")]
13
+[assembly: AssemblyCopyright("Copyright ©  2021")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// 将 ComVisible 设置为 false 会使此程序集中的类型
18
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19
+//请将此类型的 ComVisible 特性设置为 true。
20
+[assembly: ComVisible(false)]
21
+
22
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23
+[assembly: Guid("7eaa6abf-89f4-4ee0-b8d8-db953eff3e4c")]
24
+
25
+// 程序集的版本信息由下列四个值组成: 
26
+//
27
+//      主版本
28
+//      次版本
29
+//      生成号
30
+//      修订号
31
+//
32
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
33
+//通过使用 "*",如下所示:
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 48 - 0
RMYY_CallCenter_Api.Model/RMYY_CallCenter_Api.Model.csproj

@@ -0,0 +1,48 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{7EAA6ABF-89F4-4EE0-B8D8-DB953EFF3E4C}</ProjectGuid>
8
+    <OutputType>Library</OutputType>
9
+    <AppDesignerFolder>Properties</AppDesignerFolder>
10
+    <RootNamespace>RMYY_CallCenter_Api.Model</RootNamespace>
11
+    <AssemblyName>RMYY_CallCenter_Api.Model</AssemblyName>
12
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13
+    <FileAlignment>512</FileAlignment>
14
+    <Deterministic>true</Deterministic>
15
+  </PropertyGroup>
16
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17
+    <DebugSymbols>true</DebugSymbols>
18
+    <DebugType>full</DebugType>
19
+    <Optimize>false</Optimize>
20
+    <OutputPath>bin\Debug\</OutputPath>
21
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
22
+    <ErrorReport>prompt</ErrorReport>
23
+    <WarningLevel>4</WarningLevel>
24
+  </PropertyGroup>
25
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26
+    <DebugType>pdbonly</DebugType>
27
+    <Optimize>true</Optimize>
28
+    <OutputPath>bin\Release\</OutputPath>
29
+    <DefineConstants>TRACE</DefineConstants>
30
+    <ErrorReport>prompt</ErrorReport>
31
+    <WarningLevel>4</WarningLevel>
32
+  </PropertyGroup>
33
+  <ItemGroup>
34
+    <Reference Include="System" />
35
+    <Reference Include="System.Core" />
36
+    <Reference Include="System.Xml.Linq" />
37
+    <Reference Include="System.Data.DataSetExtensions" />
38
+    <Reference Include="Microsoft.CSharp" />
39
+    <Reference Include="System.Data" />
40
+    <Reference Include="System.Net.Http" />
41
+    <Reference Include="System.Xml" />
42
+  </ItemGroup>
43
+  <ItemGroup>
44
+    <Compile Include="T_Sys_UserAccount.cs" />
45
+    <Compile Include="Properties\AssemblyInfo.cs" />
46
+  </ItemGroup>
47
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
48
+</Project>

+ 184 - 0
RMYY_CallCenter_Api.Model/T_Sys_UserAccount.cs

@@ -0,0 +1,184 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace RMYY_CallCenter_Api.Model
8
+{
9
+
10
+    /// <summary>
11
+    /// T_Sys_UserAccount:实体类(属性说明自动提取数据库字段的描述信息)
12
+    /// </summary>
13
+    [Serializable]
14
+    public partial class T_Sys_UserAccount
15
+    {
16
+        public T_Sys_UserAccount()
17
+        { }
18
+        #region Model
19
+        private int _f_userid;
20
+        private string _f_usercode;
21
+        private string _f_password;
22
+        private string _f_extensionnumber;
23
+        private string _f_username;
24
+        private string _f_deptcode;
25
+        private string _f_rolecode;
26
+        private string _f_sex;
27
+        private string _f_telephone;
28
+        private string _f_wxopenid;
29
+        private string _f_remark;
30
+        private int? _f_seatflag;
31
+        private int? _f_enableflag;
32
+        private string _f_createuser;
33
+        private DateTime? _f_createtime;
34
+        private int? _f_deleteflag;
35
+        private string _f_deleteuser;
36
+        private DateTime? _f_deletetime;
37
+        /// <summary>
38
+        /// 主键
39
+        /// </summary>
40
+        public int F_UserId
41
+        {
42
+            set { _f_userid = value; }
43
+            get { return _f_userid; }
44
+        }
45
+        /// <summary>
46
+        /// 账号
47
+        /// </summary>
48
+        public string F_UserCode
49
+        {
50
+            set { _f_usercode = value; }
51
+            get { return _f_usercode; }
52
+        }
53
+        /// <summary>
54
+        /// 密码
55
+        /// </summary>
56
+        public string F_Password
57
+        {
58
+            set { _f_password = value; }
59
+            get { return _f_password; }
60
+        }
61
+        /// <summary>
62
+        /// 分机
63
+        /// </summary>
64
+        public string F_ExtensionNumber
65
+        {
66
+            set { _f_extensionnumber = value; }
67
+            get { return _f_extensionnumber; }
68
+        }
69
+        /// <summary>
70
+        /// 姓名
71
+        /// </summary>
72
+        public string F_UserName
73
+        {
74
+            set { _f_username = value; }
75
+            get { return _f_username; }
76
+        }
77
+        /// <summary>
78
+        /// 部门编码
79
+        /// </summary>
80
+        public string F_DeptCode
81
+        {
82
+            set { _f_deptcode = value; }
83
+            get { return _f_deptcode; }
84
+        }
85
+        /// <summary>
86
+        /// 角色编码
87
+        /// </summary>
88
+        public string F_RoleCode
89
+        {
90
+            set { _f_rolecode = value; }
91
+            get { return _f_rolecode; }
92
+        }
93
+        /// <summary>
94
+        /// 性别
95
+        /// </summary>
96
+        public string F_Sex
97
+        {
98
+            set { _f_sex = value; }
99
+            get { return _f_sex; }
100
+        }
101
+        /// <summary>
102
+        /// 手机号
103
+        /// </summary>
104
+        public string F_Telephone
105
+        {
106
+            set { _f_telephone = value; }
107
+            get { return _f_telephone; }
108
+        }
109
+        /// <summary>
110
+        /// 微信openid
111
+        /// </summary>
112
+        public string F_WxOpenId
113
+        {
114
+            set { _f_wxopenid = value; }
115
+            get { return _f_wxopenid; }
116
+        }
117
+        /// <summary>
118
+        /// 备注
119
+        /// </summary>
120
+        public string F_Remark
121
+        {
122
+            set { _f_remark = value; }
123
+            get { return _f_remark; }
124
+        }
125
+        /// <summary>
126
+        /// 0非坐席1坐席
127
+        /// </summary>
128
+        public int? F_SeatFlag
129
+        {
130
+            set { _f_seatflag = value; }
131
+            get { return _f_seatflag; }
132
+        }
133
+        /// <summary>
134
+        /// 1启用0禁用
135
+        /// </summary>
136
+        public int? F_EnableFlag
137
+        {
138
+            set { _f_enableflag = value; }
139
+            get { return _f_enableflag; }
140
+        }
141
+        /// <summary>
142
+        /// 创建人
143
+        /// </summary>
144
+        public string F_CreateUser
145
+        {
146
+            set { _f_createuser = value; }
147
+            get { return _f_createuser; }
148
+        }
149
+        /// <summary>
150
+        /// 创建时间
151
+        /// </summary>
152
+        public DateTime? F_CreateTime
153
+        {
154
+            set { _f_createtime = value; }
155
+            get { return _f_createtime; }
156
+        }
157
+        /// <summary>
158
+        /// 0未删除1删除
159
+        /// </summary>
160
+        public int? F_DeleteFlag
161
+        {
162
+            set { _f_deleteflag = value; }
163
+            get { return _f_deleteflag; }
164
+        }
165
+        /// <summary>
166
+        /// 删除人
167
+        /// </summary>
168
+        public string F_DeleteUser
169
+        {
170
+            set { _f_deleteuser = value; }
171
+            get { return _f_deleteuser; }
172
+        }
173
+        /// <summary>
174
+        /// 删除时间
175
+        /// </summary>
176
+        public DateTime? F_DeleteTime
177
+        {
178
+            set { _f_deletetime = value; }
179
+            get { return _f_deletetime; }
180
+        }
181
+        #endregion Model
182
+
183
+    }
184
+}

+ 43 - 0
RMYY_CallCenter_Api.Utility/Extention/Json.cs

@@ -0,0 +1,43 @@
1
+using Newtonsoft.Json;
2
+using Newtonsoft.Json.Converters;
3
+using Newtonsoft.Json.Linq;
4
+using Newtonsoft.Json.Serialization;
5
+using System.Collections.Generic;
6
+using System.Data;
7
+
8
+namespace RMYY_CallCenter_Api.Utility
9
+{
10
+    public static class Json
11
+    {
12
+        public static object ToJson(this string Json)
13
+        {
14
+            return Json == null ? null : JsonConvert.DeserializeObject(Json);
15
+        }
16
+        public static string ToJson(this object obj)
17
+        {
18
+            var timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
19
+            return JsonConvert.SerializeObject(obj, timeConverter);
20
+        }
21
+        public static string ToJson(this object obj, string datetimeformats)
22
+        {
23
+            var timeConverter = new IsoDateTimeConverter { DateTimeFormat = datetimeformats };
24
+            return JsonConvert.SerializeObject(obj, timeConverter);
25
+        }
26
+        public static T ToObject<T>(this string Json)
27
+        {
28
+            return Json == null ? default(T) : JsonConvert.DeserializeObject<T>(Json);
29
+        }
30
+        public static List<T> ToList<T>(this string Json)
31
+        {
32
+            return Json == null ? null : JsonConvert.DeserializeObject<List<T>>(Json);
33
+        }
34
+        public static DataTable ToTable(this string Json)
35
+        {
36
+            return Json == null ? null : JsonConvert.DeserializeObject<DataTable>(Json);
37
+        }
38
+        public static JObject ToJObject(this string Json)
39
+        {
40
+            return Json == null ? JObject.Parse("{}") : JObject.Parse(Json.Replace("&nbsp;", ""));
41
+        }
42
+    }
43
+}

+ 113 - 0
RMYY_CallCenter_Api.Utility/Extention/Object.cs

@@ -0,0 +1,113 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Reflection;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace RMYY_CallCenter_Api.Utility
9
+{
10
+    public static partial class ObjectExtention
11
+    {
12
+        private static BindingFlags _bindingFlags { get; }
13
+            = BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Static;
14
+
15
+        /// <summary>
16
+        /// 判断是否为Null或者空
17
+        /// </summary>
18
+        /// <param name="obj">对象</param>
19
+        /// <returns></returns>
20
+        public static bool IsNullOrEmpty(this object obj)
21
+        {
22
+            if (obj == null)
23
+                return true;
24
+            else
25
+            {
26
+                string objStr = obj.ToString();
27
+                return string.IsNullOrEmpty(objStr);
28
+            }
29
+        }
30
+
31
+        /// <summary>
32
+        /// 深复制
33
+        /// </summary>
34
+        /// <typeparam name="T">类型</typeparam>
35
+        /// <param name="obj">对象</param>
36
+        /// <returns></returns>
37
+        public static T DeepClone<T>(this T obj) where T : class
38
+        {
39
+            if (obj == null)
40
+                return null;
41
+
42
+            return obj.ToJson().ToObject<T>();
43
+        }
44
+
45
+        /// <summary>
46
+        /// 是否拥有某属性
47
+        /// </summary>
48
+        /// <param name="obj">对象</param>
49
+        /// <param name="propertyName">属性名</param>
50
+        /// <returns></returns>
51
+        public static bool ContainsProperty(this object obj, string propertyName)
52
+        {
53
+            return obj.GetType().GetProperty(propertyName, _bindingFlags) != null;
54
+        }
55
+
56
+        /// <summary>
57
+        /// 获取某属性值
58
+        /// </summary>
59
+        /// <param name="obj">对象</param>
60
+        /// <param name="propertyName">属性名</param>
61
+        /// <returns></returns>
62
+        public static object GetPropertyValue(this object obj, string propertyName)
63
+        {
64
+            return obj.GetType().GetProperty(propertyName, _bindingFlags).GetValue(obj);
65
+        }
66
+
67
+        /// <summary>
68
+        /// 设置某属性值
69
+        /// </summary>
70
+        /// <param name="obj">对象</param>
71
+        /// <param name="propertyName">属性名</param>
72
+        /// <param name="value">值</param>
73
+        /// <returns></returns>
74
+        public static void SetPropertyValue(this object obj, string propertyName, object value)
75
+        {
76
+            obj.GetType().GetProperty(propertyName, _bindingFlags).SetValue(obj, value);
77
+        }
78
+
79
+        /// <summary>
80
+        /// 是否拥有某字段
81
+        /// </summary>
82
+        /// <param name="obj">对象</param>
83
+        /// <param name="fieldName">字段名</param>
84
+        /// <returns></returns>
85
+        public static bool ContainsField(this object obj, string fieldName)
86
+        {
87
+            return obj.GetType().GetField(fieldName, _bindingFlags) != null;
88
+        }
89
+
90
+        /// <summary>
91
+        /// 获取某字段值
92
+        /// </summary>
93
+        /// <param name="obj">对象</param>
94
+        /// <param name="fieldName">字段名</param>
95
+        /// <returns></returns>
96
+        public static object GetGetFieldValue(this object obj, string fieldName)
97
+        {
98
+            return obj.GetType().GetField(fieldName, _bindingFlags).GetValue(obj);
99
+        }
100
+
101
+        /// <summary>
102
+        /// 设置某字段值
103
+        /// </summary>
104
+        /// <param name="obj">对象</param>
105
+        /// <param name="fieldName">字段名</param>
106
+        /// <param name="value">值</param>
107
+        /// <returns></returns>
108
+        public static void SetFieldValue(this object obj, string fieldName, object value)
109
+        {
110
+            obj.GetType().GetField(fieldName, _bindingFlags).SetValue(obj, value);
111
+        }
112
+    }
113
+}

+ 351 - 0
RMYY_CallCenter_Api.Utility/Extention/String.cs

@@ -0,0 +1,351 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Security.Cryptography;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace RMYY_CallCenter_Api.Utility
9
+{
10
+    public static partial class StringExtention
11
+    {
12
+
13
+        /// <summary>
14
+        /// 转为bool
15
+        /// </summary>
16
+        /// <param name="str">字符串</param>
17
+        /// <returns></returns>
18
+        public static bool ToBool(this string str)
19
+        {
20
+            return bool.Parse(str);
21
+        }
22
+
23
+        /// <summary>
24
+        /// 转为字节数组
25
+        /// </summary>
26
+        /// <param name="base64Str">base64字符串</param>
27
+        /// <returns></returns>
28
+        public static byte[] ToBytes_FromBase64Str(this string base64Str)
29
+        {
30
+            return Convert.FromBase64String(base64Str);
31
+        }
32
+
33
+        /// <summary>
34
+        /// 转换为MD5加密后的字符串(默认加密为32位)
35
+        /// </summary>
36
+        /// <param name="str"></param>
37
+        /// <returns></returns>
38
+        public static string ToMD5String(this string str)
39
+        {
40
+            MD5 md5 = MD5.Create();
41
+            byte[] inputBytes = Encoding.UTF8.GetBytes(str);
42
+            byte[] hashBytes = md5.ComputeHash(inputBytes);
43
+
44
+            StringBuilder sb = new StringBuilder();
45
+            for (int i = 0; i < hashBytes.Length; i++)
46
+            {
47
+                sb.Append(hashBytes[i].ToString("x2"));
48
+            }
49
+            md5.Dispose();
50
+
51
+            return sb.ToString();
52
+        }
53
+
54
+        /// <summary>
55
+        /// 转换为MD5加密后的字符串(16位)
56
+        /// </summary>
57
+        /// <param name="str"></param>
58
+        /// <returns></returns>
59
+        public static string ToMD5String16(this string str)
60
+        {
61
+            return str.ToMD5String().Substring(8, 16);
62
+        }
63
+
64
+        /// <summary>
65
+        /// Base64加密
66
+        /// 注:默认采用UTF8编码
67
+        /// </summary>
68
+        /// <param name="source">待加密的明文</param>
69
+        /// <returns>加密后的字符串</returns>
70
+        public static string Base64Encode(this string source)
71
+        {
72
+            return Base64Encode(source, Encoding.UTF8);
73
+        }
74
+
75
+        /// <summary>
76
+        /// Base64加密
77
+        /// </summary>
78
+        /// <param name="source">待加密的明文</param>
79
+        /// <param name="encoding">加密采用的编码方式</param>
80
+        /// <returns></returns>
81
+        public static string Base64Encode(this string source, Encoding encoding)
82
+        {
83
+            string encode = string.Empty;
84
+            byte[] bytes = encoding.GetBytes(source);
85
+            try
86
+            {
87
+                encode = Convert.ToBase64String(bytes);
88
+            }
89
+            catch
90
+            {
91
+                encode = source;
92
+            }
93
+            return encode;
94
+        }
95
+
96
+        /// <summary>
97
+        /// Base64解密
98
+        /// 注:默认使用UTF8编码
99
+        /// </summary>
100
+        /// <param name="result">待解密的密文</param>
101
+        /// <returns>解密后的字符串</returns>
102
+        public static string Base64Decode(this string result)
103
+        {
104
+            return Base64Decode(result, Encoding.UTF8);
105
+        }
106
+
107
+        /// <summary>
108
+        /// Base64解密
109
+        /// </summary>
110
+        /// <param name="result">待解密的密文</param>
111
+        /// <param name="encoding">解密采用的编码方式,注意和加密时采用的方式一致</param>
112
+        /// <returns>解密后的字符串</returns>
113
+        public static string Base64Decode(this string result, Encoding encoding)
114
+        {
115
+            string decode = string.Empty;
116
+            byte[] bytes = Convert.FromBase64String(result);
117
+            try
118
+            {
119
+                decode = encoding.GetString(bytes);
120
+            }
121
+            catch
122
+            {
123
+                decode = result;
124
+            }
125
+            return decode;
126
+        }
127
+
128
+        /// <summary>
129
+        /// Base64Url编码
130
+        /// </summary>
131
+        /// <param name="text">待编码的文本字符串</param>
132
+        /// <returns>编码的文本字符串</returns>
133
+        public static string Base64UrlEncode(this string text)
134
+        {
135
+            var plainTextBytes = Encoding.UTF8.GetBytes(text);
136
+            var base64 = Convert.ToBase64String(plainTextBytes).Replace('+', '-').Replace('/', '_').TrimEnd('=');
137
+
138
+            return base64;
139
+        }
140
+
141
+        /// <summary>
142
+        /// Base64Url解码
143
+        /// </summary>
144
+        /// <param name="base64UrlStr">使用Base64Url编码后的字符串</param>
145
+        /// <returns>解码后的内容</returns>
146
+        public static string Base64UrlDecode(this string base64UrlStr)
147
+        {
148
+            base64UrlStr = base64UrlStr.Replace('-', '+').Replace('_', '/');
149
+            switch (base64UrlStr.Length % 4)
150
+            {
151
+                case 2:
152
+                    base64UrlStr += "==";
153
+                    break;
154
+                case 3:
155
+                    base64UrlStr += "=";
156
+                    break;
157
+            }
158
+            var bytes = Convert.FromBase64String(base64UrlStr);
159
+
160
+            return Encoding.UTF8.GetString(bytes);
161
+        }
162
+
163
+        /// <summary>
164
+        /// 计算SHA1摘要
165
+        /// 注:默认使用UTF8编码
166
+        /// </summary>
167
+        /// <param name="str">字符串</param>
168
+        /// <returns></returns>
169
+        public static byte[] ToSHA1Bytes(this string str)
170
+        {
171
+            return str.ToSHA1Bytes(Encoding.UTF8);
172
+        }
173
+
174
+        /// <summary>
175
+        /// 计算SHA1摘要
176
+        /// </summary>
177
+        /// <param name="str">字符串</param>
178
+        /// <param name="encoding">编码</param>
179
+        /// <returns></returns>
180
+        public static byte[] ToSHA1Bytes(this string str, Encoding encoding)
181
+        {
182
+            SHA1 sha1 = new SHA1CryptoServiceProvider();
183
+            byte[] inputBytes = encoding.GetBytes(str);
184
+            byte[] outputBytes = sha1.ComputeHash(inputBytes);
185
+
186
+            return outputBytes;
187
+        }
188
+
189
+        /// <summary>
190
+        /// 转为SHA1哈希加密字符串
191
+        /// 注:默认使用UTF8编码
192
+        /// </summary>
193
+        /// <param name="str">字符串</param>
194
+        /// <returns></returns>
195
+        public static string ToSHA1String(this string str)
196
+        {
197
+            return str.ToSHA1String(Encoding.UTF8);
198
+        }
199
+
200
+        /// <summary>
201
+        /// 转为SHA1哈希
202
+        /// </summary>
203
+        /// <param name="str">字符串</param>
204
+        /// <param name="encoding">编码</param>
205
+        /// <returns></returns>
206
+        public static string ToSHA1String(this string str, Encoding encoding)
207
+        {
208
+            byte[] sha1Bytes = str.ToSHA1Bytes(encoding);
209
+            string resStr = BitConverter.ToString(sha1Bytes);
210
+            return resStr.Replace("-", "").ToLower();
211
+        }
212
+
213
+        /// <summary>
214
+        /// SHA256加密
215
+        /// </summary>
216
+        /// <param name="str">字符串</param>
217
+        /// <returns></returns>
218
+        public static string ToSHA256String(this string str)
219
+        {
220
+            byte[] bytes = Encoding.UTF8.GetBytes(str);
221
+            byte[] hash = SHA256.Create().ComputeHash(bytes);
222
+
223
+            StringBuilder builder = new StringBuilder();
224
+            for (int i = 0; i < hash.Length; i++)
225
+            {
226
+                builder.Append(hash[i].ToString("x2"));
227
+            }
228
+
229
+            return builder.ToString();
230
+        }
231
+
232
+        /// <summary>
233
+        /// HMACSHA256算法
234
+        /// </summary>
235
+        /// <param name="text">内容</param>
236
+        /// <param name="secret">密钥</param>
237
+        /// <returns></returns>
238
+        public static string ToHMACSHA256String(this string text, string secret)
239
+        {
240
+            secret = secret ?? "";
241
+            byte[] keyByte = Encoding.UTF8.GetBytes(secret);
242
+            byte[] messageBytes = Encoding.UTF8.GetBytes(text);
243
+            using (var hmacsha256 = new HMACSHA256(keyByte))
244
+            {
245
+                byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
246
+                return Convert.ToBase64String(hashmessage).Replace('+', '-').Replace('/', '_').TrimEnd('=');
247
+            }
248
+        }
249
+
250
+        /// <summary>
251
+        /// string转int
252
+        /// </summary>
253
+        /// <param name="str">字符串</param>
254
+        /// <returns></returns>
255
+        public static int ToInt(this string str)
256
+        {
257
+            str = str.Replace("\0", "");
258
+            if (string.IsNullOrEmpty(str))
259
+                return 0;
260
+            return Convert.ToInt32(str);
261
+        }
262
+
263
+        /// <summary>
264
+        /// string转long
265
+        /// </summary>
266
+        /// <param name="str">字符串</param>
267
+        /// <returns></returns>
268
+        public static long ToLong(this string str)
269
+        {
270
+            str = str?.Replace("\0", "");
271
+            if (string.IsNullOrEmpty(str))
272
+                return 0;
273
+
274
+            return Convert.ToInt64(str);
275
+        }
276
+
277
+        /// <summary>
278
+        /// 转换为double
279
+        /// </summary>
280
+        /// <param name="str">字符串</param>
281
+        /// <returns></returns>
282
+        public static double ToDouble(this string str)
283
+        {
284
+            return Convert.ToDouble(str);
285
+        }
286
+
287
+        /// <summary>
288
+        /// string转byte[]
289
+        /// </summary>
290
+        /// <param name="str">字符串</param>
291
+        /// <returns></returns>
292
+        public static byte[] ToBytes(this string str)
293
+        {
294
+            return Encoding.Default.GetBytes(str);
295
+        }
296
+
297
+        /// <summary>
298
+        /// string转byte[]
299
+        /// </summary>
300
+        /// <param name="str">字符串</param>
301
+        /// <param name="theEncoding">需要的编码</param>
302
+        /// <returns></returns>
303
+        public static byte[] ToBytes(this string str, Encoding theEncoding)
304
+        {
305
+            return theEncoding.GetBytes(str);
306
+        }
307
+
308
+        /// <summary>
309
+        /// 转换为日期格式
310
+        /// </summary>
311
+        /// <param name="str"></param>
312
+        /// <returns></returns>
313
+        public static DateTime ToDateTime(this string str)
314
+        {
315
+            return Convert.ToDateTime(str);
316
+        }
317
+
318
+        /// <summary>
319
+        /// 转为首字母大写
320
+        /// </summary>
321
+        /// <param name="str">字符串</param>
322
+        /// <returns></returns>
323
+        public static string ToFirstUpperStr(this string str)
324
+        {
325
+            return str.Substring(0, 1).ToUpper() + str.Substring(1);
326
+        }
327
+
328
+        /// <summary>
329
+        /// 转为首字母小写
330
+        /// </summary>
331
+        /// <param name="str">字符串</param>
332
+        /// <returns></returns>
333
+        public static string ToFirstLowerStr(this string str)
334
+        {
335
+            return str.Substring(0, 1).ToLower() + str.Substring(1);
336
+        }
337
+
338
+        /// <summary>
339
+        /// 将枚举类型的文本转为枚举类型
340
+        /// </summary>
341
+        /// <typeparam name="TEnum">枚举类型</typeparam>
342
+        /// <param name="enumText">枚举文本</param>
343
+        /// <returns></returns>
344
+        public static TEnum ToEnum<TEnum>(this string enumText) where TEnum : struct
345
+        {
346
+            Enum.TryParse(enumText, out TEnum value);
347
+
348
+            return value;
349
+        }
350
+    }
351
+}

+ 130 - 0
RMYY_CallCenter_Api.Utility/Helper/CacheHelper.cs

@@ -0,0 +1,130 @@
1
+using System;
2
+using System.Collections;
3
+using System.Collections.Generic;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+using System.Web;
8
+using System.Web.Caching;
9
+
10
+namespace RMYY_CallCenter_Api.Utility
11
+{
12
+    public class CacheHelper
13
+    {
14
+        /// <summary>
15
+        /// 创建缓存项的文件依赖
16
+        /// </summary>
17
+        /// <param name="key">缓存Key</param>
18
+        /// <param name="obj">object对象</param>
19
+        /// <param name="fileName">文件绝对路径</param>
20
+        public static void Insert(string key, object obj, string fileName)
21
+        {
22
+            //创建缓存依赖项
23
+            CacheDependency dep = new CacheDependency(fileName);
24
+            //创建缓存
25
+            HttpContext.Current.Cache.Insert(key, obj, dep);
26
+        }
27
+        /// <summary>
28
+        /// 创建缓存,无过期时间
29
+        /// </summary>
30
+        /// <param name="key"></param>
31
+        /// <param name="obj"></param>
32
+        public static void Insert(string key, object obj)
33
+        {
34
+            HttpContext.Current.Cache.Insert(key, obj);
35
+        }
36
+        /// <summary>
37
+        /// 创建缓存项过期
38
+        /// </summary>
39
+        /// <param name="key">缓存Key</param>
40
+        /// <param name="obj">object对象</param>
41
+        /// <param name="expires">过期时间(分钟)</param>
42
+        public static void Insert(string key, object obj, int expires)
43
+        {
44
+            //最后一次访问开始计算
45
+            //HttpContext.Current.Cache.Insert(key, obj, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, expires, 0));
46
+
47
+            //从设置时开始计算
48
+            HttpContext.Current.Cache.Insert(key, obj, null, DateTime.UtcNow.AddMinutes(expires), Cache.NoSlidingExpiration);
49
+        }
50
+
51
+        /// <summary>
52
+        /// 创建缓存项过期
53
+        /// </summary>
54
+        /// <param name="key">缓存Key</param>
55
+        /// <param name="obj">object对象</param>
56
+        /// <param name="expires">过期时间(分钟)</param>
57
+        /// <param name="priority">缓存清理优先级</param>
58
+        public static void Insert(string key, object obj, int expires, CacheItemPriority priority)
59
+        {
60
+            //从设置时开始计算
61
+            HttpContext.Current.Cache.Insert(key, obj, null, DateTime.UtcNow.AddMinutes(expires), Cache.NoSlidingExpiration, priority, null);
62
+        }
63
+
64
+        /// <summary>
65
+        /// 创建缓存项过期
66
+        /// </summary>
67
+        /// <param name="key">缓存Key</param>
68
+        /// <param name="obj">object对象</param>
69
+        /// <param name="expires">过期时间(分钟)</param>
70
+        /// <param name="priority">缓存清理优先级</param>
71
+        public static void Insert(string key, object obj, int expires, CacheItemPriority priority, CacheItemRemovedCallback onRemoveCallback)
72
+        {
73
+            //从设置时开始计算
74
+            HttpContext.Current.Cache.Insert(key, obj, null, DateTime.UtcNow.AddMinutes(expires), Cache.NoSlidingExpiration, priority, onRemoveCallback);
75
+        }
76
+
77
+        /// <summary>
78
+        /// 获取缓存对象
79
+        /// </summary>
80
+        /// <param name="key">缓存Key</param>
81
+        /// <returns>object对象</returns>
82
+        public static object Get(string key)
83
+        {
84
+            if (string.IsNullOrEmpty(key))
85
+            {
86
+                return null;
87
+            }
88
+            return HttpContext.Current.Cache.Get(key);
89
+        }
90
+
91
+        /// <summary>
92
+        /// 获取缓存对象
93
+        /// </summary>
94
+        /// <typeparam name="T">T对象</typeparam>
95
+        /// <param name="key">缓存Key</param>
96
+        /// <returns></returns>
97
+        public static T Get<T>(string key)
98
+        {
99
+            object obj = Get(key);
100
+            return obj == null ? default(T) : (T)obj;
101
+        }
102
+        /// <summary>
103
+        /// 移出Cache对象
104
+        /// </summary>
105
+        /// <param name="CacheKey"></param>
106
+        public static void Remove(string Key)
107
+        {
108
+            System.Web.Caching.Cache objCache = HttpRuntime.Cache;
109
+            objCache.Remove(Key);
110
+        }
111
+        /// <summary>
112
+        /// 移除所有Cache对象
113
+        /// </summary>
114
+        public static void RemoveAll()
115
+        {
116
+            System.Web.Caching.Cache cache = HttpRuntime.Cache;
117
+            IDictionaryEnumerator cacheEnum = cache.GetEnumerator();
118
+            ArrayList al = new ArrayList();
119
+            while (cacheEnum.MoveNext())
120
+            {
121
+                al.Add(cacheEnum.Key);
122
+            }
123
+
124
+            foreach (string key in al)
125
+            {
126
+                cache.Remove(key);
127
+            }
128
+        }
129
+    }
130
+}

+ 68 - 0
RMYY_CallCenter_Api.Utility/Helper/ConfigHelper.cs

@@ -0,0 +1,68 @@
1
+using System.Configuration;
2
+using System.Web;
3
+namespace RMYY_CallCenter_Api.Utility
4
+{
5
+    public class ConfigHelper
6
+    {
7
+        //public static System.Xml.XmlDocument xDoc;
8
+        //public static System.Xml.XmlNode xNode;
9
+
10
+        //static Configs()
11
+        //{
12
+        //    xDoc = new System.Xml.XmlDocument();
13
+        //    xDoc.Load(HttpContext.Current.Server.MapPath("~/Configs/system.config"));
14
+        //    xNode = xDoc.SelectSingleNode("//appSettings");
15
+        //}
16
+
17
+        static string path = HttpContext.Current.Server.MapPath("~/Configs/system.config");
18
+
19
+        /// <summary>
20
+        /// 根据Key取Value值
21
+        /// </summary>
22
+        /// <param name="key"></param>
23
+        public static string GetValue(string key)
24
+        {
25
+            try
26
+            {
27
+                System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
28
+                xDoc.Load(path);
29
+                System.Xml.XmlNode xNode = xDoc.SelectSingleNode("//appSettings");
30
+                var xElem1 = (System.Xml.XmlElement)xNode.SelectSingleNode("//add[@key='" + key + "']");
31
+                return xElem1?.GetAttribute("value") ?? "";
32
+            }
33
+            catch
34
+            {
35
+                return "";
36
+            }
37
+        }
38
+        /// <summary>
39
+        /// 根据Key修改Value
40
+        /// </summary>
41
+        /// <param name="key">要修改的Key</param>
42
+        /// <param name="value">要修改为的值</param>
43
+        public static void SetValue(string key, string value)
44
+        {
45
+            try
46
+            {
47
+                System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
48
+                xDoc.Load(path);
49
+                System.Xml.XmlNode xNode = xDoc.SelectSingleNode("//appSettings");
50
+                //System.Xml.XmlNode xNode;
51
+                System.Xml.XmlElement xElem1;
52
+                System.Xml.XmlElement xElem2;
53
+                xElem1 = (System.Xml.XmlElement)xNode.SelectSingleNode("//add[@key='" + key + "']");
54
+                if (xElem1 != null) xElem1.SetAttribute("value", value);
55
+                else
56
+                {
57
+                    xElem2 = xDoc.CreateElement("add");
58
+                    xElem2.SetAttribute("key", key);
59
+                    xElem2.SetAttribute("value", value);
60
+                    xNode.AppendChild(xElem2);
61
+                }
62
+                xDoc.Save(path);
63
+            }
64
+            catch
65
+            { }
66
+        }
67
+    }
68
+}

+ 262 - 0
RMYY_CallCenter_Api.Utility/Helper/HttpHelper.cs

@@ -0,0 +1,262 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.IO;
4
+using System.Linq;
5
+using System.Net;
6
+using System.Net.Security;
7
+using System.Security.Cryptography.X509Certificates;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+
11
+namespace RMYY_CallCenter_Api.Utility
12
+{
13
+    public static class HttpHelper
14
+    {
15
+        #region POST
16
+        /// <summary>
17
+        /// HTTP POST方式请求数据
18
+        /// </summary>
19
+        /// <param name="url">URL.</param>
20
+        /// <param name="param">POST的数据</param>
21
+        /// <returns></returns>
22
+        public static string HttpPost(string url, string param = null, string jwt = null, string contenttype = "application/x-www-form-urlencoded")
23
+        {
24
+            HttpWebRequest request;
25
+
26
+            //如果是发送HTTPS请求  
27
+            if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
28
+            {
29
+                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
30
+                request = WebRequest.Create(url) as HttpWebRequest;
31
+                request.ProtocolVersion = HttpVersion.Version10;
32
+            }
33
+            else
34
+            {
35
+                request = WebRequest.Create(url) as HttpWebRequest;
36
+            }
37
+            if (!string.IsNullOrEmpty(jwt))
38
+            {
39
+                request.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + jwt);
40
+            }
41
+            request.Method = "POST";
42
+            request.ContentType = contenttype;
43
+            request.Accept = "*/*";
44
+            request.Timeout = 15000;
45
+            request.AllowAutoRedirect = false;
46
+
47
+            StreamWriter requestStream = null;
48
+            WebResponse response = null;
49
+            string responseStr = null;
50
+
51
+            try
52
+            {
53
+                //LogTools.WriteErrorLog("post请求:", new List<object>() { url, param });
54
+
55
+                requestStream = new StreamWriter(request.GetRequestStream());
56
+                requestStream.Write(param);
57
+                requestStream.Close();
58
+
59
+                response = request.GetResponse();
60
+                if (response != null)
61
+                {
62
+                    StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
63
+                    responseStr = reader.ReadToEnd();
64
+                    reader.Close();
65
+                }
66
+                //LogTools.WriteErrorLog("post请求结果:" + responseStr);
67
+            }
68
+            catch (Exception ex)
69
+            {
70
+                responseStr = null;
71
+                LogHelper.Error("post请求失败,url:" + url + ",参数:" + (param?.ToJson() ?? ""), ex);
72
+            }
73
+            finally
74
+            {
75
+                request = null;
76
+                requestStream = null;
77
+                response = null;
78
+            }
79
+
80
+            return responseStr;
81
+        }
82
+
83
+        private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
84
+        {
85
+            return true; //总是接受  
86
+        }
87
+
88
+        #endregion
89
+
90
+        #region Get
91
+        /// <summary>
92
+        /// HTTP GET方式请求数据.
93
+        /// </summary>
94
+        /// <param name="url">URL.</param>
95
+        /// <returns></returns>
96
+        public static string HttpGet(string url, string jwt = null)
97
+        {
98
+            HttpWebRequest request;
99
+
100
+            //如果是发送HTTPS请求  
101
+            if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
102
+            {
103
+                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
104
+                request = WebRequest.Create(url) as HttpWebRequest;
105
+                request.ProtocolVersion = HttpVersion.Version10;
106
+            }
107
+            else
108
+            {
109
+                request = WebRequest.Create(url) as HttpWebRequest;
110
+            }
111
+            if (!string.IsNullOrEmpty(jwt))
112
+            {
113
+                request.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + jwt);
114
+            }
115
+            request.Method = "GET";
116
+            //request.ContentType = "application/x-www-form-urlencoded";
117
+            request.Accept = "*/*";
118
+            request.Timeout = 15000;
119
+            request.AllowAutoRedirect = false;
120
+            WebResponse response = null;
121
+            string responseStr = null;
122
+
123
+
124
+            try
125
+            {
126
+                //LogTools.WriteErrorLog("get请求url:" + url);
127
+                response = request.GetResponse();
128
+
129
+                if (response != null)
130
+                {
131
+                    StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
132
+                    responseStr = reader.ReadToEnd();
133
+                    reader.Close();
134
+                }
135
+
136
+                //LogTools.WriteErrorLog("get请求结果:" + responseStr);
137
+            }
138
+            catch (Exception ex)
139
+            {
140
+                responseStr = null;
141
+                LogHelper.Error("get请求失败,url:" + url, ex);
142
+            }
143
+            return responseStr;
144
+        }
145
+        public static string HttpGet(string url, Encoding encodeing, string jwt = null)
146
+        {
147
+            HttpWebRequest request;
148
+
149
+            //如果是发送HTTPS请求  
150
+            if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
151
+            {
152
+                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
153
+                request = WebRequest.Create(url) as HttpWebRequest;
154
+                request.ProtocolVersion = HttpVersion.Version10;
155
+            }
156
+            else
157
+            {
158
+                request = WebRequest.Create(url) as HttpWebRequest;
159
+            }
160
+            if (!string.IsNullOrEmpty(jwt))
161
+            {
162
+                request.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + jwt);
163
+            }
164
+            request.Method = "GET";
165
+            //request.ContentType = "application/x-www-form-urlencoded";
166
+            request.Accept = "*/*";
167
+            request.Timeout = 15000;
168
+            request.AllowAutoRedirect = false;
169
+            WebResponse response = null;
170
+            string responseStr = null;
171
+
172
+            try
173
+            {
174
+                response = request.GetResponse();
175
+
176
+                if (response != null)
177
+                {
178
+                    StreamReader reader = new StreamReader(response.GetResponseStream(), encodeing);
179
+                    responseStr = reader.ReadToEnd();
180
+                    reader.Close();
181
+                }
182
+            }
183
+            catch (Exception ex)
184
+            {
185
+                responseStr = null;
186
+                LogHelper.Error("get请求失败,url:" + url, ex);
187
+            }
188
+            return responseStr;
189
+        }
190
+        #endregion
191
+
192
+        #region Put
193
+        /// <summary>
194
+        /// HTTP Put方式请求数据.
195
+        /// </summary>
196
+        /// <param name="url">URL.</param>
197
+        /// <returns></returns>
198
+        public static string HttpPut(string url, string param = null, string jwt = null, string contenttype = "application/x-www-form-urlencoded")
199
+        {
200
+            HttpWebRequest request;
201
+
202
+            //如果是发送HTTPS请求  
203
+            if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
204
+            {
205
+                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
206
+                request = WebRequest.Create(url) as HttpWebRequest;
207
+                request.ProtocolVersion = HttpVersion.Version10;
208
+            }
209
+            else
210
+            {
211
+                request = WebRequest.Create(url) as HttpWebRequest;
212
+            }
213
+            if (!string.IsNullOrEmpty(jwt))
214
+            {
215
+                request.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + jwt);
216
+            }
217
+            request.Method = "PUT";
218
+            request.ContentType = contenttype;
219
+            request.Accept = "*/*";
220
+            request.Timeout = 15000;
221
+            request.AllowAutoRedirect = false;
222
+
223
+            StreamWriter requestStream = null;
224
+            WebResponse response = null;
225
+            string responseStr = null;
226
+
227
+            try
228
+            {
229
+                //LogTools.WriteErrorLog("put请求:", new List<object>() { url, param });
230
+
231
+                requestStream = new StreamWriter(request.GetRequestStream());
232
+                requestStream.Write(param);
233
+                requestStream.Close();
234
+
235
+                response = request.GetResponse();
236
+                if (response != null)
237
+                {
238
+                    StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
239
+                    responseStr = reader.ReadToEnd();
240
+                    reader.Close();
241
+                }
242
+
243
+                //LogTools.WriteErrorLog("put请求结果:" + responseStr);
244
+            }
245
+            catch (Exception ex)
246
+            {
247
+                responseStr = null;
248
+
249
+                LogHelper.Error("put请求失败,url:" + url + ",参数:" + (param?.ToJson() ?? ""), ex);
250
+            }
251
+            finally
252
+            {
253
+                request = null;
254
+                requestStream = null;
255
+                response = null;
256
+            }
257
+
258
+            return responseStr;
259
+        }
260
+        #endregion
261
+    }
262
+}

+ 90 - 0
RMYY_CallCenter_Api.Utility/Helper/LogHelper.cs

@@ -0,0 +1,90 @@
1
+using log4net;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Diagnostics;
5
+using System.IO;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Web;
10
+
11
+namespace RMYY_CallCenter_Api.Utility
12
+{
13
+    public class LogHelper
14
+    {
15
+
16
+        static LogHelper()
17
+        {
18
+            FileInfo configFile = new FileInfo(HttpContext.Current.Server.MapPath("/Configs/log4net.config"));
19
+            log4net.Config.XmlConfigurator.Configure(configFile);
20
+        }
21
+        /// <summary>
22
+        /// Error
23
+        /// </summary>
24
+        /// <param name="message"></param>
25
+        /// <param name="ex"></param>
26
+        public static void Error(string message, Exception ex = null)
27
+        {
28
+            ILog _log = LogManager.GetLogger(new StackTrace().GetFrame(1).GetMethod().DeclaringType.FullName);
29
+            if (ex != null)
30
+            {
31
+                _log.Error(message, ex);
32
+            }
33
+            else
34
+            {
35
+                _log.Error(message);
36
+            }
37
+        }
38
+        /// <summary>
39
+        /// Info
40
+        /// </summary>
41
+        /// <param name="message"></param>
42
+        /// <param name="ex"></param>
43
+        public static void Info(string message, Exception ex = null)
44
+        {
45
+            ILog _log = LogManager.GetLogger(new StackTrace().GetFrame(1).GetMethod().DeclaringType.FullName);
46
+            if (ex != null)
47
+            {
48
+                _log.Info(message, ex);
49
+            }
50
+            else
51
+            {
52
+                _log.Info(message);
53
+            }
54
+        }
55
+        /// <summary>
56
+        /// Debug
57
+        /// </summary>
58
+        /// <param name="message"></param>
59
+        /// <param name="ex"></param>
60
+        public static void Debug(string message, Exception ex = null)
61
+        {
62
+            ILog _log = LogManager.GetLogger(new StackTrace().GetFrame(1).GetMethod().DeclaringType.FullName);
63
+            if (ex != null)
64
+            {
65
+                _log.Debug(message, ex);
66
+            }
67
+            else
68
+            {
69
+                _log.Debug(message);
70
+            }
71
+        }
72
+        /// <summary>
73
+        /// Warn
74
+        /// </summary>
75
+        /// <param name="message"></param>
76
+        /// <param name="ex"></param>
77
+        public static void Warn(string message, Exception ex = null)
78
+        {
79
+            ILog _log = LogManager.GetLogger(new StackTrace().GetFrame(1).GetMethod().DeclaringType.FullName);
80
+            if (ex != null)
81
+            {
82
+                _log.Warn(message, ex);
83
+            }
84
+            else
85
+            {
86
+                _log.Warn(message);
87
+            }
88
+        }
89
+    }
90
+}

+ 212 - 0
RMYY_CallCenter_Api.Utility/Helper/NPOIHelper.cs

@@ -0,0 +1,212 @@
1
+
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Data;
5
+using System.IO;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Web;
9
+using NPOI.HSSF.UserModel;
10
+using NPOI.OpenXmlFormats.Wordprocessing;
11
+using NPOI.SS.UserModel;
12
+using NPOI.SS.Util;
13
+using NPOI.XSSF.UserModel;
14
+
15
+namespace CallCenter.Utility
16
+{
17
+    public class NPOIHelper
18
+    {
19
+
20
+        /// <summary>
21
+        /// 弹出下载框导出excel
22
+        /// </summary>
23
+        /// <param name="Name"></param>
24
+        /// <param name="dt"></param>
25
+        /// <returns></returns>
26
+        public string ExportToExcel(string Name, DataTable dt, string[] cols = null)
27
+        {
28
+            try
29
+            {
30
+                //if (dt.Rows.Count > 0)
31
+                //{
32
+                HSSFWorkbook workbook = new HSSFWorkbook();
33
+                ISheet sheet = workbook.CreateSheet(Name);
34
+
35
+                ICellStyle HeadercellStyle = workbook.CreateCellStyle();
36
+                HeadercellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
37
+                HeadercellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
38
+                HeadercellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
39
+                HeadercellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
40
+                HeadercellStyle.Alignment = HorizontalAlignment.Center;
41
+                HeadercellStyle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.SkyBlue.Index;
42
+                HeadercellStyle.FillPattern = FillPattern.SolidForeground;
43
+                HeadercellStyle.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.SkyBlue.Index;
44
+
45
+                //字体
46
+                NPOI.SS.UserModel.IFont headerfont = workbook.CreateFont();
47
+                headerfont.Boldweight = (short)FontBoldWeight.Bold;
48
+                headerfont.FontHeightInPoints = 12;
49
+                HeadercellStyle.SetFont(headerfont);
50
+
51
+
52
+                //用column name 作为列名
53
+                int icolIndex = 0;
54
+                IRow headerRow = sheet.CreateRow(0);
55
+
56
+                if (cols == null || (cols != null && cols.Length == 0))
57
+                {
58
+                    foreach (DataColumn dc in dt.Columns)
59
+                    {
60
+                        ICell cell = headerRow.CreateCell(icolIndex);
61
+                        cell.SetCellValue(dc.ColumnName);
62
+                        cell.CellStyle = HeadercellStyle;
63
+                        icolIndex++;
64
+                    }
65
+                }
66
+                else
67
+                {
68
+                    foreach (string dc in cols)
69
+                    {
70
+                        ICell cell = headerRow.CreateCell(icolIndex);
71
+                        cell.SetCellValue(dc);
72
+                        cell.CellStyle = HeadercellStyle;
73
+                        icolIndex++;
74
+                    }
75
+                }
76
+                ICellStyle cellStyle = workbook.CreateCellStyle();
77
+
78
+                //为避免日期格式被Excel自动替换,所以设定 format 为 『@』 表示一率当成text來看
79
+                cellStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("@");
80
+                cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
81
+                cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
82
+                cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
83
+                cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
84
+
85
+
86
+                NPOI.SS.UserModel.IFont cellfont = workbook.CreateFont();
87
+                cellfont.Boldweight = (short)FontBoldWeight.Normal;
88
+                cellStyle.SetFont(cellfont);
89
+
90
+                //建立内容行
91
+                int iRowIndex = 0;
92
+                foreach (DataRow dr in dt.Rows)
93
+                {
94
+                    int iCellIndex = 0;
95
+                    IRow irow = sheet.CreateRow(iRowIndex + 1);
96
+
97
+                    for (int i = 0; i < dt.Columns.Count; i++)
98
+                    {
99
+                        string strsj = string.Empty;
100
+                        if (dr[i] != null)
101
+                        {
102
+                            strsj = dr[i].ToString();
103
+                        }
104
+                        ICell cell = irow.CreateCell(iCellIndex);
105
+                        cell.SetCellValue(strsj);
106
+                        cell.CellStyle = cellStyle;
107
+                        iCellIndex++;
108
+                    }
109
+                    iRowIndex++;
110
+                }
111
+
112
+                //自适应列宽度
113
+                for (int i = 0; i < icolIndex; i++)
114
+                {
115
+                    sheet.AutoSizeColumn(i);
116
+                }
117
+
118
+                using (MemoryStream ms = new MemoryStream())
119
+                {
120
+                    workbook.Write(ms);
121
+
122
+                    HttpContext curContext = HttpContext.Current;
123
+
124
+
125
+                    // 设置编码和附件格式
126
+                    curContext.Response.ContentType = "application/vnd.ms-excel";
127
+                    curContext.Response.ContentEncoding = Encoding.UTF8;
128
+                    curContext.Response.Charset = "";
129
+                    curContext.Response.AppendHeader("Content-Disposition",
130
+                        "attachment;filename=" + HttpUtility.UrlEncode(Name + "_导出文件_" + DateTime.Now.Ticks + ".xls", Encoding.UTF8));
131
+
132
+                    curContext.Response.BinaryWrite(ms.GetBuffer());
133
+
134
+                    workbook = null;
135
+                    ms.Close();
136
+                    ms.Dispose();
137
+
138
+                    curContext.Response.End();
139
+                }
140
+                //}
141
+                return "";
142
+            }
143
+            catch
144
+            {
145
+                return "导出失败!";
146
+            }
147
+        }
148
+
149
+        /// <summary>
150
+        /// 导入excel转换为datatable
151
+        /// </summary>
152
+        /// <param name="upfile"></param>
153
+        /// <param name="headrow"></param>
154
+        /// <returns></returns>
155
+        public DataTable ExcelToTable(HttpPostedFile upfile, int headrow)
156
+        {
157
+            DataTable dt = new DataTable();
158
+
159
+            IWorkbook workbook = null;
160
+
161
+            Stream stream = upfile.InputStream;
162
+
163
+            string suffix = upfile.FileName.Substring(upfile.FileName.LastIndexOf(".") + 1).ToLower();
164
+            if (suffix == "xlsx") // 2007版本
165
+            {
166
+                workbook = new XSSFWorkbook(stream);
167
+            }
168
+            else if (suffix == "xls") // 2003版本
169
+            {
170
+                workbook = new HSSFWorkbook(stream);
171
+            }
172
+
173
+            //获取excel的第一个sheet
174
+            ISheet sheet = workbook.GetSheetAt(0);
175
+
176
+            //获取sheet的第一行
177
+            IRow headerRow = sheet.GetRow(headrow);
178
+
179
+            //一行最后一个方格的编号 即总的列数
180
+            int cellCount = headerRow.LastCellNum;
181
+            //最后一列的标号  即总的行数
182
+            int rowCount = sheet.LastRowNum;
183
+            //列名
184
+            for (int i = 0; i < cellCount; i++)
185
+            {
186
+                dt.Columns.Add(headerRow.GetCell(i).ToString());
187
+            }
188
+
189
+            for (int i = (sheet.FirstRowNum + headrow + 1); i <= sheet.LastRowNum; i++)
190
+            {
191
+                DataRow dr = dt.NewRow();
192
+
193
+                IRow row = sheet.GetRow(i);
194
+                for (int j = row.FirstCellNum; j < cellCount; j++)
195
+                {
196
+                    if (row.GetCell(j) != null)
197
+                    {
198
+                        dr[j] = row.GetCell(j).ToString();
199
+                    }
200
+                }
201
+
202
+                dt.Rows.Add(dr);
203
+            }
204
+
205
+            sheet = null;
206
+            workbook = null;
207
+
208
+            return dt;
209
+        }
210
+
211
+    }
212
+}

+ 815 - 0
RMYY_CallCenter_Api.Utility/Helper/RedisHelper.cs

@@ -0,0 +1,815 @@
1
+using System;
2
+using StackExchange.Redis;
3
+using System.Collections.Generic;
4
+using System.Linq;
5
+using Newtonsoft.Json;
6
+using System.Collections;
7
+
8
+namespace RMYY_CallCenter_Api.Utility
9
+{
10
+    public class RedisHelper
11
+    {
12
+        #region 
13
+        //执行顺序---静态字段---静态构造函数---构造函数
14
+        private static ConnectionMultiplexer redis;
15
+        private static IDatabase database;
16
+        static RedisHelper()
17
+        {
18
+            if (redis == null || !redis.IsConnected)
19
+            {
20
+                var config = new ConfigurationOptions
21
+                {
22
+                    AbortOnConnectFail = false,
23
+                    AllowAdmin = true,
24
+                    ConnectTimeout = 15000,
25
+                    SyncTimeout = 5000,
26
+                    ResponseTimeout = 15000,
27
+                    Password = "",//Redis数据库密码
28
+                    EndPoints = { ConfigHelper.GetValue("Redis_Server") + ":" + ConfigHelper.GetValue("Redis_Port") }// connectionString 为IP:Port 如”192.168.2.110:6379”
29
+                };
30
+                redis = ConnectionMultiplexer.Connect(config);
31
+                //redis = ConnectionMultiplexer.Connect(Configs.GetValue("Redis_Server")+":"+Configs.GetValue("Redis_Port"));
32
+                //redis = ConnectionMultiplexer.Connect("192.168.4.18, abortConnect=false");
33
+
34
+                database = redis.GetDatabase();
35
+            }
36
+        }
37
+
38
+        #endregion
39
+
40
+        #region redis 字符串(string)操作
41
+
42
+        /// <summary>
43
+        /// 设置指定键的值
44
+        /// </summary>
45
+        /// <param name="key"></param>
46
+        /// <param name="value"></param>
47
+        /// <returns></returns>
48
+        public static bool StringSet(string key, string value)
49
+        {
50
+            return database.StringSet(key, value);
51
+        }
52
+
53
+        /// <summary>
54
+        /// 获取指定键的值
55
+        /// </summary>
56
+        /// <param name="key"></param>
57
+        /// <returns></returns>
58
+        public static object StringGet(string key)
59
+        {
60
+            if (string.IsNullOrEmpty(key))
61
+            {
62
+                return null;
63
+
64
+            }
65
+            else
66
+            {
67
+                var rt = database.StringGet(key);
68
+
69
+                if (rt.IsNull)
70
+                {
71
+                    return null ;
72
+                }
73
+                else
74
+                {
75
+                    return rt;
76
+                }
77
+            }
78
+          
79
+        }
80
+
81
+        /// <summary>
82
+        /// 获取存储在键上的字符串的子字符串
83
+        /// </summary>
84
+        /// <param name="key"></param>
85
+        /// <param name="start"></param>
86
+        /// <param name="end"></param>
87
+        /// <returns></returns>
88
+        public static object StringGet(string key, int start, int end)
89
+        {
90
+            var rt = database.StringGetRange(key, start, end);
91
+            if (rt.IsNull)
92
+            {
93
+                return null;
94
+            }
95
+            else
96
+            {
97
+                return rt;
98
+            }
99
+        }
100
+
101
+        /// <summary>
102
+        /// 设置键的字符串值并返回其旧值
103
+        /// </summary>
104
+        /// <param name="key"></param>
105
+        /// <param name="value"></param>
106
+        /// <returns></returns>
107
+        public static object StringGetAndSet(string key, string value)
108
+        {
109
+            var rt = database.StringGetSet(key, value);
110
+            if (rt.IsNull)
111
+            {
112
+                return null;
113
+            }
114
+            else
115
+            {
116
+                return rt;
117
+            }
118
+        }
119
+
120
+        /// <summary>
121
+        /// 返回在键处存储的字符串值中偏移处的位值
122
+        /// </summary>
123
+        /// <param name="key"></param>
124
+        /// <param name="offset"></param>
125
+        /// <returns></returns>
126
+        public static bool StringGetBit(string key, long offset)
127
+        {
128
+            return database.StringGetBit(key, offset);
129
+        }
130
+
131
+        /// <summary>
132
+        /// 获取所有给定键的值
133
+        /// </summary>
134
+        /// <param name="keys"></param>
135
+        /// <returns></returns>
136
+        public static List<object> StringMultiGet(string[] keys)
137
+        {
138
+            List<object> list = new List<object>();
139
+            for (int i = 0; i < keys.Length; i++)
140
+            {
141
+                list.Add(database.StringGet(keys[i]));
142
+            }
143
+            return list;
144
+        }
145
+
146
+        /// <summary>
147
+        /// 存储在键上的字符串值中设置或清除偏移处的位
148
+        /// </summary>
149
+        /// <param name="key"></param>
150
+        /// <param name="offset"></param>
151
+        /// <param name="value"></param>
152
+        /// <returns></returns>
153
+        public static bool StringSetBit(string key, long offset)
154
+        {
155
+            return database.StringSetBit(key, offset, true);
156
+        }
157
+
158
+        /// <summary>
159
+        /// 使用键和到期时间来设置值
160
+        /// </summary>
161
+        /// <param name="key"></param>
162
+        /// <param name="value"></param>
163
+        /// <param name="expiry"></param>
164
+        /// <returns></returns>
165
+        public static bool StringSet(string key, string value, TimeSpan expiry)
166
+        {
167
+            return database.StringSet(key, value, expiry);
168
+        }
169
+
170
+        /// <summary>
171
+        /// 设置键的值,仅当键不存在时
172
+        /// </summary>
173
+        /// <param name="key"></param>
174
+        /// <param name="value"></param>
175
+        /// <returns></returns>
176
+        public static void StringSetIfAbsent(string key, string value)
177
+        {
178
+            if (database.StringGet(key) == RedisValue.Null)
179
+            {
180
+                database.StringSet(key, value);
181
+            }
182
+        }
183
+
184
+        /// <summary>
185
+        /// 在指定偏移处开始的键处覆盖字符串的一部分
186
+        /// </summary>
187
+        /// <param name="key">键值</param>
188
+        /// <param name="value">值</param>
189
+        /// <param name="offset">偏移量</param>
190
+        /// <returns></returns>
191
+        public static object StringSet(string key, long offset, string value)
192
+        {
193
+            return database.StringSetRange(key, offset, value);
194
+        }
195
+
196
+        /// <summary>
197
+        /// 获取存储在键中的值的长度
198
+        /// </summary>
199
+        /// <param name="key">键值</param>
200
+        /// <returns></returns>
201
+        public static long StringSize(string key)
202
+        {
203
+            return database.StringLength(key);
204
+        }
205
+
206
+        /// <summary>
207
+        /// 为多个键分别设置它们的值
208
+        /// </summary>
209
+        /// <param name="keys"></param>
210
+        /// <returns></returns>
211
+        public static void StringMultiSet(Dictionary<string, string> dic)
212
+        {
213
+            foreach (KeyValuePair<string, string> key in dic)
214
+            {
215
+                database.StringSet(key.Key, key.Value);
216
+            }
217
+        }
218
+
219
+        /// <summary>
220
+        /// 为多个键分别设置它们的值,仅当键不存在时
221
+        /// </summary>
222
+        /// <param name="keys">键值集合</param>
223
+        /// <returns></returns>
224
+        public static void StringMultiSetIfAbsent(Dictionary<string, string> dic)
225
+        {
226
+            foreach (KeyValuePair<string, string> key in dic)
227
+            {
228
+                //判断键值是否存在
229
+                if (database.StringGet(key.Key) == RedisValue.Null)
230
+                {
231
+                    database.StringSet(key.Key, key.Value);
232
+                }
233
+            }
234
+        }
235
+
236
+        /// <summary>
237
+        /// 将键的整数值按给定的数值增加
238
+        /// </summary>
239
+        /// <param name="key">键值</param>
240
+        /// <param name="value">给定的数值</param>
241
+        /// <returns></returns>
242
+        public static double StringIncrement(string key, double value)
243
+        {
244
+            return database.StringIncrement(key, value);
245
+        }
246
+
247
+        /// <summary>
248
+        /// 在key键对应值的右面追加值value
249
+        /// </summary>
250
+        /// <param name="key"></param>
251
+        /// <param name="value"></param>
252
+        /// <returns></returns>
253
+        public static long StringAppend(string key, string value)
254
+        {
255
+            return database.StringAppend(key, value);
256
+        }
257
+
258
+        /// <summary>
259
+        /// 删除某个键值
260
+        /// </summary>
261
+        /// <param name="key"></param>
262
+        /// <returns></returns>
263
+        public static bool StringDelete(string key)
264
+        {
265
+            return false;
266
+        }
267
+
268
+        #endregion
269
+
270
+        #region redis 哈希/散列/字典(Hash)操作
271
+
272
+        /// <summary>
273
+        /// 删除指定的哈希字段
274
+        /// </summary>
275
+        /// <param name="key"></param>
276
+        /// <param name="field"></param>
277
+        /// <returns></returns>
278
+        public static bool HashDelete(string key, string field)
279
+        {
280
+            return database.HashDelete(key, field);
281
+        }
282
+
283
+        /// <summary>
284
+        /// 判断是否存在散列字段
285
+        /// </summary>
286
+        /// <param name=""></param>
287
+        /// <param name=""></param>
288
+        /// <returns></returns>
289
+        public static bool HashHasKey(string key, string field)
290
+        {
291
+            return database.HashExists(key, field);
292
+        }
293
+
294
+        /// <summary>
295
+        /// 获取存储在指定键的哈希字段的值
296
+        /// </summary>
297
+        /// <param name="key"></param>
298
+        /// <param name="field"></param>
299
+        /// <returns></returns>
300
+        public static object HashGet(string key, string field)
301
+        {
302
+            return database.HashGet(key, field);
303
+        }
304
+
305
+        /// <summary>
306
+        /// 获取存储在指定键的哈希中的所有字段和值
307
+        /// </summary>
308
+        /// <param name="key"></param>
309
+        /// <returns></returns>
310
+        public static Dictionary<string, object> HashGetAll(string key)
311
+        {
312
+            Dictionary<string, object> dic = new Dictionary<string, object>();
313
+            var collection = database.HashGetAll(key);
314
+            foreach (var item in collection)
315
+            {
316
+                dic.Add(item.Name, item.Value);
317
+            }
318
+            return dic;
319
+        }
320
+
321
+        /// <summary>
322
+        /// 将哈希字段的浮点值按给定数值增加
323
+        /// </summary>
324
+        /// <param name="key"></param>
325
+        /// <param name="field"></param>
326
+        /// <param name="value">给定的数值</param>
327
+        /// <returns></returns>
328
+        public static double HashIncrement(string key, string field, double value)
329
+        {
330
+            return database.HashIncrement(key, field, value);
331
+        }
332
+
333
+        /// <summary>
334
+        /// 获取哈希中的所有字段
335
+        /// </summary>
336
+        /// <param name="key"></param>
337
+        /// <returns></returns>
338
+        public static string[] HashKeys(string key)
339
+        {
340
+            return database.HashKeys(key).ToStringArray();
341
+        }
342
+
343
+        /// <summary>
344
+        /// 获取散列中的字段数量
345
+        /// </summary>
346
+        /// <param name="key"></param>
347
+        /// <returns></returns>
348
+        public static long HashSize(string key)
349
+        {
350
+            return database.HashLength(key);
351
+        }
352
+
353
+        /// <summary>
354
+        /// 获取所有给定哈希字段的值
355
+        /// </summary>
356
+        /// <param name="key"></param>
357
+        /// <param name="hashKeys"></param>
358
+        /// <returns></returns>
359
+        public static List<object> HashMultiGet(string key, List<string> hashKeys)
360
+        {
361
+            List<object> result = new List<object>();
362
+            foreach (string field in hashKeys)
363
+            {
364
+                result.Add(database.HashGet(key, field));
365
+            }
366
+            return result;
367
+        }
368
+
369
+        /// <summary>
370
+        /// 为多个哈希字段分别设置它们的值
371
+        /// </summary>
372
+        /// <param name="key"></param>
373
+        /// <param name="dic"></param>
374
+        /// <returns></returns>
375
+        public static void HashPutAll(string key, Dictionary<string, string> dic)
376
+        {
377
+            List<HashEntry> list = new List<HashEntry>();
378
+            for (int i = 0; i < dic.Count; i++)
379
+            {
380
+                KeyValuePair<string, string> param = dic.ElementAt(i);
381
+                list.Add(new HashEntry(param.Key, param.Value));
382
+            }
383
+            database.HashSet(key, list.ToArray());
384
+        }
385
+
386
+        /// <summary>
387
+        /// 设置散列字段的字符串值
388
+        /// </summary>
389
+        /// <param name="key"></param>
390
+        /// <param name="field"></param>
391
+        /// <param name="value"></param>
392
+        /// <returns></returns>
393
+        public static void HashPut(string key, string field, string value)
394
+        {
395
+            database.HashSet(key, new HashEntry[] { new HashEntry(field, value) });
396
+        }
397
+
398
+        /// <summary>
399
+        /// 仅当字段不存在时,才设置散列字段的值
400
+        /// </summary>
401
+        /// <param name="key"></param>
402
+        /// <param name="fiels"></param>
403
+        /// <param name="value"></param>
404
+        /// <returns></returns>
405
+        public static void HashPutIfAbsent(string key, string field, string value)
406
+        {
407
+            if (!HashHasKey(key, field))
408
+            {
409
+                database.HashSet(key, new HashEntry[] { new HashEntry(field, value) });
410
+            }
411
+        }
412
+
413
+        /// <summary>
414
+        /// 获取哈希中的所有值
415
+        /// </summary>
416
+        /// <param name="key"></param>
417
+        /// <returns></returns>
418
+        public static string[] HashValues(string key)
419
+        {
420
+            return database.HashValues(key).ToStringArray();
421
+        }
422
+
423
+        /// <summary>
424
+        /// redis中获取指定键的值并返回对象
425
+        /// </summary>
426
+        /// <typeparam name="T"></typeparam>
427
+        /// <param name="key"></param>
428
+        /// <returns></returns>
429
+        public static T GetHashValue<T>(string key)
430
+        {
431
+            HashEntry[] array = database.HashGetAll(key);
432
+            Dictionary<string, object> dic = new Dictionary<string, object>();
433
+            for (int i = 0; i < array.Length; i++)
434
+            {
435
+                dic.Add(array[i].Name, array[i].Value);
436
+            }
437
+            if (dic.Count > 0)
438
+            {
439
+                string strJson = JsonConvert.SerializeObject(dic);
440
+                return JsonConvert.DeserializeObject<T>(strJson);
441
+            }
442
+            else
443
+            {
444
+                return default(T);
445
+            }
446
+        }
447
+
448
+        /// <summary>
449
+        /// 把指定对象存储在键值为key的redis中
450
+        /// </summary>
451
+        /// <typeparam name="T"></typeparam>
452
+        /// <param name="t"></param>
453
+        /// <param name="key"></param>
454
+        public static void SetHashValue<T>(T t, string key)
455
+        {
456
+            string strJson = JsonConvert.SerializeObject(t);
457
+            Dictionary<string, string> param = JsonConvert.DeserializeObject<Dictionary<string, string>>(strJson);
458
+            HashPutAll(key, param);
459
+        }
460
+
461
+        #endregion
462
+
463
+        #region redis 列表(List)操作
464
+
465
+        /// <summary>
466
+        /// 从左向右存压栈
467
+        /// </summary>
468
+        /// <param name="key"></param>
469
+        /// <param name="value"></param>
470
+        /// <returns></returns>
471
+        public static long ListLeftPush(string key, string value)
472
+        {
473
+            return database.ListLeftPush(key, value);
474
+        }
475
+
476
+        /// <summary>
477
+        /// 从左出栈
478
+        /// </summary>
479
+        /// <param name="key"></param>
480
+        /// <returns></returns>
481
+        public static object ListLeftPop(string key)
482
+        {
483
+            return database.ListLeftPop(key);
484
+        }
485
+
486
+        /// <summary>
487
+        /// 队/栈长
488
+        /// </summary>
489
+        /// <param name="key"></param>
490
+        /// <returns></returns>
491
+        public static long ListSize(string key)
492
+        {
493
+            return database.ListLength(key);
494
+        }
495
+
496
+        /// <summary>
497
+        /// 范围检索,返回List
498
+        /// </summary>
499
+        /// <param name="key"></param>
500
+        /// <param name="start"></param>
501
+        /// <param name="end"></param>
502
+        /// <returns></returns>
503
+        public static string[] ListRange(string key, int start, int end)
504
+        {
505
+            return database.ListRange(key, start, end).ToStringArray();
506
+        }
507
+
508
+        /// <summary>
509
+        /// 移除key中值为value的i个,返回删除的个数;如果没有这个元素则返回0 
510
+        /// </summary>
511
+        /// <param name="key"></param>
512
+        /// <param name="i"></param>
513
+        /// <param name="value"></param>
514
+        /// <returns></returns>
515
+        public static long ListRemove(string key, string value)
516
+        {
517
+            return database.ListRemove(key, value);
518
+        }
519
+
520
+        /// <summary>
521
+        /// 检索
522
+        /// </summary>
523
+        /// <param name="key"></param>
524
+        /// <param name="index"></param>
525
+        /// <returns></returns>
526
+        public static object ListIndex(string key, long index)
527
+        {
528
+            return database.ListGetByIndex(key, index);
529
+        }
530
+
531
+        /// <summary>
532
+        /// 赋值
533
+        /// </summary>
534
+        /// <param name="key"></param>
535
+        /// <param name="index"></param>
536
+        /// <param name="value"></param>
537
+        /// <returns></returns>
538
+        public static void ListSet(string key, int index, string value)
539
+        {
540
+            database.ListSetByIndex(key, index, value);
541
+        }
542
+
543
+        /// <summary>
544
+        /// 裁剪,删除除了[start,end]以外的所有元素 
545
+        /// </summary>
546
+        /// <param name="key"></param>
547
+        /// <param name="start"></param>
548
+        /// <param name="end"></param>
549
+        /// <returns></returns>
550
+        public static void ListTrim(string key, int start, int end)
551
+        {
552
+            database.ListTrim(key, start, end);
553
+        }
554
+
555
+        /// <summary>
556
+        /// 将源key的队列的右边的一个值删除,然后塞入目标key的队列的左边,返回这个值
557
+        /// </summary>
558
+        /// <param name="sourceKey"></param>
559
+        /// <param name="destinationKey"></param>
560
+        /// <returns></returns>
561
+        public static object ListRightPopAndLeftPush(string sourceKey, string destinationKey)
562
+        {
563
+            return database.ListRightPopLeftPush(sourceKey, destinationKey);
564
+        }
565
+
566
+        #endregion
567
+
568
+        #region redis 集合(Set)操作
569
+
570
+        /// <summary>
571
+        /// 集合添加元素
572
+        /// </summary>
573
+        /// <param name="key"></param>
574
+        /// <param name="value"></param>
575
+        public static void SetAdd(string key, string value)
576
+        {
577
+            database.SetAdd(key, value);
578
+        }
579
+
580
+        /// <summary>
581
+        /// 集合组合操作
582
+        /// </summary>
583
+        /// <param name="point">操作标示:0--并集;1--交集;2--差集</param>
584
+        /// <param name="firstKey">第一个集合的键值</param>
585
+        /// <param name="secondKey">第二个集合的键值</param>
586
+        public static string[] SetCombine(int point, string firstKey, string secondKey)
587
+        {
588
+            RedisValue[] array;
589
+            switch (point)
590
+            {
591
+                case 0:
592
+                    array = database.SetCombine(SetOperation.Union, firstKey, secondKey);
593
+                    break;
594
+                case 1:
595
+                    array = database.SetCombine(SetOperation.Intersect, firstKey, secondKey);
596
+                    break;
597
+                case 2:
598
+                    array = database.SetCombine(SetOperation.Difference, firstKey, secondKey);
599
+                    break;
600
+                default:
601
+                    array = new RedisValue[0];
602
+                    break;
603
+            }
604
+            return array.ToStringArray();
605
+        }
606
+
607
+        /// <summary>
608
+        /// 
609
+        /// </summary>
610
+        /// <param name="key"></param>
611
+        /// <param name="value"></param>
612
+        /// <returns></returns>
613
+        public static bool SetContains(string key, string value)
614
+        {
615
+            return database.SetContains(key, value);
616
+        }
617
+
618
+        /// <summary>
619
+        /// 返回对应键值集合的长度
620
+        /// </summary>
621
+        /// <param name="key"></param>
622
+        /// <returns></returns>
623
+        public static long SetLength(string key)
624
+        {
625
+            return database.SetLength(key);
626
+        }
627
+
628
+        /// <summary>
629
+        /// 根据键值返回集合中所有的value
630
+        /// </summary>
631
+        /// <param name="key"></param>
632
+        /// <returns></returns>
633
+        public static string[] SetMembers(string key)
634
+        {
635
+            return database.SetMembers(key).ToStringArray();
636
+        }
637
+
638
+        /// <summary>
639
+        /// 将成员从源集移动到目标集
640
+        /// </summary>
641
+        /// <param name="sourceKey">源集key</param>
642
+        /// <param name="destinationKey">目标集key</param>
643
+        /// <param name="value"></param>
644
+        public static bool SetMove(string sourceKey, string destinationKey, string value)
645
+        {
646
+            return database.SetMove(sourceKey, destinationKey, value);
647
+        }
648
+
649
+        /// <summary>
650
+        /// 移除集合中指定键值随机元素
651
+        /// </summary>
652
+        /// <param name="key"></param>
653
+        public static string SetPop(string key)
654
+        {
655
+            return database.SetPop(key);
656
+        }
657
+
658
+        /// <summary>
659
+        /// 返回集合中指定键值随机元素
660
+        /// </summary>
661
+        /// <param name="key"></param>
662
+        /// <returns></returns>
663
+        public static string SetRandomMember(string key)
664
+        {
665
+            return database.SetRandomMember(key);
666
+        }
667
+
668
+        /// <summary>
669
+        /// 
670
+        /// </summary>
671
+        /// <param name="key"></param>
672
+        /// <param name="count"></param>
673
+        public static string[] SetRandomMembers(string key, long count)
674
+        {
675
+            return database.SetRandomMembers(key, count).ToStringArray();
676
+        }
677
+
678
+        /// <summary>
679
+        /// 移除集合中指定key值和value
680
+        /// </summary>
681
+        /// <param name="key"></param>
682
+        /// <param name="value"></param>
683
+        public static void SetRemove(string key, string value)
684
+        {
685
+            database.SetRemove(key, value);
686
+        }
687
+
688
+        /// <summary>
689
+        /// 
690
+        /// </summary>
691
+        /// <param name="key"></param>
692
+        public static void SetScan(string key)
693
+        {
694
+            database.SetScan(key);
695
+        }
696
+
697
+        #endregion
698
+
699
+        #region redis 有序集合(sorted set)操作
700
+
701
+        public static void Method(string key, string value, double score)
702
+        {
703
+            database.SortedSetAdd(key, new SortedSetEntry[] { new SortedSetEntry(value, score) });
704
+        }
705
+
706
+        #endregion
707
+
708
+        #region redis 键(Key)操作
709
+
710
+        /// <summary>
711
+        /// 获取 Key
712
+        /// </summary>
713
+        /// <param name="redisKey"></param>
714
+        /// <returns></returns>
715
+        //public static IEnumerable<RedisKey> GetKeyList(string redisKey)
716
+        //{
717
+        //    var server = redis.GetServer(Configs.GetValue("Redis_Server"), Configs.GetValue("Redis_Port"));
718
+        //    return server.Keys(pattern: "*"+ redisKey + "*");
719
+        //}
720
+        public static List<string> GetKeyList(string redisKey)
721
+        {
722
+            var server = redis.GetServer(ConfigHelper.GetValue("Redis_Server"), Int32.Parse(ConfigHelper.GetValue("Redis_Port")));
723
+            List<string> keylist = new List<string>();
724
+            var redisenum = server.Keys(pattern: "*" + redisKey + "*");
725
+            foreach (var r in redisenum.ToList())
726
+            {
727
+                keylist.Add(r.ToString());
728
+            }
729
+            return keylist;
730
+        }
731
+
732
+        /// <summary>
733
+        /// 移除指定 Key
734
+        /// </summary>
735
+        /// <param name="redisKey"></param>
736
+        /// <returns></returns>
737
+        public static bool KeyDelete(string redisKey)
738
+        {
739
+            if (KeyExists(redisKey))
740
+                return database.KeyDelete(redisKey);
741
+            else
742
+                return true;
743
+        }
744
+
745
+        /// <summary>
746
+        /// 移除指定 Key
747
+        /// </summary>
748
+        /// <param name="redisKey"></param>
749
+        /// <returns></returns>
750
+        //public static long KeysDelete(IEnumerable<RedisKey> redisKeys)
751
+        //{
752
+        //    return database.KeyDelete(redisKeys.ToArray());
753
+        //}
754
+        public static long KeysDelete(List<string> redisKeys)
755
+        {
756
+            int n = 0;
757
+            foreach (var r in redisKeys)
758
+            {
759
+                if (database.KeyDelete(r))
760
+                {
761
+                    n++;
762
+                }
763
+            }
764
+            return n;
765
+        }
766
+
767
+        /// <summary>
768
+        /// 校验 Key 是否存在
769
+        /// </summary>
770
+        /// <param name="redisKey"></param>
771
+        /// <returns></returns>
772
+        public static bool KeyExists(string redisKey)
773
+        {
774
+            return database.KeyExists(redisKey);
775
+        }
776
+
777
+        /// <summary>
778
+        /// 重命名 Key
779
+        /// </summary>
780
+        /// <param name="redisKey"></param>
781
+        /// <param name="redisNewKey"></param>
782
+        /// <returns></returns>
783
+        public static bool KeyRename(string redisKey, string redisNewKey)
784
+        {
785
+            return database.KeyRename(redisKey, redisNewKey);
786
+        }
787
+
788
+        /// <summary>
789
+        /// 设置 Key 的时间
790
+        /// </summary>
791
+        /// <param name="redisKey"></param>
792
+        /// <param name="expiry"></param>
793
+        /// <returns></returns>
794
+        public static bool KeyExpire(string redisKey, TimeSpan? expiry)
795
+        {
796
+            return database.KeyExpire(redisKey, expiry);
797
+        }
798
+
799
+        #endregion
800
+
801
+        /// <summary>
802
+        /// 获取key过期时间
803
+        /// </summary>
804
+        /// <param name="redisKey"></param>
805
+        /// <returns></returns>
806
+        public static string GetKeyOutTime(string redisKey)
807
+        {
808
+            var server = redis.GetServer(ConfigHelper.GetValue("Redis_Server"), Int32.Parse(ConfigHelper.GetValue("Redis_Port")));
809
+            var timeNow = server.Time().ToUniversalTime();
810
+            var time = database.KeyTimeToLive(redisKey);
811
+            var expire = time == null ? (DateTime?)null : timeNow.Add(time.Value); //返回UTC时间。
812
+            return expire == null ? "" : expire.Value.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
813
+        }
814
+    }
815
+}

+ 90 - 0
RMYY_CallCenter_Api.Utility/Models/AjaxResult.cs

@@ -0,0 +1,90 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace RMYY_CallCenter_Api.Utility
8
+{
9
+
10
+    public class AjaxResult
11
+    {
12
+        /// <summary>
13
+        /// 操作结果类型
14
+        /// </summary>
15
+        public object state { get; set; }
16
+        /// <summary>
17
+        /// 获取 消息内容
18
+        /// </summary>
19
+        public string message { get; set; }
20
+        /// <summary>
21
+        /// 获取 返回数据
22
+        /// </summary>
23
+        public object data { get; set; }
24
+    }
25
+    /// <summary>
26
+    /// 表示 ajax 操作结果类型的枚举
27
+    /// </summary>
28
+    public enum ResultTypes
29
+    {
30
+        /// <summary>
31
+        /// 成功结果类型
32
+        /// </summary>
33
+        success = 200, //请求(或处理)成功,
34
+
35
+        /// <summary>
36
+        /// 成功结果类型
37
+        /// </summary>
38
+        redirect = 302, //跳转,
39
+
40
+        /// <summary>
41
+        /// 警告结果类型
42
+        /// </summary>
43
+        warning = 402,//警告
44
+
45
+        /// <summary>
46
+        /// 未授权
47
+        /// </summary>
48
+        unauthorized = 401,
49
+
50
+
51
+        /// <summary>
52
+        /// 请求参数不完整或不正确
53
+        /// </summary>
54
+        parameterError = 400,
55
+
56
+        /// <summary>
57
+        /// 请求TOKEN失效
58
+        /// </summary>
59
+        tokenInvalid = 403,
60
+
61
+        /// <summary>
62
+        /// HTTP请求类型不合法
63
+        /// </summary>
64
+        httpMehtodError = 405,
65
+
66
+
67
+        /// <summary>
68
+        /// HTTP请求类型不合法
69
+        /// </summary>
70
+        httpRequestError = 406,
71
+
72
+
73
+        /// <summary>
74
+        /// 该URL已经失效
75
+        /// </summary>
76
+        yrlExpireError = 407,
77
+
78
+        /// <summary>
79
+        /// 未登录或登录已过期
80
+        /// </summary>
81
+        notoken = 499,
82
+
83
+        /// <summary>
84
+        /// 异常结果类型
85
+        /// </summary>
86
+        error = 500
87
+
88
+    }
89
+
90
+}

+ 36 - 0
RMYY_CallCenter_Api.Utility/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// 有关程序集的一般信息由以下
6
+// 控制。更改这些特性值可修改
7
+// 与程序集关联的信息。
8
+[assembly: AssemblyTitle("RMYY_CallCenter_Api.Utility")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("RMYY_CallCenter_Api.Utility")]
13
+[assembly: AssemblyCopyright("Copyright ©  2021")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// 将 ComVisible 设置为 false 会使此程序集中的类型
18
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19
+//请将此类型的 ComVisible 特性设置为 true。
20
+[assembly: ComVisible(false)]
21
+
22
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23
+[assembly: Guid("4e6a4fe2-c305-48e6-a1bf-b939b9252e24")]
24
+
25
+// 程序集的版本信息由下列四个值组成: 
26
+//
27
+//      主版本
28
+//      次版本
29
+//      生成号
30
+//      修订号
31
+//
32
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
33
+//通过使用 "*",如下所示:
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 86 - 0
RMYY_CallCenter_Api.Utility/RMYY_CallCenter_Api.Utility.csproj

@@ -0,0 +1,86 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{4E6A4FE2-C305-48E6-A1BF-B939B9252E24}</ProjectGuid>
8
+    <OutputType>Library</OutputType>
9
+    <AppDesignerFolder>Properties</AppDesignerFolder>
10
+    <RootNamespace>RMYY_CallCenter_Api.Utility</RootNamespace>
11
+    <AssemblyName>RMYY_CallCenter_Api.Utility</AssemblyName>
12
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13
+    <FileAlignment>512</FileAlignment>
14
+    <Deterministic>true</Deterministic>
15
+  </PropertyGroup>
16
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17
+    <DebugSymbols>true</DebugSymbols>
18
+    <DebugType>full</DebugType>
19
+    <Optimize>false</Optimize>
20
+    <OutputPath>bin\Debug\</OutputPath>
21
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
22
+    <ErrorReport>prompt</ErrorReport>
23
+    <WarningLevel>4</WarningLevel>
24
+  </PropertyGroup>
25
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26
+    <DebugType>pdbonly</DebugType>
27
+    <Optimize>true</Optimize>
28
+    <OutputPath>bin\Release\</OutputPath>
29
+    <DefineConstants>TRACE</DefineConstants>
30
+    <ErrorReport>prompt</ErrorReport>
31
+    <WarningLevel>4</WarningLevel>
32
+  </PropertyGroup>
33
+  <ItemGroup>
34
+    <Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
35
+      <HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
36
+    </Reference>
37
+    <Reference Include="log4net, Version=2.0.7.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
38
+      <HintPath>..\packages\log4net.2.0.7\lib\net45-full\log4net.dll</HintPath>
39
+    </Reference>
40
+    <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
41
+      <HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
42
+    </Reference>
43
+    <Reference Include="NPOI, Version=2.3.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
44
+      <HintPath>..\packages\NPOI.2.3.0\lib\net40\NPOI.dll</HintPath>
45
+    </Reference>
46
+    <Reference Include="NPOI.OOXML, Version=2.3.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
47
+      <HintPath>..\packages\NPOI.2.3.0\lib\net40\NPOI.OOXML.dll</HintPath>
48
+    </Reference>
49
+    <Reference Include="NPOI.OpenXml4Net, Version=2.3.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
50
+      <HintPath>..\packages\NPOI.2.3.0\lib\net40\NPOI.OpenXml4Net.dll</HintPath>
51
+    </Reference>
52
+    <Reference Include="NPOI.OpenXmlFormats, Version=2.3.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
53
+      <HintPath>..\packages\NPOI.2.3.0\lib\net40\NPOI.OpenXmlFormats.dll</HintPath>
54
+    </Reference>
55
+    <Reference Include="StackExchange.Redis, Version=1.2.6.0, Culture=neutral, processorArchitecture=MSIL">
56
+      <HintPath>..\packages\StackExchange.Redis.1.2.6\lib\net45\StackExchange.Redis.dll</HintPath>
57
+    </Reference>
58
+    <Reference Include="System" />
59
+    <Reference Include="System.Core" />
60
+    <Reference Include="System.IO.Compression" />
61
+    <Reference Include="System.Web" />
62
+    <Reference Include="System.Xml.Linq" />
63
+    <Reference Include="System.Data.DataSetExtensions" />
64
+    <Reference Include="Microsoft.CSharp" />
65
+    <Reference Include="System.Data" />
66
+    <Reference Include="System.Net.Http" />
67
+    <Reference Include="System.Xml" />
68
+  </ItemGroup>
69
+  <ItemGroup>
70
+    <Compile Include="Extention\Object.cs" />
71
+    <Compile Include="Extention\String.cs" />
72
+    <Compile Include="Helper\CacheHelper.cs" />
73
+    <Compile Include="Helper\HttpHelper.cs" />
74
+    <Compile Include="Helper\LogHelper.cs" />
75
+    <Compile Include="Helper\NPOIHelper.cs" />
76
+    <Compile Include="Helper\RedisHelper.cs" />
77
+    <Compile Include="Models\AjaxResult.cs" />
78
+    <Compile Include="Helper\ConfigHelper.cs" />
79
+    <Compile Include="Extention\Json.cs" />
80
+    <Compile Include="Properties\AssemblyInfo.cs" />
81
+  </ItemGroup>
82
+  <ItemGroup>
83
+    <None Include="packages.config" />
84
+  </ItemGroup>
85
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
86
+</Project>

+ 8 - 0
RMYY_CallCenter_Api.Utility/packages.config

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<packages>
3
+  <package id="log4net" version="2.0.7" targetFramework="net45" />
4
+  <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net45" />
5
+  <package id="NPOI" version="2.3.0" targetFramework="net45" />
6
+  <package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
7
+  <package id="StackExchange.Redis" version="1.2.6" targetFramework="net45" />
8
+</packages>

+ 55 - 0
RMYY_CallCenter_Api.sln

@@ -0,0 +1,55 @@
1
+
2
+Microsoft Visual Studio Solution File, Format Version 12.00
3
+# Visual Studio 15
4
+VisualStudioVersion = 15.0.28307.1525
5
+MinimumVisualStudioVersion = 10.0.40219.1
6
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RMYY_CallCenter_Api", "RMYY_CallCenter_Api\RMYY_CallCenter_Api.csproj", "{6AAD6561-5D5C-4C81-8BEA-9A9523179E48}"
7
+EndProject
8
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RMYY_CallCenter_Api.Utility", "RMYY_CallCenter_Api.Utility\RMYY_CallCenter_Api.Utility.csproj", "{4E6A4FE2-C305-48E6-A1BF-B939B9252E24}"
9
+EndProject
10
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RMYY_CallCenter_Api.DB", "RMYY_CallCenter_Api.DB\RMYY_CallCenter_Api.DB.csproj", "{F5E242C5-4F08-45CB-BFE7-E3B304FCCE1F}"
11
+EndProject
12
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RMYY_CallCenter_Api.Model", "RMYY_CallCenter_Api.Model\RMYY_CallCenter_Api.Model.csproj", "{7EAA6ABF-89F4-4EE0-B8D8-DB953EFF3E4C}"
13
+EndProject
14
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RMYY_CallCenter_Api.Dal", "RMYY_CallCenter_Api.Dal\RMYY_CallCenter_Api.Dal.csproj", "{FFB706A9-6108-4A3B-8959-4F81C414C590}"
15
+EndProject
16
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RMYY_CallCenter_Api.Bll", "RMYY_CallCenter_Api.Bll\RMYY_CallCenter_Api.Bll.csproj", "{7CC643A2-983D-4BDF-A9B1-6D169A026B76}"
17
+EndProject
18
+Global
19
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
20
+		Debug|Any CPU = Debug|Any CPU
21
+		Release|Any CPU = Release|Any CPU
22
+	EndGlobalSection
23
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
24
+		{6AAD6561-5D5C-4C81-8BEA-9A9523179E48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25
+		{6AAD6561-5D5C-4C81-8BEA-9A9523179E48}.Debug|Any CPU.Build.0 = Debug|Any CPU
26
+		{6AAD6561-5D5C-4C81-8BEA-9A9523179E48}.Release|Any CPU.ActiveCfg = Release|Any CPU
27
+		{6AAD6561-5D5C-4C81-8BEA-9A9523179E48}.Release|Any CPU.Build.0 = Release|Any CPU
28
+		{4E6A4FE2-C305-48E6-A1BF-B939B9252E24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29
+		{4E6A4FE2-C305-48E6-A1BF-B939B9252E24}.Debug|Any CPU.Build.0 = Debug|Any CPU
30
+		{4E6A4FE2-C305-48E6-A1BF-B939B9252E24}.Release|Any CPU.ActiveCfg = Release|Any CPU
31
+		{4E6A4FE2-C305-48E6-A1BF-B939B9252E24}.Release|Any CPU.Build.0 = Release|Any CPU
32
+		{F5E242C5-4F08-45CB-BFE7-E3B304FCCE1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33
+		{F5E242C5-4F08-45CB-BFE7-E3B304FCCE1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
34
+		{F5E242C5-4F08-45CB-BFE7-E3B304FCCE1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
35
+		{F5E242C5-4F08-45CB-BFE7-E3B304FCCE1F}.Release|Any CPU.Build.0 = Release|Any CPU
36
+		{7EAA6ABF-89F4-4EE0-B8D8-DB953EFF3E4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37
+		{7EAA6ABF-89F4-4EE0-B8D8-DB953EFF3E4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
38
+		{7EAA6ABF-89F4-4EE0-B8D8-DB953EFF3E4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
39
+		{7EAA6ABF-89F4-4EE0-B8D8-DB953EFF3E4C}.Release|Any CPU.Build.0 = Release|Any CPU
40
+		{FFB706A9-6108-4A3B-8959-4F81C414C590}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41
+		{FFB706A9-6108-4A3B-8959-4F81C414C590}.Debug|Any CPU.Build.0 = Debug|Any CPU
42
+		{FFB706A9-6108-4A3B-8959-4F81C414C590}.Release|Any CPU.ActiveCfg = Release|Any CPU
43
+		{FFB706A9-6108-4A3B-8959-4F81C414C590}.Release|Any CPU.Build.0 = Release|Any CPU
44
+		{7CC643A2-983D-4BDF-A9B1-6D169A026B76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45
+		{7CC643A2-983D-4BDF-A9B1-6D169A026B76}.Debug|Any CPU.Build.0 = Debug|Any CPU
46
+		{7CC643A2-983D-4BDF-A9B1-6D169A026B76}.Release|Any CPU.ActiveCfg = Release|Any CPU
47
+		{7CC643A2-983D-4BDF-A9B1-6D169A026B76}.Release|Any CPU.Build.0 = Release|Any CPU
48
+	EndGlobalSection
49
+	GlobalSection(SolutionProperties) = preSolution
50
+		HideSolutionNode = FALSE
51
+	EndGlobalSection
52
+	GlobalSection(ExtensibilityGlobals) = postSolution
53
+		SolutionGuid = {9CB803B0-DA04-42AD-AC91-46EBC1D22EBA}
54
+	EndGlobalSection
55
+EndGlobal

+ 15 - 0
RMYY_CallCenter_Api/App_Start/FilterConfig.cs

@@ -0,0 +1,15 @@
1
+using RMYY_CallCenter_Api.Filter;
2
+using System.Web;
3
+using System.Web.Mvc;
4
+
5
+namespace RMYY_CallCenter_Api
6
+{
7
+    public class FilterConfig
8
+    {
9
+        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
10
+        {
11
+            filters.Add(new AuthorizeFilter());
12
+            filters.Add(new ExceptionFilter());
13
+        }
14
+    }
15
+}

+ 23 - 0
RMYY_CallCenter_Api/App_Start/RouteConfig.cs

@@ -0,0 +1,23 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Web;
5
+using System.Web.Mvc;
6
+using System.Web.Routing;
7
+
8
+namespace RMYY_CallCenter_Api
9
+{
10
+    public class RouteConfig
11
+    {
12
+        public static void RegisterRoutes(RouteCollection routes)
13
+        {
14
+            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15
+
16
+            routes.MapRoute(
17
+                name: "Default",
18
+                url: "{controller}/{action}/{id}",
19
+                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20
+            );
21
+        }
22
+    }
23
+}

+ 129 - 0
RMYY_CallCenter_Api/Configs/log4net.config

@@ -0,0 +1,129 @@
1
+<?xml version="1.0" encoding="utf-8" ?>
2
+<configuration>
3
+  <configSections>
4
+    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
5
+  </configSections>
6
+
7
+  <log4net>
8
+    <!--根配置-->
9
+    <root>
10
+      <!--日志级别:可选值: ERROR > WARN > INFO > DEBUG -->
11
+      <level value="ERROR"/>
12
+      <level value="WARN"/>
13
+      <level value="INFO"/>
14
+      <level value="DEBUG"/>
15
+      <appender-ref ref="ErrorLog" />
16
+      <appender-ref ref="WarnLog" />
17
+      <appender-ref ref="InfoLog" />
18
+      <appender-ref ref="DebugLog" />
19
+    </root>
20
+    <!-- 错误 Error.log-->
21
+    <appender name="ErrorLog" type="log4net.Appender.RollingFileAppender">
22
+      <!--目录路径,可以是相对路径或绝对路径-->
23
+      <param name="File" value="log"/>
24
+      <!--文件名,按日期生成文件夹-->
25
+      <param name="DatePattern" value="/yyyy-MM-dd/&quot;Error.log&quot;"/>
26
+      <!--追加到文件-->
27
+      <appendToFile value="true"/>
28
+      <!--创建日志文件的方式,可选值:Date[日期],文件大小[Size],混合[Composite]-->
29
+      <rollingStyle value="Composite"/>
30
+      <!--写到一个文件-->
31
+      <staticLogFileName value="false"/>
32
+      <!--单个文件大小。单位:KB|MB|GB-->
33
+      <maximumFileSize value="20MB"/>
34
+      <!--最多保留的文件数,设为"-1"则不限-->
35
+      <maxSizeRollBackups value="-1"/>
36
+      <!--日志格式-->
37
+      <layout type="log4net.Layout.PatternLayout">
38
+        <conversionPattern value="记录时间:[%date] %thread -- %-5level -- %logger [%M] %n%message%n%n"/>
39
+      </layout>
40
+      <filter type="log4net.Filter.LevelRangeFilter">
41
+        <param name="LevelMin" value="ERROR" />
42
+        <param name="LevelMax" value="ERROR" />
43
+      </filter>
44
+    </appender>
45
+
46
+    <!-- 警告 Warn.log-->
47
+    <appender name="WarnLog" type="log4net.Appender.RollingFileAppender">
48
+      <!--目录路径,可以是相对路径或绝对路径-->
49
+      <param name="File" value="log"/>
50
+      <!--文件名,按日期生成文件夹-->
51
+      <param name="DatePattern" value="/yyyy-MM-dd/&quot;Warn.log&quot;"/>
52
+      <!--追加到文件-->
53
+      <appendToFile value="true"/>
54
+      <!--创建日志文件的方式,可选值:Date[日期],文件大小[Size],混合[Composite]-->
55
+      <rollingStyle value="Composite"/>
56
+      <!--写到一个文件-->
57
+      <staticLogFileName value="false"/>
58
+      <!--单个文件大小。单位:KB|MB|GB-->
59
+      <maximumFileSize value="20MB"/>
60
+      <!--最多保留的文件数,设为"-1"则不限-->
61
+      <maxSizeRollBackups value="-1"/>
62
+      <!--日志格式-->
63
+      <layout type="log4net.Layout.PatternLayout">
64
+        <conversionPattern value="记录时间:[%date] %thread -- %-5level -- %logger [%M] %n%message%n%n"/>
65
+      </layout>
66
+      <filter type="log4net.Filter.LevelRangeFilter">
67
+        <param name="LevelMin" value="WARN" />
68
+        <param name="LevelMax" value="WARN" />
69
+      </filter>
70
+    </appender>
71
+
72
+    <!-- 信息 Info.log-->
73
+    <appender name="InfoLog" type="log4net.Appender.RollingFileAppender">
74
+      <!--目录路径,可以是相对路径或绝对路径-->
75
+      <param name="File" value="log"/>
76
+      <!--文件名,按日期生成文件夹-->
77
+      <param name="DatePattern" value="/yyyy-MM-dd/&quot;Info.log&quot;"/>
78
+      <!--追加到文件-->
79
+      <appendToFile value="true"/>
80
+      <!--创建日志文件的方式,可选值:Date[日期],文件大小[Size],混合[Composite]-->
81
+      <rollingStyle value="Composite"/>
82
+      <!--写到一个文件-->
83
+      <staticLogFileName value="false"/>
84
+      <!--单个文件大小。单位:KB|MB|GB-->
85
+      <maximumFileSize value="20MB"/>
86
+      <!--最多保留的文件数,设为"-1"则不限-->
87
+      <maxSizeRollBackups value="-1"/>
88
+      <!--日志格式-->
89
+      <layout type="log4net.Layout.PatternLayout">
90
+        <conversionPattern value="记录时间:[%date] %thread -- %-5level -- %logger [%M] %n%message%n%n"/>
91
+      </layout>
92
+      <filter type="log4net.Filter.LevelRangeFilter">
93
+        <param name="LevelMin" value="INFO" />
94
+        <param name="LevelMax" value="INFO" />
95
+      </filter>
96
+    </appender>
97
+
98
+    <!-- 调试 Debug.log-->
99
+    <appender name="DebugLog" type="log4net.Appender.RollingFileAppender">
100
+      <!--目录路径,可以是相对路径或绝对路径-->
101
+      <param name="File" value="log"/>
102
+      <!--文件名,按日期生成文件夹-->
103
+      <param name="DatePattern" value="/yyyy-MM-dd/&quot;Debug.log&quot;"/>
104
+      <!--追加到文件-->
105
+      <appendToFile value="true"/>
106
+      <!--创建日志文件的方式,可选值:Date[日期],文件大小[Size],混合[Composite]-->
107
+      <rollingStyle value="Composite"/>
108
+      <!--写到一个文件-->
109
+      <staticLogFileName value="false"/>
110
+      <!--单个文件大小。单位:KB|MB|GB-->
111
+      <maximumFileSize value="20MB"/>
112
+      <!--最多保留的文件数,设为"-1"则不限-->
113
+      <maxSizeRollBackups value="-1"/>
114
+      <!--日志格式-->
115
+      <layout type="log4net.Layout.PatternLayout">
116
+        <conversionPattern value="记录时间:[%date] %thread -- %-5level -- %logger [%M] %n%message%n%n"/>
117
+      </layout>
118
+      <filter type="log4net.Filter.LevelRangeFilter">
119
+        <param name="LevelMin" value="DEBUG" />
120
+        <param name="LevelMax" value="DEBUG" />
121
+      </filter>
122
+    </appender>
123
+
124
+
125
+  </log4net>
126
+  <startup>
127
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
128
+  </startup>
129
+</configuration>

+ 52 - 0
RMYY_CallCenter_Api/Configs/system.config

@@ -0,0 +1,52 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<appSettings>
3
+  <!-- ================== 1:系统软件参数配置 ================== -->
4
+  <!-- 联系我们 -->
5
+  <add key="Contact" value="www.800100.net" />
6
+  <!-- 软件名称 -->
7
+  <add key="SoftName" value="华谊呼叫中心" />
8
+  <!-- 软件版本 -->
9
+  <add key="Version" value="5.0" />
10
+  <!-- 软件授权码-->
11
+  <add key="LicenceKey" value="" />
12
+  <!-- 是否开启全日志-->
13
+  <add key="IsLog" value="0" />
14
+  <!-- ================== 3:微信配置参数 ================== -->
15
+  <!-- 设置微信appid -->
16
+  <add key="WechatAppid" value="wxe03366d8c63d9b09" />
17
+  <!-- 设置微信appsecret -->
18
+  <add key="WechatAppsecret" value="3e42313935a4d6dc8b450172b8be2765" />
19
+  <!-- 设置微信token -->
20
+  <add key="WechatToken" value="72E4E2C7EC8BBF6AF535F53A213E8EBB" />
21
+  <!-- 设置微信EncodingAESKey -->
22
+  <add key="WechatEncodingAESKey" value="bOs7gmWm6FaqAViH9ZngbfhZS47pvzOucCrGO7tkMlD" />
23
+  <!-- ================== 5:Redis配置 ================== -->
24
+  <add key="Redis_Server" value="192.168.8.20"/>
25
+  <add key="Redis_Port" value="6379"/>
26
+  <!-- ================== 8:外呼前缀配置 ================== -->
27
+  <!--外呼外地前缀-->
28
+  <add key="CallOutWPre" value="0" />
29
+  <!--外呼本地前缀-->
30
+  <add key="CallOutBPre" value="" />
31
+  <!--归属地-->
32
+  <add key="CallOutZipCode" value="0370" />
33
+  <!-- ================== 12:前端API路径配置 ================== -->
34
+  <!--生产环境-->
35
+  <add key="callcenter_url" value="http://192.168.8.13:1001/" />
36
+  <!--ip-->
37
+  <add key="socket_ip" value="192.168.5.7" />
38
+  <!--端口号-->
39
+  <add key="socket_port" value="8081" />
40
+  <!--菜单工单数量刷新间隔-->
41
+  <add key="menuworktime" value="30000" />
42
+  <!--首页报表刷新间隔,格式例如30000*60,务必将格式填写一致-->
43
+  <add key="indextime" value="30000*60" />
44
+  <add key="messageTime" value="60000" />
45
+  <!-- ================== 13:短信配置 ================== -->
46
+  <add key="Smsurl" value="http://rcsapi.wo.cn:8000/umcinterface/sendtempletmsg" />
47
+  <add key="Smscpcode" value="AABJYC" />
48
+  <add key="Smskey" value="724ee6be83d8d6f4d64ef5a537a9985d" />
49
+  <!-- ================== 14:其他配置 ================== -->
50
+  <add key="AuthDate" value="2021-10-12" />
51
+  <add key="OutSignCode" value="$RMYY20210707#" />
52
+</appSettings>

+ 118 - 0
RMYY_CallCenter_Api/Controllers/BaseController.cs

@@ -0,0 +1,118 @@
1
+using RMYY_CallCenter_Api.Models;
2
+using RMYY_CallCenter_Api.Utility;
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Linq;
6
+using System.Web;
7
+using System.Web.Mvc;
8
+
9
+namespace RMYY_CallCenter_Api.Controllers
10
+{
11
+    public class BaseController : Controller
12
+    {
13
+        public new Model.T_Sys_UserAccount User
14
+        {
15
+            get
16
+            {
17
+                try
18
+                {
19
+                    var us = (FormsPrincipal<Model.T_Sys_UserAccount>)base.User;
20
+
21
+                    return us.UserData;
22
+                }
23
+                catch
24
+                {
25
+                    return null;
26
+                }
27
+            }
28
+        }
29
+        /// <summary>
30
+        /// 成功的消息格式化
31
+        /// </summary>
32
+        /// <param name="message"></param>
33
+        /// <returns></returns>
34
+        protected virtual ActionResult Success(string message)
35
+        {
36
+            var jsonMsg = new AjaxResult { state = ResultTypes.success.ToString(), message = message }.ToJson();
37
+            return Content(jsonMsg);
38
+        }
39
+
40
+        /// <summary>
41
+        /// 成功的消息格式化
42
+        /// </summary>
43
+        /// <param name="message"></param>
44
+        /// <param name="data"></param>
45
+        /// <returns></returns>
46
+        protected virtual ActionResult Success(string message, object data)
47
+        {
48
+            var jsonMsg = new AjaxResult { state = ResultTypes.success.ToString(), message = message, data = data }.ToJson();
49
+            return Content(jsonMsg);
50
+        }
51
+
52
+        /// <summary>
53
+        /// 跳转的消息格式化
54
+        /// </summary>
55
+        /// <param name="message"></param>
56
+        /// <param name="data"></param>
57
+        /// <returns></returns>
58
+        protected virtual ActionResult Redirect(string message, object data)
59
+        {
60
+            return Content(new AjaxResult { state = ResultTypes.redirect.ToString(), message = message, data = data }.ToJson());
61
+        }
62
+
63
+        /// <summary>
64
+        /// 错误的消息格式化
65
+        /// </summary>
66
+        /// <param name="message"></param>
67
+        /// <returns></returns>
68
+        protected virtual ActionResult Error(string message)
69
+        {
70
+            var jsonMsg = new AjaxResult { state = ResultTypes.error.ToString(), message = message }.ToJson();
71
+            return Content(jsonMsg);
72
+        }
73
+
74
+        /// <summary>
75
+        /// 错误的消息格式化
76
+        /// </summary>
77
+        /// <param name="message"></param>
78
+        /// <returns></returns>
79
+        protected virtual ActionResult Warn(string message)
80
+        {
81
+            var jsonMsg = new AjaxResult { state = ResultTypes.warning.ToString(), message = message }.ToJson();
82
+            return Content(jsonMsg);
83
+        }
84
+        /// <summary>
85
+        /// 警告的消息格式化
86
+        /// </summary>
87
+        /// <param name="message"></param>
88
+        /// <returns></returns>
89
+        protected virtual ActionResult Warn(string message, object data)
90
+        {
91
+            var jsonMsg = new AjaxResult { state = ResultTypes.warning.ToString(), message = message, data = data }.ToJson();
92
+            return Content(jsonMsg);
93
+        }
94
+
95
+
96
+        /// <summary>
97
+        /// 未登录或者登录已过期
98
+        /// </summary>
99
+        /// <param name="message"></param>
100
+        /// <returns></returns>
101
+        protected virtual ActionResult NoToken(string message)
102
+        {
103
+            var jsonMsg = new AjaxResult { state = ResultTypes.notoken.ToString(), message = message }.ToJson();
104
+            return Content(jsonMsg);
105
+        }
106
+
107
+        /// <summary>
108
+        /// 未授权
109
+        /// </summary>
110
+        /// <param name="message"></param>
111
+        /// <returns></returns>
112
+        protected virtual ActionResult UnAuthorized(string message)
113
+        {
114
+            var jsonMsg = new AjaxResult { state = ResultTypes.unauthorized.ToString(), message = message }.ToJson();
115
+            return Content(jsonMsg);
116
+        }
117
+    }
118
+}

+ 57 - 0
RMYY_CallCenter_Api/Controllers/HomeController.cs

@@ -0,0 +1,57 @@
1
+using RMYY_CallCenter_Api.DB;
2
+using RMYY_CallCenter_Api.Models;
3
+using RMYY_CallCenter_Api.Utility;
4
+using System;
5
+using System.Collections.Generic;
6
+using System.Data;
7
+using System.Linq;
8
+using System.Web;
9
+using System.Web.Mvc;
10
+
11
+namespace RMYY_CallCenter_Api.Controllers
12
+{
13
+    [AllowAnonymous]
14
+    public class HomeController : BaseController
15
+    {
16
+        public ActionResult Index()
17
+        {
18
+            return Content("hello world!");
19
+        }
20
+
21
+        /// <summary>
22
+        /// 登录
23
+        /// </summary>
24
+        /// <param name="usercode"></param>
25
+        /// <param name="password"></param>
26
+        /// <returns></returns>
27
+        [HttpPost]
28
+        public ActionResult Login(string usercode,string password)
29
+        {
30
+            Dictionary<string, string> paras = new Dictionary<string, string>();
31
+            string sql = " select * from T_Sys_UserAccount where F_UserCode=@F_UserCode and F_PassWord=@F_PassWord";
32
+            paras.Add("@F_UserCode", usercode);
33
+            paras.Add("@F_PassWord", password.ToMD5String());
34
+            var dt = DbHelperSQL.Query(sql, paras).Tables[0];
35
+            if (dt != null && dt.Rows.Count > 0)
36
+            {
37
+                var dr = dt.Rows[0];
38
+                if (dr["F_DeleteFlag"] != null && dr["F_DeleteFlag"].ToString() == "1")
39
+                {
40
+                    return Error("此账号已经被禁用");
41
+                }
42
+
43
+                Dictionary<string, string> Dic = new Dictionary<string, string>();
44
+                Dic.Add("F_UserCode", dt.Rows[0]["F_UserCode"].ToString());
45
+                Dic.Add("F_RoleCode", dt.Rows[0]["F_RoleCode"].ToString());
46
+                Dic.Add("F_DeptCode", dt.Rows[0]["F_DeptCode"].ToString());
47
+
48
+                var token = FormsPrincipal<Dictionary<string, string>>.GetCookieValue(Dic["F_UserCode"], Dic);
49
+                return Success("登录成功", token);
50
+            }
51
+            else
52
+            {
53
+                return Error("账号或密码错误");
54
+            }
55
+        }
56
+    }
57
+}

+ 99 - 0
RMYY_CallCenter_Api/Controllers/System/UserAccountController.cs

@@ -0,0 +1,99 @@
1
+using RMYY_CallCenter_Api.Utility;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Data;
5
+using System.Linq;
6
+using System.Web;
7
+using System.Web.Mvc;
8
+
9
+namespace RMYY_CallCenter_Api.Controllers.System
10
+{
11
+    public class UserAccountController : BaseController
12
+    {
13
+        // GET: UserAccount
14
+        //用户列表
15
+        [HttpPost]
16
+        public ActionResult GetList()
17
+        {
18
+            DataTable dt = new DataTable();
19
+            string sql = string.Empty;
20
+
21
+            string rolecode = Request.Params["rolecode"];
22
+            string deptcode = Request.Params["deptcode"];
23
+            string key = Request.Params["key"];
24
+
25
+            string strpageindex = Request.Params["page"];
26
+            int pageindex = 1;
27
+            string strpagesize = Request.Params["pagesize"];
28
+            int pagesize = 10;
29
+
30
+            if (!string.IsNullOrWhiteSpace(deptcode))
31
+            {
32
+                sql += " and F_DeptCode='" + deptcode + "'";
33
+            }
34
+            if (!string.IsNullOrWhiteSpace(rolecode))
35
+            {
36
+                sql += " and F_RoleCode='" + rolecode + "'";
37
+            }
38
+
39
+            if (!string.IsNullOrWhiteSpace(key))
40
+            {
41
+                sql += " and (F_UserCode like '%{0}%' or F_UserName like '%{1}%')";
42
+            }
43
+
44
+            if (!string.IsNullOrWhiteSpace(strpageindex))
45
+            {
46
+                pageindex = Convert.ToInt32(strpageindex);
47
+            }
48
+
49
+            if (!string.IsNullOrWhiteSpace(strpagesize))
50
+            {
51
+                pagesize = Convert.ToInt32(strpagesize);
52
+            }
53
+
54
+            int recordCount = 0;
55
+            dt = Bll.PagerBll.GetListPager(
56
+                                    "T_Sys_UserAccount",
57
+                                    "F_UserId",
58
+                                    "*",
59
+                                    sql,
60
+                                    "ORDER BY F_UserId desc",
61
+                                    pagesize,
62
+                                    pageindex,
63
+                                    true,
64
+                                    out recordCount);
65
+            var obj = new
66
+            {
67
+                rows = dt,
68
+                total = recordCount
69
+            };
70
+
71
+            return Content(obj.ToJson());
72
+        }
73
+
74
+        /// <summary>
75
+        /// 获取用户信息
76
+        /// </summary>
77
+        /// <param name="userId"></param>
78
+        /// <param name="userCode"></param>
79
+        /// <returns></returns>
80
+        public ActionResult GetUser(int userId = 0, string userCode = "")
81
+        {
82
+            string sql = " 1=1 ";
83
+            if (userId > 0)
84
+            {
85
+                sql += " and F_UserId=" + userId;
86
+            }
87
+            if (!string.IsNullOrWhiteSpace(userCode))
88
+            {
89
+                sql += " and F_UserCode='" + userCode + "'";
90
+            }
91
+            if (string.IsNullOrWhiteSpace(sql))
92
+                return Error("获取失败");
93
+
94
+            Model.T_Sys_UserAccount User = new Bll.T_Sys_UserAccount().GetModelList(sql).FirstOrDefault();
95
+
96
+            return Success("获取成功", User);
97
+        }
98
+    }
99
+}

+ 76 - 0
RMYY_CallCenter_Api/Filter/AuthorizeFilter.cs

@@ -0,0 +1,76 @@
1
+using RMYY_CallCenter_Api.Models;
2
+using RMYY_CallCenter_Api.Utility;
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Linq;
6
+using System.Web;
7
+using System.Web.Mvc;
8
+using System.Web.Security;
9
+
10
+namespace RMYY_CallCenter_Api.Filter
11
+{
12
+    public class AuthorizeFilter : AuthorizeAttribute
13
+    {
14
+        /// <summary>
15
+        /// 权限验证
16
+        /// </summary>
17
+        /// <param name="filterContext"></param>
18
+        public override void OnAuthorization(AuthorizationContext filterContext)
19
+        {
20
+            if (filterContext.ActionDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true)
21
+                || filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true))
22
+            {
23
+                return;
24
+            }
25
+
26
+            var context = filterContext.RequestContext.HttpContext;
27
+            var token = context.Request["token"];
28
+            if (!string.IsNullOrEmpty(token))
29
+            {
30
+                try
31
+                {
32
+                    bool isAuth = false;
33
+                    //获取FormsAuthenticationTicket对象
34
+                    FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(token);
35
+                    if (ticket != null && !ticket.Expired && !string.IsNullOrEmpty(ticket.UserData))
36
+                    {
37
+                        Dictionary<string, string> userData = ticket.UserData.ToObject<Dictionary<string, string>>();
38
+                        if (userData != null)
39
+                        {
40
+                            var user = new Bll.T_Sys_UserAccount().GetModel(userData["F_UserCode"]);
41
+                            if (user != null && user.F_RoleCode == userData["F_RoleCode"])
42
+                            {
43
+                                isAuth = true;
44
+                                context.User = new FormsPrincipal<Model.T_Sys_UserAccount>(ticket, user);//重新给context.User赋值。
45
+                            }
46
+                        }
47
+                    }
48
+                    if (!isAuth)
49
+                    {
50
+                        context.Response.StatusCode = 200;
51
+                        filterContext.Result = new ContentResult { Content = new AjaxResult { state = ResultTypes.notoken.ToString(), message = "token无效或过期,请重新登录。" }.ToJson() };
52
+                        return;
53
+                    }
54
+                }
55
+                catch (Exception ex)
56
+                {
57
+                    LogHelper.Error("验证失败", ex);
58
+                    context.Response.StatusCode = 200;
59
+                    filterContext.Result = new ContentResult { Content = new AjaxResult { state = ResultTypes.notoken.ToString(), message = "token无效或过期,请重新登录。" }.ToJson() };
60
+                    return;
61
+                }
62
+            }
63
+            else
64
+            {
65
+                context.Response.StatusCode = 200;
66
+                filterContext.Result = new ContentResult { Content = new AjaxResult { state = ResultTypes.notoken.ToString(), message = "未传入token,请重新登录。" }.ToJson() };
67
+                return;
68
+            }
69
+
70
+            if (filterContext != null)
71
+            {
72
+                base.OnAuthorization(filterContext);
73
+            }
74
+        }
75
+    }
76
+}

+ 35 - 0
RMYY_CallCenter_Api/Filter/ExceptionFilter.cs

@@ -0,0 +1,35 @@
1
+using RMYY_CallCenter_Api.Utility;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Linq;
5
+using System.Web;
6
+using System.Web.Mvc;
7
+
8
+namespace RMYY_CallCenter_Api.Filter
9
+{
10
+    public class ExceptionFilter : HandleErrorAttribute
11
+    {
12
+        public override void OnException(ExceptionContext context)
13
+        {
14
+            base.OnException(context);
15
+
16
+            var rt = context.RequestContext.HttpContext.Request;
17
+            Dictionary<string, string> Params = new Dictionary<string, string>();
18
+            Params.Add("request_url", rt.Url.ToString());
19
+
20
+            foreach (var key in rt.Params.AllKeys)
21
+            {
22
+                if (key == "ALL_HTTP")
23
+                {
24
+                    break;
25
+                }
26
+                Params.Add(key, rt.Params[key]);
27
+            }
28
+
29
+            LogHelper.Error("系统异常,参数:" + Params.ToJson(), context.Exception);
30
+            context.ExceptionHandled = true;
31
+            context.HttpContext.Response.StatusCode = 200;
32
+            context.Result = new ContentResult { Content = new AjaxResult { state = ResultTypes.error.ToString(), message = context.Exception.ToString() }.ToJson() };
33
+        }
34
+    }
35
+}

+ 1 - 0
RMYY_CallCenter_Api/Global.asax

@@ -0,0 +1 @@
1
+<%@ Application Codebehind="Global.asax.cs" Inherits="RMYY_CallCenter_Api.MvcApplication" Language="C#" %>

+ 45 - 0
RMYY_CallCenter_Api/Global.asax.cs

@@ -0,0 +1,45 @@
1
+using RMYY_CallCenter_Api.Utility;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Linq;
5
+using System.Web;
6
+using System.Web.Mvc;
7
+using System.Web.Optimization;
8
+using System.Web.Routing;
9
+
10
+namespace RMYY_CallCenter_Api
11
+{
12
+    public class MvcApplication : System.Web.HttpApplication
13
+    {
14
+        protected void Application_Start()
15
+        {
16
+            AreaRegistration.RegisterAllAreas();
17
+            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
18
+            RouteConfig.RegisterRoutes(RouteTable.Routes);
19
+        }
20
+
21
+        protected void Application_AuthenticateRequest(object sender, EventArgs e)
22
+        {
23
+            HttpApplication app = (HttpApplication)sender;
24
+            var context = app.Context;
25
+            if (context == null) throw new ArgumentNullException("context");
26
+
27
+            Dictionary<string, string> Params = new Dictionary<string, string>();
28
+            Params.Add("request_url", context.Request.Url.ToString());
29
+
30
+            foreach (var key in context.Request.Params.AllKeys)
31
+            {
32
+                if (key == "ALL_HTTP")
33
+                {
34
+                    break;
35
+                }
36
+                Params.Add(key, context.Request.Params[key]);
37
+            }
38
+
39
+            if (ConfigHelper.GetValue("IsLog").ToString() == "1")
40
+            {
41
+                LogHelper.Debug(Params.ToJson());
42
+            }
43
+        }
44
+    }
45
+}

+ 77 - 0
RMYY_CallCenter_Api/Models/FormsPrincipal.cs

@@ -0,0 +1,77 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Security.Principal;
5
+using System.Web;
6
+using System.Web.Script.Serialization;
7
+using System.Web.Security;
8
+
9
+namespace RMYY_CallCenter_Api.Models
10
+{
11
+    public class FormsPrincipal<TUserData> : IPrincipal
12
+       where TUserData : class, new()
13
+    {
14
+        private IIdentity _identity;
15
+        private TUserData _userData;
16
+
17
+        public FormsPrincipal(FormsAuthenticationTicket ticket, TUserData userData)
18
+        {
19
+            if (ticket == null)
20
+                throw new ArgumentNullException("ticket");
21
+            if (userData == null)
22
+                throw new ArgumentNullException("userData");
23
+
24
+            _identity = new FormsIdentity(ticket);
25
+            _userData = userData;
26
+        }
27
+
28
+        public TUserData UserData
29
+        {
30
+            get { return _userData; }
31
+        }
32
+
33
+        public IIdentity Identity
34
+        {
35
+            get { return _identity; }
36
+        }
37
+
38
+        public bool IsInRole(string role)
39
+        {
40
+            // 把判断用户组的操作留给UserData去实现。
41
+
42
+            IPrincipal principal = _userData as IPrincipal;
43
+            if (principal == null)
44
+                throw new NotImplementedException();
45
+            else
46
+                return principal.IsInRole(role);
47
+        }
48
+
49
+        /// <summary>
50
+        /// 执行用户登录操作
51
+        /// </summary>
52
+        /// <param name="loginName">登录名</param>
53
+        /// <param name="userData">与登录名相关的用户信息</param>
54
+        /// <param name="expiration">登录Cookie的过期时间,单位:分钟。</param>
55
+        public static string GetCookieValue(string loginName, TUserData userData)
56
+        {
57
+            if (string.IsNullOrEmpty(loginName))
58
+                throw new ArgumentNullException("loginName");
59
+            if (userData == null)
60
+                throw new ArgumentNullException("userData");
61
+
62
+            // 1. 把需要保存的用户数据转成一个字符串。
63
+            string data = null;
64
+            if (userData != null)
65
+                data = (new JavaScriptSerializer()).Serialize(userData);
66
+
67
+
68
+            // 2. 创建一个FormsAuthenticationTicket,它包含登录名以及额外的用户数据。
69
+            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
70
+                2, loginName, DateTime.Now, DateTime.Now.AddDays(8), true, data);
71
+
72
+
73
+            // 3. 加密Ticket,变成一个加密的字符串。
74
+            return FormsAuthentication.Encrypt(ticket);
75
+        }
76
+    }
77
+}

+ 35 - 0
RMYY_CallCenter_Api/Properties/AssemblyInfo.cs

@@ -0,0 +1,35 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// 有关程序集的常规信息是通过以下项进行控制的
6
+// 控制。更改这些特性值可修改
7
+// 与程序集关联的信息。
8
+[assembly: AssemblyTitle("RMYY_CallCenter_Api")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("RMYY_CallCenter_Api")]
13
+[assembly: AssemblyCopyright("版权所有(C)  2021")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// 将 ComVisible 设置为 false 将使此程序集中的类型
18
+// 对 COM 组件不可见。如果需要
19
+// 从 COM 访问此程序集中的某个类型,请针对该类型将 ComVisible 特性设置为 true。
20
+[assembly: ComVisible(false)]
21
+
22
+// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID
23
+[assembly: Guid("82335da9-71d1-417c-a963-19efec72da15")]
24
+
25
+// 程序集的版本信息由下列四个值组成:
26
+//
27
+//      主版本
28
+//      次版本
29
+//      内部版本号
30
+//      修订版本
31
+//
32
+// 你可以指定所有值,也可以让修订版本和内部版本号采用默认值,
33
+// 方法是按如下所示使用 "*":
34
+[assembly: AssemblyVersion("1.0.0.0")]
35
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 210 - 0
RMYY_CallCenter_Api/RMYY_CallCenter_Api.csproj

@@ -0,0 +1,210 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
4
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
5
+  <PropertyGroup>
6
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8
+    <ProductVersion>
9
+    </ProductVersion>
10
+    <SchemaVersion>2.0</SchemaVersion>
11
+    <ProjectGuid>{6AAD6561-5D5C-4C81-8BEA-9A9523179E48}</ProjectGuid>
12
+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
13
+    <OutputType>Library</OutputType>
14
+    <AppDesignerFolder>Properties</AppDesignerFolder>
15
+    <RootNamespace>RMYY_CallCenter_Api</RootNamespace>
16
+    <AssemblyName>RMYY_CallCenter_Api</AssemblyName>
17
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
18
+    <MvcBuildViews>false</MvcBuildViews>
19
+    <UseIISExpress>true</UseIISExpress>
20
+    <Use64BitIISExpress />
21
+    <IISExpressSSLPort />
22
+    <IISExpressAnonymousAuthentication />
23
+    <IISExpressWindowsAuthentication />
24
+    <IISExpressUseClassicPipelineMode />
25
+    <UseGlobalApplicationHostFile />
26
+    <NuGetPackageImportStamp>
27
+    </NuGetPackageImportStamp>
28
+  </PropertyGroup>
29
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
30
+    <DebugSymbols>true</DebugSymbols>
31
+    <DebugType>full</DebugType>
32
+    <Optimize>false</Optimize>
33
+    <OutputPath>bin\</OutputPath>
34
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
35
+    <ErrorReport>prompt</ErrorReport>
36
+    <WarningLevel>4</WarningLevel>
37
+  </PropertyGroup>
38
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
39
+    <DebugSymbols>true</DebugSymbols>
40
+    <DebugType>pdbonly</DebugType>
41
+    <Optimize>true</Optimize>
42
+    <OutputPath>bin\</OutputPath>
43
+    <DefineConstants>TRACE</DefineConstants>
44
+    <ErrorReport>prompt</ErrorReport>
45
+    <WarningLevel>4</WarningLevel>
46
+  </PropertyGroup>
47
+  <ItemGroup>
48
+    <Reference Include="Microsoft.CSharp" />
49
+    <Reference Include="System" />
50
+    <Reference Include="System.Data" />
51
+    <Reference Include="System.Drawing" />
52
+    <Reference Include="System.Web.DynamicData" />
53
+    <Reference Include="System.Web.Entity" />
54
+    <Reference Include="System.Web.ApplicationServices" />
55
+    <Reference Include="System.ComponentModel.DataAnnotations" />
56
+    <Reference Include="System.Core" />
57
+    <Reference Include="System.Data.DataSetExtensions" />
58
+    <Reference Include="System.Xml.Linq" />
59
+    <Reference Include="System.Web" />
60
+    <Reference Include="System.Web.Extensions" />
61
+    <Reference Include="System.Web.Abstractions" />
62
+    <Reference Include="System.Web.Routing" />
63
+    <Reference Include="System.Xml" />
64
+    <Reference Include="System.Configuration" />
65
+    <Reference Include="System.Web.Services" />
66
+    <Reference Include="System.EnterpriseServices" />
67
+    <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68
+      <Private>True</Private>
69
+      <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
70
+    </Reference>
71
+    <Reference Include="System.Net.Http">
72
+    </Reference>
73
+    <Reference Include="System.Net.Http.WebRequest">
74
+    </Reference>
75
+    <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
76
+      <Private>True</Private>
77
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.Helpers.dll</HintPath>
78
+    </Reference>
79
+    <Reference Include="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
80
+      <Private>True</Private>
81
+      <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.4\lib\net45\System.Web.Mvc.dll</HintPath>
82
+    </Reference>
83
+    <Reference Include="System.Web.Optimization">
84
+      <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
85
+    </Reference>
86
+    <Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
87
+      <Private>True</Private>
88
+      <HintPath>..\packages\Microsoft.AspNet.Razor.3.2.4\lib\net45\System.Web.Razor.dll</HintPath>
89
+    </Reference>
90
+    <Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
91
+      <Private>True</Private>
92
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.WebPages.dll</HintPath>
93
+    </Reference>
94
+    <Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
95
+      <Private>True</Private>
96
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
97
+    </Reference>
98
+    <Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
99
+      <Private>True</Private>
100
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
101
+    </Reference>
102
+    <Reference Include="Newtonsoft.Json">
103
+      <HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
104
+    </Reference>
105
+    <Reference Include="WebGrease">
106
+      <Private>True</Private>
107
+      <HintPath>..\packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
108
+    </Reference>
109
+    <Reference Include="Antlr3.Runtime">
110
+      <Private>True</Private>
111
+      <HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
112
+    </Reference>
113
+  </ItemGroup>
114
+  <ItemGroup>
115
+    <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform">
116
+      <HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
117
+    </Reference>
118
+  </ItemGroup>
119
+  <ItemGroup>
120
+    <Compile Include="App_Start\FilterConfig.cs" />
121
+    <Compile Include="App_Start\RouteConfig.cs" />
122
+    <Compile Include="Controllers\BaseController.cs" />
123
+    <Compile Include="Controllers\HomeController.cs" />
124
+    <Compile Include="Controllers\System\UserAccountController.cs" />
125
+    <Compile Include="Filter\AuthorizeFilter.cs" />
126
+    <Compile Include="Filter\ExceptionFilter.cs" />
127
+    <Compile Include="Global.asax.cs">
128
+      <DependentUpon>Global.asax</DependentUpon>
129
+    </Compile>
130
+    <Compile Include="Models\FormsPrincipal.cs" />
131
+    <Compile Include="Properties\AssemblyInfo.cs" />
132
+  </ItemGroup>
133
+  <ItemGroup>
134
+    <Content Include="Global.asax" />
135
+    <Content Include="Web.config" />
136
+    <Content Include="Web.Debug.config">
137
+      <DependentUpon>Web.config</DependentUpon>
138
+    </Content>
139
+    <Content Include="Web.Release.config">
140
+      <DependentUpon>Web.config</DependentUpon>
141
+    </Content>
142
+  </ItemGroup>
143
+  <ItemGroup>
144
+    <Folder Include="App_Data\" />
145
+    <Folder Include="Views\UserAccount\" />
146
+  </ItemGroup>
147
+  <ItemGroup>
148
+    <Content Include="Configs\log4net.config" />
149
+    <Content Include="Configs\system.config" />
150
+    <None Include="packages.config" />
151
+  </ItemGroup>
152
+  <ItemGroup>
153
+    <ProjectReference Include="..\RMYY_CallCenter_Api.Bll\RMYY_CallCenter_Api.Bll.csproj">
154
+      <Project>{7cc643a2-983d-4bdf-a9b1-6d169a026b76}</Project>
155
+      <Name>RMYY_CallCenter_Api.Bll</Name>
156
+    </ProjectReference>
157
+    <ProjectReference Include="..\RMYY_CallCenter_Api.DB\RMYY_CallCenter_Api.DB.csproj">
158
+      <Project>{F5E242C5-4F08-45CB-BFE7-E3B304FCCE1F}</Project>
159
+      <Name>RMYY_CallCenter_Api.DB</Name>
160
+    </ProjectReference>
161
+    <ProjectReference Include="..\RMYY_CallCenter_Api.Model\RMYY_CallCenter_Api.Model.csproj">
162
+      <Project>{7eaa6abf-89f4-4ee0-b8d8-db953eff3e4c}</Project>
163
+      <Name>RMYY_CallCenter_Api.Model</Name>
164
+    </ProjectReference>
165
+    <ProjectReference Include="..\RMYY_CallCenter_Api.Utility\RMYY_CallCenter_Api.Utility.csproj">
166
+      <Project>{4E6A4FE2-C305-48E6-A1BF-B939B9252E24}</Project>
167
+      <Name>RMYY_CallCenter_Api.Utility</Name>
168
+    </ProjectReference>
169
+  </ItemGroup>
170
+  <PropertyGroup>
171
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
172
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
173
+  </PropertyGroup>
174
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
175
+  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
176
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
177
+  <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
178
+    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
179
+  </Target>
180
+  <ProjectExtensions>
181
+    <VisualStudio>
182
+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
183
+        <WebProjectProperties>
184
+          <UseIIS>True</UseIIS>
185
+          <AutoAssignPort>True</AutoAssignPort>
186
+          <DevelopmentServerPort>50973</DevelopmentServerPort>
187
+          <DevelopmentServerVPath>/</DevelopmentServerVPath>
188
+          <IISUrl>http://localhost:50973/</IISUrl>
189
+          <NTLMAuthentication>False</NTLMAuthentication>
190
+          <UseCustomServer>False</UseCustomServer>
191
+          <CustomServerUrl>
192
+          </CustomServerUrl>
193
+          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
194
+        </WebProjectProperties>
195
+      </FlavorProperties>
196
+    </VisualStudio>
197
+  </ProjectExtensions>
198
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
199
+    <PropertyGroup>
200
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
201
+    </PropertyGroup>
202
+    <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
203
+  </Target>
204
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
205
+       Other similar extension points exist, see Microsoft.Common.targets.
206
+  <Target Name="BeforeBuild">
207
+  </Target>
208
+  <Target Name="AfterBuild">
209
+  </Target> -->
210
+</Project>

+ 30 - 0
RMYY_CallCenter_Api/Web.Debug.config

@@ -0,0 +1,30 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<!-- 有关使用 Web.config 转换的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkId=301874 -->
4
+
5
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
6
+  <!--
7
+    在下例中,“SetAttributes”转换将更改
8
+    “connectionString”的值,仅在“Match”定位器找到值为“MyDB”的
9
+    特性“name”时使用“ReleaseSQLServer”。
10
+
11
+    <connectionStrings>
12
+      <add name="MyDB"
13
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
14
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
15
+    </connectionStrings>
16
+  -->
17
+  <system.web>
18
+    <!--
19
+      在以下示例中,"Replace" 转换将替换 Web.config 文件的
20
+      整个 <customErrors> 节。
21
+      请注意,由于在 <system.web> 节点下只有一个
22
+       customErrors 节,因此无需使用 "xdt:Locator" 属性。
23
+
24
+      <customErrors defaultRedirect="GenericError.htm"
25
+        mode="RemoteOnly" xdt:Transform="Replace">
26
+        <error statusCode="500" redirect="InternalError.htm"/>
27
+      </customErrors>
28
+    -->
29
+  </system.web>
30
+</configuration>

+ 31 - 0
RMYY_CallCenter_Api/Web.Release.config

@@ -0,0 +1,31 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<!-- 有关使用 Web.config 转换的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkId=301874 -->
4
+
5
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
6
+  <!--
7
+    在下例中,“SetAttributes”转换将更改
8
+    “connectionString”的值,仅在“Match”定位器找到值为“MyDB”的
9
+    特性“name”时使用“ReleaseSQLServer”。
10
+
11
+    <connectionStrings>
12
+      <add name="MyDB"
13
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
14
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
15
+    </connectionStrings>
16
+  -->
17
+  <system.web>
18
+    <compilation xdt:Transform="RemoveAttributes(debug)" />
19
+    <!--
20
+      在以下示例中,"Replace" 转换将替换 Web.config 文件的
21
+      整个 <customErrors> 节。
22
+      请注意,由于在 <system.web> 节点下只有一个
23
+       customErrors 节,因此无需使用 "xdt:Locator" 属性。
24
+
25
+      <customErrors defaultRedirect="GenericError.htm"
26
+        mode="RemoteOnly" xdt:Transform="Replace">
27
+        <error statusCode="500" redirect="InternalError.htm"/>
28
+      </customErrors>
29
+    -->
30
+  </system.web>
31
+</configuration>

+ 77 - 0
RMYY_CallCenter_Api/Web.config

@@ -0,0 +1,77 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!--
3
+  有关如何配置 ASP.NET 应用程序的详细信息,请访问
4
+  https://go.microsoft.com/fwlink/?LinkId=301880
5
+  -->
6
+<configuration>
7
+  <appSettings>
8
+    <add key="webpages:Version" value="3.0.0.0"/>
9
+    <add key="webpages:Enabled" value="false"/>
10
+    <add key="ClientValidationEnabled" value="true"/>
11
+    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
12
+  </appSettings>
13
+  <connectionStrings>
14
+    <add name="ConnectionString" connectionString="Data Source=192.168.1.37;User ID=sa;pwd=hykj@800100;Initial Catalog=RMYY_CallCenter;"/>
15
+  </connectionStrings>
16
+  <system.web>
17
+    <compilation debug="true" targetFramework="4.5"/>
18
+    <httpRuntime targetFramework="4.5"/>
19
+  </system.web>
20
+  <system.webServer>
21
+    <staticContent>
22
+      <mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive" />
23
+    </staticContent>
24
+    <!--cors 支持跨域 clq新增 strat-->
25
+    <httpProtocol>
26
+      <customHeaders>
27
+        <add name="Access-Control-Allow-Origin" value="*" />
28
+        <add name="Access-Control-Allow-Headers" value="Content-Type" />
29
+        <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
30
+      </customHeaders>
31
+    </httpProtocol>
32
+    <!--cors 支持跨域 end-->
33
+    <validation validateIntegratedModeConfiguration="false"/>
34
+  </system.webServer>
35
+  <runtime>
36
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
37
+      <dependentAssembly>
38
+        <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f"/>
39
+        <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
40
+      </dependentAssembly>
41
+      <dependentAssembly>
42
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"/>
43
+        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/>
44
+      </dependentAssembly>
45
+      <dependentAssembly>
46
+        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/>
47
+        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
48
+      </dependentAssembly>
49
+      <dependentAssembly>
50
+        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
51
+        <bindingRedirect oldVersion="1.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
52
+      </dependentAssembly>
53
+      <dependentAssembly>
54
+        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
55
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
56
+      </dependentAssembly>
57
+      <dependentAssembly>
58
+        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
59
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
60
+      </dependentAssembly>
61
+      <dependentAssembly>
62
+        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
63
+        <bindingRedirect oldVersion="1.0.0.0-5.2.4.0" newVersion="5.2.4.0"/>
64
+      </dependentAssembly>
65
+    </assemblyBinding>
66
+  </runtime>
67
+  <system.codedom>
68
+    <compilers>
69
+      <compiler language="c#;cs;csharp" extension=".cs"
70
+        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
71
+        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
72
+      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
73
+        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
74
+        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
75
+    </compilers>
76
+  </system.codedom>
77
+</configuration>

+ 18 - 0
RMYY_CallCenter_Api/packages.config

@@ -0,0 +1,18 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<packages>
3
+  <package id="Antlr" version="3.5.0.2" targetFramework="net45" />
4
+  <package id="Microsoft.AspNet.Mvc" version="5.2.4" targetFramework="net45" />
5
+  <package id="Microsoft.AspNet.Mvc.zh-Hans" version="5.2.4" targetFramework="net45" />
6
+  <package id="Microsoft.AspNet.Razor" version="3.2.4" targetFramework="net45" />
7
+  <package id="Microsoft.AspNet.Razor.zh-Hans" version="3.2.4" targetFramework="net45" />
8
+  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
9
+  <package id="Microsoft.AspNet.Web.Optimization.zh-Hans" version="1.1.3" targetFramework="net45" />
10
+  <package id="Microsoft.AspNet.WebPages" version="3.2.4" targetFramework="net45" />
11
+  <package id="Microsoft.AspNet.WebPages.zh-Hans" version="3.2.4" targetFramework="net45" />
12
+  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net45" />
13
+  <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.4" targetFramework="net45" />
14
+  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
15
+  <package id="Modernizr" version="2.8.3" targetFramework="net45" />
16
+  <package id="Newtonsoft.Json" version="11.0.1" targetFramework="net45" />
17
+  <package id="WebGrease" version="1.6.0" targetFramework="net45" />
18
+</packages>