Exemplo n.º 1
0
        /// <summary>
        /// 提现信息列表展示
        /// </summary>
        /// <returns></returns>
        public ActionResult PaymentList()
        {
            int    pageCount    = 0;
            int    pageIndexs   = string.IsNullOrEmpty(Request["curr"]) ? 1 : Int32.Parse(Request["curr"]);    //当前页
            int    PageSize     = string.IsNullOrEmpty(Request["psize"]) ? 20 : Int32.Parse(Request["psize"]); //每页显示数量
            string types        = string.IsNullOrEmpty(Request["s_type"]) ? "1" : Request["s_type"];
            string searchKey    = string.IsNullOrEmpty(Request["s_key"]) ? "" : Request["s_key"];
            string stime        = string.IsNullOrEmpty(Request["s_begin"]) ? DateTime.Now.ToString("yyyy-MM-dd") : Request["s_begin"];
            string etime        = string.IsNullOrEmpty(Request["s_end"]) ? DateTime.Now.ToString("yyyy-MM-dd") : Request["s_end"];
            string b_tradestate = string.IsNullOrEmpty(Request["check"]) ? "" : Request["check"];           //交易状态
            string payfashion   = string.IsNullOrEmpty(Request["payfashion"]) ? "" : Request["payfashion"]; //付款方式

            #region 组装查询语句
            string where = "where c.u_id=" + UserInfo.UserId + " ";
            string orderby = " order by b_id desc";
            if (!string.IsNullOrEmpty(types.ToString()))
            {
                if (!string.IsNullOrEmpty(searchKey))
                {
                    if (types == "0")
                    {
                        where += string.Format(" and  b_batchnumber like '%{0}%'", searchKey);
                    }
                    else if (types == "1")
                    {
                        where += string.Format(" and b_number like '%{0}%'", searchKey);
                    }
                    else if (types == "2")
                    {
                        where += string.Format(" and b_tradeno like '%{0}%'", searchKey);
                    }
                    else if (types == "3")
                    {
                        where += string.Format(" and b.u_name like '%{0}%'", searchKey);
                    }
                }
            }

            if (!string.IsNullOrEmpty(stime) && !string.IsNullOrEmpty(etime))
            {
                where += " and b_date >='" + stime + " 00:00:00'  and b_date<='" + etime + " 23:59:59' ";
            }

            if (!string.IsNullOrEmpty(b_tradestate))
            {
                where += string.Format(" and a.b_tradestate={0}", b_tradestate);
            }
            if (!string.IsNullOrEmpty(payfashion))
            {
                where += string.Format(" and a.b_payfashion={0}", payfashion);
            }
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat(@"select * from 
(select  a.*,b.u_bankname,b.u_banknumber,b.u_name ,c.u_realname,c.u_phone from jmp_BankPlaymoney  a left join jmp_userbank  b on a.b_bankid=b.u_id left join  jmp_user c on b.u_userid=c.u_id {0} ) a 
left join (select p_state,p_batchnumber from jmp_pays group by p_batchnumber,p_state) b on a.b_batchnumber=b.p_batchnumber
 ", where);
            JMP.BLL.jmp_BankPlaymoney        bankpbll  = new JMP.BLL.jmp_BankPlaymoney();
            List <JMP.MDL.jmp_BankPlaymoney> bankplist = new List <JMP.MDL.jmp_BankPlaymoney>();

            bankplist = bankpbll.GetLists(sql.ToString(), orderby, pageIndexs, PageSize, out pageCount);

            #endregion

            #region 合计组装查询语句

            JMP.MDL.jmp_BankPlaymoney model = new JMP.MDL.jmp_BankPlaymoney();

            string countsql = string.Format(@"select SUM(b_money) as b_money from 
(select  a.*,b.u_bankname,b.u_banknumber,b.u_name ,c.u_realname,c.u_phone from jmp_BankPlaymoney  a left join jmp_userbank  b on a.b_bankid=b.u_id left join  jmp_user c on b.u_userid=c.u_id {0} ) a 
left join (select p_state,p_batchnumber from jmp_pays group by p_batchnumber,p_state) b on a.b_batchnumber=b.p_batchnumber
 ", where);
            if (bankplist.Count > 0)
            {
                DataTable dt = bankpbll.SelectSQL(countsql);
                model = dt.Rows.Count > 0 ? JMP.TOOL.MdlList.ToModel <JMP.MDL.jmp_BankPlaymoney>(dt) : new JMP.MDL.jmp_BankPlaymoney();
            }

            #endregion


            StringBuilder sqlinfo = new StringBuilder();
            sqlinfo.AppendFormat(@";WITH a AS( 
 select a.*,b.SettlementDay
from [dbo].[jmp_pays]  a 
left join [dx_total].[dbo].[CoSettlementDeveloperOverview]  b on a.p_bill_id=b.Id and a.p_userid={0} 
), b as(
  select a.Id,(TotalAmount-ServiceFee-PortFee) as KFZIncome,
isnull(SUM(b.p_money),0) as p_moneys
from  dx_total.dbo.[CoSettlementDeveloperOverview] as a
left join (select * from dx_base.dbo.jmp_pays a,dx_base.dbo.jmp_BankPlaymoney b 
 where a.p_batchnumber=b.b_batchnumber and a.p_state!=-1 and b.b_tradestate!=4
) as b on a.Id=b.p_bill_id and b.p_userid={0} group by a.Id,TotalAmount,ServiceFee,PortFee
)
select  *  from  a 
left join b on a.p_bill_id=b.Id", UserInfo.UserId);
            JMP.BLL.jmp_pays        bllinfo  = new JMP.BLL.jmp_pays();
            List <JMP.MDL.jmp_pays> listinfo = new List <JMP.MDL.jmp_pays>();
            DataTable dts = bllinfo.SelectList(sqlinfo.ToString());
            listinfo       = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_pays>(dts);
            ViewBag.colist = listinfo;


            ViewBag.show_fields = types;
            ViewBag.pageIndexs  = pageIndexs;
            ViewBag.PageSize    = PageSize;
            ViewBag.pageCount   = pageCount;
            ViewBag.list        = bankplist;
            ViewBag.model       = model;
            ViewBag.scheck      = b_tradestate;
            ViewBag.stime       = stime;
            ViewBag.etime       = etime;
            ViewBag.payfashion  = payfashion;
            ViewBag.searchname  = searchKey;

            return(View());
        }
Exemplo n.º 2
0
        public JsonResult paysAdd()
        {
            object result = new { success = 0, msg = "操作失败!" };

            JMP.BLL.jmp_user   userbll   = new JMP.BLL.jmp_user();
            JMP.BLL.jmp_system systembll = new JMP.BLL.jmp_system();

            //可提现金额
            decimal ketiMoney = Convert.ToDecimal(Request["ketiMoney"] ?? "0");
            //提现金额
            decimal payMoney = Convert.ToDecimal(Request["payMoney"] ?? "0");
            //提现银行卡信息
            string b_bankid = string.IsNullOrEmpty(Request["b_bankid"]) ? "" : Request["b_bankid"];
            //提现选中账单ID
            string payid = string.IsNullOrEmpty(Request["payid"]) ? "0" : Request["payid"];
            //支付密码
            string PayPwd = string.IsNullOrEmpty(Request["PayPwd"]) ? "" : Request["PayPwd"];
            //提现类型(1:单卡提现,2:多卡提现)
            int WithdrawalsType = string.IsNullOrEmpty(Request["WithdrawalsType"]) ? 0 : int.Parse(Request["WithdrawalsType"]);

            //查询开发者信息
            JMP.MDL.jmp_user j_user = userbll.GetModel(UserInfo.UserId);
            //查询超级密码
            JMP.MDL.jmp_system j_sys = systembll.GetModel_name("password");
            //提现最小金额
            string WithdrawalsMinimum = System.Configuration.ConfigurationManager.AppSettings["WithdrawalsMinimum"].ToString();

            //验证提现金额
            if (payMoney >= decimal.Parse(WithdrawalsMinimum))
            {
                if (payMoney > ketiMoney)
                {
                    result = new { success = 0, msg = "提现金额不能超过可提金额!" };
                }
                else
                {
                    #region 提现金额验证成功,后续处理

                    //判断是否验证原支付密码
                    if (!string.IsNullOrEmpty(PayPwd))
                    {
                        string temp = DESEncrypt.Encrypt(PayPwd);
                        if (temp == j_user.u_paypwd || temp == j_sys.s_value)
                        {
                            #region 拼装提款表与银行打款对接表sql



                            if (WithdrawalsType == 1 || WithdrawalsType == 2)
                            {
                                List <string> sqllist = new List <string>();

                                if (WithdrawalsType == 1)
                                {
                                    sqllist = BankPaySongle(payMoney, b_bankid, payid);
                                }
                                else
                                {
                                    sqllist = BankPay(payMoney, b_bankid, payid);
                                }

                                if (sqllist.Count > 0)
                                {
                                    JMP.BLL.jmp_BankPlaymoney bankBll = new JMP.BLL.jmp_BankPlaymoney();

                                    //执行多条SQL语句,实现数据库事务。
                                    int num = bankBll.SelectBankPayMoney(sqllist);

                                    if (num > 0)
                                    {
                                        string log = "用户:" + UserInfo.UserId + ",申请提现:" + payMoney + ",申请时间:" + DateTime.Now;

                                        Logger.OperateLog("提现申请", log);

                                        result = new { success = 1, msg = "提现申请成功,请等待审核通过!" };
                                    }
                                    else
                                    {
                                        result = new { success = 0, msg = "提现申请失败!" };
                                    }
                                }
                                else
                                {
                                    result = new { success = 0, msg = "提现申请失败!" };
                                }
                            }
                            else
                            {
                                Logger.OperateLog("提现申请失败", "提现类型(1:单卡提现,2:多卡提现):" + WithdrawalsType);
                                result = new { success = 0, msg = "提现申请失败!" };
                            }

                            #endregion
                        }
                        else
                        {
                            result = new { success = 0, msg = "支付密码输入错误!" };
                        }
                    }
                    else
                    {
                        result = new { success = 0, msg = "请输入支付密码!" };
                    }

                    #endregion
                }
            }
            else
            {
                result = new { success = 0, msg = "提现金额不能为空且必须大于等于100!" };
            }

            return(Json(result));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查询代付信息
        /// </summary>
        /// <param name="payparamter"></param>
        /// <returns></returns>
        public bool SubmitSelectChinaPay(SelectChinaPayParameter payparamter)
        {
            bool flag = false;

            JMP.BLL.jmp_BankPlaymoney bll = new JMP.BLL.jmp_BankPlaymoney();
            try
            {
                string respStr = ChinaPayForAnother.SelectChinaPay(payparamter.merDate, payparamter.merSeqId, payparamter.PrivateKey, payparamter.merId);

                if (!string.IsNullOrEmpty(respStr))
                {
                    //截取数据验签
                    string responseCode = respStr.Substring(0, 3);

                    int    dex        = respStr.LastIndexOf("|");      // dex为chkValue的索引位置
                    string plain      = respStr.Substring(0, dex + 1); //获取待验签的字符串
                    string cpChkValue = respStr.Substring(dex + 1);    //获取ChinaPay 返回的签名值

                    //验签方法
                    string result = Utils.checkData(plain, cpChkValue, payparamter.p_PublicKey);//验签

                    if (result != "0")
                    {
                        flag = false;

                        Logger.PayForAnotherLog("单笔查询接口验签失败", "交易流水号:" + payparamter.merSeqId + "返回参数:" + respStr);
                    }
                    else
                    {
                        #region 验签成功
                        switch (responseCode)
                        {
                        //成功
                        case "000":

                            string[] s = plain.Split('|');

                            int start = ChinaPayForAnother.VerificationStatCX(s[14]);

                            switch (start)
                            {
                            case 1:

                                //修改银行打款对接表相关信息
                                flag = bll.UpdateBankPayTradeno(1, payparamter.merSeqId, s[5]);
                                if (!flag)
                                {
                                    Logger.PayForAnotherLog("修改银行打款对接表状态失败", "交易流水号:" + payparamter.merSeqId + "交易状态:" + 1 + "代付返回参数:" + respStr);
                                }

                                break;

                            case 2:

                                //修改银行打款对接表相关信息
                                flag = bll.UpdateBankPayTradeno(2, payparamter.merSeqId, "");

                                if (!flag)
                                {
                                    Logger.PayForAnotherLog("修改银行打款对接表状态失败", "交易流水号:" + payparamter.merSeqId + "交易状态:" + 2 + "代付返回参数:" + respStr);
                                }

                                break;

                            case -1:

                                //修改银行打款对接表相关信息
                                flag = bll.UpdateBankPayTradeno(-1, payparamter.merSeqId, "");
                                if (!flag)
                                {
                                    Logger.PayForAnotherLog("修改银行打款对接表状态失败", "交易流水号:" + payparamter.merSeqId + "交易状态:" + -1 + "代付返回参数:" + respStr);
                                }

                                Logger.PayForAnotherLog("代付提现失败返回参数", "交易流水号:" + payparamter.merSeqId + "代付返回参数:" + respStr);

                                break;
                            }

                            break;

                        //无记录(交易失败)
                        case "001":

                            //修改银行打款对接表相关信息
                            flag = bll.UpdateBankPayTradeno(-1, payparamter.merSeqId, "");

                            Logger.PayForAnotherLog("单笔查询接口查询无记录", "交易流水号:" + payparamter.merSeqId + "返回参数:" + respStr);

                            if (!flag)
                            {
                                Logger.PayForAnotherLog("单笔查询接口查询无记录", "交易流水号:" + payparamter.merSeqId + "交易状态:" + -1 + "返回参数:" + respStr);
                            }

                            break;

                        //查询出错
                        case "002":

                            Logger.PayForAnotherLog("单笔查询接口查询出错", "交易流水号:" + payparamter.merSeqId + "返回参数:" + respStr);
                            break;
                        }
                        #endregion
                    }
                }
                else
                {
                    //修改银行打款对接表相关信息
                    flag = bll.UpdateBankPayTradeno(3, payparamter.merSeqId, "");
                    if (!flag)
                    {
                        Logger.PayForAnotherLog("修改银行打款对接表状态失败", "交易流水号:" + payparamter.merSeqId + "交易状态:" + 3 + "代付返回参数:" + respStr);
                    }

                    Logger.PayForAnotherLog("查询接口返回数据为空!!!", "交易流水号:" + payparamter.merSeqId + "交易状态:" + 3 + "代付返回参数:" + respStr);
                }
            }
            catch (Exception ex)
            {
                //修改银行打款对接表相关信息
                flag = bll.UpdateBankPayTradeno(3, payparamter.merSeqId, "");
                if (!flag)
                {
                    Logger.PayForAnotherLog("修改银行打款对接表状态失败", "交易流水号:" + payparamter.merSeqId + "交易状态:" + 3);
                }

                Logger.PayForAnotherLog("代付查询接口异常", "异常信息:" + ex.Message);
                throw;
            }

            return(flag);
        }