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); }
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); }
public function mobile() { /*if(!$GLOBALS['user_info']){ set_gopreview(); app_redirect(url("index","user#login")); }*/ $id = intval($_REQUEST['id']); $deal = get_deal($id); send_deal_contract_email($id, $deal, $deal['user_id']); if (!$deal) { app_redirect(url("index")); } //借款列表 $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']); $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']) { $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); $GLOBALS['tmpl']->assign("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); $GLOBALS['tmpl']->assign("user_statics", $user_statics); } $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)); 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", $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 . ","); //留言 require APP_ROOT_PATH . 'app/Lib/message.php'; require APP_ROOT_PATH . 'app/Lib/page.php'; $rel_table = 'deal'; $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', "deal"); //分页 $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']); if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } $GLOBALS['tmpl']->assign("deal", $deal); $GLOBALS['tmpl']->display("deal_mobile.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"); }
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); }