| | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\cylsg.Core\cylsg.Core.csproj" /> |
| | | <ProjectReference Include="..\cylsg.redis\cylsg.redis.csproj" /> |
| | | <ProjectReference Include="..\cylsg.utility\cylsg.utility.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | |
| | | 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; |
| | |
| | | using cylsg.Authorization; |
| | | using cylsg.Core; |
| | | using cylsg.Model.UserModel; |
| | | using cylsg.utility.Extend; |
| | | using EzWechat; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | 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("没找到用户,需要重新注册登录"); |
| | |
| | | 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) |
| | | { |
| | | //没有用户 ,需要新建用户 |
| | |
| | | { |
| | | |
| | | Avatar = phone, |
| | | Nickname = Param.Nickname, |
| | | Nickname = Param.Nickname??phone.PrivacyStr(), |
| | | name = Param.Name ?? phone, |
| | | Phone = phone, |
| | | ItCode = phone, |
| | | PassWord = "123456", |
| | | WxAppId = opeid, |
| | | WxOpenId = opeid, |
| | | |
| | | |
| | | |
| | |
| | | <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> |
| | |
| | | /// 创建时间 |
| | | /// </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; } |
| | | |
| | | |
| | |
| | | /// </summary> |
| | | [Description("用户模型")] |
| | | [CoderFirst] |
| | | public class User:BaseModelBase |
| | | public class User: BaseModel |
| | | { |
| | | /// <summary> |
| | | /// 用户Id |
| | |
| | | /// <summary> |
| | | /// 电话 |
| | | /// </summary> |
| | | [SugarColumn(ColumnDescription = "电话")] |
| | | [SugarColumn(ColumnDescription = "电话", IsNullable = true)] |
| | | public string Phone { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | /// <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; } |
| | | } |
| | | } |
| | |
| | | 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 |
| | |
| | | {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 |