示例#1
0
 public function index()
 {
     $root = array();
     $id = intval($GLOBALS['request']['id']);
     $deal = get_deal($id);
     //send_deal_contract_email($id,$deal,$deal['user_id']);  //发送电子协议邮件
     $root['deal'] = $deal;
     //借款列表
     $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $id);
     $u_info = get_user("*", $deal['user_id']);
     //可用额度
     $can_use_quota = get_can_use_quota($deal['user_id']);
     $root['can_use_quota'] = $can_use_quota;
     $credit_file = get_user_credit_file($deal['user_id']);
     $deal['is_faved'] = 0;
     /*
     		if($GLOBALS['user_info']){
     			$deal['is_faved'] = $GLOBALS['db']->getOne("SELECT count(*) FROM ".DB_PREFIX."deal_collect WHERE deal_id = ".$id." AND user_id=".intval($GLOBALS['user_info']['id']));
     				
     			if($deal['deal_status'] >=4){
     				//还款列表
     				$loan_repay_list = get_deal_load_list($deal);
     				
     				$root['loan_repay_list']= $loan_repay_list;
     				
     				
     				foreach($load_list as $k=>$v){
     					$load_list[$k]['remain_money'] = $v['money'] - $GLOBALS['db']->getOne("SELECT sum(self_money) FROM ".DB_PREFIX."deal_load_repay WHERE user_id=".$v['user_id']." AND deal_id=".$id);
     					if($load_list[$k]['remain_money'] <=0){
     						$load_list[$k]['remain_money'] = 0;
     						$load_list[$k]['status'] = 1;
     					}
     				}
     			}
     			
     		}*/
     $user_statics = sys_user_status($deal['user_id'], true);
     $root['user_statics'] = $user_statics;
     //借款笔数
     $root['load_list'] = $load_list;
     $root['credit_file'] = $credit_file;
     $root['u_info'] = $u_info;
     //工作认证是否过期
     $root['expire'] = user_info_expire($u_info);
     //留言
     $message_list = $GLOBALS['db']->getAll("SELECT title,content,a.create_time,rel_id,a.user_id,a.is_effect,b.user_name FROM " . DB_PREFIX . "message as a left join " . DB_PREFIX . "user as b on  a.user_id = b.id WHERE rel_id = " . $id);
     $root['message'] = $message_list;
     //seo
     if ($deal['type_match_row']) {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name'];
     } else {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name'];
     }
     $root['page_title'] = $seo_title;
     $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name'];
     $root['page_keyword'] = $seo_keyword;
     $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name'];
     $root['seo_description'] = $seo_description;
     output($root);
 }
示例#2
0
function insert_load_user_tip_index()
{
    //输出未读的消息数
    $msg_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "msg_box where to_user_id = " . intval($GLOBALS['user_info']['id']) . " and is_read = 0 and is_delete = 0 and type = 0");
    $GLOBALS['tmpl']->assign("msg_count", intval($msg_count));
    $expire = array();
    if ($GLOBALS['user_info']) {
        $credit_file = get_user_credit_file($GLOBALS['user_info']['id'], $GLOBALS['user_info']);
        $GLOBALS['tmpl']->assign("credit_file", $credit_file);
    }
    return $GLOBALS['tmpl']->fetch("inc/insert/load_user_tip_index.html");
}
 public function index()
 {
     $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_CREDIT']);
     $list = load_auto_cache("level");
     $GLOBALS['tmpl']->assign("list", $list['list']);
     foreach ($list["list"] as $k => $v) {
         if ($v['id'] == $GLOBALS['user_info']['level_id']) {
             $user_point_level = $v['name'];
         }
     }
     //可用额度
     $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota);
     $credit_file = get_user_credit_file($GLOBALS['user_info']['id'], $GLOBALS['user_info']);
     //必要信用认证
     $level_point['need_other_point'] = 0;
     $must_credit_count = 0;
     $other_credit_count = 0;
     foreach ($credit_file as $k => $v) {
         if ($v['passed'] == 1) {
             $level_point['need_other_point'] += (int) trim($v['point']);
         }
         if ($v['must'] == 1) {
             $must_credit_count++;
         } else {
             $other_credit_count++;
         }
     }
     //还清
     $level_point['repay_success'] = $GLOBALS['db']->getRow("SELECT sum(point) as total_point,count(*) AS total_count FROM " . DB_PREFIX . "user_log WHERE log_info like '%还清借款%' AND user_id=" . $GLOBALS['user_info']['id']);
     //逾期
     $level_point['impose_repay'] = $GLOBALS['db']->getRow("SELECT sum(point) as total_point,count(*) AS total_count FROM " . DB_PREFIX . "user_log WHERE log_info like '%逾期还款%' and log_info not like '%严重逾期还款%' AND user_id=" . $GLOBALS['user_info']['id']);
     //严重逾期
     $level_point['yz_impose_repay'] = $GLOBALS['db']->getRow("SELECT sum(point) as total_point,count(*) AS total_count FROM " . DB_PREFIX . "user_log WHERE log_info like '%严重逾期还款%' AND user_id=" . $GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign('level_point', $level_point);
     $GLOBALS['tmpl']->assign("credit_file", $credit_file);
     $GLOBALS['tmpl']->assign("must_credit_count", $must_credit_count);
     $GLOBALS['tmpl']->assign("other_credit_count", $other_credit_count);
     $GLOBALS['tmpl']->assign("user_point_level", $user_point_level);
     $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_credit.html");
     $GLOBALS['tmpl']->display("page/uc.html");
 }
示例#4
0
 public function index()
 {
     $root = array();
     $id = intval($GLOBALS['request']['id']);
     $deal = get_deal($id);
     //send_deal_contract_email($id,$deal,$deal['user_id']);  //发送电子协议邮件
     $root['deal'] = $deal;
     //借款列表
     $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $id);
     $u_info = get_user("*", $deal['user_id']);
     //可用额度
     $can_use_quota = get_can_use_quota($deal['user_id']);
     $root['can_use_quota'] = $can_use_quota;
     $credit_file = get_user_credit_file($deal['user_id']);
     $deal['is_faved'] = 0;
     $user_statics = sys_user_status($deal['user_id'], true);
     $root['user_statics'] = $user_statics;
     //借款笔数
     $root['load_list'] = $load_list;
     $root['credit_file'] = $credit_file;
     $root['u_info'] = $u_info;
     //工作认证是否过期
     $root['expire'] = user_info_expire($u_info);
     //留言
     $message_list = $GLOBALS['db']->getAll("SELECT a.title,a.content,a.create_time,a.rel_id,a.user_id,a.is_effect,b.user_name FROM " . DB_PREFIX . "message as a left join " . DB_PREFIX . "user as b on  a.user_id = b.id WHERE a.rel_id = " . $id);
     $root['message'] = $message_list;
     //seo
     if ($deal['type_match_row']) {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name'];
     } else {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name'];
     }
     $root['page_title'] = $seo_title;
     $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name'];
     $root['page_keyword'] = $seo_keyword;
     $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name'];
     $root['seo_description'] = $seo_description;
     $root['program_title'] = "详细信息";
     output($root);
 }
