From d47565bee39818a5bed69696d151c018473f0f08 Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期四, 15 八月 2024 11:10:17 +0800
Subject: [PATCH] 调整登录流程。完成登录测试,登录OK

---
 cylsg/cylsg.Model/UserModel/User.cs              |   22 +++++++++++-----------
 cylsg/EzWechat/WechatService.cs                  |    7 ++++---
 cylsg/cylsg.Application/LogoInController.cs      |    9 +++++----
 cylsg/EzWechat/EzWechat.csproj                   |    1 +
 cylsg/cylsg.Core/BaseModelBase.cs                |    8 ++++----
 cylsg/cylsg.sln                                  |    6 ++++++
 cylsg/cylsg.Application/cylsg.Application.csproj |    1 +
 7 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/cylsg/EzWechat/EzWechat.csproj b/cylsg/EzWechat/EzWechat.csproj
index 02fd47b..1e28ec0 100644
--- a/cylsg/EzWechat/EzWechat.csproj
+++ b/cylsg/EzWechat/EzWechat.csproj
@@ -13,6 +13,7 @@
   <ItemGroup>
     <ProjectReference Include="..\cylsg.Core\cylsg.Core.csproj" />
     <ProjectReference Include="..\cylsg.redis\cylsg.redis.csproj" />
+    <ProjectReference Include="..\cylsg.utility\cylsg.utility.csproj" />
   </ItemGroup>
 
   <ItemGroup>
