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 getUCInrepayRepayBorrowMoney($id) { $id = intval($id); $root = array(); $root["status"] = 0; //0:出错;1:正确; if ($id == 0) { $root["show_err"] = "操作失败!"; return $root; } $deal = get_deal($id); if (!$deal) { $root["show_err"] = "借款不存在!"; return $root; } if ($deal['user_id'] != $GLOBALS['user_info']['id']) { $root["show_err"] = "不属于你的借款!"; return $root; } if ($deal['deal_status'] != 4) { $root["show_err"] = "借款不是还款状态!"; return $root; } $time = TIME_UTC; $impose_money = 0; //是否有部分还款的 $repay_count_ing = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_repay WHERE has_repay=2 and deal_id=" . $id); if ($repay_count_ing) { $root["show_err"] = "请将部分还款的借款还完才可以进行此操作!"; return $root; } //计算罚息 $loan_list = get_deal_load_list($deal); $k_repay_key = -1; $k_repay_time = 0; foreach ($loan_list as $k => $v) { if ($v['has_repay'] == 0) { if ($k_repay_key == -1) { $k_repay_key = $v['l_key']; $k_repay_time = $v['repay_day']; } $impose_money += $v['impose_all_money']; } } if ($impose_money > 0) { $root["show_err"] = "请将逾期未还的借款还完才可以进行此操作!"; return $root; } if ($deal['ips_bill_no'] != "") { $root["status"] = 2; $root["jump"] = APP_ROOT . '/index.php?ctl=collocation&act=RepaymentNewTrade&deal_id=' . $deal['id'] . '&l_key=all&from=' . $GLOBALS['request']['from']; $root['jump'] = str_replace("/mapi", "", SITE_DOMAIN . $root['jump']); return $root; } //还了几期了 $has_repay_count = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_repay WHERE has_repay=1 and deal_id=" . $id); $loaninfo['deal'] = $deal; $loaninfo['loanlist'] = $loan_list; //返佣 $rebate_rs = get_rebate_fee($GLOBALS['user_info']['id'], "borrow"); $loaninfo['deal']['rebate'] = $rebate_rs['rebate']; $inrepay_info = inrepay_repay($loaninfo, $has_repay_count); $true_repay_money = (double) $inrepay_info['true_repay_money']; $true_self_money = (double) $inrepay_info['true_self_money']; $impose_money = (double) $inrepay_info['impose_money']; $true_manage_money = (double) $inrepay_info['true_manage_money']; $true_manage_money_rebate = (double) $inrepay_info['true_manage_money_rebate']; $true_total_repay_money = $true_repay_money + $impose_money + $true_manage_money; if ($true_total_repay_money > $GLOBALS['user_info']['money']) { $root["show_err"] = "对不起,您的余额不足!"; return $root; } //录入到提前还款列表 $inrepay_data['deal_id'] = $id; $inrepay_data['user_id'] = $GLOBALS['user_info']['id']; $inrepay_data['repay_money'] = $true_repay_money; $inrepay_data['self_money'] = $true_self_money; $inrepay_data['impose_money'] = $impose_money; $inrepay_data['manage_money'] = $true_manage_money; $inrepay_data['repay_time'] = $k_repay_time; $inrepay_data['true_repay_time'] = $time; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_inrepay_repay", $inrepay_data, "INSERT"); $inrepay_id = $GLOBALS['db']->insert_id(); if ($inrepay_id == 0) { $root["show_err"] = "对不起,数据处理失败,请联系客服!"; return $root; } //录入还款列表 $wait_repay_list = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "deal_repay WHERE deal_id=" . $id . " and has_repay=0 ORDER BY l_key ASC"); $temp_ids = array(); foreach ($wait_repay_list as $k => $v) { $repay_data = array(); $repay_data['has_repay'] = 1; $repay_data['true_repay_time'] = $time; $repay_data['true_repay_date'] = to_date($time); $repay_data['status'] = 0; if ($k_repay_key == $v['l_key']) { $repay_data['true_repay_money'] = $true_repay_money; $repay_data['impose_money'] = $impose_money; $repay_data['true_manage_money'] = $true_manage_money; $repay_data['true_self_money'] = $true_self_money; $repay_data['true_interest_money'] = $true_repay_money - $true_self_money; $repay_data['true_manage_money_rebate'] = $true_manage_money_rebate; } $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_repay", $repay_data, "UPDATE", "id=" . $v['id']); //假如出错 删除掉原来的以插入的数据 if ($GLOBALS['db']->affected_rows() == 0) { if (count($temp_ids) > 0) { $GLOBALS['db']->query("UPDATE " . DB_PREFIX . "deal_repay SET has_repay=0 WHERE id in " . implode(",", $temp_ids) . ""); make_repay_plan($deal); } $root["show_err"] = "对不起,处理数据失败请联系客服!"; return $root; } else { $temp_ids[] = $v['id']; } } if (count($temp_ids) == 0) { $root["show_err"] = "对不起,处理数据失败请联系客服!"; return $root; } //更新用户账户资金记录 require APP_ROOT_PATH . 'system/libs/user.php'; modify_account(array("money" => -round($impose_money, 2)), $GLOBALS['user_info']['id'], "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],提前还款违约金", 6); modify_account(array("money" => -round($true_manage_money, 2)), $GLOBALS['user_info']['id'], "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],提前还款管理费", 10); modify_account(array("money" => -round($true_repay_money, 2)), $GLOBALS['user_info']['id'], "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],提前还款本息", 6); //用户获得额度 modify_account(array("quota" => trim(app_conf('USER_REPAY_QUOTA'))), $GLOBALS['user_info']['id'], "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],还清借款获得额度", 6); //借款者返佣金 if ($true_manage_money_rebate != 0) { /*ok*/ $reback_memo = '借款“<a href="' . $deal["url"] . '">' . $deal["name"] . '</a>”,借款者' . $deal["user"]["user_name"]; reback_rebate_money($GLOBALS['user_info']['id'], $true_manage_money_rebate, "borrow", $reback_memo); } //判断获取的信用是否超过限制 if ($GLOBALS['db']->getOne("SELECT sum(point) FROM " . DB_PREFIX . "user_point_log WHERE `type`=6 AND user_id=" . $GLOBALS['user_info']['id']) < (int) trim(app_conf('REPAY_SUCCESS_LIMIT'))) { //获取上一次还款时间 $befor_repay_time = $GLOBALS['db']->getOne("SELECT MAX(create_time) FROM " . DB_PREFIX . "user_point_log WHERE `type`=6 AND user_id=" . $GLOBALS['user_info']['id']); $day = ceil(($time - $befor_repay_time) / 24 / 3600); //当天数大于等于间隔时间 获得信用 if ($day >= (int) trim(app_conf('REPAY_SUCCESS_DAY'))) { modify_account(array("point" => trim(app_conf('REPAY_SUCCESS_POINT'))), $GLOBALS['user_info']['id'], "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],还清借款", 6); } } //用户回款 /** * 获取某一期的用户还款列表 * array $deal_info 借款信息 * int $user_id 用户ID 为0代表全部 * int $lkey 第几期 -1 全部 * int $ukey 第几个投标人 -1 全部 * int $true_time 真实还款时间 * int $get_type 0 全部 1代表未还的 2 代表已还的 * int $r_type = 0; 返回类型; 1:只返回一个数组; $result['item'] * string $limit; 查询限制数量; 0,20 $result['count'] */ $user_loan_list = get_deal_user_load_list($deal, 0, -1, -1, $time, 1, 0, ''); foreach ($user_loan_list as $lllk => $lllv) { //循环用户 //本金 $user_self_money = 0; //本息 $user_repay_money = 0; //违约金 $user_impose_money = 0; //管理费 $user_manage_money = 0; //利息管理费 $user_manage_interest_money = 0; //返佣金 $manage_interest_money_rebate = 0; //奖励 $user_reward_money = 0; foreach ($lllv as $kk => $vv) { //循环期数 $in_user_id = $vv['user_id']; //判断是否转让了债权 if ((int) $vv['t_user_id'] == 0) { $loan_user_info['user_name'] = $vv['user_name']; $loan_user_info['email'] = $vv['email']; $loan_user_info['mobile'] = $vv['mobile']; } else { $in_user_id = $vv['t_user_id']; $loan_user_info['user_name'] = $vv['t_user_name']; $loan_user_info['email'] = $vv['t_email']; $loan_user_info['mobile'] = $vv['t_mobile']; } $user_load_data = array(); $user_load_data['true_repay_time'] = $time; $user_load_data['true_repay_date'] = to_date($time); $user_load_data['is_site_repay'] = 0; $user_load_data['status'] = 0; if ($k_repay_key == $vv['l_key']) { $loadinfo['deal']['rate'] = $deal['rate']; $loadinfo['deal']['loantype'] = $deal['loantype']; $loadinfo['deal']['repay_time'] = $deal['repay_time']; $loadinfo['deal']['borrow_amount'] = $vv['money']; $loadinfo['deal']['repay_start_time'] = $deal['repay_start_time']; $loadinfo['deal']['month_manage_money'] = $vv['manage_money']; $loadinfo['deal']['manage_interest_money'] = $vv['manage_interest_money']; $deal = get_user_load_fee($in_user_id, 0, $deal); $loadinfo['deal']['user_loan_interest_manage_fee'] = $deal['user_loan_interest_manage_fee']; $rebate_rs = get_rebate_fee($in_user_id, "invest"); $loadinfo['deal']['rebate'] = $rebate_rs['rebate']; $loadinfo['deal']['manage_interest_money_rebate'] = $vv['manage_interest_money_rebate']; $loadinfo['deal']['month_repay_money'] = $vv['month_repay_money']; $loadinfo['deal']['compensate_fee'] = $deal['compensate_fee']; if ($deal['repay_time_type'] == 1) { $loadinfo['deal']['all_manage_money'] = $vv['manage_money']; } else { $loadinfo['deal']['all_manage_money'] = $vv['manage_money'] * $deal['repay_time']; } $loadinfo['deal']['repay_time_type'] = $deal['repay_time_type']; $user_load_rs = inrepay_repay($loadinfo, $has_repay_count); $user_load_data['true_repay_money'] = $user_load_rs['true_repay_money']; $user_load_data['true_self_money'] = $user_load_rs['true_self_money']; $user_load_data['impose_money'] = $user_load_rs['impose_money']; $user_load_data['true_interest_money'] = $user_load_rs['true_repay_money'] - $user_load_rs['true_self_money']; $user_load_data['true_manage_money'] = $user_load_rs['true_manage_money']; $user_load_data['true_manage_interest_money'] = $user_load_rs['true_manage_interest_money']; $user_load_data['true_manage_interest_money_rebate'] = $user_load_rs['true_manage_interest_money_rebate']; $user_load_data['true_repay_manage_money'] = $true_manage_money / count($user_loan_list); $user_load_data['true_reward_money'] = 0; if ((int) $vv['is_winning'] == 1 && (int) $vv['income_type'] == 2 && (double) $vv['income_value'] != 0) { $user_load_data['true_reward_money'] = $user_load_data['true_interest_money'] * (double) $vv['income_value'] * 0.01; } $user_self_money = $user_load_data['true_self_money']; $user_repay_money = $user_load_data['true_repay_money']; $user_impose_money = $user_load_data['impose_money']; $user_manage_money = $user_load_data['true_manage_money']; $user_manage_interest_money = $user_load_data['true_manage_interest_money']; $manage_interest_money_rebate = $user_load_data['true_manage_interest_money_rebate']; $user_reward_money = $user_load_data['true_reward_money']; } $user_load_data['has_repay'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load_repay", $user_load_data, "UPDATE", "id=" . $vv['id']); //普通会员邀请返利 get_referrals($vv['id']); } if ($user_repay_money > 0 || $user_impose_money > 0 || $user_manage_money > 0 || $user_manage_interest_money > 0 || $user_reward_money > 0) { $all_repay_money = number_format($GLOBALS['db']->getOne("SELECT (sum(repay_money)-sum(self_money) + sum(impose_money)) as shouyi FROM " . DB_PREFIX . "deal_load_repay WHERE has_repay = 1 and deal_id=" . $v['deal_id'] . " AND user_id=" . $v['user_id']), 2); $all_impose_money = number_format($GLOBALS['db']->getOne("SELECT sum(impose_money) FROM " . DB_PREFIX . "deal_load_repay WHERE has_repay = 1 and deal_id=" . $v['deal_id'] . " AND user_id=" . $v['user_id']), 2); //$content = "您好,您在".app_conf("SHOP_TITLE")."的投标 “<a href=\"".$deal['url']."\">".$deal['name']."</a>”提前还款,"; //$content .= "本次投标共获得收益:".$all_repay_money."元,其中违约金为:".$all_impose_money."元,本次投标已回款完毕!"; //更新用户账户资金记录 modify_account(array("money" => $user_repay_money), $in_user_id, "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],回报本息", 5); modify_account(array("money" => $user_impose_money), $in_user_id, "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],提前回收违约金", 7); if ($user_manage_money > 0) { modify_account(array("money" => -$user_manage_money), $in_user_id, "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],投标管理费", 20); } if ($user_reward_money > 0) { modify_account(array("money" => -$user_reward_money), $in_user_id, "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],投标奖励", 28); } modify_account(array("money" => -$user_manage_interest_money), $in_user_id, "[<a href='" . $deal['url'] . "' target='_blank'>" . $deal['name'] . "</a>],投标利息管理费", 20); //投资者返佣金 if ($manage_interest_money_rebate) { /*ok*/ $reback_memo = "借款“<a href'" . $deal['url'] . "'>" . $deal["name"] . "</a>”,投资者" . $loan_user_info["user_name"] . ",第" . (intval($k_repay_key) + 1) . "期,提前还款"; reback_rebate_money($in_user_id, $manage_interest_money_rebate, "invest", $reback_memo); } $msg_conf = get_user_msg_conf($in_user_id); //短信通知 if (app_conf("SMS_ON") == 1 && app_conf('SMS_REPAY_TOUSER_ON') == 1) { $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_DEAL_LOAD_REPAY_SMS'", false); $tmpl_content = $tmpl['content']; $notice['user_name'] = $loan_user_info['user_name']; $notice['deal_name'] = $deal['sub_name']; $notice['deal_url'] = $deal['url']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['repay_money'] = $vv['month_repay_money'] + $vv['impose_money']; $notice['all_repay_money'] = $all_repay_money; $notice['impose_money'] = $all_impose_money; $GLOBALS['tmpl']->assign("notice", $notice); $sms_content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $loan_user_info['mobile']; $msg_data['send_type'] = 0; $msg_data['title'] = $msg_data['content'] = addslashes($sms_content); $msg_data['send_time'] = 0; $msg_data['is_send'] = 0; $msg_data['create_time'] = $time; $msg_data['user_id'] = $in_user_id; $msg_data['is_html'] = 0; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } //站内信 $notices['shop_title'] = app_conf("SHOP_TITLE"); $notices['url'] = "“<a href=\"" . $deal['url'] . "\">" . $deal['name'] . "</a>”"; $notices['repay_money'] = $all_repay_money; $notices['impose_money'] = $all_impose_money; $tmpl_contents = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_REPAY_MONEY_TQTB'", false); $GLOBALS['tmpl']->assign("notice", $notices); $content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_contents['content']); if ($msg_conf['sms_bidrepaid'] == 1) { send_user_msg("", $content, 0, $in_user_id, $time, 0, true, 9); } //邮件 if ($msg_conf['mail_bidrepaid'] == 1 && app_conf('MAIL_ON') == 1) { $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_DEAL_LOAD_REPAY_EMAIL'", false); $tmpl_content = $tmpl['content']; $notice['user_name'] = $loan_user_info['user_name']; $notice['deal_name'] = $deal['sub_name']; $notice['deal_url'] = $deal['url']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['site_url'] = SITE_DOMAIN . APP_ROOT; $notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter"); $notice['msg_cof_setting_url'] = SITE_DOMAIN . url("index", "uc_msg#setting"); $notice['repay_money'] = $vv['month_repay_money'] + $vv['impose_money']; $notice['all_repay_money'] = $all_repay_money; $notice['impose_money'] = $all_impose_money; $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $loan_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; $msg_data['user_id'] = $in_user_id; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } /* $content = "您好,您在".app_conf("SHOP_TITLE")."的借款 “<a href=\"".$deal['url']."\">".$deal['name']."</a>”成功提前还款".number_format($true_total_repay_money,2)."元,"; $content .= "其中违约金为:".number_format($impose_money,2)."元,本笔借款已还款完毕!"; */ $notices['shop_title'] = app_conf("SHOP_TITLE"); $notices['url'] = "“<a href=\"" . $deal['url'] . "\">" . $deal['name'] . "</a>”"; $notices['repay_money'] = number_format($true_total_repay_money, 2); $notices['impose_money'] = number_format($impose_money, 2); $tmpl_contents = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_REPAY_MONEY_TQJK'", false); $GLOBALS['tmpl']->assign("notice", $notices); $content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_contents['content']); //站内信 send_user_msg("", $content, 0, $GLOBALS['user_info']['id'], $time, 0, true, 8); //短信通知 if (app_conf("SMS_ON") == 1 && app_conf('SMS_SEND_REPAY') == 1) { //$sms_content = "尊敬的".app_conf("SHOP_TITLE")."用户".$GLOBALS['user_info']['user_name'].",您成功提前还款".number_format($true_total_repay_money,2)."元,其中违约金为:".number_format($impose_money,2)."元,感谢您的关注和支持。【".app_conf("SHOP_TITLE")."】"; $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_SMS_REPAY_SUCCESS_MSG'", false); $tmpl_content = $tmpl['content']; $notice['user_name'] = $GLOBALS['user_info']['user_name']; $notice['deal_name'] = $deal['sub_name']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['index'] = $has_repay_count + 1; $notice['status'] = "成功提前"; $notice['all_money'] = number_format($true_total_repay_money, 2); $notice['repay_money'] = number_format($true_repay_money, 2); $notice['impose_money'] = number_format($impose_money, 2); $notice['manage_money'] = number_format($true_manage_money, 2); $notice['manage_impose_money'] = 0; $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $GLOBALS['user_info']['mobile']; $msg_data['send_type'] = 0; $msg_data['title'] = "提前还款短信通知"; $msg_data['content'] = $msg; $msg_data['send_time'] = 0; $msg_data['is_send'] = 0; $msg_data['create_time'] = $time; $msg_data['user_id'] = $GLOBALS['user_info']['id']; $msg_data['is_html'] = 0; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } $GLOBALS['db']->query("UPDATE " . DB_PREFIX . "generation_repay_submit SET `memo`='因还款失效',`status`=2 WHERE deal_id=" . $deal['id']); //VIP升级 -提前还款 $type = 1; $type_info = 4; $resultdate = syn_user_vip($GLOBALS['user_info']['id'], $type, $type_info); syn_deal_status($id); sys_user_status($GLOBALS['user_info']['id'], false, true); syn_transfer_status(0, $id); $root["status"] = 1; //0:出错;1:正确; $root["show_err"] = "操作成功!"; return $root; }