public function index() { $parm = array(); //$Map = ' b.borrow_status = 2 and b.is_show=1 and b.transfer_total > b.transfer_out'; $Map = 'b.is_show=1 '; $parm['map'] = $Map; $parm['orderby'] = "b.is_show desc,b.id DESC"; $parm['pagesize'] = 8; $listTBorrow = getTBorrowList($parm); if ($this->isAjax()) { $string = ''; foreach ($listTBorrow['list'] as $vb) { $string .= '<a href="' . getInvestUrl($vb['id']) . '"> <div class="biao_box"> <h4><div class="title_img" style="float:left;margin-top:4px">' . getIco($vb) . '</div> <div style="float:left;text-align:left">' . cnsubstr($vb['borrow_name'], 5) . '</div></h4><table> <tr> <td>融资金额:' . MFormt($vb['borrow_money']) . '元</td> <td>融资期限:' . $vb['borrow_duration']; $string .= $vb['repayment_type'] == 1 ? '天' : '个月'; $string .= '</tr><tr><td>年化利率:' . $vb['borrow_interest_rate'] . '%/'; $string .= $vb['repayment_type'] == 1 ? '天' : '年'; $string .= '</td><td><span class="progress"> <span class="precent" style="width":' . $vb['progress'] . '></span></span> </td></tr></table> </div> </a>'; } echo $string; } else { $this->assign("listTBorrow", $listTBorrow); $this->display(); } }
public function index() { //正在进行的贷款 $parm = array(); $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.borrow_type'] = array("neq", '9'); $parm['map'] = $searchMap; $parm['limit'] = 3; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listBorrow = getBorrowList($parm); $this->assign("listBorrow", $listBorrow); //企业直投列表开始 $parm = array(); $searchMap = array(); $searchMap['bi.borrow_status'] = array("in", '2,4,6,7'); $parm['map'] = $searchMap; $parm['limit'] = 3; $listTBorrow = getTBorrowList($parm); $this->assign("listTBorrow", $listTBorrow); // 债权转让 $pre = C('DB_PREFIX'); $condition = 'd.status in(2,4) AND b.borrow_status in(2,4,6,7)'; $field = 'd.transfer_price, d.status, d.money, d.total_period, d.period, d.valid, d.id as debt_id, i.id as invest_id,'; $field .= 'i.investor_uid, i.deadline, b.id, b.borrow_name, b.borrow_interest_rate,b.borrow_status,'; $field .= 'b.borrow_duration,m.credits, m.user_name'; $list = M("invest_detb d")->join("{$pre}borrow_investor i ON d.invest_id=i.id")->join("{$pre}borrow_info b ON i.borrow_id = b.id")->join("{$pre}members m ON i.investor_uid=m.id")->field($field)->where($condition)->limit('0,3')->order("d.status asc")->select(); //exit(M()->getlastsql()); $this->assign('list', $list); $this->display(); }
public function index() { $maprow = array(); $searchMap['borrow_status'] = array("in", '2,4,6,7'); $parm['map'] = $searchMap; $parm['pagesize'] = 5; $sort = "desc"; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $list = getBorrowList($parm); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); if ($this->isAjax()) { $string = ''; foreach ($list['list'] as $vb) { $string .= ' <div class="main_box"> <div class="title"> <div class="title_img">' . getIco($vb) . '</div> <a href="' . getInvestUrl($vb['id']) . '" >' . cnsubstr($vb['borrow_name'], 17) . '</a> </div> <div class="box_ner"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td align="left"> <div class="box_ner_nn"> <ul> <li>金额:<span class="col">' . MFormt($vb['borrow_money']) . '元</span></li> <li>期限:' . $vb['borrow_duration']; $string .= $vb['repayment_type'] == 1 ? '天' : '个月'; $string .= '</li> <li>利率:' . $vb['borrow_interest_rate'] . '%/'; $string .= $vb['repayment_type'] == 1 ? '天' : '年'; $string .= '</li> <li><span class="jd">进度:</span> <span class="progress"> <span class="precent" style="width:' . $vb['progress'] . '%;"></span></span></li> </ul> </div> </td> <td align="center">' . borrow_status($vb['id'], $vb['borrow_status']) . '</td> </tr> </table> </div> </div>'; } echo $string; } else { ///////////////企业直投列表开始 ///////////// $parm = array(); $Map = ' b.borrow_status = 2 and b.is_show=1 and b.transfer_total > b.transfer_out'; $parm['map'] = $Map; $parm['orderby'] = "b.is_show desc,b.id DESC"; $listTBorrow = getTBorrowList($parm); $this->assign("listTBorrow", $listTBorrow); ///////////////企业直投列表结束 ///////////// $this->assign('list', $list); $this->assign('Bconfig', $Bconfig); $this->display(); } }
public function index() { $per = C('DB_PREFIX'); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //网站公告 $parm['type_id'] = 26; $parm['limit'] = 4; $this->assign("noticeList", getArticleList($parm)); //网站公告 $a = loan_total_info(); //var_dump($a); $d['a1'] = M('members m')->where($map)->count('m.id'); //假的 $d['a2'] = $a['ordinary_total']; $d['a3'] = $a['num_total']; $d['a4'] = $a['has_also']; $d['a5'] = $a['arrears']; //var_dump($d); $this->assign("a1", $d); //正在进行的贷款 $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); //$searchMap['b.is_tuijian']=array("in",'0,1'); //$searchMap['b.borrow_btype']=1; $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 6; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listBorrow = getBorrowList($parm); //var_dump($listBorrow); $this->assign("listBorrow", $listBorrow); $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['_string'] = "b.is_tuijian = 1"; $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 2; $parm['_string'] = "b.is_tuijian = 1"; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listBorrow1 = getBorrowList($parm); $this->assign("listBorrow1", $listBorrow1); //测试时间获取函数开始 //$date = date("Y-m-d",time()); //$ret = get_date($date,'m'); //dump($ret);exit; //测试时间获取函数结束 //////////////////////调取数据//////////// $money_log = get_money_log(0); $borrowOutNum = M("borrow_info")->where("borrow_status in(6,7,8,9)")->count("id"); $transferBorrowOutNum = M("transfer_borrow_info")->count("id"); $mborrowOutNum = $borrowOutNum + $transferBorrowOutNum; $shouyi = M('borrow_info')->sum('borrow_interest'); $this->assign("shouyi", $shouyi); $this->assign("mcount", M("members")->count("id")); $this->assign("mborrowOut", $money_log['17']['money']); $this->assign("mborrowOutNum", $mborrowOutNum); //////////////////////调取数据//////////// //正在进行的贷款 ///////////////省心宝列表开始 fan 2013-10-21////////////// $parm = array(); $searchMap = array(); //$searchMap['borrow_status']=2; //$searchMap['b.on_off']=1; //$searchMap['b.is_jijin']=0; //$searchMap['b.is_show'] = array('in','0,1'); $searchMap['b.borrow_status'] = array('neq', '3'); //$searchMap['b.online_time']=array("lt",time()); $parm['map'] = $searchMap; $parm['limit'] = 3; //$parm['orderby'] = "b.is_show desc,b.progress asc"; $listTBorrow = getTBorrowList($parm); $this->assign("listTBorrow", $listTBorrow); ///////////////省心宝列表结束 fan 2013-10-21////////////// ///////////////省心宝列表开始 fan 2014-06-13////////////// /* hycd $parm = array(); $searchMap = array(); //$searchMap['borrow_status']=2; //$searchMap['is_tuijian']=0; $searchMap['on_off']=1; $searchMap['is_jijin']=1; $searchMap['b.online_time']=array("lt",time()+300); $parm['map'] = $searchMap; $parm['limit'] = 2; $parm['orderby'] = "b.is_show desc,b.borrow_status ASC,b.borrow_duration ASC,b.online_time desc"; $listFBorrow = getTBorrowList($parm); $this->assign("listFBorrow",$listFBorrow); $this->assign('Bconfig',$Bconfig);*/ $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.is_tuijian'] = array("in", '0,1'); //$searchMap['b.borrow_btype']=2; $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 2; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listFBorrow = getTBorrowList($parm); //var_dump($listBorrow); $this->assign("listFBorrow", $listFBorrow); ///////////////省心宝列表结束 fan 2014-06-13/////////////// $this->display(); /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ //流标返回 $mapT = array(); $mapT['collect_time'] = array("lt", time()); $mapT['borrow_status'] = 2; $tlist = M("borrow_info")->field("id,borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time")->where($mapT)->select(); if (empty($tlist)) { exit; } foreach ($tlist as $key => $vbx) { $borrow_id = $vbx['id']; //流标 $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_type,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital')->where("borrow_id={$borrow_id}")->select(); M('investor_detail')->where("borrow_id={$borrow_id}")->delete(); if ($binfo['borrow_type'] == 1) { $limit_credit = memberLimitLog($binfo['borrow_uid'], 12, $binfo['borrow_money'], $info = "{$binfo['id']}号标流标"); } //返回额度 $borrowInvestor->startTrans(); $bstatus = 3; $upborrow_info = M('borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); //处理借款概要 $buname = M('members')->getFieldById($binfo['borrow_uid'], 'user_name'); //处理借款概要 if (is_array($investorList)) { $upsummary_res = M('borrow_investor')->where("borrow_id={$borrow_id}")->setField("status", $type); foreach ($investorList as $v) { MTip('chk15', $v['investor_uid']); //sss $accountMoney_investor = M("member_money")->field(true)->find($v['investor_uid']); $datamoney_x['uid'] = $v['investor_uid']; $datamoney_x['type'] = $type == 3 ? 16 : 8; $datamoney_x['affect_money'] = $v['investor_capital']; $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $datamoney_x['affect_money']; //投标不成功返回充值资金池 $datamoney_x['collect_money'] = $accountMoney_investor['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze'] - $datamoney_x['affect_money']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; //会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; $mmoney_x['back_money'] = $datamoney_x['back_money']; //会员帐户 $_xstr = $type == 3 ? "复审未通过" : "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回冻结资金"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname; $moneynewid_x = M('member_moneylog')->add($datamoney_x); if ($moneynewid_x) { $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x); } } } else { $moneynewid_x = true; $bxid = true; $upsummary_res = true; } if ($moneynewid_x && $upsummary_res && $bxid && $upborrow_info) { $done = true; $borrowInvestor->commit(); } else { $borrowInvestor->rollback(); } if (!$done) { continue; } MTip('chk11', $vbx['borrow_uid'], $borrow_id); $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = 0; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($vbx['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vbx['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id'])); //@SMStip("refuse",$vss['user_phone'],array("#USERANEM#","ID"),array($vss['user_name'],$verify_info['borrow_id'])); //updateBinfo $newBinfo = array(); $newBinfo['id'] = $borrow_id; $newBinfo['borrow_status'] = 3; $newBinfo['second_verify_time'] = time(); $x = M("borrow_info")->save($newBinfo); } /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ }
public function index() { $jsoncode = file_get_contents("php://input"); $arr = array(); $arr = json_decode($jsoncode, true); // $arr['id'] = 0; // $arr['type'] = 0; // $arr['num'] = 3; // $arr['tid'] = 11; // $arr['ttype'] = 1; // $arr['tnum'] = 3; //普通标翻页 if (is_array($arr) && isset($arr['id']) && isset($arr['type']) && isset($arr['num'])) { $type = $arr['type']; $id = intval($arr['id']); $num = intval($arr['num']); } else { $type = 2; $num = 5; } //流转标翻页 if (is_array($arr) && isset($arr['tid']) && isset($arr['ttype']) && isset($arr['tnum'])) { $ttype = $arr['ttype']; $tid = intval($arr['tid']); $tnum = intval($arr['tnum']); } else { $ttype = 2; $tnum = 5; } //alogsm("Main",0,1,$jsoncode); $per = C('DB_PREFIX'); //普通标 if ($type == 1) { $searchMap['borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.id'] = array("gt", $id); $parm['map'] = $searchMap; $parm['limit'] = $num; $parm['orderby'] = "b.borrow_status ASC,b.id asc"; } elseif ($type == 0) { $searchMap['borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.id'] = array("lt", $id); $parm['map'] = $searchMap; $parm['limit'] = $num; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; } else { $searchMap['borrow_status'] = array("in", '2,4,6,7'); $parm['map'] = $searchMap; $parm['limit'] = $num; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; } $list = getBorrowList($parm); //$_list = $list; foreach ($list['list'] as $key => $v) { $_list[$key]['uid'] = intval($v['uid']); $_list[$key]['type'] = getleixing($v); $_list[$key]['id'] = intval($v['id']); $_list[$key]['borrow_name'] = $v['borrow_name']; $_list[$key]['borrow_interest_rate'] = $v['borrow_interest_rate']; if ($v['repayment_type'] == 1) { $_list[$key]['borrow_duration'] = $v['borrow_duration'] . "天"; } else { $_list[$key]['borrow_duration'] = $v['borrow_duration'] . "个月"; } $_list[$key]['repayment_type'] = $v['repayment_type']; $_list[$key]['borrow_money'] = $v['borrow_money']; $_list[$key]['progress'] = $v['progress']; $_list[$key]['credits'] = $v['credits']; $_list[$key]['user_name'] = $v['user_name']; $_list[$key]['imgpath'] = get_avatar(intval($v['uid'])); $_list[$key]['suo'] = empty($v['password']) ? 0 : 1; //是否定向标 if ($v['reward_type'] == 1) { $_list[$key]['reward'] = $v['reward_num'] . "%"; } elseif ($v['reward_type'] == 2) { $_list[$key]['reward'] = $v['reward_num'] . "元"; } else { $_list[$key]['reward'] = "0"; } } $m_list['list'] = $_list; //企业直投 $parmt = array(); $searchMapt = array(); //$searchMap['borrow_status']=2; if ($ttype == 1) { $searchMapt['is_show'] = array('in', '0,1'); $searchMapt['b.id'] = array("gt", $tid); $parmt['map'] = $searchMapt; $parmt['limit'] = $tnum; $parmt['orderby'] = "b.is_show desc,b.id asc"; } elseif ($ttype == 0) { $searchMapt['is_show'] = array('in', '0,1'); $searchMapt['b.id'] = array("lt", $tid); $parmt['map'] = $searchMapt; $parmt['limit'] = $tnum; $parmt['orderby'] = "b.is_show desc,b.id DESC"; } else { $searchMapt['is_show'] = array('in', '0,1'); $parmt['map'] = $searchMapt; $parmt['limit'] = $tnum; $parmt['orderby'] = "b.is_show desc,b.id DESC"; } $tlist = getTBorrowList($parmt); foreach ($tlist['list'] as $key => $v) { $_tlist[$key]['uid'] = intval($v['uid']); $_tlist[$key]['type'] = 2; $_tlist[$key]['id'] = intval($v['id']); $_tlist[$key]['borrow_name'] = $v['borrow_name']; $_tlist[$key]['borrow_interest_rate'] = $v['borrow_interest_rate']; $_tlist[$key]['borrow_duration'] = $v['borrow_duration'] . "个月"; $_tlist[$key]['per_transfer'] = $v['per_transfer']; $_tlist[$key]['borrow_money'] = $v['borrow_money']; $_tlist[$key]['progress'] = $v['progress']; $_tlist[$key]['credits'] = $v['credits']; $_tlist[$key]['user_name'] = $v['user_name']; $_tlist[$key]['imgpath'] = get_avatar(intval($v['uid'])); $_tlist[$key]['reward'] = $v['reward_rate'] . "%"; } $m_list['tlist'] = $_tlist; echo ajaxmsg($m_list); }
public function index() { //访问首页跳转到https // if($_SERVER['SERVER_PORT'] != '443'){ // header('HTTP/1.1 301 Moved Permanently'); // //$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; // //header('Location: https://www.cailai.com' . $_SERVER['PHP_SELF'] . $request_uri); // header('Location: https://www.cailai.com/'); // } $per = C('DB_PREFIX'); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //网站公告 $parm['type_id'] = 9; $parm['limit'] = 7; $this->assign("noticeList", getArticleList($parm)); //网站公告 //统计 2015 07 22 $statictis = M('home_tongji')->find(); $this->statictis = $statictis; //投资达人列表 $daren = M("amount_top")->select(); $this->daren = $daren; //新手标 $newbie = M("newbie_bid")->where('logic_del!=9')->find(); $this->gary = $newbie; // //转让专区 $map = array(); $map['d.status'] = array("in", "2,4"); $parm = array(); $parm['map'] = $map; D("DebtBehavior"); $Debt = new DebtBehavior(); $lists = $Debt->listAll($parm, 2, false); //print_r($lists); //dump($lists); //die; $this->assign("lists", $lists); ///////////////债权转让结束 gwf 2014-10-21////////////// //新手标开始----201509-08 // $newmatch = array(); // $newmatch['b.logic_del']=array("neq",'9');//逻辑删除 9为 默认删除掉 // //$newmatch['b.is_tuijian']=array("in",'0,1'); // $parm=array(); // $parm['map'] = $newmatch; // $parm['limit'] = 1; // $parm['orderby']="b.id DESC"; // $listBorrowNew = getNewBie($parm); // // dump($listBorrowNew); // $gary=$listBorrowNew['list']['0']; // dump($gary); // array(2) { ["list"]=> array(3) { [0]=> array(5) { ["id"]=> string(1) "3" ["bidname"]=> string(1) "4" ["borrow_uid"]=> string(1) "5" ["bidtime"]=> string(1) "7" ["rate"]=> string(2) "12" } [1]=> array(5) { ["id"]=> string(1) "2" ["bidname"]=> string(1) "3" ["borrow_uid"]=> string(1) "4" ["bidtime"]=> string(1) "7" ["rate"]=> string(2) "12" } [2]=> array(5) { ["id"]=> string(1) "1" ["bidname"]=> string(1) "2" ["borrow_uid"]=> string(1) "3" ["bidtime"]=> string(1) "7" ["rate"]=> string(2) "12" } } ["page"]=> string(0) "" } //只需在前端遍历数组 //新手标结束----201509-08 lj //正在进行的贷款 $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.is_tuijian'] = array("in", '0,1'); $searchMap['b.borrow_type'] = array("neq", 9); $searchMap['b.is_new'] = array("eq", 0); $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 10; //$parm['orderby']="b.borrow_status ASC,b.id DESC"; $listBorrow = getBorrowList($parm); //dump($listBorrow);die; $this->assign("listBorrow", $listBorrow); ///////////////企业直投推荐开始 gwf 2014-10-21////////////// $parm = array(); $searchMap = array(); $parm['limit'] = 1; $parm['map'] = $searchMap; $parm['orderby'] = "bi.is_tuijian desc,bi.id desc"; $listTBorrowa = getTBorrowList($parm); $this->assign("listTBorrowa", $listTBorrowa); ///////////////企业直投推荐开始 gwf 2014-10-21////////////// ///////////////企业直投列表开始 gwf 2014-10-21////////////// $parm = array(); $searchMap = array(); $searchMap['bi.borrow_status'] = array('neq', '3'); $searchMap['bi.borrow_type'] = array("eq", "9"); $parm['map'] = $searchMap; $parm['limit'] = 4; $parm['orderby'] = "bi.id DESC,bi.borrow_status ASC"; $listTBorrow = getTBorrowList($parm); //dump($listTBorrow);die; $this->assign("listTBorrow", $listTBorrow); ///////////////企业直投列表结束 gwf 2014-10-21////////////// $this->display(); /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ //流标返回 $mapT = array(); $mapT['collect_time'] = array("lt", time()); $mapT['borrow_status'] = 2; $tlist = M("borrow_info")->field("id,borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time")->where($mapT)->select(); if (empty($tlist)) { exit; } foreach ($tlist as $key => $vbx) { $borrow_id = $vbx['id']; //流标 $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_type,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital')->where("borrow_id={$borrow_id}")->select(); M('investor_detail')->where("borrow_id={$borrow_id}")->delete(); if ($binfo['borrow_type'] == 1) { $limit_credit = memberLimitLog($binfo['borrow_uid'], 12, $binfo['borrow_money'], $info = "{$binfo['id']}号标流标"); } //返回额度 $borrowInvestor->startTrans(); $bstatus = 3; $upborrow_info = M('borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); //处理借款概要 $buname = M('members')->getFieldById($binfo['borrow_uid'], 'user_name'); //处理借款概要 if (is_array($investorList)) { $upsummary_res = M('borrow_investor')->where("borrow_id={$borrow_id}")->setField("status", $type); foreach ($investorList as $v) { MTip('chk15', $v['investor_uid']); //sss $accountMoney_investor = M("member_money")->field(true)->find($v['investor_uid']); $datamoney_x['uid'] = $v['investor_uid']; $datamoney_x['type'] = $type == 3 ? 16 : 8; $datamoney_x['affect_money'] = $v['investor_capital']; $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $datamoney_x['affect_money']; //投标不成功返回充值资金池 $datamoney_x['collect_money'] = $accountMoney_investor['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze'] - $datamoney_x['affect_money']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; //会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; $mmoney_x['back_money'] = $datamoney_x['back_money']; //会员帐户 $_xstr = $type == 3 ? "复审未通过" : "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回冻结资金"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname; $moneynewid_x = M('member_moneylog')->add($datamoney_x); if ($moneynewid_x) { $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x); } } } else { $moneynewid_x = true; $bxid = true; $upsummary_res = true; } if ($moneynewid_x && $upsummary_res && $bxid && $upborrow_info) { $done = true; $borrowInvestor->commit(); } else { $borrowInvestor->rollback(); } if (!$done) { continue; } MTip('chk11', $vbx['borrow_uid'], $borrow_id); $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = 0; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($vbx['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vbx['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id'])); //@SMStip("refuse",$vss['user_phone'],array("#USERANEM#","ID"),array($vss['user_name'],$verify_info['borrow_id'])); //updateBinfo $newBinfo = array(); $newBinfo['id'] = $borrow_id; $newBinfo['borrow_status'] = 3; $newBinfo['second_verify_time'] = time(); $x = M("borrow_info")->save($newBinfo); } /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ }
public function index() { static $newpars; $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $per = C('DB_PREFIX'); $curl = $_SERVER['REQUEST_URI']; $urlarr = parse_url($curl); parse_str($urlarr['query'], $surl); //array获取当前链接参数,2. $urlArr = array('borrow_type', 'interest_rate', 'borrow_duration', 'leve'); $leveconfig = FS("Webconfig/leveconfig"); foreach ($urlArr as $v) { $newpars = $surl; //用新变量避免后面的连接受影响 unset($newpars[$v], $newpars['type'], $newpars['order_sort'], $newpars['orderby']); //去掉公共参数,对掉当前参数 foreach ($newpars as $skey => $sv) { if ($sv == "all") { unset($newpars[$skey]); } //去掉"全部"状态的参数,避免地址栏全满 } $newurl = http_build_query($newpars); //生成此值的链接,生成必须是即时生成 $searchUrl[$v]['url'] = $newurl; $searchUrl[$v]['cur'] = empty($_GET[$v]) ? "all" : text($_GET[$v]); } $searchMap['interest_rate'] = array("all" => "不限制", "0-10" => "10%以下", "10-15" => "10%-15%", "20-100" => "20%以上"); $searchMap['borrow_duration'] = array("all" => "不限制", "0-3" => "3个月以内", "4-6" => "3-6个月", "7-12" => "6-12个月", "13-24" => "12-24个月"); $searchMap['leve'] = array("all" => "不限制", "{$leveconfig['1']['start']}-{$leveconfig['1']['end']}" => "{$leveconfig['1']['name']}", "{$leveconfig['2']['start']}-{$leveconfig['2']['end']}" => "{$leveconfig['2']['name']}", "{$leveconfig['3']['start']}-{$leveconfig['3']['end']}" => "{$leveconfig['3']['name']}", "{$leveconfig['4']['start']}-{$leveconfig['4']['end']}" => "{$leveconfig['4']['name']}", "{$leveconfig['5']['start']}-{$leveconfig['5']['end']}" => "{$leveconfig['5']['name']}", "{$leveconfig['6']['start']}-{$leveconfig['6']['end']}" => "{$leveconfig['6']['name']}", "{$leveconfig['7']['start']}-{$leveconfig['7']['end']}" => "{$leveconfig['7']['name']}"); $search = array(); //搜索条件 foreach ($urlArr as $v) { if ($_GET[$v] && $_GET[$v] != 'all') { switch ($v) { case 'leve': $barr = explode("-", text($_GET[$v])); $search["m.credits"] = array("between", $barr); break; case 'borrow_type': $search["b.borrow_type"] = intval($_GET[$v]); break; case 'interest_rate': $barr = explode("-", text($_GET[$v])); $search["b.borrow_interest_rate"] = array("between", $barr); break; default: $barr = explode("-", text($_GET[$v])); $search["b." . $v] = array("between", $barr); break; } } } //searchMap $search['b.is_show'] = array("in", '0,1'); $search['b.borrow_status'] = array('neq', '3'); $str = "%" . urldecode($_REQUEST['searchkeywords']) . "%"; if ($_GET['is_keyword'] == '1') { $search['m.user_name'] = array("like", $str); } elseif ($_GET['is_keyword'] == '2') { $search['b.borrow_name'] = array("like", $str); } $parm['map'] = $search; $parm['pagesize'] = 9; $parm['orderby'] = "b.is_tuijian desc,b.is_show desc,b.progress asc"; $list = getTBorrowList($parm); $this->assign("Sorder", $Sorder); $this->assign("searchUrl", $searchUrl); $this->assign("searchMap", $searchMap); $this->assign("Bconfig", $Bconfig); $this->assign("list", $list); $this->display(); }
/** * 普通标列表 * */ public function index() { static $newpars; $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $per = C('DB_PREFIX'); $curl = $_SERVER['REQUEST_URI']; $urlarr = parse_url($curl); parse_str($urlarr['query'], $surl); //array获取当前链接参数,2. //$urlArr = array('borrow_status','borrow_duration','leve'); $urlArr = array('borrow_status', 'interest_rate', 'borrow_duration', 'scale', 'leve'); $leveconfig = FS("Webconfig/leveconfig"); foreach ($urlArr as $v) { $newpars = $surl; //用新变量避免后面的连接受影响 unset($newpars[$v], $newpars['type'], $newpars['order_sort'], $newpars['orderby']); //去掉公共参数,对掉当前参数 foreach ($newpars as $skey => $sv) { if ($sv == "all") { unset($newpars[$skey]); } //去掉"全部"状态的参数,避免地址栏全满 } $newurl = http_build_query($newpars); //生成此值的链接,生成必须是即时生成 $searchUrl[$v]['url'] = $newurl; $searchUrl[$v]['cur'] = empty($_GET[$v]) ? "all" : text($_GET[$v]); } $searchMap['deadline'] = strtotime("deadline"); $searchMap['borrow_status'] = array("all" => "不限制", "2" => "进行中", "4" => "复审中", "6" => "还款中", "7" => "已完成"); $searchMap['borrow_duration'] = array("all" => "不限制", "0-3" => "3个月以内", "3-6" => "3-6个月", "6-12" => "6-12个月", "12-24" => "12-24个月"); $searchMap['scale'] = array("all" => "不限制", "0-1000000" => "0-100万", "1000000-3000000" => "100-300万", "3000000-5000000" => "300-500万", "5000000-10000000" => "500万以上"); $searchMap['leve'] = array("all" => "不限制", "{$leveconfig['1']['start']}-{$leveconfig['1']['end']}" => "{$leveconfig['1']['name']}", "{$leveconfig['2']['start']}-{$leveconfig['2']['end']}" => "{$leveconfig['2']['name']}", "{$leveconfig['3']['start']}-{$leveconfig['3']['end']}" => "{$leveconfig['3']['name']}", "{$leveconfig['4']['start']}-{$leveconfig['4']['end']}" => "{$leveconfig['4']['name']}", "{$leveconfig['5']['start']}-{$leveconfig['5']['end']}" => "{$leveconfig['5']['name']}", "{$leveconfig['6']['start']}-{$leveconfig['6']['end']}" => "{$leveconfig['6']['name']}", "{$leveconfig['7']['start']}-{$leveconfig['7']['end']}" => "{$leveconfig['7']['name']}"); $search = array(); //搜索条件 foreach ($urlArr as $v) { if ($_GET[$v] && $_GET[$v] != 'all') { switch ($v) { case 'scale': $barr = explode("-", text($_GET[$v])); $search["bi.borrow_money"] = array("between", $barr); break; case 'borrow_status': $search["bi." . $v] = intval($_GET[$v]); break; case 'interest_rate': $barr = explode("-", text($_GET[$v])); $search["b.borrow_interest_rate"] = array("between", $barr); break; default: $barr = explode("-", text($_GET[$v])); $search["bi." . $v] = array("between", $barr); break; } } } if ($search['bi.borrow_status'] == 0) { $search['bi.borrow_status'] = array("in", "2,4,6,7"); } $str = "%" . urldecode($_REQUEST['searchkeywords']) . "%"; if ($_GET['is_keyword'] == '1') { $search['m.user_name'] = array("like", $str); } elseif ($_GET['is_keyword'] == '2') { $search['b.borrow_name'] = array("like", $str); } $parm['map'] = $search; $parm['pagesize'] = 10; //排序 strtolower($_GET['sort']) == "asc" ? $sort = "desc" : ($sort = "asc"); unset($surl['orderby'], $surl['sort']); $orderUrl = http_build_query($surl); if ($_GET['orderby']) { //if(strtolower($_GET['orderby'])=="leve") $parm['orderby'] = "m.credits ".text($_GET['sort']); if (strtolower($_GET['orderby']) == "rate") { $parm['orderby'] = "b.borrow_interest_rate " . text($_GET['sort']); } elseif (strtolower($_GET['orderby']) == "borrow_money") { $parm['orderby'] = "b.borrow_money " . text($_GET['sort']); } else { $parm['orderby'] = "b.id DESC"; } } else { $parm['orderby'] = "bi.borrow_status asc,bi.id desc"; } $Sorder['Corderby'] = strtolower(text($_GET['orderby'])); $Sorder['Csort'] = strtolower(text($_GET['sort'])); $Sorder['url'] = $orderUrl; $Sorder['sort'] = $sort; $Sorder['orderby'] = text($_GET['orderby']); $list = getTBorrowList($parm); //dump(M()->getlastsql());die; $this->assign("Sorder", $Sorder); $this->assign("searchUrl", $searchUrl); $this->assign("searchMap", $searchMap); $this->assign("Bconfig", $Bconfig); $this->assign("list", $list); $this->display(); }
public function index() { $per = C('DB_PREFIX'); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //网站公告 $parm['type_id'] = 9; $parm['limit'] = 7; $this->assign("noticeList", getArticleList($parm)); //网站公告 /* //正在进行的贷款 $searchMap = array(); $searchMap['borrow_status']=array("in",'2,4,6,7'); $searchMap['is_tuijian']=array("in",'0,1'); $searchMap['deadline']=strtotime("deadline"); $parm=array(); $parm['map'] = $searchMap; $parm['limit'] = 1; $parm['orderby']="b.id DESC,b.borrow_status ASC"; $listBorrow = getBorrowList($parm); $this->assign("listBorrow",$listBorrow); //散标开始 $Bconfig = require C("APP_ROOT")."Conf/borrow_config.php"; $per = C('DB_PREFIX'); //预发标的借款 $parm=array(); $searchMap = array(); $searchMap['borrow_status']=array("in",'9'); $searchMap['b.borrow_status']=0; $parm['map'] = $searchMap; $parm['limit'] = 5; $parm['orderby']="b.id DESC"; $list = getBorrowList($parm); //dump($list);die; $this->assign("list",$list); ///////////////债权转让开始 gwf 2014-10-21////////////// $map = array(); $map['d.status']=array("in","2,4"); $parm = array(); $parm['map'] = $map; D("DebtBehavior"); $Debt = new DebtBehavior(); $lists = $Debt->listAll($parm ,3, true); $this->assign("lists", $lists); ///////////////债权转让结束 gwf 2014-10-21////////////// ///////////////企业直投推荐开始 gwf 2014-10-21////////////// $parm = array(); $searchMap = array(); $parm['limit'] =1; $parm['map'] = $searchMap; $parm['orderby'] = "bi.is_tuijian desc,bi.id desc"; $listTBorrowa = getTBorrowList($parm); $this->assign("listTBorrowa",$listTBorrowa); ///////////////企业直投推荐开始 gwf 2014-10-21////////////// */ //的借款 //还款中的借款总额 @董强 $map = array(); $map['borrow_status'] = array("in", "6,7"); $Repayment = M("borrow_info")->field("SUM(borrow_money) as money")->where($map)->select(); $this->assign("Repayment_money", $Repayment[0]['money']); //还款中的借款总额 END //正常还款完成利息总额 @董强 $where = array(); $where['status'] = array("in", "5,6,7"); $Repayment_lx = M("borrow_investor")->field("SUM(investor_interest) as investor_interest")->where($where)->select(); $this->assign("investor_interest", $Repayment_lx[0]['investor_interest']); //正常还款完成利息总额 END// $parm = array(); $searchMap = array(); $searchMap['b.borrow_status'] = array('neq', '3'); $searchMap['b.borrow_type'] = array("neq", "9"); $parm['map'] = $searchMap; $parm['limit'] = 3; $parm['orderby'] = "b.id DESC"; $list = getBorrowList($parm); //dump($list);die; $this->assign("list", $list); ///////////////企业直投列表开始 gwf 2014-10-21////////////// $parm = array(); $searchMap = array(); $searchMap['bi.borrow_status'] = array('neq', '3'); $searchMap['bi.borrow_type'] = array("eq", "9"); $parm['map'] = $searchMap; $parm['limit'] = 3; $parm['orderby'] = "bi.borrow_status ASC"; $listTBorrow = getTBorrowList($parm); $this->assign("listTBorrow", $listTBorrow); ///////////////企业直投列表结束 gwf 2014-10-21////////////// $this->display(); /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ //流标返回 $mapT = array(); $mapT['collect_time'] = array("lt", time()); $mapT['borrow_status'] = 2; $tlist = M("borrow_info")->field("id,borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time")->where($mapT)->select(); if (empty($tlist)) { exit; } foreach ($tlist as $key => $vbx) { $borrow_id = $vbx['id']; //流标 $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_type,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital')->where("borrow_id={$borrow_id}")->select(); M('investor_detail')->where("borrow_id={$borrow_id}")->delete(); if ($binfo['borrow_type'] == 1) { $limit_credit = memberLimitLog($binfo['borrow_uid'], 12, $binfo['borrow_money'], $info = "{$binfo['id']}号标流标"); } //返回额度 $borrowInvestor->startTrans(); $bstatus = 3; $upborrow_info = M('borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); //处理借款概要 $buname = M('members')->getFieldById($binfo['borrow_uid'], 'user_name'); //处理借款概要 if (is_array($investorList)) { $upsummary_res = M('borrow_investor')->where("borrow_id={$borrow_id}")->setField("status", $type); foreach ($investorList as $v) { MTip('chk15', $v['investor_uid']); //sss $accountMoney_investor = M("member_money")->field(true)->find($v['investor_uid']); $datamoney_x['uid'] = $v['investor_uid']; $datamoney_x['type'] = $type == 3 ? 16 : 8; $datamoney_x['affect_money'] = $v['investor_capital']; $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $datamoney_x['affect_money']; //投标不成功返回充值资金池 $datamoney_x['collect_money'] = $accountMoney_investor['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze'] - $datamoney_x['affect_money']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; //会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; $mmoney_x['back_money'] = $datamoney_x['back_money']; //会员帐户 $_xstr = $type == 3 ? "复审未通过" : "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回冻结资金"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname; $moneynewid_x = M('member_moneylog')->add($datamoney_x); if ($moneynewid_x) { $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x); } } } else { $moneynewid_x = true; $bxid = true; $upsummary_res = true; } if ($moneynewid_x && $upsummary_res && $bxid && $upborrow_info) { $done = true; $borrowInvestor->commit(); } else { $borrowInvestor->rollback(); } if (!$done) { continue; } MTip('chk11', $vbx['borrow_uid'], $borrow_id); $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = 0; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($vbx['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vbx['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id'])); //@SMStip("refuse",$vss['user_phone'],array("#USERANEM#","ID"),array($vss['user_name'],$verify_info['borrow_id'])); //updateBinfo $newBinfo = array(); $newBinfo['id'] = $borrow_id; $newBinfo['borrow_status'] = 3; $newBinfo['second_verify_time'] = time(); $x = M("borrow_info")->save($newBinfo); } /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ }
public function index() { session('invitation_code', $_GET['i']); $per = C('DB_PREFIX'); $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); //网站公告 $parm['type_id'] = 43; $parm['limit'] = 7; $this->assign("noticeList", getArticleList($parm)); unset($parm); //网站公告 //新闻 $parm['type_id'] = 2; $parm['limit'] = 6; $this->assign("newsList", getArticleList($parm)); unset($parm); //新闻 ///////////////散标列表开始////////////// $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.is_tuijian'] = array("in", '0,1'); $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 5; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; $listBorrow = getBorrowList($parm); $this->assign("listBorrow", $listBorrow); ///////////////散标列表结束////////////// ///////////////累计会员人数//////////// $members = M('members')->count(); $this->assign("members", $members); //会员总数 ///////////////累计会员人数//////////// ///////////////累计配资人数//////////// //$member_num = M("members")->count(); //$this->assign("member_num",$member_num); ///////////////累计配资人数//////////// $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php"); $this->assign("Bconfig", $Bconfig); //////天天盈////////////// $searchMap = array(); $searchMap['b.borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.stock_type'] = array("in", '1,2,3,4'); //$searchMap['b.is_tuijian']=array("in",'0,1'); $parm = array(); $parm['map'] = $searchMap; $parm['limit'] = 5; $parm['orderby'] = "b.borrow_status asc ,b.first_verify_time desc"; $dayslists = getBorrowList($parm); $this->assign("dayslists", $dayslists); $progress = ''; if ($dayslists['list']) { foreach ($dayslists['list'] as $val) { $progress[] = (int) $val['progress']; } } $this->assign('progress', $progress ? json_encode($progress) : ''); /** //月月盈 $searchMap1 = array(); $searchMap1['b.borrow_status']=array("in",'2,4,6,7'); $searchMap1['b.stock_type']=array("eq",'2'); //$searchMap['b.is_tuijian']=array("in",'0,1'); $parm1=array(); $parm1['map'] = $searchMap1; $parm1['limit'] =2; $parm1['orderby']="b.borrow_status asc ,b.first_verify_time desc"; $monthlists = getBorrowList($parm1); $this->assign("monthlists",$monthlists); **/ ///////////////累计配资金额//////////// $borrow_sum = M("borrow_info")->where(array('borrow_status' => array("in", '6,7,9,10')))->sum("borrow_money"); ///////////////为客户赚取收益//////////// $investor_profit = M("borrow_info")->where(array('borrow_status' => array("in", '6,7,9,10')))->sum("borrow_interest"); $this->assign("investor_profit", $investor_profit); ///////////////为客户赚取收益//////////// $this->assign("borrow_sum", $borrow_sum); ///////////////累计配资金额//////////// ///////////////配资盈利列表//////////// //$shares_list = M("shares_record r")->join("lzh_shares_apply a ON a.id = r.shares_id")->where("r.profit_loss > 0")->field("r.profit_loss,a.principal,a.shares_money,a.u_name")->order("r.add_time DESC")->limit(7)->select(); //$this->assign("shares_list",getRetRate($shares_list)); ///////////////配资盈利列表//////////// ///媒体报道 $mediaslist = M("media")->where(" is_show = 1 ")->order(" link_order desc ")->limit(14)->select(); $this->assign("mediaslist", $mediaslist); ///////////////配资列表//////////// //$shares_apply = M("shares_apply")->where("status in(2,3,6)")->field("u_name,shares_money,examine_time")->order("examine_time DESC")->limit(20)->select(); //echo M()->getLastSql();exit; //$this->assign("shares_apply",$shares_apply); ///////////////配资列表//////////// ///////////////企业直投列表开始 fan 2013-10-21////////////// $parm = array(); $searchMap = array(); $searchMap['b.is_show'] = array('in', '0,1'); $searchMap['b.borrow_status'] = array('neq', '3'); $parm['map'] = $searchMap; $parm['limit'] = 3; $parm['orderby'] = "b.is_tuijian desc,b.is_show desc,b.progress asc"; $listTBorrow = getTBorrowList($parm); $this->assign("listTBorrow", $listTBorrow); ///////////////企业直投列表结束 fan 2013-10-21////////////// if (ListMobile()) { if ($this->uid && M('members')->where('id=' . $this->uid . ' and ent=1')->count()) { $redbag = M('redbag')->order('id desc')->where('status=1')->find(); //判断活动是否存在 $rid = $redbag['id']; if ($rid) { $usered = M('redbag_list')->where('uid=' . $this->uid . ' and pid=' . $rid)->count(); //判断是否领过红包 if (!$usered) { $redinfo = M('redbag_list')->order('id asc')->where('uid=0 and pid=' . $rid . ' and status=1')->find(); //判断是否还有剩余红包 if ($redinfo) { $this->assign('isredbag', true); } } } } } //if($_GET['debug']){ $this->display(); //}else{ // $this->display('indexv'); //} exit; /****************************募集期内标未满,自动流标 新增 2013-03-13*************************\***/ //流标返回 $mapT = array(); $mapT['collect_time'] = array("lt", time()); $mapT['borrow_status'] = 2; $tlist = M("borrow_info")->field("id,borrow_uid,borrow_type,borrow_money,first_verify_time,borrow_interest_rate,borrow_duration,repayment_type,collect_day,collect_time")->where($mapT)->select(); if (empty($tlist)) { exit; } foreach ($tlist as $key => $vbx) { $borrow_id = $vbx['id']; //流标 $done = false; $borrowInvestor = D('borrow_investor'); $binfo = M("borrow_info")->field("borrow_type,borrow_money,borrow_uid,borrow_duration,repayment_type")->find($borrow_id); $investorList = $borrowInvestor->field('id,investor_uid,investor_capital')->where("borrow_id={$borrow_id}")->select(); M('investor_detail')->where("borrow_id={$borrow_id}")->delete(); if ($binfo['borrow_type'] == 1) { $limit_credit = memberLimitLog($binfo['borrow_uid'], 12, $binfo['borrow_money'], $info = "{$binfo['id']}号标流标"); } //返回额度 $borrowInvestor->startTrans(); $bstatus = 3; $upborrow_info = M('borrow_info')->where("id={$borrow_id}")->setField("borrow_status", $bstatus); //处理借款概要 $buname = M('members')->getFieldById($binfo['borrow_uid'], 'user_name'); //处理借款概要 if (is_array($investorList)) { $upsummary_res = M('borrow_investor')->where("borrow_id={$borrow_id}")->setField("status", $type); foreach ($investorList as $v) { MTip('chk15', $v['investor_uid']); //sss $accountMoney_investor = M("member_money")->field(true)->find($v['investor_uid']); $datamoney_x['uid'] = $v['investor_uid']; $datamoney_x['type'] = $type == 3 ? 16 : 8; $datamoney_x['affect_money'] = $v['investor_capital']; $datamoney_x['account_money'] = $accountMoney_investor['account_money'] + $datamoney_x['affect_money']; //投标不成功返回充值资金池 $datamoney_x['collect_money'] = $accountMoney_investor['money_collect']; $datamoney_x['freeze_money'] = $accountMoney_investor['money_freeze'] - $datamoney_x['affect_money']; $datamoney_x['back_money'] = $accountMoney_investor['back_money']; //会员帐户 $mmoney_x['money_freeze'] = $datamoney_x['freeze_money']; $mmoney_x['money_collect'] = $datamoney_x['collect_money']; $mmoney_x['account_money'] = $datamoney_x['account_money']; $mmoney_x['back_money'] = $datamoney_x['back_money']; //会员帐户 $_xstr = $type == 3 ? "复审未通过" : "募集期内标未满,流标"; $datamoney_x['info'] = "第{$borrow_id}号标" . $_xstr . ",返回冻结资金"; $datamoney_x['add_time'] = time(); $datamoney_x['add_ip'] = get_client_ip(); $datamoney_x['target_uid'] = $binfo['borrow_uid']; $datamoney_x['target_uname'] = $buname; $moneynewid_x = M('member_moneylog')->add($datamoney_x); if ($moneynewid_x) { $bxid = M('member_money')->where("uid={$datamoney_x['uid']}")->save($mmoney_x); } } } else { $moneynewid_x = true; $bxid = true; $upsummary_res = true; } if ($moneynewid_x && $upsummary_res && $bxid && $upborrow_info) { $done = true; $borrowInvestor->commit(); } else { $borrowInvestor->rollback(); } if (!$done) { continue; } MTip('chk11', $vbx['borrow_uid'], $borrow_id); $verify_info['borrow_id'] = $borrow_id; $verify_info['deal_info_2'] = text($_POST['deal_info_2']); $verify_info['deal_user_2'] = 0; $verify_info['deal_time_2'] = time(); $verify_info['deal_status_2'] = 3; if ($vbx['first_verify_time'] > 0) { M('borrow_verify')->save($verify_info); } else { M('borrow_verify')->add($verify_info); } $vss = M("members")->field("user_phone,user_name")->where("id = {$vbx['borrow_uid']}")->find(); SMStip("refuse", $vss['user_phone'], array("#USERANEM#", "ID"), array($vss['user_name'], $verify_info['borrow_id'])); //@SMStip("refuse",$vss['user_phone'],array("#USERANEM#","ID"),array($vss['user_name'],$verify_info['borrow_id'])); //updateBinfo $newBinfo = array(); $newBinfo['id'] = $borrow_id; $newBinfo['borrow_status'] = 3; $newBinfo['second_verify_time'] = time(); $x = M("borrow_info")->save($newBinfo); } /****************************募集期内标未满,自动流标 新增 2013-03-13****************************/ }
public function index_bak() { $jsoncode = file_get_contents("php://input"); $arr = array(); $arr = json_decode($jsoncode, true); // $datag = get_global_setting(); // $newversion = $datag['apkversion']; // if(is_array($arr)&&(!empty($arr))&&(!empty($arr['version']))&&((int)$arr['version'])<$newversion){ // $m_list['upversion'] = 1; // $m_list['path'] = $datag['apkpath']; // }else{ // $m_list['upversion'] = 0; // } //alogsm("Main",0,1,$jsoncode); $per = C('DB_PREFIX'); //print_r($arr);die(); //普通标翻页 if (is_array($arr) && isset($arr['id']) && isset($arr['type']) && isset($arr['num'])) { $type = $arr['type']; $id = intval($arr['id']); $num = intval($arr['num']); } else { $type = 2; $num = 5; } //企业标翻页 if (is_array($arr) && isset($arr['tid']) && isset($arr['ttype']) && isset($arr['tnum'])) { $ttype = $arr['ttype']; $tid = intval($arr['tid']); $tnum = intval($arr['tnum']); } else { $ttype = 2; $tnum = 5; } //普通标 if ($type == 1) { $searchMap['borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.borrow_type'] = array("neq", "9"); $searchMap['b.id'] = array("gt", $id); $parm['map'] = $searchMap; $parm['limit'] = $num; $parm['orderby'] = "b.borrow_status ASC,b.id asc"; } elseif ($type == 0) { $searchMap['borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.borrow_type'] = array("neq", "9"); $searchMap['b.id'] = array("lt", $id); $parm['map'] = $searchMap; $parm['limit'] = $num; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; } else { $searchMap['borrow_status'] = array("in", '2,4,6,7'); $searchMap['b.borrow_type'] = array("neq", "9"); $parm['map'] = $searchMap; $parm['limit'] = $num; $parm['orderby'] = "b.borrow_status ASC,b.id DESC"; } //$searchMap['borrow_status']=array("in",'2,4,6,7'); //$parm['map'] = $searchMap; //$parm['limit'] = 10; //$parm['orderby']="b.borrow_status ASC,b.id DESC"; $list = getBorrowList($parm); //$_list = $list; foreach ($list['list'] as $key => $v) { $_list[$key]['uid'] = intval($v['uid']); $_list[$key]['type'] = getleixing($v); $_list[$key]['id'] = intval($v['id']); $_list[$key]['borrow_name'] = $v['borrow_name']; $_list[$key]['borrow_interest_rate'] = $v['borrow_interest_rate']; if ($v['repayment_type'] == 1) { $_list[$key]['borrow_duration'] = $v['borrow_duration'] . "天"; } else { $_list[$key]['borrow_duration'] = $v['borrow_duration'] . "个月"; } $_list[$key]['repayment_type'] = $v['repayment_type']; $_list[$key]['borrow_money'] = $v['borrow_money']; $_list[$key]['progress'] = $v['progress']; $_list[$key]['credits'] = $v['credits']; $_list[$key]['user_name'] = $v['user_name']; $_list[$key]['imgpath'] = get_avatar(intval($v['uid'])); $_list[$key]['suo'] = empty($v['password']) ? 0 : 1; //是否定向标 if ($v['reward_type'] == 1) { $_list[$key]['reward'] = $v['reward_num'] . "%"; } elseif ($v['reward_type'] == 2) { $_list[$key]['reward'] = $v['reward_num'] . "元"; } else { $_list[$key]['reward'] = "0"; } } $m_list['list'] = $_list; //企业直投 $parmt = array(); if ($ttype == 1) { $searchMapt['bi.borrow_status'] = array("in", "2,4,6,7"); $searchMapt['bi.borrow_type'] = 9; $parmt['map'] = $searchMapt; $parmt['limit'] = $tnum; $parmt['orderby'] = "bi.borrow_status ASC,bi.id DESC,bi.add_time DESC"; } elseif ($ttype == 0) { $searchMapt['bi.borrow_status'] = array("in", "2,4,6,7"); $searchMapt['bi.borrow_type'] = 9; $parmt['map'] = $searchMapt; $parmt['limit'] = $tnum; $parmt['orderby'] = "bi.borrow_status ASC,bi.id DESC,bi.add_time DESC"; } else { $searchMapt['bi.borrow_status'] = array("in", "2,4,6,7"); $searchMapt['bi.borrow_type'] = 9; $parmt['map'] = $searchMapt; $parmt['limit'] = $tnum; $parmt['orderby'] = "bi.borrow_status ASC,bi.id DESC,bi.add_time DESC"; } //$searchMapt['bi.borrow_type'] = 9; //$searchMap['borrow_status']=2; //$searchMapt['is_show'] = array('in','0,1'); //$searchMapt['bi.borrow_status']=array("in","2,4,6,7"); // $searchMap['b.borrow_status']=0; // $searchMap['deadline']=strtotime("deadline"); // $search['bi.borrow_status']=array("in","2,4,6,7"); //$searchMap['b.borrow_type'] =9; //$parmt['map'] = $searchMapt; //$parmt['limit'] = 10; //$parmt['orderby'] = "b.is_show desc,b.id DESC"; // $parm['orderby']="bi.borrow_status ASC,bi.id DESC,bi.add_time DESC"; $tlist = getTBorrowList($parmt); foreach ($tlist['list'] as $key => $v) { // $_tlist[$key]['uid'] = intval($v['uid']); // $_tlist[$key]['type'] = 2; // $_tlist[$key]['id'] = intval($v['id']); // $_tlist[$key]['borrow_name'] = $v['borrow_name']; // $_tlist[$key]['borrow_interest_rate'] = $v['borrow_interest_rate']; // $_tlist[$key]['borrow_duration'] = $v['borrow_duration']."个月"; // $_tlist[$key]['per_transfer'] = $v['per_transfer']; // $_tlist[$key]['borrow_money'] =$v['borrow_money']; // $_tlist[$key]['progress'] =$v['progress']; // $_tlist[$key]['credits'] =$v['credits']; // $_tlist[$key]['user_name'] =$v['user_name']; // $_tlist[$key]['imgpath'] =get_avatar(intval($v['uid'])); // $_tlist[$key]['reward'] = $v['reward_rate']."%"; $_tlist[$key]['uid'] = intval($v['uid']); $_tlist[$key]['type'] = 2; $_tlist[$key]['id'] = intval($v['id']); $_tlist[$key]['borrow_name'] = $v['borrow_name']; $_tlist[$key]['borrow_interest_rate'] = $v['borrow_interest_rate']; if ($v['repayment_type'] == 1) { $_tlist[$key]['borrow_duration'] = $v['borrow_duration'] . "天"; } else { $_tlist[$key]['borrow_duration'] = $v['borrow_duration'] . "个月"; } $_tlist[$key]['repayment_type'] = $v['repayment_type']; $_tlist[$key]['borrow_money'] = $v['borrow_money']; $_tlist[$key]['progress'] = $v['progress']; $_tlist[$key]['credits'] = $v['credits']; $_tlist[$key]['user_name'] = $v['user_name']; $_tlist[$key]['imgpath'] = get_avatar(intval($v['uid'])); $_tlist[$key]['suo'] = empty($v['password']) ? 0 : 1; //是否定向标 if ($v['reward_type'] == 1) { $_tlist[$key]['reward'] = $v['reward_num'] . "%"; } elseif ($v['reward_type'] == 2) { $_tlist[$key]['reward'] = $v['reward_num'] . "元"; } else { $_tlist[$key]['reward'] = "0"; } } //$m_list['tlist']= $_tlist; //////////////////////////////////////////////债券转让////////////////////////////////////////////////// // $search1 = array(); // $search1['b.borrow_status']=array("in","2,4,6,7"); // $parm1['map'] = $search1; // D("DebtBehavior"); // $Debt = new DebtBehavior(); // $dlist = $Debt->listAll($parm1); // foreach($dlist['data'] as $key =>$v){ // $_dlist[$key]['uid'] = intval($v['uid']); // $_dlist[$key]['type'] = 9; // $_dlist[$key]['id'] = intval($v['id']); // $_dlist[$key]['borrow_name'] = $v['borrow_name']; // $_dlist[$key]['credits'] =$v['credits']; // $_dlist[$key]['borrow_interest_rate'] = $v['borrow_interest_rate']."%"; // $_dlist[$key]['transfer_price'] = $v['transfer_price']; // $_dlist[$key]['money'] =$v['money']; // $_dlist[$key]['period'] =$v['period']; // $_dlist[$key]['total_period'] =$v['total_period']; // $_dlist[$key]['status'] = $v['status']; // } // $m_list['dlist']= $_dlist; echo ajaxmsg($m_list); //$this->assign("Sorder",$Sorder); // $this->assign("searchMap",$maprow); // $this->assign("Bconfig",$Bconfig); // $this->assign("mainlist",$list); //$this->display(); }