示例#5
0
 public function creditswitch()
 {
     $info['title'] = "信用审核";
     $GLOBALS['tmpl']->assign("info", $info);
     $list = load_auto_cache("level");
     $GLOBALS['tmpl']->assign("list", $list['list']);
     foreach ($list["list"] as $k => $v) {
         if ($v['id'] == $GLOBALS['user_info']['level_id']) {
             $user_point_level = $v['name'];
         }
     }
     $GLOBALS['tmpl']->assign("user_point_level", $user_point_level);
     //可用额度
     $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota);
     $credit_file = get_user_credit_file($GLOBALS['user_info']['id'], $GLOBALS['user_info']);
     //必要信用认证
     $level_point['need_other_point'] = 0;
     $must_credit_count = 0;
     $other_credit_count = 0;
     foreach ($credit_file as $k => $v) {
         if ($v['passed'] == 1) {
             $level_point['need_other_point'] += (int) trim($v['point']);
         }
         if ($v['must'] == 1) {
             $must_credit_count++;
         } else {
             $other_credit_count++;
         }
     }
     $GLOBALS['tmpl']->assign('credit_file', $credit_file);
     $GLOBALS['tmpl']->assign("must_credit_count", $must_credit_count);
     $GLOBALS['tmpl']->assign("other_credit_count", $other_credit_count);
     //还清
     $level_point['repay_success'] = $GLOBALS['db']->getRow("SELECT sum(point) as total_point,count(*) AS total_count FROM " . DB_PREFIX . "user_log WHERE log_info like '%还清借款%' AND user_id=" . $GLOBALS['user_info']['id']);
     //逾期
     $level_point['impose_repay'] = $GLOBALS['db']->getRow("SELECT sum(point) as total_point,count(*) AS total_count FROM " . DB_PREFIX . "user_log WHERE log_info like '%逾期还款%' and log_info not like '%严重逾期还款%' AND user_id=" . $GLOBALS['user_info']['id']);
     //严重逾期
     $level_point['yz_impose_repay'] = $GLOBALS['db']->getRow("SELECT sum(point) as total_point,count(*) AS total_count FROM " . DB_PREFIX . "user_log WHERE log_info like '%严重逾期还款%' AND user_id=" . $GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign('level_point', $level_point);
     $seo_title = $info['seo_title'] != '' ? $info['seo_title'] : $info['title'];
     $GLOBALS['tmpl']->assign("page_title", $seo_title);
     $seo_keyword = $info['seo_keyword'] != '' ? $info['seo_keyword'] : $info['title'];
     $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ",");
     $seo_description = $info['seo_description'] != '' ? $info['seo_description'] : $info['title'];
     $GLOBALS['tmpl']->assign("page_description", $seo_description . ",");
     $GLOBALS['tmpl']->display("page/borrow_creditswitch.html");
 }
 function preview()
 {
     $deal['id'] = 'XXX';
     $deal_loan_type_list = load_auto_cache("deal_loan_type_list");
     if (intval($_REQUEST['quota']) == 1) {
         $deal = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "deal_quota_submit WHERE status=1 and user_id = " . $GLOBALS['user_info']['id'] . " ORDER BY id DESC");
         $type_id = intval($deal['type_id']);
         $deal['rate_foramt'] = number_format($deal['rate'], 2);
         $data['view_info'] = unserialize($deal['view_info']);
         if ($deal['cate_id'] > 0) {
             $deal['cate_info'] = $GLOBALS['db']->getRowCached("select id,name,brief,uname,icon from " . DB_PREFIX . "deal_cate where id = " . $deal['cate_id'] . " and is_effect = 1 and is_delete = 0");
         }
         $deal['repay_time'] = strim($_REQUEST['repay_time']);
         $deal['repay_time_type'] = 1;
     } else {
         $deal['name'] = strim($_REQUEST['borrowtitle']);
         $type_id = intval($_REQUEST['borrowtype']);
         $deal['repay_time_type'] = intval($_REQUEST['repaytime_type']);
         $deal['rate_foramt'] = number_format(strim($_REQUEST['apr']), 2);
         $deal['repay_time'] = strim($_REQUEST['repaytime']);
         $icon_type = strim($_REQUEST['imgtype']);
         $icon_type_arr = array('upload' => 1, 'userImg' => 2, 'systemImg' => 3);
         $data['icon_type'] = $icon_type_arr[$icon_type];
         switch ($data['icon_type']) {
             case 1:
                 $deal['icon'] = replace_public(strim($_REQUEST['icon']));
                 break;
             case 2:
                 $deal['icon'] = replace_public(get_user_avatar($GLOBALS['user_info']['id'], 'big'));
                 break;
             case 3:
                 $deal['icon'] = $GLOBALS['db']->getOneCached("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath']));
         }
         $deal['description'] = replace_public(valid_str(bstrim($_REQUEST['borrowdesc'])));
         $user_view_info = $GLOBALS['user_info']['view_info'];
         $user_view_info = unserialize($user_view_info);
         $new_view_info_arr = array();
         for ($i = 1; $i <= intval($_REQUEST['file_upload_count']); $i++) {
             $img_info = array();
             $img = replace_public(strim($_REQUEST['file_' . $i]));
             if ($img != "") {
                 $img_info['name'] = strim($_REQUEST['file_name_' . $i]);
                 $img_info['img'] = $img;
                 $img_info['is_user'] = 1;
                 $user_view_info[] = $img_info;
                 $ss = $user_view_info;
                 end($ss);
                 $key = key($ss);
                 $new_view_info_arr[$key] = $img_info;
             }
         }
         $data['view_info'] = array();
         foreach ($_REQUEST['file_key'] as $k => $v) {
             if (isset($user_view_info[$v])) {
                 $data['view_info'][$v] = $user_view_info[$v];
             }
         }
         foreach ($new_view_info_arr as $k => $v) {
             $data['view_info'][$k] = $v;
         }
         if ($deal['cate_id'] > 0) {
             $deal['cate_info']['name'] = "借款预览标";
         }
     }
     $deal['borrow_amount'] = strim($_REQUEST['borrowamount']);
     $deal['borrow_amount_format'] = format_price($deal['borrow_amount'] / 10000) . "万";
     $GLOBALS['tmpl']->assign('view_info_list', $data['view_info']);
     unset($data['view_info']);
     foreach ($deal_loan_type_list as $k => $v) {
         if ($v['id'] == $type_id) {
             $deal['type_info'] = $v;
         }
     }
     $deal['min_loan_money'] = 50;
     $deal['need_money'] = $deal['borrow_amount_format'];
     //本息还款金额
     $deal['month_repay_money'] = format_price(pl_it_formula($deal['borrow_amount'], strim($deal['rate']) / 12 / 100, $deal['repay_time']));
     if ($deal['agency_id'] > 0) {
         $deal['agency_info'] = $GLOBALS['db']->getRowCached("select * from " . DB_PREFIX . "deal_agency where id = " . $deal['agency_id'] . " and is_effect = 1");
     }
     $deal['progress_point'] = 0;
     $deal['buy_count'] = 0;
     $deal['voffice'] = 1;
     $deal['vjobtype'] = 1;
     $deal['is_delete'] = 2;
     $u_info = get_user("*", $GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign("u_info", $u_info);
     $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota);
     $credit_file = get_user_credit_file($GLOBALS['user_info']['id'], $u_info);
     $GLOBALS['tmpl']->assign("credit_file", $credit_file);
     $user_statics = sys_user_status($GLOBALS['user_info']['id'], true);
     $GLOBALS['tmpl']->assign("user_statics", $user_statics);
     $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name'];
     $GLOBALS['tmpl']->assign("page_title", $seo_title);
     $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name'];
     $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ",");
     $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name'];
     $GLOBALS['tmpl']->assign("seo_description", $seo_description . ",");
     $GLOBALS['tmpl']->assign("deal", $deal);
     $GLOBALS['tmpl']->display("page/deal.html");
 }
 public function detail()
 {
     /*if(!$GLOBALS['user_info']){
     			
     			app_redirect(url("index","user#login")); 
     		}*/
     set_gopreview();
     $id = intval($_REQUEST['id']);
     $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id);
     if ($deal_id == 0) {
         echo "不存在的债权";
         die;
     }
     $deal = get_deal($deal_id);
     syn_transfer_status($id);
     $deal['yq_count'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_repay WHERE has_repay = 1 and deal_id=" . $deal_id . " AND status >= 2");
     $GLOBALS['tmpl']->assign('deal', $deal);
     //借款列表
     $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $deal_id);
     $u_info = get_user("*", $deal['user_id']);
     if ($deal['view_info'] != "") {
         $view_info_list = unserialize($deal['view_info']);
         $GLOBALS['tmpl']->assign('view_info_list', $view_info_list);
     }
     //可用额度
     $can_use_quota = get_can_use_quota($deal['user_id']);
     $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota);
     $credit_file = get_user_credit_file($deal['user_id']);
     $deal['is_faved'] = 0;
     if ($GLOBALS['user_info']) {
         if ($u_info['user_type'] == 1) {
             $company = $GLOBALS['db']->getRowCached("SELECT * FROM " . DB_PREFIX . "user_company WHERE user_id=" . $u_info['id']);
         }
         if ($deal['deal_status'] >= 4) {
             //还款列表
             $loan_repay_list = get_deal_load_list($deal);
             $GLOBALS['tmpl']->assign("loan_repay_list", $loan_repay_list);
             if ($loan_repay_list) {
                 $temp_self_money_list = $GLOBALS['db']->getAllCached("SELECT sum(self_money) as total_money,u_key FROM " . DB_PREFIX . "deal_load_repay WHERE has_repay=1 AND deal_id=" . $id . " group by u_key ");
                 $self_money_list = array();
                 foreach ($temp_self_money_list as $k => $v) {
                     $self_money_list[$v['u_key']] = $v['total_money'];
                 }
                 foreach ($load_list as $k => $v) {
                     $load_list[$k]['remain_money'] = $v['money'] - $self_money_list[$k];
                     if ($load_list[$k]['remain_money'] <= 0) {
                         $load_list[$k]['remain_money'] = 0;
                         $load_list[$k]['status'] = 1;
                     }
                 }
             }
         }
         $user_statics = sys_user_status($deal['user_id'], true);
         $GLOBALS['tmpl']->assign("user_statics", $user_statics);
         $GLOBALS['tmpl']->assign("company", $company);
     }
     $GLOBALS['tmpl']->assign("load_list", $load_list);
     $GLOBALS['tmpl']->assign("credit_file", $credit_file);
     $GLOBALS['tmpl']->assign("u_info", $u_info);
     //工作认证是否过期
     $GLOBALS['tmpl']->assign('expire', user_info_expire($u_info));
     //留言
     require APP_ROOT_PATH . 'app/Lib/message.php';
     require APP_ROOT_PATH . 'app/Lib/page.php';
     $rel_table = 'transfer';
     $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "'");
     $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id;
     if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
         $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']);
     } else {
         if ($message_type['is_effect'] == 0) {
             $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']);
         }
     }
     //message_form 变量输出
     $GLOBALS['tmpl']->assign('rel_id', $id);
     $GLOBALS['tmpl']->assign('rel_table', $rel_table);
     //分页
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     $msg_condition = $condition . " AND is_effect = 1 ";
     $message = get_message_list($limit, $msg_condition);
     $page = new Page($message['count'], app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     foreach ($message['list'] as $k => $v) {
         $msg_sub = get_message_list("", "pid=" . $v['id'], false);
         $message['list'][$k]["sub"] = $msg_sub["list"];
     }
     $GLOBALS['tmpl']->assign("message_list", $message['list']);
     //==================================================
     $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0  and d.repay_time_type =1 and  d.publish_wait=0 ';
     $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id ";
     $transfer = get_transfer($union_sql, $condition);
     $GLOBALS['tmpl']->assign('transfer', $transfer);
     if ($deal['type_match_row']) {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name'];
     } else {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name'];
     }
     $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['TRANSFER'] . " - " . $seo_title);
     $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name'];
     $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['TRANSFER'] . "," . $seo_keyword . ",");
     $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name'];
     $GLOBALS['tmpl']->assign("seo_description", $GLOBALS['lang']['TRANSFER'] . "," . $seo_description . ",");
     $GLOBALS['tmpl']->assign("deal", $deal);
     $GLOBALS['tmpl']->display("page/transfer.html");
 }
