public function invest()
 {
     if (!$this->uid) {
         if ($this->isAjax()) {
             die("请先登录后投资");
         } else {
             $this->redirect('M/pub/login');
         }
     }
     if ($this->isAjax()) {
         $borrow_id = intval($this->_get('bid'));
         $tnum = intval($_POST['cnum']);
         $pre = c("DB_PREFIX");
         $m = M("member_money")->field('account_money,back_money,money_collect')->find($this->uid);
         $amoney = $m['account_money'] + $m['back_money'];
         $uname = session("u_user_name");
         $binfo = M("transfer_borrow_info")->field("borrow_uid,borrow_interest_rate,transfer_out,transfer_back,transfer_total,\n                                per_transfer,is_show,deadline,min_month,increase_rate,reward_rate,borrow_duration")->find($borrow_id);
         if ($this->uid == $binfo['borrow_uid']) {
             ajaxmsg("不能去投自己的标", 0);
         }
         $month = $binfo['borrow_duration'];
         //手机版默认投资最大期限
         $max_num = $binfo['transfer_total'] - $binfo['transfer_out'];
         if ($max_num < $tnum) {
             die("本标还能认购最大份数为" . $max_num . "份,请重新输入认购份数");
         }
         $money = $binfo['per_transfer'] * $tnum;
         if ($amoney < $money) {
             die("尊敬的{$uname},您准备认购{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再认购");
         }
         $vm = getMinfo($this->uid, "m.pin_pass,mm.invest_vouch_cuse,mm.money_collect");
         $pin_pass = $vm['pin_pass'];
         $pin = md5($_POST['paypass']);
         // if ($pin != $pin_pass){
         //     die( "支付密码错误,请重试" );
         // }
         $tinvest_id = TinvestMoney($this->uid, $borrow_id, $tnum, $month);
         //投企业直投
         if ($tinvest_id) {
             //die('TRUE');
             $loanconfig = FS("Webconfig/loanconfig");
             $orders = 'T' . date("YmdHi") . $tinvest_id;
             // 发送到乾多多
             $invest_qdd = M("escrow_account")->field('*')->where("uid={$this->uid}")->find();
             $borrow_qdd = M("escrow_account")->field('*')->where("uid={$binfo['borrow_uid']}")->find();
             $invest_info = M("transfer_borrow_investor")->field("reward_money, borrow_fee")->where("id={$tinvest_id}")->find();
             $secodary = '';
             import("ORG.Loan.Escrow");
             $loan = new Escrow();
             if ($invest_info['reward_money'] > 0.0) {
                 // 投标奖励
                 $secodary[] = $loan->secondaryJsonList($invest_qdd['qdd_marked'], $invest_info['reward_money'], '二次分配', '投标奖励');
             }
             if ($invest_info['borrow_fee'] > 0.0) {
                 // 借款管理费
                 $secodary[] = $loan->secondaryJsonList($loanconfig['pfmmm'], $invest_info['borrow_fee'], '二次分配', '借款管理费');
             }
             $secodary && ($secodary = json_encode($secodary));
             $loanList = $loan->loanJsonList($invest_qdd['qdd_marked'], $borrow_qdd['qdd_marked'], $orders, 'T_' . $borrow_id, $money, $binfo['borrow_money'], '投标', "对{$borrow_id}号企业直投进行投标", $secodary);
             $loanJsonList = json_encode($loanList);
             $returnURL = C('WEB_URL') . U("tinvest/wapinvestReturn");
             $notifyURL = C('WEB_URL') . U("tinvest/notify");
             $data = $loan->transfer($loanJsonList, $returnURL, $notifyURL, 1, 1, 2, 1);
             // 自动到帐
             $form = $loan->setForm($data, 'transfer');
             // echo "aaaaaa";die();
             echo $form . "正在跳转至乾多多。。。";
             exit;
         } else {
             die("很遗憾,认购失败,请重试!");
         }
     } else {
         $borrow_id = $this->_get('bid');
         $pre = C('DB_PREFIX');
         $borrowinfo = M("transfer_borrow_info b")->join("{$pre}transfer_detail d ON d.borrow_id=b.id")->field(true)->find($borrow_id);
         $borrowinfo['progress'] = getfloatvalue($borrowinfo['transfer_out'] / $borrowinfo['transfer_total'] * 100, 2);
         $borrowinfo['need'] = getfloatvalue(($borrowinfo['transfer_total'] - $borrowinfo['transfer_out']) * $borrowinfo['per_transfer'], 2);
         $borrowinfo['updata'] = unserialize($borrowinfo['updata']);
         $this->assign("vo", $borrowinfo);
         $user_info = M('member_money')->field("account_money+back_money as money ")->where("uid='{$this->uid}'")->find();
         $this->assign('user_info', $user_info);
         $paypass = M("members")->field('pin_pass')->where('id=' . $this->uid)->find();
         $this->assign('paypass', $paypass['pin_pass']);
         $this->display();
     }
 }
