Browse Source

zhao:增加DAL

ZhangXueYang
耀 4 years ago
parent
commit
cdfc7aabb7

+ 72
- 0
XHZB.DAL/Class1.cs View File

@@ -0,0 +1,72 @@
1
+using Common.system;
2
+
3
+using Newtonsoft.Json.Linq;
4
+
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading;
10
+using System.Threading.Tasks;
11
+
12
+namespace XHZB.DAL
13
+{
14
+    public class Class1
15
+    {
16
+        /// <summary>
17
+        /// API请求地址
18
+        /// </summary>
19
+        private string APIRequestAddress = FileToolsCommon.GetConfigValue("APIRequestAddress");
20
+        /// <summary>
21
+        /// 文件请求地址
22
+        /// </summary>
23
+        private string FileRequestAddress = FileToolsCommon.GetConfigValue("FileRequestAddress");
24
+        /// <summary>
25
+        /// 测试
26
+        /// </summary>
27
+        /// <param name="Message"></param>
28
+        /// <returns></returns>
29
+        public bool test( string FileCode, out string Message)
30
+        {
31
+
32
+            Exception ex = null;
33
+            Message = "";//请求重试5次 共5秒
34
+            for (int num = 0; num < 5; num++)
35
+            {
36
+                try
37
+                {
38
+                    JObject jo = HttpHelper.PostFunction(FileRequestAddress + @"/chunkdb/mergechunk", @"application/x-www-form-urlencoded", @"identifier=" + FileCode, "");
39
+                    if (jo == null)
40
+                    {
41
+                        Message = "无法访问文件服务器,请检查网络或文件服务器地址。";
42
+                        return false;
43
+                    }
44
+                    //Model.ResultVo<Model_ResourceAddTwo> resultObj = JsonHelper.JsonToObj<Model.ResultVo<Model_ResourceAddTwo>>(jo.ToString());
45
+                    //APP.ResourceAddTwo = new Model_ResourceAddTwo();
46
+                    ////0成功,1失败
47
+                    //if (resultObj.code == 0 && resultObj.obj != null)
48
+                    //{
49
+                    //    APP.ResourceAddTwo = resultObj.obj;
50
+                        
51
+                    //    return true;
52
+                    //}
53
+                    //else
54
+                    //{
55
+                    //    //Message = "上传失败!";
56
+                    //    Message = jo["msg"].ToString();
57
+                    //    return false;
58
+                    //}
59
+                }
60
+                catch (Exception e)
61
+                {
62
+                    Message = e.Message;
63
+                    ex = e;
64
+                    Thread.Sleep(1000);
65
+                }
66
+            }
67
+            string ErrMessage = "【请求失败】(test):请求失败。" + Message;
68
+            LogHelper.WriteErrLog(ErrMessage, ex);
69
+            return false;
70
+        }
71
+    }
72
+}

+ 36
- 0
XHZB.DAL/Properties/AssemblyInfo.cs View File

