Commit aea848ab authored by liudong1993's avatar liudong1993

word转图片

parent cafe4aac
......@@ -15,6 +15,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Aspose.PDF" Version="20.9.0" />
<PackageReference Include="Aspose.Slides.NET" Version="20.8.0" />
<PackageReference Include="Aspose.Words" Version="20.9.0" />
<PackageReference Include="BarcodeLib" Version="2.2.5" />
<PackageReference Include="CoreHtmlToImage" Version="1.0.6" />
<PackageReference Include="LumenWorks.Framework.IO.Core" Version="1.0.1" />
......@@ -26,6 +29,7 @@
<PackageReference Include="NPOI" Version="2.4.1" />
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
<PackageReference Include="QRCoder" Version="1.3.9" />
<PackageReference Include="RabbitMQ.Client" Version="5.2.0" />
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.6.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common.Models
{
/// <summary>
/// 消息队列配置文件
/// </summary>
public class RabbitConfig
{
/// <summary>
/// 主机名:ip地址
/// </summary>
public string HostName { get; set; }
/// <summary>
/// 端口
/// </summary>
public int Port { get; set; }
/// <summary>
/// 用户名
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// 队列名称
/// </summary>
public string QueenName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common.Models
{
/// <summary>
/// 消息队列名称类
/// </summary>
public class RabbitKey
{
/// <summary>
/// 初始化教育消息队列
/// </summary>
public const string QUEEN_GENERATE_EDUCARION = "generate_educarion";
}
}
This diff is collapsed.
using Mall.Common.Models;
using RabbitMQ.Client;
using System;
using System.Text;
namespace Mall.Common.Plugin
{
/// <summary>
/// RabbitMq消息队列
/// </summary>
public class RabbiMQManager
{
/// <summary>
/// 获取连接
/// </summary>
/// <param name="rabbitConfig">连接配置实体</param>
/// <returns></returns>
private static ConnectionFactory GetConnectionFactory(RabbitConfig rabbitConfig)
{
ConnectionFactory factory = new ConnectionFactory
{
HostName = rabbitConfig.HostName,
//默认端口
Port = rabbitConfig.Port,
UserName = rabbitConfig.UserName,
Password = rabbitConfig.Password
};
return factory;
}
/// <summary>
/// 发送信息
/// </summary>
/// <param name="rabbitConfig">消息队列配置实体</param>
/// <param name="message">发送的消息</param>
public static void SendMessage(RabbitConfig rabbitConfig, string message)
{
using (IConnection conn = GetConnectionFactory(rabbitConfig).CreateConnection())
{
using (IModel channel = conn.CreateModel())
{
//在MQ上定义一个持久化队列,如果名称相同不会重复创建
channel.QueueDeclare(rabbitConfig.QueenName, true, false, false, null);
byte[] buffer = Encoding.UTF8.GetBytes(message);
IBasicProperties properties = channel.CreateBasicProperties();
properties.DeliveryMode = 2;
channel.BasicPublish("", rabbitConfig.QueenName, properties, buffer);
}
}
}
}
}
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<appSettings>
<add key="IsNorServer" value="2" />
<add key="TX_COS_REGION" value="ap-chengdu" />
<add key="TX_COS_SECRETID" value="AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd" />
<add key="TX_COS_SECRETKEY" value="PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob" />
<add key="TX_COS_BUCKET" value="viitto-1301420277" />
</appSettings>
<connectionStrings>
<!--<add name="DefaultConnection" providerName="MySql.Data.MySqlClient" connectionString="server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;port=3306;user id=reborn;password=Reborn@2018;database=test_reborn_mall_3;CharSet=utf8;Convert Zero Datetime=true;" />-->
<add name="DefaultConnection" providerName="MySql.Data.MySqlClient" connectionString="server=192.168.1.214;user id=reborn;password=Reborn@2018;database=test_reborn_mall_3;CharSet=utf8; Convert Zero Datetime=true;"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" maxRequestLength="2097152000" />
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-8.0.14.0" newVersion="8.0.14.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
namespace Mall.Education.Common
{
/// <summary>
/// 全局配置
/// </summary>
public class Config
{
/// <summary>
/// 获取配置文件的值
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetAppSetting(string key)
{
try
{
string value = ConfigurationManager.AppSettings[key].ToString();
return value ?? "";
}
catch (Exception)
{
return "";
}
}
}
}
\ No newline at end of file
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Education.DBHelper
{
/// <summary>
/// MySql帮助类
/// </summary>
public class MySqlHelper
{
/// <summary>
/// 默认连接字符串
/// </summary>
public static readonly string defaultConnection = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
public static object ExecuteScalar(string connectionString, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters)
{
MySqlCommand cmd = new MySqlCommand();
using (MySqlConnection conn = new MySqlConnection(connectionString))
{
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
object val = cmd.ExecuteScalar();
cmd.Parameters.Clear();
return val;
}
}
public static int ExecuteNonQuery(string connectionString, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters)
{
// Create a new MySql command
MySqlCommand cmd = new MySqlCommand();
//Create a connection
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
//Prepare the command
PrepareCommand(cmd, connection, null, cmdType, cmdText, commandParameters);
//Execute the command
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return val;
}
}
/// <summary>
/// Internal function to prepare a command for execution by the database
/// </summary>
/// <param name="cmd">Existing command object</param>
/// <param name="conn">Database connection object</param>
/// <param name="trans">Optional transaction object</param>
/// <param name="cmdType">Command type, e.g. stored procedure</param>
/// <param name="cmdText">Command test</param>
/// <param name="commandParameters">Parameters for the command</param>
private static void PrepareCommand(MySqlCommand cmd, MySqlConnection conn, MySqlTransaction trans, CommandType cmdType, string cmdText, MySqlParameter[] commandParameters)
{
//Open the connection if required
if (conn.State != ConnectionState.Open)
conn.Open();
//Set up the command
cmd.Connection = conn;
cmd.CommandText = cmdText;
cmd.CommandType = cmdType;
//Bind it to the transaction if it exists
if (trans != null)
cmd.Transaction = trans;
// Bind the parameters passed in
if (commandParameters != null)
{
foreach (MySqlParameter parm in commandParameters)
cmd.Parameters.Add(parm);
}
}
/// <summary>
/// 执行SQL语句或者存储过程 ,返回参数dataset
/// </summary>
/// <param name="connection">要执行SQL语句的连接</param>
/// <param name="commandText">SQL语句或者存储过程名</param>
/// <param name="commandParameters">SQL语句或者存储过程参数</param>
/// <param name="commandType">SQL语句类型</param>
/// <param name="commandTimeout">超时时间</param>
/// <returns>执行结果集</returns>
public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText, params MySqlParameter[] commandParameters)
{
MySqlCommand cmd = new MySqlCommand();
bool mustCloseConnection = false;
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
PrepareCommand(cmd, connection, null, commandType, commandText, commandParameters);
using (MySqlDataAdapter da = new MySqlDataAdapter(cmd))
{
DataSet ds = new DataSet();
da.Fill(ds);
cmd.Parameters.Clear();
if (mustCloseConnection)
connection.Close();
return ds;
}
}
}
}
}
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using System.Text.RegularExpressions;
using Mall.Education.DBHelper;
using System.Linq;
using Newtonsoft.Json;
namespace Mall.Education.Helper
{
/// <summary>
/// 数据帮助类
/// </summary>
public class FileDataHelper
{
/// <summary>
/// 插入图片
/// </summary>
/// <param name="cookie"></param>
public static void InsertGoodsFileImage()
{
string citySql = $@"SELECT * FROM rb_destination WHERE 1=1 and Status =0 AND Name in('成都市') ";
var cityDataList = MySqlHelper.ExecuteDataset(MySqlHelper.defaultConnection, System.Data.CommandType.Text, citySql, null);
LogHelper.Write(JsonConvert.SerializeObject(cityDataList.Tables[0].Rows));
//var sqlOrderDetailResult = MySqlHelper.ExecuteNonQuery(MySqlHelper.defaultConnection, System.Data.CommandType.Text, sqlOrderDetail, null);
}
/// <summary>
/// 上传图片至阿里云/腾讯云
/// </summary>
public static void UpLoadImage() {
}
/// <summary>
/// Get获取数据
/// </summary>
/// <param name="url">url地址</param>
/// <param name="encode">编码方式</param>
/// <param name="Source">来源</param>
/// <returns></returns>
static string HttpGet(string url, string cookie)
{
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
myRequest.Headers.Add("Cookie", cookie);
myRequest.Headers.Add("X-Requested-With", "XMLHttpRequest");
myRequest.Method = "GET";
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
string content = reader.ReadToEnd();
reader.Close();
return content;
}
/// <summary>
/// Get获取数据
/// </summary>
/// <param name="url">url地址</param>
/// <param name="encode">编码方式</param>
/// <param name="Source">来源</param>
/// <returns></returns>
public static string HttpGet(string url, Encoding encode, string Source, string cookie = "")
{
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
if (!string.IsNullOrEmpty(Source))
{
myRequest.Referer = Source;
}
if (!string.IsNullOrEmpty(cookie))
{
myRequest.Headers.Add("cookie", cookie);
}
myRequest.Method = "GET";
HttpWebResponse myResponse = null;
try
{
myResponse = (HttpWebResponse)myRequest.GetResponse();
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), encode);
string content = reader.ReadToEnd();
return content;
}
//异常请求
catch (WebException e)
{
myResponse = (HttpWebResponse)e.Response;
using (Stream errData = myResponse.GetResponseStream())
{
using (StreamReader reader = new StreamReader(errData))
{
string text = reader.ReadToEnd();
return text;
}
}
}
}
}
}
using System;
using System.Configuration;
using System.IO;
using System.Threading.Tasks;
namespace Mall.Education.Helper
{
/// <summary>
/// 日志帮助类
/// </summary>
public class LogHelper
{
private static string logDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log/error");
private static string infoLogDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log/info");
private static string requestLogDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log/request");
private static object objError = new object();
private static object objInfo = new object();
private static object objRequest = new object();
/// <summary>
/// 构造函数
/// </summary>
static LogHelper()
{
if (!Directory.Exists(logDir))
Directory.CreateDirectory(logDir);
if (!Directory.Exists(infoLogDir))
Directory.CreateDirectory(infoLogDir);
if (!Directory.Exists(requestLogDir))
Directory.CreateDirectory(requestLogDir);
}
/// <summary>
/// 写日志(异常日志)
/// </summary>
/// <param name="ex">异常内容</param>
public static void Write(Exception ex)
{
Write(ex, "");
}
/// <summary>
/// 写日志(异常日志)
/// </summary>
/// <param name="msg">信息</param>
public static void Write(string msg)
{
Write(null, msg);
}
/// <summary>
/// 写日志(异常日志)
/// </summary>
/// <param name="exception">异常信息</param>
/// <param name="otherMsg">其他信息</param>
public static void Write(Exception exception, string otherMsg)
{
Task.Run(() => WriteLog(exception, otherMsg, LogEnum.Error));
}
/// <summary>
/// 打印信息(记录信息)
/// </summary>
/// <param name="msg">信息</param>
public static void WriteInfo(string msg)
{
Task.Run(() => WriteLog(null, msg, LogEnum.Info));
}
/// <summary>
/// 写日志
/// </summary>
/// <param name="exception">异常信息</param>
/// <param name="otherMsg">其他信息</param>
/// <param name="logType">日志类型</param>
private static void WriteLog(Exception exception, string otherMsg, LogEnum logType)
{
string str = "";
try
{
str += string.Format(@"
DateTime:{0}", DateTime.Now.ToString());
if (exception != null)
{
if (exception.InnerException != null)
{
exception = exception.InnerException;
}
str += string.Format(@"
Message:{0}
StackTrace:
{1}
Source:{2}
"
, exception.Message
, exception.StackTrace
, exception.Source
);
}
str += string.Format(@"
ExtMessage:{0}", otherMsg);
string filePath = "";
object lockObj = new object();
switch (logType)
{
case LogEnum.Error:
filePath = Path.Combine(logDir, DateTime.Now.ToString("yyyyMMdd") + ".txt");
lockObj = objError;
break;
case LogEnum.Info:
filePath = Path.Combine(infoLogDir, DateTime.Now.ToString("yyyyMMdd") + ".txt");
lockObj = objInfo;
break;
case LogEnum.Request:
filePath = Path.Combine(requestLogDir, DateTime.Now.ToString("yyyyMMdd") + ".txt");
lockObj = objRequest;
break;
}
lock (lockObj)
{
StreamWriter sw = new StreamWriter(filePath, true);
sw.WriteLine(str);
sw.Close();
}
}
catch
{
}
}
}
/// <summary>
/// 日志枚举
/// </summary>
public enum LogEnum
{
/// <summary>
/// 错误日志
/// </summary>
Error = 1,
/// <summary>
/// 信息记录
/// </summary>
Info = 2,
/// <summary>
/// 接口请求
/// </summary>
Request = 3
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CE026CAA-B6E6-47F5-9998-181A07679DA0}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Mall.Education</RootNamespace>
<AssemblyName>Mall.Education</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Aspose.Pdf">
<HintPath>lib\Aspose.Pdf.dll</HintPath>
</Reference>
<Reference Include="Aspose.Slides">
<HintPath>lib\Aspose.Slides.dll</HintPath>
</Reference>
<Reference Include="Aspose.Words, Version=16.4.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>lib\Aspose.Words.dll</HintPath>
</Reference>
<Reference Include="COSXML, Version=5.4.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Tencent.QCloud.Cos.Sdk.5.4.13\lib\netstandard2.0\COSXML.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Diagnostics.Tracing.EventSource, Version=2.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Diagnostics.Tracing.EventSource.Redist.2.2.0\lib\net461\Microsoft.Diagnostics.Tracing.EventSource.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.14.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<HintPath>..\packages\MySql.Data.8.0.14\lib\net452\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RabbitMQ.Client, Version=5.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce, processorArchitecture=MSIL">
<HintPath>..\packages\RabbitMQ.Client.5.2.0\lib\net451\RabbitMQ.Client.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Management" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="DBHelper\MySqlHelper.cs" />
<Compile Include="Helper\FileDataHelper.cs" />
<Compile Include="Helper\LogHelper.cs" />
<Compile Include="Model\GoodsModel.cs" />
<Compile Include="Model\RabbitConfig.cs" />
<Compile Include="Model\RabbitKey.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ProjectInstaller.Designer.cs">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RabbitMQ\ImageConverters.cs" />
<Compile Include="RabbitMQ\RabbiMQManager.cs" />
<Compile Include="RabbitMQ\Unrar.cs" />
<Compile Include="RebornTimerServer.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="RebornTimerServer.Designer.cs">
<DependentUpon>RebornTimerServer.cs</DependentUpon>
</Compile>
<Compile Include="TXCOS\DeleteObject.cs" />
<Compile Include="TXCOS\TransferCopyObject.cs" />
<Compile Include="TXCOS\TransferDownloadObject.cs" />
<Compile Include="TXCOS\TransferUploadObject.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Education.Models
{
/// <summary>
/// 消息队列配置文件
/// </summary>
public class GoodsModel
{
/// <summary>
/// 商品id
/// </summary>
public int GoodsId { get; set; }
/// <summary>
/// 课程id
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// 文件地址
/// </summary>
public string FilePath { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Education.Models
{
/// <summary>
/// 消息队列配置文件
/// </summary>
public class RabbitConfig
{
/// <summary>
/// 主机名:ip地址
/// </summary>
public string HostName { get; set; }
/// <summary>
/// 端口
/// </summary>
public int Port { get; set; }
/// <summary>
/// 用户名
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// 队列名称
/// </summary>
public string QueenName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Education.Models
{
/// <summary>
/// 消息队列名称类
/// </summary>
public class RabbitKey
{
/// <summary>
/// 初始化教育消息队列
/// </summary>
public const string QUEEN_GENERATE_EDUCARION = "generate_educarion";
}
}

using Mall.Education.Helper;
using Mall.Education.Models;
using Mall.Education.RabbitMQ;
using System;
using System.ServiceProcess;
using COSSnippet;
namespace Mall.Education
{
public class Program
{
static void Main(string[] args)
{
//ServiceBase[] ServicesToRun;
//ServicesToRun = new ServiceBase[]
//{
// new RebornTimerServer(),
//};
//ServiceBase.Run(ServicesToRun);
//RabbitConfig rabbit = new RabbitConfig()
//{
// HostName = "47.96.25.130",
// Port = 5672,
// UserName = "guest",
// Password = "viitto2019",
// QueenName = RabbitKey.QUEEN_GENERATE_EDUCARION
//};
//RabbiMQManager.DealWithMessage(rabbit);
//new OfficeHelper().GetWordToImagePathList("C:/Users/Administrator/Desktop/testImage/网课需求(1).docx", "C:/Users/Administrator/Desktop/testImage/Image/", null);
//new Word2ImageConverter().ConvertToImage("C:/Users/Administrator/Desktop/testImage/网课需求(1).docx", "C:/Users/Administrator/Desktop/testImage/Image/");
//new Pdf2ImageConverter().ConvertToImage("C:/Users/Administrator/Desktop/testImage/MA10048W_zh.pdf", "C:/Users/Administrator/Desktop/testImage/PdfImage/");
//new Ppt2ImageConverter().ConvertToImage("C:/Users/Administrator/Desktop/testImage/kjljlkjk.ppt", "C:/Users/Administrator/Desktop/testImage/PptImage/");
//FileDataHelper.InsertGoodsFileImage();
TransferUploadObjectModel m = new TransferUploadObjectModel();
m.TransferUploadFile("C:/Users/Administrator/Desktop/testImage/Image/网课需求(1)_001.Png", "网课需求(1)_001.Png");
Console.ReadKey();
}
}
}
namespace Mall.Education
{
partial class ProjectInstaller
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.Description = "RebornTimerService定时器服务";
this.serviceInstaller1.ServiceName = "RebornTimerServer";
this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1,
this.serviceInstaller1});
}
#endregion
private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
private System.ServiceProcess.ServiceInstaller serviceInstaller1;
}
}
\ No newline at end of file
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.Threading.Tasks;
namespace Mall.Education
{
[RunInstaller(true)]
public partial class ProjectInstaller : System.Configuration.Install.Installer
{
public ProjectInstaller()
{
InitializeComponent();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="serviceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="serviceInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>208, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
\ No newline at end of file
This diff is collapsed.
using Mall.Education.Models;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using System;
using System.Text;
using Newtonsoft.Json;
namespace Mall.Education.RabbitMQ
{
/// <summary>
/// RabbitMq消息队列
/// </summary>
public static class RabbiMQManager
{
/// <summary>
/// 获取连接
/// </summary>
/// <param name="rabbitConfig">连接配置实体</param>
/// <returns></returns>
private static ConnectionFactory GetConnectionFactory(RabbitConfig rabbitConfig)
{
ConnectionFactory factory = new ConnectionFactory
{
HostName = rabbitConfig.HostName,
//默认端口
Port = rabbitConfig.Port,
UserName = rabbitConfig.UserName,
Password = rabbitConfig.Password
};
return factory;
}
///// <summary>
///// 消费消息
///// </summary>
///// <param name="rabbitConfig"></param>
//public static void DealWithMessage(RabbitConfig rabbitConfig)
//{
// using (IConnection conn = GetConnectionFactory(rabbitConfig).CreateConnection())
// {
// using (IModel channel = conn.CreateModel())
// {
// //在MQ上定义一个持久化队列,如果名称相同不会重复创建
// //channel.QueueDeclare(rabbitConfig.QueenName, true, false, false, null);
// //输入1,那如果接收一个消息,但是没有应答,则客户端不会收到下一个消息
// //channel.BasicQos(0, 1, false);
// channel.QueueDeclare(rabbitConfig.QueenName, false, false, false, null);
// var consumer = new EventingBasicConsumer(channel);//消费者
// channel.BasicConsume(rabbitConfig.QueenName, true, consumer);//消费消息
// Console.WriteLine("开始");
// consumer.Received += (model, ea) =>
// {
// //var body = ea.Body;
// Console.WriteLine("123");
// };
// Console.WriteLine("结束");
// //在队列上定义一个消费者
// //EventingBasicConsumer consumer = new EventingBasicConsumer(channel);
// ////消费队列,并设置应答模式为程序主动应答
// //channel.BasicConsume(rabbitConfig.QueenName, true, consumer);
// //consumer.Received += (sender, e) =>
// //{
// // Console.WriteLine("123");
// // //byte[] bytes = e.Body.ToArray();
// // //string message = Encoding.UTF8.GetString(bytes);
// // //try
// // //{
// // // Console.WriteLine(message);
// // // //序列化 操作数据
// // // //var msgModel = JsonConvert.DeserializeObject<FeaturesMQ>(message);
// // //}
// // //catch (Exception)
// // //{
// // // throw;
// // //}
// // //channel.BasicAck(e.DeliveryTag, false);
// //};
// }
// }
//}
[Obsolete]
public static void DealWithMessage(RabbitConfig rabbitConfig)
{
using (IConnection conn = GetConnectionFactory(rabbitConfig).CreateConnection())
{
using (IModel channel = conn.CreateModel())
{
//在MQ上定义一个持久化队列,如果名称相同不会重复创建
channel.QueueDeclare(rabbitConfig.QueenName, true, false, false, null);
//输入1,那如果接收一个消息,但是没有应答,则客户端不会收到下一个消息
channel.BasicQos(0, 1, false);
//在队列上定义一个消费者
QueueingBasicConsumer consumer = new QueueingBasicConsumer(channel);
//消费队列,并设置应答模式为程序主动应答
channel.BasicConsume(rabbitConfig.QueenName, false, consumer);
while (true)
{
//阻塞函数,获取队列中的消息
BasicDeliverEventArgs ea = (BasicDeliverEventArgs)consumer.Queue.Dequeue();
byte[] bytes = ea.Body;
string msg = Encoding.UTF8.GetString(bytes);
try
{
var GoodsModel = JsonConvert.DeserializeObject<GoodsModel>(msg);
//处理
Console.WriteLine(msg);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
//回复确认
channel.BasicAck(ea.DeliveryTag, false);
}
}
}
}
}
}
This diff is collapsed.
namespace Mall.Education
{
partial class RebornTimerServer
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "RebornTimerServer";
}
#endregion
}
}
using Mall.Education.Models;
using Mall.Education.RabbitMQ;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Education
{
partial class RebornTimerServer : ServiceBase
{
public RebornTimerServer()
{
InitializeComponent();
}
/// <summary>
/// 在此处添加代码以启动服务。
/// </summary>
/// <param name="args"></param>
protected override void OnStart(string[] args)
{
RabbitConfig rabbit = new RabbitConfig()
{
HostName = "47.96.25.130",
Port = 5672,
UserName = "guest",
Password = "viitto2019",
QueenName = RabbitKey.QUEEN_GENERATE_EDUCARION
};
Task.Factory.StartNew(() => RabbiMQManager.DealWithMessage(rabbit));
}
/// <summary>
/// 在此处添加代码以执行停止服务所需的关闭操作。
/// </summary>
protected override void OnStop()
{
}
}
}
using COSXML.Common;
using COSXML.CosException;
using COSXML.Model;
using COSXML.Model.Object;
using COSXML.Model.Tag;
using COSXML.Model.Bucket;
using COSXML.Model.Service;
using COSXML.Utils;
using COSXML.Auth;
using COSXML.Transfer;
using System;
using COSXML;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Mall.Education.Common;
namespace COSSnippet
{
public class DeleteObjectModel
{
private CosXml cosXml;
DeleteObjectModel()
{
CosXmlConfig config = new CosXmlConfig.Builder()
.SetRegion(Config.GetAppSetting("TX_COS_REGION")) //设置一个默认的存储桶地域
.Build();
string secretId = Config.GetAppSetting("TX_COS_SECRETID"); //云 API 密钥 SecretId
string secretKey = Config.GetAppSetting("TX_COS_SECRETKEY"); //云 API 密钥 SecretKey
long durationSecond = 600; //每次请求签名有效时长,单位为秒
QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId,
secretKey, durationSecond);
this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
}
/// 删除对象
public void DeleteObject()
{
//.cssg-snippet-body-start:[delete-object]
try
{
String bucket = Config.GetAppSetting("TX_COS_BUCKET"); //存储桶,格式:BucketName-APPID
string key = "exampleobject"; //对象键
DeleteObjectRequest request = new DeleteObjectRequest(bucket, key);
//执行请求
DeleteObjectResult result = cosXml.DeleteObject(request);
//请求成功
Console.WriteLine(result.GetResultInfo());
}
catch (COSXML.CosException.CosClientException clientEx)
{
//请求失败
Console.WriteLine("CosClientException: " + clientEx);
}
catch (COSXML.CosException.CosServerException serverEx)
{
//请求失败
Console.WriteLine("CosServerException: " + serverEx.GetInfo());
}
//.cssg-snippet-body-end
}
/// 删除多个对象
public void DeleteMultiObject()
{
//.cssg-snippet-body-start:[delete-multi-object]
try
{
string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
DeleteMultiObjectRequest request = new DeleteMultiObjectRequest(bucket);
//设置返回结果形式
request.SetDeleteQuiet(false);
//对象key
string key = "exampleobject"; //对象键
List<string> objects = new List<string>();
objects.Add(key);
request.SetObjectKeys(objects);
//执行请求
DeleteMultiObjectResult result = cosXml.DeleteMultiObjects(request);
//请求成功
Console.WriteLine(result.GetResultInfo());
}
catch (COSXML.CosException.CosClientException clientEx)
{
//请求失败
Console.WriteLine("CosClientException: " + clientEx);
}
catch (COSXML.CosException.CosServerException serverEx)
{
//请求失败
Console.WriteLine("CosServerException: " + serverEx.GetInfo());
}
//.cssg-snippet-body-end
}
// .cssg-methods-pragma
//static void Main(string[] args)
//{
// DeleteObjectModel m = new DeleteObjectModel();
// /// 删除对象
// m.DeleteObject();
// /// 删除多个对象
// m.DeleteMultiObject();
// // .cssg-methods-pragma
//}
}
}
\ No newline at end of file
using COSXML.Common;
using COSXML.CosException;
using COSXML.Model;
using COSXML.Model.Object;
using COSXML.Model.Tag;
using COSXML.Model.Bucket;
using COSXML.Model.Service;
using COSXML.Utils;
using COSXML.Auth;
using COSXML.Transfer;
using System;
using COSXML;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Mall.Education.Common;
namespace COSSnippet
{
public class TransferCopyObjectModel
{
private CosXml cosXml;
TransferCopyObjectModel()
{
CosXmlConfig config = new CosXmlConfig.Builder()
.SetRegion(Config.GetAppSetting("TX_COS_REGION")) //设置一个默认的存储桶地域
.Build();
string secretId = Config.GetAppSetting("TX_COS_SECRETID"); //云 API 密钥 SecretId
string secretKey = Config.GetAppSetting("TX_COS_SECRETKEY"); //云 API 密钥 SecretKey
long durationSecond = 600; //每次请求签名有效时长,单位为秒
QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId,
secretKey, durationSecond);
this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
}
/// 高级接口拷贝对象
public void TransferCopyObject()
{
TransferConfig transferConfig = new TransferConfig();
// 初始化 TransferManager
TransferManager transferManager = new TransferManager(cosXml, transferConfig);
//.cssg-snippet-body-start:[transfer-copy-object]
string sourceAppid = "1250000000"; //账号 appid
string sourceBucket = "sourcebucket-1250000000"; //"源对象所在的存储桶
string sourceRegion = "COS_REGION"; //源对象的存储桶所在的地域
string sourceKey = "sourceObject"; //源对象键
//构造源对象属性
CopySourceStruct copySource = new CopySourceStruct(sourceAppid, sourceBucket,
sourceRegion, sourceKey);
String bucket = Config.GetAppSetting("TX_COS_BUCKET"); //存储桶,格式:BucketName-APPID
string key = "exampleobject"; //目标对象的对象键
COSXMLCopyTask copytask = new COSXMLCopyTask(bucket, key, copySource);
copytask.successCallback = delegate (CosResult cosResult)
{
COSXML.Transfer.COSXMLCopyTask.CopyTaskResult result = cosResult
as COSXML.Transfer.COSXMLCopyTask.CopyTaskResult;
Console.WriteLine(result.GetResultInfo());
string eTag = result.eTag;
};
copytask.failCallback = delegate (CosClientException clientEx, CosServerException serverEx)
{
if (clientEx != null)
{
Console.WriteLine("CosClientException: " + clientEx);
}
if (serverEx != null)
{
Console.WriteLine("CosServerException: " + serverEx.GetInfo());
}
};
transferManager.Copy(copytask);
//.cssg-snippet-body-end
}
// .cssg-methods-pragma
//static void Main(string[] args)
//{
// TransferCopyObjectModel m = new TransferCopyObjectModel();
// /// 高级接口拷贝对象
// m.TransferCopyObject();
// // .cssg-methods-pragma
//}
}
}
\ No newline at end of file
using COSXML.Common;
using COSXML.CosException;
using COSXML.Model;
using COSXML.Model.Object;
using COSXML.Model.Tag;
using COSXML.Model.Bucket;
using COSXML.Model.Service;
using COSXML.Utils;
using COSXML.Auth;
using COSXML.Transfer;
using System;
using COSXML;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Mall.Education.Common;
namespace COSSnippet
{
public class TransferDownloadObjectModel
{
private CosXml cosXml;
TransferDownloadObjectModel()
{
CosXmlConfig config = new CosXmlConfig.Builder()
.SetRegion(Config.GetAppSetting("TX_COS_REGION")) //设置一个默认的存储桶地域
.Build();
string secretId = Config.GetAppSetting("TX_COS_SECRETID"); //云 API 密钥 SecretId
string secretKey = Config.GetAppSetting("TX_COS_SECRETKEY"); //云 API 密钥 SecretKey
long durationSecond = 600; //每次请求签名有效时长,单位为秒
QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId,
secretKey, durationSecond);
this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
}
/// 高级接口下载对象
public void TransferDownloadObject()
{
//.cssg-snippet-body-start:[transfer-download-object]
// 初始化 TransferConfig
TransferConfig transferConfig = new TransferConfig();
// 初始化 TransferManager
TransferManager transferManager = new TransferManager(cosXml, transferConfig);
String bucket = Config.GetAppSetting("TX_COS_BUCKET"); //存储桶,格式:BucketName-APPID
String cosPath = "exampleobject"; //对象在存储桶中的位置标识符,即称对象键
string localDir = System.IO.Path.GetTempPath();//本地文件夹
string localFileName = "my-local-temp-file"; //指定本地保存的文件名
// 下载对象
COSXMLDownloadTask downloadTask = new COSXMLDownloadTask(bucket, cosPath,
localDir, localFileName);
downloadTask.progressCallback = delegate (long completed, long total)
{
Console.WriteLine(String.Format("progress = {0:##.##}%", completed * 100.0 / total));
};
downloadTask.successCallback = delegate (CosResult cosResult)
{
COSXML.Transfer.COSXMLDownloadTask.DownloadTaskResult result = cosResult
as COSXML.Transfer.COSXMLDownloadTask.DownloadTaskResult;
Console.WriteLine(result.GetResultInfo());
string eTag = result.eTag;
};
downloadTask.failCallback = delegate (CosClientException clientEx, CosServerException serverEx)
{
if (clientEx != null)
{
Console.WriteLine("CosClientException: " + clientEx);
}
if (serverEx != null)
{
Console.WriteLine("CosServerException: " + serverEx.GetInfo());
}
};
transferManager.Download(downloadTask);
//.cssg-snippet-body-end
}
/// 下载暂停
public void TransferDownloadObjectInteract()
{
//.cssg-snippet-body-start:[transfer-download-object-pause]
//.cssg-snippet-body-end
//.cssg-snippet-body-start:[transfer-download-object-resume]
//.cssg-snippet-body-end
//.cssg-snippet-body-start:[transfer-download-object-cancel]
//.cssg-snippet-body-end
}
/// 批量下载
public void TransferBatchDownloadObjects()
{
//.cssg-snippet-body-start:[transfer-batch-download-objects]
TransferConfig transferConfig = new TransferConfig();
// 初始化 TransferManager
TransferManager transferManager = new TransferManager(cosXml, transferConfig);
string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
string localDir = System.IO.Path.GetTempPath();//本地文件夹
for (int i = 0; i < 5; i++)
{
// 下载对象
string cosPath = "exampleobject" + i; //对象在存储桶中的位置标识符,即称对象键
string localFileName = "my-local-temp-file"; //指定本地保存的文件名
COSXMLDownloadTask downloadTask = new COSXMLDownloadTask(bucket, cosPath,
localDir, localFileName);
transferManager.Download(downloadTask);
}
//.cssg-snippet-body-end
}
/// 下载时对单链接限速
public void DownloadObjectTrafficLimit()
{
//.cssg-snippet-body-start:[download-object-traffic-limit]
TransferConfig transferConfig = new TransferConfig();
// 初始化 TransferManager
TransferManager transferManager = new TransferManager(cosXml, transferConfig);
String bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
String cosPath = "exampleobject"; //对象在存储桶中的位置标识符,即称对象键
string localDir = System.IO.Path.GetTempPath();//本地文件夹
string localFileName = "my-local-temp-file"; //指定本地保存的文件名
GetObjectRequest request = new GetObjectRequest(bucket,
cosPath, localDir, localFileName);
request.LimitTraffic(8 * 1000 * 1024); // 限制为1MB/s
COSXMLDownloadTask downloadTask = new COSXMLDownloadTask(request);
transferManager.Download(downloadTask);
//.cssg-snippet-body-end
}
// .cssg-methods-pragma
//static void Main(string[] args)
//{
// TransferDownloadObjectModel m = new TransferDownloadObjectModel();
// /// 高级接口下载对象
// m.TransferDownloadObject();
// /// 下载暂停续传取消
// m.TransferDownloadObjectInteract();
// /// 批量下载
// m.TransferBatchDownloadObjects();
// /// 下载时对单链接限速
// m.DownloadObjectTrafficLimit();
// // .cssg-methods-pragma
//}
}
}
\ No newline at end of file
using COSXML.Common;
using COSXML.CosException;
using COSXML.Model;
using COSXML.Model.Object;
using COSXML.Model.Tag;
using COSXML.Model.Bucket;
using COSXML.Model.Service;
using COSXML.Utils;
using COSXML.Auth;
using COSXML.Transfer;
using System;
using COSXML;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Mall.Education.Common;
namespace COSSnippet
{
public class TransferUploadObjectModel
{
private CosXml cosXml;
public TransferUploadObjectModel()
{
CosXmlConfig config = new CosXmlConfig.Builder()
.SetRegion(Config.GetAppSetting("TX_COS_REGION")) //设置一个默认的存储桶地域
.Build();
string secretId = Config.GetAppSetting("TX_COS_SECRETID"); //云 API 密钥 SecretId
string secretKey = Config.GetAppSetting("TX_COS_SECRETKEY"); //云 API 密钥 SecretKey
long durationSecond = 600; //每次请求签名有效时长,单位为秒
QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId,
secretKey, durationSecond);
this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);
}
/// 高级接口上传对象
public void TransferUploadFile(string filePath,string newFileName)
{
//.cssg-snippet-body-start:[transfer-upload-file]
// 初始化 TransferConfig
TransferConfig transferConfig = new TransferConfig();
// 初始化 TransferManager
TransferManager transferManager = new TransferManager(cosXml, transferConfig);
String bucket = Config.GetAppSetting("TX_COS_BUCKET"); //存储桶,格式:BucketName-APPID
String cosPath = "Upload/Education/"+ newFileName; //对象在存储桶中的位置标识符,即称对象键
if (Config.GetAppSetting("IsNorServer") == "2")
{
cosPath = "Test/" + cosPath;
}
String srcPath = filePath;//本地文件绝对路径
// 上传对象
COSXMLUploadTask uploadTask = new COSXMLUploadTask(bucket, cosPath);
uploadTask.SetSrcPath(srcPath);
uploadTask.progressCallback = delegate (long completed, long total)
{
Console.WriteLine(String.Format("progress = {0:##.##}%", completed * 100.0 / total));
};
uploadTask.successCallback = delegate (CosResult cosResult)
{
COSXML.Transfer.COSXMLUploadTask.UploadTaskResult result = cosResult
as COSXML.Transfer.COSXMLUploadTask.UploadTaskResult;
Console.WriteLine(result.GetResultInfo());
string eTag = result.eTag;
};
uploadTask.failCallback = delegate (CosClientException clientEx, CosServerException serverEx)
{
if (clientEx != null)
{
Console.WriteLine("CosClientException: " + clientEx);
}
if (serverEx != null)
{
Console.WriteLine("CosServerException: " + serverEx.GetInfo());
}
};
transferManager.Upload(uploadTask);
//.cssg-snippet-body-end
}
/// 高级接口上传二进制数据
public void TransferUploadBytes()
{
//.cssg-snippet-body-start:[transfer-upload-bytes]
try
{
string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
string cosPath = "exampleObject"; // 对象键
byte[] data = new byte[1024]; // 二进制数据
PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, cosPath, data);
cosXml.PutObject(putObjectRequest);
}
catch (COSXML.CosException.CosClientException clientEx)
{
//请求失败
Console.WriteLine("CosClientException: " + clientEx);
}
catch (COSXML.CosException.CosServerException serverEx)
{
//请求失败
Console.WriteLine("CosServerException: " + serverEx.GetInfo());
}
//.cssg-snippet-body-end
}
/// 高级接口流式上传
public void TransferUploadStream()
{
/// 暂不支持
//.cssg-snippet-body-start:[transfer-upload-stream]
//.cssg-snippet-body-end
}
/// 高级接口 URI 上传
public void TransferUploadUri()
{
/// 暂不支持
//.cssg-snippet-body-start:[transfer-upload-uri]
//.cssg-snippet-body-end
}
/// 上传暂停、续传、取消
public void TransferUploadInteract()
{
TransferConfig transferConfig = new TransferConfig();
TransferManager transferManager = new TransferManager(cosXml, transferConfig);
string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
string cosPath = "exampleobject"; //对象在存储桶中的位置标识符,即称对象键
string srcPath = @"temp-source-file";//本地文件绝对路径
// 上传对象
COSXMLUploadTask uploadTask = new COSXMLUploadTask(bucket, cosPath);
uploadTask.SetSrcPath(srcPath);
transferManager.Upload(uploadTask);
//.cssg-snippet-body-start:[transfer-upload-pause]
uploadTask.Pause();
//.cssg-snippet-body-end
//.cssg-snippet-body-start:[transfer-upload-resume]
uploadTask.Resume();
//.cssg-snippet-body-end
//.cssg-snippet-body-start:[transfer-upload-cancel]
uploadTask.Cancel();
//.cssg-snippet-body-end
}
/// 批量上传
public void TransferBatchUploadObjects()
{
//.cssg-snippet-body-start:[transfer-batch-upload-objects]
TransferConfig transferConfig = new TransferConfig();
// 初始化 TransferManager
TransferManager transferManager = new TransferManager(cosXml, transferConfig);
string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
for (int i = 0; i < 5; i++)
{
// 上传对象
string cosPath = "exampleobject" + i; //对象在存储桶中的位置标识符,即称对象键
string srcPath = @"temp-source-file";//本地文件绝对路径
COSXMLUploadTask uploadTask = new COSXMLUploadTask(bucket, cosPath);
uploadTask.SetSrcPath(srcPath);
transferManager.Upload(uploadTask);
}
//.cssg-snippet-body-end
}
/// 上传时对单链接限速
public void UploadObjectTrafficLimit()
{
//.cssg-snippet-body-start:[upload-object-traffic-limit]
TransferConfig transferConfig = new TransferConfig();
// 初始化 TransferManager
TransferManager transferManager = new TransferManager(cosXml, transferConfig);
string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
string cosPath = "dir/exampleObject"; // 对象键
string srcPath = @"temp-source-file";//本地文件绝对路径
PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, cosPath, srcPath);
putObjectRequest.LimitTraffic(8 * 1000 * 1000); // 限制为1MB/s
COSXMLUploadTask uploadTask = new COSXMLUploadTask(putObjectRequest);
uploadTask.SetSrcPath(srcPath);
transferManager.Upload(uploadTask);
//.cssg-snippet-body-end
}
/// 创建目录
public void CreateDirectory()
{
//.cssg-snippet-body-start:[create-directory]
try
{
string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
string cosPath = "dir/"; // 对象键
PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, cosPath, new byte[0]);
cosXml.PutObject(putObjectRequest);
}
catch (COSXML.CosException.CosClientException clientEx)
{
//请求失败
Console.WriteLine("CosClientException: " + clientEx);
}
catch (COSXML.CosException.CosServerException serverEx)
{
//请求失败
Console.WriteLine("CosServerException: " + serverEx.GetInfo());
}
//.cssg-snippet-body-end
}
// .cssg-methods-pragma
//static void Main(string[] args)
//{
// TransferUploadObjectModel m = new TransferUploadObjectModel();
// /// 高级接口上传对象
// m.TransferUploadFile();
// /// 高级接口上传二进制数据
// m.TransferUploadBytes();
// /// 高级接口流式上传
// m.TransferUploadStream();
// /// 高级接口 URI 上传
// m.TransferUploadUri();
// /// 上传暂停续传取消
// m.TransferUploadInteract();
// /// 批量上传
// m.TransferBatchUploadObjects();
// /// 上传时对单链接限速
// m.UploadObjectTrafficLimit();
// /// 创建目录
// m.CreateDirectory();
// // .cssg-methods-pragma
//}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Diagnostics.Tracing.EventSource.Redist" version="2.2.0" targetFramework="net461" />
<package id="MySql.Data" version="8.0.14" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="RabbitMQ.Client" version="5.2.0" targetFramework="net461" />
<package id="Tencent.QCloud.Cos.Sdk" version="5.4.13" targetFramework="net461" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<appSettings>
<add key="VoiceIndexPath" value="SearchIndex\\Voice" />
<!--更新汇率时间间隔以及获取第三方汇率https://www.cngold.org/fx/huansuan.html金投网-->
<add key="WithIntervalInMinutes" value="30" />
<add key="Number" value="1" />
<add key="Referer" value="https://www.cngold.org/fx/huansuan.html" />
<add key="RequestURL" value="https://api.jijinhao.com/plus/convert.htm" />
<!--获取中国银行实时汇率-->
<add key="ChinaBankReferer" value="http://srh.bankofchina.com/search/whpj/search_cn.jsp" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<connectionStrings>
<add name="DefaultConnection" providerName="MySql.Data.MySqlClient" connectionString="server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;port=3306;user id=reborn;password=Reborn@2018;database=uat_reborn_user;CharSet=utf8;Convert Zero Datetime=true;" />
<!--allow zero datetime=true;Convert Zero Datetime=true;-->
<add name="DMCConnection" providerName="MySql.Data.MySqlClient" connectionString="server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;port=3306;user id=reborn;password=Reborn@2018;database=uat_reborn_dmc;CharSet=utf8;Convert Zero Datetime=true;" />
<!--日志数据库-->
<add name="LogConnection" providerName="MySql.Data.MySqlClient" connectionString="server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;port=3306;user id=reborn;password=Reborn@2018;database=uat_reborn_log;CharSet=utf8;Convert Zero Datetime=true;" />
<!--销售数据库-->
<add name="SellConnection" providerName="MySql.Data.MySqlClient" connectionString="server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;port=3306;user id=reborn;password=Reborn@2018;database=uat_reborn_sell;CharSet=utf8;Convert Zero Datetime=true;" />
<!--财务数据库-->
<add name="FinanceConnection" providerName="MySql.Data.MySqlClient" connectionString="server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;port=3306;user id=reborn;password=Reborn@2018;database=uat_reborn_finance;CharSet=utf8;Convert Zero Datetime=true;" />
<!--国内票务-->
<add name="DomesticConnection" providerName="MySql.Data.MySqlClient" connectionString="server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;port=3306;user id=reborn;password=Reborn@2018;database=uat_reborn_domestic_ticket;CharSet=utf8;Convert Zero Datetime=true;" />
<!--统计数据库-->
<add name="DataStatisticsConnection" providerName="MySql.Data.MySqlClient" connectionString="server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;port=3306;user id=reborn;password=Reborn@2018;database=uat_reborn_datastatistics;CharSet=utf8; Convert Zero Datetime=true;" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.86.0.518" newVersion="0.86.0.518" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.14.0" newVersion="8.0.14.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
\ No newline at end of file
namespace REBORN.QuartClient
{
partial class ClientServerControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnStopServer = new System.Windows.Forms.Button();
this.btnUninstallServer = new System.Windows.Forms.Button();
this.btnStartServer = new System.Windows.Forms.Button();
this.btnInstallationServer = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnStopServer
//
this.btnStopServer.Location = new System.Drawing.Point(12, 56);
this.btnStopServer.Name = "btnStopServer";
this.btnStopServer.Size = new System.Drawing.Size(75, 23);
this.btnStopServer.TabIndex = 6;
this.btnStopServer.Text = "停止服务";
this.btnStopServer.UseVisualStyleBackColor = true;
this.btnStopServer.Click += new System.EventHandler(this.btnStopServer_Click);
//
// btnUninstallServer
//
this.btnUninstallServer.Location = new System.Drawing.Point(142, 56);
this.btnUninstallServer.Name = "btnUninstallServer";
this.btnUninstallServer.Size = new System.Drawing.Size(75, 23);
this.btnUninstallServer.TabIndex = 7;
this.btnUninstallServer.Text = "卸载服务";
this.btnUninstallServer.UseVisualStyleBackColor = true;
this.btnUninstallServer.Click += new System.EventHandler(this.btnUninstallServer_Click);
//
// btnStartServer
//
this.btnStartServer.Location = new System.Drawing.Point(142, 12);
this.btnStartServer.Name = "btnStartServer";
this.btnStartServer.Size = new System.Drawing.Size(75, 23);
this.btnStartServer.TabIndex = 5;
this.btnStartServer.Text = "启动服务";
this.btnStartServer.UseVisualStyleBackColor = true;
this.btnStartServer.Click += new System.EventHandler(this.btnStartServer_Click);
//
// btnInstallationServer
//
this.btnInstallationServer.Location = new System.Drawing.Point(12, 12);
this.btnInstallationServer.Name = "btnInstallationServer";
this.btnInstallationServer.Size = new System.Drawing.Size(75, 23);
this.btnInstallationServer.TabIndex = 4;
this.btnInstallationServer.Text = "安装服务";
this.btnInstallationServer.UseVisualStyleBackColor = true;
this.btnInstallationServer.Click += new System.EventHandler(this.btnInstallationServer_Click);
//
// ClientServerControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(265, 86);
this.Controls.Add(this.btnStopServer);
this.Controls.Add(this.btnUninstallServer);
this.Controls.Add(this.btnStartServer);
this.Controls.Add(this.btnInstallationServer);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ClientServerControl";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Reborn定时器服务控制台";
this.Load += new System.EventHandler(this.SocketServerControl_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnStopServer;
private System.Windows.Forms.Button btnUninstallServer;
private System.Windows.Forms.Button btnStartServer;
private System.Windows.Forms.Button btnInstallationServer;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>F:\发布2\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>zh-CN</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace REBORN.QuartClient
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ClientServerControl());
}
}
}
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.3" targetFramework="net46" />
<package id="SuperSocket" version="1.6.6.1" targetFramework="net46" />
<package id="SuperSocket.Engine" version="1.6.6.1" targetFramework="net46" />
</packages>
\ No newline at end of file
......@@ -3916,7 +3916,7 @@ namespace Mall.Module.Product
{
return ApiResult.Failed("商品服务类型不一致");
}
int uday = Convert.ToInt32((gmodel.UseDay ?? 0).Equals(0.5) ? 1 : (gmodel.UseDay ?? 0));
int uday = Convert.ToInt32((gmodel.UseDay ?? 0).Equals(Convert.ToDecimal(0.5)) ? 1 : (gmodel.UseDay ?? 0));
if (demodel.TripSTime.Value.AddDays(uday - 1).ToString("yyyy-MM-dd") != demodel.TripETime.Value.ToString("yyyy-MM-dd"))
{
return ApiResult.Failed("预定日期与商品使用天数不一致");
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment