Skip to content

Commit

Permalink
更新依赖包。并更新editor到最新版
Browse files Browse the repository at this point in the history
  • Loading branch information
hogenwang committed Mar 29, 2023
1 parent dcca21b commit 02db388
Show file tree
Hide file tree
Showing 186 changed files with 702 additions and 511 deletions.
6 changes: 3 additions & 3 deletions COMCMS.API/COMCMS.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NewLife.Core" Version="10.1.2022.1201" />
<PackageReference Include="Senparc.Weixin" Version="6.15.7" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.18.9" />
<PackageReference Include="NewLife.Core" Version="10.2.2023.301" />
<PackageReference Include="Senparc.Weixin" Version="6.15.8.7" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.18.10.6" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions COMCMS.Common/COMCMS.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="NewLife.Core" Version="10.1.2022.1201" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NewLife.Core" Version="10.2.2023.301" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
<PackageReference Include="SkiaSharp" Version="2.88.3" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.3" />
Expand Down
119 changes: 6 additions & 113 deletions COMCMS.Common/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Net.Sockets;
using System.Runtime.InteropServices;
using NewLife.Caching;
using System.Net.Http;

namespace COMCMS.Common
{
Expand Down Expand Up @@ -1214,127 +1215,19 @@ public static string DelLastChar(string str, string strchar)
/// <returns></returns>
public static string HttpGet(string url)
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "GET";
//request.ContentType = "application/x-www-form-urlencoded";
request.Accept = "*/*";
request.Proxy = null;
request.Timeout = 15000;
request.AllowAutoRedirect = false;

WebResponse response = null;
//使用webclient http get
string responseStr = null;

try
using (HttpClient client = new HttpClient())
{
response = request.GetResponse();

if (response != null)
var re = client.GetAsync(url).Result;
if (re.IsSuccessStatusCode)
{
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
responseStr = reader.ReadToEnd();
reader.Close();
responseStr = re.Content.ReadAsStringAsync().Result;
}
}
catch (Exception ex)
{
NewLife.Log.XTrace.WriteException(ex);
throw;
}
finally
{
request = null;
response = null;
}

return responseStr;
}

/// <summary>
/// 后台发送POST请求
/// </summary>
/// <param name="url">服务器地址</param>
/// <param name="data">发送的数据</param>
/// <returns></returns>
public static Stream HttpPost(string url, string data)
{
try
{
//创建post请求
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/json;charset=UTF-8";
byte[] payload = Encoding.UTF8.GetBytes(data);
request.ContentLength = payload.Length;


//发送post的请求
Stream writer = request.GetRequestStream();
writer.Write(payload, 0, payload.Length);
writer.Close();

//接受返回来的数据
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
return stream;
//StreamReader reader = new StreamReader(stream, Encoding.UTF8);
//string value = reader.ReadToEnd();

//reader.Close();
//stream.Close();
//response.Close();

//return value;
}
catch (Exception ex)
{
NewLife.Log.XTrace.WriteException(ex);
return null;
}
}

/// <summary>
/// 后台发送POST请求
/// </summary>
/// <param name="url">服务器地址</param>
/// <param name="data">发送的数据</param>
/// <returns></returns>
public static string HttpPostAndReturnString(string url, string data)
{
try
{
//创建post请求
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/json;charset=UTF-8";
byte[] payload = Encoding.UTF8.GetBytes(data);
request.ContentLength = payload.Length;


//发送post的请求
Stream writer = request.GetRequestStream();
writer.Write(payload, 0, payload.Length);
writer.Close();

//接受返回来的数据
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
string value = reader.ReadToEnd();

reader.Close();
stream.Close();
response.Close();

return value;
}
catch (Exception ex)
{
NewLife.Log.XTrace.WriteException(ex);
return "";
}
}

/// <summary>
/// 将对象转换为Int32类型
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions COMCMS.Core/COMCMS.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NewLife.XCode" Version="11.5.2022.1201" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NewLife.XCode" Version="11.6.2023.302" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
23 changes: 15 additions & 8 deletions COMCMS.Web/Areas/AdminCP/Controllers/WeixinController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
using Senparc.Weixin.MP.Entities.Menu;
using System.IO;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;

namespace COMCMS.Web.Areas.AdminCP.Controllers
{
Expand Down Expand Up @@ -73,7 +75,7 @@ public IActionResult Menu()
//修改菜单
[HttpPost]
[MyAuthorize("edit", "wxmenu", "JSON")]
public IActionResult DoPostMenuData(string allmenu)
public async Task<IActionResult> DoPostMenuData(string allmenu)
{

Config cfg = Config.GetSystemConfig();
Expand Down Expand Up @@ -102,13 +104,18 @@ public IActionResult DoPostMenuData(string allmenu)
//Senparc.Weixin.MP.CommonAPIs.CommonApi.CreateMenu()
string posturl = $"https://api.weixin.qq.com/cgi-bin/menu/create?access_token={accessToken}";

Stream retunStream = Utils.HttpPost(posturl, allmenu);

StreamReader reader = new StreamReader(retunStream, Encoding.UTF8);
string value = reader.ReadToEnd();

reader.Close();

HttpContent content = new StringContent(allmenu);
string value = string.Empty;
using (HttpClient client = new HttpClient())
{
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
var re = await client.PostAsync(posturl, content);
string responseString = re.Content.ReadAsStringAsync().Result;
if (!string.IsNullOrEmpty(responseString))
{
value = responseString;
}
}
XTrace.WriteLine("创建公众号菜单回传:" + value);

dynamic rejson = Newtonsoft.Json.Linq.JToken.Parse(value) as dynamic;
Expand Down
30 changes: 15 additions & 15 deletions COMCMS.Web/COMCMS.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MailKit" Version="3.4.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.0" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.0" />
<PackageReference Include="MimeKit" Version="3.4.3" />
<PackageReference Include="MySql.Data" Version="8.0.31" />
<PackageReference Include="NewLife.XCode" Version="11.5.2022.1201" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Senparc.NeuChar" Version="2.1.2" />
<PackageReference Include="Senparc.Weixin" Version="6.15.7" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.18.9" />
<PackageReference Include="MailKit" Version="3.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.4" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.4" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.5" />
<PackageReference Include="MimeKit" Version="3.6.1" />
<PackageReference Include="MySql.Data" Version="8.0.32.1" />
<PackageReference Include="NewLife.XCode" Version="11.6.2023.302" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Senparc.NeuChar" Version="2.1.3.5" />
<PackageReference Include="Senparc.Weixin" Version="6.15.8.7" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.18.10.6" />
<PackageReference Include="Senparc.Weixin.MP.MvcExtension" Version="4.1.1" />
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.12.4" />
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.15.9" />
<PackageReference Include="Senparc.Weixin.TenPay" Version="1.12.5.7" />
<PackageReference Include="Senparc.Weixin.WxOpen" Version="3.15.13" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
</ItemGroup>

Expand Down
Loading

0 comments on commit 02db388

Please sign in to comment.