You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

using Furion.FriendlyException;
using GDZZ.Application.Entity;
using GDZZ.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDZZ.Application.Service
{
public class UtilService
{
private readonly SqlSugarRepository<MiniRecharge> rechargeRep; //充值仓储
/// <summary>
/// 奖励重载
/// </summary>
/// <param name="rechargeRep"></param>
public UtilService(SqlSugarRepository<MiniRecharge> rechargeRep)
{
this.rechargeRep = rechargeRep;
}
/// <summary>
/// 奖励
/// </summary>
/// <param name="userID"></param>
/// <param name="prize"></param>
public async void Reward(long userID, decimal prize)
{
var recharge = await this.rechargeRep.InsertAsync(new MiniRecharge()
{
CreatedUserId = userID,
PaymentMoney = prize,
Status = RechargeEnum.Finish,
Type = RechargeTypeEnum.Reward,
TotalPrice = prize
});
if (recharge < 1)
throw Oops.Oh("奖励发放失败!");
}
}
}