public function index() { $key = $_GET['key']; $arg = file_get_contents($this->updir . "config.txt"); $arga = explode("|", $arg); $rate = intval($arga[1]); if ($key != $arga[2]) { exit("fail|密钥错误"); } $total = 0; if ($rate > 0) { $list = M("member_money")->field("uid,account_money")->where("account_money>0")->select(); $i = 0; foreach ($list as $v) { $amoney = getFloatValue($v['account_money'] * $rate / 10000, 2); $re = memberMoneyLog($v['uid'], 32, $amoney, date("Y年m月d日") . "利息"); if ($re) { $i++; $total += $amoney; } } $all = count($list); $str = "共{$all}人需要发布利息,共成功对{$i}人发放共计{$total}元利息"; echo "success|{$str}"; } else { echo "success|利率为0,不返利"; } echo "\r\n" . date("Y-m-d H:i:s", time()); exit; }
function getBorrowList($map, $size, $limit = 10) { //if(empty($map['borrow_uid'])) return; if ($size) { //分页处理 import("ORG.Util.Page"); $count = M('borrow_info')->where($map)->count('id'); $p = new Page($count, $size); $page = $p->show(); $Lsql = "{$p->firstRow},{$p->listRows}"; //分页处理 } else { $page = ""; $Lsql = "{$parm['limit']}"; } $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $status_arr = $Bconfig['BORROW_STATUS_SHOW']; $type_arr = $Bconfig['REPAYMENT_TYPE']; //$list = M('borrow_info')->where($map)->order('id DESC')->limit($Lsql)->select(); /////////////使用了视图查询操作 fans 2013-05-22///////////////////////////////// $Model = D("BorrowView"); $list = $Model->field(true)->where($map)->order('times ASC')->group('id')->limit($Lsql)->select(); //echo M()->getlastsql();exit; /////////////使用了视图查询操作 fans 2013-05-22///////////////////////////////// foreach ($list as $key => $v) { $list[$key]['status'] = $status_arr[$v['borrow_status']]; $list[$key]['repayment_type_num'] = $v['repayment_type']; $list[$key]['repayment_type'] = $type_arr[$v['repayment_type']]; $list[$key]['progress'] = getFloatValue($v['has_borrow'] / $v['borrow_money'] * 100, 2); if ($map['borrow_status'] == 6) { $vx = M('investor_detail')->field('deadline')->where("borrow_id={$v['id']} and status=7")->order("deadline ASC")->find(); $list[$key]['repayment_time'] = $vx['deadline']; } if ($map['borrow_status'] == 5 || $map['borrow_status'] == 1) { $vd = M('borrow_verify')->field(true)->where("borrow_id={$v['id']}")->find(); $list[$key]['dealinfo'] = $vd; } $dealinfo2 = M("borrow_verify")->field("deal_info_2")->where("borrow_id=" . $v['id'])->find(); $list[$key]['deal_info'] = $dealinfo2['deal_info_2']; } $row = array(); $row['list'] = $list; $row['page'] = $page; //$map['status'] = 1; //$row['success_money'] = M('member_payonline')->where($map)->sum('money'); //$map['status'] = array('neq','1'); //$row['fail_money'] = M('member_payonline')->where($map)->sum('money'); return $row; }
function getBorrowList($parm = array(), $countonly = false) { if (empty($parm['map'])) { return; } $map = $parm['map']; $orderby = $parm['orderby']; //$map = array_merge($map,$search); if ($countonly) { return M('borrow_info b')->where($map)->count('b.id'); } if ($parm['pagesize']) { //分页处理 import("ORG.Util.Page"); $count = M('borrow_info b')->where($map)->count('b.id'); $p = new Page($count, $parm['pagesize']); $page = $p->show(); $Lsql = "{$p->firstRow},{$p->listRows}"; //分页处理 } else { $page = ""; $Lsql = "{$parm['limit']}"; } $pre = C('DB_PREFIX'); $suffix = C("URL_HTML_SUFFIX"); $field = "b.id,b.borrow_name,b.borrow_type,b.reward_type,b.borrow_times,b.borrow_status,b.borrow_money,b.borrow_use,b.repayment_type,b.borrow_interest_rate,b.borrow_duration,b.collect_time,b.province,b.has_borrow,b.has_vouch,b.city,b.area,b.reward_type,b.reward_num,b.password,b.borrow_info,m.user_name,m.id as uid,m.credits,m.customer_name,b.is_tuijian,b.pro_provide,b.first_verify_time,b.schedular_time"; if ($parm['hotest']) { $field .= ",IFNULL(b.`full_time`,0)-IFNULL(bv.`deal_time`,0) finish_time"; $list = M('borrow_info')->alias("b")->field($field)->join("{$pre}members m ON m.id=b.borrow_uid")->join("{$pre}borrow_verify bv ON b.id=bv.borrow_id")->where($map)->order($orderby)->limit($Lsql)->select(); } else { $list = M('borrow_info')->alias("b")->field($field)->join("{$pre}members m ON m.id=b.borrow_uid")->where($map)->order($orderby)->limit($Lsql)->select(); } $areaList = getArea(); foreach ($list as $key => $v) { $list[$key]['location'] = $areaList[$v['province']] . $areaList[$v['city']]; $list[$key]['biao'] = $v['borrow_times']; $list[$key]['need'] = $v['borrow_money'] - $v['has_borrow']; $list[$key]['leftdays'] = getLeftTime($v['collect_time']); $list[$key]['progress'] = getFloatValue($v['has_borrow'] / $v['borrow_money'] * 100, 2); $list[$key]['vouch_progress'] = getFloatValue($v['has_vouch'] / $v['borrow_money'] * 100, 2); $list[$key]['burl'] = MU("Home/invest", "invest", array("id" => $v['id'], "suffix" => $suffix)); $list[$key]['schedular_time'] = trans_date_format($v['schedular_time'], 'Y-m-d'); } $row = array(); $row['list'] = $list; $row['page'] = $page; return $row; }
public function downfile() { //$this->assign("waitSecond",-1);$this->error("该功能暂时被关闭!"); $per = C('DB_PREFIX'); $borrow_config = (require C("APP_ROOT") . "Conf/borrow_config.php"); $invest_id = intval($_GET['id']); //$borrow_id=intval($_GET['id']); $iinfo = M('borrow_investor')->field('borrow_id,investor_capital,investor_interest,deadline,investor_uid')->where("(investor_uid={$this->uid} OR borrow_uid={$this->uid}) AND id={$invest_id}")->find(); $binfo = M('borrow_info')->field('repayment_type,borrow_duration,borrow_uid,borrow_type,full_time,add_time,borrow_interest_rate')->find($iinfo['borrow_id']); $mBorrow = M("members m")->join("{$per}member_info mi ON mi.uid=m.id")->field('mi.real_name,m.user_name')->where("m.id={$binfo['borrow_uid']}")->find(); $mInvest = M("members m")->join("{$per}member_info mi ON mi.uid=m.id")->field('mi.real_name,m.user_name')->where("m.id={$iinfo['investor_uid']}")->find(); if (!is_array($iinfo) || !is_array($binfo) || !is_array($mBorrow) || !is_array($mInvest)) { exit; } $type = $borrow_config['REPAYMENT_TYPE']; //echo $binfo['repayment_type']; $binfo['repayment_name'] = $type[$binfo['repayment_type']]; $iinfo['repay'] = getFloatValue(($iinfo['investor_capital'] + $iinfo['investor_interest']) / $binfo['borrow_duration'], 2); //print_r($type); $this->assign('iinfo', $iinfo); $this->assign('binfo', $binfo); $this->assign('mBorrow', $mBorrow); $this->assign('mInvest', $mInvest); $detail_list = M('investor_detail')->field(true)->where("invest_id={$invest_id}")->select(); $this->assign("detail_list", $detail_list); $html = $this->fetch('index'); //路径,x坐标,y坐标,图片宽度,图片高度(''表示自适应),网址, //$mask = $pdf->Image($this->pdfPath.'images/alpha.png', 10, 10, 10, '', '', '', '', false, 100, '', true); $this->mypdf->Image(K_PATH_MAIN . '../../../Style/seal/images/bg.png', 35, 130, 143, 44, '', '', '', false, 300, '', false, false, 0); //出图的,放在后面图就在上层,放在前面图就在下层 // set the starting point for the page content $this->mypdf->setPageMark(); $this->mypdf->writeHTML($html, true, false, true, false, ''); //$this->mypdf->MultiCell(0, 5, "ssssssssssssssssssssssssssssssss", 0, 'J', 0, 2, '', '', true, 0, false); //路径,x坐标,y坐标,图片宽度,图片高度(''表示自适应),网址, //$mask = $this->mypdf->Image($this->pdfPath.'images/alpha.png', 10, 10, 10, '', '', '', '', false, 100, '', true); //$this->mypdf->Image($this->pdfPath.'images/image_with_alpha.png', 70, 120, 60, 60, '', '', '', false, 10, '', true, $mask);//出图的,放在后面图就在上层,放在前面图就在下层 // --------------------------------------------------------- $this->mypdf->setPage(2); //$this->mypdf->Image(K_PATH_MAIN.'../../../Style/seal/images/seal.png', 150, 230, 42, 42, '', '', '', false, 300, '', false, false, 0);//出图的,放在后面图就在上层,放在前面图就在下层 $this->mypdf->Image(K_PATH_MAIN . '../../../Style/seal/images/seal.png', 10, 170, '145', '46', '', '', '', false, 300, '', false, false, 0); //出图的,放在后面图就在上层,放在前面图就在下层 ob_end_clean(); //Close and output PDF document $this->mypdf->Output('jiedaihetong.pdf', 'I'); }
public function addborrow() { $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $fee_borrow_manage = explode("|", $this->glo['fee_borrow_manage']); $vminfo = M('members')->field("credit_limit,credit_use,credit_status,user_leve,time_limit")->find($this->uid); $add_field = array('borrow_interest_rate', 'borrow_money', 'borrow_duration', 'repayment_type', 'borrow_name', 'borrow_info'); foreach ($add_field as $v) { $savedata[$v] = text($_POST[$v]); } if ($savedata['borrow_interest_rate'] > $rate_lixt[1] || $savedata['borrow_interest_rate'] < $rate_lixt[0]) { ajaxmsg("提交的数据有误,请重试", 0); } if ($savedata['borrow_duration'] > $borrow_duration[1] || $savedata['borrow_duration'] < $borrow_duration[0]) { ajaxmsg("提交的数据有误,请重试", 0); } if ($savedata['borrow_money'] > $vminfo['credit_limit'] - $vminfo['credit_use'] || $savedata['borrow_money'] < 500) { ajaxmsg("提交的数据有误,请重试", 0); } //if(!in_array($savedata['repayment_type'],C('REPAYMENT_TYPE'))) ajaxmsg("提交的数据有误,请重试",0); if (empty($savedata['borrow_name']) || empty($savedata['repayment_type']) || empty($savedata['borrow_info'])) { ajaxmsg("提交的数据有误,请重试", 0); } if ($vminfo['credit_status'] == 0) { ajaxmsg("您还未通过借款审核", 0); } $bc = M("borrow_info")->where("borrow_uid={$this->uid} AND borrow_status in(0,2)")->count('id'); if ($bc > 0) { ajaxmsg("您有正在审核或者正在筹集中的借款,所以暂时不能发布新的借款申请", 0); } $vminfo['user_leve'] == 1 && $vminfo['time_limit'] > time() ? $fee_rate = $fee_borrow_manage[1] / 100 : ($fee_rate = $fee_borrow_manage[0] / 100); $savedata['borrow_uid'] = $this->uid; $savedata['borrow_interest'] = getBorrowInterest($savedata['repayment_type'], $savedata['borrow_money'], $savedata['borrow_duration'], $savedata['borrow_interest_rate']); $savedata['borrow_fee'] = getFloatValue($fee_rate * $savedata['borrow_money'], 2); $savedata['borrow_status'] = 0; $savedata['add_time'] = time(); $savedata['add_ip'] = get_client_ip(); $savedata['total'] = $savedata['repayment_type'] == 1 ? $savedata['borrow_duration'] : "1"; $newid = M('borrow_info')->add($savedata); if ($newid) { ajaxmsg(); } else { ajaxmsg("借款申请发布失败,请重试", 0); } }
function getBorrowList($parm = array()) { $map = $parm['map']; $orderby = $parm['orderby']; if ($parm['pagesize']) { //分页处理 import("ORG.Util.Page"); $count = M('borrow_info b')->where($map)->count('b.id'); $p = new Page($count, $parm['pagesize']); $page = $p->show(); $Lsql = "{$p->firstRow},{$p->listRows}"; $row['page']['total'] = ceil($count / $parm['pagesize']); $row['page']['nowPage'] = isset($_REQUEST['p']) ? $_REQUEST['p'] : 1; //分页处理 } else { $page = ""; $Lsql = "{$parm['limit']}"; } $pre = C('DB_PREFIX'); $suffix = C("URL_HTML_SUFFIX"); $field = "b.id,b.borrow_name,b.borrow_type,b.updata,b.reward_type,b.borrow_times,b.borrow_status,b.borrow_money,b.borrow_use,b.repayment_type,b.borrow_interest_rate,b.borrow_duration,b.collect_time,b.add_time,b.province,b.has_borrow,b.has_vouch,b.city,b.area,b.reward_type,b.reward_num,b.password,m.user_name,m.id as uid,m.credits,m.customer_name,b.is_tuijian,b.deadline,b.danbao,b.borrow_info,b.risk_control"; $list = M('borrow_info b')->field($field)->join("{$pre}members m ON m.id=b.borrow_uid")->where($map)->order($orderby)->limit($Lsql)->select(); $areaList = getArea(); foreach ($list as $key => $v) { $list[$key]['location'] = $areaList[$v['province']] . $areaList[$v['city']]; $list[$key]['biao'] = $v['borrow_times']; $list[$key]['need'] = $v['borrow_money'] - $v['has_borrow']; $list[$key]['leftdays'] = getLeftTime($v['collect_time']); $list[$key]['progress'] = getFloatValue($v['has_borrow'] / $v['borrow_money'] * 100, 2); $list[$key]['vouch_progress'] = getFloatValue($v['has_vouch'] / $v['borrow_money'] * 100, 2); $list[$key]['burl'] = MU("M/invest", "invest", array("id" => $v['id'], "suffix" => $suffix)); $img = unserialize($v['updata']); $list[$key]['image'] = $img['0']['img']; } $row['list'] = $list; return $row; }
public function tool3() { if ($_POST) { $money = floatval($_POST['money']); $rate = floatval($_POST['interest_rate']); $month = $_POST['selDays'] == -1 ? intval($_POST['month']) : intval($_POST['selDays']); $fee = getFloatValue($rate / 12 * $month * $money / 100 + $money, 4); $this->assign('mmoney', $money); $this->assign('m', $month); $this->assign('fee', $fee); $parm['month_times'] = $month; $parm['account'] = $money; $parm['year_apr'] = $rate; $repay_detail = EqualSeason($parm); $parm['type'] = "all"; $repay_summary = EqualSeason($parm); $this->assign('repay_detail', $repay_detail); $this->assign('repay_summary', $repay_summary); $data['html_1'] = $this->fetch('tool3_res_1'); $data['html_2'] = $this->fetch('tool3_res_2'); exit(json_encode($data)); } $this->display(); }
public function detail() { $pre = C('DB_PREFIX'); $id = intval($_GET['id']); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $borrowinfo = M("borrow_info bi")->field('bi.*,ac.title,ac.id as aid')->join('lzh_article ac on ac.id= bi.danbao')->where('bi.id=' . $id)->find(); if (!$borrowinfo || $borrowinfo['borrow_status'] == 0 && $this->uid != $borrowinfo['borrow_uid']) { $this->error("数据有误"); } $borrowinfo['biao'] = $borrowinfo['borrow_times']; $borrowinfo['need'] = $borrowinfo['borrow_money'] - $borrowinfo['has_borrow']; $borrowinfo['lefttime'] = $borrowinfo['collect_time'] - time(); $borrowinfo['progress'] = getFloatValue($borrowinfo['has_borrow'] / $borrowinfo['borrow_money'] * 100, 2); $this->assign("vo", $borrowinfo); //borrowinfo //此标借款利息还款相关情况 //memberinfo $memberinfo = M("members")->field("id,customer_name,customer_id,user_name,reg_time,credits")->where("id={$borrowinfo['borrow_uid']}")->find(); $this->assign("minfo", $memberinfo); //memberinfo $this->assign("Bconfig", $Bconfig); $this->assign("gloconf", $this->gloconf); $this->display(); }
public function ajax_invest() { $jsoncode = file_get_contents("php://input"); //alogsm("ajax_invest",0,1,session("u_id").$jsoncode); if (!$this->uid) { ajaxmsg("请先登陆", 0); exit; } $arr = array(); $arr = json_decode($jsoncode, true); if (intval($arr['uid']) != $this->uid) { ajaxmsg("查询错误!", 0); } if (!is_array($arr) || empty($arr) || empty($arr['id']) || !in_array($arr['type'], array(3, 4, 5, 6, 7))) { ajaxmsg("查询错误!", 0); } $pre = C('DB_PREFIX'); $id = intval($arr['id']); //$id=23; $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $field = "id,borrow_uid,borrow_money,borrow_status,borrow_type,has_borrow,has_vouch,borrow_interest_rate,borrow_duration,repayment_type,collect_time,borrow_min,borrow_max,password,borrow_use,money_collect"; $vo = M('borrow_info')->field($field)->find($id); if ($this->uid == $vo['borrow_uid']) { ajaxmsg("不能去投自己的标", 0); } if ($vo['borrow_status'] != 2) { ajaxmsg("只能投正在借款中的标", 0); } $vo['need'] = $vo['borrow_money'] - $vo['has_borrow']; if ($vo['need'] < 0) { ajaxmsg("投标金额不能超出借款剩余金额", 0); } $vo['lefttime'] = $vo['collect_time'] - time(); $vo['progress'] = getFloatValue($vo['has_borrow'] / $vo['borrow_money'] * 100, 4); //ceil($vo['has_borrow']/$vo['borrow_money']*100); $vo['uname'] = M("members")->getFieldById($vo['borrow_uid'], 'user_name'); $time1 = microtime(true) * 1000; $vm = getMinfo($this->uid, 'm.pin_pass,mm.account_money,mm.back_money,mm.money_collect'); $amoney = $vm['account_money'] + $vm['back_money']; ////////////////////////////////////待收金额限制 2013-08-26 fan/////////////////// if ($binfo['money_collect'] > 0) { if ($vm['money_collect'] < $binfo['money_collect']) { ajaxmsg("此标设置有投标待收金额限制,您账户里必须有足够的待收才能投此标", 0); } } ////////////////////////////////////待收金额限制 2013-08-26 fan/////////////////// ////////////////////投标时自动填写可投标金额在投标文本框 2013-07-03 fan//////////////////////// if ($amoney < floatval($vo['borrow_min'])) { ajaxmsg("您的账户可用余额小于本标的最小投标金额限制,不能投标!", 0); } elseif ($amoney >= floatval($vo['borrow_max']) && floatval($vo['borrow_max']) > 0) { $toubiao = intval($vo['borrow_max']); } else { if ($amoney >= floatval($vo['need'])) { $toubiao = intval($vo['need']); } else { $toubiao = floor($amoney); } } $vo['toubiao'] = $toubiao; ////////////////////投标时自动填写可投标金额在投标文本框 2013-07-03 fan//////////////////////// $pin_pass = $vm['pin_pass']; $has_pin = empty($pin_pass) ? "no" : "yes"; $data['type'] = $arr['type']; $data['id'] = $id; $data['has_pin'] = $has_pin == 'yes' ? 1 : 0; $data['borrow_min'] = $vo['borrow_min']; $data['borrow_max'] = $vo['borrow_max'] == "0" ? "无" : "{$vo['borrow_max']}"; $data['need'] = $vo['need']; $data['toubiao'] = $vo['toubiao']; $data['password'] = empty($vo['password']) ? 0 : 1; $data['account_money'] = $amoney; ajaxmsg($data); }
public function vouchmoney() { if (!$this->uid) { exit; } /****** 防止模拟表单提交 *********/ $cookieKeyS = cookie(strtolower(MODULE_NAME) . "-vouch"); if ($cookieKeyS != $_REQUEST['cookieKey']) { $this->error("数据校验有误"); } /****** 防止模拟表单提交 *********/ $money = intval($_POST['vouch_money']); $borrow_id = intval($_POST['borrow_id']); $rate = M('borrow_info')->getFieldById($borrow_id, 'reward_vouch_rate'); $amoney = M("member_money")->getFieldByUid($this->uid, 'invest_vouch_cuse'); $uname = session('u_user_name'); if ($amoney < $money) { $this->error("尊敬的{$uname},您准备担保{$money}元,但您可用担保投资额度为{$amoney}元,请先去申请更高额度."); } $saveVouch['borrow_id'] = $borrow_id; $saveVouch['uid'] = $this->uid; $saveVouch['uname'] = $uname; $saveVouch['vouch_money'] = $money; $saveVouch['vouch_reward_rate'] = $rate; $saveVouch['vouch_reward_money'] = getFloatValue($money * $rate / 100, 2); $saveVouch['add_ip'] = get_client_ip(); $saveVouch['vouch_time'] = time(); $newid = M('borrow_vouch')->add($saveVouch); if ($newid) { $done = M("member_money")->where("uid={$this->uid}")->setDec('invest_vouch_cuse', $money); } //$this->assign("waitSecond",1000); if ($done == true) { M("borrow_info")->where("id={$borrow_id}")->setInc('has_vouch', $money); $this->success("恭喜成功担保{$money}元"); } else { $this->error("对不起,担保失败,请重试!"); } }
public function downliuzhuanfile() { $per = C('DB_PREFIX'); $borrow_config = (require C("APP_ROOT") . "Conf/borrow_config.php"); $invest_id = intval($_GET['id']); //$borrow_id=intval($_GET['id']); //old //$iinfo = M('borrow_investor')->field('id,borrow_id,investor_capital,investor_interest,deadline,investor_uid,add_time')->where("(investor_uid={$this->uid} OR borrow_uid={$this->uid}) AND id={$invest_id}")->find(); $iinfo = M('borrow_investor')->field('id,borrow_id,investor_capital,investor_interest,deadline,investor_uid,add_time')->where("investor_uid={$this->uid} AND id={$invest_id}")->find(); $investor_capital_big = cny($iinfo['investor_capital']); $borrow_id = $iinfo['borrow_id']; //dump( $borrow_id); //exit; $binfo = M('borrow_info bi')->field('bi.id,bi.repayment_type,bi.borrow_duration,bi.borrow_uid,bi.borrow_type,bi.borrow_use,bi.borrow_money,bi.full_time,bi.add_time,bi.borrow_interest_rate,bi.deadline,bi.second_verify_time,bi.collect_time,mi.real_name,mi.stamp_img')->join("{$per}member_info mi ON bi.danbao=mi.uid")->find($borrow_id); //dump($iinfo); //dump(M("members m")->getlastsql()); //exit; $mBorrow = M("members m")->join("{$per}member_info mi ON mi.uid=m.id")->field('mi.real_name,m.user_name,mi.idcard,mi.stamp_img')->where("m.id={$binfo['borrow_uid']}")->find(); //$mInvest = M("members m")->join("{$per}member_info mi ON mi.uid=m.id")->field('mi.real_name,m.user_name')->where("m.id={$iinfo['investor_uid']}")->find(); $mInvest = M("members m")->join("{$per}member_info mi ON mi.uid=m.id")->field('mi.real_name,mi.address,mi.cell_phone,mi.idcard,m.user_name,m.user_email')->where("m.id={$iinfo['investor_uid']}")->find(); //if(!is_array($iinfo)||!is_array($binfo)||!is_array($mBorrow)||!is_array($mInvest)) exit; $detail = M('investor_detail d')->field('d.borrow_id,d.investor_uid,d.borrow_uid,d.capital,sum(d.capital+d.interest-d.interest_fee) benxi,d.total')->where("d.borrow_id={$iinfo['borrow_id']} and d.invest_id ={$iinfo['id']}")->group('d.investor_uid')->find(); //$detailinfo = M('investor_detail d')->join("{$per}borrow_investor bi ON bi.id=d.invest_id")->join("{$per}members m ON m.id=d.investor_uid")->field('d.borrow_id,d.investor_uid,d.borrow_uid,d.capital,sum(d.capital+d.interest-d.interest_fee) benxi,d.total,m.user_name,bi.investor_capital,bi.add_time')->where("d.borrow_id={$iinfo['borrow_id']} and d.invest_id ={$iinfo['id']}")->group('d.investor_uid')->find(); $detailinfo = M('investor_detail d')->field('d.borrow_id,d.investor_uid,d.borrow_uid,(d.capital+d.interest-d.interest_fee) benxi,d.capital,d.interest,d.interest_fee,d.sort_order,d.deadline')->where("d.borrow_id={$iinfo['borrow_id']} and d.invest_id ={$iinfo['id']}")->select(); $time = M('borrow_investor')->field('id,add_time')->where("borrow_id={$iinfo['borrow_id']} order by add_time asc")->limit(1)->find(); if ($binfo['repayment_type'] == 1) { $deadline_last = strtotime("+{$binfo['borrow_duration']} day", $time['add_time']); } else { $deadline_last = strtotime("+{$binfo['borrow_duration']} month", $time['add_time']); } $this->assign('deadline_last', $deadline_last); $this->assign('detailinfo', $detailinfo); $this->assign('detail', $detail); $type1 = $this->gloconf['BORROW_USE']; $binfo['borrow_use'] = $type1[$binfo['borrow_use']]; $ht = M('hetong')->field('hetong_img,name,dizhi,tel')->find(); $this->assign("ht", $ht); $type = $borrow_config['REPAYMENT_TYPE']; //echo $binfo['repayment_type']; $binfo['repayment_name'] = $type[$binfo['repayment_type']]; // dump($binfo['stamp_img']);exit; $iinfo['repay'] = getFloatValue(($iinfo['investor_capital'] + $iinfo['investor_interest']) / $binfo['borrow_duration'], 2); $this->assign("bid", "bytp2pD"); //print_r($type); $this->assign('investor_capital_big', $investor_capital_big); $this->assign('iinfo', $iinfo); $this->assign('binfo', $binfo); $this->assign('mBorrow', $mBorrow); $this->assign('mInvest', $mInvest); $this->assign('borrow_id', $borrow_id); $detail_list = M('investor_detail')->field(true)->where("invest_id={$invest_id}")->select(); $this->assign("detail_list", $detail_list); //echo "<pre>";print_r($binfo);echo "</pre>";exit; //$this->display("transfer");exit; Vendor('Mpdf.mpdf'); $mpdf = new mPDF('UTF-8', 'A4', '', '', 15, 15, 4, 15); $mpdf->useAdobeCJK = true; $mpdf->SetAutoFont(AUTOFONT_ALL); $mpdf->SetDisplayMode('fullpage'); $mpdf->SetAutoFont(); $mpdf->SetHTMLFooter(' >>{PAGENO}<<'); $mpdf->WriteHTML($this->fetch('transfer')); $mpdf->Output('cailaijinfu.pdf', 'I'); exit; $this->display("transfer"); }
public function save() { $jsoncode = file_get_contents("php://input"); $arr = array(); $arr = json_decode($jsoncode, true); if (!$this->uid || $arr['uid'] != $this->uid) { ajaxmsg("请先登录", 0); exit; } if (!is_array($arr) || empty($arr) || empty($arr['uid'])) { ajaxmsg("查询错误!", 0); } $pre = C('DB_PREFIX'); $id = intval($arr['id']); //$id = 30; $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //相关的判断参数 $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']); $fee_borrow_manage = explode("|", $this->glo['fee_borrow_manage']); $vminfo = M('members m')->join("{$pre}member_info mf ON m.id=mf.uid")->field("m.user_leve,m.time_limit,mf.province_now,mf.city_now,mf.area_now,m.is_vip,m.is_borrow")->where("m.id={$this->uid}")->find(); //var_dump($vminfo);die; if ($vminfo['is_vip'] == 0) { $_xoc = M('borrow_info')->where("borrow_uid={$this->uid} AND borrow_status in(0,2,4)")->count('id'); if ($_xoc > 0) { ajaxmsg("您有一个借款中的标,请等待审核", 0); } if (!($vminfo['user_leve'] > 0 && $vminfo['time_limit'] > time())) { ajaxmsg("请先通过VIP审核再发标", 0); } if ($vminfo['is_borrow'] == 0) { ajaxmsg("您目前不允许发布借款,如需帮助,请与客服人员联系!", 0); //$this->assign("waitSecond",3); } $vo = getMemberDetail($this->uid); if ($vo['province'] == 0 && $vo['province_now '] == 0 && $vo['province_now '] == 0 && $vo['city'] == 0 && $vo['city_now'] == 0) { ajaxmsg("请先填写个人详细资料后再发标", 0); } } $borrow['borrow_type'] = $arr['vkey']; //intval(cookie(text($_POST['vkey']))); //dump($borrow['borrow_type']);die; if ($borrow['borrow_type'] == 0) { ajaxmsg("校验数据有误,请重新发布", 0); } if (floatval($arr['borrow_interest_rate']) > $rate_lixt[1] || floatval($arr['borrow_interest_rate']) < $rate_lixt[0]) { ajaxmsg("提交的借款利率不在允许范围,请重试", 0); } $borrow['borrow_money'] = intval($arr['borrow_money']); $_minfo = getMinfo($this->uid, "m.pin_pass,mm.account_money,mm.back_money,mm.credit_cuse,mm.money_collect"); $_capitalinfo = getMemberBorrowScan($this->uid); /////////////////////////////////////////////////////// //$vo = M('members m')->field('mm.account_money,mm.back_money,(mm.account_money+mm.back_money) all_money,m.user_leve,m.time_limit')->join("{$pre}member_money mm on mm.uid = //m.id")->where("m.id={$this->uid} AND m.pin_pass='******'")->find(); $borrowNum = M('borrow_info')->field("borrow_type,count(id) as num,sum(borrow_money) as money,sum(repayment_money) as repayment_money")->where("borrow_uid = {$this->uid} AND borrow_status=6 ")->group("borrow_type")->select(); $borrowDe = array(); foreach ($borrowNum as $k => $v) { $borrowDe[$v['borrow_type']] = $v['money'] - $v['repayment_money']; } /////////////////////////////////////////////////// switch ($borrow['borrow_type']) { case 1: //普通标 if ($_minfo['credit_cuse'] < $borrow['borrow_money']) { ajaxmsg("您的可用信用额度为{$_minfo['credit_cuse']}元,小于您准备借款的金额,不能发标", 0); } break; case 2: //新担保标 break; case 4: //净值标 $_netMoney = getFloatValue(0.9 * $_minfo['money_collect'] - $borrowDe[4], 2); if ($_netMoney < $borrow['borrow_money']) { ajaxmsg("您的净值额度{$_netMoney}元,小于您准备借款的金额,不能发标", 0); } break; case 5: //抵押标 //$borrow_type=5; break; } $borrow['borrow_uid'] = $this->uid; $borrow['borrow_name'] = text($arr['borrow_name']); $borrow['borrow_duration'] = $borrow['borrow_type'] == 3 ? 1 : intval($arr['borrow_duration']); //秒标固定为一月 $borrow['borrow_interest_rate'] = floatval($arr['borrow_interest_rate']); if (strtolower($arr['is_day']) == 'yes') { $borrow['repayment_type'] = 1; } elseif ($borrow['borrow_type'] == 3) { $borrow['repayment_type'] = 2; } else { $borrow['repayment_type'] = intval($arr['repayment_type']); } if ($borrow['repayment_type'] == '1' || $borrow['repayment_type'] == '5') { $borrow['total'] = 1; } else { $borrow['total'] = $borrow['borrow_duration']; //分几期还款 } $borrow['borrow_status'] = 0; $borrow['borrow_use'] = intval($arr['borrow_use']); $borrow['add_time'] = time(); $borrow['collect_day'] = intval($arr['borrow_time']); $borrow['add_ip'] = get_client_ip(); $borrow['borrow_info'] = text($arr['borrow_info']); $borrow['reward_type'] = intval($arr['reward_type']); $borrow['reward_num'] = floatval($arr["reward_type_{$borrow['reward_type']}_value"]); $borrow['borrow_min'] = intval($arr['borrow_min']); $borrow['borrow_max'] = intval($arr['borrow_max']); //$borrow['province'] = $vminfo['province_now']; //$borrow['city'] = $vminfo['city_now']; //$borrow['area'] = $vminfo['area_now']; if ($arr['is_pass'] && intval($arr['is_pass']) == 1) { $borrow['password'] = md5($arr['password']); } $borrow['money_collect'] = floatval($arr['moneycollect']); //代收金额限制设置 //借款费和利息 $borrow['borrow_interest'] = getBorrowInterest($borrow['repayment_type'], $borrow['borrow_money'], $borrow['borrow_duration'], $borrow['borrow_interest_rate']); $borrow['borrow_fee'] = 0.0; if ($borrow['borrow_type'] == 3) { //秒还标 if ($borrow['reward_type'] > 0) { $_reward_money = getFloatValue($borrow['borrow_money'] * $borrow['reward_num'] / 100, 2); } $_reward_money = floatval($_reward_money); if ($_minfo['account_money'] + $_minfo['back_money'] < $borrow['borrow_fee'] + $_reward_money) { ajaxmsg("发布此标您最少需保证您的帐户余额大于等于" . ($borrow['borrow_fee'] + $_reward_money) . "元,以确保可以支付借款管理费和投标奖励费用", 0); } } //投标上传图片资料(暂隐) foreach ($arr['swfimglist'] as $key => $v) { if ($key > 10) { break; } $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $arr['picinfo'][$key]; } $borrow['updata'] = serialize($row); $newid = M("borrow_info")->add($borrow); $suo = array(); $suo['id'] = $newid; $suo['suo'] = 0; $suoid = M("borrow_info_lock")->add($suo); if ($newid) { ajaxmsg("借款发布成功,网站会尽快初审", 1); } else { ajaxmsg("发布失败,请先检查是否完成了个人详细资料然后重试", 0); } }
public function getBorrowerInfo($bid) { $db = core::db()->getConnect('CAILAI', true); $filed = "bi.borrow_uid,mi.sex,mi.age,mi.education,mi.marry,fi.fin_monthin,m.user_email,m.customer_name,fi.fin_car,m.integral,mi.zy,mm.credit_limit,mi.province,mi.city,mm.account_money,mm.back_money,mm.money_collect,mm.money_freeze "; $sql = sprintf("SELECT {$filed} FROM`lzh_borrow_info` bi LEFT JOIN lzh_members m ON m.id = bi.borrow_uid LEFT JOIN lzh_member_financial_info fi ON bi.borrow_uid=fi.uid LEFT JOIN `lzh_member_info` mi ON mi.uid=bi.borrow_uid LEFT JOIN `lzh_member_money` mm ON mm.uid=bi.borrow_uid WHERE bi.id=%s", $bid); $zw = $db->query($sql, "array "); $borrow_uid = $zw['borrow_uid']; unset($zw['borrow_uid']); $zw['fin_monthin'] = getMoneyFormt($zw['fin_monthin']); $zw['integral'] = (int) $zw['integral']; $zw['credit_limit'] = (double) $zw['credit_limit']; if ($zw['fin_car'] == NULL) { $zw['fin_car'] = '未填写'; } //借款次数相关 $sql2 = sprintf("SELECT `borrow_status`, COUNT(id) AS num,SUM(borrow_money) AS money,SUM(repayment_money) AS repayment_money FROM `lzh_borrow_info` WHERE borrow_uid = %s GROUP BY borrow_status ", $borrow_uid); $zw2 = $db->query($sql2); while ($row = $db->fetchArray($zw2)) { $borrowCount[$row['borrow_status']] = $row; } //借出情况相关 $field3 = "status,count(id) as num,sum(investor_capital) as investor_capital,sum(reward_money) as reward_money,sum(investor_interest) as investor_interest,sum(receive_capital) as receive_capital,sum(receive_interest) as receive_interest,sum(invest_fee) as invest_fee"; $sql3 = sprintf("SELECT {$field3} FROM `lzh_borrow_investor` WHERE investor_uid = %s GROUP BY STATUS ", $borrow_uid); $zw3 = $db->query($sql3); $_reward_money = 0; while ($v = $db->fetchArray($zw3)) { $investStatus[$v['status']] = $v; $_reward_money += floatval($v['reward_money']); } $rowtj['jkze'] = getFloatValue(floatval($borrowCount[6]['money'] + $borrowCount[7]['money'] + $borrowCount[8]['money'] + $borrowCount[9]['money']), 2); //借款总额 $rowtj['jcze'] = getFloatValue(floatval($investStatus[4]['investor_capital']), 2); //借出总额 $rowtj['ysze'] = getFloatValue(floatval($investStatus[4]['receive_capital']), 2); //应收总额 $rowtj['yhze'] = getFloatValue(floatval($borrowCount[6]['repayment_money'] + $borrowCount[7]['repayment_money'] + $borrowCount[8]['repayment_money'] + $borrowCount[9]['repayment_money']), 2); //应还总额 $data2['yhze'] = getMoneyFormt(getFloatValue(floatval($borrowCount[6]['repayment_money'] + $borrowCount[7]['repayment_money'] + $borrowCount[8]['repayment_money'] + $borrowCount[9]['repayment_money']), 2)); //应还总额 $data2['dhze'] = getMoneyFormt(getFloatValue($rowtj['jkze'] - $rowtj['yhze'], 2)); //待还总额 $data2['jcze'] = getMoneyFormt(getFloatValue(floatval($investStatus[4]['investor_capital']), 2)); //借出总额 $data2['ysze'] = getMoneyFormt(getFloatValue(floatval($investStatus[4]['receive_capital']), 2)); //应收总额 $data2['dsze'] = getMoneyFormt(getFloatValue($rowtj['jcze'] - $rowtj['ysze'], 2)); //待收总额 $data2['fz'] = getMoneyFormt(getFloatValue($rowtj['jcze'] - $rowtj['jkze'], 2)); $data2['jkcgcs'] = (int) ($borrowCount[6]['num'] + $borrowCount[7]['num'] + $borrowCount[8]['num'] + $borrowCount[9]['num']); //借款成功次数 $data2['zcze'] = getMoneyFormt(getFloatValue(floatval($zw['account_money'] + $zw['back_money'] + $zw['money_collect'] + $zw['money_freeze']), 2)); //资产总额 //还款情况相关 $field4 = "status,sort_order,borrow_id,sum(capital) as capital,sum(interest) as interest"; $sql4 = sprintf("SELECT {$field4} FROM `lzh_investor_detail` WHERE borrow_uid = %s GROUP BY sort_order, borrow_id ", $borrow_uid); $zw4 = $db->query($sql4); while ($v = $db->fetchArray($zw4)) { // $repaymentStatus[$v['status']]['capital']+=$v['capital'];//当前状态下的数金额 // $repaymentStatus[$v['status']]['interest']+=$v['interest'];//当前状态下的数金额 $repaymentStatus[$v['status']]['num']++; //当前状态下的总笔数 } $data2['repayment1'] = (int) $repaymentStatus[1]['num']; //正常还款次数: $data2['repayment3'] = (int) $repaymentStatus[3]['num']; //迟还次数: $data2['repayment2'] = (int) $repaymentStatus[2]['num']; //提前还款次数:: $data2['repayment6'] = (int) $repaymentStatus[6]['num']; //待还款笔数: $data2['repayment4'] = (int) $repaymentStatus[4]['num']; //网站代还次数::: $data2['repayment5'] = (int) $repaymentStatus[5]['num']; //逾期还款笔数:: $areaList = getArea(); $data2['location'] = $areaList[$zw['province']] . $areaList[$zw['city']]; unset($zw['province'], $zw['city']); $zz = array_merge($zw, $data2); return $zz; }
public function save() { if (!$this->uid) { $this->error("请先登陆", __APP__ . "/member/common/login"); } $pre = C('DB_PREFIX'); //相关的判断参数 $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']); $fee_borrow_manage = explode("|", $this->glo['fee_borrow_manage']); $vminfo = M('members m')->join("{$pre}member_info mf ON m.id=mf.uid")->field("m.user_leve,m.time_limit,mf.province_now,mf.city_now,mf.area_now")->where("m.id={$this->uid}")->find(); //相关的判断参数 $borrow['borrow_type'] = intval(cookie(text($_POST['vkey']))); if ($borrow['borrow_type'] == 50) { $this->error("校验数据有误,请重新发布"); } $borrow['borrow_money'] = intval($_POST['borrow_money']); $_minfo = getMinfo($this->uid, true); $_capitalinfo = getMemberBorrowScan($this->uid); switch ($borrow['borrow_type']) { case 1: //普通标 if ($_minfo['credit_cuse'] < $borrow['borrow_money']) { $this->error("您的可用信用额度为{$_minfo['credit_cuse']}元,小于您准备借款的金额,不能发标"); } break; case 2: //担保标 if ($_minfo['borrow_vouch_cuse'] < $borrow['borrow_money']) { $this->error("您的可用信用担保借款额度为{$_minfo['borrow_vouch_cuse']}元,小于您准备借款的金额,不能发标"); } break; case 3: //秒还标 break; case 4: //净值标 $_netMoney = getFloatValue($minfo['money_collect'], 2); //getNet($_minfo,$_capitalinfo); if ($_netMoney < $borrow['borrow_money']) { $this->error("您的净资产为{$_netMoney}元,小于您准备借款的金额,不能发标"); } break; case 5: //抵押标 //$borrow_type=5; break; } if ($borrow['borrow_type'] == 2) { //担保标 $borrow['reward_vouch_rate'] = floatval($_POST['vouch_rate']); $borrow['reward_vouch_money'] = getFloatValue($borrow['borrow_money'] * $borrow['reward_vouch_rate'] / 100, 2); $borrow['vouch_member'] = text($_POST['vouch_member']); } $borrow['borrow_uid'] = $this->uid; $borrow['borrow_name'] = text($_POST['borrow_name']); $borrow['borrow_duration'] = $borrow['borrow_type'] == 3 ? 1 : intval($_POST['borrow_duration']); //秒标固定为一月 $borrow['borrow_interest_rate'] = floatval($_POST['borrow_interest_rate']); if (strtolower($_POST['is_day']) == 'yes') { $borrow['repayment_type'] = 1; } elseif ($borrow['borrow_type'] == 3) { $borrow['repayment_type'] = 2; } else { $borrow['repayment_type'] = intval($_POST['repayment_type']); } if ($_POST['show_tbzj'] == 1) { $borrow['is_show_invest'] = 1; } //共几期(分几次还) $borrow['total'] = $borrow['repayment_type'] == 1 ? 1 : $borrow['borrow_duration']; //共几期(分几次还) $borrow['borrow_status'] = 0; $borrow['borrow_use'] = intval($_POST['borrow_use']); $borrow['add_time'] = time(); $borrow['collect_day'] = intval($_POST['borrow_time']); $borrow['add_ip'] = get_client_ip(); $borrow['borrow_info'] = text($_POST['borrow_info']); $borrow['reward_type'] = intval($_POST['reward_type']); $borrow['reward_num'] = floatval($_POST["reward_type_{$borrow['reward_type']}_value"]); $borrow['borrow_min'] = intval($_POST['borrow_min']); $borrow['borrow_max'] = intval($_POST['borrow_max']); $borrow['province'] = $vminfo['province_now']; $borrow['city'] = $vminfo['city_now']; $borrow['area'] = $vminfo['area_now']; if ($_POST['is_pass'] && intval($_POST['is_pass']) == 1) { $borrow['password'] = md5($_POST['password']); } //借款费和利息 $borrow['borrow_interest'] = getBorrowInterest($borrow['repayment_type'], $borrow['borrow_money'], $borrow['borrow_duration'], $borrow['borrow_interest_rate']); if ($borrow['repayment_type'] == 1) { //按天还 $fee_rate = is_numeric($fee_borrow_manage[0]) ? $fee_borrow_manage[0] / 100 : 0.001; $borrow['borrow_fee'] = getFloatValue($fee_rate * $borrow['borrow_money'] * $borrow['borrow_duration'], 2); } else { $fee_rate_1 = is_numeric($fee_borrow_manage[1]) ? $fee_borrow_manage[1] / 100 : 0.02; $fee_rate_2 = is_numeric($fee_borrow_manage[2]) ? $fee_borrow_manage[2] / 100 : 0.002; if ($borrow['borrow_duration'] > $fee_borrow_manage[3] && is_numeric($fee_borrow_manage[3])) { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); $borrow['borrow_fee'] += getFloatValue($fee_rate_2 * $borrow['borrow_money'] * ($borrow['borrow_duration'] - $fee_borrow_manage[3]), 2); } else { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); } } if ($borrow['borrow_type'] == 3) { //秒还标 if ($borrow['reward_type'] > 0) { if ($borrow['reward_type'] == 1) { $_reward_money = getFloatValue($borrow['borrow_money'] * $borrow['reward_num'] / 100, 2); } elseif ($borrow['reward_type'] == 2) { $_reward_money = getFloatValue($borrow['reward_num'], 2); } } $_reward_money = floatval($_reward_money); if ($_minfo['account_money'] < $borrow['borrow_fee'] + $_reward_money) { $this->error("发布此标您最少需保证您的帐户余额大于等于" . ($borrow['borrow_fee'] + $_reward_money) . "元,以确保可以支付借款管理费和投标奖励费用"); } } //投标上传图片资料(暂隐) foreach ($_POST['swfimglist'] as $key => $v) { if ($key > 10) { break; } $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $_POST['picinfo'][$key]; } $borrow['updata'] = serialize($row); $borrow['is_tuijian'] = 1; $newid = M("borrow_info")->add($borrow); if ($newid) { $this->success("借款发布成功,网站会尽快初审", __APP__ . "/member/borrowin#fragment-1"); } else { $this->error("发布失败,请先检查是否完成了个人详细资料然后重试"); } }
function getBorrowList($parm = array()) { if (empty($parm['map'])) { return; } $map = $parm['map']; $orderby = $parm['orderby'] . "borrow_money-has_borrow DESC ,id DESC"; if ($parm['pagesize']) { //分页处理 import("ORG.Util.Page"); $count = M('borrow_info b')->where($map)->count('b.id'); // return $sql= M()->getLastSql(); // die; $p = new Page($count, $parm['pagesize']); $page = $p->show(); $Lsql = "{$p->firstRow},{$p->listRows}"; //分页处理 } else { $page = ""; $Lsql = "{$parm['limit']}"; } $pre = C('DB_PREFIX'); $suffix = C("URL_HTML_SUFFIX"); $field = "b.id,b.borrow_name,b.borrow_type,b.reward_type,b.borrow_times,b.borrow_status,b.borrow_money,b.borrow_use,b.repayment_type,b.borrow_min,b.borrow_interest_rate,b.borrow_mortgage_rate,b.borrow_duration,b.collect_time,b.add_time,b.province,b.has_borrow,b.has_vouch,b.city,b.area,b.reward_type,b.reward_num,b.password,m.user_name,m.id as uid,m.credits,m.customer_name,b.is_tuijian,b.deadline,b.danbao,b.borrow_info,b.risk_control,b.toubiao_telephone"; // $field = "b.id,b.borrow_name,b.borrow_type,b.reward_type,b.borrow_times,b.borrow_status,b.borrow_money,b.borrow_use,b.repayment_type,b.borrow_min,b.borrow_interest_rate,b.borrow_duration,b.collect_time,b.add_time,b.province,b.has_borrow,b.has_vouch,b.city,b.area,b.reward_type,b.reward_num,b.password,m.user_name,m.id as uid,m.credits,m.customer_name,b.is_tuijian,b.deadline,b.danbao,b.borrow_info,b.risk_control"; $list = M('borrow_info b')->field($field)->join("{$pre}members m ON m.id=b.borrow_uid")->where($map)->order($orderby)->limit($Lsql)->select(); //ORDER BY borrow_money-has_borrow DESC ,id DESC // echo M()->getLastSql(); // die; $areaList = getArea(); foreach ($list as $key => $v) { if (strlen($v['toubiao_telephone']) >= 11) { $userTelephone = $_SESSION['u_user_name']; if (strpos($v['toubiao_telephone'], $userTelephone) !== false) { //此标是否在前端显示 $list[$key]['zw_show'] = 1; } else { $list[$key]['zw_show'] = 0; } } else { $list[$key]['zw_show'] = 1; } $list[$key]['location'] = $areaList[$v['province']] . $areaList[$v['city']]; $list[$key]['biao'] = $v['borrow_times']; $list[$key]['need'] = $v['borrow_money'] - $v['has_borrow']; $list[$key]['leftdays'] = getLeftTime($v['collect_time']); $list[$key]['progress'] = getFloatValue($v['has_borrow'] / $v['borrow_money'] * 100, 2); $list[$key]['vouch_progress'] = getFloatValue($v['has_vouch'] / $v['borrow_money'] * 100, 2); $list[$key]['burl'] = MU("Home/invest", "invest", array("id" => $v['id'], "suffix" => $suffix)); //新加 $list[$key]['lefttime'] = $v['collect_time'] - time(); if ($v['deadline'] == 0) { $endTime = strtotime(date("Y-m-d", time())); if ($v['repayment_type'] == 1) { $list[$key]['repaytime'] = strtotime("+{$v['borrow_duration']} day", $endTime); } else { $list[$key]['repaytime'] = strtotime("+{$v['borrow_duration']} month", $endTime); } } else { $list[$key]['repaytime'] = $v['deadline']; //还款时间 } $list[$key]['publishtime'] = $v['add_time'] + 60 * 60 * 24 * 3; //预计发标时间=添加时间+1天 if ($v['danbao'] != 0) { $danbao = M('article')->field("id,title")->where("type_id =7 and id ={$v['danbao']}")->find(); $list[$key]['danbao'] = $danbao['title']; //担保机构 } else { $list[$key]['danbao'] = '暂无担保机构'; //担保机构 } } $row = array(); $row['list'] = $list; $row['page'] = $page; $row['count'] = $count; return $row; }
function renderBlock($char_data) { $rating = getRating($char_data[UNIT_FIELD_LEVEL]); $value = getFloatValue($char_data[PLAYER_BLOCK_PERCENTAGE], 2); $valueRating = $char_data[PLAYER_FIELD_BLOCK_RATING]; $RatingPct = $valueRating / GetRatingCoefficient($rating, CR_BLOCK); $block_damage = $char_data[PLAYER_SHIELD_BLOCK]; createTopTable(); printf("<TR><TD class=head>Block Chance %.2f%%</TD></TR>", $value); printf("<TR><TD>Block rating of %d adds Block</TD></TR>", $valueRating, $RatingPct); printf("<TR><TD>You block stops %d damage</TD></TR>", $block_damage); createEndTable("normStat", $value . "%"); }
private function getPaydetail() { if (!$this->uid) { exit; } $this->paydetail['money'] = getFloatValue($_GET['t_money'], 2); $this->paydetail['fee'] = 0; $this->paydetail['add_time'] = time(); $this->paydetail['add_ip'] = get_client_ip(); $this->paydetail['status'] = 0; $this->paydetail['uid'] = $this->uid; $this->paydetail['bank'] = strtoupper($_GET['bankCode']); }
function getBorrowList($parm = array()) { if (empty($parm['map'])) { return; } $map = $parm['map']; $orderby = $parm['orderby']; if ($parm['pagesize']) { //分页处理 import("ORG.Util.Page"); //require THINK_PATH.'Lib/Util/page.class.php'; $count = M('borrow_info b')->where($map)->count('b.id'); $p = new Page($count, $parm['pagesize']); $page = $p->show(); $Lsql = "{$p->firstRow},{$p->listRows}"; //分页处理 } else { $page = ""; $Lsql = "{$parm['limit']}"; } $pre = C('DB_PREFIX'); $suffix = C("URL_HTML_SUFFIX"); //$field = "b.id,b.borrow_name,b.topic,b.borrow_type,b.reward_type,b.borrow_times,b.borrow_status,b.borrow_money,b.borrow_use,b.repayment_type,b.borrow_interest_rate,b.borrow_duration,b.collect_time,b.add_time,b.province,b.has_borrow,b.has_vouch,b.city,b.area,b.reward_type,b.reward_num,b.password,m.user_name,m.id as uid,m.credits,m.customer_name,b.is_tuijian,b.deadline,b.danbao,b.borrow_info,b.risk_control"; $field = "b.id,b.borrow_name,b.money_invest_place,b.borrow_type,b.stock_type,b.reward_type,b.borrow_times,b.borrow_status,b.borrow_money,b.borrow_use,b.repayment_type,b.stock_type,b.borrow_interest_rate,b.borrow_duration,b.collect_time,b.add_time,b.province,b.has_borrow,b.has_vouch,b.city,b.area,b.reward_type,b.reward_num,b.password,m.user_name,m.id as uid,m.credits,m.customer_name,b.is_tuijian,b.deadline,b.danbao,b.borrow_info,b.risk_control"; $list = M('borrow_info b')->field($field)->join("{$pre}members m ON m.id=b.borrow_uid")->where($map)->order($orderby)->limit($Lsql)->select(); $areaList = getArea(); foreach ($list as $key => $v) { $list[$key]['location'] = $areaList[$v['province']] . $areaList[$v['city']]; $list[$key]['biao'] = $v['borrow_times']; $list[$key]['need'] = $v['borrow_money'] - $v['has_borrow']; $list[$key]['leftdays'] = getLeftTime($v['collect_time']); $progress = $v['has_borrow'] / $v['borrow_money'] * 100; $list[$key]['progress'] = $progress > 50 ? floor($progress) : ceil($progress); //增加floor //$list[$key]['progress'] = getFloatValue($v['has_borrow']/$v['borrow_money']*100,2); $list[$key]['vouch_progress'] = getFloatValue($v['has_vouch'] / $v['borrow_money'] * 100, 2); $list[$key]['burl'] = MU("Home/invest", "invest", array("id" => $v['id'], "suffix" => $suffix)); //新加 $list[$key]['lefttime'] = $v['collect_time'] - time(); if ($v['deadline'] == 0) { $endTime = strtotime(date("Y-m-d", time())); if ($v['repayment_type'] == 1) { $list[$key]['repaytime'] = strtotime("+{$v['borrow_duration']} day", $endTime); } else { $list[$key]['repaytime'] = strtotime("+{$v['borrow_duration']} month", $endTime); } } else { $list[$key]['repaytime'] = $v['deadline']; //还款时间 } $list[$key]['publishtime'] = $v['add_time'] + 60 * 60 * 24 * 3; //预计发标时间=添加时间+1天 if ($v['danbao'] != 0) { $danbao = M('article')->field("id,title")->where("type_id =7 and id ={$v['danbao']}")->find(); $list[$key]['danbao'] = $danbao['title']; //担保机构 } else { $list[$key]['danbao'] = '暂无担保机构'; //担保机构 } } $row = array(); $row['list'] = $list; $row['count'] = $count; $row['page'] = $page; return $row; }
public function downdingtoubao() { $per = C('DB_PREFIX'); $borrow_config = (require C("APP_ROOT") . "Conf/borrow_config.php"); $type = $borrow_config['REPAYMENT_TYPE']; $invest_id = intval($_GET['id']); if (empty($invest_id)) { $this->display("dingtoubao"); } $datag = get_global_setting(); $fee_rate = $datag['fee_invest_manage']; //投资者成交管理费费率 $iinfo = M("transfer_borrow_investor")->field(true)->where("investor_uid={$this->uid} AND id={$invest_id}")->find(); $binfo = M('transfer_borrow_info')->field(true)->find($iinfo['borrow_id']); $tou = M('transfer_investor_detail')->where("invest_id={$iinfo['id']} AND investor_uid={$this->uid} ")->find(); $detail = M("transfer_detail")->field(true)->find($iinfo['borrow_id']); $mBorrow = M("members m")->join("{$per}member_info mi ON mi.uid=m.id")->field('mi.real_name,mi.address,mi.cell_phone,m.user_name')->where("m.id={$binfo['borrow_uid']}")->find(); $mInvest = M("members m")->join("{$per}member_info mi ON mi.uid=m.id")->field('mi.real_name,mi.address,mi.cell_phone,mi.idcard,m.user_name,m.user_email')->where("m.id={$iinfo['investor_uid']}")->find(); $danbao = M('article')->field('id,title,art_img')->where("id={$binfo['danbao']}")->find(); if (!is_array($tou)) { $mBorrow['real_name'] = hidecard($mBorrow['real_name'], 4); } $binfo['repayment_name'] = $type[$binfo['repayment_type']]; $this->assign("bid", "LZBHT-" . str_repeat("0", 5 - strlen($iinfo['id'])) . $iinfo['id']); $detailinfo = M('transfer_investor_detail d')->join("{$per}transfer_borrow_investor bi ON bi.id=d.invest_id")->join("{$per}members m ON m.id=d.investor_uid")->field('d.borrow_id,d.investor_uid,d.borrow_uid,d.capital,sum(d.capital+d.interest-d.interest_fee) benxi,d.total,m.user_name,bi.investor_capital,bi.add_time')->where("d.borrow_id={$iinfo['borrow_id']} and d.invest_id ={$iinfo['id']}")->group('d.investor_uid')->find(); $time = M('transfer_borrow_investor')->field('id,add_time,deadline')->where("borrow_id={$iinfo['borrow_id']} order by add_time asc")->limit(1)->find(); $deadline_last = $time['deadline']; $this->assign('deadline_last', $deadline_last); $this->assign('detailinfo', $detailinfo); $type1 = $this->gloconf['BORROW_USE']; $binfo['borrow_use'] = $type1[$binfo['borrow_use']]; $type = $borrow_config['REPAYMENT_TYPE']; //echo $binfo['repayment_type']; $binfo['repayment_name'] = $type[$binfo['repayment_type']]; $iinfo['repay'] = getFloatValue(($iinfo['investor_capital'] + $iinfo['investor_interest']) / $binfo['borrow_duration'], 2); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $ht = M('hetong')->field('hetong_img,name,dizhi,tel')->find(); $this->assign("ht", $ht); $this->assign("fee_rate", $fee_rate); $this->assign("Bconfig", $Bconfig); $this->assign('iinfo', $iinfo); $this->assign('binfo', $binfo); $this->assign('tou', $tou); $this->assign('mBorrow', $mBorrow); $this->assign('mInvest', $mInvest); $this->assign('danbao', $danbao); $this->assign('detail', $detail); $detail_list = M('transfer_investor_detail')->field(true)->where("invest_id={$invest_id}")->select(); $this->assign("detail_list", $detail_list); $ht = M('hetong')->field('hetong_img,name,dizhi,tel')->find(); $this->assign("ht", $ht); $this->display("dingtoubao"); }
public function save() { if (!$this->uid) { $this->error("请先登陆", __APP__ . "/member/common/login"); } $pre = C('DB_PREFIX'); //相关的判断参数 $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']); $fee_borrow_manage = explode("|", $this->glo['fee_borrow_manage']); $vminfo = M('members m')->join("{$pre}member_info mf ON m.id=mf.uid")->field("m.user_leve,m.time_limit,mf.province_now,mf.city_now,mf.area_now")->where("m.id={$this->uid}")->find(); //相关的判断参数 $borrow['borrow_type'] = intval(cookie(text($_POST['vkey']))); if ($borrow['borrow_type'] == 0) { $this->error("校验数据有误,请重新发布"); } if (floatval($_POST['borrow_interest_rate']) > $rate_lixt[1] || floatval($_POST['borrow_interest_rate']) < $rate_lixt[0]) { $this->error("提交的借款利率超出允许范围,请重试", 0); } //if($_POST['borrow_btype']==0) $this->error("请选择标的类型"); $borrow['borrow_money'] = intval($_POST['borrow_money']); $_minfo = getMinfo($this->uid, "m.pin_pass,mm.account_money,mm.back_money,mm.credit_cuse,mm.money_collect"); $_capitalinfo = getMemberBorrowScan($this->uid); /////////////////////////////////////////////////////// $borrowNum = M('borrow_info')->field("borrow_type,count(id) as num,sum(borrow_money) as money,sum(repayment_money) as repayment_money")->where("borrow_uid = {$this->uid} AND borrow_status=6 ")->group("borrow_type")->select(); $borrowDe = array(); foreach ($borrowNum as $k => $v) { $borrowDe[$v['borrow_type']] = $v['money'] - $v['repayment_money']; } /////////////////////////////////////////////////// switch ($borrow['borrow_type']) { case 1: //普通标 if ($_minfo['credit_cuse'] < $borrow['borrow_money']) { $this->error("您的可用信用额度为{$_minfo['credit_cuse']}元,小于您准备借款的金额,不能发标"); } break; case 2: //新担保标 //新担保标 case 3: //秒还标 break; case 4: //净值标 $_netMoney = getFloatValue(0.9 * $_minfo['money_collect'] - $borrowDe[4], 2); if ($_netMoney < $borrow['borrow_money']) { $this->error("您的净值额度{$_netMoney}元,小于您准备借款的金额,不能发标"); } break; case 5: //抵押标 //$borrow_type=5; break; } $borrow['borrow_uid'] = $this->uid; $borrow['borrow_name'] = text($_POST['borrow_name']); $borrow['borrow_duration'] = $borrow['borrow_type'] == 3 ? 1 : intval($_POST['borrow_duration']); //秒标固定为一月 $borrow['borrow_interest_rate'] = floatval($_POST['borrow_interest_rate']); if (strtolower($_POST['is_day']) == 'yes') { $borrow['repayment_type'] = 1; } elseif ($borrow['borrow_type'] == 3) { $borrow['repayment_type'] = 2; } else { $borrow['repayment_type'] = intval($_POST['repayment_type']); } if ($borrow['repayment_type'] == '1' || $borrow['repayment_type'] == '5') { $borrow['total'] = 1; } else { $borrow['total'] = $borrow['borrow_duration']; //分几期还款 } $borrow['borrow_status'] = 0; $borrow['borrow_use'] = intval($_POST['borrow_use']); $borrow['add_time'] = time(); $borrow['collect_day'] = intval($_POST['borrow_time']); $borrow['add_ip'] = get_client_ip(); $borrow['borrow_info'] = text($_POST['borrow_info']); $borrow['reward_type'] = intval($_POST['reward_type']); $borrow['reward_num'] = floatval($_POST["reward_type_{$borrow['reward_type']}_value"]); $borrow['borrow_min'] = intval($_POST['borrow_min']); $borrow['borrow_max'] = intval($_POST['borrow_max']); $borrow['borrow_btype'] = intval($_POST['borrow_btype']); $borrow['ifdianzibiao'] = $_POST['ifdianzibiao']; $borrow['is_tuijian'] = $_POST['is_tuijian']; /*$borrow['province'] = $vminfo['province_now']; $borrow['city'] = $vminfo['city_now']; $borrow['area'] = $vminfo['area_now'];*/ if ($_POST['is_pass'] && intval($_POST['is_pass']) == 1) { $borrow['password'] = md5($_POST['password']); } $borrow['money_collect'] = floatval($_POST['moneycollect']); //代收金额限制设置 //借款费和利息 $borrow['borrow_interest'] = getBorrowInterest($borrow['repayment_type'], $borrow['borrow_money'], $borrow['borrow_duration'], $borrow['borrow_interest_rate']); if ($borrow['repayment_type'] == 1) { //按天还 $fee_rate = is_numeric($fee_borrow_manage[0]) ? $fee_borrow_manage[0] / 100 : 0.001; $borrow['borrow_fee'] = getFloatValue($fee_rate * $borrow['borrow_money'] * $borrow['borrow_duration'], 2); } else { $fee_rate_1 = is_numeric($fee_borrow_manage[1]) ? $fee_borrow_manage[1] / 100 : 0.02; $fee_rate_2 = is_numeric($fee_borrow_manage[2]) ? $fee_borrow_manage[2] / 100 : 0.002; if ($borrow['borrow_duration'] > $fee_borrow_manage[3] && is_numeric($fee_borrow_manage[3])) { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); $borrow['borrow_fee'] += getFloatValue($fee_rate_2 * $borrow['borrow_money'] * ($borrow['borrow_duration'] - $fee_borrow_manage[3]), 2); } else { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); } } if ($borrow['borrow_type'] == 3) { //秒还标 if ($borrow['reward_type'] > 0) { $_reward_money = getFloatValue($borrow['borrow_money'] * $borrow['reward_num'] / 100, 2); } $_reward_money = floatval($_reward_money); if ($_minfo['account_money'] + $_minfo['back_money'] < $borrow['borrow_fee'] + $_reward_money) { $this->error("发布此标您最少需保证您的帐户余额大于等于" . ($borrow['borrow_fee'] + $_reward_money) . "元,以确保可以支付借款管理费和投标奖励费用"); } } //投标上传图片资料(暂隐) foreach ($_POST['swfimglist'] as $key => $v) { if ($key > 10) { break; } $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $_POST['picinfo'][$key]; } $borrow['updata'] = serialize($row); $newid = M("borrow_info")->add($borrow); //var_dump($borrow);exit; $suo = array(); $suo['id'] = $newid; $suo['suo'] = 0; $suoid = M("borrow_info_lock")->add($suo); if ($newid) { $this->success("借款发布成功,网站会尽快初审", __APP__ . "/member/borrowin#fragment-2"); } else { $this->error("发布失败,请先检查是否完成了个人详细资料然后重试"); } }
public function tdetail() { if ($_GET['type'] == 'commentlist') { //评论 $cmap['tid'] = intval($_GET['id']); $clist = getCommentList($cmap, 5); $this->assign("commentlist", $clist['list']); $this->assign("commentpagebar", $clist['page']); $this->assign("commentcount", $clist['count']); $data['html'] = $this->fetch('commentlist'); exit(json_encode($data)); } $pre = C('DB_PREFIX'); $id = intval($_GET['id']); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //合同ID if ($this->uid) { $invs = M('borrow_investor')->field('id')->where("borrow_id={$id} AND (investor_uid={$this->uid})")->find(); if ($invs['id'] > 0) { $invsx = $invs['id']; } elseif (!is_array($invs)) { $invsx = 'no'; } } else { $invsx = 'login'; } $this->assign("invid", $invsx); //合同ID //borrowinfo //$borrowinfo = M("borrow_info")->field(true)->find($id); $borrowinfo = M("borrow_info bi")->field('bi.*,ac.title,ac.id as aid')->join('lzh_article ac on ac.id= bi.danbao')->where('bi.id=' . $id)->find(); if (!is_array($borrowinfo) || $borrowinfo['borrow_status'] == 0 && $this->uid != $borrowinfo['borrow_uid']) { $this->error("数据有误"); } $borrowinfo['biao'] = $borrowinfo['borrow_times']; $borrowinfo['need'] = $borrowinfo['borrow_money'] - $borrowinfo['has_borrow']; $borrowinfo['lefttime'] = $borrowinfo['collect_time'] - time(); $borrowinfo['progress'] = getFloatValue($borrowinfo['has_borrow'] / $borrowinfo['borrow_money'] * 100, 2); $this->assign("vo", $borrowinfo); $memberinfo = M("members m")->field("m.id,m.customer_name,m.customer_id,m.user_name,m.reg_time,m.credits,fi.*,mi.*,mm.*")->join("{$pre}member_financial_info fi ON fi.uid = m.id")->join("{$pre}member_info mi ON mi.uid = m.id")->join("{$pre}member_money mm ON mm.uid = m.id")->where("m.id={$borrowinfo['borrow_uid']}")->find(); $areaList = getArea(); $memberinfo['location'] = $areaList[$memberinfo['province']] . $areaList[$memberinfo['city']]; $memberinfo['location_now'] = $areaList[$memberinfo['province_now']] . $areaList[$memberinfo['city_now']]; $memberinfo['zcze'] = $memberinfo['account_money'] + $memberinfo['back_money'] + $memberinfo['money_collect'] + $memberinfo['money_freeze']; $this->assign("minfo", $memberinfo); //data_list $data_list = M("member_data_info")->field('type,add_time,count(status) as num,sum(deal_credits) as credits')->where("uid={$borrowinfo['borrow_uid']} AND status=1")->group('type')->select(); $this->assign("data_list", $data_list); //data_list // 投资记录 $this->investRecord($id); $this->assign('borrow_id', $id); //近期还款的投标 //$time1 = microtime(true)*1000; $history = getDurationCount($borrowinfo['borrow_uid']); $this->assign("history", $history); //$time2 = microtime(true)*1000; //echo $time2-$time1; //investinfo $fieldx = "bi.investor_capital,bi.add_time,m.user_name,bi.is_auto"; $investinfo = M("borrow_investor bi")->field($fieldx)->join("{$pre}members m ON bi.investor_uid = m.id")->limit(10)->where("bi.borrow_id={$id}")->order("bi.id DESC")->select(); $this->assign("investinfo", $investinfo); //investinfo //帐户资金情况 $this->assign("investInfo", getMinfo($this->uid, true)); $this->assign("mainfo", getMinfo($borrowinfo['borrow_uid'], true)); $this->assign("capitalinfo", getMemberBorrowScan($borrowinfo['borrow_uid'])); //帐户资金情况 //展示资料 $show_list = M("member_borrow_show")->where("uid={$borrowinfo['borrow_uid']}")->order('sort DESC')->select(); $this->assign("show_list", $show_list); //展示资料 //上传资料类型 $upload_type = FilterUploadType(FS("Webconfig/integration")); $this->assign("upload_type", $upload_type); // 上传资料所有类型 //评论 $cmap['tid'] = $id; $clist = getCommentList($cmap, 5); $this->assign("Bconfig", $Bconfig); $this->assign("gloconf", $this->gloconf); $this->assign("commentlist", $clist['list']); $this->assign("commentpagebar", $clist['page']); $this->assign("commentcount", $clist['count']); $this->display(); }
public function submit() { if (!$this->uid) { redirect('/member/common/login'); } if (empty($_SERVER['HTTP_REFERER'])) { redirect('/mpay/repl'); exit; } $payinfo = $this->payCore->getPayinfo($this->uid); if (empty($payinfo)) { die('参数错误'); } $i = 1; $this->pay_no = date("YmdHis") . mt_rand(100000, 999999); $this->payMoney = getFloatValue($payinfo['nowmoney'], 2); while (M('member_payonline')->where(array('pay_no' => $this->pay_no))->count()) { $this->pay_no = date("YmdHis") . mt_rand(100000, 999999); $i++; } $reg_time = M('members')->where('id=' . $this->uid)->getField('reg_time'); //获取用户身份认证信息 $realname = $this->getMemberInfo(); $this->payCore->user_info_dt_register = date('YmdHis'); $this->payCore->card_no = $payinfo['card_no']; $this->payCore->no_order = $this->pay_no; $this->payCore->name_goods = $this->name_goods . '-编号(' . $this->pay_no . ')'; $this->payCore->info_order = $this->info_order; $this->payCore->money_order = $this->payMoney; $this->payCore->user_id = $this->uid; $this->payCore->acct_name = $realname['real_name']; //姓名 $this->payCore->id_no = $realname['idcard']; //身份证号 $this->payCore->return_url = $this->return_url; $this->payCore->notify_url = $this->notify_url; //if($payinfo['no_agree']){ //$this->payCore->html = $this->fetch(); $this->payCore->ajax = 1; // } $this->payCore->no_agree = $this->getNoArgee($payinfo); $this->getPaydetail(); $res = M('member_payonline')->add($this->paydetail); if ($res) { echo $this->payCore->paySubmit(); } //die('订单创建失败'); }
public function save() { //if(!$this->uid) $this->error("请先登录",__APP__."/member/common/login"); //if(empty($_FILES['topic']['name'])){ // $this->error('请上传标题图片'); //} $borrow = array(); //$this->savePathNew = C('HOME_UPLOAD_DIR').'Product/'; //$this->thumbMaxWidth = C('PRODUCT_UPLOAD_W'); //$this->thumbMaxHeight = C('PRODUCT_UPLOAD_H'); //$this->saveRule = date("YmdHis",time()).rand(0,1000); //$info = $this->CUpload(); //$borrow['topic'] = $info[0]['savepath'].$info[0]['savename']; if ($_POST['borrow_uid'] == '') { $this->error('选择借款人不能为空!'); } if ($_POST['borrow_type'] == '') { $this->error('借款标类型不能为空!'); } if ($_POST['reward_type'] && ($_POST['reward_type_1_value'] > 6 || $_POST['reward_type_1_value'] < 0)) { $this->error("投标奖励超出范围!"); } if ($this->_post('stock_type') == '') { $this->error("选择配资类型不能为空!"); } $capital_name = htmlspecialchars($this->_post('capital_name')); $capital_card = htmlspecialchars($this->_post('capital_card')); $pre = C('DB_PREFIX'); //相关的判断参数 $rate_lixt = explode("|", $this->glo['rate_lixi']); $borrow_duration = explode("|", $this->glo['borrow_duration']); $borrow_duration_day = explode("|", $this->glo['borrow_duration_day']); $fee_borrow_manage = explode("|", $this->glo['fee_borrow_manage']); $vminfo = M('members m')->join("{$pre}member_info mf ON m.id=mf.uid")->field("m.user_leve,m.time_limit,mf.province_now,mf.city_now,mf.area_now")->where("m.id={$this->uid}")->find(); //相关的判断参数 $borrow['borrow_type'] = $this->_post('borrow_type'); if ($borrow['borrow_type'] == 0) { $this->error("校验数据有误,请重新发布"); } if (floatval($_POST['borrow_interest_rate']) > $rate_lixt[1] || floatval($_POST['borrow_interest_rate']) < $rate_lixt[0]) { $this->error("提交的借款利率超出允许范围,请重试", 0); } $borrow['borrow_money'] = intval($_POST['borrow_money']); $_minfo = getMinfo($this->uid, "m.pin_pass,mm.account_money,mm.back_money,mm.credit_cuse,mm.money_collect"); $_capitalinfo = getMemberBorrowScan($this->uid); /////////////////////////////////////////////////////// $borrowNum = M('borrow_info')->field("borrow_type,count(id) as num,sum(borrow_money) as money,sum(repayment_money) as repayment_money")->where("borrow_uid = {$this->uid} AND borrow_status=6 ")->group("borrow_type")->select(); $borrowDe = array(); foreach ($borrowNum as $k => $v) { $borrowDe[$v['borrow_type']] = $v['money'] - $v['repayment_money']; } /////////////////////////////////////////////////// switch ($borrow['borrow_type']) { case 1: //普通标 //if($_minfo['credit_cuse']<$borrow['borrow_money']) $this->error("您的可用信用额度为{$_minfo['credit_cuse']}元,小于您准备借款的金额,不能发标"); break; case 2: //新担保标 //新担保标 case 3: //秒还标 break; case 4: //净值标 //$_netMoney = getFloatValue(0.9*$_minfo['money_collect']-$borrowDe[4],2); //if($_netMoney<$borrow['borrow_money']) $this->error("您的净值额度{$_netMoney}元,小于您准备借款的金额,不能发标"); break; case 5: //抵押标 //$borrow_type=5; break; } $borrow['borrow_uid'] = $this->_post("borrow_uid"); $borrow['borrow_name'] = text($_POST['borrow_name']); $borrow['borrow_duration'] = $borrow['borrow_type'] == 3 ? 1 : intval($_POST['borrow_duration']); //秒标固定为一月 $borrow['borrow_interest_rate'] = floatval($_POST['borrow_interest_rate']); if (strtolower($_POST['is_day']) == 'yes') { $borrow['repayment_type'] = 1; } elseif ($borrow['borrow_type'] == 3) { $borrow['repayment_type'] = 2; } else { $borrow['repayment_type'] = intval($_POST['repayment_type']); } if ($borrow['repayment_type'] == '1' || $borrow['repayment_type'] == '5') { $borrow['total'] = 1; } else { $borrow['total'] = $borrow['borrow_duration']; //分几期还款 } $borrow['capital_name'] = $capital_name; $borrow['capital_card'] = $capital_card; $borrow['borrow_status'] = 0; $borrow['borrow_use'] = intval($_POST['borrow_use']); $borrow['add_time'] = time(); $borrow['collect_day'] = intval($_POST['borrow_time']); $borrow['add_ip'] = get_client_ip(); $borrow['borrow_info'] = text($_POST['borrow_info']); $borrow['reward_type'] = intval($_POST['reward_type']); $borrow['reward_num'] = floatval($_POST["reward_type_{$borrow['reward_type']}_value"]); $borrow['borrow_min'] = intval($_POST['borrow_min']); $borrow['borrow_max'] = intval($_POST['borrow_max']); $prow = array(); foreach ($_POST['swfimglist'] as $key => $v) { $prow[$key]['img'] = substr($v, 1); $prow[$key]['info'] = $_POST['picinfo'][$key]; } $borrow['updata'] = false === empty($prow) ? serialize($prow) : ''; /*$borrow['province'] = $vminfo['province_now']; $borrow['city'] = $vminfo['city_now']; $borrow['area'] = $vminfo['area_now'];*/ if ($_POST['is_pass'] && intval($_POST['is_pass']) == 1) { $borrow['password'] = md5($_POST['password']); } $borrow['money_collect'] = floatval($_POST['moneycollect']); //代收金额限制设置 //借款费和利息 $borrow['borrow_interest'] = getBorrowInterest($borrow['repayment_type'], $borrow['borrow_money'], $borrow['borrow_duration'], $borrow['borrow_interest_rate']); if ($borrow['repayment_type'] == 1) { //按天还 $fee_rate = is_numeric($fee_borrow_manage[0]) ? $fee_borrow_manage[0] / 100 : 0.001; $borrow['borrow_fee'] = getFloatValue($fee_rate * $borrow['borrow_money'] * $borrow['borrow_duration'], 2); } else { $fee_rate_1 = is_numeric($fee_borrow_manage[1]) ? $fee_borrow_manage[1] / 100 : 0.02; $fee_rate_2 = is_numeric($fee_borrow_manage[2]) ? $fee_borrow_manage[2] / 100 : 0.002; if ($borrow['borrow_duration'] > $fee_borrow_manage[3] && is_numeric($fee_borrow_manage[3])) { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); $borrow['borrow_fee'] += getFloatValue($fee_rate_2 * $borrow['borrow_money'] * ($borrow['borrow_duration'] - $fee_borrow_manage[3]), 2); } else { $borrow['borrow_fee'] = getFloatValue($fee_rate_1 * $borrow['borrow_money'], 2); } } if ($borrow['borrow_type'] == 3) { //秒还标 if ($borrow['reward_type'] > 0) { $_reward_money = getFloatValue($borrow['borrow_money'] * $borrow['reward_num'] / 100, 2); } $_reward_money = floatval($_reward_money); if ($_minfo['account_money'] + $_minfo['back_money'] < $borrow['borrow_fee'] + $_reward_money) { $this->error("发布此标您最少需保证您的帐户余额大于等于" . ($borrow['borrow_fee'] + $_reward_money) . "元,以确保可以支付借款管理费和投标奖励费用"); } } if ($borrow['borrow_type'] == 2) { $borrow['danbao'] = $_POST['danbao']; $borrow['huilv'] = M('article')->where("id=" . $_POST['danbao'])->getField('art_keyword'); } //投标上传图片资料(暂隐) foreach ($_POST['swfimglist'] as $key => $v) { if ($key > 10) { break; } $row[$key]['img'] = substr($v, 1); $row[$key]['info'] = $_POST['picinfo'][$key]; } $borrow['updata'] = serialize($row); $borrow['stock_the'] = $this->_post("stock_the"); $borrow['stock_bond_money'] = $this->_post("stock_bond_money"); $borrow['stock_type'] = $this->_post('stock_type'); $newid = M("borrow_info")->add($borrow); $suo = array(); $suo['id'] = $newid; $suo['suo'] = 0; $suoid = M("borrow_info_lock")->add($suo); if ($newid) { $this->success("借款发布成功,网站会尽快初审"); } else { $this->error("发布失败,请先检查是否完成了个人详细资料然后重试"); } }
public function actwithdraw() { $pre = C('DB_PREFIX'); $withdraw_money = floatval($_POST['amount']); $pwd = md5($_POST['pwd']); $vo = M('members m')->field('mm.account_money,mm.back_money,(mm.account_money+mm.back_money) all_money,m.user_leve,m.time_limit')->join("{$pre}member_money mm on mm.uid = m.id")->where("m.id={$this->uid} AND m.pin_pass='******'")->find(); if (!is_array($vo)) { ajaxmsg("", 0); } //=======================20151209 if (bccomp($withdraw_money, $vo['all_money']) == 1) { ajaxmsg("提现额大于帐户余额", 2); } //if($vo['all_money']<$withdraw_money) ajaxmsg("提现额大于帐户余额",2); $start = strtotime(date("Y-m-d",time())." 00:00:00"); $end = strtotime(date("Y-m-d", time()) . " 23:59:59"); $wmap['uid'] = $this->uid; $wmap['withdraw_status'] = array("neq", 3); $wmap['add_time'] = array("between", "{$start},{$end}"); $today_money = M('member_withdraw')->where($wmap)->sum('withdraw_money'); $today_time = M('member_withdraw')->where($wmap)->count('id'); $tqfee = explode("|", $this->glo['fee_tqtx']); $fee[0] = explode("-", $tqfee[0]); $fee[1] = explode("-", $tqfee[1]); $fee[2] = explode("-", $tqfee[2]); $one_limit = $fee[2][0]; $txxz_min = $this->glo['txxz_min']; if ($withdraw_money < $txxz_min || $withdraw_money > $one_limit) { ajaxmsg("单笔提现金额限制为{$txxz_min}-{$one_limit}元", 2); } /* $today_limit = $fee[2][1]/$fee[2][0]; if($today_time>=$today_limit){ $message = "一天最多只能提现{$today_limit}次"; ajaxmsg($message,2); } */ if (1 == 1 || $vo['user_leve'] > 0 && $vo['time_limit'] > time()) { if ($today_money + $withdraw_money > $fee[2][1]) { $message = "单日提现上限为{$fee[2][1]}元。您今日已经申请提现金额:{$today_money}元,当前申请金额为:{$withdraw_money}元,已超出单日上限,请您修改申请金额或改日再申请提现"; ajaxmsg($message, 2); } $itime = strtotime(date("Y-m", time()) . "-01 00:00:00") . "," . strtotime(date("Y-m-", time()) . date("t", time()) . " 23:59:59"); $wmapx['uid'] = $this->uid; $wmapx['withdraw_status'] = array("neq", 3); $wmapx['add_time'] = array("between", "{$itime}"); $times_month = M("member_withdraw")->where($wmapx)->count("id"); $tqfee1 = explode("|", $this->glo['fee_tqtx']); $fee1[0] = explode("-", $tqfee1[0]); $fee1[1] = explode("-", $tqfee1[1]); if ($withdraw_money - $vo['back_money'] > 0) { $maxfee1 = ($withdraw_money - $vo['back_money']) * $fee1[0][0] / 1000; if ($maxfee1 >= $fee1[0][1]) { $maxfee1 = $fee1[0][1]; } $maxfee2 = $vo['back_money'] * $fee1[1][0] / 1000; if ($maxfee2 >= $fee1[1][1]) { $maxfee2 = $fee1[1][1]; } $fee = $maxfee1 + $maxfee2; $fee = $fee > $fee1[0][2] ? $fee : $fee1[0][2]; $money = $withdraw_money - $vo['back_money']; $moneydata['withdraw_back_money'] = $vo['back_money']; } else { $fee = $vo['back_money'] * $fee1[1][0] / 1000; //$fee = $withdraw_money*$fee1[1][0]/1000; if ($fee >= $fee1[1][1]) { $fee = $fee1[1][1]; } $moneydata['withdraw_back_money'] = $withdraw_money; } if ($vo['all_money'] - $withdraw_money - $fee < 0) { //$withdraw_money = ($withdraw_money - $fee); $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { //memberMoneyLog($this->uid,4,-$withdraw_money,"提现,默认自动扣减手续费".$fee."元",'0','@网站管理员@',0); memberMoneyLog($this->uid, 4, -$withdraw_money, "申请提现", '0', '@网站管理员@', 0); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { //memberMoneyLog($this->uid,4,-$withdraw_money,"提现,默认自动扣减手续费".$fee."元",'0','@网站管理员@',-$fee); //memberMoneyLog($this->uid,4,-$withdraw_money,"提现,默认自动扣减手续费".$fee."元",'0','@网站管理员@'); memberMoneyLog($this->uid, 4, -$withdraw_money, "申请提现", '0', '@网站管理员@'); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } else { //普通会员暂未使用 if ($today_money + $withdraw_money > 300000) { $message = "您是普通会员,单日提现上限为30万元。您今日已经申请提现金额:{$today_money元},当前申请金额为:{$withdraw_money元},已超出单日上限,请您修改申请金额或改日再申请提现"; ajaxmsg($message, 2); } $tqfee = $this->glo['fee_pttx']; $fee = getFloatValue($tqfee * $withdraw_money / 100, 2); if ($vo['account_money'] - $withdraw_money - $fee < 0) { $withdraw_money = $withdraw_money - $fee; $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money - $fee, "提现,自动扣减手续费" . $fee . "元"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,自动扣减手续费" . $fee . "元", '0', '@网站管理员@', -$fee); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } }
function getNet($minfo, $capitalinfo) { return getFloatValue($minfo['account_money'] + $minfo['money_freeze'] + $minfo['money_collect'] - intval($capitalinfo['borrow'][6]['money'] - $capitalinfo['borrow'][6]['repayment_money']), 2); }
public function actwithdraw() { $pre = C('DB_PREFIX'); $withdraw_money = floatval($_POST['amount']); $pwd = md5($_POST['pwd']); $vo = M('members m')->field('mm.account_money,m.user_leve,m.time_limit')->join("{$pre}member_money mm on mm.uid = m.id")->where("m.id={$this->uid} AND m.pin_pass='******'")->find(); if (!is_array($vo)) { ajaxmsg("", 0); } if ($vo['account_money'] < $withdraw_money) { ajaxmsg("提现额大于帐户余额", 2); } $start = strtotime(date("Y-m-d", time()) . " 00:00:00"); $end = strtotime(date("Y-m-d", time()) . " 23:59:59"); $wmap['uid'] = $this->uid; $wmap['withdraw_status'] = array("neq", 3); $wmap['add_time'] = array("between", "{$start},{$end}"); $today_money = M('member_withdraw')->where($wmap)->sum('withdraw_money'); if ($vo['user_leve'] > 0 && $vo['time_limit'] > time()) { if ($today_money + $withdraw_money > 1000000) { $message = "您是特权会员,单日提现上限为100万元。您今日已经申请提现金额:{$today_money元},当前申请金额为:{$withdraw_money元},已超出单日上限,请您修改申请金额或改日再申请提现"; ajaxmsg($message, 2); } $tqfee = explode("|", $this->glo['fee_tqtx']); $fee = getFloatValue($tqfee[0] * $withdraw_money / 100, 2); $fee > $tqfee[1] ? $fee = $tqfee[1] : ''; if (1 == 2 && $vo['account_money'] - $withdraw_money - $fee < 0) { $withdraw_money = $withdraw_money - $fee; $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money - $fee, "提现"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } else { if ($today_money + $withdraw_money > 300000) { $message = "您是普通会员,单日提现上限为30万元。您今日已经申请提现金额:{$today_money元},当前申请金额为:{$withdraw_money元},已超出单日上限,请您修改申请金额或改日再申请提现"; ajaxmsg($message, 2); } $tqfee = $this->glo['fee_pttx']; $fee = getFloatValue($tqfee * $withdraw_money / 100, 2); if ($vo['account_money'] - $withdraw_money - $fee < 0) { $withdraw_money = $withdraw_money - $fee; $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money - $fee, "提现"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -($withdraw_money + $fee), "提现"); MTip('chk6', $this->uid); ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } }
public function investRecord() { if (!$this->uid) { $this->qingxian(); } $pre = C('DB_PREFIX'); $borrow_id = $_GET['borrow_id']; $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $borrowinfo = M("borrow_info bi")->field('bi.*,ac.title,ac.id as aid')->join('lzh_article ac on ac.id= bi.danbao')->where('bi.id=' . $borrow_id)->find(); if (!is_array($borrowinfo) || $borrowinfo['borrow_status'] == 0 && $this->uid != $borrowinfo['borrow_uid']) { $this->error("数据有误"); } $borrowinfo['biao'] = $borrowinfo['borrow_times']; $borrowinfo['need'] = $borrowinfo['borrow_money'] - $borrowinfo['has_borrow']; $borrowinfo['lefttime'] = $borrowinfo['collect_time'] - time(); $borrowinfo['progress'] = getFloatValue($borrowinfo['has_borrow'] / $borrowinfo['borrow_money'] * 100, 2); $this->assign("vo", $borrowinfo); $list = M("borrow_investor as b")->join(C(DB_PREFIX) . "members as m on b.investor_uid = m.id")->join(C(DB_PREFIX) . "borrow_info as i on b.borrow_id = i.id")->field('i.borrow_interest_rate, i.repayment_type, b.investor_capital, b.add_time, b.is_auto, m.user_name')->where('b.borrow_id=' . $borrow_id)->order('b.id')->select(); $this->assign("list", $list); // $this->assign("vo",$borrowinfo); $this->assign("borrow_id", $borrow_id); $this->display("investRecord"); }
function getTBorrowList($parm = array()) { /* hycd if(empty($parm['map'])) return; $map = $parm['map']; $orderby = $parm['orderby']; if($parm['pagesize']) { import( "ORG.Util.Page" ); $count = M("transfer_borrow_info b")->where($map)->count("b.id"); $p = new \Org\Util\Page($count, $parm['pagesize']); $page = $p->show(); $Lsql = "{$p->firstRow},{$p->listRows}"; }else{ $page = ""; $Lsql = "{$parm['limit']}"; } $pre = C("DB_PREFIX"); $suffix =C("URL_HTML_SUFFIX"); $field = "b.id,b.borrow_name,b.borrow_status,b.borrow_money,b.repayment_type,b.min_month,b.transfer_out,b.transfer_back,b.transfer_total,b.per_transfer,b.borrow_interest_rate,b.borrow_duration,b.increase_rate,b.reward_rate,b.deadline,b.is_show,m.province,m.city,m.area,m.user_name,m.id as uid,m.credits,m.customer_name,b.borrow_type,b.b_img,b.add_time,b.collect_day,b.danbao,b.online_time"; $list = M("transfer_borrow_info b")->field($field)->join("{$pre}members m ON m.id=b.borrow_uid")->where($map)->order($orderby)->limit($Lsql)->select(); print_r($list); $areaList = getarea(); foreach($list as $key => $v) { $list[$key]['location'] = $areaList[$v['province']].$areaList[$v['city']]; $list[$key]['progress'] = getfloatvalue( $v['transfer_out'] / $v['transfer_total'] * 100, 2); $list[$key]['need'] = getfloatvalue(($v['transfer_total'] - $v['transfer_out'])*$v['per_transfer'], 2 ); $list[$key]['burl'] = MU("Home/invest_transfer", "invest_transfer",array("id" => $v['id'],"suffix" => $suffix)); $temp=floor(("{$v['collect_day']}"*3600*24-time()+"{$v['add_time']}")/3600/24); $list[$key]['leftdays'] = "{$temp}".'天以上'; $list[$key]['now'] = time(); $list[$key]['borrow_times'] = count(M('transfer_borrow_investor') -> where("borrow_id = {$list[$key]['id']}") ->select()); $list[$key]['investornum'] = M('transfer_borrow_investor')->where("borrow_id={$v['id']}")->count("id"); if($v['danbao']!=0 ){ $list[$key]['danbaoid'] = intval($v['danbao']); $danbao = M('article')->field('id,title')->where("type_id=7 and id={$v['danbao']}")->find(); $list[$key]['danbao']=$danbao['title'];//担保机构 }else{ $list[$key]['danbao']='暂无担保机构';//担保机构 } //收益率 $monthData['month_times'] = 12; $monthData['account'] = $v['borrow_money']; $monthData['year_apr'] = $v['borrow_interest_rate']; $monthData['type'] = "all"; $repay_detail = CompoundMonth($monthData); if($v['borrow_duration']==1){ $list[$key]['shouyi'] = $v['borrow_interest_rate']; }else{ $list[$key]['shouyi'] = $repay_detail['shouyi']; } //收益率结束 } $row = array(); $row['list'] = $list; $row['page'] = $page; return $row;*/ if (empty($parm['map'])) { return; } $map = $parm['map']; $orderby = $parm['orderby']; if ($parm['pagesize']) { //分页处理 import("ORG.Util.Page"); $count = M('borrow_info b')->where($map)->count('b.id'); echo $count; $p = new \Org\Util\Page($count, $parm['pagesize']); $page = $p->show(); $Lsql = "{$p->firstRow},{$p->listRows}"; //分页处理 } else { $page = ""; $Lsql = "{$parm['limit']}"; } $pre = C('DB_PREFIX'); $suffix = C("URL_HTML_SUFFIX"); $field = "b.id,b.borrow_name,b.borrow_type,b.reward_type,b.borrow_times,b.borrow_status,b.borrow_money,b.borrow_use,b.repayment_type,b.borrow_interest_rate,b.borrow_duration,b.collect_time,b.add_time,b.province,b.has_borrow,b.has_vouch,b.city,b.area,b.reward_type,b.reward_num,b.password,m.user_name,m.id as uid,m.credits,m.customer_name,b.is_tuijian,b.deadline,b.danbao,b.borrow_info,b.risk_control,b.borrow_btype"; $list = M('borrow_info b')->field($field)->join("{$pre}members m ON m.id=b.borrow_uid")->where($map)->order($orderby)->limit($Lsql)->select(); $areaList = getArea(); foreach ($list as $key => $v) { $list[$key]['location'] = $areaList[$v['province']] . $areaList[$v['city']]; $list[$key]['biao'] = $v['borrow_times']; $list[$key]['need'] = $v['borrow_money'] - $v['has_borrow']; $list[$key]['leftdays'] = getLeftTime($v['collect_time']); $list[$key]['bollprogress'] = getFloatValue($v['has_borrow'] / $v['borrow_money'] * 86.90000000000001, 2); $list[$key]['progress'] = getFloatValue($v['has_borrow'] / $v['borrow_money'] * 100); $list[$key]['vouch_progress'] = getFloatValue($v['has_vouch'] / $v['borrow_money'] * 100, 2); $list[$key]['burl'] = MU("Home/invest", "invest", array("id" => $v['id'], "suffix" => $suffix)); //新加 $list[$key]['lefttime'] = $v['collect_time'] - time(); if ($v['deadline'] == 0) { $endTime = strtotime(date("Y-m-d", time())); if ($v['repayment_type'] == 1) { $list[$key]['repaytime'] = strtotime("+{$v['borrow_duration']} day", $endTime); } else { $list[$key]['repaytime'] = strtotime("+{$v['borrow_duration']} month", $endTime); } } else { $list[$key]['repaytime'] = $v['deadline']; //还款时间 } $list[$key]['publishtime'] = $v['add_time'] + 60 * 60 * 24 * 3; //预计发标时间=添加时间+1天 if ($v['danbao'] != 0) { $danbao = M('article')->field("id,title")->where("type_id =7 and id ={$v['danbao']}")->find(); $list[$key]['danbao'] = $danbao['title']; //担保机构 } else { $list[$key]['danbao'] = '暂无担保机构'; //担保机构 } } $row = array(); $row['list'] = $list; $row['page'] = $page; return $row; }
public function actwithdraw() { $jsoncode = file_get_contents("php://input"); // alogsm("actwithdraw",0,1,session("u_id").$jsoncode); $arr = array(); $arr = json_decode($jsoncode, true); if (!is_array($arr) || empty($arr) || empty($arr['amount']) || empty($arr['pwd'])) { //alogsm("actwithdraw_fail",0,1,"请求错误!");// ajaxmsg("请求错误!", 0); } if (intval($arr['uid']) != $this->uid) { //alogsm("actwithdraw_fail",0,1,"用户错误!");// ajaxmsg("用户错误!", 0); } $pre = C('DB_PREFIX'); $withdraw_money = floatval($arr['amount']); $pwd = md5($arr['pwd']); //alogsm("actwithdraw_pwd",0,1,$arr['pwd']."-".$arr['amount']);// $vo = M('members m')->field('mm.account_money,mm.back_money,(mm.account_money+mm.back_money) all_money,m.user_leve,m.time_limit')->join("{$pre}member_money mm on mm.uid = m.id")->where("m.id={$this->uid} AND m.pin_pass='******'")->find(); if (!is_array($vo)) { ajaxmsg("", 0); } //alogsm("actwithdraw_密码是否错误",0,1,is_array($vo));// if ($vo['all_money'] < $withdraw_money) { ajaxmsg("提现额大于帐户余额", 2); } $start = strtotime(date("Y-m-d", time()) . " 00:00:00"); $end = strtotime(date("Y-m-d", time()) . " 23:59:59"); $wmap['uid'] = $this->uid; $wmap['withdraw_status'] = array("neq", 3); $wmap['add_time'] = array("between", "{$start},{$end}"); $today_money = M('member_withdraw')->where($wmap)->sum('withdraw_money'); $today_time = M('member_withdraw')->where($wmap)->count('id'); $tqfee = explode("|", $this->glo['fee_tqtx']); $fee[0] = explode("-", $tqfee[0]); $fee[1] = explode("-", $tqfee[1]); $fee[2] = explode("-", $tqfee[2]); $one_limit = $fee[2][0] * 10000; if ($withdraw_money < 100 || $withdraw_money > $one_limit) { //alogsm("actwithdraw_fail",0,1,"单笔提现金额限制为100-{$one_limit}元");// ajaxmsg("单笔提现金额限制为100-{$one_limit}元", 2); } $today_limit = $fee[2][1] / $fee[2][0]; if ($today_time >= $today_limit) { $message = "一天最多只能提现{$today_limit}次"; //alogsm("actwithdraw_fail",0,1,$message);// ajaxmsg($message, 2); } if (1 == 1 || $vo['user_leve'] > 0 && $vo['time_limit'] > time()) { if ($today_money + $withdraw_money > $fee[2][1] * 10000) { $message = "单日提现上限为{$fee[2][1]}万元。您今日已经申请提现金额:{$today_money}元,当前申请金额为:{$withdraw_money}元,已超出单日上限,请您修改申请金额或改日再申请提现"; //alogsm("actwithdraw_fail",0,1,$message);// ajaxmsg($message, 2); } $itime = strtotime(date("Y-m", time()) . "-01 00:00:00") . "," . strtotime(date("Y-m-", time()) . date("t", time()) . " 23:59:59"); $wmapx['uid'] = $this->uid; $wmapx['withdraw_status'] = array("neq", 3); $wmapx['add_time'] = array("between", "{$itime}"); $times_month = M("member_withdraw")->where($wmapx)->count("id"); if ($withdraw_money - $vo['back_money'] >= 0) { $maxfee1 = ($withdraw_money - $vo['back_money']) * $fee[0][0] / 1000; if ($maxfee1 >= $fee[0][1]) { $maxfee1 = $fee[0][1]; } $maxfee2 = $vo['back_money'] * $fee[1][0] / 1000; if ($maxfee2 >= $fee[1][1]) { $maxfee2 = $fee[1][1]; } $fee = $maxfee1 + $maxfee2; $money = $withdraw_money - $vo['back_money']; } else { $fee = $vo['back_money'] * $fee[1][0] / 1000; if ($fee >= $fee[1][1]) { $fee = $fee[1][1]; } } if ($vo['all_money'] - $withdraw_money - $fee < 0) { //$withdraw_money = ($withdraw_money - $fee); $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@', 0); MTip('chk6', $this->uid); //alogsm("actwithdraw_success",0,1,"恭喜,提现申请提交成功");// ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['second_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { //memberMoneyLog($this->uid,4,-$withdraw_money,"提现,默认自动扣减手续费".$fee."元",'0','@网站管理员@',-$fee); memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,默认自动扣减手续费" . $fee . "元", '0', '@网站管理员@', 0); MTip('chk6', $this->uid); //alogsm("actwithdraw_success",0,1,"恭喜,提现申请提交成功");// ajaxmsg("恭喜,提现申请提交成功", 1); } } ajaxmsg("对不起,提现出错,请重试", 2); } else { //普通会员暂未使用 if ($today_money + $withdraw_money > 300000) { $message = "您是普通会员,单日提现上限为30万元。您今日已经申请提现金额:{$today_money元},当前申请金额为:{$withdraw_money元},已超出单日上限,请您修改申请金额或改日再申请提现"; //alogsm("actwithdraw_fail",0,1,$message);// ajaxmsg($message, 2); } $tqfee = $this->glo['fee_pttx']; $fee = getFloatValue($tqfee * $withdraw_money / 100, 2); if ($vo['account_money'] - $withdraw_money - $fee < 0) { $withdraw_money = $withdraw_money - $fee; $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money - $fee, "提现,自动扣减手续费" . $fee . "元"); MTip('chk6', $this->uid); //alogsm("actwithdraw_success",0,1,"恭喜,提现申请提交成功");// ajaxmsg("恭喜,提现申请提交成功", 1); } } else { $moneydata['withdraw_money'] = $withdraw_money; $moneydata['withdraw_fee'] = $fee; $moneydata['withdraw_status'] = 0; $moneydata['uid'] = $this->uid; $moneydata['add_time'] = time(); $moneydata['add_ip'] = get_client_ip(); $newid = M('member_withdraw')->add($moneydata); if ($newid) { memberMoneyLog($this->uid, 4, -$withdraw_money, "提现,自动扣减手续费" . $fee . "元", '0', '@网站管理员@', -$fee); MTip('chk6', $this->uid); //alogsm("actwithdraw_success",0,1,"恭喜,提现申请提交成功");// ajaxmsg("恭喜,提现申请提交成功", 1); } } //alogsm("actwithdraw_fail",0,1,"对不起,提现出错,请重试");// ajaxmsg("对不起,提现出错,请重试", 2); } }
function getMoneyFormt($money) { if ($money >= 100000 && $money <= 100000000) { $res = getFloatValue($money / 10000, 2) . "万"; } else { if ($money >= 100000000) { $res = getFloatValue($money / 100000000, 2) . "亿"; } else { $res = getFloatValue($money, 0); } } return $res; }