From d6e560e1d30bd6af259b0c07ffb51b9caf8ab925 Mon Sep 17 00:00:00 2001 From: 移动系统liao <liaoxujun@qq.com> Date: 星期四, 15 八月 2024 10:17:04 +0800 Subject: [PATCH] 萨达 --- cylsg/EzUpFile/EzUpFile.csproj | 9 cylsg/EzWechat/WechatConfig.json | 6 .gitignore | 4 cylsg/cylsg.redis/RedisConfig.json | 2 cylsg/EzTencentCloud/Class1.cs | 7 cylsg/cylsg.sln | 18 + cylsg/cylsg.Web.Core/Startup.cs | 18 + cylsg/cylsg.Web.Entry/SingleFilePublish.cs | 5 cylsg/cylsg.Web.Entry/appsettings.json | 6 cylsg/EzWechat/EzWechat.csproj | 7 cylsg/cylsg.Application/cylsg.Application.xml | 58 +++++ cylsg/cylsg.Application/cylsg.Application.csproj | 4 cylsg/EzWechat/IWechatService.cs | 15 + cylsg/cylsg.redis/cylsg.redis.csproj | 6 cylsg/EzTencentCloud/ITencentCloudService.cs | 29 ++ cylsg/cylsg.Model/UserModel/User.cs | 13 cylsg/EzTencentCloud/EzTencentCloud.csproj | 23 ++ cylsg/EzTencentCloud/TencentCloudConfig.json | 6 cylsg/EzWechat/WechatService.cs | 83 +++++++ cylsg/cylsg.Application/applicationsettings.json | 12 cylsg/cylsg.Authorization/IEzAuthorizationService.cs | 2 cylsg/cylsg.Web.Entry/Properties/launchSettings.json | 4 cylsg/cylsg.Web.Entry/cylsg.Web.Entry.csproj | 1 cylsg/cylsg.Application/LogoInController.cs | 163 ++++++++++++++ cylsg/EzTencentCloud/TencentCloudService.cs | 141 ++++++++++++ cylsg/EzUpFile/Class1.cs | 7 26 files changed, 618 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 6d2e95a..f80bbf4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,7 @@ cylsg/EzUpFiles/obj/ cylsg/EzWechat/obj/ cylsg/cylsg.redis/bin/ +cylsg/EzWechat/bin/ +cylsg/EzTencentCloud/bin/ +cylsg/EzTencentCloud/obj/ +cylsg/EzUpFile/obj/ diff --git a/cylsg/EzTencentCloud/Class1.cs b/cylsg/EzTencentCloud/Class1.cs new file mode 100644 index 0000000..5238cf9 --- /dev/null +++ b/cylsg/EzTencentCloud/Class1.cs @@ -0,0 +1,7 @@ +锘縩amespace EzTencentCloud +{ + public class Class1 + { + + } +} diff --git a/cylsg/EzTencentCloud/EzTencentCloud.csproj b/cylsg/EzTencentCloud/EzTencentCloud.csproj new file mode 100644 index 0000000..8734b39 --- /dev/null +++ b/cylsg/EzTencentCloud/EzTencentCloud.csproj @@ -0,0 +1,23 @@ +锘�<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net8.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="TencentCloudSDK" Version="3.0.1069" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="..\cylsg.Core\cylsg.Core.csproj" /> + </ItemGroup> + + <ItemGroup> + <None Update="TencentCloudConfig.json"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + </ItemGroup> + +</Project> diff --git a/cylsg/EzTencentCloud/ITencentCloudService.cs b/cylsg/EzTencentCloud/ITencentCloudService.cs new file mode 100644 index 0000000..8a43e16 --- /dev/null +++ b/cylsg/EzTencentCloud/ITencentCloudService.cs @@ -0,0 +1,29 @@ +锘縰sing Furion.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TencentCloud.Ocr.V20181119.Models; + +namespace EzTencentCloud +{ + /// <summary> + /// 鑵捐浜戞湇鍔� + /// </summary> + public interface ITencentCloudService: IScoped + { + /// <summary> + /// 韬唤璇佽瘑鍒紝骞跺壀瑁� + /// </summary> + /// <param name="ImageBase64"></param> + /// <param name="isFRONT"></param> + /// <returns></returns> + IDCardOCRResponse IdCord(string ImageBase64, bool isFRONT); + /// <summary> + /// 鑾峰彇鍓鍚庣殑韬唤璇佺収鐗� + /// </summary> + /// <returns></returns> + string GetIdCordImg(); + } +} diff --git a/cylsg/EzTencentCloud/TencentCloudConfig.json b/cylsg/EzTencentCloud/TencentCloudConfig.json new file mode 100644 index 0000000..e52425a --- /dev/null +++ b/cylsg/EzTencentCloud/TencentCloudConfig.json @@ -0,0 +1,6 @@ +{ + "TencentCloud": { + "SecretId": "AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T", + "SecretKey": "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n" + } +} diff --git a/cylsg/EzTencentCloud/TencentCloudService.cs b/cylsg/EzTencentCloud/TencentCloudService.cs new file mode 100644 index 0000000..5d2919d --- /dev/null +++ b/cylsg/EzTencentCloud/TencentCloudService.cs @@ -0,0 +1,141 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using TencentCloud.Ocr.V20181119; +using TencentCloud.Ocr.V20181119.Models; +using Newtonsoft.Json; +using TencentCloud.Common; +using TencentCloud.Common.Profile; +using Furion.DependencyInjection; +using Furion; + +namespace EzTencentCloud +{ + public class TencentCloudService: ITencentCloudService, IScoped + { + /// <summary> + /// 鍓鍚庣殑韬唤璇佸浘鐗� + /// </summary> + public string CropIdCard { get; set; } + + public string GetIdCordImg() + { + if (string.IsNullOrEmpty(CropIdCard)) + return ""; + else + return CropIdCard; + + } + + public IDCardOCRResponse IdCord(string ImageBase64, bool isFRONT) + { + try + { + Credential cred = new Credential + { + SecretId = App.Configuration["TencentCloud:SecretId"] ??"AKIDIPFp9CyThfMmvoQlpeCl34pKYVBahY9T", + SecretKey = App.Configuration["TencentCloud:SecretKey"] ?? "4rNcaHhrkMhmb9QQ9bmgKipfFZcOt86n" + }; + + ClientProfile clientProfile = new ClientProfile(); + HttpProfile httpProfile = new HttpProfile(); + + + httpProfile.Endpoint = ("ocr.tencentcloudapi.com"); + clientProfile.HttpProfile = httpProfile; + + OcrClient client = new OcrClient(cred, "ap-beijing", clientProfile); + IDCardOCRRequest req = new IDCardOCRRequest(); + if (isFRONT) + req.CardSide = "FRONT"; + else + req.CardSide = "BACK"; + req.ImageBase64 = ImageBase64; + + req.Config = JsonConvert.SerializeObject(new + { + //韬唤璇佺収鐗囪鍓紙鍘绘帀璇佷欢澶栧浣欑殑杈圭紭銆佽嚜鍔ㄧ煫姝f媿鎽勮搴︼級 + CropIdCard = true, + // CropPortrait = true, + //杈规鍜屾鍐呴伄鎸″憡璀� + BorderCheckWarn = true, + //PS妫�娴嬪憡璀� + DetectPsWarn = true, + //涓存椂韬唤璇佸憡璀� + TempIdWarn = true, + //韬唤璇佹湁鏁堟棩鏈熶笉鍚堟硶鍛婅 + InvalidDateWarn = true, + //鍥剧墖璐ㄩ噺鍒嗘暟锛堣瘎浠峰浘鐗囩殑妯$硦绋嬪害锛� + Quality = true, + + }); + IDCardOCRResponse resp = client.IDCardOCRSync(req); + + if (resp == null) + throw new Exception("鍥剧墖鏃犳硶璇嗗埆锛岃閲嶆柊閫夋嫨韬唤璇佸浘鐗�"); + + + var adv = JsonConvert.DeserializeObject<AdvancedInfo>(resp.AdvancedInfo); + if (adv == null) + throw new Exception("鍥剧墖鏃犳硶璇嗗埆锛岃閲嶆柊閫夋嫨韬唤璇佸浘鐗�"); + if (adv?.BorderCodeValue != null && adv.BorderCodeValue > 50) + throw new Exception("韬唤璇佸浘鐗囦笉瀹屾暣锛岃閲嶆柊閫夋嫨韬唤璇佸浘鐗�"); + if (adv?.Quality != null && adv.Quality < 50) + throw new Exception("鍥剧墖妯$硦锛岃閲嶆柊閫夋嫨韬唤璇佸浘鐗�"); + if (adv?.WarnInfos?.Where(x => x == -9100) == null) + throw new Exception("韬唤璇佹棩鏈熶笉鍚堟硶锛岃閲嶆柊閫夋嫨韬唤璇佸浘鐗�"); + if (adv?.WarnInfos?.Where(x => x == -9106) == null) + throw new Exception("璇ュ浘鐗囧彲鑳芥槸琚玃S杩囷紝璇烽噸鏂伴�夋嫨韬唤璇佸浘鐗�"); + + CropIdCard = adv.IdCard; + return resp; + } + catch (Exception) + { + throw; + } + + + } + + + } + + //杩斿洖鎵╁睍鍙傛暟 + internal class AdvancedInfo + { + /// <summary> + /// idCard 瑁佸壀鍚庤韩浠借瘉鐓х墖鐨刡ase64缂栫爜锛岃姹� Config.CropIdCard 鏃惰繑鍥烇紱 + /// </summary> + public string? IdCard { get; set; } + /// <summary> + /// 韬唤璇佸ご鍍忕収鐗囩殑base64缂栫爜锛岃姹� Config.CropPortrait 鏃惰繑鍥烇紱 + /// </summary> + public string? Portrait { get; set; } + /// <summary> + /// 鍥剧墖璐ㄩ噺鍒嗘暟锛岃姹� Config.Quality 鏃惰繑鍥烇紙鍙栧�艰寖鍥达細0 ~ 100锛屽垎鏁拌秺浣庤秺妯$硦锛屽缓璁槇鍊尖墺50锛�; + /// </summary> + public int? Quality { get; set; } + /// <summary> + /// 韬唤璇佽竟妗嗕笉瀹屾暣鍛婅闃堝�煎垎鏁帮紝璇锋眰 Config.BorderCheckWarn鏃惰繑鍥烇紙鍙栧�艰寖鍥达細0 ~ 100锛屽垎鏁拌秺浣庤竟妗嗛伄鎸″彲鑳芥�ц秺浣庯紝寤鸿闃堝�尖墹50锛�; + /// </summary> + public int BorderCodeValue { get; set; } + /// <summary> + /// 鍛婅淇℃伅锛孋ode 鍛婅鐮佸垪琛ㄥ拰閲婁箟锛� + ///-9100 韬唤璇佹湁鏁堟棩鏈熶笉鍚堟硶鍛婅锛� + ///-9101 韬唤璇佽竟妗嗕笉瀹屾暣鍛婅锛� + ///-9102 韬唤璇佸鍗颁欢鍛婅锛� + ///-9103 韬唤璇佺炕鎷嶅憡璀︼紝 + ///-9105 韬唤璇佹鍐呴伄鎸″憡璀︼紝 + ///-9104 涓存椂韬唤璇佸憡璀︼紝 + ///-9106 韬唤璇� PS 鍛婅锛� + ///-9107 韬唤璇佸弽鍏夊憡璀︺�� + /// </summary> + public List<int> WarnInfos { get; set; } + } + +} diff --git a/cylsg/EzUpFile/Class1.cs b/cylsg/EzUpFile/Class1.cs new file mode 100644 index 0000000..2d366e9 --- /dev/null +++ b/cylsg/EzUpFile/Class1.cs @@ -0,0 +1,7 @@ +锘縩amespace EzUpFile +{ + public class Class1 + { + + } +} diff --git a/cylsg/EzUpFile/EzUpFile.csproj b/cylsg/EzUpFile/EzUpFile.csproj new file mode 100644 index 0000000..fa71b7a --- /dev/null +++ b/cylsg/EzUpFile/EzUpFile.csproj @@ -0,0 +1,9 @@ +锘�<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>net8.0</TargetFramework> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + </PropertyGroup> + +</Project> diff --git a/cylsg/EzWechat/EzWechat.csproj b/cylsg/EzWechat/EzWechat.csproj index f8face4..02fd47b 100644 --- a/cylsg/EzWechat/EzWechat.csproj +++ b/cylsg/EzWechat/EzWechat.csproj @@ -12,6 +12,13 @@ <ItemGroup> <ProjectReference Include="..\cylsg.Core\cylsg.Core.csproj" /> + <ProjectReference Include="..\cylsg.redis\cylsg.redis.csproj" /> + </ItemGroup> + + <ItemGroup> + <None Update="WechatConfig.json"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> </ItemGroup> </Project> diff --git a/cylsg/EzWechat/IWechatService.cs b/cylsg/EzWechat/IWechatService.cs index 935346f..bde7133 100644 --- a/cylsg/EzWechat/IWechatService.cs +++ b/cylsg/EzWechat/IWechatService.cs @@ -1,4 +1,5 @@ -锘縰sing System; +锘縰sing SKIT.FlurlHttpClient.Wechat.Api.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,5 +10,17 @@ public interface IWechatService { + /// <summary> + /// 浣跨敤jsocde 鎹㈠尯 code + /// </summary> + /// <param name="jscode"></param> + /// <returns></returns> + Task<string> GetOpenID(string jscode); + /// <summary> + /// 鑾峰彇鎵嬫満鍙风爜 + /// </summary> + /// <param name="bindgetphonenumber"></param> + /// <returns></returns> + Task<string> GetPhone(string bindgetphonenumber); } } diff --git a/cylsg/EzWechat/WechatConfig.json b/cylsg/EzWechat/WechatConfig.json index a6540e1..f238b57 100644 --- a/cylsg/EzWechat/WechatConfig.json +++ b/cylsg/EzWechat/WechatConfig.json @@ -1,7 +1,7 @@ { - "WechatAPP" :{ - "AppId": "寰俊 AppId", - "AppSecret": "寰俊 AppSecret" + "WechatAPP": { + "AppId": "wx983556688354dd14", + "AppSecret": "2ab1aefaac926855dc9d5f7bf7f04477" } } \ No newline at end of file diff --git a/cylsg/EzWechat/WechatService.cs b/cylsg/EzWechat/WechatService.cs index cc1cf84..b0d3e4b 100644 --- a/cylsg/EzWechat/WechatService.cs +++ b/cylsg/EzWechat/WechatService.cs @@ -1,26 +1,35 @@ -锘縰sing Furion; +锘縰sing EzCoreNet.Redis; +using Furion; +using Furion.DependencyInjection; +using Furion.DynamicApiController; +using Furion.FriendlyException; +using Microsoft.Extensions.Options; using SKIT.FlurlHttpClient.Wechat.Api; using SKIT.FlurlHttpClient.Wechat.Api.Models; using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace EzWechat { - public class WechatService:IWechatService + public class WechatService:IWechatService ,IScoped { + private readonly WechatApiClient _client; + private readonly IEzCoreNetRedisService _redisService; - public WechatService() { - + public WechatService(IEzCoreNetRedisService ezCoreNetRedis) { + /* 浠ュ叕浼楀彿鑾峰彇鐢ㄦ埛淇℃伅鎺ュ彛涓轰緥 */ var request = new WechatApiClientOptions() { AppId = App.Configuration["WechatAPP:AppId"], AppSecret = App.Configuration["WechatAPP:AppSecret"], - + Timeout=3000, + //ImmeDeliveryAppKey = "鍗虫椂閰嶉�佺浉鍏虫湇鍔� AppKey锛屼笉鐢ㄥ垯涓嶅~", //ImmeDeliveryAppSecret = "鍗虫椂閰嶉�佺浉鍏虫湇鍔� AppSecret锛屼笉鐢ㄥ垯涓嶅~", //VirtualPaymentAppKey = "铏氭嫙鏀粯鐩稿叧鏈嶅姟 AppKey锛屼笉鐢ㄥ垯涓嶅~", @@ -28,9 +37,73 @@ //MidasAppKey = "绫冲ぇ甯� 1.0 鐩稿叧鏈嶅姟 AppKey锛屼笉鐢ㄥ垯涓嶅~", //MidasOfferIdV2 = "绫冲ぇ甯� 2.0 鐩稿叧鏈嶅姟 OfferId锛屼笉鐢ㄥ垯涓嶅~", //MidasAppKeyV2 = "绫冲ぇ甯� 2.0 鐩稿叧鏈嶅姟 AppKey锛屼笉鐢ㄥ垯涓嶅~" + }; + _client = WechatApiClientBuilder.Create(request).Build(); + + _redisService = ezCoreNetRedis; + + + } + + public async Task<string> GetOpenID(string jscode) + { + + var reques = new SnsComponentJsCode2SessionRequest() + { + AppId = App.Configuration["WechatAPP:AppId"], + + + JsCode = jscode + }; + var a= await _client.ExecuteSnsComponentJsCode2SessionAsync(reques); + if(a.IsSuccessful()) + { + return a.OpenId; + } + else + { + throw Oops.Oh($"{a.ErrorCode}+++{a.ErrorMessage}"); + } + } + public async Task<string> GetPhone( string bindgetphonenumber) + { + + + var requs = new WxaBusinessGetUserPhoneNumberRequest() + { + AccessToken = await GetAccessToken(), + Code= bindgetphonenumber + }; + var a= await _client.ExecuteWxaBusinessGetUserPhoneNumberAsync(requs); + if (a.IsSuccessful()) + return a.PhoneInfo.PurePhoneNumber; + else + { + throw Oops.Oh($"{a.ErrorCode}+++{a.ErrorMessage}"); + } } + /// <summary> + /// 鑾峰彇AccToken + /// </summary> + /// <returns></returns> + private async Task<string> GetAccessToken() + { + string key = _redisService.Get<string>("WxAccessToken"); + if(string.IsNullOrEmpty(key)) + { + var a = await _client.ExecuteCgibinTokenAsync(new CgibinTokenRequest { }); + if(!a.IsSuccessful()) + { + throw Oops.Oh($"{a.ErrorCode}+++{a.ErrorMessage}"); + } + key=a.AccessToken; + _redisService.Add<string>("WxAccessToken", a.AccessToken, 7000); + } + return key; + } + } } diff --git a/cylsg/cylsg.Application/LogoInController.cs b/cylsg/cylsg.Application/LogoInController.cs new file mode 100644 index 0000000..6f00d81 --- /dev/null +++ b/cylsg/cylsg.Application/LogoInController.cs @@ -0,0 +1,163 @@ +锘縰sing cylsg.Authorization; +using cylsg.Core; +using cylsg.Model.UserModel; +using EzWechat; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cylsg.Application +{ + /// <summary> + /// 鐧诲綍 + /// </summary> + [DynamicApiController] + public class LogoIn + { + private readonly IWechatService _wechatService; + + private readonly IEzAuthorizationService _ezAuthorizationService; + public LogoIn(IWechatService wechatService, + IEzAuthorizationService ezAuthorizationService) + { + _wechatService = wechatService; + _ezAuthorizationService = ezAuthorizationService; + + } + /// <summary> + /// 蹇�熺櫥褰� + /// </summary> + /// <returns></returns> + [HttpGet] + [QueryParameters] + public async Task<TokenInfo> LogoinFast(string jscode) + { + + var opeid = await _wechatService.GetOpenID(jscode); + var UserRes = new BaseRepository<User>(); + + + var user = await UserRes.GetFirstAsync(x => x.WxAppId == opeid); + if (user == null) + { + throw Oops.Oh("娌℃壘鍒扮敤鎴�,闇�瑕侀噸鏂版敞鍐岀櫥褰�"); + } + var jwt = new EzJwtModel() + { + ITCode = user.ItCode, + NickName = user.Nickname, + UserID = user.Id, + + + }; + + + return _ezAuthorizationService.CreateToken<EzJwtModel>(jwt); + + + + + + } + + + /// <summary> + /// 娉ㄥ唽鐢ㄦ埛骞剁櫥褰� + /// </summary> + /// <param name="Param">logoinjscode</param> + /// <returns></returns> + [HttpPost] + public async Task<TokenInfo> CreateUser(UserInfoIn Param) + { + + var opeid = await _wechatService.GetOpenID(Param.JsCode); + var UserRes = new BaseRepository<User>(); + + + var user = await UserRes.GetFirstAsync(x => x.WxAppId == opeid); + if (user == null) + { + //娌℃湁鐢ㄦ埛 锛岄渶瑕佹柊寤虹敤鎴� + var phone = await _wechatService.GetPhone(Param.Bindgetphonenumber); + + user = new User + { + + Avatar = phone, + Nickname = Param.Nickname, + name = Param.Name ?? phone, + Phone = phone, + ItCode = phone, + PassWord = "123456", + WxAppId = opeid, + + + + }; + + await UserRes.EzInsertAsync(user); + + + } + var jwt = new EzJwtModel() + { + ITCode = user.ItCode, + NickName = user.Nickname, + UserID = user.Id, + + + }; + + + return _ezAuthorizationService.CreateToken<EzJwtModel>(jwt); + + + + + + + + } + + + + + + } + /// <summary> + /// 鍒涘缓鐢ㄦ埛妯″瀷 + /// </summary> + + public class UserInfoIn() + { + /// <summary> + /// 澶村儚 + /// </summary> + public string? Avatar { get; set; } + /// <summary> + /// 鏄电О + /// </summary> + public string? Nickname { get; set; } + /// <summary> + /// 鐢佃瘽 + /// </summary> + public string? Phone { get; set; } + /// <summary> + /// 鍚嶇О + /// </summary> + public string? Name { get; set; } + + /// <summary> + /// 鎵嬫満鍙锋崲鍙栫爜 + /// </summary> + [Required] + public string Bindgetphonenumber { get; set; } + /// <summary> + /// jscode + /// </summary> + [Required] + public string JsCode { get; set;} + } +} diff --git a/cylsg/cylsg.Application/applicationsettings.json b/cylsg/cylsg.Application/applicationsettings.json index b01b457..4b91598 100644 --- a/cylsg/cylsg.Application/applicationsettings.json +++ b/cylsg/cylsg.Application/applicationsettings.json @@ -1,22 +1,22 @@ 锘縶 "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json", "SpecificationDocumentSettings": { - "DocumentTitle": "Furion | 瑙勮寖鍖栨帴鍙�", + "DocumentTitle": "Furion | 宸濆嵃闆舵椂宸�", "GroupOpenApiInfos": [ { "Group": "Default", - "Title": "瑙勮寖鍖栨紨绀�", - "Description": "宸濆嵃鐏垫椂宸�", + "Title": "宸濆嵃闆舵椂宸�", + "Description": "宸濆嵃闆舵椂宸�", "Version": "1.0.0", - + "Contact": { "Name": "", - + "Email": "monksoul@outlook.com" }, "License": { "Name": "Apache-2.0" - + } } ] diff --git a/cylsg/cylsg.Application/cylsg.Application.csproj b/cylsg/cylsg.Application/cylsg.Application.csproj index 71a7b0e..d4d1c03 100644 --- a/cylsg/cylsg.Application/cylsg.Application.csproj +++ b/cylsg/cylsg.Application/cylsg.Application.csproj @@ -22,8 +22,12 @@ </ItemGroup> <ItemGroup> + <ProjectReference Include="..\cylsg.Authorization\cylsg.Authorization.csproj" /> <ProjectReference Include="..\cylsg.Core\cylsg.Core.csproj" /> <ProjectReference Include="..\cylsg.Model\cylsg.Model.csproj" /> + <ProjectReference Include="..\cylsg.redis\cylsg.redis.csproj" /> + <ProjectReference Include="..\EzTencentCloud\EzTencentCloud.csproj" /> + <ProjectReference Include="..\EzWechat\EzWechat.csproj" /> </ItemGroup> <ItemGroup> diff --git a/cylsg/cylsg.Application/cylsg.Application.xml b/cylsg/cylsg.Application/cylsg.Application.xml index bc89ada..b9d8279 100644 --- a/cylsg/cylsg.Application/cylsg.Application.xml +++ b/cylsg/cylsg.Application/cylsg.Application.xml @@ -4,6 +4,64 @@ <name>cylsg.Application</name> </assembly> <members> + <member name="T:cylsg.Application.LogoIn"> + <summary> + 鐧诲綍 + </summary> + </member> + <member name="M:cylsg.Application.LogoIn.LogoinFast(System.String)"> + <summary> + 蹇�熺櫥褰� + </summary> + <returns></returns> + </member> + <member name="M:cylsg.Application.LogoIn.CreateUser(cylsg.Application.UserInfoIn)"> + <summary> + 娉ㄥ唽鐢ㄦ埛骞剁櫥褰� + </summary> + <param name="Param">logoinjscode</param> + <returns></returns> + </member> + <member name="T:cylsg.Application.UserInfoIn"> + <summary> + 鍒涘缓鐢ㄦ埛妯″瀷 + </summary> + </member> + <member name="M:cylsg.Application.UserInfoIn.#ctor"> + <summary> + 鍒涘缓鐢ㄦ埛妯″瀷 + </summary> + </member> + <member name="P:cylsg.Application.UserInfoIn.Avatar"> + <summary> + 澶村儚 + </summary> + </member> + <member name="P:cylsg.Application.UserInfoIn.Nickname"> + <summary> + 鏄电О + </summary> + </member> + <member name="P:cylsg.Application.UserInfoIn.Phone"> + <summary> + 鐢佃瘽 + </summary> + </member> + <member name="P:cylsg.Application.UserInfoIn.Name"> + <summary> + 鍚嶇О + </summary> + </member> + <member name="P:cylsg.Application.UserInfoIn.Bindgetphonenumber"> + <summary> + 鎵嬫満鍙锋崲鍙栫爜 + </summary> + </member> + <member name="P:cylsg.Application.UserInfoIn.JsCode"> + <summary> + jscode + </summary> + </member> <member name="T:cylsg.Application.SystemAppService"> <summary> 绯荤粺鏈嶅姟鎺ュ彛 diff --git a/cylsg/cylsg.Authorization/IEzAuthorizationService.cs b/cylsg/cylsg.Authorization/IEzAuthorizationService.cs index 19e9986..fd2736b 100644 --- a/cylsg/cylsg.Authorization/IEzAuthorizationService.cs +++ b/cylsg/cylsg.Authorization/IEzAuthorizationService.cs @@ -12,7 +12,7 @@ public interface IEzAuthorizationService { TokenInfo CreateToken<T>(T jwt) where T : EzJwtModel; - public Task<TokenInfo?> RefreshToken<T>(string refToken) where T : EzJwtModel; + Task<TokenInfo?> RefreshToken<T>(string refToken) where T : EzJwtModel; } diff --git a/cylsg/cylsg.Model/UserModel/User.cs b/cylsg/cylsg.Model/UserModel/User.cs index e6215eb..4ad793f 100644 --- a/cylsg/cylsg.Model/UserModel/User.cs +++ b/cylsg/cylsg.Model/UserModel/User.cs @@ -43,20 +43,25 @@ /// <summary> /// 鏄电О /// </summary> - [SugarColumn(ColumnDescription = "鐢ㄦ埛ID", Length = 100)] - public int Nickname { get; set; } + [SugarColumn(ColumnDescription = "鏄电О", Length = 100)] + public string Nickname { get; set; } /// <summary> /// 瀵嗙爜 /// </summary> [SugarColumn(ColumnDescription = "瀵嗙爜", Length = 100)] - public int PassWord { get; set; } + public string PassWord { get; set; } /// <summary> /// 澶村儚鍦板潃 /// </summary> [SugarColumn(ColumnDescription = "澶村儚鍦板潃")] - public int Avatar { get; set; } + public string Avatar { get; set; } + /// <summary> + /// 寰俊APPID + /// </summary> + [SugarColumn(ColumnDescription = "WxAppId",Length =30)] + public string? WxAppId { get; set; } } } diff --git a/cylsg/cylsg.Web.Core/Startup.cs b/cylsg/cylsg.Web.Core/Startup.cs index 0737f0c..9bda758 100644 --- a/cylsg/cylsg.Web.Core/Startup.cs +++ b/cylsg/cylsg.Web.Core/Startup.cs @@ -7,6 +7,9 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SqlSugar; +using System.Text.Encodings.Web; +using System.Text.Json.Serialization; +using System.Text.Unicode; namespace cylsg.Web.Core; @@ -25,7 +28,20 @@ return DbContext.Instance; } ); - + services.AddJsonOptions(options => + { + //鏇存敼杈撳嚭杈撳叆鏋氫妇灞炴�т负 瀛楁鍚� + options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); + //绌哄�间笉杈撳嚭json鏍煎紡 + options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; + options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); + options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); + + + // options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); + // options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(); + }); + services.AddControllersWithViews() .AddInjectWithUnifyResult<EzCoreRESTFulResultProvider>(); } diff --git a/cylsg/cylsg.Web.Entry/Properties/launchSettings.json b/cylsg/cylsg.Web.Entry/Properties/launchSettings.json index 025cb44..f5c975c 100644 --- a/cylsg/cylsg.Web.Entry/Properties/launchSettings.json +++ b/cylsg/cylsg.Web.Entry/Properties/launchSettings.json @@ -3,7 +3,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:58595", + "applicationUrl": "http://127.0.0.1:58595", "sslPort": 44326 } }, @@ -19,7 +19,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "https://localhost:5001;http://localhost:5000", + "applicationUrl": "http://0.0.0.0:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/cylsg/cylsg.Web.Entry/SingleFilePublish.cs b/cylsg/cylsg.Web.Entry/SingleFilePublish.cs index 4e0f945..418785e 100644 --- a/cylsg/cylsg.Web.Entry/SingleFilePublish.cs +++ b/cylsg/cylsg.Web.Entry/SingleFilePublish.cs @@ -16,7 +16,10 @@ { "cylsg.Application", "cylsg.Core", - "cylsg.Web.Core" + "cylsg.Web.Core", + "EzWechat", + "EzWechat", + "cylsg.redis" }; } } \ No newline at end of file diff --git a/cylsg/cylsg.Web.Entry/appsettings.json b/cylsg/cylsg.Web.Entry/appsettings.json index 8f4963f..c9ec59a 100644 --- a/cylsg/cylsg.Web.Entry/appsettings.json +++ b/cylsg/cylsg.Web.Entry/appsettings.json @@ -24,6 +24,12 @@ ], + "DynamicApiControllerSettings": { + "KeepName": true, + "KeepVerb": true, + "LowercaseRoute": false + }, + "JWTSettings": { "ValidateIssuerSigningKey": true, // 鏄惁楠岃瘉瀵嗛挜锛宐ool 绫诲瀷锛岄粯璁rue "IssuerSigningKey": "129(*dasd09213)*(*jKDl65656656532jiohi", // 瀵嗛挜锛宻tring 绫诲瀷锛屽繀椤绘槸澶嶆潅瀵嗛挜锛岄暱搴﹀ぇ浜�16 diff --git a/cylsg/cylsg.Web.Entry/cylsg.Web.Entry.csproj b/cylsg/cylsg.Web.Entry/cylsg.Web.Entry.csproj index f8a41c3..ecabffa 100644 --- a/cylsg/cylsg.Web.Entry/cylsg.Web.Entry.csproj +++ b/cylsg/cylsg.Web.Entry/cylsg.Web.Entry.csproj @@ -12,6 +12,7 @@ <ItemGroup> <ProjectReference Include="..\cylsg.Web.Core\cylsg.Web.Core.csproj" /> + <ProjectReference Include="..\EzWechat\EzWechat.csproj" /> </ItemGroup> </Project> diff --git a/cylsg/cylsg.redis/RedisConfig.json b/cylsg/cylsg.redis/RedisConfig.json index f817c47..d4bb4aa 100644 --- a/cylsg/cylsg.redis/RedisConfig.json +++ b/cylsg/cylsg.redis/RedisConfig.json @@ -2,7 +2,7 @@ //璇蜂繚鎸乺edis涓烘甯稿彲鐢� "RedisConfig": { // 濡傛灉閲囩敤瀹瑰櫒鍖栭儴缃睸ervice 瑕佸啓鎴恟edis鐨勬湇鍔″悕锛屽惁鍒欏啓鍦板潃 - "ConnectionString": "127.0.0.1:6379,password=,connectTimeout=30000,responseTimeout=30000,abortConnect=false,connectRetry=1,syncTimeout=10000,DefaultDatabase=1" //redis鏁版嵁搴撹繛鎺ュ瓧绗︿覆 + "ConnectionString": "127.0.0.1:6379,password=,connectTimeout=30000,responseTimeout=30000,abortConnect=false,connectRetry=1,syncTimeout=10000,DefaultDatabase=3" //redis鏁版嵁搴撹繛鎺ュ瓧绗︿覆 } } diff --git a/cylsg/cylsg.redis/cylsg.redis.csproj b/cylsg/cylsg.redis/cylsg.redis.csproj index d71de94..10a89fc 100644 --- a/cylsg/cylsg.redis/cylsg.redis.csproj +++ b/cylsg/cylsg.redis/cylsg.redis.csproj @@ -14,4 +14,10 @@ <ProjectReference Include="..\cylsg.Core\cylsg.Core.csproj" /> </ItemGroup> + <ItemGroup> + <None Update="RedisConfig.json"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </None> + </ItemGroup> + </Project> diff --git a/cylsg/cylsg.sln b/cylsg/cylsg.sln index bb4f5ca..b028eb0 100644 --- a/cylsg/cylsg.sln +++ b/cylsg/cylsg.sln @@ -11,17 +11,19 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cylsg.Web.Entry", "cylsg.Web.Entry\cylsg.Web.Entry.csproj", "{9826E365-EEE9-4721-A738-B02AB64D47E5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cylsg.Model", "cylsg.Model\cylsg.Model.csproj", "{09E3AFC0-0975-4842-891F-9B5C78E12458}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cylsg.Model", "cylsg.Model\cylsg.Model.csproj", "{09E3AFC0-0975-4842-891F-9B5C78E12458}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cylsg.utility", "cylsg.utility\cylsg.utility.csproj", "{5ED2C481-2D74-43BC-ABAF-1455A052FAA4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cylsg.utility", "cylsg.utility\cylsg.utility.csproj", "{5ED2C481-2D74-43BC-ABAF-1455A052FAA4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EzWechat", "EzWechat\EzWechat.csproj", "{709CC927-07D3-4400-BD57-838A44B4FBD4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EzWechat", "EzWechat\EzWechat.csproj", "{709CC927-07D3-4400-BD57-838A44B4FBD4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cylsg.services", "cylsg.services\cylsg.services.csproj", "{28CCF771-A760-4191-B299-4E53B5B23D91}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cylsg.services", "cylsg.services\cylsg.services.csproj", "{28CCF771-A760-4191-B299-4E53B5B23D91}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cylsg.redis", "cylsg.redis\cylsg.redis.csproj", "{15042E77-32D5-46DE-9CE5-24D093C63422}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cylsg.redis", "cylsg.redis\cylsg.redis.csproj", "{15042E77-32D5-46DE-9CE5-24D093C63422}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cylsg.Authorization", "cylsg.Authorization\cylsg.Authorization.csproj", "{1197C9BB-C73D-42FB-A114-AFB0A7466615}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "cylsg.Authorization", "cylsg.Authorization\cylsg.Authorization.csproj", "{1197C9BB-C73D-42FB-A114-AFB0A7466615}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EzTencentCloud", "EzTencentCloud\EzTencentCloud.csproj", "{8E2530EC-45FE-4EC6-A29A-1B8F25E0F94B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -69,6 +71,10 @@ {1197C9BB-C73D-42FB-A114-AFB0A7466615}.Debug|Any CPU.Build.0 = Debug|Any CPU {1197C9BB-C73D-42FB-A114-AFB0A7466615}.Release|Any CPU.ActiveCfg = Release|Any CPU {1197C9BB-C73D-42FB-A114-AFB0A7466615}.Release|Any CPU.Build.0 = Release|Any CPU + {8E2530EC-45FE-4EC6-A29A-1B8F25E0F94B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E2530EC-45FE-4EC6-A29A-1B8F25E0F94B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E2530EC-45FE-4EC6-A29A-1B8F25E0F94B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E2530EC-45FE-4EC6-A29A-1B8F25E0F94B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- Gitblit v1.9.1