public function index() { $root = array(); $id = intval($GLOBALS['request']['id']); $deal_id = intval($GLOBALS['request']['deal_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; $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and d.publish_wait=0 '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; $transfer = get_transfer($union_sql, $condition); $root['transfer'] = $transfer; $root['deal_id'] = $deal_id; $root['open_ips'] = intval(app_conf("OPEN_IPS")); $root['ips_acct_no'] = $user['ips_acct_no']; $root['ips_bill_no'] = $GLOBALS['db']->getOne("SELECT ips_bill_no FROM " . DB_PREFIX . "deal WHERE id = " . $deal_id); 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']); //用户金额 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; } }
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 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 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; } }
function send_transfer_contract_email($id, $transfer) { if ($id == 0 && !$transfer) { return false; } if (app_conf('MAIL_ON') == 0 || app_conf('MAIL_SEND_CONTRACT_ON') == 0) { return false; } if (!$transfer) { $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 and (dlt.user_id=' . $GLOBALS['user_info']['id'] . ' or dlt.t_user_id = ' . $GLOBALS['user_info']['id'] . ') '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; /* $sql = 'SELECT dlt.id,dlt.deal_id,dlt.load_id,dlt.transfer_amount,dlt.near_repay_time,dlt.user_id,d.next_repay_time,d.last_repay_time,d.rate,d.repay_start_time,d.repay_time,dlt.load_money,dlt.id as dltid,dlt.status as tras_status,dlt.t_user_id,dlt.transfer_amount,dlt.create_time as tras_create_time,dlt.transfer_time,d.user_id as duser_id,d.tcontract_id FROM '.DB_PREFIX.'deal_load dl LEFT JOIN '.DB_PREFIX.'deal d ON d.id = dl.deal_id '.$union_sql.' WHERE 1=1 '.$condition; $transfer = $GLOBALS['db']->getRow($sql);*/ require_once APP_ROOT_PATH . "/app/Lib/deal_func.php"; $transfer = get_transfer($union_sql, $condition); } if ($transfer) { /* //下个还款日 $transfer['next_repay_time_format'] = to_date($transfer['near_repay_time'],"Y 年 m 月 d 日"); $transfer['near_repay_time_format'] = to_date(next_replay_month($transfer['near_repay_time']," -1 "),"Y 年 m 月 d 日"); //什么时候开始借 $transfer['repay_start_time_format'] = to_date($transfer['repay_start_time'],"Y 年 m 月 d 日"); //还款日 $transfer['final_repay_time'] = next_replay_month($transfer['repay_start_time'],$transfer['repay_time']); $transfer['final_repay_time_format'] = to_date($transfer['final_repay_time'],"Y 年 m 月 d 日"); //剩余期数 $transfer['how_much_month'] = how_much_month($transfer['near_repay_time'],$transfer['final_repay_time']) +1; $transfer_rs = deal_transfer($transfer); //本息还款金额 $transfer['month_repay_money'] = $transfer_rs['month_repay_money']; //剩余多少钱未回 $transfer['all_must_repay_money'] = $transfer_rs['all_must_repay_money']; //剩余多少本金未回 $transfer['left_benjin'] = $transfer_rs['left_benjin']; $transfer['month_repay_money_format'] = format_price($transfer['month_repay_money']); $transfer['all_must_repay_money_format'] = format_price($transfer['all_must_repay_money']); $transfer['left_benjin_format'] = format_price($transfer['left_benjin']); //剩多少利息 $transfer['left_lixi'] = $transfer['all_must_repay_money'] - $transfer['left_benjin']; $transfer['left_lixi_format'] = format_price($transfer['left_lixi']); //投标价格 $transfer['load_money_format'] = format_price($transfer['load_money']); //转让价格 $transfer['transfer_amount_format'] = format_price($transfer['transfer_amount']); //转让管理费 $transfer['transfer_fee_format'] = format_price($transfer['transfer_amount']*(float)app_conf("USER_LOAD_TRANSFER_FEE")); //转让收益 $transfer['transfer_income_format'] = format_price($transfer['all_must_repay_money']-$transfer['transfer_amount']); if($transfer['tras_create_time'] !=""){ $transfer['tras_create_time_format'] = to_date($transfer['tras_create_time'],"Y 年 m 月 d 日"); } $transfer['transfer_time_format'] = to_date($transfer['transfer_time'],"Y 年 m 月 d 日"); $transfer['user'] = get_user("user_name,email,real_name,idno,level_id",$transfer['user_id']); $transfer['tuser'] = get_user("user_name,email,real_name,idno,level_id",$transfer['t_user_id']); $transfer['duser'] = get_user("user_name,email,real_name,idno,level_id",$transfer['duser_id']); $GLOBALS['tmpl']->assign('transfer',$transfer); */ $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN)); $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE")); $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT")); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($transfer['tcontract_id'])); $msg_data['dest'] = $transfer['user']['email']; $msg_data['send_type'] = 1; $msg_data['title'] = "债权“Z-" . $transfer['load_id'] . "”的电子协议!"; $msg_data['content'] = addslashes($contract); $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'] = 1; //发送给转让者 $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //发送给承接者 $msg_data['dest'] = $transfer['tuser']['email']; $msg_data['user_id'] = $transfer['t_user_id']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); } }
public function contact() { $id = intval($_REQUEST['id']); if ($id == 0) { echo "不存在的债权"; die; } //先执行更新借贷信息 $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id); if ($deal_id == 0) { echo "不存在的债权"; die; } else { syn_deal_status($deal_id); } $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 and (dlt.user_id=' . $GLOBALS['user_info']['id'] . ' or dlt.t_user_id = ' . $GLOBALS['user_info']['id'] . ') '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; /*$sql = 'SELECT dlt.id,dlt.deal_id,dlt.load_id,dlt.transfer_amount,dlt.near_repay_time,dlt.user_id,d.next_repay_time,d.last_repay_time,d.rate,d.repay_start_time,d.repay_time,dlt.load_money,dlt.id as dltid,dlt.status as tras_status,dlt.t_user_id,dlt.transfer_amount,dlt.create_time as tras_create_time,dlt.transfer_time,d.user_id as duser_id FROM '.DB_PREFIX.'deal_load dl LEFT JOIN '.DB_PREFIX.'deal d ON d.id = dl.deal_id '.$union_sql.' WHERE 1=1 '.$condition; $transfer = $GLOBALS['db']->getRow($sql);*/ require APP_ROOT_PATH . "/app/Lib/deal_func.php"; $transfer = get_transfer($union_sql, $condition); if ($transfer) { /*//下个还款日 $transfer['next_repay_time_format'] = to_date($transfer['near_repay_time'],"Y 年 m 月 d 日"); $transfer['near_repay_time_format'] = to_date(next_replay_month($transfer['near_repay_time']," -1 "),"Y 年 m 月 d 日"); //什么时候开始借 $transfer['repay_start_time_format'] = to_date($transfer['repay_start_time'],"Y 年 m 月 d 日"); //还款日 $transfer['final_repay_time'] = next_replay_month($transfer['repay_start_time'],$transfer['repay_time']); $transfer['final_repay_time_format'] = to_date($transfer['final_repay_time'],"Y 年 m 月 d 日"); //剩余期数 $transfer['how_much_month'] = how_much_month($transfer['near_repay_time'],$transfer['final_repay_time']) +1; //本息还款金额 $transfer['month_repay_money'] = pl_it_formula($transfer['load_money'],$transfer['rate']/12/100,$transfer['repay_time']); $transfer['month_repay_money_format'] = format_price($transfer['month_repay_money']); //剩余多少钱未回 $transfer['all_must_repay_money'] = $transfer['month_repay_money'] * $transfer['how_much_month']; $transfer['all_must_repay_money_format'] = format_price($transfer['all_must_repay_money']); //剩余多少本金未回 $transfer['left_benjin'] = get_benjin($transfer['repay_time']-$transfer['how_much_month']-1,$transfer['repay_time'],$transfer['load_money'],$transfer['month_repay_money'],$transfer['rate']); $transfer['left_benjin_format'] = format_price($transfer['left_benjin']); //剩多少利息 $transfer['left_lixi'] = $transfer['all_must_repay_money'] - $transfer['left_benjin']; $transfer['left_lixi_format'] = format_price($transfer['left_lixi']); //投标价格 $transfer['load_money_format'] = format_price($transfer['load_money']); //转让价格 $transfer['transfer_amount_format'] = format_price($transfer['transfer_amount']); //转让管理费 $transfer_fee = $transfer['transfer_amount']*(float)app_conf("USER_LOAD_TRANSFER_FEE"); if($transfer_fee!=0) $transfer_fee = $transfer_fee / 100; $transfer['transfer_fee_format'] = format_price($transfer_fee); //转让收益 $transfer['transfer_income_format'] = format_price($transfer['all_must_repay_money']-$transfer['transfer_amount']); if($transfer['tras_create_time'] !=""){ $transfer['tras_create_time_format'] = to_date($transfer['tras_create_time'],"Y 年 m 月 d 日"); } $transfer['transfer_time_format'] = to_date($transfer['transfer_time'],"Y 年 m 月 d 日"); $transfer['user'] = get_user("user_name,real_name,idno,level_id",$transfer['user_id']); $transfer['tuser'] = get_user("user_name,real_name,idno,level_id",$transfer['t_user_id']); $transfer['duser'] = get_user("user_name,real_name,idno,level_id",$transfer['duser_id']);*/ $GLOBALS['tmpl']->assign('transfer', $transfer); } else { echo "不存在的债权"; die; } $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN)); $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE")); $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT")); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($transfer['tcontract_id'])); $GLOBALS['tmpl']->assign('contract', $contract); $GLOBALS['tmpl']->display("inc/uc/transfer_contact.html"); }
public function ips_transfer() { $GLOBALS['tmpl']->assign("page_title", "债权转让"); $start_time = strim($_REQUEST['start_time']); $end_time = strim($_REQUEST['end_time']); $d = explode('-', $start_time); if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) { $this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)"); exit; } $d = explode('-', $end_time); if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) { $this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)"); exit; } if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) { $this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time); exit; } $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); if ($limit) { $limit = " limit " . $limit; } $className = getCollName(); //环迅 if (strtolower($className) == "ips") { $condition = " and t.pErrCode = 'MG00000F' and (dlt.user_id = " . $GLOBALS["user_info"]["id"] . " or dlt.t_user_id = " . $GLOBALS["user_info"]["id"] . ")"; if (strim($_REQUEST['pBidNo']) != '') { $condition .= " and d.id like '%" . strim($_REQUEST['pBidNo']) . "%'"; } if (strim($_REQUEST['deal_name']) != '') { $condition .= " and d.name like '%" . strim($_REQUEST['deal_name']) . "%'"; } if (strim($start_time) != "") { $condition .= " and UNIX_TIMESTAMP(pDate) >=" . to_timespan(strim($start_time)); } if (strim($end_time) != "") { $condition .= " and UNIX_TIMESTAMP(pDate) <=" . to_timespan(strim($end_time)); } $sql = "select dlt.id as mid,t.*,d.`name`,u.user_name,tu.user_name as t_user_name,bu.user_name as b_user_name,(dlt.load_money - dlt.transfer_amount) as leave_money from " . DB_PREFIX . "ips_transfer as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_data\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlt.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\tleft join " . DB_PREFIX . "user bu on bu.id = d.user_id\r\n\t\t\twhere t.pTransferType = 4 "; $count_sql = "select count(*) from " . DB_PREFIX . "ips_transfer as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_data\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlt.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\tleft join " . DB_PREFIX . "user bu on bu.id = d.user_id\r\n\t\t\twhere t.pTransferType = 4 "; //print_r($sql.$condition);die; $list = $GLOBALS['db']->getAll($sql . $condition . " order by t.id desc " . $limit); $list_count = $GLOBALS['db']->getOne($count_sql . $condition); //print_r($count);die; //$name=$this->getActionName(); } elseif (strtolower($className) == "yeepay") { $condition = " where bizType = 'CREDIT_ASSIGNMENT' and is_complete_transaction = 1 and t.code ='1' and is_callback = 1 and (dlt.user_id = " . $GLOBALS["user_info"]["id"] . " or dlt.t_user_id = " . $GLOBALS["user_info"]["id"] . ")"; if (strim($_REQUEST['pBidNo']) != '') { $condition .= " and d.id like '%" . strim($_REQUEST['pBidNo']) . "%'"; } if (strim($_REQUEST['deal_name']) != '') { $condition .= " and d.name like '%" . strim($_REQUEST['deal_name']) . "%'"; } if (strim($start_time) != "") { $condition .= " and t.update_time >=" . to_timespan(strim($start_time)); } if (strim($end_time) != "") { $condition .= " and t.update_time <=" . to_timespan(strim($end_time)); } $sql = "select dlt.id as mid,t.*,d.`name`,u.user_name,tu.user_name as t_user_name,bu.user_name as b_user_name,dlt.ips_status,dlt.t_user_id ,\r\n\t\t\trequestNo as pIpsBillNo,tenderOrderNo as pBidNo,FROM_UNIXTIME(t.create_time ,'%Y-%m-%d') as pDate,\r\n\t\t\tFROM_UNIXTIME(t.update_time ,'%Y-%m-%d') as pIpsTime\r\n\t\t\tfrom " . DB_PREFIX . "yeepay_cp_transaction as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.tenderOrderNo\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.transfer_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlt.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\tleft join " . DB_PREFIX . "user bu on bu.id = d.user_id"; $count_sql = "select count(*) \r\n\t\t\tfrom " . DB_PREFIX . "yeepay_cp_transaction as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.tenderOrderNo\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.transfer_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlt.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\tleft join " . DB_PREFIX . "user bu on bu.id = d.user_id"; //print_r($sql.$condition);die; $list = $GLOBALS['db']->getAll($sql . $condition . " order by t.id desc " . $limit); $list_count = $GLOBALS['db']->getOne($count_sql . $condition); //print_r($count);die; //$name=$this->getActionName(); } elseif (strtolower($className) == "baofoo") { $condition = " where ref_type = '1' and t.code ='CSD000' and (dlt.user_id = " . $GLOBALS["user_info"]["id"] . " or dlt.t_user_id = " . $GLOBALS["user_info"]["id"] . ")"; if (strim($_REQUEST['pBidNo']) != '') { $condition .= " and d.id like '%" . strim($_REQUEST['pBidNo']) . "%'"; } if (strim($_REQUEST['deal_name']) != '') { $condition .= " and d.name like '%" . strim($_REQUEST['deal_name']) . "%'"; } if (strim($start_time) != "") { $condition .= " and (t.req_time/1000) >=" . to_timespan(strim($start_time)); } if (strim($end_time) != "") { $condition .= " and (t.req_time/1000) <=" . to_timespan(strim($end_time)); } $sql = "select dlt.id as mid, t.*,d.`name`,u.user_name,tu.user_name as t_user_name,bu.user_name as b_user_name,dlt.ips_status,dlt.t_user_id ,\r\n\t\t\torder_id as pIpsBillNo,dlt.deal_id as pBidNo,FROM_UNIXTIME(t.req_time/1000 ,'%Y-%m-%d') as pDate,\r\n\t\t\tFROM_UNIXTIME(t.req_time/1000 ,'%Y-%m-%d') as pIpsTime\r\n\t\t\tfrom " . DB_PREFIX . "baofoo_acct_trans as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = dlt.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlt.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\tleft join " . DB_PREFIX . "user bu on bu.id = d.user_id"; $count_sql = "select count(*) \r\n\t\t\tfrom " . DB_PREFIX . "baofoo_acct_trans as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = dlt.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = dlt.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\tleft join " . DB_PREFIX . "user bu on bu.id = d.user_id"; //print_r($sql.$condition);die; //print_r($sql.$condition);die; $list = $GLOBALS['db']->getAll($sql . $condition . " order by t.id desc " . $limit); $list_count = $GLOBALS['db']->getOne($count_sql . $condition); } require_once APP_ROOT_PATH . 'app/Lib/deal.php'; require_once APP_ROOT_PATH . 'app/Lib/common.php'; foreach ($list as $k => $v) { $condition = " AND dlt.id='" . $v["mid"] . "'"; //$condition = ' AND dlt.id='.$v["mid"].' 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.load_id = dl.id "; $info = get_transfer($union_sql, $condition); $list[$k]["left_benjin_format"] = $info["left_benjin_format"]; $list[$k]["left_lixi_format"] = $info["left_lixi_format"]; $list[$k]["transfer_amount_format"] = $info["transfer_amount_format"]; $list[$k]["transfer_income_format"] = $info["transfer_income_format"]; } $page = new Page($list_count, app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('user_id', $GLOBALS["user_info"]["id"]); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign('list', $list); $GLOBALS['tmpl']->assign("start_time", $start_time); $GLOBALS['tmpl']->assign("end_time", $end_time); $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_ips_ips_transfer.html"); $GLOBALS['tmpl']->display("page/uc.html"); }
public function export_csv($page = 1) { set_time_limit(0); $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE")); $start_time = strim($_REQUEST['start_time']); $end_time = strim($_REQUEST['end_time']); $d = explode('-', $start_time); if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) { $this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)"); exit; } $d = explode('-', $end_time); if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) { $this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)"); exit; } if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) { $this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time); exit; } if ($limit) { $limit = " limit " . $limit; } $className = getCollName(); //环迅 if (strtolower($className) == "ips") { $condition = " and t.pErrCode = 'MG00000F' "; if (strim($_REQUEST['pBidNo']) != '') { $condition .= " and d.id like '%" . strim($_REQUEST['pBidNo']) . "%'"; } if (strim($_REQUEST['deal_name']) != '') { $condition .= " and d.name like '%" . strim($_REQUEST['deal_name']) . "%'"; } if (strim($start_time) != "") { $condition .= " and UNIX_TIMESTAMP(pDate) >=" . to_timespan(strim($start_time)); } if (strim($end_time) != "") { $condition .= " and UNIX_TIMESTAMP(pDate) <=" . to_timespan(strim($end_time)); } $sql = "select dlt.id as mid,t.*,d.`name`,u.user_name,tu.user_name as t_user_name,(dlt.load_money - dlt.transfer_amount) as leave_money from " . DB_PREFIX . "ips_transfer as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_data\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\twhere t.pTransferType = 4 "; $count_sql = "select count(*) from " . DB_PREFIX . "ips_transfer as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_data\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id\r\n\t\t\twhere t.pTransferType = 4 "; //print_r($sql.$condition);die; $list = $GLOBALS['db']->getAll($sql . $condition . $limit); $list_count = $GLOBALS['db']->getOne($count_sql . $condition); //print_r($count);die; //$name=$this->getActionName(); } elseif (strtolower($className) == "yeepay") { $condition = " where bizType = 'CREDIT_ASSIGNMENT' and is_complete_transaction = 1 and t.code ='1' and is_callback = 1 "; if (strim($_REQUEST['pBidNo']) != '') { $condition .= " and d.id like '%" . strim($_REQUEST['pBidNo']) . "%'"; } if (strim($_REQUEST['deal_name']) != '') { $condition .= " and d.name like '%" . strim($_REQUEST['deal_name']) . "%'"; } if (strim($start_time) != "") { $condition .= " and t.update_time >=" . to_timespan(strim($start_time)); } if (strim($end_time) != "") { $condition .= " and t.update_time <=" . to_timespan(strim($end_time)); } $sql = "select dlt.id as mid,t.*,d.`name`,u.user_name,tu.user_name as t_user_name,dlt.ips_status,dlt.t_user_id ,\r\n\t\t\trequestNo as pIpsBillNo,tenderOrderNo as pBidNo,FROM_UNIXTIME(t.create_time ,'%Y-%m-%d') as pDate,\r\n\t\t\tFROM_UNIXTIME(t.update_time ,'%Y-%m-%d') as pIpsTime\r\n\t\t\tfrom " . DB_PREFIX . "yeepay_cp_transaction as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.tenderOrderNo\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.transfer_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id"; $count_sql = "select count(*) \r\n\t\t\tfrom " . DB_PREFIX . "yeepay_cp_transaction as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.tenderOrderNo\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.transfer_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id"; //print_r($sql.$condition);die; $list = $GLOBALS['db']->getAll($sql . $condition . $limit); $list_count = $GLOBALS['db']->getOne($count_sql . $condition); //print_r($count);die; //$name=$this->getActionName(); } elseif (strtolower($className) == "baofoo") { $condition = " where ref_type = '1' and t.code ='CSD000' "; if (strim($_REQUEST['pBidNo']) != '') { $condition .= " and d.id like '%" . strim($_REQUEST['pBidNo']) . "%'"; } if (strim($_REQUEST['deal_name']) != '') { $condition .= " and d.name like '%" . strim($_REQUEST['deal_name']) . "%'"; } if (strim($start_time) != "") { $condition .= " and (t.req_time/1000) >=" . to_timespan(strim($start_time)); } if (strim($end_time) != "") { $condition .= " and (t.req_time/1000) <=" . to_timespan(strim($end_time)); } $sql = "select dlt.id as mid, t.*,d.`name`,u.user_name,tu.user_name as t_user_name,dlt.ips_status,dlt.t_user_id ,\r\n\t\t\torder_id as pIpsBillNo,dlt.deal_id as pBidNo,FROM_UNIXTIME(t.req_time /1000,'%Y-%m-%d') as pDate,\r\n\t\t\tFROM_UNIXTIME(t.req_time/1000 ,'%Y-%m-%d') as pIpsTime\r\n\t\t\tfrom " . DB_PREFIX . "baofoo_acct_trans as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = dlt.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id"; $count_sql = "select count(*) \r\n\t\t\tfrom " . DB_PREFIX . "baofoo_acct_trans as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal_load_transfer as dlt on dlt.id = t.ref_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = dlt.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id\r\n\t\t\tleft join " . DB_PREFIX . "user tu on tu.id = dlt.t_user_id"; //print_r($sql.$condition);die; //print_r($sql.$condition);die; $list = $GLOBALS['db']->getAll($sql . $condition . $limit); $list_count = $GLOBALS['db']->getOne($count_sql . $condition); } foreach ($list as $k => $v) { $condition = " AND dlt.id='" . $v["mid"] . "'"; //$condition = ' AND dlt.id='.$v["mid"].' 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.load_id = dl.id "; $info = get_transfer($union_sql, $condition); $list[$k]["left_benjin_format"] = $info["left_benjin_format"]; $list[$k]["left_lixi_format"] = $info["left_lixi_format"]; $list[$k]["transfer_amount_format"] = $info["transfer_amount_format"]; $list[$k]["transfer_income_format"] = $info["transfer_income_format"]; } if ($list) { register_shutdown_function(array(&$this, 'export_csv'), $page + 1); $list_value_old = array('id' => '""', 'pBidNo' => '""', 'name' => '""', 'user_name' => '""', 'left_benjin_format' => '""', 'left_lixi_format' => '""', 'transfer_amount_format' => '""', 'transfer_income_format' => '""', 't_user_name' => '""', 'pDate' => '""'); if ($page == 1) { $content = iconv("utf-8", "gbk", "编号,标号,贷款名称,转让者,剩余本金,剩余利息,转让金额,受让收益,承接人,承接时间"); $content = $content . "\n"; } foreach ($list as $k => $v) { $list_value = $list_value_old; $list_value["id"] = '"' . iconv('utf-8', 'gbk', $v['id']) . '"'; $list_value["name"] = '"' . iconv('utf-8', 'gbk', $v['name']) . '"'; $list_value["pBidNo"] = '"' . iconv('utf-8', 'gbk', $v["pBidNo"]) . '"'; $list_value["pDate"] = '"' . iconv('utf-8', 'gbk', $v["pDate"]) . '"'; $list_value["t_user_name"] = '"' . iconv('utf-8', 'gbk', $v["t_user_name"]) . '"'; $list_value["left_benjin_format"] = '"' . iconv('utf-8', 'gbk', $v["left_benjin_format"]) . '"'; $list_value["left_lixi_format"] = '"' . iconv('utf-8', 'gbk', $v["left_lixi_format"]) . '"'; $list_value["transfer_amount_format"] = '"' . iconv('utf-8', 'gbk', $v["transfer_amount_format"]) . '"'; $list_value["transfer_income_format"] = '"' . iconv('utf-8', 'gbk', $v["transfer_income_format"]) . '"'; $list_value["user_name"] = '"' . iconv('utf-8', 'gbk', $v["user_name"]) . '"'; $content .= implode(",", $list_value) . "\n"; } header("Content-Disposition: attachment; filename=order_list.csv"); echo $content; } else { if ($page == 1) { $this->error(L("NO_RESULT")); } } }
function dtcontact() { $win = 1; $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['TT_CONTACT'] . ' - ' . $GLOBALS['lang']['TOOLS']); $id = intval($_REQUEST['id']); if ($id > 0) { //先执行更新借贷信息 $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id); if ($deal_id == 0) { echo "不存在的债权"; die; } else { syn_deal_status($deal_id); } $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 and (dlt.user_id=' . $GLOBALS['user_info']['id'] . ' or dlt.t_user_id = ' . $GLOBALS['user_info']['id'] . ') '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; require APP_ROOT_PATH . "/app/Lib/deal_func.php"; $transfer = get_transfer($union_sql, $condition); if ($transfer) { $GLOBALS['tmpl']->assign('transfer', $transfer); } else { echo "不存在的债权"; die; } $GLOBALS['tmpl']->assign('SITE_URL', str_replace(array("https://", "http://"), "", SITE_DOMAIN)); $GLOBALS['tmpl']->assign('SITE_TITLE', app_conf("SITE_TITLE")); $GLOBALS['tmpl']->assign('CURRENCY_UNIT', app_conf("CURRENCY_UNIT")); $contract = $GLOBALS['tmpl']->fetch("str:" . get_contract($transfer['tcontract_id'])); $GLOBALS['tmpl']->assign('contract', $contract); } require APP_ROOT_PATH . "/system/utils/word.php"; $word = new word(); $word->start(); $wordname = "债权转让及受让协议.doc"; echo $GLOBALS['tmpl']->fetch("inc/tool/tcontact.html"); $word->save($wordname); }
public function index() { $root = array(); //set_gopreview(); $deal_id = intval($GLOBALS['request']['id']); $root['deal_id'] = $deal_id; if ($deal_id == 0) { echo "不存在的债权"; die; } $deal = get_deal($deal_id); //syn_transfer_status($id); $deal['yq_count'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_repay WHERE has_repay = 1 and deal_id=" . $deal_id . " AND status >= 2"); $root['deal'] = $deal; //借款列表 $load_list = $GLOBALS['db']->getAll("SELECT deal_id,user_id,user_name,money,is_auto,create_time FROM " . DB_PREFIX . "deal_load WHERE deal_id = " . $deal_id); $u_info = get_user("*", $deal['user_id']); //可用额度 $can_use_quota = get_can_use_quota($deal['user_id']); $root['can_use_quota'] = $can_use_quota; $credit_file = get_user_credit_file($deal['user_id']); $deal['is_faved'] = 0; $user_statics = sys_user_status($deal['user_id'], true); $root['user_statics'] = $user_statics; $root['load_list'] = $load_list; $root['credit_file'] = $credit_file; $root['u_info'] = $u_info; //工作认证是否过期 $root['expire'] = user_info_expire($u_info); //留言 $message_list = $GLOBALS['db']->getAll("SELECT title,content,a.create_time,rel_id,a.user_id,a.is_effect,b.user_name FROM " . DB_PREFIX . "message as a left join " . DB_PREFIX . "user as b on a.user_id = b.id WHERE rel_id = " . $id); $root['message'] = $message_list; /* //分页 $page = intval($_REQUEST['p']); if($page==0) $page = 1; $limit = (($page-1)*app_conf("PAGE_SIZE")).",".app_conf("PAGE_SIZE"); $msg_condition = $condition." AND is_effect = 1 "; $message = get_message_list($limit,$msg_condition); $page = new Page($message['count'],app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $root['pages']= $p; */ foreach ($message['list'] as $k => $v) { $msg_sub = get_message_list("", "pid=" . $v['id'], false); $message['list'][$k]["sub"] = $msg_sub["list"]; } $root['message_list'] = $message['list']; $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and d.publish_wait=0 '; $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id "; $transfer = get_transfer($union_sql, $condition); $root['transfer'] = $transfer; if ($deal['type_match_row']) { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name']; } else { $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['name']; } $root['page_title'] = $seo_title; $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name']; $root['page_keyword'] = $seo_keyword; $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']; $root['seo_description'] = $seo_description; output($root); }