/// <summary> /// 商家充值成功方法 /// 窦海超 /// 2015年5月29日 16:00:07 /// </summary> /// <param name="model"></param> private dynamic BusinessRechargeSusess(Ets.Model.DataModel.Business.BusinessRechargeModel model) { #region 充值、流水、商家金额实体组装 BusinessBalanceRecord businessBalanceRecord = new BusinessBalanceRecord() { Amount = model.PayAmount, BusinessId = model.BusinessId, Operator = model.PayBy, RecordType = BusinessBalanceRecordRecordType.Recharge.GetHashCode(), RelationNo = model.OrderNo, Remark = "商家客户端充值", Status = 1, WithwardId = 0 }; UpdateForWithdrawPM forWithdrawPM = new UpdateForWithdrawPM() { Id = model.BusinessId, Money = model.PayAmount }; #endregion using (IUnitOfWork tran = EdsUtilOfWorkFactory.GetUnitOfWorkOfEDS()) { new BusinessRechargeDao().Insert(model); //写入充值 new BusinessDao().UpdateForWithdrawC(forWithdrawPM); //更新商家金额、可提现金额 new BusinessBalanceRecordDao().Insert(businessBalanceRecord); //写商家流水 tran.Complete(); } #region jpush推送 Task.Factory.StartNew(() => { JPushModel jpushModel = new JPushModel() { Alert = string.Concat("已成功充值", model.PayAmount, "元"), City = string.Empty, RegistrationId = model.BusinessId.ToString(),//发送商家ID TagId = 1, Title = "充值成功提醒" }; Ets.Service.Provider.MyPush.Push.PushMessage(jpushModel); }); #endregion string success = string.Concat("成功完成商家充值订单号:", model.OrderNo); LogHelper.LogWriter(success); return("success"); }
/// <summary> /// 更新一条记录 /// </summary> /// <param name="businessBalanceRecord">参数实体</param> public void Update(BusinessBalanceRecord businessBalanceRecord) { const string updateSql = @" update BusinessBalanceRecord set Amount=@Amount,Status=@Status,Balance=@Balance,RecordType=@RecordType,Operator=@Operator,OperateTime=@OperateTime,RelationNo=@RelationNo,Remark=@Remark where Id=@Id "; IDbParameters dbParameters = DbHelper.CreateDbParameters(); dbParameters.AddWithValue("Amount", businessBalanceRecord.Amount); dbParameters.AddWithValue("Status", businessBalanceRecord.Status); dbParameters.AddWithValue("Balance", businessBalanceRecord.Balance); dbParameters.AddWithValue("RecordType", businessBalanceRecord.RecordType); dbParameters.AddWithValue("Operator", businessBalanceRecord.Operator); dbParameters.AddWithValue("OperateTime", businessBalanceRecord.OperateTime); dbParameters.AddWithValue("RelationNo", businessBalanceRecord.RelationNo); dbParameters.AddWithValue("Remark", businessBalanceRecord.Remark); DbHelper.ExecuteNonQuery(SuperMan_Write, updateSql, dbParameters); }
/// <summary> /// 增加一条记录 /// </summary> /// <param name="businessBalanceRecord">参数实体</param> /// <returns></returns> public long Insert(BusinessBalanceRecord businessBalanceRecord) { const string insertSql = @" insert into BusinessBalanceRecord (BusinessId,Amount,Status,Balance,RecordType,Operator,WithwardId,RelationNo,Remark) select @BusinessId,@Amount,@Status,b.BalancePrice,@RecordType,@Operator,@WithwardId,@RelationNo,@Remark from dbo.business as b where Id=@BusinessId select @@IDENTITY"; IDbParameters dbParameters = DbHelper.CreateDbParameters(); dbParameters.AddWithValue("BusinessId", businessBalanceRecord.BusinessId); //商户id dbParameters.AddWithValue("Amount", businessBalanceRecord.Amount); //流水金额 dbParameters.AddWithValue("Status", businessBalanceRecord.Status); //流水状态(1、交易成功 2、交易中) dbParameters.AddWithValue("RecordType", businessBalanceRecord.RecordType); //交易类型(1佣金 2奖励 3提现 4取消订单赔偿 5无效订单扣款) dbParameters.AddWithValue("Operator", businessBalanceRecord.Operator); //操作人 dbParameters.AddWithValue("WithwardId", businessBalanceRecord.WithwardId); //关联ID dbParameters.AddWithValue("RelationNo", businessBalanceRecord.RelationNo); //关联单号 dbParameters.AddWithValue("Remark", businessBalanceRecord.Remark); //描述 object result = DbHelper.ExecuteScalar(SuperMan_Write, insertSql, dbParameters); return(ParseHelper.ToLong(result)); }