Пример #1
0
 public void TestGetList()
 {
     using (ShimsContext.Create())
     {
         //模拟返回结果
         ShimFilialeSao.GetAllFiliale = () => new List <FilialeInfo> {
             new FilialeInfo()
         };
         var result = FilialeManager.GetList();
         Assert.IsNotNull(result);
     }
 }
Пример #2
0
        /// <summary>
        /// 打款完成
        /// </summary>
        /// <param name="salePlatformId"></param>
        /// <param name="applyId"></param>
        protected void PayFinish(Guid salePlatformId, Guid applyId)
        {
            var errorMsg = new StringBuilder();
            MemberMentionApplyInfo memberMentionApplyInfo = MemberCenterSao.GetMemberMentionApply(salePlatformId, applyId);

            if (memberMentionApplyInfo.State == (int)MemberMentionState.Process)
            {
                var orderNoStr = string.Empty;
                if (!string.IsNullOrWhiteSpace(memberMentionApplyInfo.OrderNo))
                {
                    orderNoStr = string.Format("[订单号:{0}]", memberMentionApplyInfo.OrderNo);
                }
                if (!string.IsNullOrWhiteSpace(memberMentionApplyInfo.ThirdPartyOrderNo) || memberMentionApplyInfo.ThirdPartyOrderNo == "-")
                {
                    orderNoStr = string.Format("{0}[第三方平台订单号:{1}]", orderNoStr, memberMentionApplyInfo.ThirdPartyOrderNo);
                }
                var rdescription = string.Format("[余额提现(提现会员:{0};提现申请单号:{1};提现到:{2};操作人:{3}),资金减少,{4})]", memberMentionApplyInfo.UserName, memberMentionApplyInfo.ApplyNo, memberMentionApplyInfo.BankName, Personnel.RealName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                var info = new WasteBookInfo(Guid.NewGuid(), new Guid(RCB_BankAccountsId.SelectedValue),
                                             memberMentionApplyInfo.ApplyNo, rdescription + orderNoStr,
                                             -memberMentionApplyInfo.Amount, (Int32)AuditingState.Yes,
                                             (Int32)WasteBookType.Decrease, memberMentionApplyInfo.SaleFilialeId)
                {
                    LinkTradeCode = memberMentionApplyInfo.ApplyNo,
                    LinkTradeType = (int)WasteBookLinkTradeType.WithdrawDeposit,
                    BankTradeCode = string.Empty,
                    State         = (int)WasteBookState.Currently,
                    IsOut         = false
                };

                var memo        = "提现" + memberMentionApplyInfo.ApplyNo + "取走余额;";
                var description = "提现" + memberMentionApplyInfo.ApplyNo + ",提走余额;" + Common.WebControl.RetrunUserAndTime("提现受理");

                #region 提现
                using (var ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    try
                    {
                        if (info.Income != 0)
                        {
                            _wasteBook.Insert(info);
                        }
                        string errorMessage;
                        var    result = MemberCenterSao.CompleteWithdrawApply(salePlatformId, applyId, memo, description, out errorMessage);
                        if (!result)
                        {
                            throw new Exception("会员名:" + memberMentionApplyInfo.UserName + "提现单号:" + memberMentionApplyInfo.ApplyNo + "   " + errorMessage);
                        }
                        //提现打款完成增加操作记录添加
                        Common.WebControl.AddOperationLog(Personnel.PersonnelId, Personnel.RealName, info.WasteBookId, info.TradeCode, OperationPoint.MemberWithdrawCash.PaySuccess.GetBusinessInfo(), string.Empty);
                        ts.Complete();
                    }
                    catch (Exception ex)
                    {
                        errorMsg.Append("提现失败!" + ex.Message).Append("\\n");
                    }
                    finally
                    {
                        ts.Dispose();
                    }
                }
                #endregion

                #region 发送短信
                try
                {
                    MemberBaseInfo memberBaseInfo = MemberCenterSao.GetUserBase(salePlatformId, memberMentionApplyInfo.MemberId);
                    if (memberBaseInfo != null)
                    {
                        if (!string.IsNullOrEmpty(memberBaseInfo.Mobile))
                        {
                            //可得完成打款发送短信
                            var keedeFilialeId = FilialeManager.GetList().First(f => f.Code.ToLower() == "kede").ID;
                            if (memberMentionApplyInfo.SaleFilialeId == keedeFilialeId)
                            {
                                const string MSG = "您好,您的提现申请已收到,现已完成打款,一般2-5个工作日到账,请注意查收。详情可致电4006202020咨询。感谢您对可得网支持!";
                                MailSMSSao.SendShortMessage(memberMentionApplyInfo.SaleFilialeId, memberMentionApplyInfo.SalePlatformId, memberBaseInfo.Mobile, MSG);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    errorMsg.Append("提现成功,短信发送失败! " + "会员名:" + memberMentionApplyInfo.UserName + "提现单号:" + memberMentionApplyInfo.ApplyNo + "   " + ex.Message).Append("\\n");
                }
                #endregion
            }

            if (!string.IsNullOrEmpty(errorMsg.ToString()))
            {
                throw new Exception(errorMsg.ToString());
            }
        }