Example #1
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(int keyValue, dm_apply_cashrecordEntity entity)
 {
     try
     {
         if (keyValue > 0)
         {
             entity.Modify(keyValue);
             this.BaseRepository("dm_data").Update(entity);
         }
         else
         {
             entity.Create();
             this.BaseRepository("dm_data").Insert(entity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
Example #2
0
        public void ApplyAccountCash(int user_id, decimal price, string remark)
        {
            IRepository db = null;

            try
            {
                dm_userEntity dm_UserEntity = dm_UserIBLL.GetEntity(user_id);//不从缓存取,此处需要验证账户余额
                if (dm_UserEntity.IsEmpty())
                {
                    throw new Exception("用户信息异常!");
                }
                if (price > dm_UserEntity.accountprice)
                {
                    throw new Exception("账户余额不足!");
                }
                else
                {
                    dm_UserEntity.accountprice -= price;
                    dm_UserEntity.Modify(user_id);

                    #region 增加提现记录
                    dm_apply_cashrecordEntity dm_Apply_CashrecordEntity = new dm_apply_cashrecordEntity();
                    dm_Apply_CashrecordEntity.user_id      = user_id;
                    dm_Apply_CashrecordEntity.createtime   = DateTime.Now;
                    dm_Apply_CashrecordEntity.paytype      = 0;
                    dm_Apply_CashrecordEntity.price        = price;
                    dm_Apply_CashrecordEntity.currentprice = dm_UserEntity.accountprice;
                    dm_Apply_CashrecordEntity.remark       = remark;
                    dm_Apply_CashrecordEntity.status       = 0;
                    #endregion

                    db = BaseRepository("dm_data").BeginTrans();
                    db.Update(dm_UserEntity);
                    db.Insert(dm_Apply_CashrecordEntity);

                    db.Commit();
                }
            }
            catch (Exception ex)
            {
                if (db != null)
                {
                    db.Rollback();
                }
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Example #3
0
        /// <summary>
        /// 审核提现记录
        /// </summary>
        /// <param name="id">提现记录id</param>
        public void CheckApplyCashRecord(int id, int paytype)
        {
            IRepository db = null;

            try
            {
                dm_apply_cashrecordEntity dm_Apply_CashrecordEntity = GetEntity(id);
                if (dm_Apply_CashrecordEntity.IsEmpty())
                {
                    throw new Exception("提现记录不存在!");
                }

                dm_Apply_CashrecordEntity.paytype = paytype;
                dm_Apply_CashrecordEntity.status  = 1;

                dm_accountdetailEntity dm_AccountdetailEntity = new dm_accountdetailEntity();
                dm_AccountdetailEntity.currentvalue = dm_AccountdetailEntity.currentvalue;
                dm_AccountdetailEntity.stepvalue    = dm_Apply_CashrecordEntity.price;
                dm_AccountdetailEntity.type         = 11;
                dm_AccountdetailEntity.title        = "提现";
                dm_AccountdetailEntity.remark       = "账户余额提现";
                dm_AccountdetailEntity.user_id      = dm_Apply_CashrecordEntity.user_id;
                dm_AccountdetailEntity.createtime   = DateTime.Now;

                db = BaseRepository("dm_data").BeginTrans();
                db.Update(dm_Apply_CashrecordEntity);
                db.Insert(dm_AccountdetailEntity);
                db.Commit();
            }
            catch (Exception ex)
            {
                if (db != null)
                {
                    db.Rollback();
                }
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
 public void CheckApplyCashRecordByAli(dm_apply_cashrecordEntity dm_Apply_CashrecordEntity)
 {
     try
     {
         dM_Apply_CashRecordService.CheckApplyCashRecordByAli(dm_Apply_CashrecordEntity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(int keyValue, dm_apply_cashrecordEntity entity)
 {
     try
     {
         dM_Apply_CashRecordService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
Example #6
0
 public void CheckApplyCashRecordByAli(dm_apply_cashrecordEntity dm_Apply_CashrecordEntity)
 {
     try
     {
         BaseRepository("dm_data").Update(dm_Apply_CashrecordEntity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
Example #7
0
        /// <summary>
        /// 审核提现记录
        /// </summary>
        /// <param name="id">提现记录id</param>
        public void CheckApplyCashRecord(int id, int paytype)
        {
            try
            {
                dm_apply_cashrecordEntity dm_Apply_CashrecordEntity = GetEntity(id);
                if (dm_Apply_CashrecordEntity.IsEmpty())
                {
                    throw new Exception("提现记录不存在!");
                }

                if (dm_Apply_CashrecordEntity.status != 0)
                {
                    throw new Exception("当前提现记录不可操作!");
                }

                dm_Apply_CashrecordEntity.paytype   = paytype;
                dm_Apply_CashrecordEntity.status    = 1;
                dm_Apply_CashrecordEntity.checktime = DateTime.Now;

                /*
                 * 余额明细在提现列表返回
                 * dm_accountdetailEntity dm_AccountdetailEntity = new dm_accountdetailEntity();
                 * dm_AccountdetailEntity.currentvalue = dm_Apply_CashrecordEntity.currentprice;
                 * dm_AccountdetailEntity.stepvalue = dm_Apply_CashrecordEntity.price;
                 * dm_AccountdetailEntity.type = 11;
                 * dm_AccountdetailEntity.title = "提现";
                 * dm_AccountdetailEntity.remark = "账户余额提现";
                 * dm_AccountdetailEntity.user_id = dm_Apply_CashrecordEntity.user_id;
                 * dm_AccountdetailEntity.createtime = DateTime.Now;*/

                BaseRepository("dm_data").Update(dm_Apply_CashrecordEntity);
            }
            catch (Exception ex)
            {
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Example #8
0
        public void ApplyAccountCash(int user_id, decimal price, string remark, string appid)
        {
            IRepository db = null;

            try
            {
                lock (sign)
                {
                    dm_userEntity        dm_UserEntity        = dm_UserIBLL.GetEntity(user_id);//不从缓存取,此处需要验证账户余额
                    dm_basesettingEntity dm_BasesettingEntity = dm_BaseSettingService.GetEntityByCache(appid);
                    if (dm_UserEntity.IsEmpty())
                    {
                        throw new Exception("用户信息异常!");
                    }
                    //if (dm_UserEntity.isreal == 0)  未实名认证也可以提现(2021-01-11)
                    //    throw new Exception("您的账号未实名,禁止提现!");
                    if (dm_UserEntity.zfb.IsEmpty())
                    {
                        throw new Exception("支付宝账号未绑定,禁止提现!");
                    }
                    if (price < dm_BasesettingEntity.cashrecord_min_price)
                    {
                        throw new Exception(string.Format("最低提现金额不得小于{0}元!", dm_BasesettingEntity.cashrecord_min_price));
                    }

                    if (price > dm_UserEntity.accountprice)
                    {
                        throw new Exception("账户余额不足!");
                    }
                    else
                    {
                        decimal predict_price = price;
                        if (dm_BasesettingEntity.cashrecord_fee > 0)
                        {
                            price = price * (1 - dm_BasesettingEntity.cashrecord_fee / 100);
                        }
                        if (price <= 0)
                        {
                            throw new Exception("提现数据异常,请联系官方客服!");
                        }

                        dm_UserEntity.accountprice -= predict_price;
                        dm_UserEntity.Modify(user_id);

                        #region 增加提现记录
                        dm_apply_cashrecordEntity dm_Apply_CashrecordEntity = new dm_apply_cashrecordEntity();
                        dm_Apply_CashrecordEntity.user_id       = user_id;
                        dm_Apply_CashrecordEntity.createtime    = DateTime.Now;
                        dm_Apply_CashrecordEntity.paytype       = 0;
                        dm_Apply_CashrecordEntity.price         = price;
                        dm_Apply_CashrecordEntity.predict_price = predict_price;
                        dm_Apply_CashrecordEntity.currentprice  = dm_UserEntity.accountprice;
                        dm_Apply_CashrecordEntity.remark        = remark;
                        dm_Apply_CashrecordEntity.status        = 0;
                        #endregion

                        #region 增加余额变更明细(2020-08-20)
                        dm_accountdetailEntity dm_AccountdetailEntity = new dm_accountdetailEntity();
                        dm_AccountdetailEntity.currentvalue = dm_Apply_CashrecordEntity.currentprice;
                        dm_AccountdetailEntity.stepvalue    = dm_Apply_CashrecordEntity.price;
                        dm_AccountdetailEntity.type         = 11;
                        dm_AccountdetailEntity.profitLoss   = CommonHelper.GetProfitLoss(11);
                        dm_AccountdetailEntity.title        = "提现";
                        dm_AccountdetailEntity.remark       = "账户余额提现";
                        dm_AccountdetailEntity.user_id      = dm_Apply_CashrecordEntity.user_id;
                        dm_AccountdetailEntity.createtime   = DateTime.Now;
                        #endregion

                        db = BaseRepository("dm_data").BeginTrans();
                        db.Update(dm_UserEntity);
                        db.Insert(dm_Apply_CashrecordEntity);
                        db.Insert(dm_AccountdetailEntity);

                        db.Commit();
                    }
                }
            }
            catch (Exception ex)
            {
                if (db != null)
                {
                    db.Rollback();
                }
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }