예제 #1
0
 public function newbie_repayment()
 {
     $type = 1;
     $investid = intval($_POST['invest_uid']) ? intval($_POST['invest_uid']) : 0;
     if (!$investid) {
         echo "还款失败,投资者id不存在";
     }
     $pre = C('DB_PREFIX');
     $done = false;
     $b_member = M('members')->field("user_name")->find($binfo['borrow_uid']);
     $tuoguan = FS("Webconfig/tuoguanconfig");
     $merCustId = $tuoguan['huifu']['MerCustId'];
     //还款信息 还款金额 还款利息 借款人
     $repayinfo = M("newbie_record")->field("id,invest_money,interest,borrow_uid,ordid,orddate,freezetrxid")->where('invest_uid=' . $investid)->find();
     $repaysql = M()->getLastsql();
     file_put_contents("/tmp/isnew2", date('Y-m-d') . '$repaysql-invest1125-' . print_r($repaysql, true) . "\n", FILE_APPEND);
     file_put_contents("/tmp/isnew2", date('Y-m-d') . 'REpayinfo-invest1125-' . print_r($repayinfo, true) . "\n", FILE_APPEND);
     //还款人都自己还
     $borrow_uid = $repayinfo['borrow_uid'];
     $info1 = M("members")->field("usrid")->where("id=" . $borrow_uid)->find();
     $usrid = $info1['usrid'];
     //借款人客户号
     //投资人usrid
     $info2 = M("members")->field("usrid")->where("id=" . $investid)->find();
     $investusrid = $info2['usrid'];
     //投资人客户号
     //还款汇付接口数据初始化
     $transamt = array();
     //本息
     $investor = array();
     //投资人
     $investorid = array();
     //投资人
     $Fee = array();
     //利息管理费
     $divdetails = array();
     //利息管理费详情
     $subordid = array();
     //订单号
     $suborddate = array();
     //订单日期
     $repaymentid = array();
     //还款ID
     $transamt = $repayinfo['invest_money'] + $repayinfo['interest'];
     //本息
     $investor = $investusrid;
     //投资人usrid
     $investorid = $investid;
     //投资人ID
     $Fee = 0.0;
     //利息管理费
     $divdetails = '';
     //因为利息管理费为零 所以此变量为空
     $subordid = $repayinfo['ordid'];
     //订单号
     $suborddate = $repayinfo['orddate'];
     //订单日期
     $repaymentid = $repayinfo['id'];
     //投资的记录的id
     //解除冻结保证金
     $borrowid = 1;
     //标的id为1 固定值
     $freezetrxid = $repayinfo['freezetrxid'];
     import("ORG.Huifu.Huifu");
     $huifu = new Huifu();
     // $huifu->newbie_usrUnFreeze($freezetrxid,$borrowid,$borrow_uid,$type);//解冻资金
     $cron = $huifu->repayment($usrid, $transamt, $Fee, $investor, $divdetails, $subordid, $suborddate, $borrowid, $sort_order = '', $repaymentid, $investorid, $type);
     //还款
     if ($investid) {
         echo "{$investid}还款成功";
     }
 }