Exemple #1
0
        /// <summary>
        /// 用户拼团成功返现
        /// </summary>
        /// <param name="id">提现账号id(PlatUserCash)</param>
        /// <param name="drawcashmoney">提现金额(分)</param>
        /// <returns></returns>
        public string PxhUserApplyDrawCash(PinGoodsOrder order, int userId, string appid)
        {
            PinGoodsOrderBLL pinGoodsOrderBLL = new PinGoodsOrderBLL();
            TransactionModel tran             = new TransactionModel();

            if (userId <= 0)
            {
                return("用户ID不能为0");
            }
            if (order.returnMoney <= 0)
            {
                return("返现金额不能为0");
            }
            if (string.IsNullOrEmpty(appid))
            {
                return("appid不能为空");
            }

            int           serviceFee       = 0;//服务费
            string        partner_trade_no = WxPayApi.GenerateOutTradeNo();
            DrawCashApply apply            = new DrawCashApply()
            {
                Aid              = order.aid,
                appId            = appid,
                partner_trade_no = partner_trade_no,
                userId           = userId,
                applyMoney       = order.returnMoney,
                serviceMoney     = serviceFee,
                cashMoney        = order.returnMoney - serviceFee,
                useCash          = "0",
                BeforeApplyMoney = 0,
                AddTime          = DateTime.Now,
                remark           = "拼享惠拼团成功用户申请返现",
                hostIP           = WebHelper.GetIP(),
                state            = 0,
                drawState        = (int)DrawCashState.未开始提现,
                applyType        = (int)DrawCashApplyType.拼享惠用户返现,
                drawCashWay      = (int)DrawCashWay.微信提现,
                OrderId          = order.id,
            };

            tran.Add(base.BuildAddSql(apply));

            order.isReturnMoney = 1;
            tran.Add(pinGoodsOrderBLL.BuildUpdateSql(order, "isReturnMoney"));

            if (!base.ExecuteTransactionDataCorect(tran.sqlArray))
            {
                return("申请提现失败");
            }
            return("");
        }
Exemple #2
0
        /// <summary>
        /// 更新用户拼团成功提现结果
        /// </summary>
        /// <param name="code">0提现失败 1提现成功</param>
        /// <param name="drawCashApplyId"></param>
        /// <param name="result">附加信息</param>
        /// <returns></returns>
        public string UpdatePxhUserDrawCashResult(int code, DrawCashApply drawCashApply, string result, int state = 0)
        {
            TransactionModel tranModel = new TransactionModel();
            C_UserInfo       usercash  = C_UserInfoBLL.SingleModel.GetModel(drawCashApply.userId);

            if (usercash == null)
            {
                return("没有找到用户提现账号");
            }
            //if (drawCashApply.drawState != (int)DrawCashState.提现中)
            //{
            //    return "无效状态";
            //}
            if (code == 1)
            {
                drawCashApply.drawState = 2;
                drawCashApply.DrawTime  = DateTime.Now;
                drawCashApply.remark   += $" ;本次提现成功{DateTime.Now}";
            }
            else
            {
                PinGoodsOrderBLL pinGoodsOrderBLL = new PinGoodsOrderBLL();
                PinGoodsOrder    order            = pinGoodsOrderBLL.GetModel(drawCashApply.OrderId);
                if (order == null)
                {
                    return("没有找到拼享惠订单");
                }
                order.isReturnMoney = 0;
                tranModel.Add(pinGoodsOrderBLL.BuildUpdateSql(order, "isReturnMoney"));
                //表示提现失败
                //tranModel.Add($"update PinGoodsOrder set isReturnMoney=0 where id={order.id}");

                drawCashApply.drawState = -1;
                if (state == (int)ApplyState.审核不通过)
                {
                    drawCashApply.state = state;
                }

                drawCashApply.DrawTime = DateTime.Now;
                drawCashApply.remark   = $" ;本次提现失败{DateTime.Now},原因{result}";
            }

            tranModel.Add(base.BuildUpdateSql(drawCashApply, "state,drawState,DrawTime,remark"));

            bool success = base.ExecuteTransactionDataCorect(tranModel.sqlArray);

            return(success ? "" : "执行更新拼享惠用户提现结果失败");
        }