From b175c0780a3d3c41a41249f22911e70a6622d6bf Mon Sep 17 00:00:00 2001 From: jianweie code Date: Thu, 11 May 2023 00:18:40 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E5=BE=AE=E4=BF=A1=E5=85=AC=E4=BC=97=E5=8F=B7=E5=8F=8A?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AFWAP=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E4=B8=8B=EF=BC=8CH5=E7=AB=AF=E7=9A=84=E5=A4=9A=E7=A7=8D?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=8A=9F=E8=83=BD=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CoreCms.Net.Model/CoreCms.Net.Model.xml | 15 +++++++++++ .../FromBody/FMWeChatOffiaccount.cs | 26 +++++++++++++++++++ .../WeChatOffiaccountController.cs | 10 ++++--- .../CoreCms.Net.Web.WebApi.xml | 2 +- 4 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 CoreCms.Net.Model/FromBody/FMWeChatOffiaccount.cs diff --git a/CoreCms.Net.Model/CoreCms.Net.Model.xml b/CoreCms.Net.Model/CoreCms.Net.Model.xml index 6fdd4a24..2d4b9503 100644 --- a/CoreCms.Net.Model/CoreCms.Net.Model.xml +++ b/CoreCms.Net.Model/CoreCms.Net.Model.xml @@ -10832,6 +10832,21 @@ 提现方式 + + + + + + + + 请求网址 + + + + + 请求授权 + + 小程序提交数据标准接收实体 diff --git a/CoreCms.Net.Model/FromBody/FMWeChatOffiaccount.cs b/CoreCms.Net.Model/FromBody/FMWeChatOffiaccount.cs new file mode 100644 index 00000000..12817b3d --- /dev/null +++ b/CoreCms.Net.Model/FromBody/FMWeChatOffiaccount.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoreCms.Net.Model.FromBody +{ + /// + /// + /// + public class FMGetWeChatConfig + { + /// + /// 请求网址 + /// + public string url { get; set; } + + /// + /// 请求授权 + /// + + public string token { get; set; } = string.Empty; + + } +} diff --git a/CoreCms.Net.Web.WebApi/Controllers/WeChatOffiaccountController.cs b/CoreCms.Net.Web.WebApi/Controllers/WeChatOffiaccountController.cs index fe048c02..b0162040 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/WeChatOffiaccountController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/WeChatOffiaccountController.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using CoreCms.Net.Caching.AccressToken; using CoreCms.Net.Model; +using CoreCms.Net.Model.FromBody; using CoreCms.Net.WeChat.Service.Enums; using CoreCms.Net.WeChat.Service.HttpClients; using CoreCms.Net.WeChat.Service.Options; @@ -44,15 +45,15 @@ namespace CoreCms.Net.Web.WebApi.Controllers /// [HttpPost] [Authorize] - public IActionResult GetWeChatConfig() + public IActionResult GetWeChatConfig(FMGetWeChatConfig entity) { //获取全局缓存的jsapi_ticket var jsApiTicket = WeChatCacheAccessTokenHelper.GetWeChatJsApiTicket(); var nonceStr = CoreCms.Net.Utility.Helper.CommonHelper.GetSerialNumber(); var timestamp = CoreCms.Net.Utility.Helper.CommonHelper.GetTimeStampByTotalSeconds().ToString(); - var url = Request.GetTypedHeaders().Referer; + //var url = Request.GetTypedHeaders().Referer; //获取前面 - var signatureStr = "jsapi_ticket=" + jsApiTicket + "&noncestr=" + nonceStr + "×tamp=" + timestamp + "&url=" + url; + var signatureStr = "jsapi_ticket=" + jsApiTicket + "&noncestr=" + nonceStr + "×tamp=" + timestamp + "&url=" + entity.url; var signature = CoreCms.Net.Utility.Helper.CommonHelper.Sha1Signature(signatureStr); return new JsonResult(new @@ -62,7 +63,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers timestamp, nonceStr, signature, - url + entity.url, + entity }); } diff --git a/CoreCms.Net.Web.WebApi/CoreCms.Net.Web.WebApi.xml b/CoreCms.Net.Web.WebApi/CoreCms.Net.Web.WebApi.xml index ab448627..46020818 100644 --- a/CoreCms.Net.Web.WebApi/CoreCms.Net.Web.WebApi.xml +++ b/CoreCms.Net.Web.WebApi/CoreCms.Net.Web.WebApi.xml @@ -1514,7 +1514,7 @@ - + JS-SDK使用权限签名算法