public function __construct() { require_once APP_ROOT_PATH . "system/payment/Appay_payment.php"; $o = new Appay_payment(); //获取用户积分 $user_ap = $o->get_user_ap($GLOBALS['user_info']['id']); $GLOBALS['tmpl']->assign("user_ap", $user_ap); }
public function pay() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } $id = intval($_REQUEST['id']); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); if (!$deal_item) { app_redirect(url("index")); } elseif ($deal_item['support_count'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) { app_redirect(url("deal#show", array("id" => $deal_item['deal_id']))); } $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and id = " . $deal_item['deal_id']); if (!$deal_info) { app_redirect(url("index")); } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { app_redirect(url("deal#show", array("id" => $deal_item['deal_id']))); } $deal_item['price_format'] = number_price_format($deal_item['price']); $deal_item['delivery_fee_format'] = number_price_format($deal_item['delivery_fee']); $deal_item['total_price_format'] = number_price_format($deal_item['total_price']); $deal_info['percent'] = round($deal_info['support_amount'] / $deal_info['limit_price'] * 100); $deal_info['remain_days'] = ceil(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $deal_item['ap_price'] = $deal_item['price'] * $deal_item['ap_ratio']; $deal_item['delivery_ap'] = $deal_item['delivery_fee'] * $deal_item['ap_ratio']; $deal_info['limit_ap'] = $deal_info['limit_price'] * $deal_info['ap_ratio']; $deal_info['ap_amount'] = $deal_info['support_amount'] * $deal_info['ap_ratio']; $deal_item['total_ap'] = $deal_item['ap_price'] + $deal_item['delivery_ap']; $GLOBALS['tmpl']->assign("deal_item", $deal_item); $GLOBALS['tmpl']->assign("deal_info", $deal_info); if ($deal_info['seo_title'] != "") { $GLOBALS['tmpl']->assign("seo_title", $deal_info['seo_title']); } if ($deal_info['seo_keyword'] != "") { $GLOBALS['tmpl']->assign("seo_keyword", $deal_info['seo_keyword']); } if ($deal_info['seo_description'] != "") { $GLOBALS['tmpl']->assign("seo_description", $deal_info['seo_description']); } $GLOBALS['tmpl']->assign("page_title", $deal_info['name']); $memo = es_session::get("cart_memo_" . $id); $consignee_id = intval($_REQUEST['did']); $GLOBALS['tmpl']->assign("memo", $memo); $GLOBALS['tmpl']->assign("consignee_id", $consignee_id); require_once APP_ROOT_PATH . "system/payment/Appay_payment.php"; $o = new Appay_payment(); //获取用户积分 $user_ap = $o->get_user_ap($GLOBALS['user_info']['id']); $GLOBALS['tmpl']->assign('user_ap', $user_ap); $GLOBALS['tmpl']->display("apcart_pay.html"); }
public function show() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } get_mortgate(); //获取项目的ID $id = intval($_REQUEST['id']); $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . "))"); $deal_info['deal_type'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id=" . $deal_info['cate_id']); $deal_info['login_time'] = $GLOBALS['db']->getOne("select login_time from " . DB_PREFIX . "user where id=" . $deal_info['user_id']); if (!$deal_info) { app_redirect(url("index")); } $deal_img_array = array(); $deal_img_array[] = $deal_info['image']; for ($i = 0; $i < 9; $i++) { if ($deal_info['imghead_' . $i]) { $deal_img_array[] = $deal_info['imghead_' . $i]; } } $GLOBALS['tmpl']->assign('deal_img_array', $deal_img_array); //获取当前用户支持当前项目状态 $deal_sup_num = $GLOBALS['db']->getOne("select count(*) as num from " . DB_PREFIX . "deal_order where deal_id = " . $id . " and user_id = " . intval($GLOBALS['user_info']['id']) . " and order_status=3"); $GLOBALS['tmpl']->assign('deal_sup_num', $deal_sup_num); //获取当前用户关注当前项目状态 $deal_focus_num = $GLOBALS['db']->getOne("select count(*) as num from " . DB_PREFIX . "deal_focus_log where deal_id = " . $id . " and user_id = " . intval($GLOBALS['user_info']['id'])); $GLOBALS['tmpl']->assign('deal_focus_num', $deal_focus_num); if ($deal_info['is_effect'] == 1) { log_deal_visit($deal_info['id']); } if ($deal_info['type'] == 1) { //跟投人数 $gen_num = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "investment_list where type=2 and deal_id=" . $id); $GLOBALS['tmpl']->assign('gen_num', intval($gen_num)); //询价人数 $xun_num = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "investment_list where type=0 and deal_id=" . $id); $GLOBALS['tmpl']->assign('xun_num', intval($xun_num)); } $deal_info = cache_deal_extra($deal_info); $deal_info['ap_amount'] = $deal_info['support_amount'] * $deal_info['ap_ratio']; $deal_info['limit_ap'] = $deal_info['limit_price'] * $deal_info['ap_ratio']; $page_size = DEAL_COMMENT_PAGE_SIZE; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $comment_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where deal_id = " . $id . " and log_id = 0 and status=1 order by create_time desc limit " . $limit); $GLOBALS['tmpl']->assign('comment_list', $comment_list); $comment_count = count($comment_list); $GLOBALS['tmpl']->assign('comment_count', $comment_count); $page = '<ul>'; if ($p > 1) { $page .= '<li><a href="/index.php?ctl=ap&act=show&id=' . $id . '&p=' . ($p - 1) . '" class="last">上一页</a></li>'; } $allPNum = ceil($comment_count / $page_size); for ($i = 1; $i <= $allPNum; $i++) { $page .= '<li class="fy2_no"><a href="/index.php?ctl=ap&act=show&id=' . $id . '&p=' . $i . '" class="last">' . $i . '</a></li>'; } if ($p < $allPNum) { $page .= '<li><a href="/index.php?ctl=ap&act=show&id=' . $id . '&p=' . ($p + 1) . '" class="next">下一页</a></li>'; } $page .= '</ul>'; $GLOBALS['tmpl']->assign('page', $page); $this->init_deal_page(@$deal_info); if (app_conf("INVEST_STATUS") == 2 && $deal_info['type'] == 0) { showErr("产品众筹已经关闭"); } if ($deal_info['type'] == 1) { $GLOBALS['tmpl']->assign('deal_type', 'gq_type'); } else { $GLOBALS['tmpl']->assign('deal_type', 'product_type'); } require_once APP_ROOT_PATH . "system/payment/Appay_payment.php"; $o = new Appay_payment(); //获取用户积分 $user_ap = $o->get_user_ap($GLOBALS['user_info']['id']); $GLOBALS['tmpl']->assign('user_ap', $user_ap); //普通众筹 $GLOBALS['tmpl']->display("ap_show.html"); }