修改问题

This commit is contained in:
zpc 2024-10-14 21:05:48 +08:00
parent b1f56c46b9
commit fd623af85b

View File

@ -221,10 +221,21 @@ namespace HuanMeng.MiaoYu.Code.Music
{
throw new Exception("请先登录");
}
UserInfoBLL userInfoBLL = new UserInfoBLL(Dao, _UserId);
if (!userInfoBLL.IsCheckingSufficient(UserCurrencyType., 10))
var songVip = Dao.daoDbMiaoYu.context.M_SongVIP.FirstOrDefault(it => it.UserId == _UserId && it.ExpirationAt > DateTime.Now);
bool isSongVip = false;
if (songVip != null)
{
throw new Exception("音乐点数不足");
isSongVip = true;
}
UserInfoBLL userInfoBLL = new UserInfoBLL(Dao, _UserId);
if (!isSongVip)
{
if (!userInfoBLL.IsCheckingSufficient(UserCurrencyType., 10))
{
throw new Exception("音乐点数不足");
}
}
bool isGenresId = false;
var genresId = MiaoYuCacheExtend.GetMiaoYuDataEntityCacheList<M_MusicGenres>(this, it => it.IsEnabled)?.FirstOrDefault(it => it.GenreName == musicCreateRequest.GenreName)?.Id;
@ -292,7 +303,29 @@ namespace HuanMeng.MiaoYu.Code.Music
Dao.daoDbMiaoYu.context.Add(song2);
}
//扣除货币
userInfoBLL[UserCurrencyType.].ConsumeMoneyNoWork(-10, Dao);
if (!isSongVip)
{
userInfoBLL[UserCurrencyType.].ConsumeMoneyNoWork(-10, Dao);
}
else
{
var log = new T_User_Currency_Log()
{
Consume = 0,
ConsumeType = 0,
CreateTime = DateTime.Now,
CurrencyType = (int)UserCurrencyType.,
UpdateTime = DateTime.Now,
UserId = _UserId,
Remarks = "会员生成音乐",
Title = "音乐生成",
OrderId = "",
IsHide = false
};
Dao.daoDbMiaoYu.context.T_User_Currency_Log.Add(log);
}
Dao.daoDbMiaoYu.context.SaveChanges();
return new BaseResponse<int>(ResonseCode.Success, "音乐正在生成", m_SongInfo.Id) { };
}