예제 #1
0
        public void RefuseApplyWithDraw(long id, ApplyWithdrawInfo.ApplyWithdrawStatus status, string opuser, string remark)
        {
            //var model = Context.ApplyWithDrawInfo.FirstOrDefault(e => e.Id == id);
            var model = DbFactory.Default.Get <ApplyWithdrawInfo>().Where(e => e.Id == id).FirstOrDefault();

            model.ApplyStatus = status;
            model.OpUser      = opuser;
            model.Remark      = remark;
            model.ConfirmTime = DateTime.Now;
            DbFactory.Default.Update(model);
            //var capital = Context.CapitalInfo.FirstOrDefault(e => e.MemId == model.MemId);
            var capital = DbFactory.Default.Get <CapitalInfo>().Where(e => e.MemId == model.MemId).FirstOrDefault();

            //capital.Balance = capital.Balance.Value + model.ApplyAmount;
            //capital.FreezeAmount = capital.FreezeAmount - model.ApplyAmount;
            DbFactory.Default.Set <CapitalInfo>().Set(n => n.Balance, capital.Balance + model.ApplyAmount)
            .Set(n => n.FreezeAmount, capital.FreezeAmount - model.ApplyAmount).Where(p => p.Id == capital.Id).Succeed();
            //发送消息
            var member  = DbFactory.Default.Get <MemberInfo>(m => m.Id == model.MemId).FirstOrDefault();
            var message = new MessageWithDrawInfo();

            message.UserName  = model.NickName;
            message.UserName  = member != null ? member.UserName : "";
            message.Amount    = model.ApplyAmount;
            message.ApplyType = model.ApplyType.GetHashCode();
            message.ApplyTime = model.ApplyTime;
            message.Remark    = model.Remark;
            message.SiteName  = SiteSettingApplication.SiteSettings.SiteName;
            Task.Factory.StartNew(() => ServiceProvider.Instance <IMessageService> .Create.SendMessageOnMemberWithDrawFail(model.MemId, message));
            //Context.SaveChanges();
        }
예제 #2
0
 /// <summary>
 /// 拒绝会员提现申请
 /// </summary>
 /// <param name="id"></param>
 /// <param name="status"></param>
 /// <param name="opuser"></param>
 /// <param name="remark"></param>
 public static void RefuseApplyWithDraw(long id, ApplyWithdrawInfo.ApplyWithdrawStatus status, string opuser, string remark)
 {
     Service.RefuseApplyWithDraw(id, status, opuser, remark);
 }