コード例 #1
0
ファイル: Wallet.cs プロジェクト: zanderphh/Shop
        /// <summary>
        /// 审核提现状态
        /// </summary>
        /// <param name="withdrawApplyId"></param>
        /// <param name="status"></param>
        /// <param name="remark"></param>
        public void ChangeWithdrawApplyStatus(Guid withdrawApplyId, WithdrawApplyStatus status, string remark)
        {
            var withdrawApply = _withdrawApplys.SingleOrDefault(x => x.Id == withdrawApplyId);

            if (withdrawApply == null)
            {
                throw new Exception("不存在该提现申请.");
            }

            if (status == WithdrawApplyStatus.Success)
            {
                if (_lockedCash < withdrawApply.Info.Amount)
                {
                    throw new Exception("错误的锁定金额");
                }
                var finalLockedCash = _lockedCash;
                finalLockedCash -= withdrawApply.Info.Amount;

                ApplyEvent(new WithdrawApplySuccessEvent(withdrawApplyId, withdrawApply.Info.Amount, finalLockedCash));
            }
            if (status == WithdrawApplyStatus.Rejected)
            {
                //拒绝提现申请
                var finalLockedCash = _lockedCash;
                finalLockedCash -= withdrawApply.Info.Amount;
                ApplyEvent(new WithdrawApplyRejectedEvent(withdrawApplyId, withdrawApply.Info.Amount, finalLockedCash, remark));
            }
        }
コード例 #2
0
 public ChangeWithdrawStatusCommand(Guid withdrawApplyId,
                                    WithdrawApplyStatus status, string remark)
 {
     WithdrawApplyId = withdrawApplyId;
     Status          = status;
     Remark          = remark;
 }
コード例 #3
0
 public WithdrawApply(Guid id, WithdrawApplyInfo info, WithdrawApplyStatus status)
 {
     Id     = id;
     Info   = info;
     Status = status;
 }