添加用户协议

This commit is contained in:
zpc 2024-12-06 14:05:01 +08:00
parent 600125711d
commit 693058c65d
2 changed files with 44 additions and 2 deletions

View File

@ -119,4 +119,18 @@ public class AccountController : CloudGamingControllerBase
await account.ExitApp();
return true;
}
/// <summary>
/// 账号注销
/// </summary>
/// <returns></returns>
[HttpPost]
[Message("注销成功")]
public async Task<bool> AccountLogOff()
{
AccountBLL account = new AccountBLL(ServiceProvider);
await account.AccountLogOff();
return true;
}
}

View File

@ -719,8 +719,36 @@ namespace CloudGaming.Code.Account
{
await userInfo.DeleteUserInfoCache(this);
}
}
/// <summary>
/// 账号注销
/// </summary>
/// <returns></returns>
public async Task AccountLogOff()
{
if (_UserId == 0)
{
return;
}
//redis
//用户信息
var user = await Dao.DaoUser.Context.T_User.FirstOrDefaultAsync(it => it.Id == _UserId);
if (user != null)
{
user.State = 1;
}
//用户手机号登录表
var userData = await Dao.DaoUser.Context.T_User_Phone_Account.FirstOrDefaultAsync(it => it.UserId == _UserId);
if (userData != null)
{
userData.IsLogout = true;
}
await Dao.DaoUser.Context.SaveChangesAsync();
var userInfo = await AccountExtend.GetUserInfoOrNull(_UserId, this);
if (userInfo != null)
{
await userInfo.DeleteUserInfoCache(this);
}
}
}
}