mirror of
https://github.com/CoreUnion/CoreShop.git
synced 2026-10-18 22:44:49 +08:00
94e5145b7b
* 1、【后端】移除业务逻辑中的【MediatR】及中介者模式,启用【Redis队列】处理。 * Merge branch 'develop' into dahuihui/develop * 升级编辑器为CKEditor5 * Merge branch 'develop' into dahuihui/develop * Merge branch 'develop' into dahuihui/develop * 【后端】优化后端设置权限角色,反射controller和action的效率问题。 * 【后端】修复后端编辑商品问题。 * 【后端】修复腾讯云cos存储未调用bucket问题。#I42DF0 * Merge branch 'develop' into dahuihui/develop * 启用新域名及演示平台 * Merge branch 'develop' into dahuihui/develop * Merge branch 'develop' into dahuihui/develop * 调整说明 * Merge branch 'develop' into dahuihui/develop * 删除不需要的菜单 * 修复域名转发获取ip地址长度过长问题。 * 1、【后端】调整全局错误返回提示语。2、【数据库】修复20日删除3个表后,未清理干净问题。 * Merge branch 'develop' into dahuihui/develop * Merge branch 'develop' into dahuihui/develop * 调整全局错误返回提示语 * 修复商品批量处理报错的问题并优化展示界面。#I3X8PP * Merge branch 'develop' into dahuihui/develop * Merge branch 'develop' into dahuihui/develop * 增加过滤敏感词的功能。#I3W6CM * 增加Issue 和 Pull Request 模板 * 修复自定义上传路径上传至站点根目录,而非wwwroot的问题 #I41TD1 * Merge branch 'develop' into dahuihui/develop * 修复自定义上传路径的表单命名异常问题 * 使用新数据库 * 【数据库】修复mysql数据库decimal类型未带小数的问题。#I3WAUY * 更新数据库及脚本 * 2021-07-20 * Merge branch 'develop' into dahuihui/develop * 修复webapi不进入调试断点的问题。 * Merge branch 'develop' into dahuihui/develop * 修复后台前后端分离table面板启用自定义域名问题。 * 修复后台前后端分离域名未增加到html问题。 * Merge branch 'develop' into dahuihui/develop * 【后端】修复修改登录用户真实姓名长度问题。 * 修复后台管理配送方式维护错误问题 * 1、修复小程序注册问题,导致交互事情。不然盛派的组件有bug,在不注册微信公众号只注册微信小程序的时候,进行小程序消息操作,默认还是走的是微… * 修复消息模板不推送的问题 * Merge branch 'develop' into dahuihui/develop * Merge branch 'develop' into dahuihui/develop * 修复过期失效文档 * 调整代码生成器,增加初始化事务 * 调整接口端提示界面 * 修复弹窗不居中问题 * 调整一些命名方式 * 修复uni-app前端,用户订单列表【确认收货】按钮失效问题 * 1、修复mysql数据库下,报表统计sql的语法错误。2、为方便前端在不部署接口及后端的情况下测试uni-app前端,默认增加了测试接口地址… * Merge branch 'develop' into dahuihui/develop * 调整命名 * 增加docker-compose部署 * Merge branch 'develop' into dahuihui/develop * 修复因linux下存在数据与文件名称大小写不对应,导致找不到数据库表的问题,特重新发布一份表名与实体名称一一对应脚本。 * 新mysql表名存在大小写问题
98 lines
3.4 KiB
C#
98 lines
3.4 KiB
C#
/***********************************************************************
|
|
* Project: CoreCms
|
|
* ProjectName: 核心内容管理系统
|
|
* Web: https://www.corecms.net
|
|
* Author: 大灰灰
|
|
* Email: jianweie@163.com
|
|
* CreateTime: 2021/7/29 23:21:06
|
|
* Description: 暂无
|
|
***********************************************************************/
|
|
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
using System.Xml.Linq;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace CoreCms.Net.WeChat.Service.Utilities
|
|
{
|
|
/// <summary>XML 工具类</summary>
|
|
public static class XmlUtility
|
|
{
|
|
/// <summary>反序列化</summary>
|
|
/// <param name="xml">XML字符串</param>
|
|
/// <returns></returns>
|
|
public static object Deserialize<T>(string xml)
|
|
{
|
|
try
|
|
{
|
|
using (StringReader stringReader = new StringReader(xml))
|
|
return new XmlSerializer(typeof(T)).Deserialize((TextReader)stringReader);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine((object)ex);
|
|
return (object)null;
|
|
}
|
|
}
|
|
|
|
/// <summary>反序列化</summary>
|
|
/// <param name="stream"></param>
|
|
/// <returns></returns>
|
|
public static object Deserialize<T>(Stream stream) => new XmlSerializer(typeof(T)).Deserialize(stream);
|
|
|
|
/// <summary>
|
|
/// 序列化
|
|
/// 说明:此方法序列化复杂类,如果没有声明XmlInclude等特性,可能会引发“使用 XmlInclude 或 SoapInclude 特性静态指定非已知的类型。”的错误。
|
|
/// </summary>
|
|
/// <param name="obj">对象</param>
|
|
/// <returns></returns>
|
|
public static string Serializer<T>(T obj)
|
|
{
|
|
MemoryStream memoryStream = new MemoryStream();
|
|
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
|
|
try
|
|
{
|
|
xmlSerializer.Serialize((Stream)memoryStream, (object)obj);
|
|
}
|
|
catch (InvalidOperationException)
|
|
{
|
|
throw;
|
|
}
|
|
memoryStream.Position = 0L;
|
|
StreamReader streamReader = new StreamReader((Stream)memoryStream);
|
|
string end = streamReader.ReadToEnd();
|
|
streamReader.Dispose();
|
|
memoryStream.Dispose();
|
|
return end;
|
|
}
|
|
|
|
/// <summary>序列化将流转成XML字符串</summary>
|
|
/// <param name="stream"></param>
|
|
/// <returns></returns>
|
|
public static XDocument Convert(Stream stream)
|
|
{
|
|
if (stream.CanSeek)
|
|
stream.Seek(0L, SeekOrigin.Begin);
|
|
using (XmlReader reader = XmlReader.Create(stream))
|
|
return XDocument.Load(reader);
|
|
}
|
|
|
|
/// <summary>序列化将流转成XML字符串</summary>
|
|
/// <param name="stream"></param>
|
|
/// <returns></returns>
|
|
public static string ConvertToString(Stream stream)
|
|
{
|
|
StreamReader reader = new StreamReader(stream);
|
|
string sHtml = reader.ReadToEnd();
|
|
return sHtml;
|
|
}
|
|
|
|
}
|
|
}
|