From 57b7855595f40b62206bbaf8e761e50001382b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=81=B0=E7=81=B0?= Date: Sat, 20 Aug 2022 01:26:56 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E4=BA=A4=E6=98=93=E7=BB=84=E4=BB=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E3=80=90=E8=8E=B7=E5=8F=96=E5=95=86=E5=AE=B6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E3=80=91=E3=80=90=E6=9B=B4=E6=96=B0=E5=95=86=E5=AE=B6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E3=80=91=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FromBody/FMUpdateInfo.cs | 69 ++++++ .../Order/CoreCmsOrderController.cs | 2 +- ...atTransactionComponentAccountController.cs | 117 +++++++++ ...ransactionComponentBrandAuditController.cs | 2 +- ...ctionComponentDeliveryCompanyController.cs | 2 +- ...eChatTransactionComponentGoodController.cs | 2 +- ...sactionComponentThirdCategoryController.cs | 2 +- .../CoreCms.Net.Web.Admin.csproj | 1 + .../accountinfo/getinfo.html | 223 ++++++++++++++++++ 9 files changed, 415 insertions(+), 5 deletions(-) create mode 100644 CoreCms.Net.WeChat.Service/TransactionComponent/FromBody/FMUpdateInfo.cs create mode 100644 CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentAccountController.cs create mode 100644 CoreCms.Net.Web.Admin/wwwroot/views/wechat/transactioncomponent/accountinfo/getinfo.html diff --git a/CoreCms.Net.WeChat.Service/TransactionComponent/FromBody/FMUpdateInfo.cs b/CoreCms.Net.WeChat.Service/TransactionComponent/FromBody/FMUpdateInfo.cs new file mode 100644 index 00000000..d082bdde --- /dev/null +++ b/CoreCms.Net.WeChat.Service/TransactionComponent/FromBody/FMUpdateInfo.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoreCms.Net.WeChat.Service.TransactionComponent.FromBody +{ + /// + /// 更新商家信息提交 + /// + public class FMUpdateInfo + { + + /// + /// 小程序path + /// + public string service_agent_path { get; set; } + /// + /// + /// + public string service_agent_phone { get; set; } + /// + /// + /// + public List service_agent_type { get; set; } + /// + /// + /// + public Default_receiving_address default_receiving_address { get; set; } + + } + + /// + /// 默认退货地址,退货售后超时时,会让用户将货物寄往此地址。 + /// + public class Default_receiving_address + { + /// + /// 张三 + /// + public string receiver_name { get; set; } + /// + /// 详细收货地址信息 + /// + public string detailed_address { get; set; } + /// + /// 收货人电话 + /// + public string tel_number { get; set; } + /// + /// 国家 + /// + public string country { get; set; } + /// + /// 省份 + /// + public string province { get; set; } + /// + /// 城市 + /// + public string city { get; set; } + /// + /// 区县 + /// + public string town { get; set; } + } + +} diff --git a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsOrderController.cs b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsOrderController.cs index fc185d3b..a77cd7a2 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsOrderController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsOrderController.cs @@ -66,7 +66,7 @@ namespace CoreCms.Net.Web.Admin.Controllers private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices; private readonly IWeChatTransactionComponentDeliveryCompanyServices _tcDeliveryCompanyServices; private readonly IRedisOperationRepository _redisOperationRepository; - private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; + private readonly Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; private readonly ICoreCmsOrderItemServices _orderItemServices; diff --git a/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentAccountController.cs b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentAccountController.cs new file mode 100644 index 00000000..76d2ed80 --- /dev/null +++ b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentAccountController.cs @@ -0,0 +1,117 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System.ComponentModel; +using System.Linq; +using System.Threading.Tasks; +using CoreCms.Net.Caching.AccressToken; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.UI; +using CoreCms.Net.WeChat.Service.HttpClients; +using SKIT.FlurlHttpClient.Wechat.Api; +using SKIT.FlurlHttpClient.Wechat.Api.Models; +using CoreCms.Net.WeChat.Service.TransactionComponent.FromBody; + +namespace CoreCms.Net.Web.Admin.Controllers.WeChat +{ + /// + /// 自定义交易组件上传类目资质 + /// + [Description("自定义交易组件上传类目资质")] + [Route("api/[controller]/[action]")] + [ApiController] + public class WeChatTransactionComponentAccountController : ControllerBase + { + private readonly Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; + + /// + /// 构造函数 + /// + /// + public WeChatTransactionComponentAccountController(IWeChatApiHttpClientFactory weChatApiHttpClientFactory) + { + _weChatApiHttpClientFactory = weChatApiHttpClientFactory; + } + + + #region 获取商家信息============================================================ + // POST: Api/WeChatTransactionComponentAccount/GetInfo + /// + /// 获取商家信息 + /// + /// + [HttpPost] + [Description("获取商家信息")] + public async Task GetInfo() + { + var jm = new AdminUiCallBack(); + + + var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken(); + var client = _weChatApiHttpClientFactory.CreateWxOpenClient(); + var request = new ShopAccountGetInfoRequest(); + request.AccessToken = accessToken; + + var response = await client.ExecuteShopAccountGetInfoAsync(request); + + jm.code = response.IsSuccessful() ? 0 : 1; + jm.msg = response.IsSuccessful() ? "获取成功" : response.ErrorMessage; + jm.data = response.Data; + + jm.otherData = new + { + service_agent_type_service = response.Data.ServiceAgentTypeList?.Contains(0) == true ? 0 : -1, + service_agent_type_phone = response.Data.ServiceAgentTypeList?.Contains(2) == true ? 0 : -1, + service_agent_type_path = response.Data.ServiceAgentTypeList?.Contains(1) == true ? 0 : -1, + }; + + + + return jm; + } + #endregion + + #region 更新商家信息============================================================ + // POST: Api/WeChatTransactionComponentAccount/DoUpdateInfo + /// + /// 更新商家信息 + /// + /// + /// + [HttpPost] + [Description("更新商家信息")] + public async Task DoUpdateInfo([FromBody] FMUpdateInfo entity) + { + var jm = new AdminUiCallBack { code = 0 }; + + var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken(); + var client = _weChatApiHttpClientFactory.CreateWxOpenClient(); + var request = new ShopAccountUpdateInfoRequest(); + request.AccessToken = accessToken; + + request.ServiceAgentTypeList = entity.service_agent_type; + request.ServiceAgentPagePath = entity.service_agent_path; + request.ServiceAgentPhoneNumber = entity.service_agent_phone; + + request.DefaultReceivingAddress = new ShopAccountUpdateInfoRequest.Types.Address(); + request.DefaultReceivingAddress.ReceiverName = entity.default_receiving_address.receiver_name; + request.DefaultReceivingAddress.Detail = entity.default_receiving_address.detailed_address; + request.DefaultReceivingAddress.TeleNumber = entity.default_receiving_address.tel_number; + request.DefaultReceivingAddress.Country = entity.default_receiving_address.country; + request.DefaultReceivingAddress.Province = entity.default_receiving_address.province; + request.DefaultReceivingAddress.City = entity.default_receiving_address.city; + request.DefaultReceivingAddress.District = entity.default_receiving_address.town; + + var response = await client.ExecuteShopAccountUpdateInfoAsync(request); + + jm.code = response.IsSuccessful() ? 0 : 1; + jm.msg = response.IsSuccessful() ? "更新成功" : response.ErrorMessage; + + jm.data = entity; + + return jm; + } + #endregion + + + } +} diff --git a/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentBrandAuditController.cs b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentBrandAuditController.cs index 0ae87ae3..0b97ae57 100644 --- a/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentBrandAuditController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentBrandAuditController.cs @@ -51,7 +51,7 @@ namespace CoreCms.Net.Web.Admin.Controllers { private readonly IWebHostEnvironment _webHostEnvironment; private readonly IWeChatTransactionComponentBrandAuditServices _weChatTransactionComponentBrandAuditServices; - private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; + private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; /// /// 构造函数 diff --git a/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentDeliveryCompanyController.cs b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentDeliveryCompanyController.cs index d70e29c8..98a1f210 100644 --- a/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentDeliveryCompanyController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentDeliveryCompanyController.cs @@ -46,7 +46,7 @@ namespace CoreCms.Net.Web.Admin.Controllers { private readonly IWebHostEnvironment _webHostEnvironment; private readonly IWeChatTransactionComponentDeliveryCompanyServices _weChatTransactionComponentDeliveryCompanyServices; - private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; + private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; /// diff --git a/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentGoodController.cs b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentGoodController.cs index 9dcd10ff..f0cd3e26 100644 --- a/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentGoodController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentGoodController.cs @@ -54,7 +54,7 @@ namespace CoreCms.Net.Web.Admin.Controllers private readonly IWeChatTransactionComponentAuditCategoryServices _weChatTransactionComponentAuditCategoryServices; private readonly ICoreCmsProductsServices _productsServices; - private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; + private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; private readonly IWeChatTransactionComponentBrandAuditServices _weChatTransactionComponentBrandAuditServices; diff --git a/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentThirdCategoryController.cs b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentThirdCategoryController.cs index 8a5ba3a3..6a4410f2 100644 --- a/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentThirdCategoryController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/WeChat/WeChatTransactionComponentThirdCategoryController.cs @@ -49,7 +49,7 @@ namespace CoreCms.Net.Web.Admin.Controllers { private readonly IWebHostEnvironment _webHostEnvironment; private readonly IWeChatTransactionComponentThirdCategoryServices _weChatTcThirdCatListServices; - private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; + private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; /// diff --git a/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.csproj b/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.csproj index 82b1e174..32383372 100644 --- a/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.csproj +++ b/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.csproj @@ -45,6 +45,7 @@ + diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/wechat/transactioncomponent/accountinfo/getinfo.html b/CoreCms.Net.Web.Admin/wwwroot/views/wechat/transactioncomponent/accountinfo/getinfo.html new file mode 100644 index 00000000..c28b35c3 --- /dev/null +++ b/CoreCms.Net.Web.Admin/wwwroot/views/wechat/transactioncomponent/accountinfo/getinfo.html @@ -0,0 +1,223 @@ + + + + + +