public function index() { global $tmpl; $rel_table = addslashes(trim($_REQUEST['act'])); $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "' and type_name <> 'supplier'"); if (!$message_type || $message_type['is_fix'] == 0) { app_redirect(APP_ROOT . "/"); } $rel_table = $message_type['type_name']; $condition = ''; $id = intval($_REQUEST['id']); if ($rel_table == 'deal') { $deal = get_deal($id); if ($deal['buy_type'] != 1) { $GLOBALS['tmpl']->assign("deal", $deal); } $id = $deal['id']; } require APP_ROOT_PATH . 'app/Lib/side.php'; if ($id > 0) { $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id; } else { $condition = "rel_table = '" . $rel_table . "'"; } if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { if ($message_type['is_effect'] == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } $condition .= " and is_buy = " . intval($_REQUEST['is_buy']); //message_form 变量输出 $GLOBALS['tmpl']->assign("post_title", $message_type['show_name']); $GLOBALS['tmpl']->assign("page_title", $message_type['show_name']); $GLOBALS['tmpl']->assign('rel_id', $id); $GLOBALS['tmpl']->assign('rel_table', $rel_table); $GLOBALS['tmpl']->assign('is_buy', intval($_REQUEST['is_buy'])); if (intval($_REQUEST['is_buy']) == 1) { $GLOBALS['tmpl']->assign("post_title", $GLOBALS['lang']['AFTER_BUY']); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['AFTER_BUY']); } if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $message = get_message_list($limit, $condition); $page = new Page($message['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("message_list", $message['list']); $GLOBALS['tmpl']->assign("user_auth", get_user_auth()); $GLOBALS['tmpl']->display("message.html"); }
/** * 检测团购的时间状态 * $id 团购ID * */ function check_deal_time($id) { $deal_info = get_deal($id); $now = TIME_UTC; //开始验证团购时间 if ($deal_info['begin_time'] != 0) { //有开始时间 if ($now < $deal_info['begin_time']) { $result['status'] = 0; $result['data'] = DEAL_NOTICE; //未上线 $result['info'] = $deal_info['sub_name']; return $result; } } if ($deal_info['end_time'] != 0) { //有结束时间 if ($now >= $deal_info['end_time']) { $result['status'] = 0; $result['data'] = DEAL_HISTORY; //过期 $result['info'] = $deal_info['sub_name']; return $result; } } //验证团购时间 $result['status'] = 1; $result['info'] = $deal_info['name']; return $result; }
public function index() { $root = array(); $id = intval($GLOBALS['request']['id']); $deal = get_deal($id); //send_deal_contract_email($id,$deal,$deal['user_id']); //发送电子协议邮件 $root['deal'] = $deal; //借款列表 $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $id); $u_info = get_user("*", $deal['user_id']); //可用额度 $can_use_quota = get_can_use_quota($deal['user_id']); $root['can_use_quota'] = $can_use_quota; $credit_file = get_user_credit_file($deal['user_id']); $deal['is_faved'] = 0; /* if($GLOBALS['user_info']){ $deal['is_faved'] = $GLOBALS['db']->getOne("SELECT count(*) FROM ".DB_PREFIX."deal_collect WHERE deal_id = ".$id." AND user_id=".intval($GLOBALS['user_info']['id'])); if($deal['deal_status'] >=4){ //还款列表 $loan_repay_list = get_deal_load_list($deal); $root['loan_repay_list']= $loan_repay_list; foreach($load_list as $k=>$v){ $load_list[$k]['remain_money'] = $v['money'] - $GLOBALS['db']->getOne("SELECT sum(self_money) FROM ".DB_PREFIX."deal_load_repay WHERE user_id=".$v['user_id']." AND deal_id=".$id); if($load_list[$k]['remain_money'] <=0){ $load_list[$k]['remain_money'] = 0; $load_list[$k]['status'] = 1; } } } }*/ $user_statics = sys_user_status($deal['user_id'], true); $root['user_statics'] = $user_statics; //借款笔数 $root['load_list'] = $load_list; $root['credit_file'] = $credit_file; $root['u_info'] = $u_info; //工作认证是否过期 $root['expire'] = user_info_expire($u_info); //留言 $message_list = $GLOBALS['db']->getAll("SELECT title,content,a.create_time,rel_id,a.user_id,a.is_effect,b.user_name FROM " . DB_PREFIX . "message as a left join " . DB_PREFIX . "user as b on a.user_id = b.id WHERE rel_id = " . $id); $root['message'] = $message_list; //seo if ($deal['type_match_row']) { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name']; } else { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']; } $root['page_title'] = $seo_title; $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name']; $root['page_keyword'] = $seo_keyword; $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']; $root['seo_description'] = $seo_description; output($root); }
public function index() { $root = array(); require_once APP_ROOT_PATH . "app/Lib/deal_func.php"; $id = intval($GLOBALS['request']['id']); $minmoney = floatval($GLOBALS['request']['money']); $number = floatval($GLOBALS['request']['number']); $deal = $GLOBALS['cache']->get("MOBILE_DEAL_BY_ID_" . $id); if ($deal === false) { $deal = get_deal($id); $GLOBALS['cache']->set("MOBILE_DEAL_BY_ID_" . $id, $deal, 300); } $parmas = array(); //$parmas['uloantype'] = 1; $parmas['uloantype'] = $deal['uloadtype']; if ($deal['uloadtype'] == 1) { $parmas['minmoney'] = $minmoney; $parmas['money'] = $number; } else { $parmas['money'] = $minmoney; } $parmas['loantype'] = $deal['loantype']; $parmas['rate'] = $deal['rate']; $parmas['repay_time'] = $deal['repay_time']; $parmas['repay_time_type'] = $deal['repay_time_type']; $parmas['user_loan_manage_fee'] = $deal['user_loan_manage_fee']; $parmas['user_loan_interest_manage_fee'] = $deal['user_loan_interest_manage_fee']; $root['profit'] = bid_calculate($parmas); $root['profit'] = "¥" . $root['profit']; $root['response_code'] = 1; output($root); }
public function index() { require_once APP_ROOT_PATH . 'app/Lib/deal.php'; /** * has_attr: 0:无属性; 1:有属性 * 有商品属性在要购买时,要选择属性后,才能购买 * change_cart_request_server: * 编辑购买车商品时,需要提交到服务器端,让服务器端通过一些判断返回一些信息回来(如:满多少钱,可以免运费等一些提示) * 0:提交,1:不提交; * image_attr_a_id_{$attr_a_id} 图片列表,可以根据属性ID值,来切换图片列表;默认为:0 * limit_num: 库存数量 */ $id = intval($GLOBALS['request']['id']); //商品ID $item = get_deal($id); $root = getGoodsArray($item); $root['return'] = 1; $root['attr'] = getAttrArray($id); $images = array(); //image_attr_1_id_{$attr_1_id} 图片列表,可以根据属性ID值,来切换图片列表 $sql = "select img from " . DB_PREFIX . "deal_gallery where deal_id = " . intval($id); $list = $GLOBALS['db']->getAll($sql); $gallery = array(); $big_gallery = array(); foreach ($list as $k => $image) { $gallery[] = get_abs_img_root(get_spec_image($image['img'], 320, 320, 0)); $big_gallery[] = get_abs_img_root(get_spec_image($image['img'], 0, 0, 0)); } $root['gallery'] = $gallery; $root['big_gallery'] = $big_gallery; output($root); }
public function index() { $root = array(); $id = intval($GLOBALS['request']['id']); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { $root['is_faved'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_collect WHERE deal_id = " . $id . " AND user_id=" . $user_id); } else { $root['is_faved'] = 0; //0:未关注;>0:已关注 } $root['response_code'] = 1; $deal = get_deal($id); //format_deal_item($deal,$email,$pwd); //print_r($deal); //exit; $root['deal'] = $deal; //data.deal.name output($root); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $id = intval($GLOBALS['request']['id']); //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { require APP_ROOT_PATH . 'app/Lib/deal.php'; $root['user_login_status'] = 1; $deal = get_deal($id); if (!$deal || $deal['user_id'] != $user_id || $deal['deal_status'] != 4) { $root['show_err'] = "操作失败!"; $root['response_code'] = 0; } else { //还款列表 $loan_list = get_deal_load_list($deal); $root['loan_list'] = $loan_list; $root['deal'] = $deal; $root['response_code'] = 1; $root['show_err'] = ''; } } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $id = intval($GLOBALS['request']['id']); //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { require APP_ROOT_PATH . 'app/Lib/deal.php'; $root['user_login_status'] = 1; $deal = get_deal($id); $root['deal'] = $deal; //还款列表 $loan_list = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "deal_repay where deal_id={$id} ORDER BY repay_time ASC"); $manage_fee = 0; $impose_money = 0; $repay_money = 0; foreach ($loan_list as $k => $v) { $manage_fee += $v['manage_money']; $impose_money += $v['impose_money']; $repay_money += $v['repay_money']; //还款日 $loan_list[$k]['repay_time_format'] = to_date($v['repay_time'], 'Y-m-d'); $loan_list[$k]['true_repay_time_format'] = to_date($v['true_repay_time'], 'Y-m-d'); //待还本息 $loan_list[$k]['repay_money_format'] = format_price($v['repay_money']); //借款管理费 $loan_list[$k]['manage_money_format'] = format_price($v['manage_money']); //逾期费用 $loan_list[$k]['impose_money_format'] = format_price($v['impose_money']); //状态 if ($v['status'] == 0) { $loan_list[$k]['status_format'] = '提前还款'; } elseif ($v['status'] == 1) { $loan_list[$k]['status_format'] = '准时还款'; } elseif ($v['status'] == 2) { $loan_list[$k]['status_format'] = '逾期还款'; } elseif ($v['status'] == 3) { $loan_list[$k]['status_format'] = '严重逾期'; } } $root['manage_fee'] = $manage_fee; $root['impose_money'] = $impose_money; $root['repay_money'] = $repay_money; $root['loan_list'] = $loan_list; $inrepay_info = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "deal_inrepay_repay WHERE deal_id={$id}"); $root['inrepay_info'] = $inrepay_info; } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } $root['program_title'] = "提前还款"; output($root); }
public function index() { $content = strim($GLOBALS['request']['content']); //点评内容 $point = intval($GLOBALS['request']['point']); //点评分数 $deal_id = intval($GLOBALS['request']['id']); //团购或商品id //只有购买后,才能点评 //检查用户,用户密码 $user = $GLOBALS['user_info']; $user_id = intval($user['id']); $money = floatval($user['money']); $root = array(); $root['return'] = 1; if ($user_id > 0) { $GLOBALS['user_info'] = $user; $root['user_login_status'] = 1; require_once APP_ROOT_PATH . "system/model/review.php"; require_once APP_ROOT_PATH . "system/model/deal.php"; $deal_info = get_deal($deal_id); if ($deal_info['is_shop'] == 1) { $cfg = load_dp_cfg(array("scate_id" => $deal_info['shop_cate_id'])); } else { $cfg = load_dp_cfg(array("cate_id" => $deal_info['cate_id'])); } $point_group = array(); foreach ($cfg['point_group'] as $row) { $point_group[$row['id']] = $point; } $dp_img = array(); if (count($_FILES['file']['name']) > 9) { $root['status'] = 0; $root['info'] = '上传图片不能超过9张'; } else { //同步图片 foreach ($_FILES['file']['name'] as $k => $v) { $_files['file']['name'] = $v; $_files['file']['type'] = $_FILES['file']['type'][$k]; $_files['file']['tmp_name'] = $_FILES['file']['tmp_name'][$k]; $_files['file']['error'] = $_FILES['file']['error'][$k]; $_files['file']['size'] = $_FILES['file']['size'][$k]; $res = upload_topic($_files); if ($res['error'] == 0) { $dp_img[] = $res['url']; } } $result = save_review($user_id, array("deal_id" => $deal_id), $content, $point, $dp_img, array(), $point_group); //$result = add_deal_dp($user_id, $content, $point, $deal_id); $root['status'] = $result['status']; $root['info'] = $result['info']; } } else { $root['user_login_status'] = 0; $root['status'] = 0; $root['info'] = '请先登录'; } output($root); }
public function load($param) { $key = $this->build_key(__CLASS__, $param); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/"); $deal_info = $GLOBALS['fcache']->get($key); if ($deal_info === false) { $id = intval($param['id']); $deal_info = get_deal($id); $GLOBALS['fcache']->set_dir(APP_ROOT_PATH . "public/runtime/data/" . __CLASS__ . "/"); $GLOBALS['fcache']->set($key, $deal_info); } return $deal_info; }
public function index() { $root = array(); $id = intval($GLOBALS['request']['id']); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { $root['is_faved'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_collect WHERE deal_id = " . $id . " AND user_id=" . $user_id); } else { $root['is_faved'] = 0; //0:未关注;>0:已关注 } $root['response_code'] = 1; $deal = get_deal($id); //format_deal_item($deal,$email,$pwd); //print_r($deal); //exit; $root['deal'] = $deal; $root['open_ips'] = intval(app_conf("OPEN_IPS")); $root['ips_acct_no'] = $user['ips_acct_no']; $root['ips_bill_no'] = $deal['ips_bill_no']; // function bid_calculate(){ // require_once APP_ROOT_PATH."app/Lib/deal_func.php"; // echo bid_calculate($_POST); // } if (!empty($root['ips_bill_no'])) { //第三方托管标 if (!empty($user['ips_acct_no'])) { $result = GetIpsUserMoney($user_id, 0); $root['user_money'] = $result['pBalance']; } else { $root['user_money'] = 0; } } else { $root['user_money'] = $user['money']; } $root['user_money_format'] = format_price($user['user_money']); //用户金额 //data.deal.name $root['program_title'] = "投标详情"; output($root); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $deal_id = intval($GLOBALS['request']['id']); $l_key = intval($GLOBALS['request']['l_key']); //$l_key = 2; //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { require APP_ROOT_PATH . 'app/Lib/deal.php'; $root['user_login_status'] = 1; $deal = get_deal($deal_id, 0); $root['deal'] = $deal; $page = intval($GLOBALS['request']['page']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $count = $GLOBALS['db']->getOne(" SELECT count(*) FROM " . DB_PREFIX . "deal_load_repay dlr where dlr.deal_id ='{$deal_id}' and dlr.l_key='{$l_key}' "); // $load_user = $GLOBALS['db']->getAll("SELECT dlr.*,u.user_name FROM ".DB_PREFIX."deal_load_repay dlr left join ".DB_PREFIX."user u on dlr.user_id = u.id where dlr.deal_id ='$deal_id' and dlr.l_key='$l_key' order by dlr.id limit $limit "); // $root['page'] = array("page"=>$page,"page_total"=>ceil($count/app_conf("PAGE_SIZE")),"page_size"=>app_conf("PAGE_SIZE")); // foreach ($load_user as $k=>$v) // { // //$load_user[$k]['month_repay_money']=$v['self_money']+$v['interest_money']; // $load_user[$k]['month_repay_money']=$v['repay_money']; // } // // $root['load_user'] = $load_user; $load_user = get_deal_user_load_list($deal, 0, $l_key, -1, 0, 0, 1, $limit); $root['page'] = array("page" => $page, "page_total" => ceil($count / app_conf("PAGE_SIZE")), "page_size" => app_conf("PAGE_SIZE")); $root['load_user'] = $load_user['item']; $root['response_code'] = 1; $root['show_err'] = ''; } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } $root['program_title'] = "查看明细"; output($root); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { $root['user_login_status'] = 1; $id = intval($GLOBALS['request']['id']); $deal = get_deal($id); $bid_money = floatval($GLOBALS['request']["bid_money"]); $buy_number = $GLOBALS['request']["buy_number"]; if ($deal['uloadtype'] == 1 && $buy_number > 1) { $bid_money = $buy_number * $bid_money; } $bid_paypassword = strim($GLOBALS['request']['bid_paypassword']); $status = dobid2($id, $bid_money, $bid_paypassword); $root['status'] = $status['status']; if ($status['status'] == 2) { $root['response_code'] = 1; $root['app_url'] = $status['jump']; } else { if ($status['status'] != 1) { $root['response_code'] = 0; $root['show_err'] = $status['show_err']; } else { $root['response_code'] = 1; $root['show_err'] = $GLOBALS['lang']['DEAL_BID_SUCCESS']; $root['id'] = $id; } } } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $id = intval($GLOBALS['request']['id']); //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { require APP_ROOT_PATH . 'app/Lib/deal.php'; $root['user_login_status'] = 1; $deal = get_deal($id); if (!$deal || $deal['user_id'] != $user_id || $deal['deal_status'] != 4) { $root['show_err'] = "操作失败!"; $root['response_code'] = 0; } else { //还款列表 $loan_list = get_deal_load_list($deal); $flag = 1; foreach ($loan_list as $k => $v) { if ($loan_list[$k]['has_repay'] == 0 && $flag == 1) { $loan_list[$k]["flag"] = $flag; $flag = 0; } } $root['loan_list'] = $loan_list; $root['deal'] = $deal; $root['response_code'] = 1; $root['show_err'] = ''; } } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } $root['program_title'] = "还款"; output($root); }
public function index() { $root = array(); $id = intval($GLOBALS['request']['id']); $deal = get_deal($id); //send_deal_contract_email($id,$deal,$deal['user_id']); //发送电子协议邮件 $root['deal'] = $deal; //借款列表 $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $id); $u_info = get_user("*", $deal['user_id']); //可用额度 $can_use_quota = get_can_use_quota($deal['user_id']); $root['can_use_quota'] = $can_use_quota; $credit_file = get_user_credit_file($deal['user_id']); $deal['is_faved'] = 0; $user_statics = sys_user_status($deal['user_id'], true); $root['user_statics'] = $user_statics; //借款笔数 $root['load_list'] = $load_list; $root['credit_file'] = $credit_file; $root['u_info'] = $u_info; //工作认证是否过期 $root['expire'] = user_info_expire($u_info); //留言 $message_list = $GLOBALS['db']->getAll("SELECT a.title,a.content,a.create_time,a.rel_id,a.user_id,a.is_effect,b.user_name FROM " . DB_PREFIX . "message as a left join " . DB_PREFIX . "user as b on a.user_id = b.id WHERE a.rel_id = " . $id); $root['message'] = $message_list; //seo if ($deal['type_match_row']) { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name']; } else { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']; } $root['page_title'] = $seo_title; $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name']; $root['page_keyword'] = $seo_keyword; $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']; $root['seo_description'] = $seo_description; $root['program_title'] = "详细信息"; output($root); }
/** * 加载相应的类型消息 * @param unknown_type $msg 数据集(即数据库中的对应消息行) * * 返回:array("id"=>"当前消息ID",title="标题",is_read=>"是否已读","icon"=>"相关数据的图片(可为空)","content"=>"内容","create_time"=>"时间","link"=>"(可为空)相关数据的跳转链接"); */ public function load_msg($msg) { if (!$msg['data']) { $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_dp where id = " . $msg['data_id']); if ($data['deal_id'] > 0) { require_once APP_ROOT_PATH . "system/model/deal.php"; $data_info = get_deal($data['deal_id']); $data['url'] = $data_info['url']; $data['icon'] = $data_info['icon']; $data['title'] = $data_info['name']; } elseif ($data['youhui_id'] > 0) { require_once APP_ROOT_PATH . "system/model/youhui.php"; $data_info = get_youhui($data['youhui_id']); $data['url'] = $data_info['url']; $data['icon'] = $data_info['icon']; $data['title'] = $data_info['name']; } elseif ($data['event_id'] > 0) { require_once APP_ROOT_PATH . "system/model/event.php"; $data_info = get_event($data['event_id']); $data['url'] = $data_info['url']; $data['icon'] = $data_info['icon']; $data['title'] = $data_info['name']; } else { require_once APP_ROOT_PATH . "system/model/supplier.php"; $data_info = get_location($data['supplier_location_id']); $data['url'] = $data_info['url']; $data['icon'] = $data_info['preview']; $data['title'] = $data_info['name']; } $msg['data'] = serialize($data); $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg, "UPDATE", "id=" . $msg['id'], "SILENT"); } $data = unserialize($msg['data']); $msg['icon'] = $data['icon']; $msg['link'] = $data['url']; $msg['title'] = "对 [" . $data['title'] . "] 的点评"; $msg['short_title'] = "对 [" . msubstr($msg['title']) . "] 的点评"; return $msg; }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { $root['user_login_status'] = 1; $id = intval($GLOBALS['request']['id']); $deal = get_deal($id); if ($deal) { if ($deal['user_id'] == $GLOBALS['user_info']['id']) { $root['response_code'] = 0; $root['show_err'] = $GLOBALS['lang']['CANT_BID_BY_YOURSELF']; //当response_code != 0 时,返回:错误内容 } else { $root['deal'] = $deal; $root['user_money'] = $user['money']; //用户金额 $root['user_money_format'] = format_price($user['money']); //用户金额 $root['response_code'] = 1; } } else { $root['response_code'] = 0; } } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function index() { require_once APP_ROOT_PATH . 'system/model/deal.php'; /** * has_attr: 0:无属性; 1:有属性 * 有商品属性在要购买时,要选择属性后,才能购买 * change_cart_request_server: * 编辑购买车商品时,需要提交到服务器端,让服务器端通过一些判断返回一些信息回来(如:满多少钱,可以免运费等一些提示) * 0:提交,1:不提交; * image_attr_a_id_{$attr_a_id} 图片列表,可以根据属性ID值,来切换图片列表;默认为:0 * limit_num: 库存数量 */ $id = intval($GLOBALS['request']['id']); //商品ID $user = $GLOBALS['user_info']; $user_id = intval($user['id']); $is_collect = 0; if ($user_id > 0) { $sql2 = "select count(*) from " . DB_PREFIX . "deal_collect where deal_id = " . $id . " and user_id=" . $user_id; if ($GLOBALS['db']->getOne($sql2) > 0) { $is_collect = 1; } } $ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']); //ypoint $xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']); //xpoint $city_name = strim($GLOBALS['request']['city_name']); //城市名称 $item = get_deal($id); //$item['origin_price_format'] = format_price2($item['origin_price']); //$item['current_price_format'] = format_price2($item['current_price']); //$item['save_price_format'] = format_price2($item['save_price']); $root = getGoodsArray($item); //$message_re=m_get_message_list(3," m.rel_table = 'deal' and m.rel_id=".$id." and m.is_buy = 1");/*购买评论*/ require_once APP_ROOT_PATH . "system/model/review.php"; require_once APP_ROOT_PATH . "system/model/user.php"; $message_re = get_dp_list(3, $param = array("deal_id" => $id, "youhui_id" => 0, "event_id" => 0, "location_id" => 0, "tag" => ""), "", ""); foreach ($message_re['list'] as $k => $v) { $message_re['list'][$k]['width'] = $v['point'] / 5 * 100; if ($v['point'] > 0) { $str = ""; for ($i = 1; $i <= $v['point']; $i++) { $str .= "★"; } $message_re['list'][$k]['xing'] = $str; } $message_re['list'][$k]['reply_time_format'] = date("Y-m-d H:i:s", $v['reply_time']); $uinfo = load_user($v['user_id']); $message_re['list'][$k]['user_name'] = $uinfo['user_name']; foreach ($message_re['list'][$k]['images'] as $kk => $vv) { $message_re['list'][$k]['images'][$kk] = get_abs_img_root(get_spec_image($vv, 60, 60, 1)); $message_re['list'][$k]['oimages'][$kk] = get_abs_img_root($vv); } } $root['message_list'] = $message_re['list']; if (count($message_re['list']) > 0) { $sql = "select count(*) from " . DB_PREFIX . "supplier_location_dp where " . $message_re['condition']; $message_re['count'] = $GLOBALS['db']->getOne($sql); } $root['message_count'] = $message_re['count']; $pi = 3.14159265; //圆周率 $r = 6378137; //地球平均半径(米) $root['distance'] = ACOS(SIN($ypoint * $pi / 180) * SIN($item['supplier_address_info']['ypoint'] * $pi / 180) + COS($ypoint * $pi / 180) * COS($item['supplier_address_info']['ypoint'] * $pi / 180) * COS($xpoint * $pi / 180 - $item['supplier_address_info']['xpoint'] * $pi / 180)) * $r; $root['return'] = 1; $images = array(); //image_attr_1_id_{$attr_1_id} 图片列表,可以根据属性ID值,来切换图片列表 $sql = "select img from " . DB_PREFIX . "deal_gallery where deal_id = " . intval($id) . " order by sort asc"; $list = $GLOBALS['db']->getAll($sql); $gallery = array(); $big_gallery = array(); foreach ($list as $k => $image) { $gallery[] = get_abs_img_root(get_spec_image($image['img'], 460, 280, 1)); $big_gallery[] = get_abs_img_root(get_spec_image($image['img'], 0, 0, 0)); } $root['gallery'] = $gallery; $root['big_gallery'] = $big_gallery; //支持的门店列表; $sql = "select id,name,address,tel,xpoint,ypoint,supplier_id from " . DB_PREFIX . "supplier_location where id in (select location_id from " . DB_PREFIX . "deal_location_link where deal_id = " . $id . ")"; $supplier_location_list = $GLOBALS['db']->getAll($sql); foreach ($supplier_location_list as $k => $sl) { $supplier_location_list[$k]['distance'] = ACOS(SIN($ypoint * $pi / 180) * SIN($sl['ypoint'] * $pi / 180) + COS($ypoint * $pi / 180) * COS($sl['ypoint'] * $pi / 180) * COS($xpoint * $pi / 180 - $sl['xpoint'] * $pi / 180)) * $r; } $root['supplier_location_list'] = $supplier_location_list; //其它团购 //if($GLOBALS['request']['from']=="wap"){ $time = get_gmtime(); $time_condition = ' and is_shop = 0 '; $time_condition .= ' and (' . $time . '>=begin_time or begin_time = 0 ) and (' . $time . '< end_time or end_time = 0) and buy_type<>2 and is_recommend=1'; $time_condition .= ' and id<>' . $id; /* if($item['cate_id']>0) { $ids = load_auto_cache("deal_sub_parent_cate_ids",array("cate_id"=>$item['cate_id'])); $time_condition .= " and cate_id in (".implode(",",$ids).")"; } if($item['city_id']==0) { $city = get_current_deal_city(); $city_id = $city['id']; $time_condition .= " and city_id in (".implode(",",$item['city_id']).")"; } if($item['city_id']>0) { $ids = load_auto_cache("deal_city_belone_ids",array("city_id"=>$item['city_id'])); if($ids) { $time_condition .= " and city_id in (".implode(",",$ids).")"; } } */ $dealsql = "select * from " . DB_PREFIX . "deal where is_effect = 1 and is_delete = 0 " . $time_condition . " order by sort desc,id desc limit 4"; $deal_other = $GLOBALS['db']->getAll($dealsql); $root['deal_other'] = $deal_other; /*门店评论*/ /* $comment_list=$GLOBALS['db']->getAll("select a.id,a.content,a.point,a.avg_price,a.create_time,b.id as user_id,b.user_name from ".DB_PREFIX."supplier_location_dp as a left join ".DB_PREFIX."user as b on b.id=a.user_id where a.supplier_location_id = ".$root['supplier_location_id']." and a.status = 1"); $comment_count=$GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."supplier_location_dp as a left join ".DB_PREFIX."user as b on b.id=a.user_id where a.supplier_location_id = ".$root['supplier_location_id']." and a.status = 1"); $count_point=0; foreach($comment_list as $k=>$v) { $comment_list[$k]['avg_price']=round($v['avg_price'],2); $comment_list[$k]['time']=pass_date($v['create_time']); $count_point+=$v['point']; } $root['comment_list']=$comment_list; $score=round($count_point/$comment_count,2); $width = $score > 0 ? ($score / 5) * 100 : 0; $root['point']=$score; $root['width']=$width; $root['comment_count']=$comment_count; */ /*商品评论*/ /* $comment_list=$GLOBALS['db']->getAll("select a.id,a.content,a.point,a.avg_price,a.create_time,b.id as user_id,b.user_name from ".DB_PREFIX."deal as a left join ".DB_PREFIX."user as b on b.id=a.user_id where a.supplier_location_id = ".$root['supplier_location_id']." and a.status = 1"); $comment_count=$GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."supplier_location_dp as a left join ".DB_PREFIX."user as b on b.id=a.user_id where a.supplier_location_id = ".$root['supplier_location_id']." and a.status = 1"); $count_point=0; foreach($comment_list as $k=>$v) { $comment_list[$k]['avg_price']=round($v['avg_price'],2); $comment_list[$k]['time']=pass_date($v['create_time']); $count_point+=$v['point']; } $root['comment_list']=$comment_list; $score=round($count_point/$comment_count,2); $width = $score > 0 ? ($score / 5) * 100 : 0; $root['point']=$score; $root['width']=$width; $root['comment_count']=$comment_count; */ //购买点评数量 $comment_count = $root['message_count']; // intval($GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."message where rel_id = ".$id." and rel_table = 'deal' and pid = 0 and is_buy = 1")); $buy_dp_sum = 0.0; $buy_dp_group = $GLOBALS['db']->getAll("select point,count(*) as num from " . DB_PREFIX . "message where rel_id = " . $id . " and rel_table = 'deal' and pid = 0 and is_buy = 1 group by point"); foreach ($buy_dp_group as $dp_k => $dp_v) { $star = intval($dp_v['point']); if ($star >= 1 && $star <= 5) { $buy_dp_sum += $star * $dp_v['num']; } } //点评平均分 $score = round($buy_dp_sum / $comment_count, 1); $width = $score > 0 ? $score / 5 * 110 : 0; $root['point'] = $score; $root['width'] = $width; /* $root['comment_count']=$comment_count; $sql = "select m.id,m.content,m.create_time,m.update_time, m.point,m.admin_reply,m.admin_id,u.user_name from ".DB_PREFIX."message m left join fanwe_user u on u.id = m.user_id where m.rel_id = ".$id." and m.rel_table = 'deal' and m.pid = 0 and m.is_buy = 1 order by m.create_time desc limit 0,8"; $comment_list = $GLOBALS['db']->getAll($sql); $root['comment_list']=$comment_list; */ if ($item['is_shop'] == 0) { $root['page_title'] = "团购详情"; } elseif ($item['is_shop'] == 1) { $root['page_title'] = "商品详情"; } else { $root['page_title'] = "代金券详情"; } //} $root['is_collect'] = $is_collect; $root['city_name'] = $city_name; output($root); }
public function index() { if (trim($_REQUEST['search']) == "do") { $start_time = trim($_REQUEST['start_time']); if ($start_time == "") { $this->error("请选择开始时间"); die; } $this->assign("start_time", $start_time); $end_time = trim($_REQUEST['end_time']); if ($end_time == "") { $this->error("请选择结束时间"); die; } $this->assign("end_time", $end_time); $start_time = to_timespan($start_time, "Y-m-d"); $end_time = to_timespan($end_time, "Y-m-d"); if ($end_time < $start_time) { $this->error("结束时间必须大于开始时间"); die; } $now_time = to_timespan(to_date(TIME_UTC, "Y-m-d"), "Y-m-d"); if ($end_time > $now_time) { $end_time = $now_time; } //开始时间跟结束时间差多少天 $day = ($end_time - $start_time) / 24 / 3600; $list = array(); $day_time = $start_time; //标分类 $deal_cate = load_auto_cache("cache_deal_cate"); /*foreach($deal_cate as $kk=>$vv){ if(strpos($vv['name'],"智能")!==false){ unset($deal_cate[$kk]); } }*/ $this->assign("deal_cate", $deal_cate); //获取改时间段内所有的 还款中和 已还清的贷款 //$deals = $GLOBALS['db']->getAll("SELECT id FROM ".DB_PREFIX."deal where deal_status in(4,5) and is_effect=1 and is_delete=0 and publish_wait=0 AND success_time >= $start_time and ((loantype=1 and (success_time + repay_time*31*24*3600) >=$end_time) or (loantype=0 and (success_time + (repay_time+1)*24*3600)>=$end_time))"); $deals = $GLOBALS['db']->getAll("SELECT id FROM " . DB_PREFIX . "deal where deal_status in(4,5) and is_effect=1 and is_delete=0 and publish_wait=0 AND success_time >= {$start_time}"); $temp_deals = array(); require_once APP_ROOT_PATH . "app/Lib/common.php"; require_once APP_ROOT_PATH . "app/Lib/deal.php"; require_once APP_ROOT_PATH . "system/libs/user.php"; for ($i = 0; $i <= $day; $i++) { $list[$i]['day'] = $day_time; //线上充值金额 $list[$i]['online_pay'] = floatval($GLOBALS['db']->getOne("SELECT sum(deal_total_price) FROM " . DB_PREFIX . "deal_order where pay_status=2 and type = 1 and is_delete = 0 and create_time between {$day_time} and {$day_time}+24*3600 and payment_id not in (SELECT id from " . DB_PREFIX . "payment where class_name='Otherpay') ")); //线下充值金额 $list[$i]['below_pay'] = floatval($GLOBALS['db']->getOne("SELECT sum(deal_total_price) FROM " . DB_PREFIX . "deal_order where pay_status=2 and type = 1 and is_delete = 0 and create_time between {$day_time} and {$day_time}+24*3600 and payment_id in (SELECT id from " . DB_PREFIX . "payment where class_name='Otherpay') ")); foreach ($deal_cate as $kk => $vv) { //if(strpos($vv['name'],"智能")===false) $list[$i][$vv['id']]['borrow_amount'] = floatval($GLOBALS['db']->getOne("SELECT sum(borrow_amount) FROM " . DB_PREFIX . "deal where deal_status=4 and is_delete = 0 and publish_wait = 0 and success_time between {$day_time} and {$day_time}+24*3600 and cate_id=" . $vv['id'])); } //投资总额[投标者] $list[$i]['load_amount'] = floatval($GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "deal_load where is_repay=0 and create_time between {$day_time} and {$day_time}+24*3600")); //已获利息总额[投标者] $list[$i]['load_lixi_amount'] = floatval($GLOBALS['db']->getOne("SELECT (sum(repay_money) - sum(self_money)) FROM " . DB_PREFIX . "deal_load_repay where true_repay_time between {$day_time} and {$day_time}+24*3600")); //应付本金 $list[$i]['benjin_amount'] = 0; //应付利息 $list[$i]['pay_lxi_amount'] = 0; //应付罚息 $list[$i]['impose_amount'] = 0; //已付本金 $list[$i]['has_repay_benjin_amount'] = 0; //已付利息 $list[$i]['has_repay_lxi_amount'] = 0; //已付罚息 $list[$i]['has_repay_impose_amount'] = 0; foreach ($deals as $kk => $vv) { if (!isset($temp_deals[$vv['id']])) { $temp_deals[$vv['id']]['deal'] = get_deal($vv['id']); $temp_deals[$vv['id']]['loan'] = get_deal_load_list($temp_deals[$vv['id']]['deal']); } foreach ($temp_deals[$vv['id']]['loan'] as $kkk => $vvv) { //如果刚好等于传入的时间就开始计算 if ($vvv['true_repay_time'] >= $day_time && $vvv['true_repay_time'] <= $day_time + 24 * 3600 - 1 || $vvv['repay_day'] == $day_time) { if ($temp_deals[$vv['id']]['deal']['month_repay_money'] > 0 || $temp_deals[$vv['id']]['deal']['last_month_repay_money'] > 0) { if ($temp_deals[$vv['id']]['deal']['loantype'] == 0) { $benj = get_benjin($kkk, count($temp_deals[$vv['id']]['loan']), $temp_deals[$vv['id']]['deal']['borrow_amount'], $temp_deals[$vv['id']]['deal']['month_repay_money'], $temp_deals[$vv['id']]['deal']['rate']); $list[$i]['benjin_amount'] += $benj; $list[$i]['pay_lxi_amount'] += $temp_deals[$vv['id']]['deal']['month_repay_money'] - $benj; } elseif ($temp_deals[$vv['id']]['deal']['loantype'] == 1) { if ($kkk + 1 == count($temp_deals[$vv['id']]['loan'])) { $list[$i]['benjin_amount'] += $temp_deals[$vv['id']]['deal']['borrow_amount']; $list[$i]['pay_lxi_amount'] += $temp_deals[$vv['id']]['deal']['last_month_repay_money'] - $list[$i]['benjin_amount']; } else { $list[$i]['pay_lxi_amount'] += $temp_deals[$vv['id']]['deal']['month_repay_money']; } } elseif ($temp_deals[$vv['id']]['deal']['loantype'] == 2) { if ($kkk + 1 == count($temp_deals[$vv['id']]['loan'])) { $list[$i]['benjin_amount'] += $temp_deals[$vv['id']]['deal']['borrow_amount']; $list[$i]['pay_lxi_amount'] += $temp_deals[$vv['id']]['deal']['last_month_repay_money'] - $temp_deals[$vv['id']]['deal']['borrow_amount']; } } $list[$i]['impose_amount'] += $vvv['impose_money']; if ($vvv['has_repay'] == 1) { if ($temp_deals[$vv['id']]['deal']['loantype'] == 0) { $benj = get_benjin($kkk, count($temp_deals[$vv['id']]['loan']), $temp_deals[$vv['id']]['deal']['borrow_amount'], $temp_deals[$vv['id']]['deal']['month_repay_money'], $temp_deals[$vv['id']]['deal']['rate']); $list[$i]['has_repay_benjin_amount'] += $benj; $list[$i]['has_repay_lxi_amount'] += $temp_deals[$vv['id']]['deal']['month_repay_money'] - $benj; } elseif ($temp_deals[$vv['id']]['deal']['loantype'] == 1) { if ($kkk + 1 == count($temp_deals[$vv['id']]['loan'])) { $list[$i]['has_repay_benjin_amount'] += $temp_deals[$vv['id']]['deal']['borrow_amount']; $list[$i]['has_repay_lxi_amount'] += $temp_deals[$vv['id']]['deal']['last_month_repay_money'] - $list[$i]['benjin_amount']; } else { $list[$i]['has_repay_lxi_amount'] += $temp_deals[$vv['id']]['deal']['month_repay_money']; } } elseif ($temp_deals[$vv['id']]['deal']['loantype'] == 2) { if ($kkk + 1 == count($temp_deals[$vv['id']]['loan'])) { $list[$i]['has_repay_benjin_amount'] += $temp_deals[$vv['id']]['deal']['borrow_amount']; $list[$i]['has_repay_lxi_amount'] += $temp_deals[$vv['id']]['deal']['last_month_repay_money'] - $temp_deals[$vv['id']]['deal']['borrow_amount']; } } $list[$i]['has_repay_impose_amount'] += $vvv['impose_money']; } } } } } //待还本金 $list[$i]['wait_repay_benjin_amount'] = $list[$i]['benjin_amount'] - $list[$i]['has_repay_benjin_amount']; //待还利息 $list[$i]['wait_repay_lxi_amount'] = $list[$i]['pay_lxi_amount'] - $list[$i]['has_repay_lxi_amount']; //待还罚息 $list[$i]['wait_repay_impose_amount'] = $list[$i]['impose_amount'] - $list[$i]['has_repay_impose_amount']; //申请提现总额 $list[$i]['carry'] = floatval($GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "user_carry where create_time between {$day_time} and {$day_time}+24*3600 ")); //成功提现金额 $list[$i]['suc_carry'] = floatval($GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "user_carry where status=1 and update_time between {$day_time} and {$day_time}+24*3600 ")); $day_time += 24 * 3600; } //待投资资金 $user_amount = M("User")->where("is_delete=0 AND is_effect=1")->sum("money"); $this->assign("user_amount", $user_amount); $this->assign("list", $list); } $this->display(); }
function bid() { if (!$GLOBALS['user_info']) { set_gopreview(); app_redirect(url("index", "user#login")); } //如果未绑定手机 if (intval($GLOBALS['user_info']['mobilepassed']) == 0) { $GLOBALS['tmpl']->assign("page_title", "成为借出者"); $GLOBALS['tmpl']->display("page/deal_mobilepaseed.html"); exit; } $id = intval($_REQUEST['id']); $deal = get_deal($id); if (!$deal) { app_redirect(url("index")); } if ($deal['user_id'] == $GLOBALS['user_info']['id']) { showErr($GLOBALS['lang']['CANT_BID_BY_YOURSELF']); } if ($deal['ips_bill_no'] != "" && $GLOBALS['user_info']['ips_acct_no'] == "") { showErr("此标为第三方托管标,请先绑定第三方托管账户", 0, url("index", "uc_center")); } $has_bid_money = $GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "deal_load WHERE deal_id=" . $id); $GLOBALS['tmpl']->assign("has_bid_money", $has_bid_money); if ($deal['uloadtype'] == 1) { $GLOBALS['tmpl']->assign("has_bid_portion", intval($has_bid_money) / ($deal['borrow_amount'] / $deal['portion'])); } $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']; $GLOBALS['tmpl']->assign("deal", $deal); $GLOBALS['tmpl']->display("page/deal_bid.html"); }
/** * 解冻保证金 * @param int $deal_id 标的号 * @param int $pUnfreezenType 解冻类型 否 1#解冻借款方;2#解冻担保方 * @param float $money 解冻金额;默认为0时,则解冻所有未解冻的金额 * @return string */ function GuaranteeUnfreeze() { $pTransferType = intval(strim($_REQUEST['pTransferType'])); $deal_id = intval(strim($_REQUEST['deal_id'])); $money = floatval($_REQUEST['money']); require_once APP_ROOT_PATH . "app/Lib/deal_func.php"; $deal = get_deal($deal_id); // $GLOBALS['db']->getRow("select * from ".DB_PREFIX."deal where id = ".$deal_id); if (!empty($deal)) { if (!empty($deal['ips_bill_no'])) { $class_name = 'Ips'; require_once APP_ROOT_PATH . "system/collocation/" . $class_name . "_collocation.php"; $collocation_class = $class_name . "_collocation"; $collocation_object = new $collocation_class(); $collocation_code = $collocation_object->GuaranteeUnfreeze($deal_id, $pTransferType, $money); print_r($collocation_code); } else { showErr('该标未发布登记:' . $deal['ips_bill_no'], 0); } } else { showErr('标的ID不存在:' . $deal_id, 0); } }
function dogeneration() { $user_id = $GLOBALS['user_info']['id']; $id = intval($_REQUEST['id']); $is_ajax = intval($_REQUEST['is_ajax']); $deal = get_deal($id); if (!$deal) { showErr("借款不存在", $is_ajax); } if ($deal['user_id'] != $GLOBALS['user_info']['id']) { showErr("不属于你的借款", $is_ajax); } if ($deal['repay_progress_point'] < $deal['generation_position']) { showErr("已还金额不足够续约", $is_ajax); } $data['deal_id'] = $id; $data['user_id'] = $GLOBALS['user_info']['id']; $data['money'] = $deal['need_remain_repay_money']; $data['create_time'] = TIME_UTC; $rs_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "generation_repay_submit WHERE deal_id=" . $id . " AND user_id={$user_id}"); if (!$rs_id) { $GLOBALS['db']->autoExecute(DB_PREFIX . "generation_repay_submit", $data); if ($GLOBALS['db']->insert_id() > 0) { showSuccess("申请续约成功", $is_ajax); } else { showErr("申请续约失败", $is_ajax); } } else { $GLOBALS['db']->autoExecute(DB_PREFIX . "generation_repay_submit", $data, "UPDATE", "id=" . $rs_id); if ($GLOBALS['db']->affected_rows() > 0) { showSuccess("申请续约成功", $is_ajax); } else { showErr("申请续约失败", $is_ajax); } } }
public function detail() { /*if(!$GLOBALS['user_info']){ app_redirect(url("index","user#login")); }*/ set_gopreview(); $id = intval($_REQUEST['id']); $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id); if ($deal_id == 0) { echo "不存在的债权"; die; } $deal = get_deal($deal_id); syn_transfer_status($id); $deal['yq_count'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_repay WHERE has_repay = 1 and deal_id=" . $deal_id . " AND status >= 2"); $GLOBALS['tmpl']->assign('deal', $deal); //借款列表 $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $deal_id); $u_info = get_user("*", $deal['user_id']); if ($deal['view_info'] != "") { $view_info_list = unserialize($deal['view_info']); $GLOBALS['tmpl']->assign('view_info_list', $view_info_list); } //可用额度 $can_use_quota = get_can_use_quota($deal['user_id']); $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota); $credit_file = get_user_credit_file($deal['user_id']); $deal['is_faved'] = 0; if ($GLOBALS['user_info']) { if ($u_info['user_type'] == 1) { $company = $GLOBALS['db']->getRowCached("SELECT * FROM " . DB_PREFIX . "user_company WHERE user_id=" . $u_info['id']); } if ($deal['deal_status'] >= 4) { //还款列表 $loan_repay_list = get_deal_load_list($deal); $GLOBALS['tmpl']->assign("loan_repay_list", $loan_repay_list); if ($loan_repay_list) { $temp_self_money_list = $GLOBALS['db']->getAllCached("SELECT sum(self_money) as total_money,u_key FROM " . DB_PREFIX . "deal_load_repay WHERE has_repay=1 AND deal_id=" . $id . " group by u_key "); $self_money_list = array(); foreach ($temp_self_money_list as $k => $v) { $self_money_list[$v['u_key']] = $v['total_money']; } foreach ($load_list as $k => $v) { $load_list[$k]['remain_money'] = $v['money'] - $self_money_list[$k]; if ($load_list[$k]['remain_money'] <= 0) { $load_list[$k]['remain_money'] = 0; $load_list[$k]['status'] = 1; } } } } $user_statics = sys_user_status($deal['user_id'], true); $GLOBALS['tmpl']->assign("user_statics", $user_statics); $GLOBALS['tmpl']->assign("company", $company); } $GLOBALS['tmpl']->assign("load_list", $load_list); $GLOBALS['tmpl']->assign("credit_file", $credit_file); $GLOBALS['tmpl']->assign("u_info", $u_info); //工作认证是否过期 $GLOBALS['tmpl']->assign('expire', user_info_expire($u_info)); //留言 require APP_ROOT_PATH . 'app/Lib/message.php'; require APP_ROOT_PATH . 'app/Lib/page.php'; $rel_table = 'transfer'; $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "'"); $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id; if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { if ($message_type['is_effect'] == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } //message_form 变量输出 $GLOBALS['tmpl']->assign('rel_id', $id); $GLOBALS['tmpl']->assign('rel_table', $rel_table); //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $msg_condition = $condition . " AND is_effect = 1 "; $message = get_message_list($limit, $msg_condition); $page = new Page($message['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); foreach ($message['list'] as $k => $v) { $msg_sub = get_message_list("", "pid=" . $v['id'], false); $message['list'][$k]["sub"] = $msg_sub["list"]; } $GLOBALS['tmpl']->assign("message_list", $message['list']); //================================================== $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and d.publish_wait=0 '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; $transfer = get_transfer($union_sql, $condition); $GLOBALS['tmpl']->assign('transfer', $transfer); if ($deal['type_match_row']) { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name']; } else { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']; } $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['TRANSFER'] . " - " . $seo_title); $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name']; $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['TRANSFER'] . "," . $seo_keyword . ","); $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']; $GLOBALS['tmpl']->assign("seo_description", $GLOBALS['lang']['TRANSFER'] . "," . $seo_description . ","); $GLOBALS['tmpl']->assign("deal", $deal); $GLOBALS['tmpl']->display("page/transfer.html"); }
function get_topic_list($limit, $condition = '', $orderby = 'create_time desc', $keywords_array = array()) { if ($orderby == '') { $orderby = 'create_time desc'; } if ($condition != '') { $condition = " and " . $condition; } $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where is_effect = 1 " . $condition); $list = array(); if ($total > 0) { $list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic where is_effect = 1 " . $condition . " order by " . $orderby . " limit " . $limit); foreach ($list as $k => $v) { if ($v['type'] == "deal_message" || $v['type'] == "message" || $v['type'] == "deal_message_reply" || $v['type'] == "message_reply" || $v['type'] == "deal_collect" || $v['type'] == "deal_bad") { require_once APP_ROOT_PATH . "/app/Lib/deal.php"; $list[$k]['deal'] = get_deal($v['fav_id']); } elseif ($v['type'] == "transfer_message" || $v['type'] == "transfer_message_reply") { require_once APP_ROOT_PATH . "/app/Lib/deal.php"; $condition = ' AND dlt.id=' . $v['fav_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 "; $list[$k]['transfer'] = get_transfer($union_sql, $condition); } } } return array('list' => $list, 'total' => $total); }
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); }
function repay_plan_a() { $deal_id = intval($_REQUEST['deal_id']); $l_key = intval($_REQUEST['l_key']); $obj = strim($_REQUEST['obj']); if ($deal_id == 0) { $this->error("数据错误"); } require_once APP_ROOT_PATH . "app/Lib/common.php"; require_once APP_ROOT_PATH . "app/Lib/deal.php"; $deal_info = get_deal($deal_id); if (!$deal_info) { $this->error("借款不存在"); } //输出投标列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $page_size = 10; $limit = ($page - 1) * $page_size . "," . $page_size; $result = get_deal_user_load_list($deal_info, 0, $l_key, -1, 0, 0, 1, $limit); foreach ($result['item'] as $k => $v) { $result['item'][$k]['interest_money'] = format_price($v['interest_money']); } $rs_count = $result['count']; $page_all = ceil($rs_count / $page_size); $this->assign("load_user", $result['item']); $this->assign("l_key", $l_key); $this->assign("page_all", $page_all); $this->assign("rs_count", $rs_count); $this->assign("page", $page); $this->assign("deal_id", $deal_id); $this->assign("obj", $obj); $this->assign("page_prev", $page - 1); $this->assign("page_next", $page + 1); $html = $this->fetch(); $this->success($html); }
public function index() { $type = strim($GLOBALS['request']['type']); $id = intval($GLOBALS['request']['id']); $city_name = strim($GLOBALS['request']['city_name']); //城市名称 $deal_id = 0; $youhui_id = 0; $location_id = 0; $event_id = 0; $tech_id = 0; if ($type == "deal") { $deal_id = $id; require_once APP_ROOT_PATH . "system/model/deal.php"; $deal_info = get_deal($deal_id); $relate_data_name = $deal_info['name']; } elseif ($type == "supplier") { $location_id = $id; require_once APP_ROOT_PATH . "system/model/supplier.php"; $location_info = get_location($location_id); $relate_data_name = $location_info['name']; } elseif ($type == "youhui") { $youhui_id = $id; require_once APP_ROOT_PATH . "system/model/youhui.php"; $youhui_info = get_youhui($youhui_id); $relate_data_name = $youhui_info['name']; } elseif ($type == "event") { $event_id = $id; require_once APP_ROOT_PATH . "system/model/event.php"; $event_info = get_event($event_id); $relate_data_name = $event_info['name']; } elseif ($type == "tech") { $tech_id = $id; require_once APP_ROOT_PATH . "system/model/tech.php"; $tech_info = get_tech($tech_id); $relate_data_name = $tech_info['name']; } $page = intval($GLOBALS['request']['page']); /*分页*/ $city_name = strim($GLOBALS['request']['city_name']); //城市分类ID //检查用户,用户密码 $user = $GLOBALS['user_info']; $user_id = intval($user['id']); $root = array(); $root['return'] = 1; $page = $page == 0 ? 1 : $page; $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; // $message_re=m_get_message_list($limit," m.rel_table = 'deal' and m.rel_id=".$tuan_id." and m.is_buy = 1",0);/*购买评论*/ require_once APP_ROOT_PATH . "system/model/review.php"; require_once APP_ROOT_PATH . "system/model/user.php"; $message_re = get_dp_list($limit, $param = array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "tech_id" => $tech_id, "tag" => ""), "", ""); foreach ($message_re['list'] as $k => $v) { $message_re['list'][$k]['width'] = $v['point'] / 5 * 100; $message_re['list'][$k]['create_time'] = to_date($v['create_time']); $uinfo = load_user($v['user_id']); $message_re['list'][$k]['user_name'] = $uinfo['user_name']; foreach ($message_re['list'][$k]['images'] as $kk => $vv) { $message_re['list'][$k]['images'][$kk] = get_abs_img_root(get_spec_image($vv, 60, 60, 1)); $message_re['list'][$k]['oimages'][$kk] = get_abs_img_root($vv); } } $root['message_list'] = $message_re['list']; if (count($message_re['list']) > 0) { $sql = "select count(*) from " . DB_PREFIX . "supplier_location_dp where " . $message_re['condition']; $message_re['count'] = $GLOBALS['db']->getOne($sql); } $root['message_count'] = $message_re['count']; //$deal = get_deal($tuan_id); $dp_info = load_dp_info(array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "tech_id" => $tech_id)); $root['name'] = $relate_data_name; //星级点评数 $root['star_1'] = $dp_info['dp_count_1']; $root['star_2'] = $dp_info['dp_count_2']; $root['star_3'] = $dp_info['dp_count_3']; $root['star_4'] = $dp_info['dp_count_4']; $root['star_5'] = $dp_info['dp_count_5']; $root['star_dp_width_1'] = $dp_info['avg_point_1_percent']; $root['star_dp_width_2'] = $dp_info['avg_point_2_percent']; $root['star_dp_width_3'] = $dp_info['avg_point_3_percent']; $root['star_dp_width_4'] = $dp_info['avg_point_4_percent']; $root['star_dp_width_5'] = $dp_info['avg_point_5_percent']; $buy_dp_sum = 0.0; // $buy_dp_group = $GLOBALS['db']->getAll("select point,count(*) as num from ".DB_PREFIX."message where rel_id = ".$tuan_id." and rel_table = 'deal' and pid = 0 and is_buy = 1 group by point"); // foreach($buy_dp_group as $dp_k=>$dp_v) // { // $star = intval($dp_v['point']); // if ($star >= 1 && $star <= 5){ // $root['star_'.$star] = $dp_v['num']; // $buy_dp_sum += $star * $dp_v['num']; // $root['star_dp_width_'.$star] = (round($dp_v['num']/ $message_re['count'],1)) * 100; // } // } //点评平均分 $root['buy_dp_sum'] = $dp_info['dp_count']; $root['buy_dp_avg'] = $dp_info['avg_point']; $root['buy_dp_width'] = $dp_info['avg_point'] / 5 * 100; $page_total = ceil($message_re['count'] / $page_size); $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size); $root['allow_dp'] = 0; //0:不允许点评;1:允许点评 //判断用户是否购买了这个商品 if ($user_id > 0) { // $sql = "select count(*) from ".DB_PREFIX."deal_order_item as doi left join ".DB_PREFIX."deal_order as do on doi.order_id = do.id where doi.deal_id = ".intval($tuan_id)." and do.user_id = ".intval($user_id)." and do.pay_status = 2"; // //$root['sql'] = $sql; // if($GLOBALS['db']->getOne($sql)>0) // { // $root['allow_dp'] = 1; // } $dp_status = check_dp_status($user_id, array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id)); if ($dp_status['status']) { $root['allow_dp'] = 1; } if ($type == "tech" && $user_id == $id) { //技师本身不能给自己点评 $root['allow_dp'] = 0; } } $root['type'] = $type; $root['id'] = $id; $root['page_title'] = "点评列表"; $root['city_name'] = $city_name; output($root); }
function insert_load_msg_list() { $rel_table = strim($_REQUEST['act']); $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "' "); if (!$message_type || $message_type['is_fix'] == 0) { $message_type_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "message_type where is_fix = 0 order by sort desc"); if (!$message_type_list) { showErr($GLOBALS['lang']['INVALID_MESSAGE_TYPE']); } else { if (!$message_type) { $message_type = $message_type_list[0]; } foreach ($message_type_list as $k => $v) { if ($v['type_name'] == $message_type['type_name']) { $message_type_list[$k]['current'] = 1; } else { $message_type_list[$k]['current'] = 0; } } $GLOBALS['tmpl']->assign("message_type_list", $message_type_list); } } $rel_table = $message_type['type_name']; $condition = ''; $id = intval($_REQUEST['id']); if ($rel_table == 'deal') { $deal = get_deal($id); if ($deal['buy_type'] != 1) { $GLOBALS['tmpl']->assign("deal", $deal); } $id = $deal['id']; } //require './app/Lib/side.php'; if ($id > 0) { $condition = "rel_table = '" . $rel_table . "' and rel_id = " . $id; } else { $condition = "rel_table = '" . $rel_table . "'"; } if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } else { if ($message_type['is_effect'] == 0) { $condition .= " and user_id = " . intval($GLOBALS['user_info']['id']); } } $condition .= " and is_buy = " . intval($_REQUEST['is_buy']); //message_form 变量输出 //开始输出当前的site_nav $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => APP_ROOT . "/"); $site_nav[] = array('name' => $message_type['show_name'], 'url' => url("shop", "msg#" . $message_type['type_name'])); $GLOBALS['tmpl']->assign("site_nav", $site_nav); //输出当前的site_nav $GLOBALS['tmpl']->assign("post_title", $message_type['show_name']); $GLOBALS['tmpl']->assign("page_title", $message_type['show_name']); $GLOBALS['tmpl']->assign('rel_id', $id); $GLOBALS['tmpl']->assign('rel_table', $rel_table); $GLOBALS['tmpl']->assign('is_buy', intval($_REQUEST['is_buy'])); if (intval($_REQUEST['is_buy']) == 1) { $GLOBALS['tmpl']->assign("post_title", $GLOBALS['lang']['AFTER_BUY']); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['AFTER_BUY']); } if (!$GLOBALS['user_info']) { $GLOBALS['tmpl']->assign("message_login_tip", sprintf($GLOBALS['lang']['MESSAGE_LOGIN_TIP'], url("shop", "user#login"), url("shop", "user#register"))); } //分页 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $message = get_message_list_shop($limit, $condition); $page = new Page($message['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("user_auth", get_user_auth()); $GLOBALS['tmpl']->assign("message_list", $message['list']); return $GLOBALS['tmpl']->fetch("inc/insert/load_msg_list.html"); }
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 get_user_load_item() { $deal_id = intval($_REQUEST['deal_id']); $l_key = intval($_REQUEST['l_key']); $obj = strim($_REQUEST['obj']); if ($deal_id == 0) { showErr("数据错误", 1); } require_once APP_ROOT_PATH . "app/Lib/deal.php"; $deal_info = get_deal($deal_id); if (!$deal_info) { showErr("借款不存在", 1); } //输出投标列表 $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $result = get_deal_user_load_list($deal_info, 0, $l_key, -1, 0, 0, 1, $limit); $rs_count = $result['count']; $page_all = ceil($rs_count / app_conf("PAGE_SIZE")); $GLOBALS['tmpl']->assign("load_user", $result['item']); $GLOBALS['tmpl']->assign("l_key", $l_key); $GLOBALS['tmpl']->assign("page_all", $page_all); $GLOBALS['tmpl']->assign("rs_count", $rs_count); $GLOBALS['tmpl']->assign("page", $page); $GLOBALS['tmpl']->assign("deal_id", $deal_id); $GLOBALS['tmpl']->assign("obj", $obj); $GLOBALS['tmpl']->assign("page_prev", $page - 1); $GLOBALS['tmpl']->assign("page_next", $page + 1); $html = $GLOBALS['tmpl']->fetch("inc/uc/ajax_load_user.html"); showSuccess($html, 1); }