@@ -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("XHZB.DAL")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("XHZB.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("45c8855f-093c-4f92-b9a7-ad3e91c97c06")]
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")]

+ 62
- 0
XHZB.DAL/XHZB.DAL.csproj View File

@@ -0,0 +1,62 @@
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>{45C8855F-093C-4F92-B9A7-AD3E91C97C06}</ProjectGuid>
8
+    <OutputType>Library</OutputType>
9
+    <AppDesignerFolder>Properties</AppDesignerFolder>
10
+    <RootNamespace>XHZB.DAL</RootNamespace>
11
+    <AssemblyName>XHZB.DAL</AssemblyName>
12
+    <TargetFrameworkVersion>v4.5.2</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="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
35
+      <SpecificVersion>False</SpecificVersion>
36
+      <HintPath>..\Common\dlls\log4net.dll</HintPath>
37
+    </Reference>
38
+    <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
39
+      <SpecificVersion>False</SpecificVersion>
40
+      <HintPath>..\Common\dlls\Newtonsoft.Json.dll</HintPath>
41
+    </Reference>
42
+    <Reference Include="System" />
43
+    <Reference Include="System.Core" />
44
+    <Reference Include="System.Xml.Linq" />
45
+    <Reference Include="System.Data.DataSetExtensions" />
46
+    <Reference Include="Microsoft.CSharp" />
47
+    <Reference Include="System.Data" />
48
+    <Reference Include="System.Net.Http" />
49
+    <Reference Include="System.Xml" />
50
+  </ItemGroup>
51
+  <ItemGroup>
52
+    <Compile Include="Class1.cs" />
53
+    <Compile Include="Properties\AssemblyInfo.cs" />
54
+  </ItemGroup>
55
+  <ItemGroup>
56
+    <ProjectReference Include="..\Common\Common.csproj">
57
+      <Project>{808a7075-5af5-46b3-8ef6-514c0b5fa8d7}</Project>
58
+      <Name>Common</Name>
59
+    </ProjectReference>
60
+  </ItemGroup>
61
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
62
+</Project>

+ 8
- 0
XHZB.Desktop/App.config View File

@@ -13,5 +13,13 @@
13 13
     <add key="VersionName" value="1.0.1" />
14 14
     <!--流媒体服务器地址-->
15 15
     <add key="ServerPath" value="live2.xhkjedu.com"/>
16
+    <!--API请求地址-->
17
+    <add key="APIRequestAddress" value="http://schoolapi.xhkjedu.com" />
18
+    <!--文件平台请求地址-->
19
+    <add key="FileRequestAddress" value="http://schoolfile.xhkjedu.com" />
20
+    <!--展示文件服务器请求地址-->
21
+    <add key="SchoolfileRequestAddress" value="http://schoolfile.xhkjedu.com" />
22
+    <!--认证请求地址-->
23
+    <add key="CertapiRequestAddress" value="http://certapi.xhkjedu.com" />
16 24
   </appSettings>
17 25
 </configuration>

+ 31
- 3
XHZB.Desktop/App.cs View File

@@ -1,4 +1,5 @@
1
-using Common.system;
1
+using Common;
2
+using Common.system;
2 3
 
3 4
 using System;
4 5
 using System.Collections.Generic;
@@ -24,6 +25,14 @@ namespace XHZB.Desktop
24 25
         /// </summary>
25 26
         public static string RTMPServerPath = FileToolsCommon.GetConfigValue("ServerPath");
26 27
         /// <summary>
28
+        /// AES账号加密字符串
29
+        /// </summary>
30
+        public static string AESAccountStr = null;
31
+        /// <summary>
32
+        /// AES密码加密字符串
33
+        /// </summary>
34
+        public static string AESPassWordStr = null;
35
+        /// <summary>
27 36
         /// 接口地址
28 37
         /// </summary>
29 38
         public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("APIRequestAddress");
@@ -89,14 +98,33 @@ namespace XHZB.Desktop
89 98
         public static MainWindow W_MainWindow = null;
90 99
         #endregion
91 100
         #endregion
92
-
101
+        /// <summary>
102
+        /// 启动入口
103
+        /// </summary>
104
+        /// <param name="args">参数1:账号加密字符串 参数1:密码加密字符串</param>
93 105
         [STAThread]
94
-        private static void Main()
106
+        private static void Main(string[] args)
95 107
         {
96 108
             //myloading = new LoadDialog();
97 109
             StopSameProcess();
98 110
             Killffmpeg();
99 111
             try
112
+            {
113
+                if (args != null)
114
+                {
115
+                    AESAccountStr = args[0];
116
+                    AESPassWordStr = args[1];
117
+                    ////解密
118
+                    //string Account= AESHelper.AESDecrypt(AESAccountStr);
119
+                    //string PassWord = AESHelper.AESDecrypt(AESPassWordStr);
120
+                }
121
+            }
122
+            catch (Exception ex)
123
+            {
124
+                LogHelper.WriteErrLog("参数接收失败:" + ex.Message, ex);
125
+                throw;
126
+            }
127
+            try
100 128
             {
101 129
                 WindowsIdentity identity = WindowsIdentity.GetCurrent();
102 130
                 WindowsPrincipal principal = new WindowsPrincipal(identity);

+ 4
- 0
XHZB.Desktop/XHZB.Desktop.csproj View File

@@ -118,6 +118,10 @@
118 118
       <Project>{808a7075-5af5-46b3-8ef6-514c0b5fa8d7}</Project>
119 119
       <Name>Common</Name>
120 120
     </ProjectReference>
121
+    <ProjectReference Include="..\XHZB.DAL\XHZB.DAL.csproj">
122
+      <Project>{45c8855f-093c-4f92-b9a7-ad3e91c97c06}</Project>
123
+      <Name>XHZB.DAL</Name>
124
+    </ProjectReference>
121 125
     <ProjectReference Include="..\XHZB.Model\XHZB.Model.csproj">
122 126
       <Project>{fc00ab0b-da8c-46be-aad5-8d8a7fb8c767}</Project>
123 127
       <Name>XHZB.Model</Name>

+ 6
- 0
XHZB.sln View File

@@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XHZB.Desktop", "XHZB.Deskto
9 9
 EndProject
10 10
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XHZB.Model", "XHZB.Model\XHZB.Model.csproj", "{FC00AB0B-DA8C-46BE-AAD5-8D8A7FB8C767}"
11 11
 EndProject
12
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XHZB.DAL", "XHZB.DAL\XHZB.DAL.csproj", "{45C8855F-093C-4F92-B9A7-AD3E91C97C06}"
13
+EndProject
12 14
 Global
13 15
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 16
 		Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
27 29
 		{FC00AB0B-DA8C-46BE-AAD5-8D8A7FB8C767}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 30
 		{FC00AB0B-DA8C-46BE-AAD5-8D8A7FB8C767}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 31
 		{FC00AB0B-DA8C-46BE-AAD5-8D8A7FB8C767}.Release|Any CPU.Build.0 = Release|Any CPU
32
+		{45C8855F-093C-4F92-B9A7-AD3E91C97C06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33
+		{45C8855F-093C-4F92-B9A7-AD3E91C97C06}.Debug|Any CPU.Build.0 = Debug|Any CPU
34
+		{45C8855F-093C-4F92-B9A7-AD3E91C97C06}.Release|Any CPU.ActiveCfg = Release|Any CPU
35
+		{45C8855F-093C-4F92-B9A7-AD3E91C97C06}.Release|Any CPU.Build.0 = Release|Any CPU
30 36
 	EndGlobalSection
31 37
 	GlobalSection(SolutionProperties) = preSolution
32 38
 		HideSolutionNode = FALSE

Loading…
Cancel
Save