示例#8
0
 public function level()
 {
     $GLOBALS['tmpl']->caching = true;
     $GLOBALS['tmpl']->cache_lifetime = 600;
     $cache_id = md5(MODULE_NAME . ACTION_NAME . trim($_REQUEST['id']));
     if (!$GLOBALS['tmpl']->is_cached('page/space_credit.html', $cache_id)) {
         $this->init();
         $title = sprintf($GLOBALS['lang']['WHOS_SPACE'], $this->space_user['user_name']);
         $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/");
         $site_nav[] = array('name' => $title, 'url' => url("index", "space#deal", array("id" => $this->space_user['id'])));
         $site_nav[] = array('name' => $GLOBALS['lang']['SPACE_DEAL'], 'url' => url("index", "space#deal", array("id" => $this->space_user['id'])));
         $GLOBALS['tmpl']->assign("site_nav", $site_nav);
         $list = load_auto_cache("level");
         $GLOBALS['tmpl']->assign("list", $list['list']);
         foreach ($list["list"] as $k => $v) {
             if ($v['id'] == $this->space_user['level_id']) {
                 $user_point_level = $v['name'];
             }
         }
         $GLOBALS['tmpl']->assign("user_point_level", $user_point_level);
         $credit_file = get_user_credit_file($GLOBALS['user_info']['id'], $this->space_user);
         //必要信用认证
         $level_point['need_other_point'] = 0;
         $must_credit_count = 0;
         $other_credit_count = 0;
         foreach ($credit_file as $k => $v) {
             if ($v['passed'] == 1) {
                 $level_point['need_other_point'] += (int) trim($v['point']);
             }
             if ($v['must'] == 1) {
                 $must_credit_count++;
             } else {
                 $other_credit_count++;
             }
         }
         //工作认证是否过期
         $GLOBALS['tmpl']->assign('expire', $this->space_user);
         //还清
         $level_point['repay_success'] = $GLOBALS['db']->getRow("SELECT sum(point) as total_point,count(*) AS total_count FROM " . DB_PREFIX . "user_log WHERE log_info like '%还清借款%' AND user_id=" . $this->space_user['id']);
         //逾期
         $level_point['impose_repay'] = $GLOBALS['db']->getRow("SELECT sum(point) as total_point,count(*) AS total_count FROM " . DB_PREFIX . "user_log WHERE log_info like '%逾期还款%' and log_info not like '%严重逾期还款%' AND user_id=" . $this->space_user['id']);
         //严重逾期
         $level_point['yz_impose_repay'] = $GLOBALS['db']->getRow("SELECT sum(point) as total_point,count(*) AS total_count FROM " . DB_PREFIX . "user_log WHERE log_info like '%严重逾期还款%' AND user_id=" . $this->space_user['id']);
         $GLOBALS['tmpl']->assign('level_point', $level_point);
         $GLOBALS['tmpl']->assign("credit_file", $credit_file);
         $GLOBALS['tmpl']->assign("must_credit_count", $must_credit_count);
         $GLOBALS['tmpl']->assign("other_credit_count", $other_credit_count);
         //可用额度
         $can_use_quota = get_can_use_quota($this->space_user['id']);
         $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota);
         $GLOBALS['tmpl']->assign("page_title", $title);
         $GLOBALS['tmpl']->assign("page_keyword", $title . ",");
         $GLOBALS['tmpl']->assign("page_description", $title . ",");
     }
     $GLOBALS['tmpl']->display("page/space_credit.html", $cache_id);
 }
