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); }
function ajax_calculate() { $deal['loantype'] = intval($_REQUEST['borrowpay']); $deal['borrow_amount'] = intval($_REQUEST['borrowamount']); $deal['repay_time'] = intval($_REQUEST['repaytime']); $deal['repay_time_type'] = intval($_REQUEST['repaytimetype']); $deal['rate'] = trim($_REQUEST['apr']); $deal['repay_start_time'] = to_timespan(to_date(TIME_UTC, "Y-m-d")); $deal_repay_rs = deal_repay_money($deal); $deal['month_repay_money'] = $deal_repay_rs['month_repay_money']; //总的必须还多少本息 $deal['remain_repay_money'] = $deal_repay_rs['remain_repay_money']; //最后一期还款 $deal['last_month_repay_money'] = $deal_repay_rs['last_month_repay_money']; $deal['month_manage_money'] = $deal['borrow_amount'] * (double) app_conf('MANAGE_FEE') / 100; //总的多少管理费 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']; } $GLOBALS['tmpl']->assign("borrowpay", $deal['loantype']); $GLOBALS['tmpl']->assign("borrowamount", $deal['borrow_amount']); $GLOBALS['tmpl']->assign("apr", $deal['rate']); if ($deal['repay_time_type'] == 1) { $GLOBALS['tmpl']->assign("rate", $deal['rate'] / 12); } else { $GLOBALS['tmpl']->assign("rate", $deal['rate'] / 12 / 30); } $GLOBALS['tmpl']->assign("repaytime", $deal['repay_time']); $GLOBALS['tmpl']->assign("repaytimetype", $deal['repay_time_type']); $GLOBALS['tmpl']->assign("repayamount", $deal['month_repay_money']); $GLOBALS['tmpl']->assign("repayallamount", $deal['remain_repay_money']); $level = intval($_REQUEST['level']); $level_list = load_auto_cache("level"); $GLOBALS['tmpl']->assign("services_fee", $level_list['services_fee'][$level] / 100 * $deal['borrow_amount']); if ($deal['repay_time_type'] == 0) { $inrepayshow = 0; } else { $inrepayshow = intval($_REQUEST['inrepayshow']); } $impose_day = intval($_REQUEST['impose_day']); if (isset($_REQUEST['isshow']) && intval($_REQUEST['isshow']) == 1) { $loantype = $deal['loantype']; $LoanModule = LoadLoanModule($loantype); $list = $LoanModule->make_repay_plan($deal); if ($impose_day >= app_conf('YZ_IMPSE_DAY')) { $impose_fee = app_conf('IMPOSE_FEE_DAY2'); $manage_impose_fee = app_conf('MANAGE_IMPOSE_FEE_DAY2'); } else { $impose_fee = app_conf('IMPOSE_FEE_DAY1'); $manage_impose_fee = app_conf('MANAGE_IMPOSE_FEE_DAY1'); } $left_repay_money = $deal['remain_repay_money']; foreach ($list as $k => $v) { $list[$k]['impose_money'] = $v['repay_money'] * $impose_fee * $impose_day * 0.01; $list[$k]['manage_impose_money'] = $v['repay_money'] * $manage_impose_fee * $impose_day * 0.01; $list[$k]['left_repay_money'] = $left_repay_money = $left_repay_money - round($v['repay_money'], 2); } $GLOBALS['tmpl']->assign("list", $list); } //提前还款 if ($inrepayshow == 1) { $tq_list = array(); $deal['compensate_fee'] = app_conf('COMPENSATE_FEE'); for ($i = 0; $i < $deal['repay_time']; $i++) { $loaninfo['deal'] = $deal; if (is_last_repay($deal['loantype'])) { $loaninfo['deal']['month_manage_money'] = $deal['all_manage_money']; } $tq_list[$i] = inrepay_repay($loaninfo, $i, next_replay_month(TIME_UTC, $i + 1)); if (is_last_repay($deal['loantype'])) { $tq_list[$i]['month_repay_money'] = 0; $tq_list[$i]['month_repay_money'] = 0; if ($i + 1 == $deal['repay_time']) { $tq_list[$i]['manage_money'] = $deal['all_manage_money']; $tq_list[$i]['month_repay_money'] = $deal['last_month_repay_money']; } } else { $tq_list[$i]['manage_money'] = $deal['month_manage_money']; $tq_list[$i]['month_repay_money'] = $deal['month_repay_money']; if ($i + 1 == $deal['repay_time']) { $tq_list[$i]['month_repay_money'] = $deal['last_month_repay_money']; } } } $GLOBALS['tmpl']->assign("tq_list", $tq_list); } $GLOBALS['tmpl']->display("inc/tool/calculate_result.html"); }
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; } 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=" . $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']; $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); if ($deal['agency_id'] > 0) { $tmpl_content = app_conf("CONTRACT_1"); } else { $tmpl_content = app_conf("CONTRACT_0"); } $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $deal['user_id']); $GLOBALS['tmpl']->assign("user_info", $user_info); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $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'] = $user_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); } }
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); } }
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); }
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); }
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); }