예제 #1
0
 /**
  * 确认购买
  * 流程: 检测购买条件
  * 购买
  */
 public function buy()
 {
     $paypass = strval($_REQUEST['paypass']);
     $invest_id = intval($_REQUEST['invest_id']);
     D("DebtBehavior");
     $Debt = new DebtBehavior($this->uid);
     // 检测是否可以购买  密码是否正确,余额是否充足
     $result = $Debt->buy($paypass, $invest_id);
     if ($result === 'TRUE') {
         ajaxmsg('购买成功');
     } else {
         ajaxmsg($result, 1);
     }
 }
예제 #2
0
 /**
  * 债权转让列表
  * 
  */
 public function index()
 {
     $curl = $_SERVER['REQUEST_URI'];
     $urlarr = parse_url($curl);
     parse_str($urlarr['query'], $surl);
     //array获取当前链接参数,2.
     $urlArr = array('borrow_status', '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['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['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_status':
                     $search["b." . $v] = intval($_GET[$v]);
                     break;
                 default:
                     $barr = explode("-", text($_GET[$v]));
                     $search["b." . $v] = array("between", $barr);
                     break;
             }
         }
     }
     if ($search['b.borrow_status'] == 0) {
         $search['b.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;
     D("DebtBehavior");
     $Debt = new DebtBehavior();
     $list = $Debt->listAll($parm);
     $this->assign("list", $list);
     A("Home/Invest")->blank();
     $this->fang = session('fang');
     $this->zong = session('zong');
     $this->che = session('che');
     $this->assign("searchUrl", $searchUrl);
     $this->assign("searchMap", $searchMap);
     //左侧页面
     $left = A('Home/Invest')->invest_ad();
     $this->left = $left;
     $this->display();
 }
예제 #3
0
파일: DataSource.php 프로젝트: GStepOne/CI
function cancelDebt($borrow_id)
{
    $borrow_id = intval($borrow_id);
    $borrow_info = M("borrow_info")->field("total, has_pay")->where("id={$borrow_id}")->find();
    $result = M("borrow_investor")->field("id")->where(" borrow_id={$borrow_id}")->select();
    D("DebtBehavior");
    $Debt = new DebtBehavior();
    foreach ($result as $k => $v) {
        $debt_info = M('invest_detb')->field('status')->where("invest_id={$v['id']}")->find();
        if ($borrow_info['total'] == $borrow_info['has_pay'] && $debt_info['status'] == 1) {
            //已经还完更改状态
            M('invest_detb')->where("invest_id={$v['id']}")->save(array('status' => 4));
        } elseif ($debt_info['status'] == 2) {
            $Debt->cancelDebt($v['id'], 2);
        }
    }
}
예제 #4
0
 /**
  * 确认购买
  * 流程: 检测购买条件
  * 购买
  */
 public function buy()
 {
     //dump($this->uid);die;(2)
     $paypass = strval($_REQUEST['paypass']);
     $invest_id = intval($_REQUEST['invest_id']);
     //dump($invest_id);(146)die;
     /*var_dump($paypass);//(123)
     		var_dump($invest_id);//(1)
     		uid=2
     		
     		*/
     D("DebtBehavior");
     $Debt = new DebtBehavior($this->uid);
     // 检测是否可以购买  密码是否正确,余额是否充足
     $result = $Debt->buya($paypass, $invest_id);
     //dump($result);die;
     if ($result === '购买成功') {
         //ajaxmsg('购买成功');
         ajaxmsg($result, 1);
     } else {
         ajaxmsg($result, 0);
     }
 }
예제 #5
0
 public function creditassignret()
 {
     $usrid = $_POST['BuyCustId'];
     $info = M("huifulog")->distinct(true)->field("uid,username")->where("usrid=" . $usrid)->find();
     $data = array();
     $data['uid'] = $info['uid'];
     //用户UID
     $data['username'] = $info['username'];
     //用户名
     $data['rescode'] = $_POST['RespCode'];
     //返回码
     $data['cmdid'] = $_POST['CmdId'];
     //消息类型
     $data['usrid'] = $_POST['BuyCustId'];
     //用户客户号
     $data['ordid'] = $_POST['OrdId'];
     //订单号
     $data['orddate'] = $_POST['OrdDate'];
     //订单日期
     $data['trxid'] = "";
     $data['merpriv'] = $_POST['MerPriv'];
     $data['addtime'] = time();
     //记录时间
     sleep(1);
     //防止与前台回调同步到达
     $condition['uid'] = $data['uid'];
     $condition['ordid'] = $data['ordid'];
     $num = M("huifulog")->where($condition)->count();
     if ($num == 0) {
         M("huifulog")->add($data);
         if (strcmp($_POST['RespCode'], "000") == 0) {
             $temp = base64_decode($data['merpriv']);
             $pos1 = strpos($temp, '{');
             $pos2 = strpos($temp, '}');
             $len = $pos2 - $pos1 + 1;
             $merpriv = substr($temp, $pos1, $len);
             $merpriv = json_decode($merpriv, true);
             $investid = $merpriv['investid'];
             //投资ID
             D("DebtBehavior");
             $Debt = new DebtBehavior($data['uid']);
             $Debt->buy($investid);
             $assign['investor'] = $data['uid'];
             $assign['ordid'] = $data['ordid'];
             $assign['orddate'] = $data['orddate'];
             M("borrow_investor")->where("id=" . $investid)->save($assign);
         }
     }
     echo "RECV_ORD_ID_" . $_POST['OrdId'];
 }
예제 #6
0
 /**
  * [reclist(recommend list) 推荐标信息作废]
  * @return [type] [description]
  * @author yudianguo <*****@*****.**>
  */
 public function reclist()
 {
     //普通表\企业标
     //$maxid=M('borrow_info')->max('id');
     //$parm=array();
     //searchMap=array();
     //$searchMap['id']=$maxid;
     $searchMap['stock_type'] = 1;
     $searchMap['borrow_status'] = '2';
     $parm['map'] = $searchMap;
     $parm['limit'] = 1;
     $parm['orderby'] = "b.id DESC";
     $func = (require c("APP_ROOT") . "Common/Apps/function.php");
     $list = getBorrowList($parm);
     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]['huankuan_type'] = $Bconfig['REPAYMENT_TYPE'][$v['repayment_type']];
         $_list[$key]['borrow_money'] = $v['borrow_money'];
         $_list[$key]['progress'] = $v['progress'];
         $_list[$key]['credits'] = $v['credits'];
         $_list[$key]['borrow_min'] = $v['borrow_min'];
         $_list[$key]['borrow_max'] = $v['borrow_max'];
         $_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";
         }
         $borrowinfo = M("borrow_info bi")->field('bi.id as bid,bi.*,ac.title,ac.id')->join('lzh_article ac on ac.id= bi.danbao')->where('bi.id=' . $v['id'])->find();
         $borrowinfo['lefttime'] = $borrowinfo['collect_time'] - time();
         if ($v['progress'] >= 100) {
             $_list[$key]['lefttime'] = "已结束";
         } elseif ($borrowinfo['lefttime'] > 0) {
             $left_tian = floor($borrowinfo['lefttime'] / (60 * 60 * 24));
             $left_hour = floor(($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60) / 3600);
             $left_minute = floor(($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60 - $left_hour * 60 * 60) / 60);
             $left_second = floor($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60 - $left_hour * 60 * 60 - $left_minute * 60);
             $_list[$key]['lefttime'] = $left_tian . "天" . $left_hour . "时" . $left_minute . "分";
         } else {
             $_list[$key]['lefttime'] = "已结束";
         }
         $m_list['lists'] = $_list;
     }
     //企业标
     $searchMaps['stock_type'] = 2;
     $searchMaps['borrow_status'] = '2';
     $parms['map'] = $searchMaps;
     $parms['limit'] = 2;
     $parms['orderby'] = "b.id DESC";
     $lists = getBorrowList($parms);
     foreach ($lists['list'] as $key => $v) {
         $_lists[$key]['uid'] = intval($v['uid']);
         $_lists[$key]['type'] = getleixing($v);
         $_lists[$key]['id'] = intval($v['id']);
         $_lists[$key]['borrow_name'] = $v['borrow_name'];
         $_lists[$key]['borrow_interest_rate'] = $v['borrow_interest_rate'];
         if ($v['repayment_type'] == 1) {
             $_lists[$key]['borrow_duration'] = $v['borrow_duration'] . "天";
         } else {
             $_lists[$key]['borrow_duration'] = $v['borrow_duration'] . "个月";
         }
         $_lists[$key]['repayment_type'] = $v['repayment_type'];
         $_lists[$key]['huankuan_type'] = $Bconfig['REPAYMENT_TYPE'][$v['repayment_type']];
         $_lists[$key]['borrow_money'] = $v['borrow_money'];
         $_lists[$key]['progress'] = $v['progress'];
         $_lists[$key]['credits'] = $v['credits'];
         $_lists[$key]['user_name'] = $v['user_name'];
         $_lists[$key]['borrow_min'] = $v['borrow_min'];
         $_lists[$key]['borrow_max'] = $v['borrow_max'];
         $_lists[$key]['imgpath'] = get_avatar(intval($v['uid']));
         $_lists[$key]['suo'] = empty($v['password']) ? 0 : 1;
         //是否定向标
         if ($v['reward_type'] == 1) {
             $_lists[$key]['reward'] = $v['reward_num'] . "%";
         } elseif ($v['reward_type'] == 2) {
             $_lists[$key]['reward'] = $v['reward_num'] . "元";
         } else {
             $_lists[$key]['reward'] = "0";
         }
         $borrowinfo = M("borrow_info bi")->field('bi.id as bid,bi.*,ac.title,ac.id')->join('lzh_article ac on ac.id= bi.danbao')->where('bi.id=' . $v['id'])->find();
         $borrowinfo['lefttime'] = $borrowinfo['collect_time'] - time();
         if ($v['progress'] >= 100) {
             $_lists[$key]['lefttime'] = "已结束";
         } elseif ($borrowinfo['lefttime'] > 0) {
             $left_tian = floor($borrowinfo['lefttime'] / (60 * 60 * 24));
             $left_hour = floor(($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60) / 3600);
             $left_minute = floor(($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60 - $left_hour * 60 * 60) / 60);
             $left_second = floor($borrowinfo['lefttime'] - $left_tian * 24 * 60 * 60 - $left_hour * 60 * 60 - $left_minute * 60);
             $_lists[$key]['lefttime'] = $left_tian . "天" . $left_hour . "时" . $left_minute . "分";
         } else {
             $_lists[$key]['lefttime'] = "已结束";
         }
         $m_list['company'] = $_lists;
     }
     //债券转让
     $search['b.borrow_status'] = array("in", "2,4,6,7");
     $parmss['map'] = $search;
     $parmss['limit'] = 1;
     D("DebtBehavior");
     $Debt = new DebtBehavior();
     $list = $Debt->listAllz($parmss);
     foreach ($list as $k => $v) {
         foreach ($v as $k => $vl) {
             $listss[$k]['borrow_name'] = cnsubstr($vl['borrow_name'], 12);
             $listss[$k]['credits'] = getLeveIco($vl['credits'], 2);
             $listss[$k]['borrow_interest_rate'] = $vl['borrow_interest_rate'];
             $listss[$k]['transfer_price'] = $vl['transfer_price'];
             $listss[$k]['money'] = $vl['money'];
             $listss[$k]['transfer_date'] = $vl['period'];
             $listss[$k]['total_date'] = $vl['total_period'];
             $listss[$k]['id'] = $vl['id'];
             $listss[$k]['invest_id'] = $vl['invest_id'];
             if ($vl['status'] == 2) {
                 $listss[$k]['status'] = "我要购买";
             } elseif ($vl['status'] == 4) {
                 $listss[$k]['status'] = "已停售";
             }
             $m_list['debt'] = $listss;
         }
     }
     ajaxmsg($m_list);
 }