示例#9
0
 public function dcontract()
 {
     $id = intval($_REQUEST['id']);
     if ($id == 0) {
         showErr("操作失败!");
     }
     $deal = get_deal($id);
     if (!$deal) {
         showErr("操作失败!");
     }
     $load_user_id = $GLOBALS['db']->getOne("select user_id FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " and user_id=" . $GLOBALS['user_info']['id'] . " ORDER BY create_time ASC");
     if ($load_user_id == 0 && $deal['user_id'] != $GLOBALS['user_info']['id']) {
         showErr("操作失败!");
     }
     if ($deal['agency_id'] > 0) {
         $agency = $GLOBALS['db']->getRow("select * FROM " . DB_PREFIX . "deal_agency WHERE id=" . $deal['agency_id'] . " ");
         $deal['agency_name'] = $agency['name'];
         $deal['agency_address'] = $agency['address'];
     }
     $GLOBALS['tmpl']->assign('deal', $deal);
     $loan_list = $GLOBALS['db']->getAll("select * FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " ORDER BY create_time ASC");
     foreach ($loan_list as $k => $v) {
         if ($deal['loantype'] == 0) {
             $loan_list[$k]['get_repay_money'] = pl_it_formula($v['money'], $deal['rate'] / 12 / 100, $deal['repay_time']);
         } elseif ($deal['loantype'] == 1) {
             $loan_list[$k]['get_repay_money'] = av_it_formula($v['money'], $deal['rate'] / 12 / 100);
         } elseif ($deal['loantype'] == 2) {
             $loan_list[$k]['get_repay_money'] = $v['money'] * $deal['rate'] / 12 / 100 * $deal['repay_time'] + $v['money'];
         }
         if ($deal['repay_time_type'] == 0) {
             $loan_list[$k]['get_repay_money'] = $v['money'] * $deal['rate'] / 12 / 100 + $v['money'];
         }
     }
     $GLOBALS['tmpl']->assign('loan_list', $loan_list);
     $u_info = get_user("*", $deal['user_id']);
     $GLOBALS['tmpl']->assign('user_info', $u_info);
     if ($u_info['sealpassed'] == 1) {
         $credit_file = get_user_credit_file($deal['user_id']);
         $GLOBALS['tmpl']->assign('user_seal_url', $credit_file['credit_seal']['file_list'][0]);
     }
     if ($deal['agency_id'] > 0) {
         $contract = $GLOBALS['tmpl']->fetch("str:" . app_conf("CONTRACT_1"));
     } else {
         $contract = $GLOBALS['tmpl']->fetch("str:" . app_conf("CONTRACT_0"));
     }
     $GLOBALS['tmpl']->assign('contract', $contract);
     header("Content-type:text/html;charset=utf-8");
     header("Content-Disposition: attachment; filename=借款协议.html");
     echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
     echo '<html>';
     echo '<head>';
     echo '<title>借款协议</title>';
     echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
     echo '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
     echo $GLOBALS['tmpl']->fetch("inc/uc/uc_deal_contract.html");
     echo '</body>';
     echo '</html>';
 }
示例#10
0
 public function dcontract()
 {
     $id = intval($_REQUEST['id']);
     if ($id == 0) {
         showErr("操作失败!");
     }
     $deal = get_deal($id);
     if (!$deal) {
         showErr("操作失败!");
     }
     $load_user_id = $GLOBALS['db']->getOne("select user_id FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " and user_id=" . $GLOBALS['user_info']['id'] . " ORDER BY create_time ASC");
     if ($load_user_id == 0 && $deal['user_id'] != $GLOBALS['user_info']['id']) {
         showErr("操作失败!");
     }
     $GLOBALS['tmpl']->assign('deal', $deal);
     $loan_list = $GLOBALS['db']->getAll("select * FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " ORDER BY create_time ASC");
     foreach ($loan_list as $k => $v) {
         $vv_deal['borrow_amount'] = $v['money'];
         $vv_deal['rate'] = $deal['rate'];
         $vv_deal['repay_time'] = $deal['repay_time'];
         $vv_deal['loantype'] = $deal['loantype'];
         $vv_deal['repay_time_type'] = $deal['repay_time_type'];
         $deal_rs = deal_repay_money($vv_deal);
         $loan_list[$k]['get_repay_money'] = $deal_rs['month_repay_money'];
         if (is_last_repay($deal['loantype'])) {
             $loan_list[$k]['get_repay_money'] = $deal_rs['remain_repay_money'];
         }
     }
     $GLOBALS['tmpl']->assign('loan_list', $loan_list);
     $u_info = get_user("*", $deal['user_id']);
     $GLOBALS['tmpl']->assign('user_info', $u_info);
     if ($u_info['sealpassed'] == 1) {
         $credit_file = get_user_credit_file($deal['user_id']);
         $GLOBALS['tmpl']->assign('user_seal_url', $credit_file['credit_seal']['file_list'][0]);
     }
     $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN));
     $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE"));
     $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT"));
     $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($deal['contract_id']));
     $GLOBALS['tmpl']->assign('contract', $contract);
     /*header("Content-type:text/html;charset=utf-8");
     		header("Content-Disposition: attachment; filename=借款协议.html");
     		
     		echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
     		echo '<html>';
     		echo '<head>';
     		echo '<title>借款协议</title>';
     		echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
     		echo '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
     		echo  $GLOBALS['tmpl']->fetch("inc/uc/uc_deal_contract.html");
     		echo '</body>';
     		echo '</html>';*/
     require APP_ROOT_PATH . "/system/utils/word.php";
     $word = new word();
     $word->start();
     $wordname = "借款协议.doc";
     echo $GLOBALS['tmpl']->fetch("inc/uc/uc_deal_contract.html");
     $word->save($wordname);
 }
示例#11
0
function send_deal_contract_email($deal_id, $deal, $user_id)
{
    if ($deal_id == 0 && !$deal) {
        return false;
    }
    if (app_conf('MAIL_ON') == 0 || app_conf('MAIL_SEND_CONTRACT_ON') == 0) {
        return false;
    }
    if (!$deal) {
        $deal = get_deal($deal_id);
    }
    if (intval($deal['is_send_contract']) == 1 || $deal['deal_status'] != 4) {
        return false;
    }
    $GLOBALS['tmpl']->assign('deal', $deal);
    $loan_list = $GLOBALS['db']->getAll("select * FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $deal_id . " ORDER BY create_time ASC");
    foreach ($loan_list as $k => $v) {
        $vv_deal['borrow_amount'] = $v['money'];
        $vv_deal['rate'] = $deal['rate'];
        $vv_deal['repay_time'] = $deal['repay_time'];
        $vv_deal['loantype'] = $deal['loantype'];
        $vv_deal['repay_time_type'] = $deal['repay_time_type'];
        $deal_rs = deal_repay_money($vv_deal);
        $loan_list[$k]['get_repay_money'] = $deal_rs['month_repay_money'];
        if (is_last_repay($deal['loantype'])) {
            $loan_list[$k]['get_repay_money'] = $deal_rs['remain_repay_money'];
        }
    }
    $GLOBALS['tmpl']->assign('loan_list', $loan_list);
    $u_info = get_user("*", $deal['user_id']);
    $GLOBALS['tmpl']->assign('user_info', $u_info);
    if ($u_info['sealpassed'] == 1) {
        $credit_file = get_user_credit_file($deal['user_id']);
        $GLOBALS['tmpl']->assign('user_seal_url', $credit_file['credit_seal']['file_list'][0]);
    }
    $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN));
    $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE"));
    $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT"));
    $msg = $GLOBALS['tmpl']->fetch("str:" . get_contract($deal['contract_id']));
    $msg = "<div style=\"font-size:12px\"><div style=\"background-color: #FFFFFF; border:#dfe6ea solid 1px; padding: 5px 12px;\">" . $msg;
    $msg .= "</div></div>";
    $msg_data['dest'] = $u_info['email'];
    $msg_data['send_type'] = 1;
    $msg_data['title'] = "借款“" . $deal['name'] . "”的电子协议!";
    $msg_data['content'] = addslashes($msg);
    $msg_data['send_time'] = 0;
    $msg_data['is_send'] = 0;
    $msg_data['create_time'] = TIME_UTC;
    $msg_data['user_id'] = $deal['user_id'];
    $msg_data['is_html'] = 1;
    //插入数据库
    if ($GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data)) {
        $GLOBALS['db']->query("UPDATE " . DB_PREFIX . "deal set is_send_contract =1 where id =" . $deal['id']);
    }
    //获取投资者的邮件
    $load_user_list = $GLOBALS['db']->getAll("SELECT u.user_name,u.email,u.id FROM " . DB_PREFIX . "user u LEFT JOIN  " . DB_PREFIX . "deal_load dl ON u.id=dl.user_id WHERE dl.deal_id=" . $deal['id']);
    foreach ($load_user_list as $k => $v) {
        $msg_data['dest'] = $v['email'];
        $msg_data['send_type'] = 1;
        $msg_data['title'] = "借款“" . $deal['name'] . "”的电子协议!";
        $msg_data['content'] = addslashes($msg);
        $msg_data['send_time'] = 0;
        $msg_data['is_send'] = 0;
        $msg_data['create_time'] = TIME_UTC;
        $msg_data['user_id'] = $v['id'];
        $msg_data['is_html'] = 1;
        //插入数据库
        $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data);
    }
}
示例#12
0
function format_deal_item(&$deal, $user_name = "", $user_pwd = "")
{
    //判断是否已经开始
    $deal['is_wait'] = 0;
    if ($deal['start_time'] > TIME_UTC) {
        $deal['is_wait'] = 1;
        $deal['remain_time'] = $deal['start_time'] - TIME_UTC;
    } else {
        $deal['remain_time'] = $deal['start_time'] + $deal['enddate'] * 24 * 3600 - TIME_UTC;
    }
    //当为天的时候
    if ($deal['repay_time_type'] == 0) {
        $true_repay_time = 1;
    } else {
        $true_repay_time = $deal['repay_time'];
    }
    if (trim($deal['titlecolor']) != '') {
        $deal['color_name'] = "<span style='color:#" . $deal['titlecolor'] . "'>" . $deal['name'] . "</span>";
    } else {
        $deal['color_name'] = $deal['name'];
    }
    //格式化数据
    if ($deal['apart_borrow_amount']) {
        $deal['borrow_amount_format'] = format_price($deal['apart_borrow_amount'] / 10000) . "万";
    } else {
        $deal['borrow_amount_format'] = format_price($deal['borrow_amount'] / 10000) . "万";
    }
    $deal['load_money_format'] = format_price($deal['load_money'] / 10000) . "万";
    $deal['rate_foramt'] = number_format($deal['rate'], 2);
    $deal['create_time_format'] = to_date($deal['create_time'], 'Y-m-d');
    //$deal['borrow_amount_format_w'] = format_price($deal['borrow_amount']/10000)."万";
    $deal['rate_foramt_w'] = number_format($deal['rate'], 2) . "%";
    $deal_repay_rs = deal_repay_money($deal);
    //本息还款金额
    $deal['month_repay_money'] = $deal_repay_rs['month_repay_money'];
    //最后一期还款
    $deal['last_month_repay_money'] = $deal_repay_rs['last_month_repay_money'];
    $deal['month_repay_money_format'] = format_price($deal['month_repay_money']);
    //到期还本息管理费
    $deal['month_manage_money'] = $deal['borrow_amount'] * (double) $deal['manage_fee'] / 100;
    $deal['month_manage_money_format'] = format_price($deal['month_manage_money']);
    //总的多少管理费
    if ($deal['repay_time_type'] == 1) {
        $deal['all_manage_money'] = $deal['month_manage_money'] * $deal["repay_time"];
    } else {
        $deal['all_manage_money'] = $deal['month_manage_money'];
    }
    if (is_last_repay($deal['loantype'])) {
        $deal['true_month_repay_money'] = $deal['month_repay_money'] + $deal['all_manage_money'];
        $deal['true_last_month_repay_money'] = $deal['last_month_repay_money'] + $deal['all_manage_money'];
    } else {
        $deal['true_month_repay_money'] = $deal['month_repay_money'] + $deal['month_manage_money'];
        $deal['true_last_month_repay_money'] = $deal['last_month_repay_money'] + $deal['month_manage_money'];
    }
    $deal['true_month_repay_money_format'] = format_price($deal['true_month_repay_money']);
    //还需多少钱
    $deal['need_money'] = format_price($deal['borrow_amount'] - $deal['load_money']);
    //百分比
    $deal['progress_point'] = $deal['load_money'] / $deal['borrow_amount'] * 100;
    $deal['user'] = get_user("user_name,level_id,province_id,city_id,university,u_special,u_year,u_alipay", $deal['user_id']);
    if ($deal['cate_id'] > 0) {
        $deal['cate_info'] = $GLOBALS['db']->getRow("select id,name,brief,uname,icon from " . DB_PREFIX . "deal_cate where id = " . $deal['cate_id'] . " and is_effect = 1 and is_delete = 0", false);
    }
    if ($deal['type_id'] > 0) {
        $deal['type_info'] = get_loantype_info($deal['type_id']);
        if ($deal['deal_status'] == 0) {
            $deal['need_credit'] = 0;
            //0不需要材料,1需要材料
            $credits = unserialize($deal['type_info']['credits']);
            $user_credit = get_user_credit_file($deal['user_id']);
            foreach ($credits as $kk => $vv) {
                if ($user_credit[$vv]['passed'] == 0) {
                    $deal['need_credit'] += 1;
                }
            }
        }
    }
    if ($deal['agency_id'] > 0) {
        $deal['agency_info'] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $deal['agency_id'] . " and is_effect = 1", false);
        if ($deal['agency_info']['view_info'] != "") {
            $deal['agency_info']['view_info_list'] = unserialize($deal['agency_info']['view_info']);
        }
    }
    if ($deal['deal_status'] != 1 || $deal['remain_time'] <= 0) {
        $deal['remain_time_format'] = "0" . $GLOBALS['lang']['DAY'] . "0" . $GLOBALS['lang']['HOUR'] . "0" . $GLOBALS['lang']['MIN'];
    } else {
        $deal['remain_time_format'] = remain_time($deal['remain_time']);
    }
    $deal['min_loan_money_format'] = format_price($deal['min_loan_money']);
    if ($deal['uloadtype'] == 1) {
        if ($deal['buy_count'] == 0) {
            $deal['buy_portion'] = 0;
        } else {
            $deal['buy_portion'] = intval($deal['load_money'] / $deal['min_loan_money']);
        }
        $deal['need_portion'] = intval(($deal['borrow_amount'] - $deal['load_money']) / $deal['min_loan_money']);
    }
    if ($deal['deal_status'] >= 4) {
        //总的必须还多少本息
        $deal['remain_repay_money'] = $deal_repay_rs['remain_repay_money'];
        //还有多少需要还
        $deal['need_remain_repay_money'] = floatval($deal['remain_repay_money']) - floatval($deal['repay_money']);
        //还款进度条
        if ($deal['remain_repay_money'] > 0) {
            $deal['repay_progress_point'] = $deal['repay_money'] / $deal['remain_repay_money'] * 100;
            if ($deal['deal_status'] == 5) {
                $deal['progress_point'] = 100;
            } else {
                $deal['progress_point'] = $deal['repay_progress_point'];
            }
        } else {
            $deal['repay_progress_point'] = 0;
        }
        //最后的还款日期
        if ($deal['repay_time_type'] == 0) {
            $deal["end_repay_time"] = $deal['repay_start_time'] + $deal['repay_time'] * 24 * 3600;
        } else {
            $deal["end_repay_time"] = next_replay_month($deal['repay_start_time'], $true_repay_time);
        }
        if ($deal['deal_status'] == 4) {
            $has_repay_money = $GLOBALS['db']->getOne("SELECT sum(true_repay_money + impose_money + true_repay_manage_money + repay_manage_impose_money) FROM " . DB_PREFIX . "deal_load_repay WHERE deal_id=" . $deal['id'] . " AND repay_time=" . $deal['next_repay_time']);
            $deal['true_month_repay_money'] = $deal['true_month_repay_money'] - floatval($has_repay_money);
            $deal['true_last_month_repay_money'] = $deal['true_last_month_repay_money'] - floatval($has_repay_money);
            $deal["next_repay_time_format"] = to_date($deal['next_repay_time'], 'Y-m-d');
            if (to_date($deal["end_repay_time"], "Ymd") < to_date(TIME_UTC, "Ymd")) {
                $deal['exceed_the_time'] = true;
            }
            //罚息
            $is_check_impose = true;
            //到期还本息 只有最后一个月后才算罚息
            if ($deal_repay_rs['is_check_impose'] == true) {
                //算出到期还本息的最后一个月是否小于今天
                if ($deal['exceed_the_time']) {
                    $is_check_impose = true;
                } else {
                    $is_check_impose = false;
                }
            }
            if ($deal["next_repay_time"] - TIME_UTC < 0 && $is_check_impose) {
                //晚多少天
                $time_span = to_timespan(to_date(TIME_UTC, "Y-m-d"), "Y-m-d");
                $next_time_span = to_timespan(to_date($deal['next_repay_time'], "Y-m-d"), "Y-m-d");
                $day = ceil(($time_span - $next_time_span) / 24 / 3600);
                $impose_fee = trim($deal['impose_fee_day1']);
                $manage_impose_fee = trim($deal['manage_impose_fee_day1']);
                //判断是否严重逾期
                if ($day >= app_conf('YZ_IMPSE_DAY')) {
                    $impose_fee = trim($deal['impose_fee_day2']);
                    $manage_impose_fee = trim($deal['manage_impose_fee_day2']);
                }
                $impose_fee = floatval($impose_fee);
                $manage_impose_fee = floatval($manage_impose_fee);
                //罚息
                if ((int) $deal['next_repay_time'] == (int) $deal['end_repay_time']) {
                    $deal['impose_money'] = $deal['last_month_repay_money'] * $impose_fee * $day / 100;
                    $deal['manage_impose_money'] = $deal['last_month_repay_money'] * $manage_impose_fee * $day / 100;
                } else {
                    $deal['impose_money'] = $deal['month_repay_money'] * $impose_fee * $day / 100;
                    //罚管理费
                    $deal['manage_impose_money'] = $deal['month_repay_money'] * $manage_impose_fee * $day / 100;
                }
                $deal['impose_money'] += $deal['manage_impose_money'];
            }
        }
    }
    if ($deal['publish_wait'] == 1 || $deal['publish_wait'] == 0) {
        $deal['publish_time_format'] = to_date($deal['create_time'], 'Y-m-d H:i');
    } else {
        $deal['publish_time_format'] = to_date($deal['start_time'], 'Y-m-d H:i');
    }
    $durl = url("index", "deal", array("id" => $deal['id']));
    $deal['share_url'] = SITE_DOMAIN . APP_ROOT . $durl;
    if ($GLOBALS['user_info']) {
        if (app_conf("URL_MODEL") == 0) {
            $deal['share_url'] .= "&r=" . base64_encode(intval($GLOBALS['user_info']['id']));
        } else {
            $deal['share_url'] .= "?r=" . base64_encode(intval($GLOBALS['user_info']['id']));
        }
    }
    $deal['url'] = $durl;
    if (!empty($user_name) && !empty($user_pwd)) {
        $durl = "/index.php?ctl=uc_deal&act=mrefdetail&is_sj=1&id=" . $deal['id'] . "&user_name=" . $user_name . "&user_pwd=" . $user_pwd;
    } else {
        $durl = "/index.php?ctl=deal&act=mobile&is_sj=1&id=" . $deal['id'];
    }
    $deal['app_url'] = str_replace("/mapi", "", SITE_DOMAIN . APP_ROOT . $durl);
}
示例#13
0
 function dcontact()
 {
     $win = 1;
     $id = intval($_REQUEST['id']);
     $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['T_CONTACT'] . ' - ' . $GLOBALS['lang']['TOOLS']);
     if ($id > 0) {
         require APP_ROOT_PATH . "app/Lib/deal.php";
         $deal = get_deal($id);
         if ($deal) {
             $GLOBALS['tmpl']->assign('deal', $deal);
             $loan_list = $GLOBALS['db']->getAll("select * FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " ORDER BY create_time ASC");
             foreach ($loan_list as $k => $v) {
                 $vv_deal['borrow_amount'] = $v['money'];
                 $vv_deal['rate'] = $deal['rate'];
                 $vv_deal['repay_time'] = $deal['repay_time'];
                 $vv_deal['loantype'] = $deal['loantype'];
                 $vv_deal['repay_time_type'] = $deal['repay_time_type'];
                 $deal_rs = deal_repay_money($vv_deal);
                 $loan_list[$k]['get_repay_money'] = $deal_rs['month_repay_money'];
                 if (is_last_repay($deal['loantype'])) {
                     $loan_list[$k]['get_repay_money'] = $deal_rs['remain_repay_money'];
                 }
                 $loan_list[$k]['user_name'] = utf_substr($v['user_name']);
             }
             $GLOBALS['tmpl']->assign('loan_list', $loan_list);
             $u_info = get_user("*", $deal['user_id']);
             $GLOBALS['tmpl']->assign('user_info', $u_info);
             if ($u_info['sealpassed'] == 1) {
                 $credit_file = get_user_credit_file($deal['user_id']);
                 $GLOBALS['tmpl']->assign('user_seal_url', $credit_file['credit_seal']['file_list'][0]);
             }
             $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN));
             $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE"));
             $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT"));
             $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($deal['contract_id']));
             $GLOBALS['tmpl']->assign('contract', $contract);
         }
     }
     require APP_ROOT_PATH . "/system/utils/word.php";
     $word = new word();
     $word->start();
     $wordname = "借款协议.doc";
     echo $GLOBALS['tmpl']->fetch("inc/tool/contact.html");
     $word->save($wordname);
 }
