public function index() { require_once APP_ROOT_PATH . "system/libs/user.php"; $email = strim($GLOBALS['request']['email']); $pwd = strim($GLOBALS['request']['pwd']); $username = strim($GLOBALS['request']['user_name']); $result = do_login_user($email, $pwd); $GLOBALS['user_info'] = $user_data = es_session::get('user_info'); if ($GLOBALS['user_info']) { $user_id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where user_name = '" . $username . "'"); $content = htmlspecialchars(addslashes(trim($GLOBALS['request']['message']))); send_user_msg("", $content, intval($GLOBALS['user_info']['id']), $user_id, get_gmtime()); $root['return'] = 1; } else { $root['return'] = 0; $root['info'] = "请先登录"; } output($root); }
public function index() { $root = array(); require_once APP_ROOT_PATH . "system/model/user.php"; $username = strim($GLOBALS['request']['user_name']); if (strim($GLOBALS['request']['from'] == 'wap')) { $root['message'] = htmlspecialchars(addslashes(trim($GLOBALS['request']['message']))); $root['name'] = $GLOBALS['request']['user_name']; $root['da'] = $GLOBALS['user_info']; } if ($GLOBALS['user_info']) { $user_id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where user_name = '" . $username . "'"); $content = htmlspecialchars(addslashes(trim($GLOBALS['request']['message']))); send_user_msg("", $content, intval($GLOBALS['user_info']['id']), $user_id, get_gmtime()); $root['return'] = 1; $root['info'] = "发送成功"; } else { $root['return'] = 0; $root['info'] = "请先登录"; } output($root); }
function do_reback() { require APP_ROOT_PATH . "app/Lib/common.php"; require APP_ROOT_PATH . "app/Lib/deal.php"; $id = intval($_REQUEST['id']); if ($id == 0) { $this->error("操作失败", 0); die; } $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) { $this->error("不存在的债权"); die; } $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.loantype = 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); if ($transfer['t_user_id'] > 0) { $this->error("债权已转让,无法撤销", 0); die; } $msg = strim($_POST['msg']); if ($msg == "") { $this->error("请输入撤销原因", 0); die; } $GLOBALS['db']->query("UPDATE " . DB_PREFIX . "deal_load_transfer SET status=0 WHERE id=" . $id); if ($GLOBALS['db']->affected_rows() > 0) { $content = "您好,您在" . app_conf("SHOP_TITLE") . "转让的债权 “<a href=\"" . url("index", "transfer#detail", array("id" => $id)) . "\">Z-" . $transfer['load_id'] . "</a>” 因为:“" . $msg . "”被管理员撤销了"; send_user_msg("", $content, 0, $transfer['user_id'], TIME_UTC, 0, true, 17); $this->success("撤销成功!"); die; } else { $this->success("撤销失败!"); die; } }
/** * 处理cookie的自动登录 * @param $user_name_or_email 用户名或邮箱 * @param $user_md5_pwd md5加密过的密码 */ function auto_do_login_user($user_name_or_email, $user_md5_pwd) { $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where (user_name='" . $user_name_or_email . "' or email = '" . $user_name_or_email . "' or mobile = '" . $user_name_or_email . "') and is_delete = 0"); if ($user_data) { if (md5($user_data['user_pwd'] . "_EASE_COOKIE") == $user_md5_pwd) { //成功 //登录成功自动检测关于会员等级 $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id'])); $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc"); if ($user_current_group['score'] < $user_group['score'] && $user_data['group_id'] != $user_group['id']) { $user_data['group_id'] = intval($user_group['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['group_id'] . " where id = " . $user_data['id']); $pm_title = "您已经成为" . $user_group['name'] . ""; $pm_content = "恭喜您,您已经成为" . $user_group['name'] . "。"; if ($user_group['discount'] < 1) { $pm_content .= "您将享有" . $user_group['discount'] * 10 . "折的购物优惠"; } send_user_msg($pm_title, $pm_content, 0, $user_data['id'], TIME_UTC, 0, true, true); } $user_current_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where id = " . intval($user_data['level_id'])); $user_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where point <=" . intval($user_data['point']) . " order by point desc"); if ($user_current_level['point'] < $user_level['point'] && $user_data['level_id'] != $user_level['id']) { $user_data['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']); $pm_title = "您已经成为" . $user_level['name'] . ""; $pm_content = "恭喜您,您已经成为" . $user_level['name'] . "。"; send_user_msg($pm_title, $pm_content, 0, $user_data['id'], TIME_UTC, 0, true, true); } if ($user_current_level['point'] > $user_level['point'] && $user_data['level_id'] != $user_level['id']) { $user_data['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']); $pm_title = "您已经降为" . $user_level['name'] . ""; $pm_content = "很报歉,您已经降为" . $user_level['name'] . "。"; send_user_msg($pm_title, $pm_content, 0, $user_data['id'], TIME_UTC, 0, true, true); } es_session::set("user_info", $user_data); $GLOBALS['user_info'] = $user_data; //检测勋章 $medal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "medal where is_effect = 1 and allow_check = 1"); foreach ($medal_list as $medal) { $file = APP_ROOT_PATH . "system/medal/" . $medal['class_name'] . "_medal.php"; $cls = $medal['class_name'] . "_medal"; if (file_exists($file)) { require_once $file; if (class_exists($cls)) { $o = new $cls(); $check_result = $o->check_medal(); if ($check_result['status'] == 0) { send_user_msg($check_result['info'], $check_result['info'], 0, $user_data['id'], TIME_UTC, 0, true, true); } } } } $GLOBALS['db']->query("update " . DB_PREFIX . "user set login_ip = '" . get_client_ip() . "',login_time= " . TIME_UTC . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']); } } }
function getAuthorizedSaveCarry($amount, $paypassword, $bid) { $status = array('status' => 0, 'show_err' => ''); if ($GLOBALS['authorized_info']['id'] > 0) { $paypassword = strim($paypassword); $amount = floatval($amount); $bid = intval($bid); if ($paypassword == "") { $status['status'] = 0; $status['show_err'] = $GLOBALS['lang']['PAYPASSWORD_EMPTY']; return $status; } if (md5($paypassword) != $GLOBALS['authorized_info']['paypassword']) { $status['status'] = 0; $status['show_err'] = $GLOBALS['lang']['PAYPASSWORD_ERROR']; return $status; } $data['user_id'] = intval($GLOBALS['authorized_info']['id']); $data['money'] = $amount; if ($data['money'] <= 0) { $status['status'] = 0; $status['show_err'] = $GLOBALS['lang']['CARRY_MONEY_NOT_TRUE']; return $status; } $fee = 0; $feel_type = 0; //获取手续费配置表 $fee_config = load_auto_cache("user_carry_config"); //如果手续费大于最大的配置那么取这个手续费 if ($data['money'] >= $fee_config[count($fee_config) - 1]['max_price']) { $fee = $fee_config[count($fee_config) - 1]['fee']; $feel_type = $fee_config[count($fee_config) - 1]['fee_type']; } else { foreach ($fee_config as $k => $v) { if ($data['money'] >= $v['min_price'] && $data['money'] <= $v['max_price']) { $fee = floatval($v['fee']); $feel_type = $v['fee_type']; } } } if ($feel_type == 1) { $fee = $data['money'] * $fee * 0.01; } //判断提现金额限制 if ($data['money'] + $fee + floatval($GLOBALS['user_info']['nmc_amount']) > floatval($GLOBALS['authorized_info']['money'])) { $status['status'] = 0; $status['show_err'] = $GLOBALS['lang']['CARRY_MONEY_NOT_ENOUGHT']; return $status; } $data['fee'] = $fee; if ($bid == 0) { $status['status'] = 0; $status['show_err'] = $GLOBALS['lang']['PLASE_ENTER_CARRY_BANK']; return $status; } $user_bank = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user_bank where user_id=" . intval($GLOBALS['authorized_info']['id']) . " AND id={$bid} "); $data['bank_id'] = $user_bank['bank_id']; $data['real_name'] = $user_bank['real_name']; $data['region_lv1'] = intval($user_bank['region_lv1']); $data['region_lv2'] = intval($user_bank['region_lv2']); $data['region_lv3'] = intval($user_bank['region_lv3']); $data['region_lv4'] = intval($user_bank['region_lv4']); $data['bankzone'] = trim($user_bank['bankzone']); $data['bankcard'] = trim($user_bank['bankcard']); $data['create_time'] = TIME_UTC; $GLOBALS['db']->autoExecute(DB_PREFIX . "user_carry", $data, "INSERT"); //更新会员账户信息 require APP_ROOT_PATH . 'system/libs/user.php'; modify_account(array('money' => -$data['money'], 'lock_money' => $data['money']), $data['user_id'], "提现申请", 8); modify_account(array('money' => -$fee, 'lock_money' => $fee), $data['user_id'], "提现手续费", 9); //$content = "您于".to_date($data['create_time'],"Y年m月d日 H:i:s")."提交的".format_price($data['money'])."提现申请我们正在处理,如您填写的账户信息正确无误,您的资金将会于3个工作日内到达您的银行账户."; $notice['time'] = to_date($data['create_time'], "Y年m月d日 H:i:s"); $notice['money'] = format_price($data['money']); $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_WITHDRAWS_CASH'", false); $GLOBALS['tmpl']->assign("notice", $notice); $content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']); send_user_msg("", $content, 0, $data['user_id'], TIME_UTC, 0, true, 5); $status['status'] = 1; $status['show_err'] = $GLOBALS['lang']['CARRY_SUBMIT_SUCCESS']; } else { $status['show_err'] = "未登录"; } return $status; }
require_once APP_ROOT_PATH . "system/libs/user.php"; auto_do_login_user($r_user_name, $r_user_pwd); } } $user_info = es_session::get('user_info'); if (intval($user_info['id']) > 0) { $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where is_delete = 0 and is_effect = 1 and id = " . intval($user_info['id'])); if ($user_info) { es_session::set('user_info', $user_info); $GLOBALS['tmpl']->assign("user_info", $user_info); if (check_ipop_limit(get_client_ip(), "auto_send_msg", 30, $user_info['id'])) { //有会员登录状态时,自动创建消息 $msg_systems = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "msg_system where (end_time = 0 or end_time > " . TIME_UTC . ") and user_ids = '' or user_ids like '%" . $user_info['id'] . "|%'"); foreach ($msg_systems as $msg) { if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "msg_box where to_user_id = " . $user_info['id'] . " and system_msg_id = " . $msg['id']) == 0) { send_user_msg($msg['title'], $msg['content'], 0, $user_info['id'], $msg['create_time'], $msg['id'], true); } } } } } else { es_session::set('user_info', array()); } /* //保存返利的cookie if($_REQUEST['r']) { $rid = strim(base64_decode($_REQUEST['r'])); $ref_uid = intval($GLOBALS['db']->getOne("select id from ".DB_PREFIX."user where user_name = '".$rid."' OR mobile='".$rid."'")); es_cookie::set("REFERRAL_USER",intval($ref_uid)); }
function send_deal_success_site_sms($deal_id, $deal_info = false) { if (!$deal_info && $deal_id == 0) { return false; } if (!$deal_info) { $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id); } if (intval($deal_info['is_send_success_msg']) == 1) { return false; } //获取投标列表 $load_user_list = $GLOBALS['db']->getAll("SELECT user_name,user_id,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $deal_info['id']); if ($load_user_list) { foreach ($load_user_list as $k => $v) { $user_info = $GLOBALS['db']->getRow("select email from " . DB_PREFIX . "user where id = " . $v['user_id']); $load_msg_conf = get_user_msg_conf($v['user_id']); if ($load_msg_conf['sms_bidsuccess'] == 1 || !$load_msg_conf) { $content = "<p>感谢您使用" . app_conf("SHOP_TITLE") . "贷款融资,很高兴的通知您,您于" . to_date($v['create_time'], "Y年m月d日") . "投标的借款列表"; $content .= "“<a href=\"" . url("index", "deal", array("id" => $deal_info['id'])) . "\">" . $deal_info['name'] . "</a>”满标</p>"; send_user_msg("", $content, 0, $v['user_id'], TIME_UTC, 0, true, 16); } } } }
public function add() { $user_info = $GLOBALS['user_info']; $ajax = intval($_REQUEST['ajax']); if (!$user_info) { showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $ajax); } if ($_REQUEST['content'] == '') { showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax); } //验证码 if (app_conf("VERIFY_IMAGE") == 1) { $verify = md5(trim($_REQUEST['verify'])); $session_verify = es_session::get('verify'); if ($verify != $session_verify) { showErr($GLOBALS['lang']['VERIFY_CODE_ERROR'], $ajax); } } if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) { showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax); } $rel_table = strim($_REQUEST['rel_table']); $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "'"); if (!$message_type) { showErr($GLOBALS['lang']['INVALID_MESSAGE_TYPE'], $ajax); } //添加留言 $message['title'] = $_REQUEST['title'] ? strim($_REQUEST['title']) : btrim(valid_str($_REQUEST['content'])); $message['content'] = btrim(valid_str($_REQUEST['content'])); $message['title'] = valid_str($message['title']); $message['create_time'] = TIME_UTC; $message['rel_table'] = $rel_table; $message['rel_id'] = intval($_REQUEST['rel_id']); $message['user_id'] = intval($GLOBALS['user_info']['id']); if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $message_effect = 0; } else { $message_effect = $message_type['is_effect']; } $message['is_effect'] = $message_effect; $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message); $l_user_id = $GLOBALS['db']->getOne("SELECT user_id FROM " . DB_PREFIX . "deal WHERE id=" . $message['rel_id']); //添加到动态 insert_topic($rel_table . "_message", $message['rel_id'], $message['user_id'], $GLOBALS['user_info']['user_name'], $l_user_id); if ($rel_table == "deal") { require_once APP_ROOT_PATH . 'app/Lib/deal.php'; $deal = get_deal($message['rel_id']); //自己给自己留言不执行操作 if ($deal['user_id'] != $message['user_id']) { $msg_conf = get_user_msg_conf($deal['user_id']); //站内信 if ($msg_conf['sms_asked'] == 1) { $content = "<p>您好,用户 " . get_user_name($message['user_id']) . "对您发布的借款列表 “<a href=\"" . $deal['url'] . "\">" . $deal['name'] . "</a>”进行了以下留言:</p>"; $content .= "<p>“" . $message['content'] . "”</p>"; send_user_msg("", $content, 0, $deal['user_id'], TIME_UTC, 0, true, 13, $message['rel_id']); } //邮件 if ($msg_conf['mail_asked'] == 1 && app_conf('MAIL_ON') == 1) { $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $deal['user_id']); $tmpl = $GLOBALS['db']->getRowCached("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_DEAL_MSG'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $user_info['user_name']; $notice['msg_user_name'] = get_user_name($message['user_id'], false); $notice['deal_name'] = $deal['name']; $notice['deal_url'] = SITE_DOMAIN . url("index", "deal", array("id" => $deal['id'])); $notice['message'] = $message['content']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['site_url'] = SITE_DOMAIN . APP_ROOT; $notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter"); $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $user_info['email']; $msg_data['send_type'] = 1; $msg_data['title'] = get_user_name($message['user_id'], false) . "给您的标留言!"; $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'] = $user_info['id']; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax); }
/** * 处理会员登录 * @param $user_name_or_email 用户名或邮箱地址 * @param $user_pwd 密码 * */ function do_login_user($phone, $user_pwd) { $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where mobile= " . $phone . " and is_delete = 0"); if (!$user_data) { $result['status'] = 0; $result['data'] = ACCOUNT_NO_EXIST_ERROR; return $result; } else { $result['user'] = $user_data; if ($user_data['is_effect'] != 1) { $result['status'] = 0; $result['data'] = ACCOUNT_NO_VERIFY_ERROR; return $result; } else { if (intval($result['status']) == 0) { $result['status'] = 1; } //登录成功自动检测关于会员等级以及自动登录商家 $account_name = $user_data['merchant_name']; $account = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_account where account_name = '" . $account_name . "' and is_effect = 1 and is_delete = 0"); if ($account) { /*$account_locations = $GLOBALS['db']->getAll("select location_id from ".DB_PREFIX."supplier_account_location_link where account_id = ".$account['id']); * */ $account_locations = $GLOBALS['db']->getAll("select id from " . DB_PREFIX . "supplier_location where supplier_id = " . $account['supplier_id']); $account_location_ids = array(0); foreach ($account_locations as $row) { $account_location_ids[] = $row['id']; } $account['location_ids'] = $account_location_ids; es_session::set("account_info", $account); $GLOBALS['db']->query("update " . DB_PREFIX . "supplier_account set login_ip = '" . get_client_ip() . "' where id=" . $account['id']); } $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id'])); $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc"); if ($user_current_group['score'] < $user_group['score']) { $user_data['group_id'] = intval($user_group['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set group_id = " . $user_data['group_id'] . " where id = " . $user_data['id']); $pm_title = "您已经成为" . $user_group['name'] . ""; $pm_content = "恭喜您,您已经成为" . $user_group['name'] . "。"; if ($user_group['discount'] < 1) { $pm_content .= "您将享有" . $user_group['discount'] * 10 . "折的购物优惠"; } send_user_msg($pm_title, $pm_content, 0, $user_data['id'], get_gmtime(), 0, true, true); } $user_current_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where id = " . intval($user_data['level_id'])); $user_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where point <=" . intval($user_data['point']) . " order by point desc"); if ($user_current_level['point'] < $user_level['point']) { $user_data['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']); $pm_title = "您已经成为" . $user_level['name'] . ""; $pm_content = "恭喜您,您已经成为" . $user_level['name'] . "。"; send_user_msg($pm_title, $pm_content, 0, $user_data['id'], get_gmtime(), 0, true, true); } if ($user_current_level['point'] > $user_level['point']) { $user_data['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']); $pm_title = "您已经降为" . $user_level['name'] . ""; $pm_content = "很报歉,您已经降为" . $user_level['name'] . "。"; send_user_msg($pm_title, $pm_content, 0, $user_data['id'], get_gmtime(), 0, true, true); } es_session::set("user_info", $user_data); $GLOBALS['user_info'] = $user_data; //检测勋章 $medal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "medal where is_effect = 1 and allow_check = 1"); foreach ($medal_list as $medal) { $file = APP_ROOT_PATH . "system/medal/" . $medal['class_name'] . "_medal.php"; $cls = $medal['class_name'] . "_medal"; if (file_exists($file)) { require_once $file; if (class_exists($cls)) { $o = new $cls(); $check_result = $o->check_medal(); if ($check_result['status'] == 0) { send_user_msg($check_result['info'], $check_result['info'], 0, $user_data['id'], get_gmtime(), 0, true, true); } } } } $GLOBALS['db']->query("update " . DB_PREFIX . "user set login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']); //更新购物车 $GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set user_id = " . intval($user_data['id']) . " where session_id = '" . es_session::id() . "'"); $s_api_user_info = es_session::get("api_user_info"); if ($s_api_user_info) { $GLOBALS['db']->query("update " . DB_PREFIX . "user set " . $s_api_user_info['field'] . " = '" . $s_api_user_info['id'] . "' where id = " . $user_data['id'] . " and (" . $s_api_user_info['field'] . " = 0 or " . $s_api_user_info['field'] . "='')"); es_session::delete("api_user_info"); } $result['step'] = intval($user_data["step"]); return $result; } } }
function send_deal_success_site_sms($deal_id, $deal_info = false) { if (!$deal_info && $deal_id == 0) { return false; } if (!$deal_info) { $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id); } if (intval($deal_info['is_send_success_msg']) == 1) { return false; } //获取投标列表 $load_user_list = $GLOBALS['db']->getAll("SELECT user_name,user_id,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $deal_info['id']); if ($load_user_list) { foreach ($load_user_list as $k => $v) { $user_info = $GLOBALS['db']->getRow("select email from " . DB_PREFIX . "user where id = " . $v['user_id']); $load_msg_conf = get_user_msg_conf($v['user_id']); if ($load_msg_conf['sms_bidsuccess'] == 1 || !$load_msg_conf) { $notice['shop_title'] = app_conf("SHOP_TITLE"); $notice['time'] = to_date($v['create_time'], "Y年m月d日"); $notice['deal_name'] = "“<a href=\"" . url("index", "deal", array("id" => $deal_info['id'])) . "\">" . $deal_info['name'] . "</a>”"; $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_DEAL_SUCCESS_SITE_SMS'", false); $GLOBALS['tmpl']->assign("notice", $notice); $content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']); send_user_msg("", $content, 0, $v['user_id'], TIME_UTC, 0, true, 16); } } } }
function dotrans_ok($transfer_id) { $transfer = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_load_transfer where id = " . $transfer_id); //发送消息 $msg_conf = get_user_msg_conf($transfer['user_id']); if ($msg_conf['sms_transfer'] == 1 || $msg_conf['mail_transfer'] == 1) { $transfer['tuser'] = get_user("user_name,email", $transfer['t_user_id']); $transfer['user'] = get_user("user_name,email", $transfer['user_id']); } if ($msg_conf['sms_transfer'] == 1) { $content = "您好,您在" . app_conf("SHOP_TITLE") . "的债权 “<a href=\"" . url("index", "transfer#detail", array("id" => $transfer['id'])) . "\">Z-" . $transfer['load_id'] . "</a>” 成功转让给:<a href=\"" . $transfer['tuser']['url'] . "\">" . $transfer['tuser']['user_name'] . "</a>"; send_user_msg("", $content, 0, $transfer['user_id'], TIME_UTC, 0, true, 18); } //邮件 if ($msg_conf['mail_transfer'] == 1 && app_conf('MAIL_ON') == 1) { $tmpl = $GLOBALS['db']->getRowCached("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_TRANSFER_SUCCESS'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $transfer['user']['user_name']; $notice['transfer_time'] = to_date($transfer['create_time'], "Y年m月d日"); $notice['transfer_id'] = "Z-" . $transfer['load_id']; $notice['deal_url'] = SITE_DOMAIN . url("index", "transfer#detail", array("id" => $transfer['id'])); $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"); $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $transfer['user']['email']; $msg_data['send_type'] = 1; $msg_data['title'] = "“债权:Z-" . $transfer['load_id'] . "”转让通知"; $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'] = $transfer['user_id']; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } if (app_conf('SMS_ON') == 1) { $tmpl = $GLOBALS['db']->getRowCached("select * from " . DB_PREFIX . "msg_template where name = 'TPL_SMS_TRANSFER_SUCCESS'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $transfer['user']['user_name']; $notice['transfer_time'] = to_date($transfer['create_time'], "Y年m月d日"); $notice['transfer_id'] = "Z-" . $transfer['load_id']; $notice['site_name'] = app_conf("SHOP_TITLE"); $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $transfer['user']['mobile']; $msg_data['send_type'] = 0; $msg_data['title'] = "“债权:Z-" . $transfer['load_id'] . "”转让通知"; $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'] = $transfer['user_id']; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } //发送债权协议 send_transfer_contract_email($transfer_id); }
public function reply() { $return["status"] = 0; if (!$GLOBALS['user_info']) { $return["status"] = 2; $return["message"] = $GLOBALS['LANG']["PLEASE_LOGIN_FIRST"]; ajax_return($return); exit; } //验证码 if (app_conf("VERIFY_IMAGE") == 1) { $verify = md5(trim($_REQUEST['verify'])); $session_verify = es_session::get('verify'); if ($verify != $session_verify) { $return["message"] = $GLOBALS['lang']['VERIFY_CODE_ERROR']; ajax_return($return); exit; } } $content = htmlspecialchars(addslashes(valid_str($_REQUEST['content']))); $uid = intval($GLOBALS["user_info"]['id']); $pid = intval($_REQUEST['pid']); $dp_id = intval($_REQUEST['dp_id']); $page = intval($_REQUEST['page']); if (!check_ipop_limit(get_client_ip(), "dpsign", 10, $dp_id)) { $return['message'] = '请勿频繁回应'; ajax_return($return); exit; } es_session::delete("verify"); $dp_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_dp where id = " . $dp_id); $merchant_info = $GLOBALS['db']->getRow("select name,id from " . DB_PREFIX . "supplier_location where id = " . $dp_info['supplier_location_id']); $reply_data = array(); $reply_data['dp_id'] = $dp_id; $reply_data['content'] = $content; $reply_data['user_id'] = $uid; $reply_data['parent_id'] = $pid; $reply_data['create_time'] = get_gmtime(); $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_reply", $reply_data, "INSERT"); $rid = $GLOBALS['db']->insert_id(); if ($rid > 0) { $syn_reply = intval($_REQUEST['syn_reply']); if ($syn_reply == 1) { $s_account_info = es_session::get("account_info"); if (in_array($dp_info['supplier_location_id'], $s_account_info['location_ids']) && $dp_info['from_data'] != "") { //验证通过 $message_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message where id = " . intval($dp_info['message_id'])); if ($message_info) { $message_info['admin_reply'] = $content; $message_info['update_time'] = get_gmtime(); $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message_info, "UPDATE", "id=" . $message_info['id']); send_user_msg("商户回复了你的点评", "商户回复了你的点评 [<a href='" . url("youhui", "review#detail", array("id" => $dp_info['id'])) . "' target='_blank'>" . $dp_info['title'] . "</a>]", 0, $dp_info['user_id'], get_gmtime(), 0, 1, 1); } } } increase_user_active(intval($GLOBALS['user_info']['id']), "回应了一则商户点评"); $GLOBALS['db']->query("update " . DB_PREFIX . "supplier_location_dp set reply_count = reply_count + 1 where id = " . $dp_id); } //输出回应列表 $sql_count = "select count(*) from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id; $count = $GLOBALS['db']->getOne($sql_count); $page_size = app_conf("PAGE_SIZE"); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $sql = "select * from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id . " order by create_time desc limit " . $limit; $reply_list = $GLOBALS['db']->getAll($sql); foreach ($reply_list as $k => $v) { $reply_list[$k]['user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $v['user_id']); $reply_list[$k]['create_time_format'] = pass_date($v['create_time']); } $GLOBALS['current_url'] = $_SERVER['REQUEST_URI'] = url("youhui", "review#detail", array("id" => $dp_id)); $page = new Page($count, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("reply_list", $reply_list); $GLOBALS['tmpl']->assign('user_auth', get_user_auth()); $html = decode_topic($GLOBALS['tmpl']->fetch("inc/review/reply_list.html")); $return = array("status" => 1, "message" => $html); ajax_return($return); exit; }
function savedebit() { $view["type"] = intval($_REQUEST["type"]); $view["debit_money"] = strim($_REQUEST["debit_money"]); $view["repay_time"] = intval($_REQUEST["repaytime"]); $view["university"] = strim($_REQUEST["university"]); $view["address"] = strim($_REQUEST["address"]); $view["mobile"] = strim($_REQUEST["mobile"]); $is_ajax = intval($_REQUEST["is_ajax"]); if (strim($GLOBALS["user_info"]["u_alipay"]) == "") { showErr("请先绑定支付宝", $is_ajax); } if ($view["university"] == "") { showErr("请填写学校信息", $is_ajax); } if ($view["address"] == "") { showErr("请填写地址", $is_ajax); } if ($view["mobile"] == "") { showErr("请填写联系电话", $is_ajax); } if ($view["type"] == "" || $view["debit_money"] == "" || $view["repay_time"] == "") { showErr("请返回重新提交", $is_ajax); } $is_ajax = intval($_REQUEST['is_ajax']); if (!$GLOBALS['user_info']) { showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $is_ajax); } $t = trim($_REQUEST['t']); if (!in_array($t, array("save", "publish"))) { showErr($GLOBALS['lang']['ERROR_TITLE'], $is_ajax); } /*读取白条配置*/ $debit_conf = $GLOBALS["db"]->getRow("select * from " . DB_PREFIX . "debit_conf"); /*读取标类别作为商品名*/ $view["deal_loan_type"] = $GLOBALS["db"]->getOne("select name from " . DB_PREFIX . "deal_loan_type"); if ($t == "save") { $data['is_delete'] = 2; } else { $data['is_delete'] = 0; } $data['name'] = $view["deal_loan_type"] . $view["debit_money"] . "元"; if (empty($data['name'])) { showErr("请输入借款标题", $is_ajax); } $data['publish_wait'] = 1; $icon_type = "systemImg"; if ($icon_type == "") { showErr("请选择借款图片类型", $is_ajax); } $icon_type_arr = array('upload' => 1, 'userImg' => 2, 'systemImg' => 3); $data['icon_type'] = $icon_type_arr[$icon_type]; if (intval($data['icon_type']) == 0) { showErr("请选择借款图片类型", $is_ajax); } $_REQUEST['systemimgpath'] = $view["type"]; switch ($data['icon_type']) { case 1: if (strim($_REQUEST['icon']) == '') { showErr("请上传图片", $is_ajax); } else { $data['icon'] = replace_public(strim($_REQUEST['icon'])); } break; case 2: $data['icon'] = replace_public(get_user_avatar($GLOBALS['user_info']['id'], 'big')); break; case 3: if (intval($_REQUEST['systemimgpath']) == 0) { showErr("请选择系统图片", $is_ajax); } else { $data['icon'] = $GLOBALS['db']->getOne("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath'])); } break; } //$data['cate_id'] = $data['type_id'] = intval($view["type"]); $data['type_id'] = intval($view["type"]); if ($data['type_id'] == 0) { showErr("请选择借款用途", $is_ajax); } $data['borrow_amount'] = floatval($view["debit_money"]); /*if($data['borrow_amount'] < (int)trim(app_conf('MIN_BORROW_QUOTA')) || $data['borrow_amount'] > (int)trim(app_conf('MAX_BORROW_QUOTA')) || $data['borrow_amount'] %50 != 0){ showErr("请正确选择借款金额",$is_ajax); }*/ //判断是否需要额度 if ($GLOBALS['db']->getOne("SELECT is_quota FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . $data['type_id']) == 1) { if (intval($GLOBALS['user_info']['quota']) != 0) { $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']); if ($data['borrow_amount'] > intval($can_use_quota)) { showErr("输入借款的借款金额超过您的可用额度<br>您当前可用额度为:" . $can_use_quota, $is_ajax); } } } $data['repay_time'] = intval($_REQUEST['repaytime']); if ($data['repay_time'] == 0) { showErr("借款期限", $is_ajax); } $data['rate'] = floatval($view["rate"]); // $data['repay_time_type'] = 1; //按月 $min_rate = 0; $max_rate = 0; $is_rate_lock = false; $level_list = load_auto_cache("level"); $level_list_info = reset($level_list["repaytime_list"]); foreach ($level_list_info as $k => $v) { if ($v[1] != 0 && $v[0] == $view["repay_time"]) { $min_rate = $v[2]; $max_rate = $v[3]; break; } } if ($debit_conf["rate_cfg"] == 0) { $data["rate"] = $min_rate; } elseif ($debit_conf["rate_cfg"] == 1) { $data["rate"] = floatval(($min_rate + $max_rate) / 2); } elseif ($debit_conf["rate_cfg"] == 2) { $data["rate"] = $max_rate; } if (floatval($data['rate']) <= 0 || floatval($data['rate']) > $max_rate || floatval($data['rate']) < $min_rate) { showErr("请正确输入借款利率", $is_ajax); } $data['enddate'] = intval($debit_conf['enddate']); //筹标期限 $data['description'] = $GLOBALS["user_info"]["user_name"] . "的白条:" . $view["deal_loan_type"] . $view["debit_money"] . "元"; if (trim($data['description']) == '') { showErr("请输入项目描述", $is_ajax); } $datas["university"] = $view["university"]; $datas["address"] = $view["address"]; $datas["mobile"] = $view["mobile"]; //$datas['view_info'] = serialize($user_view_info); $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $datas, "UPDATE", "id=" . $GLOBALS['user_info']['id']); $data["services_fee"] = $debit_conf["services_fee"]; $data["manage_fee"] = $debit_conf["manage_fee"]; $data["manage_impose_fee_day1"] = $debit_conf["manage_impose_fee_day1"]; $data["manage_impose_fee_day2"] = $debit_conf["manage_impose_fee_day2"]; $data["impose_fee_day1"] = $debit_conf["impose_fee_day1"]; $data["impose_fee_day2"] = $debit_conf["impose_fee_day2"]; $data['voffice'] = 1; $data['vposition'] = 1; $data['is_effect'] = 1; $data['deal_status'] = 0; $data['agency_id'] = 0; //担保机构 $data['agency_status'] = 1; $data['warrant'] = 0; //担保类型 $data['guarantor_margin_amt'] = 0; //担保保证金 $data['guarantor_pro_fit_amt'] = 0; //担保收益 $data['user_id'] = intval($GLOBALS['user_info']['id']); $data['loantype'] = intval($view['loantype']); if ($data['repay_time_type'] == 0) { $data['loantype'] = 2; } //当为天的时候 if ($data['repay_time_type'] == 0) { $true_repay_time = 1; } else { $true_repay_time = $data['repay_time']; } //本金担保 if ($data['warrant'] == 1) { $data['guarantor_amt'] = $data['borrow_amount']; } elseif ($data['warrant'] == 2) { //等额本息 if ($data['loantype'] == 0) { $data['guarantor_amt'] = pl_it_formula($data['borrow_amount'], $data['rate'] / 12 / 100, $true_repay_time) * $true_repay_time; } } $data['is_hidden'] = 1; $data['create_time'] = TIME_UTC; //推荐人 $work_id = strim($_REQUEST["work_id"]); if ($work_id) { $data["admin_id"] = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "admin where work_id = '" . $work_id . "'"); } $module = "INSERT"; $jumpurl = url("debit", "debit_uc_center#order"); $condition = ""; $deal_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "deal WHERE ((is_delete=2 or is_delete=3) or (is_delete=0 and publish_wait=1)) AND user_id=" . $GLOBALS['user_info']['id']); if ($deal_id > 0) { $module = "UPDATE"; if ($t == "save") { $jumpurl = url("debit", "debit_uc_center#order"); } $condition = "id = {$deal_id}"; } else { if ($t == "save") { $jumpurl = url("debit", "debit_uc_center#order"); } } $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, $module, $condition); if ($module == "INSERT") { $deal_id = $GLOBALS['db']->insert_id(); } require_once APP_ROOT_PATH . 'app/Lib/deal.php'; $deal = get_deal($deal_id); //发送验证通知 if ($t != "save" && trim(app_conf('CUSTOM_SERVICE')) != '' && ($GLOBALS['user_info']['idcardpassed'] == 0 || $GLOBALS['user_info']['incomepassed'] == 0 || $GLOBALS['user_info']['creditpassed'] == 0 || $GLOBALS['user_info']['workpassed'] == 0)) { $ulist = explode(",", trim(app_conf('CUSTOM_SERVICE'))); $ulist = array_filter($ulist); if ($ulist) { $uuid = $ulist[array_rand($ulist)]; if ($uuid > 0) { $content = app_conf("SHOP_TITLE") . "用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话 " . app_conf('SHOP_TEL') . " 或给客服邮箱发邮件 " . app_conf("REPLY_ADDRESS") . " 我们会及时给您回复。"; require_once APP_ROOT_PATH . 'app/Lib/message.php'; //添加留言 $message['title'] = $content; $message['content'] = htmlspecialchars(addslashes(valid_str($content))); $message['title'] = valid_str($message['title']); $message['create_time'] = TIME_UTC; $message['rel_table'] = "deal"; $message['rel_id'] = $deal_id; $message['user_id'] = $uuid; $message['is_effect'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message); //添加到动态 insert_topic("message", $message['rel_id'], $message['user_id'], get_user_name($message['user_id'], false), $GLOBALS['user_info']['id']); //自己给自己留言不执行操作 if ($deal['user_id'] != $message['user_id']) { $msg_conf = get_user_msg_conf($deal['user_id']); //站内信 if ($msg_conf['sms_asked'] == 1) { $notices['shop_title'] = app_conf("SHOP_TITLE"); $notices['shop_tel'] = app_conf('SHOP_TEL'); $notices['shop_address'] = app_conf("REPLY_ADDRESS"); /*{$notice.shop_title}用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话{$notice.shop_tel}或给客服邮箱发邮件{$notice.shop_address}我们会及时给您回复。*/ $notices['url'] = "“<a href=\"" . $deal_info['url'] . "\">" . $deal_info['name'] . "</a>”"; $notices['user_name'] = get_user_name($message['user_id']); $notices['money'] = $user_load_data['true_repay_money'] + $user_load_data['impose_money']; $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_WORDS_MSG'", false); $GLOBALS['tmpl']->assign("notice", $notices); $contents = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']); send_user_msg("", $contents, 0, $deal['user_id'], TIME_UTC, 0, true, 13, $message['rel_id']); } //邮件 if ($msg_conf['mail_asked'] == 1 && app_conf('MAIL_ON') == 1) { $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_DEAL_MSG'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $GLOBALS['user_info']['user_name']; $notice['msg_user_name'] = get_user_name($message['user_id'], false); $notice['deal_name'] = $deal['name']; $notice['deal_url'] = SITE_DOMAIN . url("index", "deal", array("id" => $deal['id'])); $notice['message'] = $message['content']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['site_url'] = SITE_DOMAIN . APP_ROOT; $notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter"); $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $GLOBALS['user_info']['email']; $msg_data['send_type'] = 1; $msg_data['title'] = get_user_name($message['user_id'], false) . "给您的标留言!"; $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'] = $GLOBALS['user_info']['id']; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } } } if ($is_ajax == 1) { showSuccess("提交成功,请等待管理员审核", $is_ajax, $jumpurl); } else { app_redirect($jumpurl); } }
/** * 代还款 */ function do_site_repay($page = 1) { require_once APP_ROOT_PATH . "app/Lib/common.php"; require_once APP_ROOT_PATH . "app/Lib/deal.php"; $id = intval($_REQUEST['id']); $l_key = intval($_REQUEST['l_key']); $this->assign("jumpUrl", U("Deal/repay_plan", array("id" => $id))); if ($id == 0) { $this->success("数据错误"); } $deal_info = get_deal($id); if (!$deal_info) { $this->success("借款不存在"); } if ($deal_info['ips_bill_no'] != "") { $this->success("第三方同步暂无法代还款"); } if ($page == 0) { $page = 1; } $page_size = 10; $limit = ($page - 1) * $page_size . "," . $page_size; $user_loan_list = get_deal_user_load_list($deal_info, 0, $l_key, -1, 0, 0, 1, $limit); $rs_count = $user_loan_list['count']; $page_all = ceil($rs_count / $page_size); require_once APP_ROOT_PATH . "system/libs/user.php"; foreach ($user_loan_list['item'] as $kk => $vv) { if ($vv['has_repay'] == 0) { //借入者已还款,但是没打款到借出用户中心 $user_load_data = array(); $user_load_data['true_repay_time'] = TIME_UTC; $user_load_data['is_site_repay'] = 1; $user_load_data['status'] = 0; $user_load_data['repay_money'] = $vv['month_repay_money']; $user_load_data['manage_money'] = $vv['month_manage_money']; $user_load_data['impose_money'] = $vv['impose_money']; $user_load_data['repay_manage_impose_money'] = $vv['repay_manage_impose_money']; if ($vv['status'] > 0) { $user_load_data['status'] = $vv['status'] - 1; } $user_load_data['has_repay'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load_repay", $user_load_data, "UPDATE", "id=" . $vv['id'] . " AND has_repay = 0 ", "SILENT"); if ($GLOBALS['db']->affected_rows() > 0) { $content = "您好,您在" . app_conf("SHOP_TITLE") . "的投标 “<a href=\"" . $deal_info['url'] . "\">" . $deal_info['name'] . "</a>”成功还款" . ($vv['month_repay_money'] + $vv['impose_money']) . "元,"; $unext_loan = $user_loan_list[$vv['u_key']][$kk + 1]; if ($unext_loan) { $content .= "本笔投标的下个还款日为" . to_date($unext_loan['repay_day'], "Y年m月d日") . ",需还本息" . number_format($unext_loan['month_repay_money'], 2) . "元。"; } else { $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 deal_id=" . $deal_info['id'] . " AND user_id=" . $vv['user_id']), 2); $all_impose_money = number_format($GLOBALS['db']->getOne("SELECT sum(impose_money) FROM " . DB_PREFIX . "deal_load_repay WHERE deal_id=" . $deal_info['id'] . " AND user_id=" . $vv['user_id']), 2); $content .= "本次投标共获得收益:" . $all_repay_money . "元,其中违约金为:" . $all_impose_money . "元,本次投标已回款完毕!"; } if ($user_load_data['impose_money'] != 0 || $user_load_data['manage_money'] != 0 || $user_load_data['repay_money'] != 0) { $in_user_id = $vv['user_id']; //如果是转让债权那么将回款打入转让者的账户 if ($vv['t_user_id'] > 0) { $in_user_id = $vv['t_user_id']; $loan_user_info['user_name'] = $vv['user_name']; $loan_user_info['t_email'] = $vv['email']; $loan_user_info['t_mobile'] = $vv['mobile']; } else { $loan_user_info['user_name'] = $vv['t_user_name']; $loan_user_info['t_email'] = $vv['t_email']; $loan_user_info['t_mobile'] = $vv['t_mobile']; } //更新用户账户资金记录 if ($user_load_data['repay_money'] != 0) { modify_account(array("money" => $user_load_data['repay_money']), $in_user_id, "标:" . $deal_info['id'] . ",期:" . ($kk + 1) . ",回报本息"); } if ($user_load_data['impose_money'] != 0) { modify_account(array("money" => $user_load_data['impose_money']), $in_user_id, "标:" . $deal_info['id'] . ",期:" . ($kk + 1) . ",逾期罚息"); } if ($user_load_data['manage_money'] != 0) { modify_account(array("money" => -$user_load_data['manage_money']), $in_user_id, "标:" . $deal_info['id'] . ",期:" . ($kk + 1) . ",投标管理费"); } $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']->getRowCached("select * from " . DB_PREFIX . "msg_template where name = 'TPL_DEAL_LOAD_REPAY_SMS'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $loan_user_info['user_name']; $notice['deal_name'] = $deal_info['sub_name']; $notice['deal_url'] = $deal_info['url']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['repay_money'] = number_format($vv['month_repay_money'] + $vv['impose_money'], 2); if ($unext_loan) { $notice['need_next_repay'] = $unext_loan; $notice['next_repay_time'] = to_date($unext_loan['repay_day'], "Y年m月d日"); $notice['next_repay_money'] = number_format($unext_loan['month_repay_money'], 2); } else { $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_UTC; $msg_data['user_id'] = $in_user_id; $msg_data['is_html'] = 0; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } //站内信 if ($msg_conf['sms_bidrepaid'] == 1) { send_user_msg("", $content, 0, $in_user_id, TIME_UTC, 0, true, 9); } //邮件 if ($msg_conf['mail_bidrepaid'] == 1 && app_conf('MAIL_ON') == 1) { $tmpl = $GLOBALS['db']->getRowCached("select * from " . DB_PREFIX . "msg_template where name = 'TPL_DEAL_LOAD_REPAY_EMAIL'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $loan_user_info['user_name']; $notice['deal_name'] = $deal_info['sub_name']; $notice['deal_url'] = $deal_info['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'] = number_format($vv['month_repay_money'] + $vv['impose_money'], 2); if ($unext_loan) { $notice['need_next_repay'] = $unext_loan; $notice['next_repay_time'] = to_date($unext_loan['repay_day'], "Y年m月d日"); $notice['next_repay_money'] = number_format($unext_loan['month_repay_money'], 2); } else { $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_info['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'] = $in_user_id; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } } } if ($page >= $page_all) { $s_count = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_load_repay where deal_id=" . $id . " AND l_key=" . $l_key . " and has_repay = 0"); if ($s_count == 0) { $rs_sum = $GLOBALS['db']->getRow("SELECT sum(repay_money) as total_repay_money,sum(manage_money) as total_manage_money,sum(impose_money) as total_impose_money,sum(repay_manage_impose_money) as total_repay_manage_impose_money FROM " . DB_PREFIX . "deal_load_repay where deal_id=" . $id . " AND l_key=" . $l_key . " and has_repay = 1"); $deal_load_list = get_deal_load_list($deal_info); $GLOBALS['db']->query("UPDATE " . DB_PREFIX . "deal_repay set status = " . ($deal_load_list[$l_key]['status'] - 1) . ",true_repay_time = " . TIME_UTC . ", has_repay = 1, impose_money='" . floatval($rs_sum['total_impose_money']) . "',mange_impose_money='" . floatval($rs_sum['total_repay_manage_impose_money']) . "' where deal_id=" . $id . " AND l_key=" . $l_key . " and has_repay = 0"); if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "generation_repay WHERE deal_id=" . $id . " AND repay_id=" . $deal_load_list[$l_key]['repay_id'] . "") == 0) { $generation_repay['deal_id'] = $id; $generation_repay['repay_id'] = $deal_load_list[$l_key]['repay_id']; $adm_session = es_session::get(md5(conf("AUTH_KEY"))); $generation_repay['admin_id'] = $adm_session['adm_id']; $generation_repay['agency_id'] = $deal_info['agency_id']; $generation_repay['repay_money'] = $rs_sum['total_repay_money']; $generation_repay['impose_money'] = $rs_sum['total_impose_money']; $generation_repay['manage_money'] = $rs_sum['total_manage_money']; $generation_repay['manage_impose_money'] = $rs_sum['total_repay_manage_impose_money']; $generation_repay['create_time'] = TIME_UTC; $GLOBALS['db']->autoExecute(DB_PREFIX . "generation_repay", $generation_repay); } } $this->success("代还款执行完毕!"); } else { register_shutdown_function(array(&$this, 'do_site_repay'), $page + 1); } }
function do_reback() { $id = intval($_REQUEST['id']); if ($id == 0) { $this->error("操作失败", 0); die; } $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) { $this->error("不存在的债权"); die; } $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); if ($transfer['t_user_id'] > 0) { $this->error("债权已转让,无法撤销", 0); die; } $msg = strim($_POST['msg']); if ($msg == "") { $this->error("请输入撤销原因", 0); die; } $GLOBALS['db']->query("UPDATE " . DB_PREFIX . "deal_load_transfer SET status=0 WHERE id=" . $id); if ($GLOBALS['db']->affected_rows() > 0) { $notice['shop_title'] = app_conf("SHOP_TITLE"); $notice['url'] = "“<a href=\"" . url("index", "transfer#detail", array("id" => $v['id'])) . "\">Z-" . $v['load_id'] . "</a>”"; $notice['msg'] = "因为:“" . $msg . "”被管理员撤销了"; $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_DEAL_SUCCESS_SITE_SMS'", false); $GLOBALS['tmpl']->assign("notice", $notice); $content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']); send_user_msg("", $content, 0, $transfer['user_id'], TIME_UTC, 0, true, 17); save_log("撤销编号:{$id的债券转让}", 1); parent::success("撤销成功!"); die; } else { save_log("撤销编号:{$id的债券转让}", 0); $this->error("撤销失败!"); die; } }
public function send_pm() { if ($GLOBALS['user_info']) { $user_name = strim($_REQUEST['user_name']); $user_id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where user_name = '" . $user_name . "'"); if (intval($user_id) == 0) { $result['status'] = 0; $result['info'] = $GLOBALS['lang']['TO_USER_EMPTY']; ajax_return($result); } /*if($GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."user_focus where focused_user_name = '".$GLOBALS['user_info']['user_name']."' and focus_user_name = '".$user_name."'")==0) { //不是粉丝,验证是否有来信记录 $sql = "select count(*) from ".DB_PREFIX."msg_box where is_delete = 0 and (to_user_id = ".intval($GLOBALS['user_info']['id'])." and `type` = 0 and from_user_id = ".$user_id.")"; $inbox_count = $GLOBALS['db']->getOne($sql); if($inbox_count==0) { $result['status'] = 0; $result['info'] = $GLOBALS['lang']['FANS_ONLY']; ajax_return($result); } }*/ $content = btrim($_REQUEST['content']); send_user_msg("", $content, intval($GLOBALS['user_info']['id']), $user_id, TIME_UTC); $result['status'] = 1; $key = array($user_id, intval($GLOBALS['user_info']['id'])); sort($key); $group_key = implode("_", $key); $result['info'] = url("shop", "uc_msg#deal", array("id" => $group_key)); } else { $result['status'] = 0; $result['info'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST']; } ajax_return($result); }
function op_msg_del($id, $change, $reason, $check = false) { $message = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message where id = " . $id); if ($check) { $result['status'] = 1; return $result; } if (check_user_auth("msg", "del")) { $sql = "delete from " . DB_PREFIX . "message where id = " . $id; $GLOBALS['db']->query($sql); $o_reason = $reason; $reason .= "留言被删除"; if ($change == 1) { modify_account(get_op_change("msg", "del"), $message['user_id'], $reason); $reason .= get_op_change_show("msg", "del"); } if ($change == 1 || $o_reason != "") { send_user_msg($reason, $reason, intval($GLOBALS['user_info']['id']), $message['user_id'], get_gmtime(), 0, true, true); } $result['status'] = 1; } else { $result['status'] = 0; $result['info'] = "没有权限"; } return $result; }
public function modify_passed() { $id = intval($_REQUEST['id']); if ($id == 0) { echo "认证信息不存在"; exit; } $credit = D("UserCreditFile")->where("id=" . $id)->find(); if ($credit == 0) { echo "认证信息不存在"; exit; } $ispassed = intval($_REQUEST["passed"]); $field_array = array("credit_identificationscanning" => "idcardpassed", "credit_contact" => "workpassed", "credit_credit" => "creditpassed", "credit_incomeduty" => "incomepassed", "credit_house" => "housepassed", "credit_car" => "carpassed", "credit_marriage" => "marrypassed", "credit_titles" => "skillpassed", "credit_videoauth" => "videopassed", "credit_mobilereceipt" => "mobiletruepassed", "credit_residence" => "residencepassed", "credit_seal" => "sealpassed"); $credit_type = load_auto_cache("credit_type"); $typeinfo = $credit_type['list'][$credit['type']]; if ($field_array[$credit['type']]) { $data[$field_array[$credit['type']]] = $ispassed; if ($ispassed == 1) { $data[$field_array[$credit['type']] . '_time'] = TIME_UTC; } else { $data[$field_array[$credit['type']] . '_time'] = 0; } M('User')->where('id=' . $credit['user_id'])->save($data); } $u_info = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user WHERE id=" . $credit['user_id']); if ($ispassed > 0) { require_once APP_ROOT_PATH . "/system/libs/user.php"; if ($ispassed == 1) { modify_account(array('point' => $typeinfo['point']), $credit['user_id'], $typeinfo['type_name'], 8); } $content = "您好,您于 " . to_date($credit['create_time'], "Y年m月d日") . " "; if ($ispassed == 1) { $content .= "在" . app_conf('SHOP_TITLE') . "提交的" . $typeinfo['type_name'] . "信息已经成功通过审核。"; $user_current_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where id = " . intval($u_info['level_id'])); $user_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where point <=" . intval($u_info['point']) . " order by point desc"); if ($user_current_level['point'] < $user_level['point']) { $u_info['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $u_info['level_id'] . " where id = " . $u_info['id']); $pm_title = "您已经成为" . $user_level['name'] . ""; $pm_content = "恭喜您,您已经成为" . $user_level['name'] . "。"; require_once APP_ROOT_PATH . "/app/Lib/common.php"; send_user_msg($pm_title, $pm_content, 0, $u_info['id'], TIME_UTC, 0, true, true); $user_current_level['name'] = $user_level['name']; } $content .= "<br>您目前的信用分数为" . $u_info['point'] . "分(" . $user_current_level['name'] . "级),信用额度为" . $u_info['quota']; } else { $content .= "在" . app_conf('SHOP_TITLE') . "提交的" . $typeinfo['type_name'] . "信息未能通过审核。"; $content .= "未能通过的原因是“ " . $_REQUEST['msg'] . " ”"; } $group_arr = array(0, $credit['user_id']); sort($group_arr); $group_arr[] = intval($ispassed + 1); $msg_data['content'] = $content; $msg_data['to_user_id'] = $credit['user_id']; $msg_data['create_time'] = TIME_UTC; $msg_data['type'] = 0; $msg_data['group_key'] = implode("_", $group_arr); $msg_data['is_notice'] = intval($ispassed + 1); $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg_data); $id = $GLOBALS['db']->insert_id(); $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set group_key = '" . $msg_data['group_key'] . "_" . $id . "' where id = " . $id); $credit_data['status'] = 1; $credit_data['passed'] = $ispassed; $credit_data['passed_time'] = TIME_UTC; $credit_data['msg'] = $_REQUEST['msg']; $credit_data['checked'] = intval($_REQUEST['checked']); $GLOBALS['db']->autoExecute(DB_PREFIX . "user_credit_file", $credit_data, "UPDATE", "id = " . $credit['id']); save_log(l("ADMIN_MODIFY_CREDIT") . ":" . $u_info['user_name'] . " " . $typeinfo['type_name'], 1); } $this->success(L("UPDATE_SUCCESS")); }
/** * 代还款 */ function do_site_repay($page = 1) { require_once APP_ROOT_PATH . "app/Lib/common.php"; require_once APP_ROOT_PATH . "app/Lib/deal.php"; $id = intval($_REQUEST['id']); $l_key = intval($_REQUEST['l_key']); $this->assign("jumpUrl", U("Deal/repay_plan", array("id" => $id))); if ($id == 0) { $this->success("数据错误"); } $deal_info = get_deal($id); if (!$deal_info) { $this->success("借款不存在"); } if ($deal_info['ips_bill_no'] != "") { $this->success("第三方同步暂无法代还款"); } $user_id = $deal_info['user_id']; if ($page == 0) { $page = 1; } $page_size = 10; $limit = ($page - 1) * $page_size . "," . $page_size; $user_loan_list = get_deal_user_load_list($deal_info, 0, $l_key, -1, 0, 0, 1, $limit); $rs_count = $user_loan_list['count']; $page_all = ceil($rs_count / $page_size); require_once APP_ROOT_PATH . "system/libs/user.php"; foreach ($user_loan_list['item'] as $kk => $vv) { if ($vv['has_repay'] == 0) { //借入者已还款,但是没打款到借出用户中心 $user_load_data = array(); $user_load_data['true_repay_time'] = TIME_UTC; $user_load_data['true_repay_date'] = to_date(TIME_UTC); $user_load_data['is_site_repay'] = 1; $user_load_data['status'] = 0; $user_load_data['true_repay_money'] = (double) $vv['month_repay_money']; $user_load_data['true_self_money'] = (double) $vv['self_money']; $user_load_data['true_interest_money'] = (double) $vv['interest_money']; $user_load_data['true_manage_money'] = (double) $vv['manage_money']; $user_load_data['true_manage_interest_money'] = (double) $vv['manage_interest_money']; $user_load_data['true_repay_manage_money'] = (double) $vv['repay_manage_money']; $user_load_data['true_manage_interest_money_rebate'] = (double) $vv['manage_interest_money_rebate']; $user_load_data['impose_money'] = (double) $vv['impose_money']; $user_load_data['repay_manage_impose_money'] = (double) $vv['repay_manage_impose_money']; $user_load_data['true_reward_money'] = (double) $vv['reward_money']; if ($vv['status'] > 0) { $user_load_data['status'] = $vv['status'] - 1; } $user_load_data['has_repay'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load_repay", $user_load_data, "UPDATE", "id=" . $vv['id'] . " AND has_repay = 0 ", "SILENT"); if ($GLOBALS['db']->affected_rows() > 0) { //$content = "您好,您在".app_conf("SHOP_TITLE")."的投标 “<a href=\"".$deal_info['url']."\">".$deal_info['name']."</a>”成功还款".($user_load_data['true_repay_money']+$user_load_data['impose_money'])."元,"; $unext_loan = $user_loan_list[$vv['u_key']][$kk + 1]; if ($unext_loan) { //$content .= "本笔投标的下个还款日为".to_date($unext_loan['repay_day'],"Y年m月d日").",需还本息".number_format($unext_loan['month_repay_money'],2)."元。"; $notices['content'] = ",本笔投标的下个还款日为" . to_date($unext_loan['repay_day'], "Y年m月d日") . ",需还本息" . number_format($unext_loan['month_repay_money'], 2) . "元。"; } else { $load_repay_rs = $GLOBALS['db']->getOne("SELECT (sum(true_interest_money) + sum(impose_money)) as shouyi,sum(impose_money) as total_impose_money FROM " . DB_PREFIX . "deal_load_repay WHERE deal_id=" . $deal_info['id'] . " AND user_id=" . $vv['user_id']); $all_shouyi_money = number_format($load_repay_rs['shouyi'], 2); $all_impose_money = number_format($load_repay_rs['total_impose_money'], 2); //$content .= "本次投标共获得收益:".$all_shouyi_money."元,其中违约金为:".$all_impose_money."元,本次投标已回款完毕!"; $notices['content'] = ",本次投标共获得收益:" . $all_shouyi_money . "元,其中违约金为:" . $all_impose_money . "元,本次投标已回款完毕!"; } if ($user_load_data['impose_money'] != 0 || $user_load_data['true_manage_money'] != 0 || $user_load_data['true_repay_money'] != 0) { $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']; } //更新用户账户资金记录 modify_account(array("money" => $user_load_data['true_repay_money']), $in_user_id, "[<a href='" . $deal_info['url'] . "' target='_blank'>" . $deal_info['name'] . "</a>],第" . ($kk + 1) . "期,回报本息", 5); if ($user_load_data['true_manage_money'] > 0) { modify_account(array("money" => -$user_load_data['true_manage_money']), $in_user_id, "[<a href='" . $deal_info['url'] . "' target='_blank'>" . $deal_info['name'] . "</a>],第" . ($kk + 1) . "期,投标管理费", 20); } //利息管理费 modify_account(array("money" => -$user_load_data['true_manage_interest_money']), $in_user_id, "[<a href='" . $deal_info['url'] . "' target='_blank'>" . $deal_info['name'] . "</a>],第" . ($kk + 1) . "期,投标利息管理费", 20); if ($user_load_data['impose_money'] != 0) { modify_account(array("money" => $user_load_data['impose_money']), $in_user_id, "[<a href='" . $deal_info['url'] . "' target='_blank'>" . $deal_info['name'] . "</a>],第" . ($kk + 1) . "期,逾期罚息", 21); } //普通会员邀请返利 get_referrals($vv['id']); //投资者返佣金 if ($user_load_data['true_manage_interest_money_rebate'] != 0) { /*ok*/ $reback_memo = sprintf($GLOBALS['lang']["INVEST_REBATE_LOG"], $deal_info["url"], $deal_info["name"], $loan_user_info["user_name"], intval($vv["l_key"]) + 1); reback_rebate_money($in_user_id, $user_load_data['true_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'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $loan_user_info['user_name']; $notice['deal_name'] = $deal_info['sub_name']; $notice['deal_url'] = $deal_info['url']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['repay_money'] = number_format($user_load_data['true_repay_money'] + $user_load_data['impose_money'], 2); if ($unext_loan) { $notice['need_next_repay'] = $unext_loan; $notice['next_repay_time'] = to_date($unext_loan['repay_day'], "Y年m月d日"); $notice['next_repay_money'] = number_format($unext_loan['month_repay_money'], 2); } else { $notice['all_repay_money'] = $all_shouyi_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_UTC; $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_info['url'] . "\">" . $deal_info['name'] . "</a>”"; $notices['money'] = $user_load_data['true_repay_money'] + $user_load_data['impose_money']; $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_SITE_REPAY'", false); $GLOBALS['tmpl']->assign("notice", $notices); $content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']); if ($msg_conf['sms_bidrepaid'] == 1) { send_user_msg("", $content, 0, $in_user_id, TIME_UTC, 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_info['sub_name']; $notice['deal_url'] = $deal_info['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'] = number_format($vv['month_repay_money'] + $vv['impose_money'], 2); if ($unext_loan) { $notice['need_next_repay'] = $unext_loan; $notice['next_repay_time'] = to_date($unext_loan['repay_day'], "Y年m月d日"); $notice['next_repay_money'] = number_format($unext_loan['month_repay_money'], 2); } else { $notice['all_repay_money'] = $all_shouyi_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_info['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'] = $in_user_id; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } } } if ($page >= $page_all) { $s_count = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_load_repay where deal_id=" . $id . " AND l_key=" . $l_key . " and has_repay = 0"); $adm_session = es_session::get(md5(conf("AUTH_KEY"))); if ($s_count == 0) { $rs_sum = $GLOBALS['db']->getRow("SELECT sum(true_repay_money) as total_repay_money,sum(true_self_money) as total_self_money,sum(true_interest_money) as total_interest_money,sum(true_repay_manage_money) as total_manage_money,sum(impose_money) as total_impose_money,sum(repay_manage_impose_money) as total_repay_manage_impose_money FROM " . DB_PREFIX . "deal_load_repay where deal_id=" . $id . " AND l_key=" . $l_key . " and has_repay = 1"); $deal_load_list = get_deal_load_list($deal_info); //统计网站代还款 $rs_site_sum = $GLOBALS['db']->getRow("SELECT sum(true_repay_money) as total_repay_money,sum(true_self_money) as total_self_money,sum(true_repay_manage_money) as total_manage_money,sum(impose_money) as total_impose_money,sum(repay_manage_impose_money) as total_repay_manage_impose_money FROM " . DB_PREFIX . "deal_load_repay where deal_id=" . $id . " AND l_key=" . $l_key . " and is_site_repay=1 and has_repay = 1"); $repay_data['status'] = (int) $GLOBALS['db']->getOne("SELECT `status` FROM " . DB_PREFIX . "deal_load_repay where deal_id=" . $id . " AND l_key=" . $l_key . " and has_repay = 1 AND is_site_repay=1 ORDER BY l_key DESC"); $repay_data['true_repay_time'] = TIME_UTC; $repay_data['true_repay_date'] = to_date(TIME_UTC); $repay_data['has_repay'] = 1; $repay_data['impose_money'] = floatval($rs_sum['total_impose_money']); $repay_data['true_self_money'] = floatval($rs_sum['total_self_money']); $repay_data['true_repay_money'] = floatval($rs_sum['total_repay_money']); $repay_data['true_manage_money'] = floatval($rs_sum['total_manage_money']); $repay_data['true_interest_money'] = floatval($rs_sum['total_interest_money']); $repay_data['manage_impose_money'] = floatval($rs_sum['total_repay_manage_impose_money']); $rebate_rs = get_rebate_fee($user_id, "borrow"); $repay_data['true_manage_money_rebate'] = $repay_data['true_manage_money'] * floatval($rebate_rs['rebate']) / 100; //借款者返佣 if ($repay_data['true_manage_money_rebate'] != 0) { /*ok*/ $reback_memo = sprintf(L("BORROW_REBATE_LOG"), $deal_info["url"], $deal_info["name"], $deal_info["user"]["user_name"], intval($l_key) + 1); reback_rebate_money($user_id, $repay_data['true_manage_money_rebate'], "borrow", $reback_memo); } $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_repay", $repay_data, "UPDATE", " deal_id=" . $id . " AND l_key=" . $l_key . " and has_repay = 0 "); $impose_day = ceil((to_timespan(to_date(TIME_UTC, "Y-m-d"), "Y-m-d") - $deal_load_list[$l_key]['repay_day']) / 24 / 3600); if ($impose_day > 0) { //VIP 逾期还款降级 $type = 2; $type_info = 5; $resultdate = syn_user_vip($user_id, $type, $type_info); if ($impose_day < app_conf('YZ_IMPSE_DAY')) { modify_account(array("point" => trim(app_conf('IMPOSE_POINT'))), $deal_info['user_id'], "[<a href='" . $deal_info['url'] . "' target='_blank'>" . $deal_info['name'] . "</a>],第" . ($kk + 1) . "期,逾期还款", 11); } else { modify_account(array("point" => trim(app_conf('YZ_IMPOSE_POINT'))), $deal_info['user_id'], "[<a href='" . $deal_info['url'] . "' target='_blank'>" . $deal_info['name'] . "</a>],第" . ($kk + 1) . "期,严重逾期", 11); } } else { //VIP 代还款降级 $type = 2; $type_info = 6; $resultdate = syn_user_vip($user_id, $type, $type_info); } if ($rs_site_sum) { $r_msg = "网站代还款"; if ($rs_site_sum['total_repay_money'] > 0) { $r_msg .= ",本息:" . format_price($rs_site_sum['total_repay_money']); } if ($rs_site_sum['total_impose_money'] > 0) { $r_msg .= ",逾期费用:" . format_price($rs_site_sum['total_impose_money']); } if ($rs_site_sum['total_manage_money'] > 0) { $r_msg .= ",管理费:" . format_price($rs_site_sum['total_manage_money']); } if ($rs_site_sum['total_repay_manage_impose_money'] > 0) { $r_msg .= ",逾期管理费:" . format_price($rs_site_sum['total_repay_manage_impose_money']); } repay_log($deal_load_list[$l_key]['repay_id'], $r_msg, 0, $adm_session['adm_id']); } if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "generation_repay WHERE deal_id=" . $id . " AND repay_id=" . $deal_load_list[$l_key]['repay_id'] . "") == 0) { $generation_repay['deal_id'] = $id; $generation_repay['repay_id'] = $deal_load_list[$l_key]['repay_id']; $generation_repay['admin_id'] = $adm_session['adm_id']; $generation_repay['agency_id'] = $deal_info['agency_id']; $generation_repay['repay_money'] = $rs_site_sum['total_repay_money']; $generation_repay['self_money'] = $rs_site_sum['total_self_money']; $generation_repay['impose_money'] = $rs_site_sum['total_impose_money']; $generation_repay['manage_money'] = $rs_site_sum['total_manage_money']; $generation_repay['manage_impose_money'] = $rs_site_sum['total_repay_manage_impose_money']; $generation_repay['create_time'] = TIME_UTC; $generation_repay['create_date'] = to_date(TIME_UTC, "Y-m-d"); $GLOBALS['db']->autoExecute(DB_PREFIX . "generation_repay", $generation_repay); $site_money_data['user_id'] = $user_id; $site_money_data['create_time'] = TIME_UTC; $site_money_data['create_time_ymd'] = to_date(TIME_UTC, "Y-m-d"); $site_money_data['create_time_ym'] = to_date(TIME_UTC, "Ym"); $site_money_data['create_time_y'] = to_date(TIME_UTC, "Y"); if ($rs_sum['total_manage_money'] != 0) { $site_money_data['memo'] = "[<a href='" . $deal_info['url'] . "' target='_blank'>" . $deal_info['name'] . "</a>],第" . $l_key . "期,借款管理费"; $site_money_data['type'] = 10; $site_money_data['money'] = $rs_sum['total_manage_money']; $GLOBALS['db']->autoExecute(DB_PREFIX . "site_money_log", $site_money_data, "INSERT"); } if ($rs_sum['total_repay_manage_impose_money'] != 0) { $site_money_data['memo'] = "[<a href='" . $deal_info['url'] . "' target='_blank'>" . $deal_info['name'] . "</a>],第" . $l_key . "期,逾期管理费"; $site_money_data['type'] = 12; $site_money_data['money'] = $rs_sum['total_repay_manage_impose_money']; $GLOBALS['db']->autoExecute(DB_PREFIX . "site_money_log", $site_money_data, "INSERT"); } } } syn_deal_status($deal_info['id']); syn_transfer_status(0, $deal_info['id']); $this->success("代还款执行完毕!"); } else { register_shutdown_function(array(&$this, 'do_site_repay'), $page + 1); } }
/** * 处理会员登录 * @param $user_name_or_email 用户名或邮箱地址 * @param $user_pwd 密码 * */ function do_login_user($user_name_or_email, $user_pwd) { $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where (user_name='" . $user_name_or_email . "' or email = '" . $user_name_or_email . "' or mobile = '" . $user_name_or_email . "') and is_delete = 0"); //载入会员整合 $integrate_code = trim(app_conf("INTEGRATE_CODE")); if ($integrate_code != '') { $integrate_file = APP_ROOT_PATH . "system/integrate/" . $integrate_code . "_integrate.php"; if (file_exists($integrate_file)) { require_once $integrate_file; $integrate_class = $integrate_code . "_integrate"; $integrate_obj = new $integrate_class(); } } if ($integrate_obj) { $result = $integrate_obj->login($user_name_or_email, $user_pwd); } $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where (user_name='" . $user_name_or_email . "' or email = '" . $user_name_or_email . "' or mobile = '" . $user_name_or_email . "') and is_delete = 0"); if (!$user_data) { $result['status'] = 0; $result['data'] = ACCOUNT_NO_EXIST_ERROR; return $result; } else { $result['user'] = $user_data; if ($user_data['is_effect'] != 1) { $result['status'] = 0; $result['data'] = ACCOUNT_NO_VERIFY_ERROR; return $result; } $is_use_pass = false; if (strlen($user_pwd) == 32 && $user_data['user_pwd'] == $user_pwd) { $is_use_pass = true; } else { if ($user_data['user_pwd'] == md5($user_pwd . $user_data['code'])) { $is_use_pass = true; } } if ($is_use_pass) { $result['status'] = 1; $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id'])); $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc"); if ($user_current_group['score'] < $user_group['score'] && $user_data['group_id'] != $user_group['id'] && $user_group['id'] > 0) { $user_data['group_id'] = intval($user_group['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set group_id = " . $user_data['group_id'] . " where id = " . $user_data['id']); $pm_title = "您已经成为" . $user_group['name'] . ""; $pm_content = "恭喜您,您的会有组升级为" . $user_group['name'] . "。"; if ($user_group['discount'] < 1) { $pm_content .= "您将享有" . $user_group['discount'] * 10 . "折的购物优惠"; } send_user_msg($pm_title, $pm_content, 0, $user_data['id'], TIME_UTC, 0, true, true); } $user_current_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where id = " . intval($user_data['level_id'])); $user_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where point <=" . intval($user_data['point']) . " order by point desc"); if ($user_current_level['point'] <= $user_level['point'] && $user_data['level_id'] != $user_level['id'] && $user_level['id'] > 0) { $user_data['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']); $pm_title = "您信用等级升级为:" . $user_level['name'] . ""; $pm_content = "恭喜您,您的信用等级升级到" . $user_level['name'] . "。"; send_user_msg($pm_title, $pm_content, 0, $user_data['id'], TIME_UTC, 0, true, true); } if ($user_current_level['point'] > $user_level['point'] && $user_data['level_id'] != $user_level['id'] && $user_level['id'] > 0) { $user_data['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']); $pm_title = "您已经降为" . $user_level['name'] . ""; $pm_content = "很报歉,您的信用等级降为" . $user_level['name'] . "。"; send_user_msg($pm_title, $pm_content, 0, $user_data['id'], TIME_UTC, 0, true, true); } es_session::set("user_info", $user_data); $GLOBALS['user_info'] = $user_data; //检测勋章 $medal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "medal where is_effect = 1 and allow_check = 1"); foreach ($medal_list as $medal) { $file = APP_ROOT_PATH . "system/medal/" . $medal['class_name'] . "_medal.php"; $cls = $medal['class_name'] . "_medal"; if (file_exists($file)) { require_once $file; if (class_exists($cls)) { $o = new $cls(); $check_result = $o->check_medal(); if ($check_result['status'] == 0) { send_user_msg($check_result['info'], $check_result['info'], 0, $user_data['id'], TIME_UTC, 0, true, true); } } } } $GLOBALS['db']->query("update " . DB_PREFIX . "user set locate_time=login_time where id =" . $user_data['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set login_ip = '" . get_client_ip() . "',login_time= " . TIME_UTC . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']); $s_api_user_info = es_session::get("api_user_info"); if ($s_api_user_info) { $GLOBALS['db']->query("update " . DB_PREFIX . "user set " . $s_api_user_info['field'] . " = '" . $s_api_user_info['id'] . "' where id = " . $user_data['id'] . " and (" . $s_api_user_info['field'] . " = 0 or " . $s_api_user_info['field'] . "='')"); es_session::delete("api_user_info"); } $result['step'] = intval($user_data["step"]); return $result; } else { $result['status'] = 0; $result['data'] = ACCOUNT_PASSWORD_ERROR; return $result; } } }
public function modify_passed() { $id = intval($_REQUEST['id']); if ($id == 0) { echo "认证信息不存在"; exit; } $credit = D("UserCreditFile")->where("id=" . $id)->find(); if ($credit == 0) { echo "认证信息不存在"; exit; } $ispassed = intval($_REQUEST["passed"]); $field_array = array("credit_identificationscanning" => "idcardpassed", "credit_contact" => "workpassed", "credit_credit" => "creditpassed", "credit_incomeduty" => "incomepassed", "credit_house" => "housepassed", "credit_car" => "carpassed", "credit_marriage" => "marrypassed", "credit_titles" => "skillpassed", "credit_videoauth" => "videopassed", "credit_mobilereceipt" => "mobiletruepassed", "credit_residence" => "residencepassed", "credit_seal" => "sealpassed"); $credit_type = load_auto_cache("credit_type"); $typeinfo = $credit_type['list'][$credit['type']]; if ($field_array[$credit['type']]) { $data[$field_array[$credit['type']]] = $ispassed; if ($ispassed == 1) { $data[$field_array[$credit['type']] . '_time'] = TIME_UTC; } else { $data[$field_array[$credit['type']] . '_time'] = 0; } M('User')->where('id=' . $credit['user_id'])->save($data); } $u_info = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "user WHERE id=" . $credit['user_id']); if ($ispassed > 0) { require_once APP_ROOT_PATH . "/system/libs/user.php"; if ($ispassed == 1 && $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "user_point_log WHERE user_id='" . intval($credit['user_id']) . "' and memo='%" . $typeinfo['type_name'] . "%' and `type`= 8 ") == 0) { modify_account(array('point' => $typeinfo['point']), $credit['user_id'], $typeinfo['type_name'], 8); } if ($ispassed == 1) { $user_current_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where id = " . intval($u_info['level_id'])); $user_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where point <=" . intval($u_info['point']) . " order by point desc"); if ($user_current_level['point'] <= $user_level['point'] && $u_info['level_id'] != $user_level['id'] && $user_level['id'] > 0) { $u_info['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $u_info['level_id'] . " where id = " . $u_info['id']); require_once APP_ROOT_PATH . "/app/Lib/common.php"; $notice['level_name'] = $user_level['name']; $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_LEVEL_ADD'", false); $GLOBALS['tmpl']->assign("notice", $notice); $pm_content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']); send_user_msg("", $pm_content, 0, $u_info['id'], TIME_UTC, 0, true, true); $user_current_level['name'] = $user_level['name']; } $sh_notice['time'] = to_date($credit['create_time'], "Y年m月d日"); //提交审核时间 $sh_notice['shop_title'] = app_conf('SHOP_TITLE'); //站点名称 $sh_notice['type_name'] = $typeinfo['type_name']; //审核类型名 $sh_notice['point'] = $u_info['point']; //信用分数 $sh_notice['dengji'] = $user_current_level['name']; //信用等级名 $sh_notice['quota'] = $u_info['quota']; //信用额度 $sh_notice['msg'] = $_REQUEST['msg']; //未能通过原因 $GLOBALS['tmpl']->assign("sh_notice", $sh_notice); $tmpl_sh_succeed_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_INS_SUCCESS_SHEN_HE'", false); $sh_content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_sh_succeed_content['content']); } else { $sh_notice['time'] = to_date($credit['create_time'], "Y年m月d日"); //提交审核时间 $sh_notice['shop_title'] = app_conf('SHOP_TITLE'); //站点名称 $sh_notice['type_name'] = $typeinfo['type_name']; //审核类型名 $sh_notice['point'] = $u_info['point']; //信用分数 $sh_notice['quota'] = $u_info['quota']; //信用额度 $sh_notice['msg'] = $_REQUEST['msg']; //未能通过原因 $GLOBALS['tmpl']->assign("sh_notice", $sh_notice); $tmpl_sh_failed_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_INS_FAILED_SHEN_HE'", false); $sh_content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_sh_failed_content['content']); } $group_arr = array(0, $credit['user_id']); sort($group_arr); $group_arr[] = intval($ispassed + 1); $msg_data['content'] = $sh_content; $msg_data['to_user_id'] = $credit['user_id']; $msg_data['create_time'] = TIME_UTC; $msg_data['type'] = 0; $msg_data['group_key'] = implode("_", $group_arr); $msg_data['is_notice'] = intval($ispassed + 1); $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg_data); $id = $GLOBALS['db']->insert_id(); $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set group_key = '" . $msg_data['group_key'] . "_" . $id . "' where id = " . $id); $credit_data['status'] = 1; $credit_data['passed'] = $ispassed; $credit_data['passed_time'] = TIME_UTC; $credit_data['msg'] = $_REQUEST['msg']; $GLOBALS['db']->autoExecute(DB_PREFIX . "user_credit_file", $credit_data, "UPDATE", "id = " . $credit['id']); save_log(l("ADMIN_MODIFY_CREDIT") . ":" . $u_info['user_name'] . " " . $typeinfo['type_name'], 1); } $this->success(L("UPDATE_SUCCESS")); }
function savedeal() { $is_ajax = intval($_REQUEST['is_ajax']); if (!$GLOBALS['user_info']) { showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $is_ajax); } $t = trim($_REQUEST['t']); if (!in_array($t, array("save", "publish"))) { showErr($GLOBALS['lang']['ERROR_TITLE'], $is_ajax); } if ($t == "save") { $data['is_delete'] = 2; } else { $data['is_delete'] = 0; } $data['name'] = strim($_REQUEST['borrowtitle']); if (empty($data['name'])) { showErr("请输入借款标题", $is_ajax); } $data['publish_wait'] = 1; $icon_type = strim($_REQUEST['imgtype']); if ($icon_type == "") { showErr("请选择借款图片类型", $is_ajax); } $icon_type_arr = array('upload' => 1, 'userImg' => 2, 'systemImg' => 3); $data['icon_type'] = $icon_type_arr[$icon_type]; if (intval($data['icon_type']) == 0) { showErr("请选择借款图片类型", $is_ajax); } switch ($data['icon_type']) { case 1: if (strim($_REQUEST['icon']) == '') { showErr("请上传图片", $is_ajax); } else { $data['icon'] = replace_public(strim($_REQUEST['icon'])); } break; case 2: $data['icon'] = replace_public(get_user_avatar($GLOBALS['user_info']['id'], 'big')); break; case 3: if (intval($_REQUEST['systemimgpath']) == 0) { showErr("请选择系统图片", $is_ajax); } else { $data['icon'] = $GLOBALS['db']->getOne("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath'])); } break; } $data['type_id'] = intval($_REQUEST['borrowtype']); if ($data['type_id'] == 0) { showErr("请选择借款用途", $is_ajax); } $data['borrow_amount'] = floatval($_REQUEST['borrowamount']); if ($data['borrow_amount'] < (int) trim(app_conf('MIN_BORROW_QUOTA')) || $data['borrow_amount'] > (int) trim(app_conf('MAX_BORROW_QUOTA')) || $data['borrow_amount'] % 50 != 0) { showErr("请正确输入借款金额", $is_ajax); } //判断是否需要额度 if ($GLOBALS['db']->getOne("SELECT is_quota FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . $data['type_id']) == 1) { if (intval($GLOBALS['user_info']['quota']) != 0) { $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']); if ($data['borrow_amount'] > intval($can_use_quota)) { showErr("输入借款的借款金额超过您的可用额度<br>您当前可用额度为:" . $can_use_quota, $is_ajax); } } } $data['repay_time'] = intval($_REQUEST['repaytime']); if ($data['repay_time'] == 0) { showErr("借款期限", $is_ajax); } $data['rate'] = floatval($_REQUEST['apr']); $data['repay_time_type'] = intval($_REQUEST['repaytime_type']); $level_list = load_auto_cache("level"); $min_rate = 0; $max_rate = 0; $is_rate_lock = false; foreach ($level_list['repaytime_list'][$GLOBALS['user_info']['level_id']] as $kkk => $vvv) { if ($data['repay_time_type'] == 1) { if ($data['repay_time'] == intval($vvv[0]) && $vvv[1] == $data['repay_time_type']) { $min_rate = $vvv[2]; $max_rate = $vvv[3]; } } else { if ($data['repay_time'] <= intval($vvv[0]) && intval($vvv[1]) == $data['repay_time_type'] && $is_rate_lock == false) { $min_rate = $vvv[2]; $max_rate = $vvv[3]; $is_rate_lock = true; } elseif ($data['repay_time'] > intval($vvv[0]) && intval($vvv[1]) == $data['repay_time_type']) { $min_rate = $vvv[2]; $max_rate = $vvv[3]; } } } if (floatval($data['rate']) <= 0 || floatval($data['rate']) > $max_rate || floatval($data['rate']) < $min_rate) { showErr("请正确输入借款利率", $is_ajax); } $data['enddate'] = intval($_REQUEST['enddate']); $data['description'] = replace_public(btrim($_REQUEST['borrowdesc'])); $data['description'] = valid_tag($data['description']); if (trim($data['description']) == '') { showErr("请输入项目描述", $is_ajax); } $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; } } $datas['view_info'] = serialize($user_view_info); $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $datas, "UPDATE", "id=" . $GLOBALS['user_info']['id']); $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; } $data['view_info'] = serialize($data['view_info']); //资金运转 $data['remark_1'] = strim(replace_public($_REQUEST['remark_1'])); $data['remark_1'] = valid_tag($data['remark_1']); //风险控制措施 $data['remark_2'] = strim(replace_public($_REQUEST['remark_2'])); $data['remark_2'] = valid_tag($data['remark_2']); //政策及市场分析 $data['remark_3'] = strim(replace_public($_REQUEST['remark_3'])); $data['remark_3'] = valid_tag($data['remark_3']); //企业背景 $data['remark_4'] = strim(replace_public($_REQUEST['remark_4'])); $data['remark_4'] = valid_tag($data['remark_4']); //企业信息 $data['remark_5'] = strim(replace_public($_REQUEST['remark_5'])); $data['remark_5'] = valid_tag($data['remark_5']); //项目相关资料 $data['remark_6'] = strim(replace_public($_REQUEST['remark_6'])); $data['remark_6'] = valid_tag($data['remark_6']); //$data['voffice'] = intval($_REQUEST['voffice']); //$data['vposition'] = intval($_REQUEST['vposition']); $data['voffice'] = 1; $data['vposition'] = 1; $data['is_effect'] = 1; $data['deal_status'] = 0; $data['agency_id'] = intval($_REQUEST['agency_id']); $data['agency_status'] = 1; $data['warrant'] = intval($_REQUEST['warrant']); $data['guarantor_margin_amt'] = floatval($_REQUEST['guarantor_margin_amt']); $data['guarantor_pro_fit_amt'] = floatval($_REQUEST['guarantor_pro_fit_amt']); $data['user_id'] = intval($GLOBALS['user_info']['id']); $data['loantype'] = intval($_REQUEST['loantype']); if ($data['repay_time_type'] == 0) { $data['loantype'] = 2; } //当为天的时候 if ($data['repay_time_type'] == 0) { $true_repay_time = 1; } else { $true_repay_time = $data['repay_time']; } //本金担保 if ($data['warrant'] == 1) { $data['guarantor_amt'] = $data['borrow_amount']; } elseif ($data['warrant'] == 2) { //等额本息 if ($data['loantype'] == 0) { $data['guarantor_amt'] = pl_it_formula($data['borrow_amount'], $data['rate'] / 12 / 100, $true_repay_time) * $true_repay_time; } elseif ($data['loantype'] == 1) { $data['guarantor_amt'] = av_it_formula($data['borrow_amount'], $data['rate'] / 12 / 100) * $true_repay_time + $data['borrow_amount']; } elseif ($data['loantype'] == 2) { $data['guarantor_amt'] = $data['borrow_amount'] * $data['rate'] / 12 / 100 * $true_repay_time + $data['borrow_amount']; } } $data['create_time'] = TIME_UTC; $module = "INSERT"; $jumpurl = url("index", "borrow#steptwo"); $condition = ""; $deal_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "deal WHERE ((is_delete=2 or is_delete=3) or (is_delete=0 and publish_wait=1)) AND user_id=" . $GLOBALS['user_info']['id']); if ($deal_id > 0) { $module = "UPDATE"; if ($t == "save") { $jumpurl = url("index", "borrow#stepone"); } $condition = "id = {$deal_id}"; } else { if ($t == "save") { $jumpurl = url("index", "borrow#stepone"); } } $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, $module, $condition); if ($module == "INSERT") { $deal_id = $GLOBALS['db']->insert_id(); } require_once APP_ROOT_PATH . 'app/Lib/deal.php'; $deal = get_deal($deal_id); //发送验证通知 if ($t != "save" && trim(app_conf('CUSTOM_SERVICE')) != '' && ($GLOBALS['user_info']['idcardpassed'] == 0 || $GLOBALS['user_info']['incomepassed'] == 0 || $GLOBALS['user_info']['creditpassed'] == 0 || $GLOBALS['user_info']['workpassed'] == 0)) { $ulist = explode(",", trim(app_conf('CUSTOM_SERVICE'))); $ulist = array_filter($ulist); if ($ulist) { $uuid = $ulist[array_rand($ulist)]; if ($uuid > 0) { $content = app_conf("SHOP_TITLE") . "用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话 " . app_conf('SHOP_TEL') . " 或给客服邮箱发邮件 " . app_conf("REPLY_ADDRESS") . " 我们会及时给您回复。"; require_once APP_ROOT_PATH . 'app/Lib/message.php'; //添加留言 $message['title'] = $content; $message['content'] = htmlspecialchars(addslashes(valid_str($content))); $message['title'] = valid_str($message['title']); $message['create_time'] = TIME_UTC; $message['rel_table'] = "deal"; $message['rel_id'] = $deal_id; $message['user_id'] = $uuid; $message['is_effect'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message); //添加到动态 insert_topic("message", $message['rel_id'], $message['user_id'], get_user_name($message['user_id'], false), $GLOBALS['user_info']['id']); //自己给自己留言不执行操作 if ($deal['user_id'] != $message['user_id']) { $msg_conf = get_user_msg_conf($deal['user_id']); //站内信 if ($msg_conf['sms_asked'] == 1) { $notices['shop_title'] = app_conf("SHOP_TITLE"); $notices['shop_tel'] = app_conf('SHOP_TEL'); $notices['shop_address'] = app_conf("REPLY_ADDRESS"); /*{$notice.shop_title}用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话{$notice.shop_tel}或给客服邮箱发邮件{$notice.shop_address}我们会及时给您回复。*/ $notices['url'] = "“<a href=\"" . $deal_info['url'] . "\">" . $deal_info['name'] . "</a>”"; $notices['user_name'] = get_user_name($message['user_id']); $notices['money'] = $user_load_data['true_repay_money'] + $user_load_data['impose_money']; $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_WORDS_MSG'", false); $GLOBALS['tmpl']->assign("notice", $notices); $contents = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']); send_user_msg("", $contents, 0, $deal['user_id'], TIME_UTC, 0, true, 13, $message['rel_id']); } //邮件 if ($msg_conf['mail_asked'] == 1 && app_conf('MAIL_ON') == 1) { $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_DEAL_MSG'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $GLOBALS['user_info']['user_name']; $notice['msg_user_name'] = get_user_name($message['user_id'], false); $notice['deal_name'] = $deal['name']; $notice['deal_url'] = SITE_DOMAIN . url("index", "deal", array("id" => $deal['id'])); $notice['message'] = $message['content']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['site_url'] = SITE_DOMAIN . APP_ROOT; $notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter"); $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $GLOBALS['user_info']['email']; $msg_data['send_type'] = 1; $msg_data['title'] = get_user_name($message['user_id'], false) . "给您的标留言!"; $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'] = $GLOBALS['user_info']['id']; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } } } if ($is_ajax == 1) { showSuccess($GLOBALS['lang']['SUCCESS_TITLE'], $is_ajax, $jumpurl); } else { app_redirect($jumpurl); } }
function syn_rebid_match($id) { if (intval(app_conf("VIRTUAL_MONEY_DIELINE"))) { // 体验金有效期 $rebid = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "rebid_submit where id = " . $id); if ($rebid) { if (time() > $rebid['op_time'] + app_conf("VIRTUAL_MONEY_DIELINE") * 24 * 60 * 60) { $deal['status'] = 3; $GLOBALS['db']->autoExecute(DB_PREFIX . "rebid_submit", $deal, $mode = 'UPDATE', "id=" . $id, $querymode = 'SILENT'); // 修改体验金余额 require_once APP_ROOT_PATH . "system/libs/user.php"; modify_account(array("money" => -$rebid['money']), $rebid['user_id'], "体验金失效", 27, 1); save_log("编号为" . $rebid['id'] . "的体验金申请已过期", 1); //站内信 $content = "您于" . to_date($rebid['create_time'], "Y年m月d日 H:i:s") . "申请的" . format_price($rebid['money']) . "体验金已失效,请查看您的申请记录。"; require_once APP_ROOT_PATH . "/app/Lib/common.php"; send_user_msg("", $content, 0, $rebid['user_id'], TIME_UTC, 0, true, 21); } } } }