diff --git a/cylsg/EzWechat/WechatService.cs b/cylsg/EzWechat/WechatService.cs
index b0d3e4b..1d07cce 100644
--- a/cylsg/EzWechat/WechatService.cs
+++ b/cylsg/EzWechat/WechatService.cs
@@ -48,14 +48,15 @@
         public async Task<string> GetOpenID(string jscode)
         {
         
-            var reques = new SnsComponentJsCode2SessionRequest()
+            var reques = new SnsJsCode2SessionRequest()
             {
-                AppId = App.Configuration["WechatAPP:AppId"],
+            
+                 
                
               
                 JsCode = jscode
             };
-          var a= await _client.ExecuteSnsComponentJsCode2SessionAsync(reques);
+          var a= await _client.ExecuteSnsJsCode2SessionAsync(reques);
             if(a.IsSuccessful())
             {
                 return a.OpenId;
diff --git a/cylsg/cylsg.Application/LogoInController.cs b/cylsg/cylsg.Application/LogoInController.cs
index 6f00d81..8521f42 100644
--- a/cylsg/cylsg.Application/LogoInController.cs
+++ b/cylsg/cylsg.Application/LogoInController.cs
@@ -1,6 +1,7 @@
 锘縰sing cylsg.Authorization;
 using cylsg.Core;
 using cylsg.Model.UserModel;
+using cylsg.utility.Extend;
 using EzWechat;
 using System;
 using System.Collections.Generic;
@@ -39,7 +40,7 @@
             var UserRes = new BaseRepository<User>();
 
 
-            var user = await UserRes.GetFirstAsync(x => x.WxAppId == opeid);
+            var user = await UserRes.GetFirstAsync(x => x.WxOpenId == opeid);
             if (user == null)
             {
                 throw Oops.Oh("娌℃壘鍒扮敤鎴�,闇�瑕侀噸鏂版敞鍐岀櫥褰�");
@@ -76,7 +77,7 @@
             var UserRes = new BaseRepository<User>();
 
 
-            var user = await UserRes.GetFirstAsync(x => x.WxAppId == opeid);
+            var user = await UserRes.GetFirstAsync(x => x.WxOpenId == opeid);
             if (user == null)
             {
                 //娌℃湁鐢ㄦ埛 锛岄渶瑕佹柊寤虹敤鎴�
@@ -86,12 +87,12 @@
                 {
 
                     Avatar = phone,
-                    Nickname = Param.Nickname,
+                    Nickname = Param.Nickname??phone.PrivacyStr(),
                     name = Param.Name ?? phone,
                     Phone = phone,
                     ItCode = phone,
                     PassWord = "123456",
-                    WxAppId = opeid,
+                    WxOpenId = opeid,
 
 
 
diff --git a/cylsg/cylsg.Application/cylsg.Application.csproj b/cylsg/cylsg.Application/cylsg.Application.csproj
index d4d1c03..75373a4 100644
--- a/cylsg/cylsg.Application/cylsg.Application.csproj
+++ b/cylsg/cylsg.Application/cylsg.Application.csproj
@@ -26,6 +26,7 @@
 		<ProjectReference Include="..\cylsg.Core\cylsg.Core.csproj" />
 		<ProjectReference Include="..\cylsg.Model\cylsg.Model.csproj" />
 		<ProjectReference Include="..\cylsg.redis\cylsg.redis.csproj" />
+		<ProjectReference Include="..\cylsg.utility\cylsg.utility.csproj" />
 		<ProjectReference Include="..\EzTencentCloud\EzTencentCloud.csproj" />
 		<ProjectReference Include="..\EzWechat\EzWechat.csproj" />
 	</ItemGroup>
diff --git a/cylsg/cylsg.Core/BaseModelBase.cs b/cylsg/cylsg.Core/BaseModelBase.cs
index e722934..a041364 100644
--- a/cylsg/cylsg.Core/BaseModelBase.cs
+++ b/cylsg/cylsg.Core/BaseModelBase.cs
@@ -17,25 +17,25 @@
         /// 鍒涘缓鏃堕棿
         /// </summary>
         [Display(Name = "鍒涘缓鏃堕棿 ")]
-        [SugarColumn(ColumnDescription = "鍒涘缓鏃堕棿 ")]
+        [SugarColumn(ColumnDescription = "鍒涘缓鏃堕棿 " , IsNullable = true)]
         public DateTime? CreateTime { get; set; }
         /// <summary>
         /// 鍒涘缓浜�
         /// </summary>
         [Display(Name = "鍒涘缓浜� ")]
-        [SugarColumn(ColumnDescription = "鍒涘缓浜� ", Length = 100)]
+        [SugarColumn(ColumnDescription = "鍒涘缓浜� ", IsNullable = true, Length = 100)]
         public string CreateBy { get; set; }
         /// <summary>
         /// 淇敼鏃堕棿
         /// </summary>
         [Display(Name = "淇敼鏃堕棿 ")]
-        [SugarColumn(ColumnDescription = "淇敼鏃堕棿 ")]
+        [SugarColumn(ColumnDescription = "淇敼鏃堕棿 ", IsNullable = true)]
         public DateTime? UpDataTime { get; set; }
         /// <summary>
         /// 淇敼浜�
         /// </summary>
         [Display(Name = "淇敼浜� ")]
-        [SugarColumn(ColumnDescription = "淇敼浜� ", Length = 100)]
+        [SugarColumn(ColumnDescription = "淇敼浜� ", IsNullable = true,Length = 100)]
         public string UpDataBy { get; set; }
 
 
diff --git a/cylsg/cylsg.Model/UserModel/User.cs b/cylsg/cylsg.Model/UserModel/User.cs
index 4ad793f..ca8d82c 100644
--- a/cylsg/cylsg.Model/UserModel/User.cs
+++ b/cylsg/cylsg.Model/UserModel/User.cs
@@ -15,7 +15,7 @@
     /// </summary>
     [Description("鐢ㄦ埛妯″瀷")]
     [CoderFirst]
-    public class User:BaseModelBase
+    public class User: BaseModel
     {
         /// <summary>
         /// 鐢ㄦ埛Id
@@ -26,7 +26,7 @@
         /// <summary>
         /// 鐢佃瘽
         /// </summary>
-        [SugarColumn(ColumnDescription = "鐢佃瘽")]
+        [SugarColumn(ColumnDescription = "鐢佃瘽", IsNullable = true)]
         public string Phone { get; set; }
 
         /// <summary>
@@ -43,25 +43,25 @@
         /// <summary>
         /// 鏄电О
         /// </summary>
-        [SugarColumn(ColumnDescription = "鏄电О", Length = 100)]
-        public string Nickname { get; set; }
+        [SugarColumn(ColumnDescription = "鏄电О", Length = 100, IsNullable =true)]
+        public string? Nickname { get; set; }
 
 
         /// <summary>
         /// 瀵嗙爜
         /// </summary>
-        [SugarColumn(ColumnDescription = "瀵嗙爜", Length = 100)]
-        public string PassWord { get; set; }
+        [SugarColumn(ColumnDescription = "瀵嗙爜", Length = 100,IsNullable = true)]
+        public string? PassWord { get; set; }
 
         /// <summary>
         /// 澶村儚鍦板潃
         /// </summary>
-        [SugarColumn(ColumnDescription = "澶村儚鍦板潃")]
-        public string Avatar { get; set; }
+        [SugarColumn(ColumnDescription = "澶村儚鍦板潃" ,IsNullable =true)]
+        public string? Avatar { get; set; }
         /// <summary>
-        /// 寰俊APPID
+        /// 寰俊WxOpenId
         /// </summary>
-        [SugarColumn(ColumnDescription = "WxAppId",Length =30)]
-        public string?  WxAppId { get; set; }
+        [SugarColumn(ColumnDescription = "WxOpenId", Length =100,IsNullable = true)]
+        public string?  WxOpenId { get; set; }
     }
 }
diff --git a/cylsg/cylsg.sln b/cylsg/cylsg.sln
index b028eb0..963e45a 100644
--- a/cylsg/cylsg.sln
+++ b/cylsg/cylsg.sln
@@ -25,6 +25,8 @@
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EzTencentCloud", "EzTencentCloud\EzTencentCloud.csproj", "{8E2530EC-45FE-4EC6-A29A-1B8F25E0F94B}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EzUpFile", "EzUpFile\EzUpFile.csproj", "{040F7EE0-B57B-4134-8538-20B9599FB898}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -75,6 +77,10 @@
 		{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
+		{040F7EE0-B57B-4134-8538-20B9599FB898}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{040F7EE0-B57B-4134-8538-20B9599FB898}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{040F7EE0-B57B-4134-8538-20B9599FB898}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{040F7EE0-B57B-4134-8538-20B9599FB898}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

--
Gitblit v1.9.1