feat:bug fixed

develop
old易 2024-02-01 11:20:13 +08:00
parent 7b6e1a3a74
commit af218c8825
10 changed files with 473 additions and 32 deletions

View File

@ -25,10 +25,12 @@ namespace New_College.Api.Controllers.Front
{ {
private readonly IV_CustomerInfoServices _services; private readonly IV_CustomerInfoServices _services;
private readonly ID_UserSettingBaseServices _userSetting; private readonly ID_UserSettingBaseServices _userSetting;
public CustomerController(IV_CustomerInfoServices IV_CustomerInfoServices, ID_UserSettingBaseServices userSetting) private readonly ICasdoorUserServices _casdoorUserServices;
public CustomerController(IV_CustomerInfoServices IV_CustomerInfoServices, ID_UserSettingBaseServices userSetting, ICasdoorUserServices casdoorUserServices)
{ {
_services = IV_CustomerInfoServices; _services = IV_CustomerInfoServices;
_userSetting = userSetting; _userSetting = userSetting;
_casdoorUserServices = casdoorUserServices;
} }
@ -97,6 +99,7 @@ namespace New_College.Api.Controllers.Front
var newmodel = single.FirstOrDefault(); var newmodel = single.FirstOrDefault();
newmodel.IsDelete = true; newmodel.IsDelete = true;
var update = await _services.Update(newmodel); var update = await _services.Update(newmodel);
await _casdoorUserServices.AccontCancel(login.openId);
return new MessageModel<bool>() return new MessageModel<bool>()
{ {
success = true, success = true,

View File

@ -160,6 +160,11 @@
逻辑删除 逻辑删除
</summary> </summary>
</member> </member>
<member name="T:New_College.Model.Models.CasdoorUser">
<summary>
</summary>
</member>
<member name="T:New_College.Model.Models.D_Enrollmentinproduction"> <member name="T:New_College.Model.Models.D_Enrollmentinproduction">
<summary> <summary>
招生简章 招生简章

View File

@ -58,7 +58,7 @@
// https://www.bilibili.com/video/BV1BJ411B7mn?p=6 // https://www.bilibili.com/video/BV1BJ411B7mn?p=6
"MainDB": "WMBLOG_MYSQL", //Enabledtrue "MainDB": "WMBLOG_MYSQL", //Enabledtrue
"MutiDBEnabled": false, // "MutiDBEnabled": true, //
"CQRSEnabled": false, //,SqlServer "CQRSEnabled": false, //,SqlServer
"DBS": [ "DBS": [
/* /*
@ -99,6 +99,13 @@
"HitRate": 20, "HitRate": 20,
"Connection": "Server=192.168.103.102; Port=3306;SslMode=None;Database=volunteerapp; Uid=ycymedu; Pwd=Vs..127134;CharSet=utf8mb4;AllowLoadLocalInfile=true" "Connection": "Server=192.168.103.102; Port=3306;SslMode=None;Database=volunteerapp; Uid=ycymedu; Pwd=Vs..127134;CharSet=utf8mb4;AllowLoadLocalInfile=true"
}, },
{
"ConnId": "MYSQL_CasDoor",
"DBType": 0,
"Enabled": true,
"HitRate": 20,
"Connection": "Server=192.168.103.102; Port=3306;SslMode=None;Database=casdoor; Uid=ycymedu; Pwd=Vs..127134"
},
{ {
"ConnId": "WMBLOG_ORACLE", "ConnId": "WMBLOG_ORACLE",
"DBType": 3, "DBType": 3,

View File

@ -58,7 +58,7 @@
// https://www.bilibili.com/video/BV1BJ411B7mn?p=6 // https://www.bilibili.com/video/BV1BJ411B7mn?p=6
"MainDB": "WMBLOG_MYSQL", //Enabledtrue "MainDB": "WMBLOG_MYSQL", //Enabledtrue
"MutiDBEnabled": false, // "MutiDBEnabled": true, //
"CQRSEnabled": false, //,SqlServer "CQRSEnabled": false, //,SqlServer
"DBS": [ "DBS": [
/* /*
@ -99,6 +99,13 @@
"HitRate": 20, "HitRate": 20,
"Connection": "Server=192.168.103.102; Port=3306;SslMode=None;Database=volunteerapp; Uid=ycymedu; Pwd=Vs..127134;CharSet=utf8mb4" "Connection": "Server=192.168.103.102; Port=3306;SslMode=None;Database=volunteerapp; Uid=ycymedu; Pwd=Vs..127134;CharSet=utf8mb4"
}, },
{
"ConnId": "MYSQL_CasDoor",
"DBType": 0,
"Enabled": true,
"HitRate": 20,
"Connection": "Server=192.168.103.102; Port=3306;SslMode=None;Database=casdoor; Uid=ycymedu; Pwd=Vs..127134"
},
{ {
"ConnId": "WMBLOG_ORACLE", "ConnId": "WMBLOG_ORACLE",
"DBType": 3, "DBType": 3,

View File

@ -0,0 +1,13 @@
using New_College.IServices.BASE;
using New_College.Model.Models;
using System.Threading.Tasks;
namespace New_College.IServices
{
/// <summary>
/// IuserServices
/// </summary>
public interface ICasdoorUserServices : IBaseServices<CasdoorUser>
{
Task<bool> AccontCancel(string openId);
}
}

View File

@ -0,0 +1,339 @@
using System;
using System.Linq;
using System.Text;
using SqlSugar;
namespace New_College.Model.Models
{
///<summary>
///
///</summary>
[SugarTable("user", "MYSQL_CasDoor")]
public class CasdoorUser
{
public CasdoorUser()
{
}
[SugarColumn(IsPrimaryKey = true)]
public string owner { get; set; }
[SugarColumn(IsPrimaryKey = true)]
public string name { get; set; }
[SugarColumn(Length = 100)]
public string created_time { get; set; }
[SugarColumn(Length = 100)]
public string updated_time { get; set; }
[SugarColumn(Length = 100)]
public string id { get; set; }
[SugarColumn(Length = 100)]
public string external_id { get; set; }
[SugarColumn(Length = 100)]
public string type { get; set; }
[SugarColumn(Length = 100)]
public string password { get; set; }
[SugarColumn(Length = 100)]
public string password_salt { get; set; }
[SugarColumn(Length = 100)]
public string password_type { get; set; }
[SugarColumn(Length = 100)]
public string display_name { get; set; }
[SugarColumn(Length = 100)]
public string first_name { get; set; }
[SugarColumn(Length = 100)]
public string last_name { get; set; }
[SugarColumn(Length = 500)]
public string avatar { get; set; }
[SugarColumn(Length = 100)]
public string avatar_type { get; set; }
[SugarColumn(Length = 500)]
public string permanent_avatar { get; set; }
[SugarColumn(Length = 100)]
public string email { get; set; }
[SugarColumn(Length = 100)]
public byte? email_verified { get; set; }
[SugarColumn(Length = 100)]
public string phone { get; set; }
[SugarColumn(Length = 100)]
public string country_code { get; set; }
[SugarColumn(Length = 100)]
public string region { get; set; }
[SugarColumn(Length = 100)]
public string location { get; set; }
[SugarColumn(ColumnDataType = "text", Length = int.MaxValue, IsNullable = true)]
public string address { get; set; }
[SugarColumn(Length = 100)]
public string affiliation { get; set; }
[SugarColumn(Length = 100)]
public string title { get; set; }
[SugarColumn(Length = 100)]
public string id_card_type { get; set; }
[SugarColumn(Length = 100)]
public string id_card { get; set; }
[SugarColumn(Length = 100)]
public string homepage { get; set; }
[SugarColumn(Length = 100)]
public string bio { get; set; }
[SugarColumn(Length = 100)]
public string tag { get; set; }
[SugarColumn(Length = 100)]
public string language { get; set; }
[SugarColumn(Length = 100)]
public string gender { get; set; }
[SugarColumn(Length = 100)]
public string birthday { get; set; }
[SugarColumn(Length = 100)]
public string education { get; set; }
public int? score { get; set; }
public int? karma { get; set; }
public int? ranking { get; set; }
public byte? is_default_avatar { get; set; }
public byte? is_online { get; set; }
public byte? is_admin { get; set; }
public byte? is_forbidden { get; set; }
public byte? is_deleted { get; set; }
[SugarColumn(Length = 100)]
public string signup_application { get; set; }
[SugarColumn(Length = 100)]
public string hash { get; set; }
[SugarColumn(Length = 100)]
public string pre_hash { get; set; }
[SugarColumn(Length = 100)]
public string access_key { get; set; }
[SugarColumn(Length = 100)]
public string access_secret { get; set; }
[SugarColumn(Length = 100)]
public string created_ip { get; set; }
[SugarColumn(Length = 100)]
public string last_signin_time { get; set; }
[SugarColumn(Length = 100)]
public string last_signin_ip { get; set; }
[SugarColumn(Length = 100)]
public string github { get; set; }
[SugarColumn(Length = 100)]
public string google { get; set; }
[SugarColumn(Length = 100)]
public string qq { get; set; }
[SugarColumn(Length = 100)]
public string wechat { get; set; }
[SugarColumn(Length = 100)]
public string facebook { get; set; }
[SugarColumn(Length = 100)]
public string dingtalk { get; set; }
[SugarColumn(Length = 100)]
public string weibo { get; set; }
[SugarColumn(Length = 100)]
public string gitee { get; set; }
[SugarColumn(Length = 100)]
public string linkedin { get; set; }
[SugarColumn(Length = 100)]
public string wecom { get; set; }
[SugarColumn(Length = 100)]
public string lark { get; set; }
[SugarColumn(Length = 100)]
public string gitlab { get; set; }
[SugarColumn(Length = 100)]
public string adfs { get; set; }
[SugarColumn(Length = 100)]
public string baidu { get; set; }
[SugarColumn(Length = 100)]
public string alipay { get; set; }
[SugarColumn(Length = 100)]
public string casdoor { get; set; }
[SugarColumn(Length = 100)]
public string infoflow { get; set; }
[SugarColumn(Length = 100)]
public string apple { get; set; }
[SugarColumn(Length = 100)]
public string azuread { get; set; }
[SugarColumn(Length = 100)]
public string slack { get; set; }
[SugarColumn(Length = 100)]
public string steam { get; set; }
[SugarColumn(Length = 100)]
public string bilibili { get; set; }
[SugarColumn(Length = 100)]
public string okta { get; set; }
[SugarColumn(Length = 100)]
public string douyin { get; set; }
[SugarColumn(Length = 100)]
public string line { get; set; }
[SugarColumn(Length = 100)]
public string amazon { get; set; }
[SugarColumn(Length = 100)]
public string auth0 { get; set; }
[SugarColumn(Length = 100)]
public string battlenet { get; set; }
[SugarColumn(Length = 100)]
public string bitbucket { get; set; }
[SugarColumn(Length = 100)]
public string box { get; set; }
[SugarColumn(Length = 100)]
public string cloudfoundry { get; set; }
[SugarColumn(Length = 100)]
public string dailymotion { get; set; }
[SugarColumn(Length = 100)]
public string deezer { get; set; }
[SugarColumn(Length = 100)]
public string digitalocean { get; set; }
[SugarColumn(Length = 100)]
public string discord { get; set; }
[SugarColumn(Length = 100)]
public string dropbox { get; set; }
[SugarColumn(Length = 100)]
public string eveonline { get; set; }
[SugarColumn(Length = 100)]
public string fitbit { get; set; }
[SugarColumn(Length = 100)]
public string gitea { get; set; }
[SugarColumn(Length = 100)]
public string heroku { get; set; }
[SugarColumn(Length = 100)]
public string influxcloud { get; set; }
[SugarColumn(Length = 100)]
public string instagram { get; set; }
[SugarColumn(Length = 100)]
public string intercom { get; set; }
[SugarColumn(Length = 100)]
public string kakao { get; set; }
[SugarColumn(Length = 100)]
public string lastfm { get; set; }
[SugarColumn(Length = 100)]
public string mailru { get; set; }
[SugarColumn(Length = 100)]
public string meetup { get; set; }
[SugarColumn(Length = 100)]
public string microsoftonline { get; set; }
[SugarColumn(Length = 100)]
public string naver { get; set; }
[SugarColumn(Length = 100)]
public string nextcloud { get; set; }
[SugarColumn(Length = 100)]
public string onedrive { get; set; }
[SugarColumn(Length = 100)]
public string oura { get; set; }
[SugarColumn(Length = 100)]
public string patreon { get; set; }
[SugarColumn(Length = 100)]
public string paypal { get; set; }
[SugarColumn(Length = 100)]
public string salesforce { get; set; }
[SugarColumn(Length = 100)]
public string shopify { get; set; }
[SugarColumn(Length = 100)]
public string soundcloud { get; set; }
[SugarColumn(Length = 100)]
public string spotify { get; set; }
[SugarColumn(Length = 100)]
public string strava { get; set; }
[SugarColumn(Length = 100)]
public string stripe { get; set; }
[SugarColumn(Length = 100)]
public string tiktok { get; set; }
[SugarColumn(Length = 100)]
public string tumblr { get; set; }
[SugarColumn(Length = 100)]
public string twitch { get; set; }
[SugarColumn(Length = 100)]
public string twitter { get; set; }
[SugarColumn(Length = 100)]
public string typetalk { get; set; }
[SugarColumn(Length = 100)]
public string uber { get; set; }
[SugarColumn(Length = 100)]
public string vk { get; set; }
[SugarColumn(Length = 100)]
public string wepay { get; set; }
[SugarColumn(Length = 100)]
public string xero { get; set; }
[SugarColumn(Length = 100)]
public string yahoo { get; set; }
[SugarColumn(Length = 100)]
public string yammer { get; set; }
[SugarColumn(Length = 100)]
public string yandex { get; set; }
[SugarColumn(Length = 100)]
public string zoom { get; set; }
[SugarColumn(Length = 100)]
public string metamask { get; set; }
[SugarColumn(Length = 100)]
public string web3onboard { get; set; }
[SugarColumn(Length = 100)]
public string custom { get; set; }
//public byte[] webauthnCredentials { get; set; }
[SugarColumn(Length = 100)]
public string preferred_mfa_type { get; set; }
[SugarColumn(Length = 1000)]
public string recovery_codes { get; set; }
[SugarColumn(Length = 100)]
public string totp_secret { get; set; }
public byte? mfa_phone_enabled { get; set; }
public byte? mfa_email_enabled { get; set; }
[SugarColumn(Length = 100)]
public string ldap { get; set; }
[SugarColumn(Length = 100)]
public string properties { get; set; }
[SugarColumn(Length = 100)]
public string roles { get; set; }
[SugarColumn(Length = 100)]
public string permissions { get; set; }
[SugarColumn(Length = 1000)]
public string groups { get; set; }
[SugarColumn(Length = 100)]
public string last_signin_wrong_time { get; set; }
public int? signin_wrong_times { get; set; }
//public byte[] managedAccounts { get; set; }
}
}

View File

@ -0,0 +1,38 @@
using New_College.IRepository;
using New_College.IRepository.UnitOfWork;
using New_College.Model.Models;
using New_College.Model.ViewModels;
using New_College.Repository.Base;
using System.Linq;
using System.Threading.Tasks;
namespace New_College.Repository.MYSQL_CasDoor
{
/// <summary>
/// userRepository
/// </summary>
public class CasdoorUserRepository : BaseRepository<CasdoorUser>, ICasdoorUserRepository
{
public CasdoorUserRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<bool> AccountCancel(string id)
{
var status = false;
var query = await this.Query(e => e.id == id);
if (query != null && query.Count > 0)
{
var isdelete = query.FirstOrDefault();
isdelete.is_deleted = 1;
status = await this.Update(isdelete);
}
return status;
}
}
}

View File

@ -0,0 +1,21 @@

using New_College.IRepository.Base;
using New_College.Model.Models;
using System.Threading.Tasks;
namespace New_College.IRepository
{
/// <summary>
/// IuserRepository
/// </summary>
public interface ICasdoorUserRepository : IBaseRepository<CasdoorUser>
{
/// <summary>
/// 注销账户
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<bool> AccountCancel(string id);
}
}

View File

@ -0,0 +1,26 @@
using New_College.Services.BASE;
using New_College.IRepository.Base;
using New_College.IServices;
using New_College.Model.Models;
using System.Threading.Tasks;
using New_College.IRepository;
namespace New_College.Services
{
public class CasdoorUserServices : BaseServices<CasdoorUser>, ICasdoorUserServices
{
private readonly IBaseRepository<CasdoorUser> _dal;
private readonly ICasdoorUserRepository _userRepository;
public CasdoorUserServices(IBaseRepository<CasdoorUser> dal, ICasdoorUserRepository casdoorUserRepository)
{
this._dal = dal;
base.BaseDal = dal;
_userRepository = casdoorUserRepository;
}
public async Task<bool> AccontCancel(string openId)
{
return await _userRepository.AccountCancel(openId);
}
}
}

View File

@ -26,11 +26,13 @@ namespace New_College.Services
{ {
private readonly IBaseRepository<V_CustomerInfo> _dal; private readonly IBaseRepository<V_CustomerInfo> _dal;
private readonly IT_BatchlineRepository t_BatchlineRepository; private readonly IT_BatchlineRepository t_BatchlineRepository;
public V_CustomerInfoServices(IBaseRepository<V_CustomerInfo> dal, IT_BatchlineRepository t_Batchline) private readonly ICasdoorUserRepository _casdoorUserRepository;
public V_CustomerInfoServices(IBaseRepository<V_CustomerInfo> dal, IT_BatchlineRepository t_Batchline, ICasdoorUserRepository casdoorUserRepository)
{ {
this._dal = dal; this._dal = dal;
base.BaseDal = dal; base.BaseDal = dal;
t_BatchlineRepository = t_Batchline; t_BatchlineRepository = t_Batchline;
_casdoorUserRepository = casdoorUserRepository;
} }
@ -38,28 +40,16 @@ namespace New_College.Services
/// 同步修改密码 /// 同步修改密码
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="query"></param>
private void UpdateCasdoorPwd(CasDoorUpdatePwdDto query) private async void UpdateCasdoorPwd(CasDoorUpdatePwdDto query)
{ {
try try
{ {
if (!string.IsNullOrWhiteSpace(query.service_token)) var list = await _casdoorUserRepository.Query(e => e.id == query.openId);
if (list != null && list.Count() > 0)
{ {
var headers = new System.Collections.Generic.Dictionary<string, string> var updatemodels = list.FirstOrDefault();
{ updatemodels.password = query.newPassword;
{ "Authorization", string.Format("Bearer {0}", query.service_token) } await _casdoorUserRepository.Update(updatemodels);
};
var dics = new Dictionary<string, string>();
dics.Add("id", query.openId);
var userinfo = CasdoorHttpHelper.Http_Get<dynamic>("/api/get-user", headers, dics);
userinfo.password = query.newPassword;
var dto = new ThridUserRequestDto()
{
body = userinfo,
id = query.openId
};
//DingHookHelper.DingTalkHookMessage("Updaterequest", request);
var anyinfo = CasdoorHttpHelper.Http_Post<dynamic>("api/update-user", headers, new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(dto), Encoding.UTF8, "application/json"));
//DingHookHelper.DingTalkHookMessage("Updateset-password", JsonConvert.SerializeObject(anyinfo));
} }
} }
catch (Exception ex) catch (Exception ex)
@ -94,14 +84,6 @@ namespace New_College.Services
var salt = RadomHelper.RandCode(6); var salt = RadomHelper.RandCode(6);
info.UserPwd = MD5Helper.MD5Encrypt16(query.UserPwd + salt); info.UserPwd = MD5Helper.MD5Encrypt16(query.UserPwd + salt);
} }
//if (!string.IsNullOrWhiteSpace(query.UserCode))
//{
// info.UserCode = query.UserCode;
//}
var result = await _dal.Update(info); var result = await _dal.Update(info);
return new CustomerInfoResult() return new CustomerInfoResult()
{ {
@ -282,7 +264,7 @@ namespace New_College.Services
public async Task<MessageModel<CustomerInfoResult>> GetCustomerInfoById(IdQuery query) public async Task<MessageModel<CustomerInfoResult>> GetCustomerInfoById(IdQuery query)
{ {
var info = await _dal.QueryById(query.Id); var info = await _dal.QueryById(query.Id);
if (info == null) if (info == null || info.IsDelete)
return new MessageModel<CustomerInfoResult>() { success = false, msg = "获取失败,用户信息为空" }; return new MessageModel<CustomerInfoResult>() { success = false, msg = "获取失败,用户信息为空" };
var years = info.Year > 2023 ? 2023 : info.Year; var years = info.Year > 2023 ? 2023 : info.Year;
var batchlist = await t_BatchlineRepository.Query(c => c.Year == years && c.AreaName == info.AreaName && c.Type_name == "综合"); var batchlist = await t_BatchlineRepository.Query(c => c.Year == years && c.AreaName == info.AreaName && c.Type_name == "综合");
@ -412,7 +394,7 @@ namespace New_College.Services
public async Task<Tuple<bool, CustomerInfoResult>> Logined(LoginQuery query) public async Task<Tuple<bool, CustomerInfoResult>> Logined(LoginQuery query)
{ {
var userinfo = (await _dal.Query(w => w.OpenId == query.openId)).ToList().FirstOrDefault(); var userinfo = (await _dal.Query(w => w.OpenId == query.openId && w.IsDelete == false)).ToList().FirstOrDefault();
if (userinfo != null) if (userinfo != null)
{ {
return new Tuple<bool, CustomerInfoResult>(true, new CustomerInfoResult() return new Tuple<bool, CustomerInfoResult>(true, new CustomerInfoResult()