Exemple #2
0
function getTBorrowList($parm = array())
{
    $map = $parm['map'];
    $order = $parm['orderby'];
    $map['bi.borrow_type'] = 9;
    if ($parm['pagesize']) {
        import("ORG.Util.Page");
        $count = M("borrow_info bi")->where($map)->count("bi.id");
        //exit(M()->getLastSql());
        $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 = 'bi.id,bi.borrow_name,bi.borrow_money,has_borrow,bi.borrow_duration,borrow_use_text,borrow_guarantee_text,flat_comment,bi.borrow_min,guarantee_comment,borrow_miaoshu,flat_comment_yijing,borrow_cuoshi,borrow_capital,topic,swf_data,';
    $field .= 'bi.borrow_interest_rate,bi.borrow_status,bi.deadline,bi.danbao,bi.topic,m.credits,borrow_type';
    $list = M("borrow_info bi")->field($field)->join("{$pre}members m ON m.id=bi.borrow_uid")->where($map)->order($order)->limit($Lsql)->select();
    //dump($list);die();
    //exit(M()->getLastSql());
    foreach ($list as $key => $rows) {
        $list[$key]['deadline'] = date("Y-m-d", $rows['deadline']);
        $list[$key]['progress'] = ceil($rows['has_borrow'] / $rows['borrow_money'] * 100);
        $list[$key]['need'] = getfloatvalue($rows['borrow_money'] - $rows['has_borrow'], 2);
        //$list[$key]['danbao']= empty($rows['danbao']) ? '暂无担保机构' : M('article')->getFieldById($rows['danbao'], 'title');
        $list[$key]['danbao'] = empty($rows['danbao']) ? '暂无担保机构' : M('member_info')->getFieldByUid($rows['danbao'], 'real_name');
    }
    $row = array();
    $row['list'] = $list;
    $row['page'] = $page;
    return $row;
}
 public function cmpay()
 {
     if ($this->payConfig['cmpay']['enable'] == 0) {
         exit("对不起,该支付方式被关闭,暂时不能使用!");
     }
     $this->getPaydetail();
     $submitdata['characterSet'] = '02';
     //
     $submitdata['callbackUrl'] = $this->return_url . "?payid=cmpay";
     //
     $submitdata['notifyUrl'] = $this->notice_url . "?payid=cmpay";
     //
     $submitdata['ipAddress'] = getIp();
     //
     $submitdata['merchantId'] = $this->payConfig['cmpay']['merchantId'];
     //测试商户100000000000040
     $submitdata['requestId'] = date("YmdHis") . mt_rand(100000, 999999);
     //商户请求号
     $submitdata['signType'] = 'MD5';
     //
     $submitdata['type'] = 'GWDirectPay';
     //接口类型
     $submitdata['version'] = '2.0.0';
     //
     $submitdata['amount'] = $this->paydetail['money'] * 100;
     //交易金额
     $submitdata['bankAbbr'] = $this->paydetail['bank'];
     //银行代码
     $submitdata['currency'] = '00';
     //
     $submitdata['orderDate'] = date(Ymd);
     //
     $submitdata['orderId'] = 'cmpay' . date("YmdHis") . mt_rand(100000, 999999);
     //商户订单号
     $submitdata['merAcDate'] = date(Ymd);
     //
     $submitdata['period'] = 10;
     //有效期数量. 数字,不订单有效期单位同时构成订单有效期
     $submitdata['periodUnit'] = '00';
     //
     $submitdata['merchantAbbr'] = '';
     //商户展示名称
     $submitdata['productDesc'] = '';
     //商品描述
     $submitdata['productId'] = '';
     //商品编号
     $submitdata['productName'] = 'toubiao';
     //商品名称
     $submitdata['productNum'] = '';
     //商品数量
     $submitdata['reserved1'] = '';
     //保留字段1
     $submitdata['reserved2'] = '';
     //保留字段2
     $submitdata['userToken'] = '';
     //用户标识
     $submitdata['showUrl'] = '';
     //商品展示地址
     $submitdata['couponsFlag'] = '00';
     //营销工具使用控制
     $submitdata['hmac'] = $this->getSign("cmpay_return", $submitdata);
     //签名数据
     //$submitdata['merchantCert'] ='';//商户证书公钥
     //echo '<pre>';
     //dump($submitdata);exit;
     unset($this->paydetail['bank']);
     $this->paydetail['fee'] = getfloatvalue($this->payConfig['cmpay']['feerate'] * $this->paydetail['money'] / 100, 2);
     $this->paydetail['nid'] = $this->createnid("cmpay", $submitdata['orderId']);
     $this->paydetail['way'] = "cmpay";
     M("member_payonline")->add($this->paydetail);
     $this->create($submitdata, "https://ipos.10086.cn/ips/cmpayService");
     //正式环境
 }
 public function tdetail()
 {
     $jsoncode = file_get_contents("php://input");
     //alogsm("tdetail",0,1,session("u_id").$jsoncode);
     $arr = array();
     $arr = json_decode($jsoncode, true);
     if (!is_array($arr) || empty($arr) || empty($arr['id']) || $arr['type'] != 2) {
         ajaxmsg("查询错误!", 0);
     }
     $pre = C('DB_PREFIX');
     $id = intval($arr['id']);
     $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php");
     $borrowinfo = M("transfer_borrow_info b")->join("{$pre}transfer_detail d ON d.borrow_id=b.id")->field(true)->find($id);
     $borrowinfo['progress'] = getfloatvalue($borrowinfo['transfer_out'] / $borrowinfo['transfer_total'] * 100, 2);
     $borrowinfo['need'] = getfloatvalue(($borrowinfo['transfer_total'] - $borrowinfo['transfer_out']) * $borrowinfo['per_transfer'], 2);
     $borrowinfo['updata'] = unserialize($borrowinfo['updata']);
     $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();
     $list['id'] = $id;
     $list['type'] = 2;
     $list['borrow_name'] = $borrowinfo['borrow_name'];
     $list['borrow_interest_rate'] = $borrowinfo['borrow_interest_rate'];
     $list['borrow_money'] = $borrowinfo['borrow_money'];
     $list['transfer_out'] = $borrowinfo['transfer_out'];
     $list['per_transfer'] = $borrowinfo['per_transfer'];
     $list['borrow_duration'] = $borrowinfo['borrow_duration'] . "个月";
     $list['progress'] = $borrowinfo['progress'];
     $list['borrow_max'] = $borrowinfo['borrow_max'] ? $borrowinfo['borrow_max'] : "无";
     $list['transfer_total'] = $borrowinfo['transfer_total'];
     $list['transfer_leave'] = $borrowinfo['transfer_total'] - $borrowinfo['transfer_out'];
     $list['transfer_back'] = $borrowinfo['transfer_back'];
     //$list['borrow_breif'] ="<p style='color:#5c5c5c;font-size:60px;font-family: Droid Sans Fallback;'>".strip_tags($borrowinfo['borrow_breif'])."</p>";
     $list['borrow_breif'] = strip_tags($borrowinfo['borrow_breif']);
     $list['reward'] = $borrowinfo['reward_rate'];
     $list['min_month'] = $borrowinfo['min_month'];
     $list['huankuan_type'] = "一次性还款";
     $minfo = M("members")->where("id={$borrowinfo['borrow_uid']}")->find();
     $list['user_name'] = $minfo['user_name'];
     $list['imgpath'] = get_avatar($borrowinfo['borrow_uid']);
     $list['addtime'] = date("Y-m-d", $borrowinfo['add_time']);
     $list['credit_rating'] = getLeveIco($memberinfo['credits'], 3);
     $list['need_money'] = $borrowinfo['transfer_total'] * $borrowinfo['per_transfer'] - $borrowinfo['transfer_out'] * $borrowinfo['per_transfer'];
     $list['invested_money'] = $borrowinfo['transfer_out'] * $borrowinfo['per_transfer'];
     if ($borrowinfo['danbao'] != 0) {
         $danbao = M('article')->field('id,title')->where("type_id=7 and id={$borrowinfo['danbao']}")->find();
         $borrowinfo['danbao'] = $danbao['title'];
         //担保机构
         $borrowinfo['danbaoid'] = $danbao['id'];
     } else {
         $borrowinfo['danbao'] = '暂无担保机构';
         //担保机构
     }
     $list['guarantee_institutions'] = $borrowinfo['danbao'];
     ajaxmsg($list);
 }
 public function index()
 {
     $row['borrow_1'] = M('borrow_info')->where('borrow_status=0')->count('id');
     //初审
     $row['borrow_2'] = M('borrow_info')->where('borrow_status=4')->count('id');
     //复审
     $row['limit_a'] = M('member_apply')->where('apply_status=0')->count('id');
     //额度
     $row['data_up'] = M('member_data_info')->where('status=0')->count('id');
     //上传资料
     $row['vip_a'] = M('vip_apply')->where('status=0')->count('id');
     //VIP审核
     $row['video_a'] = M('video_apply')->where('apply_status=0')->count('id');
     //视频认证
     $row['face_a'] = M('face_apply')->where('apply_status=0')->count('id');
     //现场认证
     $row['real_a'] = M('members_status')->where('id_status=3')->count('uid');
     //现场认证
     $row['withdraw'] = M('member_withdraw')->where('withdraw_status=0')->count('id');
     //待审核提现
     $row['payonline'] = M('member_payonline')->where("way = 'off' and status = 0")->count('id');
     //待审核ATM转账
     $row['alipay'] = M('member_alipay')->where("status = 1")->count('id');
     //待审核支付宝充值
     //天天盈审核统计
     $row['daystock'] = M('shares_apply')->where("type_id = 1 and status = 1")->count('id');
     //配资初审待审核
     $row['additional'] = M("shares_additional s")->join("lzh_shares_apply l ON l.id = s.shares_id")->where("s.status = 1 and l.status <> 3 and s.type_id = 1")->count('s.id');
     //追加待审核
     $row['reduce'] = M("shares_additional d")->field("d.*,l.principal as aprincipal,l.shares_money as ashares_money")->join("lzh_shares_apply l ON l.id = d.shares_id")->where("d.status = 1 and d.type_id = 1 and d.is_additional = 2 and l.status <> 3")->count('d.id');
     //减少待审核
     $row['extraction'] = M("shares_apply")->where("type_id = 1 and status = 6")->count('id');
     //提取盈利审核
     $row['supply'] = M("shares_supply s")->join("lzh_shares_apply l ON l.id = s.shares_id")->where("s.status = 1 and l.status <> 3 and s.type_id = 1")->count('s.id');
     //资金补充待审核
     $row['opens'] = M("shares_supply s")->join("lzh_shares_apply l ON l.id = s.shares_id")->where("type_id = 1 and status in(2,6) and is_want_open =  1")->count('s.id');
     //停止操盘审核
     //月月盈审核统计
     $row['mstock'] = M('shares_apply')->where("type_id = 2 and status = 1")->count('id');
     //配资初审待审核
     $row['madditional'] = M("shares_additional s")->join("lzh_shares_apply l ON l.id = s.shares_id")->where("s.status = 1 and l.status <> 3 and s.type_id = 2")->count('s.id');
     //追加待审核
     $row['mextraction'] = M("shares_apply")->where("type_id = 2 and status = 6")->count('id');
     //提取盈利审核
     $row['msupply'] = M("shares_supply s")->join("lzh_shares_apply l ON l.id = s.shares_id")->where("s.status = 1 and l.status <> 3 and s.type_id = 2")->count('s.id');
     //资金补充待审核
     $row['mopens'] = M("shares_supply s")->join("lzh_shares_apply l ON l.id = s.shares_id")->where("type_id = 2 and status in(2,6) and is_want_open =  1")->count('s.id');
     //停止操盘审核
     //我是操盘手
     $row['istock'] = M('shares_apply')->where("type_id = 3 and status = 1")->count('id');
     //配资初审待审核
     $row['iadditional'] = M("shares_additional s")->join("lzh_shares_apply l ON l.id = s.shares_id")->where("s.status = 1 and l.status <> 3 and s.type_id = 3")->count('s.id');
     //追加待审核
     $row['ireduce'] = M("shares_additional d")->field("d.*,l.principal as aprincipal,l.shares_money as ashares_money")->join("lzh_shares_apply l ON l.id = d.shares_id")->where("d.status = 1 and d.type_id = 3 and d.is_additional = 2 and l.status <> 3")->count('d.id');
     //减少待审核
     $row['isupply'] = M("shares_supply s")->join("lzh_shares_apply l ON l.id = s.shares_id")->where("s.status = 1 and l.status <> 3 and s.type_id = 3")->count('s.id');
     //资金补充待审核
     $row['iopens'] = M("shares_supply s")->join("lzh_shares_apply l ON l.id = s.shares_id")->where("type_id = 3 and status in(2,6) and is_want_open =  1")->count('s.id');
     //停止操盘审核
     //免费体验
     $row['fstock'] = M('shares_apply')->where("type_id = 4 and status = 1")->count('id');
     //配资初审待审核
     $this->assign("row", $row);
     /////////////////////////////////////////////////////////////
     $sql_chart_1 = "select count(x.t) as e  from (select count(*) as t from lzh_borrow_info group by borrow_uid) as x";
     $chart1_borrow = M()->query($sql_chart_1);
     $memberCount = M("members")->count("*");
     $sql_chart_3 = "select count(x.t) as e  from (select count(*) as t from lzh_borrow_investor group by investor_uid) as x";
     $chart1_invest = M()->query($sql_chart_3);
     $chart_1_total = intval($memberCount) + intval($chart1_invest[0]['e']) + intval($chart1_borrow[0]['e']);
     $chart_1 = array("register" => intval($memberCount), "invest" => intval($chart1_invest[0]['e']), "borrow" => intval($chart1_borrow[0]['e']), "register_rate" => getfloatvalue(intval($memberCount) / $chart_1_total * 100, 2), "invest_rate" => getfloatvalue(intval($chart1_invest[0]['e']) / $chart_1_total * 100, 2));
     $this->assign("chart_one", $chart_1);
     $start = strtotime(date("Y-m-01", time()) . " 00:00:00");
     $end = strtotime(date("Y-m-t", time()) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month = array();
     $moneyMonth = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month['money_repayment'] = getFloatvalue($moneyMonth_r / 10000, 2);
     $month['money_normal'] = getFloatvalue($moneyMonth / 10000, 2);
     $month['money_transfer'] = getFloatvalue($moneyMonth_t / 10000, 2);
     $month['month'] = date("Y-m", $end);
     $start = strtotime("-1 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-1 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month1 = array();
     $moneyMonth1 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth1_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth1_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month1['money_repayment'] = getFloatvalue($moneyMonth1_r / 10000, 2);
     $month1['money_normal'] = getFloatvalue($moneyMonth1 / 10000, 2);
     $month1['money_transfer'] = getFloatvalue($moneyMonth1_t / 10000, 2);
     $month1['month'] = date("Y-m", $end);
     $start = strtotime("-2 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-2 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month2 = array();
     $moneyMonth2 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth2_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth2_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month2['money_repayment'] = getfloatvalue($moneyMonth2_r / 10000, 2);
     $month2['money_normal'] = getfloatvalue($moneyMonth2 / 10000, 2);
     $month2['money_transfer'] = getfloatvalue($moneyMonth2_t / 10000, 2);
     $month2['month'] = date("Y-m", $end);
     $start = strtotime("-3 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-3 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month3 = array();
     $moneyMonth3 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth3_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth3_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month3['money_repayment'] = getFloatvalue($moneyMonth3_r / 10000, 2);
     $month3['money_normal'] = getFloatvalue($moneyMonth3 / 10000, 2);
     $month3['money_transfer'] = getFloatvalue($moneyMonth3_t / 10000, 2);
     $month3['month'] = date("Y-m", $end);
     $start = strtotime("-4 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-4 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month4 = array();
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth4_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month4['money_repayment'] = getfloatvalue($moneyMonth4_r / 10000, 2);
     $moneyMonth4 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth4_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $month4['money_normal'] = getfloatvalue($moneyMonth4 / 10000, 2);
     $month4['money_transfer'] = getfloatvalue($moneyMonth4_t / 10000, 2);
     $month4['month'] = date("Y-m", $end);
     $start = strtotime("-5 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-5 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month5 = array();
     $moneyMonth5 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth5_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth5_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month5['money_repayment'] = getFloatvalue($moneyMonth5_r / 10000, 2);
     $month5['money_normal'] = getFloatvalue($moneyMonth5 / 10000, 2);
     $month5['money_transfer'] = getFloatvalue($moneyMonth5_t / 10000, 2);
     $month5['month'] = date("Y-m", $end);
     $start = strtotime("-6 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-6 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month6 = array();
     $moneyMonth6 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth6_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth6_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month6['money_repayment'] = getFloatvalue($moneyMonth6_r / 10000, 2);
     $month6['money_normal'] = getFloatvalue($moneyMonth6 / 10000, 2);
     $month6['money_transfer'] = getFloatvalue($moneyMonth6_t / 10000, 2);
     $month6['month'] = date("Y-m", $end);
     $this->assign("month6", $month6);
     $this->assign("month5", $month5);
     $this->assign("month4", $month4);
     $this->assign("month3", $month3);
     $this->assign("month2", $month2);
     $this->assign("month1", $month1);
     $this->assign("month", $month);
     //dump($month2);exit;
     ////////////////////////////////////////////////////////////
     /*
     	股票配资统计 @Dong
     */
     //当天共配资统计
     $time = time();
     $day = date("Y-m-d 23:59:59", $time);
     $totimeday = strtotime($day);
     $qday = date("Y-m-d 00:00:00", strtotime("{$day} -1 day"));
     $totimeqday = strtotime($qday);
     $dayarr = M('shares_apply')->where("add_time > {$totimeday} and add_time < {$totimeqday} and type_id = 1")->select();
     $daycount = count($dayarr);
     //天天盈当天配资统计
     $marr = M('shares_apply')->where("add_time > {$totimeday} and add_time < {$totimeqday} and type_id = 2")->select();
     $mcount = count($marr);
     //月月盈当天配资统计
     $carr = M('shares_apply')->where("add_time > {$totimeday} and add_time < {$totimeqday} and type_id = 3")->select();
     $ccount = count($carr);
     //我是操盘手当天配资统计
     $count = M('shares_apply')->where("add_time > {$totimeday} and add_time < {$totimeqday}")->select();
     $count = count($count);
     //当天总配资统计
     //当月配资统计
     $oneday = date("Y-m-01 00:00:00", time());
     $totime_oneday = strtotime($oneday);
     $endday = date("Y-m-d 23:59:59", strtotime("{$oneday} +1 month -1 day"));
     $totime_endday = strtotime($endday);
     $mdayarr = M('shares_apply')->where("add_time > {$totime_oneday} and add_time < {$totime_endday} and type_id = 1")->select();
     $mdaycount = count($mdayarr);
     //天天盈当月配资统计
     $mmarr = M('shares_apply')->where("add_time > {$totime_oneday} and add_time < {$totime_endday} and type_id = 2")->select();
     $mmcount = count($mmarr);
     //月月盈当月配资统计
     $mcarr = M('shares_apply')->where("add_time > {$totime_oneday} and add_time < {$totime_endday} and type_id = 3")->select();
     $mccount = count($mcarr);
     //我是操盘手当月配资统计
     $mcount_sum = M('shares_apply')->where("add_time > {$totime_oneday} and add_time < {$totime_endday}")->select();
     $mcount_sum = count($mcount_sum);
     //当月总配资统计
     $this->assign("mdaycount", $mdaycount);
     //天天盈当月配资统计渲染
     $this->assign("mmcount", $mmcount);
     //月月盈当月配资统计渲染
     $this->assign("mccount", $mccount);
     //我是操盘手当月配资统计渲染
     $this->assign("mcount_sum", $mcount_sum);
     //当月总配资统计渲染
     $this->assign("daycount", $daycount);
     //天天盈当天配资统计渲染
     $this->assign("mcount", $mcount);
     //月月盈当天配资统计渲染
     $this->assign("ccount", $ccount);
     //我是操盘手当天配资统计渲染
     $this->assign("count", $count);
     //当天总配资统计渲染
     $this->getServiceInfo();
     $this->getAdminInfo();
     $this->display();
 }
Exemple #6
0
function getTBorrowList($parm = array())
{
    if (empty($parm['map'])) {
        return;
    }
    $map = $parm['map'];
    $orderby = $parm['orderby'];
    //dump($parm['pagesize']);die;
    if ($parm['pagesize']) {
        import("ORG.Util.Page");
        $count = M("transfer_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");
    //dump($suffix);die;
    $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.stock_type";
    $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();
    $areaList = getarea();
    //(国家、省、市、县。。)
    //dump($areaList);die;
    foreach ($list as $key => $v) {
        //($list是android那边需要的数据)
        $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());
        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'] = '暂无担保机构';
            //担保机构
        }
    }
    $row = array();
    $row['list'] = $list;
    $row['page'] = $page;
    return $row;
}
Exemple #7
0
 public function tenpay()
 {
     if ($this->payConfig['tenpay']['enable'] == 0) {
         exit("对不起,该支付方式被关闭,暂时不能使用!");
     }
     $tenpay_params = C('TENPAY_PARAMS');
     $this->getPaydetail();
     $this->paydetail['use_account'] = empty($_GET['useAccount']) ? 0 : $_GET['useAccount'];
     require_once C('APP_ROOT') . "Lib/Pay/Tenpay/RequestHandler.class.php";
     /* 创建支付请求对象 */
     $reqHandler = new RequestHandler();
     $reqHandler->init();
     $reqHandler->setKey($this->payConfig['tenpay']['mkey']);
     $reqHandler->setGateUrl($tenpay_params["PAY_URL"]);
     //----------------------------------------
     //设置支付参数
     //----------------------------------------
     $reqHandler->setParameter("total_fee", doubleval($this->paydetail['money']) * 100);
     //总金额
     //用户ip
     $reqHandler->setParameter("spbill_create_ip", get_client_ip());
     //客户端IP
     $reqHandler->setParameter("return_url", $this->tenpay_rtn_url);
     //支付成功后返回
     $reqHandler->setParameter("partner", $this->payConfig['tenpay']['MerCode']);
     $reqHandler->setParameter("out_trade_no", "tenpay" . date("YmdHis") . rand(10000, 99999));
     $reqHandler->setParameter("notify_url", $this->tenpay_notice_url);
     $reqHandler->setParameter("body", "轩宇泰投资用户充值");
     if ($this->paydetail['use_account'] == 1) {
         $this->paydetail['bank'] = "";
         $reqHandler->setParameter("bank_type", "DEFAULT");
         //买方财付通帐号
     } else {
         $reqHandler->setParameter("bank_type", $this->paydetail['bank']);
         //银行类型,默认为财付通
     }
     $reqHandler->setParameter("fee_type", "1");
     //币种
     //系统可选参数
     $reqHandler->setParameter("sign_type", "MD5");
     //签名方式,默认为MD5,可选RSA
     $reqHandler->setParameter("service_version", "1.0");
     //接口版本号
     $reqHandler->setParameter("input_charset", "UTF-8");
     //字符集
     $reqHandler->setParameter("sign_key_index", "1");
     //密钥序号
     //业务可选参数
     $reqHandler->setParameter("attach", "");
     //附件数据,原样返回就可以了
     $reqHandler->setParameter("product_fee", "");
     //商品费用
     $reqHandler->setParameter("transport_fee", "");
     //物流费用
     $reqHandler->setParameter("time_start", date("YmdHis"));
     //订单生成时间
     $reqHandler->setParameter("time_expire", "");
     //订单失效时间
     $reqHandler->setParameter("buyer_id", "");
     $reqHandler->setParameter("goods_tag", "");
     //商品标记
     //请求的URL
     $reqUrl = $reqHandler->getRequestURL();
     $this->paydetail['fee'] = getfloatvalue($this->payConfig['tenpay']['feerate'] * $this->paydetail['money'] / 100, 2);
     $this->paydetail['nid'] = $this->createnid("tenpay", $reqHandler->getParameter("out_trade_no"));
     $this->paydetail['way'] = "tenpay";
     $this->paydetail['mer_order_num'] = $reqHandler->getParameter("out_trade_no");
     M("member_payonline")->add($this->paydetail);
     $this->create($reqHandler->getAllParameters(), $reqHandler->getGateUrl());
 }
Exemple #8
0
 public function invest()
 {
     if (!$this->uid) {
         if ($this->isAjax()) {
             die("请先登录后投资");
         } else {
             $this->redirect('M/pub/login');
         }
     }
     if ($this->isAjax()) {
         $borrow_id = intval($this->_get('bid'));
         $tnum = intval($_POST['cnum']);
         $pre = c("DB_PREFIX");
         $m = M("member_money")->field('account_money,back_money,money_collect')->find($this->uid);
         $amoney = $m['account_money'] + $m['back_money'];
         $uname = session("u_user_name");
         $binfo = M("transfer_borrow_info")->field("borrow_uid,borrow_interest_rate,transfer_out,transfer_back,transfer_total,\n                                per_transfer,is_show,deadline,min_month,increase_rate,reward_rate,borrow_duration")->find($borrow_id);
         if ($this->uid == $binfo['borrow_uid']) {
             ajaxmsg("不能去投自己的标", 0);
         }
         $month = $binfo['borrow_duration'];
         //手机版默认投资最大期限
         $max_num = $binfo['transfer_total'] - $binfo['transfer_out'];
         if ($max_num < $tnum) {
             die("本标还能认购最大份数为" . $max_num . "份,请重新输入认购份数");
         }
         $money = $binfo['per_transfer'] * $tnum;
         if ($amoney < $money) {
             die("尊敬的{$uname},您准备认购{$money}元,但您的账户可用余额为{$amoney}元,请先去充值再认购");
         }
         $vm = getMinfo($this->uid, "m.pin_pass,mm.invest_vouch_cuse,mm.money_collect");
         $pin_pass = $vm['pin_pass'];
         $pin = md5($_POST['paypass']);
         if ($pin != $pin_pass) {
             die("支付密码错误,请重试");
         }
         $done = TinvestMoney($this->uid, $borrow_id, $tnum, $month);
         //投企业直投
         if ($done === true) {
             die('TRUE');
         } else {
             if ($done) {
                 die($done);
             } else {
                 die("很遗憾,认购失败,请重试!");
             }
         }
     } else {
         $borrow_id = $this->_get('bid');
         $pre = C('DB_PREFIX');
         $borrowinfo = M("transfer_borrow_info b")->join("{$pre}transfer_detail d ON d.borrow_id=b.id")->field(true)->find($borrow_id);
         $borrowinfo['progress'] = getfloatvalue($borrowinfo['transfer_out'] / $borrowinfo['transfer_total'] * 100, 2);
         $borrowinfo['need'] = getfloatvalue(($borrowinfo['transfer_total'] - $borrowinfo['transfer_out']) * $borrowinfo['per_transfer'], 2);
         $borrowinfo['updata'] = unserialize($borrowinfo['updata']);
         $this->assign("vo", $borrowinfo);
         $user_info = M('member_money')->field("account_money+back_money as money ")->where("uid='{$this->uid}'")->find();
         $this->assign('user_info', $user_info);
         $paypass = M("members")->field('pin_pass')->where('id=' . $this->uid)->find();
         $this->assign('paypass', $paypass['pin_pass']);
         $this->display();
     }
 }
 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('transfer_borrow_investor')->field('id')->where("borrow_id={$id} AND (investor_uid={$this->uid} OR borrow_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("transfer_borrow_info b")->join("{$pre}transfer_detail d ON d.borrow_id=b.id")->field(true)->find($id);
     /*if(!is_array($borrowinfo) || $borrowinfo['is_show'] == 0){
     			$this->error("数据有误或此标已认购完");
     		}*/
     $borrowinfo['progress'] = getfloatvalue($borrowinfo['transfer_out'] / $borrowinfo['transfer_total'] * 100, 2);
     $borrowinfo['need'] = getfloatvalue(($borrowinfo['transfer_total'] - $borrowinfo['transfer_out']) * $borrowinfo['per_transfer'], 2);
     $borrowinfo['updata'] = unserialize($borrowinfo['updata']);
     if ($borrowinfo['danbao'] != 0) {
         $danbao = M('article')->field('id,title')->where("type_id=7 and id={$borrowinfo['danbao']}")->find();
         $borrowinfo['danbao'] = $danbao['title'];
         //担保机构
         $borrowinfo['danbaoid'] = $danbao['id'];
     } else {
         $borrowinfo['danbao'] = '暂无担保机构';
         //担保机构
     }
     if (time() >= $borrowinfo['deadline'] || $borrowinfo['progress'] == 100) {
         $borrowinfo['restday'] = 0;
         $borrowinfo['currentday'] = $borrowinfo['add_time'];
     } else {
         $borrowinfo['restday'] = ceil(($borrowinfo['deadline'] - time()) / (24 * 60 * 60));
         $borrowinfo['currentday'] = time();
     }
     $now = time();
     $borrowinfo['aa'] = floor($borrowinfo['collect_day'] - $now);
     $borrowinfo['lefttime'] = $borrowinfo['collect_day'] - $now;
     $borrowinfo['leftday'] = ceil(($borrowinfo['collect_day'] - $now) / 3600 / 24);
     $borrowinfo['leftdays'] = floor(($borrowinfo['collect_day'] - $now) / 3600 / 24) . '天以上';
     $money = 100000;
     switch ($borrowinfo['repayment_type']) {
         //收益
         case 2:
             //等额本息
             $monthData['duration'] = $borrowinfo['borrow_duration'];
             $monthData['money'] = $money;
             $monthData['year_apr'] = $borrowinfo['borrow_interest_rate'];
             $monthData['type'] = "all";
             $repay_detail = EqualMonth($monthData);
             $borrowinfo['shouyi'] = $repay_detail['repayment_money'] - $money;
             break;
         case 4:
             //每月还息
             $monthData['month_times'] = $borrowinfo['borrow_duration'];
             $monthData['account'] = $money;
             $monthData['year_apr'] = $borrowinfo['borrow_interest_rate'];
             $monthData['type'] = "all";
             $repay_detail = EqualEndMonth($monthData);
             $borrowinfo['shouyi'] = $repay_detail['repayment_account'] - $money;
             break;
         case 5:
             //一次性还款
             $borrowinfo['shouyi'] = floor($borrowinfo['borrow_interest_rate'] * $money * $borrowinfo['borrow_duration'] / 12) / 100;
             break;
     }
     $this->assign("vo", $borrowinfo);
     //帐户资金情况
     $this->assign("investInfo", getMinfo($this->uid, true));
     //帐户资金情况
     //此标借款利息还款相关情况
     //memberinfo
     $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']];
     $this->assign("minfo", $memberinfo);
     //memberinfo
     //investinfo
     $fieldx = "bi.investor_capital,bi.transfer_month,bi.transfer_num,bi.add_time,m.user_name,bi.is_auto,bi.final_interest_rate";
     $investinfo = M("transfer_borrow_investor bi")->field($fieldx)->join("{$pre}members m ON bi.investor_uid = m.id")->where("bi.borrow_id={$id}")->order("bi.id DESC")->select();
     $this->assign("investinfo", $investinfo);
     //investinfo
     $oneday = 86400;
     $time_1 = time() - 30 * $oneday . "," . time();
     $time_6 = time() - 180 * $oneday . "," . time();
     $time_12 = time() - 365 * $oneday . "," . time();
     $mapxr['borrow_id'] = $id;
     $this->assign("time_all_out", M("transfer_borrow_investor")->where($mapxr)->sum("transfer_num"));
     $mapxr['add_time'] = array("between", "{$time_1}");
     $this->assign("time_1_out", M("transfer_borrow_investor")->where($mapxr)->sum("transfer_num"));
     $mapxr['add_time'] = array("between", "{$time_6}");
     $this->assign("time_6_out", M("transfer_borrow_investor")->where($mapxr)->sum("transfer_num"));
     $mapxr['add_time'] = array("between", "{$time_12}");
     $this->assign("time_12_out", M("transfer_borrow_investor")->where($mapxr)->sum("transfer_num"));
     $mapxr = array();
     $mapxr['borrow_id'] = $id;
     $mapxr['status'] = 2;
     $this->assign("time_all_back", M("transfer_borrow_investor")->where($mapxr)->sum("transfer_num"));
     $mapxr['back_time'] = array("between", "{$time_1}");
     $this->assign("time_1_back", M("transfer_borrow_investor")->where($mapxr)->sum("transfer_num"));
     $mapxr['back_time'] = array("between", "{$time_6}");
     $this->assign("time_6_back", M("transfer_borrow_investor")->where($mapxr)->sum("transfer_num"));
     $mapxr['back_time'] = array("between", "{$time_12}");
     $this->assign("time_12_back", M("transfer_borrow_investor")->where($mapxr)->sum("transfer_num"));
     //评论
     $cmap['tid'] = $id;
     $clist = getCommentList($cmap, 5);
     $this->assign("Bconfig", $Bconfig);
     $this->assign("commentlist", $clist['list']);
     $this->assign("commentpagebar", $clist['page']);
     $this->assign("commentcount", $clist['count']);
     $this->display();
 }
 public function tdetail()
 {
     $jsoncode = file_get_contents("php://input");
     //alogsm("tdetail",0,1,session("u_id").$jsoncode);
     $arr = array();
     $arr = json_decode($jsoncode, true);
     if (!is_array($arr) || empty($arr) || empty($arr['id']) || $arr['type'] != 2) {
         ajaxmsg("查询错误!", 0);
     }
     $pre = C('DB_PREFIX');
     $id = intval($arr['id']);
     $Bconfig = (require C("APP_ROOT") . "Conf/borrow_config.php");
     $borrowinfo = M("transfer_borrow_info b")->join("{$pre}transfer_detail d ON d.borrow_id=b.id")->field(true)->find($id);
     $borrowinfo['progress'] = getfloatvalue($borrowinfo['transfer_out'] / $borrowinfo['transfer_total'] * 100, 2);
     $borrowinfo['need'] = getfloatvalue(($borrowinfo['transfer_total'] - $borrowinfo['transfer_out']) * $borrowinfo['per_transfer'], 2);
     $borrowinfo['updata'] = unserialize($borrowinfo['updata']);
     $list['id'] = $id;
     $list['type'] = 2;
     $list['borrow_name'] = $borrowinfo['borrow_name'];
     $list['borrow_interest_rate'] = $borrowinfo['borrow_interest_rate'];
     $list['borrow_money'] = $borrowinfo['borrow_money'];
     $list['transfer_out'] = $borrowinfo['transfer_out'];
     $list['per_transfer'] = $borrowinfo['per_transfer'];
     $list['borrow_duration'] = $borrowinfo['borrow_duration'] . "个月";
     $list['progress'] = $borrowinfo['progress'];
     $list['borrow_max'] = $borrowinfo['borrow_max'];
     $list['transfer_total'] = $borrowinfo['transfer_total'];
     $list['transfer_leave'] = $borrowinfo['transfer_total'] - $borrowinfo['transfer_out'];
     $list['transfer_back'] = $borrowinfo['transfer_back'];
     $list['borrow_breif'] = $borrowinfo['borrow_breif'];
     $list['reward'] = $borrowinfo['reward_rate'] . "%";
     $list['min_month'] = $borrowinfo['min_month'];
     $list['huankuan_type'] = "一次性还款";
     $minfo = M("members")->where("id={$borrowinfo['borrow_uid']}")->find();
     $list['user_name'] = $minfo['user_name'];
     $list['imgpath'] = get_avatar($borrowinfo['borrow_uid']);
     $list['addtime'] = date("Y-m-d", $borrowinfo['add_time']);
     ajaxmsg($list);
 }
 public function index()
 {
     $row['borrow_1'] = M('borrow_info')->where('borrow_status=0')->count('id');
     //初审
     $row['borrow_2'] = M('borrow_info')->where('borrow_status=4')->count('id');
     //复审
     $row['limit_a'] = M('member_apply')->where('apply_status=0')->count('id');
     //额度
     $row['data_up'] = M('member_data_info')->where('status=0')->count('id');
     //上传资料
     $row['vip_a'] = M('vip_apply')->where('status=0')->count('id');
     //VIP审核
     $row['video_a'] = M('video_apply')->where('apply_status=0')->count('id');
     //视频认证
     $row['face_a'] = M('face_apply')->where('apply_status=0')->count('id');
     //现场认证
     $row['real_a'] = M('members_status')->where('id_status=3')->count('uid');
     //现场认证
     $row['withdraw'] = M('member_withdraw')->where('withdraw_status=0')->count('id');
     //待审核提现
     $this->assign("row", $row);
     /////////////////////////////////////////////////////////////
     $sql_chart_1 = "select count(x.t) as e  from (select count(*) as t from lzh_borrow_info group by borrow_uid) as x";
     $chart1_borrow = M()->query($sql_chart_1);
     $memberCount = M("members")->count("*");
     $sql_chart_3 = "select count(x.t) as e  from (select count(*) as t from lzh_borrow_investor group by investor_uid) as x";
     $chart1_invest = M()->query($sql_chart_3);
     $chart_1_total = intval($memberCount) + intval($chart1_invest[0]['e']) + intval($chart1_borrow[0]['e']);
     $chart_1 = array("register" => intval($memberCount), "invest" => intval($chart1_invest[0]['e']), "borrow" => intval($chart1_borrow[0]['e']), "register_rate" => getfloatvalue(intval($memberCount) / $chart_1_total * 100, 2), "invest_rate" => getfloatvalue(intval($chart1_invest[0]['e']) / $chart_1_total * 100, 2));
     $this->assign("chart_one", $chart_1);
     $start = strtotime(date("Y-m-01", time()) . " 00:00:00");
     $end = strtotime(date("Y-m-t", time()) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month = array();
     $moneyMonth = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month['money_repayment'] = getFloatvalue($moneyMonth_r / 10000, 2);
     $month['money_normal'] = getFloatvalue($moneyMonth / 10000, 2);
     $month['money_transfer'] = getFloatvalue($moneyMonth_t / 10000, 2);
     $month['month'] = date("Y-m", $end);
     $start = strtotime("-1 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-1 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month1 = array();
     $moneyMonth1 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth1_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth1_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month1['money_repayment'] = getFloatvalue($moneyMonth1_r / 10000, 2);
     $month1['money_normal'] = getFloatvalue($moneyMonth1 / 10000, 2);
     $month1['money_transfer'] = getFloatvalue($moneyMonth1_t / 10000, 2);
     $month1['month'] = date("Y-m", $end);
     $start = strtotime("-2 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-2 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month2 = array();
     $moneyMonth2 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth2_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth2_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month2['money_repayment'] = getfloatvalue($moneyMonth2_r / 10000, 2);
     $month2['money_normal'] = getfloatvalue($moneyMonth2 / 10000, 2);
     $month2['money_transfer'] = getfloatvalue($moneyMonth2_t / 10000, 2);
     $month2['month'] = date("Y-m", $end);
     $start = strtotime("-3 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-3 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month3 = array();
     $moneyMonth3 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth3_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth3_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month3['money_repayment'] = getFloatvalue($moneyMonth3_r / 10000, 2);
     $month3['money_normal'] = getFloatvalue($moneyMonth3 / 10000, 2);
     $month3['money_transfer'] = getFloatvalue($moneyMonth3_t / 10000, 2);
     $month3['month'] = date("Y-m", $end);
     $start = strtotime("-4 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-4 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month4 = array();
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth4_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month4['money_repayment'] = getfloatvalue($moneyMonth4_r / 10000, 2);
     $moneyMonth4 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth4_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $month4['money_normal'] = getfloatvalue($moneyMonth4 / 10000, 2);
     $month4['money_transfer'] = getfloatvalue($moneyMonth4_t / 10000, 2);
     $month4['month'] = date("Y-m", $end);
     $start = strtotime("-5 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-5 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month5 = array();
     $moneyMonth5 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth5_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth5_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month5['money_repayment'] = getFloatvalue($moneyMonth5_r / 10000, 2);
     $month5['money_normal'] = getFloatvalue($moneyMonth5 / 10000, 2);
     $month5['money_transfer'] = getFloatvalue($moneyMonth5_t / 10000, 2);
     $month5['month'] = date("Y-m", $end);
     $start = strtotime("-6 months", strtotime(date("Y-m-01", time()) . " 00:00:00"));
     $end = strtotime(date("Y-m-t", strtotime("-6 months", time())) . " 23:59:59");
     $mapChart2 = array();
     $mapChart2['full_time'] = array("between", "{$start},{$end}");
     $mapChart2['borrow_status'] = array("in", "6,7,8,9");
     $mapTChart2 = array();
     $mapTChart2['add_time'] = array("between", "{$start},{$end}");
     $month6 = array();
     $moneyMonth6 = M("borrow_info")->where($mapChart2)->sum("borrow_money");
     $moneyMonth6_t = M("transfer_borrow_info")->where($mapTChart2)->sum("borrow_money");
     $mapRChart2 = array();
     $mapRChart2['repayment_time'] = array("between", "{$start},{$end}");
     $moneyMonth6_r = M("investor_detail")->where($mapRChart2)->sum("receive_capital");
     $month6['money_repayment'] = getFloatvalue($moneyMonth6_r / 10000, 2);
     $month6['money_normal'] = getFloatvalue($moneyMonth6 / 10000, 2);
     $month6['money_transfer'] = getFloatvalue($moneyMonth6_t / 10000, 2);
     $month6['month'] = date("Y-m", $end);
     $this->assign("month6", $month6);
     $this->assign("month5", $month5);
     $this->assign("month4", $month4);
     $this->assign("month3", $month3);
     $this->assign("month2", $month2);
     $this->assign("month1", $month1);
     $this->assign("month", $month);
     //dump($month2);exit;
     ////////////////////////////////////////////////////////////
     $this->getServiceInfo();
     $this->getAdminInfo();
     $this->display();
 }
 public function allinpay()
 {
     if ($this->payConfig['allinpay']['enable'] == 0) {
         exit("对不起,该支付方式被关闭,暂时不能使用!");
     }
     $this->getPaydetail();
     $submitdata['version'] = "v1.0";
     $submitdata['inputCharset'] = 1;
     $submitdata['language'] = 1;
     $submitdata['signType'] = 1;
     $submitdata['orderCurrency'] = 0;
     $submitdata['payerName'] = "";
     $submitdata['payerEmail'] = "";
     $submitdata['payerTelephone'] = "";
     $submitdata['payerIDCard'] = "";
     $submitdata['pid'] = "";
     $submitdata['orderExpireDatetime'] = "";
     $submitdata['orderNo'] = date("YmdHis") . mt_rand(100000, 999999);
     $submitdata['orderAmount'] = number_format($this->paydetail['money'], 2, ".", "") * 100;
     $submitdata['productName'] = '';
     //$this->glo['web_name']."帐户充值";
     $submitdata['productPrice'] = number_format($this->paydetail['money'], 2, ".", "") * 100;
     $submitdata['productNum'] = 1;
     $submitdata['productId'] = 1;
     $submitdata['productDescription'] = "";
     $submitdata['ext1'] = "";
     $submitdata['ext2'] = "";
     $submitdata['payType'] = 0;
     $submitdata['issuerId'] = "";
     $submitdata['pan'] = "";
     $submitdata['merchantId'] = $this->payConfig['allinpay']['MerCode'];
     $submitdata['orderDatetime'] = date("YmdHis");
     $submitdata['pickupUrl'] = $this->return_url . "?payid=allinpay";
     $submitdata['receiveUrl'] = $this->notice_url . "?payid=allinpay";
     $submitdata['signMsg'] = $this->getSign("allinpay", $submitdata);
     unset($this->paydetail['bank']);
     $this->paydetail['fee'] = getfloatvalue($this->payConfig['allinpay']['feerate'] * $this->paydetail['money'] / 100, 2);
     $this->paydetail['nid'] = $this->createnid("allinpay", $submitdata['orderNo']);
     $this->paydetail['way'] = "allinpay";
     M("member_payonline")->add($this->paydetail);
     $this->create($submitdata, "http://ceshi.allinpay.com/gateway/index.do");
     //测试环境
     //$this->create($submitdata,"http://service.allinpay.com/gateway/index.do" );//生产环境
 }