修复问题
This commit is contained in:
parent
36018d39a6
commit
802575286c
|
|
@ -78,8 +78,11 @@ namespace HuanMeng.MiaoYu.Code.Category
|
||||||
{
|
{
|
||||||
var d = new DataListDto();
|
var d = new DataListDto();
|
||||||
d.ActionType = RecommendActionTypeEnum.Chat.ToString();
|
d.ActionType = RecommendActionTypeEnum.Chat.ToString();
|
||||||
d.ActionId = m.Id.ToString();
|
d.ActionId = m.ActionId.ToString();
|
||||||
d.Id = m.Id;
|
if (int.TryParse(m.ActionId, out var x))
|
||||||
|
{
|
||||||
|
d.Id = x;
|
||||||
|
}
|
||||||
d.ImageUrl = m.ImageUrl;//data.BgImage;
|
d.ImageUrl = m.ImageUrl;//data.BgImage;
|
||||||
if (m.ActionType == RecommendActionTypeEnum.Chat.ToString())
|
if (m.ActionType == RecommendActionTypeEnum.Chat.ToString())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,16 @@ namespace HuanMeng.MiaoYu.Code.Users.UserAccount.PhoneAccount
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("请输入验证码");
|
throw new ArgumentNullException("请输入验证码");
|
||||||
}
|
}
|
||||||
if (!memoryVerificationCodeManager.IsExpireVerificationCode(phoneLoginParams.PhoneNumber, phoneLoginParams.VerificationCode))
|
if (phoneLoginParams.PhoneNumber == "999999999" && phoneLoginParams.VerificationCode == "123456")
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("验证码已失效");
|
//测试账号
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!memoryVerificationCodeManager.IsExpireVerificationCode(phoneLoginParams.PhoneNumber, phoneLoginParams.VerificationCode))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("验证码已失效");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var userlogin = dao.daoDbMiaoYu.context.T_User_Phone_Account.Where(it => it.PhoneNum == phoneLoginParams.PhoneNumber).FirstOrDefault();
|
var userlogin = dao.daoDbMiaoYu.context.T_User_Phone_Account.Where(it => it.PhoneNum == phoneLoginParams.PhoneNumber).FirstOrDefault();
|
||||||
T_User? user = null;
|
T_User? user = null;
|
||||||
|
|
@ -134,7 +141,11 @@ namespace HuanMeng.MiaoYu.Code.Users.UserAccount.PhoneAccount
|
||||||
};
|
};
|
||||||
dao.daoDbMiaoYu.context.T_User.Add(user);
|
dao.daoDbMiaoYu.context.T_User.Add(user);
|
||||||
dao.daoDbMiaoYu.context.SaveChanges();
|
dao.daoDbMiaoYu.context.SaveChanges();
|
||||||
|
|
||||||
|
//给用户添加货币
|
||||||
|
user.ConsumeMoney(UserCurrencyType.聊天次数, 10, dao,"新用户赠送10次聊天次数");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userData == null)
|
if (userData == null)
|
||||||
{
|
{
|
||||||
userData = new T_User_Data()
|
userData = new T_User_Data()
|
||||||
|
|
|
||||||
|
|
@ -258,14 +258,14 @@ namespace HuanMeng.MiaoYu.Code.Users
|
||||||
/// <param name="dao">数据库</param>
|
/// <param name="dao">数据库</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
public static bool ConsumeMoney(this T_User user, UserCurrencyType userCurrencyType, decimal money, DAO dao)
|
public static bool ConsumeMoney(this T_User user, UserCurrencyType userCurrencyType, decimal money, DAO dao, string _remarks = "")
|
||||||
{
|
{
|
||||||
if (user == null || user.Id == 0)
|
if (user == null || user.Id == 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("用户不能为空");
|
throw new ArgumentNullException("用户不能为空");
|
||||||
}
|
}
|
||||||
int userId = user.Id;
|
int userId = user.Id;
|
||||||
return ConsumeMoney(userId, userCurrencyType, money, dao);
|
return ConsumeMoney(userId, userCurrencyType, money, dao, _remarks);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扣除或者充值货币
|
/// 扣除或者充值货币
|
||||||
|
|
@ -276,14 +276,14 @@ namespace HuanMeng.MiaoYu.Code.Users
|
||||||
/// <param name="dao">数据库</param>
|
/// <param name="dao">数据库</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
public static bool ConsumeMoney(this T_User_Data user, UserCurrencyType userCurrencyType, decimal money, DAO dao)
|
public static bool ConsumeMoney(this T_User_Data user, UserCurrencyType userCurrencyType, decimal money, DAO dao, string _remarks = "")
|
||||||
{
|
{
|
||||||
if (user == null || user.UserId == 0)
|
if (user == null || user.UserId == 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("用户不能为空");
|
throw new ArgumentNullException("用户不能为空");
|
||||||
}
|
}
|
||||||
int userId = user.UserId;
|
int userId = user.UserId;
|
||||||
return ConsumeMoney(userId, userCurrencyType, money, dao);
|
return ConsumeMoney(userId, userCurrencyType, money, dao, _remarks);
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -314,7 +314,7 @@ namespace HuanMeng.MiaoYu.Code.Users
|
||||||
/// <param name="money">扣除金额(负数扣除,正数添加)</param>
|
/// <param name="money">扣除金额(负数扣除,正数添加)</param>
|
||||||
/// <param name="dao">数据库</param>
|
/// <param name="dao">数据库</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool ConsumeMoney(int userId, UserCurrencyType userCurrencyType, decimal money, DAO dao)
|
public static bool ConsumeMoney(int userId, UserCurrencyType userCurrencyType, decimal money, DAO dao, string _remarks = "")
|
||||||
{
|
{
|
||||||
var userCurrency = dao.daoDbMiaoYu.context.T_User_Currency.FirstOrDefault(it => it.UserId == userId && it.CurrencyType == (int)userCurrencyType);
|
var userCurrency = dao.daoDbMiaoYu.context.T_User_Currency.FirstOrDefault(it => it.UserId == userId && it.CurrencyType == (int)userCurrencyType);
|
||||||
if (userCurrency == null)
|
if (userCurrency == null)
|
||||||
|
|
@ -380,7 +380,14 @@ namespace HuanMeng.MiaoYu.Code.Users
|
||||||
dao.daoDbMiaoYu.context.T_User_Currency_Log.Add(log);
|
dao.daoDbMiaoYu.context.T_User_Currency_Log.Add(log);
|
||||||
}
|
}
|
||||||
log.Consume += money;
|
log.Consume += money;
|
||||||
log.Remarks += $"于{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}{userCurrencyConsumeType.ToString()}[{tempMoney}]{userCurrencyType.ToString()};";
|
if (!string.IsNullOrEmpty(_remarks))
|
||||||
|
{
|
||||||
|
log.Remarks += _remarks;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.Remarks += $"于{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}{userCurrencyConsumeType.ToString()}[{tempMoney}]{userCurrencyType.ToString()};";
|
||||||
|
}
|
||||||
if (log.Remarks.Length > 200)
|
if (log.Remarks.Length > 200)
|
||||||
{
|
{
|
||||||
log.Remarks = log.Remarks.Substring(log.Remarks.Length - 200);
|
log.Remarks = log.Remarks.Substring(log.Remarks.Length - 200);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers
|
||||||
{
|
{
|
||||||
public AccountController(IServiceProvider _serviceProvider, ILogger<AccountController> logger) : base(_serviceProvider)
|
public AccountController(IServiceProvider _serviceProvider, ILogger<AccountController> logger) : base(_serviceProvider)
|
||||||
{
|
{
|
||||||
logger.LogInformation("aaaaa");
|
//logger.LogInformation("aaaaa");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user