示例#14
0
 public function index()
 {
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     $id = intval($GLOBALS['request']['id']);
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         require APP_ROOT_PATH . 'app/Lib/uc.php';
         require APP_ROOT_PATH . 'app/Lib/deal.php';
         //	require_once APP_ROOT_PATH.'system/common.php';
         $root['user_login_status'] = 1;
         $root['response_code'] = 1;
         if ($id == 0) {
             showErr("操作失败!");
         }
         $deal = get_deal($id);
         if (!$deal) {
             showErr("操作失败!");
         }
         $load_user_id = $GLOBALS['db']->getOne("select user_id FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " and user_id=" . $GLOBALS['user_info']['id'] . " ORDER BY create_time ASC");
         if ($load_user_id == 0 && $deal['user_id'] != $GLOBALS['user_info']['id']) {
             showErr("操作失败!");
         }
         //$root['deal'] = $deal;
         $loan_list = $GLOBALS['db']->getAll("select * FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id . " ORDER BY create_time ASC");
         foreach ($loan_list as $k => $v) {
             $vv_deal['borrow_amount'] = $v['money'];
             $vv_deal['rate'] = $deal['rate'];
             $vv_deal['repay_time'] = $deal['repay_time'];
             $vv_deal['loantype'] = $deal['loantype'];
             $vv_deal['repay_time_type'] = $deal['repay_time_type'];
             $deal_rs = deal_repay_money($vv_deal);
             $loan_list[$k]['get_repay_money'] = $deal_rs['month_repay_money'];
             if (is_last_repay($deal['loantype'])) {
                 $loan_list[$k]['get_repay_money'] = $deal_rs['remain_repay_money'];
             }
         }
         //$root['loan_list'] = $loan_list;
         $u_info = get_user("*", $deal['user_id']);
         //$root['user_info'] = $u_info;
         if ($u_info['sealpassed'] == 1) {
             $credit_file = get_user_credit_file($deal['user_id']);
             //$GLOBALS['tmpl']->assign('user_seal_url',$credit_file['credit_seal']['file_list'][0]);
             $root['user_seal_url'] = $credit_file['credit_seal']['file_list'][0];
         }
         //			$GLOBALS['tmpl']->assign('SITE_URL',str_replace(array("https://","http://"),"",SITE_DOMAIN));
         //			$GLOBALS['tmpl']->assign('SITE_TITLE',app_conf("SITE_TITLE"));
         //			$GLOBALS['tmpl']->assign('CURRENCY_UNIT',app_conf("CURRENCY_UNIT"));
         //			$root['SITE_URL'] = str_replace(array("https://","http://"),"",SITE_DOMAIN);
         //			$root['SITE_TITLE'] = app_conf("SITE_TITLE");
         //			$root['CURRENCY_UNIT'] = app_conf("CURRENCY_UNIT");
         $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($deal['contract_id']));
         $root['contract'] = $contract;
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
 public function index()
 {
     $root = array();
     //set_gopreview();
     $deal_id = intval($GLOBALS['request']['id']);
     $root['deal_id'] = $deal_id;
     if ($deal_id == 0) {
         echo "不存在的债权";
         die;
     }
     $deal = get_deal($deal_id);
     //syn_transfer_status($id);
     $deal['yq_count'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_repay WHERE has_repay = 1 and deal_id=" . $deal_id . " AND status >= 2");
     $root['deal'] = $deal;
     //借款列表
     $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $deal_id);
     $u_info = get_user("*", $deal['user_id']);
     //可用额度
     $can_use_quota = get_can_use_quota($deal['user_id']);
     $root['can_use_quota'] = $can_use_quota;
     $credit_file = get_user_credit_file($deal['user_id']);
     $deal['is_faved'] = 0;
     $user_statics = sys_user_status($deal['user_id'], true);
     $root['user_statics'] = $user_statics;
     $root['load_list'] = $load_list;
     $root['credit_file'] = $credit_file;
     $root['u_info'] = $u_info;
     //工作认证是否过期
     $root['expire'] = user_info_expire($u_info);
     //留言
     $message_list = $GLOBALS['db']->getAll("SELECT title,content,a.create_time,rel_id,a.user_id,a.is_effect,b.user_name FROM " . DB_PREFIX . "message as a left join " . DB_PREFIX . "user as b on  a.user_id = b.id WHERE rel_id = " . $id);
     $root['message'] = $message_list;
     /*
     //分页
     $page = intval($_REQUEST['p']);
     if($page==0)
     	$page = 1;
     $limit = (($page-1)*app_conf("PAGE_SIZE")).",".app_conf("PAGE_SIZE");
     $msg_condition = $condition." AND is_effect = 1 ";
     $message = get_message_list($limit,$msg_condition);
     $page = new Page($message['count'],app_conf("PAGE_SIZE"));   //初始化分页对象
     $p  =  $page->show();
     $root['pages']= $p;
     */
     foreach ($message['list'] as $k => $v) {
         $msg_sub = get_message_list("", "pid=" . $v['id'], false);
         $message['list'][$k]["sub"] = $msg_sub["list"];
     }
     $root['message_list'] = $message['list'];
     $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0  and d.repay_time_type =1 and  d.publish_wait=0 ';
     $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id ";
     $transfer = get_transfer($union_sql, $condition);
     $root['transfer'] = $transfer;
     if ($deal['type_match_row']) {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name'];
     } else {
         $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name'];
     }
     $root['page_title'] = $seo_title;
     $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name'];
     $root['page_keyword'] = $seo_keyword;
     $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name'];
     $root['seo_description'] = $seo_description;
     output($root);
 }