public function index() { $root = array(); $root['response_code'] = 1; $id = intval($_REQUEST['id']); $email = strim($GLOBALS['request']['email']); // 用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); // 密码 // 检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['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 = " . $user_id . "))"); $deal_info = cache_deal_extra($deal_info); $page_size = $GLOBALS['m_config']['page_size']; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $support_list = $GLOBALS['db']->getAll("select user_id,price from " . DB_PREFIX . "deal_support_log where deal_id = " . $id . " order by create_time desc limit " . $limit); $support_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_support_log where deal_id = " . $id); $user_list = array(); $user_ids = array(); foreach ($support_list as $k => $v) { if ($v['user_id']) { $user_ids[] = $v['user_id']; } } $user_ids = array_filter($user_ids); if ($user_ids) { $user_id_str = implode(',', array_filter($user_ids)); $user_list_array = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where id in (" . $user_id_str . ") "); foreach ($user_list_array as $k => $v) { foreach ($support_list as $k_support => $v_support) { if ($v['id'] == $v_support['user_id']) { $support_list[$k_support]['user_info'] = $v; $support_list[$k_support]['user_info']["image"] = get_user_avatar_root($v["id"], "middle"); $support_list[$k_support]['user_info']["url"] = url_root("home", array("id" => $v["user_id"])); } } } } $root['support_list'] = $support_list; // ----------------------------------- $virtual_person = $GLOBALS['db']->getOne("select sum(virtual_person) from " . DB_PREFIX . "deal_item where deal_id=" . $id); // 获得该项目下的子项目的所有信息 // $deal_item_list=$GLOBALS['db']->getAll("select * from // ".DB_PREFIX."deal_item where deal_id=".$id); $deal_item_list = $deal_info['deal_item_list']; foreach ($deal_item_list as $k => $v) { // 统计每个子项目真实+虚拟(人) $deal_item_list[$k]['virtual_person'] = $v['virtual_person'] + $v['support_count']; // 统计所有真实+虚拟(钱) $deal_item_list[$k]['virtual_price'] = $v['price'] * $deal_item_list[$k]['virtual_person']; // 支付该项花费的金额 $deal_item_list[$k]['total_price'] = $v['price'] + $v['delivery_fee']; $deal_item_list[$k]['delivery_fee_format'] = number_price_format($v['delivery_fee']); $deal_item_list[$k]['content'] = $v['description']; foreach ($deal_item_list[$k]['images'] as $kk => $vv) { $deal_item_list[$k]['images'][$kk]['image'] = get_abs_img_root(get_spec_image($vv['image'], 640, 240, 1)); } } $root['deal_item_list'] = $deal_item_list; $root['person'] = $virtual_person + $deal_info['support_count']; // ----------------------------------- if ($deal_info['user_id'] > 0) { $deal_user_info = $GLOBALS['db']->getRow("select id,user_name,province,city,intro,login_time from " . DB_PREFIX . "user where id = " . $deal_info['user_id'] . " and is_effect = 1"); if ($deal_user_info == false) { $deal_user_info = NULL; } $root['deal_user_info'] = $deal_user_info; } // $root['support_list'] = $support_list; $root['page'] = array("page" => $page, "page_total" => ceil($support_count / $page_size), "page_size" => intval($page_size), 'total' => intval($support_count)); output($root); }
public function index() { if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } //(普通众筹)支持之前需要用户绑定手机号 if (!$GLOBALS['user_info']['mobile']) { app_redirect(url_wap("user#user_bind_mobile", array("cid" => intval($_REQUEST['id'])))); } $GLOBALS['tmpl']->assign("user_info", $GLOBALS['user_info']); $id = intval($_REQUEST['id']); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); if (!$deal_item) { app_redirect(url_wap("index")); } elseif ($deal_item['support_count'] + $deal_item['virtual_person'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) { app_redirect(url_wap("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']); $deal_info = cache_deal_extra($deal_info); init_deal_page_wap($deal_info); if (!$deal_info) { app_redirect(url_wap("index")); } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } $deal_item['consigee_url'] = url_wap("settings#add_consignee", array("deal_item_id" => $id)); //无私奉献 if ($deal_item['type'] == 1) { $pay_money = floatval($_REQUEST['pay_money']); if ($pay_money <= 0) { showErr("您输入的金额错误", 0, url_wap("deal#show", array("id" => $deal_item['deal_id']))); } $deal_item['price'] = $pay_money; $GLOBALS['tmpl']->assign('pay_money', $pay_money); } $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'] = $deal_item['price'] + $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, 2); $deal_info['remain_days'] = ceil(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $GLOBALS['tmpl']->assign("deal_item", $deal_item); if ($deal_item['is_delivery']) { $consignee_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id'])); if ($consignee_list) { $GLOBALS['tmpl']->assign("consignee_list", $consignee_list); } else { $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc"); //二级地址 $GLOBALS['tmpl']->assign("region_lv2", $region_lv2); } } $payment_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "payment where is_effect = 1 and online_pay=2 order by sort asc "); $GLOBALS['tmpl']->assign("payment_list", $payment_list); $GLOBALS['tmpl']->assign("coll", is_tg(true)); $GLOBALS['tmpl']->assign("page_title", "提交订单"); $GLOBALS['tmpl']->display("cart_index.html"); }
function init_deal_page($deal_info) { //links $g_links = get_link_by_id(14); $GLOBALS['tmpl']->assign("g_links", $g_links); $GLOBALS['tmpl']->assign("page_title", $deal_info['name']); 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']); } $deal_info['tags_arr'] = preg_split("/[ ,]/", $deal_info['tags']); $deal_info['support_amount_format'] = number_price_format($deal_info['support_amount']); $deal_info['limit_price_format'] = number_price_format($deal_info['limit_price']); $deal_info['remain_days'] = floor(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); //初始化与虚拟金额有所关联的几个比较特殊的数据 start foreach ($deal_info['deal_item_list'] as $k => $v) { // 统计所有真实+虚拟(钱) $deal_info['total_virtual_price'] += $v['price'] * $v['virtual_person'] + $v['support_amount']; //统计每个子项目真实+虚拟(人) $deal_info['deal_item_list'][$k]['virtual_person_list'] = $v['virtual_person'] + $v['support_count']; } //项目等级放到项目详细页面模块(对详细页面进行控制) $deal_info['deal_level'] = $GLOBALS['db']->getOne("select level from " . DB_PREFIX . "deal_level where id=" . intval($deal_info['user_level'])); $deal_info['virtual_person'] = $GLOBALS['db']->getOne("select sum(virtual_person) from " . DB_PREFIX . "deal_item where deal_id=" . $deal_info['id']); $deal_info['person'] = $deal_info['virtual_person'] + $deal_info['support_count']; $deal_info['percent'] = round($deal_info['total_virtual_price'] / $deal_info['limit_price'] * 100); //初始化与虚拟金额有所关联的几个比较特殊的数据 end $GLOBALS['tmpl']->assign("deal_info", $deal_info); $deal_item_list = $deal_info['deal_item_list']; //开启限购后剩余几位 foreach ($deal_item_list as $k => $v) { if ($v['limit_user'] > 0) { $deal_item_list[$k]['remain_person'] = $v['limit_user'] - $v['virtual_person'] - $v['support_count']; } } $GLOBALS['tmpl']->assign("deal_item_list", $deal_item_list); if ($deal_info['user_id'] > 0) { // $deal_user_info = $GLOBALS['db']->getRow("select id,user_name,province,city,intro,login_time from ".DB_PREFIX."user where id = ".$deal_info['user_id']." and is_effect = 1"); // if($deal_user_info) // { // $deal_user_info['weibo_list'] = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."user_weibo where user_id = ".$deal_user_info['id']); // $GLOBALS['tmpl']->assign("deal_user_info",$deal_user_info); // } } if ($GLOBALS['user_info']) { $is_focus = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_focus_log where deal_id = " . $deal_info['id'] . " and user_id = " . intval($GLOBALS['user_info']['id'])); $GLOBALS['tmpl']->assign("is_focus", $is_focus); } }
function init_deal_page($deal_info) { $GLOBALS['tmpl']->assign("page_title", $deal_info['name']); 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']); } $deal_info['tags_arr'] = preg_split("/[ ,]/", $deal_info['tags']); $deal_info['support_amount_format'] = number_price_format($deal_info['support_amount']); $deal_info['limit_price_format'] = number_price_format($deal_info['limit_price']); $deal_info['remain_days'] = floor(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $deal_info['percent'] = round($deal_info['support_amount'] / $deal_info['limit_price'] * 100); $GLOBALS['tmpl']->assign("deal_info", $deal_info); $deal_item_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_item where deal_id = " . $deal_info['id'] . " order by price asc"); foreach ($deal_item_list as $k => $v) { $deal_item_list[$k]['images'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_item_image where deal_id=" . $deal_info['id'] . " and deal_item_id = " . $v['id']); $deal_item_list[$k]['price_format'] = number_price_format($v['price']); } $GLOBALS['tmpl']->assign("deal_item_list", $deal_item_list); if ($deal_info['user_id'] > 0) { $deal_user_info = $GLOBALS['db']->getRow("select id,user_name,province,city,intro,login_time from " . DB_PREFIX . "user where id = " . $deal_info['user_id'] . " and is_effect = 1"); if ($deal_user_info) { $deal_user_info['weibo_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_weibo where user_id = " . $deal_user_info['id']); $GLOBALS['tmpl']->assign("deal_user_info", $deal_user_info); } } if ($GLOBALS['user_info']) { $is_focus = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_focus_log where deal_id = " . $deal_info['id'] . " and user_id = " . intval($GLOBALS['user_info']['id'])); $GLOBALS['tmpl']->assign("is_focus", $is_focus); } }
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'] = $deal_item['price'] + $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'] = floor(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $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); $payment_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "payment where is_effect = 1 order by sort asc "); $payment_html = ""; foreach ($payment_list as $k => $v) { $class_name = $v['class_name'] . "_payment"; require_once APP_ROOT_PATH . "system/payment/" . $class_name . ".php"; $o = new $class_name(); $payment_html .= "<div>" . $o->get_display_code() . "<div class='blank'></div></div>"; } $GLOBALS['tmpl']->assign("payment_html", $payment_html); $GLOBALS['tmpl']->display("cart_pay.html"); }
function init_deal_page_wap($deal_info) { $GLOBALS['tmpl']->assign("page_title", $deal_info['name']); 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']); } //开启限购后剩余几位 $deal_info['deal_item_count'] = 0; foreach ($deal_info['deal_item_list'] as $k => $v) { // 统计所有真实+虚拟(钱) $deal_info['total_virtual_person'] += $v['virtual_person']; $deal_info['total_virtual_price'] += $v['price'] * $v['virtual_person'] + $v['support_amount']; //统计每个子项目真实+虚拟(钱) $deal_info['deal_item_list'][$k]['person'] = $v['virtual_person'] + $v['support_count']; $deal_info['deal_item_list'][$k]['money'] = $v['price'] * $v['virtual_person'] + $v['support_amount']; $deal_info['deal_item_list'][$k]['cart_url'] = url_wap("cart#index", array("id" => $v['id'])); if ($v['limit_user']) { $deal_info['deal_item_list'][$k]['remain_person'] = $v['limit_user'] - $v['virtual_person'] - $v['support_count']; } $deal_info['deal_item_count']++; } // $deal_info['deal_type']=$GLOBALS['db']->getOne("select name from ".DB_PREFIX."deal_cate where id=".$deal_info['cate_id']); $deal_info['tags_arr'] = preg_split("/[ ,]/", $deal_info['tags']); $deal_info['support_amount_format'] = number_price_format($deal_info['support_amount']); $deal_info['limit_price_format'] = number_price_format($deal_info['limit_price']); $deal_info['total_virtual_price_format'] = number_price_format(intval($deal_info['total_virtual_price'])); $deal_info['remain_days'] = floor(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $deal_info['percent'] = round($deal_info['support_amount'] / $deal_info['limit_price'] * 100); //$deal_info['deal_level']=$GLOBALS['db']->getOne("select level from ".DB_PREFIX."deal_level where id=".intval($deal_info['user_level'])); $deal_info['person'] = $deal_info['total_virtual_person'] + $deal_info['support_count']; $deal_info['percent'] = round($deal_info['total_virtual_price'] / $deal_info['limit_price'] * 100); $deal_info['update_url'] = url_wap("deal#update", array("id" => $deal_info['id'])); $deal_info['comment_url'] = url_wap("deal#comment", array("id" => $deal_info['id'])); $deal_info['info_url'] = url_wap("deal#info", array("id" => $deal_info['id'])); if ($deal_info['begin_time'] > NOW_TIME) { $deal_info['status'] = '0'; $deal_info['left_days'] = floor(($deal_info['begin_time'] - NOW_TIME) / (24 * 3600)); } elseif ($deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] > 0) { if ($deal_info['percent'] >= 100) { $deal_info['status'] = '1'; } else { $deal_info['status'] = '2'; } } else { if ($deal_info['end_time'] > 0) { $deal_info['status'] = '3'; } else { $deal_info['status'] = '4'; } } if ($GLOBALS['user_info']) { $is_focus = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_focus_log where deal_id = " . $deal_info['id'] . " and user_id = " . intval($GLOBALS['user_info']['id'])); $GLOBALS['tmpl']->assign("is_focus", $is_focus); } if ($deal_info['user_id'] > 0) { $deal_user_info = $GLOBALS['db']->getRow("select id,user_name,province,city,intro,login_time from " . DB_PREFIX . "user where id = " . $deal_info['user_id'] . " and is_effect = 1"); if ($deal_user_info) { $deal_user_info['weibo_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_weibo where user_id = " . $deal_user_info['id']); $deal_user_info['image'] = get_user_avatar($deal_user_info['id'], 'middle'); $deal_info['user_info'] = $deal_user_info; } } if (!empty($deal_info['vedio']) && !preg_match("/http://player.youku.com/embed/i", $deal_info['source_video'])) { $deal_info['source_vedio'] = preg_replace("/id_(.*)\\.html(.*)/i", "http://player.youku.com/embed/\${1}", baseName($deal_info['vedio'])); $GLOBALS['db']->query("update " . DB_PREFIX . "deal set source_vedio='" . $deal_info['source_vedio'] . "' where id=" . $deal_info['id']); } $GLOBALS['tmpl']->assign("deal_info", $deal_info); }
function cache_deal_extra($deal_info) { if ($deal_info['deal_extra_cache'] == "") { $deal_extra_cache = array(); $deal_info['deal_faq_list'] = $deal_extra_cache['deal_faq_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_faq where deal_id = " . $deal_info['id'] . " order by sort asc"); $deal_info['deal_item_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_item where deal_id = " . $deal_info['id'] . " order by price asc"); foreach ($deal_info['deal_item_list'] as $k => $v) { $deal_info['deal_item_list'][$k]['images'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_item_image where deal_id=" . $deal_info['id'] . " and deal_item_id = " . $v['id']); $deal_info['deal_item_list'][$k]['price_format'] = number_price_format($v['price']); } $deal_extra_cache['deal_item_list'] = $deal_info['deal_item_list']; $GLOBALS['db']->query("update " . DB_PREFIX . "deal set deal_extra_cache = '" . serialize($deal_extra_cache) . "' where id = " . $deal_info['id']); } else { $deal_extra_cache = unserialize($deal_info['deal_extra_cache']); $deal_info['deal_faq_list'] = $deal_extra_cache['deal_faq_list']; $deal_info['deal_item_list'] = $deal_extra_cache['deal_item_list']; } return $deal_info; }
function cache_deal_extra($deal_info) { if ($deal_info['deal_extra_cache'] == "") { $deal_extra_cache = array(); $deal_info['deal_faq_list'] = $deal_extra_cache['deal_faq_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_faq where deal_id = " . $deal_info['id'] . " order by sort asc"); $deal_info['deal_item_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_item where deal_id = " . $deal_info['id'] . " order by price asc"); foreach ($deal_info['deal_item_list'] as $k => $v) { $deal_info['deal_item_list'][$k]['images'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_item_image where deal_id=" . $deal_info['id'] . " and deal_item_id = " . $v['id']); $deal_info['deal_item_list'][$k]['price_format'] = number_price_format($v['price']); $deal_info['deal_item_list'][$k]['error_type'] = 1; } $allIqianjinDealList = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "iqianjin_deal_item where deal_id=" . $deal_info['id']); if ($allIqianjinDealList) { $user_info = $GLOBALS['user_info']; if ($user_info) { $iqianjinDealItem2List = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "iqianjin_buy where type=2 and user_id=" . $user_info['id']); if ($iqianjinDealItem2List) { $iqianjinItem2Info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "iqianjin_deal_item where type=2 and deal_id=" . $deal_info['id']); foreach ($deal_info['deal_item_list'] as $key1 => $val1) { if ($val1['id'] == $iqianjinItem2Info['deal_item_id']) { $deal_info['deal_item_list'][$key1]['error_type'] = 3; $deal_info['deal_item_list'][$key1]['error_message'] = '您已经购买了本红包,请您到爱钱进领取。'; } } } $iqianjinDealItemList = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "iqianjin_deal_item where deal_id=" . $deal_info['id']); if ($iqianjinDealItemList) { foreach ($deal_info['deal_item_list'] as $keyd => $vald) { $iqianjinWinList = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "iqianjin_winner where user_id=" . $user_info['id']); if ($iqianjinWinList) { $deal_info['deal_item_list'][$keyd]['error_type'] = 4; $deal_info['deal_item_list'][$keyd]['error_message'] = '您已中奖!获得了爱钱进普通红包,请您到爱钱进领取。'; } else { $iqianjinBuyInfo = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "iqianjin_buy where type=1 and deal_item_id=" . $vald['id'] . " and user_id=" . $user_info['id']); if ($iqianjinBuyInfo) { $deal_info['deal_item_list'][$keyd]['error_type'] = 2; $deal_info['deal_item_list'][$keyd]['error_message'] = '您今天已经购买了本红包,请明天12:00再来支持。'; } } } } } } $deal_extra_cache['deal_item_list'] = $deal_info['deal_item_list']; //$GLOBALS['db']->query("update ".DB_PREFIX."deal set deal_extra_cache = '".serialize($deal_extra_cache)."' where id = ".$deal_info['id']); } else { $deal_extra_cache = unserialize($deal_info['deal_extra_cache']); $deal_info['deal_faq_list'] = $deal_extra_cache['deal_faq_list']; $deal_info['deal_item_list'] = $deal_extra_cache['deal_item_list']; } return $deal_info; }
public function index() { $root = array(); $id = intval($_REQUEST['id']); $root['response_code'] = 1; $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']) . "))"); $virtual_person = $GLOBALS['db']->getOne("select sum(virtual_person) from " . DB_PREFIX . "deal_item where deal_id=" . $id); //获得该项目下的子项目的所有信息 $deal_item_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_item where deal_id=" . $id); $virtual_person_list = array(); foreach ($deal_item_list as $k => $v) { // 统计所有真实+虚拟(钱) $total_virtual_price += $v['price'] * $v['virtual_person'] + $v['support_amount']; //统计每个子项目真实+虚拟(钱) //$virtual_money_list[$v['id']]['total_money']=$v['price'] * $v['virtual_person']+$v['support_amount']; //统计每个子项目真实+虚拟(人) $virtual_person_list[$k]['virtual_person'] = $v['virtual_person'] + $v['support_count']; } if (!$deal_info) { app_redirect(url("index")); } if ($deal_info['is_effect'] == 1) { log_deal_visit($deal_info['id']); } $deal_info = cache_deal_extra($deal_info); //项目等级放到项目详细页面模块(对详细页面进行控制) $deal_info['deal_level'] = $GLOBALS['db']->getOne("select level from " . DB_PREFIX . "deal_level where id=" . intval($deal_info['user_level'])); $deal_faq_list = $deal_info['deal_faq_list']; $root['deal_faq_list'] = $deal_faq_list; $root['virtual_person'] = $virtual_person; $root['virtual_person_list'] = $virtual_person_list; $root['total_virtual_price'] = $total_virtual_price; $root['person'] = $virtual_person + $deal_info['support_count']; // init_deal_page($deal_info); $root['page_title'] = $deal_info['name']; if ($deal_info['seo_title'] != "") { $root['seo_title'] = $deal_info['seo_title']; } if ($deal_info['seo_keyword'] != "") { $root['seo_keyword'] = $deal_info['seo_keyword']; } if ($deal_info['seo_description'] != "") { $root['seo_description'] = $deal_info['seo_description']; } $deal_info['tags_arr'] = preg_split("/[ ,]/", $deal_info['tags']); $deal_info['support_amount_format'] = number_price_format($deal_info['support_amount']); $deal_info['limit_price_format'] = number_price_format($deal_info['limit_price']); $deal_info['remain_days'] = floor(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $deal_info['percent'] = round($deal_info['support_amount'] / $deal_info['limit_price'] * 100); $root['deal_info'] = $deal_info; $deal_item_list = $deal_info['deal_item_list']; $root['deal_item_list'] = $deal_item_list; if ($deal_info['user_id'] > 0) { $deal_user_info = $GLOBALS['db']->getRow("select id,user_name,province,city,intro,login_time from " . DB_PREFIX . "user where id = " . $deal_info['user_id'] . " and is_effect = 1"); if ($deal_user_info) { $deal_user_info['weibo_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_weibo where user_id = " . $deal_user_info['id']); $root['deal_user_info'] = $deal_user_info; } } if ($GLOBALS['user_info']) { $is_focus = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_focus_log where deal_id = " . $deal_info['id'] . " and user_id = " . intval($GLOBALS['user_info']['id'])); $root['is_focus'] = $is_focus; } output($root); }
public function pay() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } $ticket_id = intval($_REQUEST['ticket_id']); $GLOBALS['tmpl']->assign("ticket_id", $ticket_id); $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']))); } $zc_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order where deal_id = " . $deal_info["id"] . " and user_id = " . $GLOBALS['user_info']['id']); if ($deal_info["zc_count_limit"] != 0 and $zc_count >= $deal_info["zc_count_limit"]) { showErr("对不起,您参与次数超过上限,已经无法继续参与本项目!", 0, url("deal#show", array("id" => $deal_info["id"]))); } //无私奉献 if ($deal_item['type'] == 1) { $pay_money = floatval($_REQUEST['pay_money']); if ($pay_money <= 0) { showErr("您输入的金额错误", 0, url("deal#show", array("id" => $deal_item['deal_id']))); } $deal_item['price'] = $pay_money; $GLOBALS['tmpl']->assign('pay_money', $pay_money); } $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'] = $deal_item['price'] + $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, 2); $deal_info['remain_days'] = ceil(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); //用券支付 $ticket_id = intval($_REQUEST['ticket_id']); $ticket = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "ticket where id=" . $ticket_id); if (count($ticket) > 0) { $ticket_type = $ticket['ticket_type']; //无条件支付 if ($ticket_type == 0) { $less_money = $ticket['money']; $deal_item['total_price'] = $deal_item['total_price'] - $less_money; } elseif ($ticket_type == 1) { if ($deal_item['total_price'] > $ticket['value']) { $less_money = $ticket['money']; } else { $less_money = 0; } $deal_item['total_price'] = $deal_item['total_price'] - $less_money; } } $deal_item['total_price_format'] = number_price_format($deal_item['total_price']); $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); $payment_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "payment where is_effect = 1 and online_pay=1 order by sort asc "); $payment_html = ""; foreach ($payment_list as $k => $v) { $class_name = $v['class_name'] . "_payment"; require_once APP_ROOT_PATH . "system/payment/" . $class_name . ".php"; $o = new $class_name(); $payment_html .= "<div>" . $o->get_display_code() . "<div class='blank'></div></div>"; } $GLOBALS['tmpl']->assign("payment_html", $payment_html); $GLOBALS['tmpl']->assign("coll", is_tg(true)); $GLOBALS['tmpl']->display("cart_pay.html"); }
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; $root['response_code'] = 1; $user['money_format'] = format_price($user['money']); //可用资金 $root['money_format'] = $user['money_format']; $root['money'] = $user['money']; $id = intval($_REQUEST['id']); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); if (!$deal_item) { $root['addr'] = get_domain() . APP_ROOT; } elseif ($deal_item['support_count'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) { $root['addr'] = url("deal#show", array("id" => $deal_item['deal_id'])); //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) { $root['addr'] = get_domain() . APP_ROOT; } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { $root['addr'] = url("deal#show", array("id" => $deal_item['deal_id'])); //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'] = $deal_item['price'] + $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'] = floor(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $root['deal_item'] = $deal_item; $root['deal_info'] = $deal_info; if ($deal_info['seo_title'] != "") { $root['seo_title'] = $deal_info['seo_title']; } if ($deal_info['seo_keyword'] != "") { $root['seo_keyword'] = $deal_info['seo_keyword']; } if ($deal_info['seo_description'] != "") { $root['seo_description'] = $deal_info['seo_description']; } $root['page_title'] = $deal_info['name']; if ($deal_item['is_delivery']) { $consignee_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id'])); if ($consignee_list) { $root['consignee_list'] = $consignee_list; } else { $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc"); //二级地址 $root['region_lv2'] = $region_lv2; } } $consignee_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id'])); $root['consignee_list'] = $consignee_list; $memo = es_session::get("cart_memo_" . $id); $consignee_id = intval($_REQUEST['did']); $root['memo'] = $memo; $root['consignee_id'] = $consignee_id; $payment_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "payment where is_effect = 1 and online_pay = 2 order by sort asc "); $payment_html = ""; foreach ($payment_list as $k => $v) { $class_name = $v['class_name'] . "_payment"; require_once APP_ROOT_PATH . "system/payment/" . $class_name . ".php"; $o = new $class_name(); $payment_html .= "<div>" . $o->get_display_code() . "<div class='blank'></div></div>"; } $root['payment_html'] = $payment_html; $root['payment_list'] = $payment_list; } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function index() { $l = intval($_REQUEST['l']) ? "limit " . intval($_REQUEST['l']) : ""; $r = strim($_REQUEST['r']); //推荐类型 $id = intval($_REQUEST['id']); //分类id $loc = strim($_REQUEST['loc']); //地区 $tag = strim($_REQUEST['tag']); //标签 $kw = strim($_REQUEST['k']); //关键词 if (intval($_REQUEST['redirect']) == 1) { $param = array(); if ($r != "") { $param = array_merge($param, array("r" => $r)); } if ($id > 0) { $param = array_merge($param, array("id" => $id)); } if ($loc != "") { $param = array_merge($param, array("loc" => $loc)); } if ($tag != "") { $param = array_merge($param, array("tag" => $tag)); } if ($kw != "") { $param = array_merge($param, array("k" => $kw)); } } $image_list = load_dynamic_cache("INDEX_IMAGE_LIST"); if ($image_list === false) { $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc"); } $cate_result = load_dynamic_cache("INDEX_CATE_LIST"); if ($cate_result === false) { $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc"); $cate_result = array(); foreach ($cate_list as $k => $v) { $cate_result[$v['id']] = $v; } } $loc_result = load_dynamic_cache("INDEX_CATE_LOC"); if ($loc_result === false) { $loc_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal GROUP by province"); $loc_result = array(); foreach ($loc_list as $k => $v) { $loc_result[$v['province']] = $v; } } $condition = " is_delete = 0 and is_effect = 1 "; if ($r != "") { if ($r == "new") { $condition .= " and " . NOW_TIME . " - begin_time < " . 24 * 3600 . " and " . NOW_TIME . " - begin_time > 0 "; //上线不超过一天 } if ($r == "nend") { $condition .= " and end_time - " . NOW_TIME . " < " . 24 * 3600 . " and end_time - " . NOW_TIME . " > 0 "; //当天就要结束 } if ($r == "classic") { $condition .= " and is_classic = 1 "; } } if ($id > 0) { $condition .= " and cate_id = " . $id; } if ($loc != "" && $loc != "all") { $condition .= " and (province = '" . $loc . "' or city = '" . $loc . "') "; } if ($tag != "") { $unicode_tag = str_to_unicode_string($tag); $condition .= " and match(tags_match) against('" . $unicode_tag . "' IN BOOLEAN MODE) "; } if ($kw != "") { $kws_div = div_str($kw); foreach ($kws_div as $k => $item) { $kws[$k] = str_to_unicode_string($item); } $ukeyword = implode(" ", $kws); $condition .= " and (match(name_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or match(tags_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $kw . "%') "; } $deal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where " . $condition . " order by sort asc "); $deal_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where " . $condition); foreach ($deal_list as $k => $v) { $deal_list[$k]['support_amount'] = number_price_format($deal_list[$k]['support_amount']); $deal_list[$k]['image'] = APP_ROOT . substr($deal_list[$k]['image'], 1); $deal_list[$k]['remain_days'] = floor(($v['end_time'] - NOW_TIME) / (24 * 3600)); $deal_list[$k]['percent'] = round($v['support_amount'] / $v['limit_price'] * 100); $deal_list[$k]['limit_price'] = number_format($v['limit_price']); } $arr = array('data' => $deal_list, 'total' => $deal_count); echo json_encode($arr); }
public function init_deal_page($deal_info) { $GLOBALS['tmpl']->assign("page_title", $deal_info['name']); 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']); } $deal_info['tags_arr'] = preg_split("/[ ,]/", $deal_info['tags']); $deal_info['support_amount_format'] = number_price_format($deal_info['support_amount']); $deal_info['limit_price_format'] = number_price_format($deal_info['limit_price'] / 10000); $deal_info['remain_days'] = ceil(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $deal_info['person'] = 0; $type_2 = 0; $type_array = array(); //初始化与虚拟金额有所关联的几个比较特殊的数据 start foreach ($deal_info['deal_item_list'] as $k => $v) { //统计每个子项目真实+虚拟(人) $deal_info['deal_item_list'][$k]['virtual_person_list'] = intval($v['virtual_person'] + $v['support_count']); if ($v['type'] == 1) { $type_array[] = $v; unset($deal_info['deal_item_list'][$k]); } } if ($type_array) { $deal_info['deal_item_list'] = array_merge($deal_info['deal_item_list'], $type_array); } if ($deal_info['type'] == 1) { $deal_info['person'] = $deal_info['invote_num']; $deal_info['total_virtual_price'] = number_price_format($deal_info['invote_money'] / 10000); $deal_info['percent'] = round($deal_info['invote_money'] / $deal_info['limit_price'] * 100, 2); } else { $deal_info['person'] = $deal_info['support_count'] + $deal_info['virtual_num']; $deal_info['total_virtual_price'] = number_price_format($deal_info['support_amount'] + $deal_info['virtual_price']); $deal_info['percent'] = round(($deal_info['support_amount'] + $deal_info['virtual_price']) / $deal_info['limit_price'] * 100, 2); } //项目等级放到项目详细页面模块(对详细页面进行控制) $deal_info['deal_level'] = $GLOBALS['db']->getOne("select level from " . DB_PREFIX . "deal_level where id=" . intval($deal_info['user_level'])); $deal_info['virtual_person'] = $GLOBALS['db']->getOne("select sum(virtual_person) from " . DB_PREFIX . "deal_item where deal_id=" . $deal_info['id']); $deal_info['update_url'] = url_wap("deal#update", array("id" => $deal_info['id'])); $deal_info['comment_url'] = url_wap("deal#comment", array("id" => $deal_info['id'])); //初始化与虚拟金额有所关联的几个比较特殊的数据 end if (!empty($deal_info['vedio']) && !preg_match("/http://player.youku.com/embed/i", $deal_info['source_video'])) { $deal_info['source_vedio'] = preg_replace("/id_(.*)\\.html(.*)/i", "http://player.youku.com/embed/\${1}", baseName($deal_info['vedio'])); $GLOBALS['db']->query("update " . DB_PREFIX . "deal set source_vedio='" . $deal_info['source_vedio'] . "' where id=" . $deal_info['id']); } $GLOBALS['tmpl']->assign("deal_info", $deal_info); $deal_item_list = $deal_info['deal_item_list']; //开启限购后剩余几位 foreach ($deal_item_list as $k => $v) { if ($v['limit_user'] > 0) { $deal_item_list[$k]['remain_person'] = $v['limit_user'] - $v['virtual_person'] - $v['support_count']; } } $GLOBALS['tmpl']->assign("deal_item_list", $deal_item_list); if ($GLOBALS['user_info']) { $is_focus = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_focus_log where deal_id = " . $deal_info['id'] . " and user_id = " . intval($GLOBALS['user_info']['id'])); $GLOBALS['tmpl']->assign("is_focus", $is_focus); } }
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 msg_investor_go_pay($type, $invest_id, $order_id = '') { $user_info = $GLOBALS['db']->getRow("select invest.id as invest_id,invest.user_id,invest.money,u.user_name,u.mobile,u.email,d.pay_end_time,d.name as deal_name from " . DB_PREFIX . "investment_list as invest " . "left join " . DB_PREFIX . "user as u on u.id=invest.user_id " . "left join " . DB_PREFIX . "deal as d on d.id=invest.deal_id" . " where invest.id={$invest_id} and invest.send_type=0 "); $user_info['money'] = number_price_format($user_info['money']); $user_info['pay_end_time'] = to_date($user_info['pay_end_time'], "Y-m-d"); if ($type == 'email' && $user_info) { //邮件通知 if (!empty($user_info['email'])) { if ($order_id) { $user_info['note_url'] = get_domain() . url("account#view_order", array('id' => $order_id)); $info_url = "account#view_order"; $info_param = "id=" . $order_id; } else { $user_info['note_url'] = get_domain() . url("account#index"); $info_url = "account#index"; $info_param = ""; } $this->user_info = $user_info; $msg_data['title'] = app_conf("SITE_NAME") . "付款通知-" . $user_info['deal_name']; $msg_data['dest'] = $user_info['email']; $msg_data['user_id'] = $user_info['user_id']; $msg_data['is_html'] = 1; $msg_data['send_type'] = 1; $this->msg_reply('email', 'TPL_MAIL_INVESTOR_PAY_STATUS', $msg_data); $GLOBALS['db']->query("update " . DB_PREFIX . "investment_list set send_type=1 where id=" . $user_info['invest_id']); $this->msg_notify($dest, $info, $info_url, $info_param); } } elseif ($type == 'sms' && $user_info && app_conf("INVEST_STATUS_SEND_STATUS") == 2) { if (!empty($user_info['mobile'])) { if ($order_id) { $info_url = "account#view_order"; $info_param = "id=" . $order_id; } else { $info_url = "account#index"; $info_param = ""; } $this->user_info = $user_info; $msg_data['title'] = "短信付款通知-" . $user_info['deal_name']; $msg_data['dest'] = $user_info['mobile']; $msg_data['user_id'] = $user_info['user_id']; $msg_data['is_html'] = 0; $msg_data['send_type'] = 0; $this->msg_reply('sms', 'TPL_SMS_INVESTOR_PAY_STATUS', $msg_data); $GLOBALS['db']->query("update " . DB_PREFIX . "investment_list set send_type=1 where id=" . $user_info['invest_id']); $this->msg_notify($dest, $info, $info_url, $info_param); } } }
public function index() { if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } //(普通众筹)支持之前需要用户绑定手机号 if (!$GLOBALS['user_info']['mobile']) { app_redirect(url_wap("user#user_bind_mobile", array("cid" => intval($_REQUEST['id'])))); } $GLOBALS['tmpl']->assign("user_info", $GLOBALS['user_info']); $id = intval($_REQUEST['id']); $iDI = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "iqianjin_deal_item where deal_item_id = " . $id); if ($iDI) { //检测爱钱进红包购买情况 $iWL = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "iqianjin_winner where user_id = " . $GLOBALS['user_info']['id']); if ($iWL) { showErr("您已中奖!获得了爱钱进普通红包,请您到爱钱进领取。", 0, url_wap("index")); } $iB2L = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "iqianjin_buy where type=2 and user_id = " . $GLOBALS['user_info']['id']); if ($iB2L) { if ($iDI['type'] == 2) { showErr("您已经购买了本红包,请您到爱钱进领取。", 0, url_wap("index")); } } $iBL = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "iqianjin_buy where type=1 and deal_item_id=" . $id . " and user_id = " . $GLOBALS['user_info']['id']); if ($iBL) { showErr("您今天已经购买了本红包,请明天12:00再来支持。", 0, url_wap("index")); } } $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); if (!$deal_item) { app_redirect(url_wap("index")); } elseif ($deal_item['support_count'] + $deal_item['virtual_person'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) { app_redirect(url_wap("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']); $deal_info = cache_deal_extra($deal_info); init_deal_page_wap($deal_info); if (!$deal_info) { app_redirect(url_wap("index")); } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } $deal_item['consigee_url'] = url_wap("settings#add_consignee"); $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'] = $deal_item['price'] + $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)); $GLOBALS['tmpl']->assign("deal_item", $deal_item); if ($deal_item['is_delivery']) { $consignee_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_consignee where user_id = " . intval($GLOBALS['user_info']['id'])); if ($consignee_list) { $GLOBALS['tmpl']->assign("consignee_list", $consignee_list); } else { $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc"); //二级地址 $GLOBALS['tmpl']->assign("region_lv2", $region_lv2); } } $payment_list = get_payment_list("wap"); $GLOBALS['tmpl']->assign("payment_list", $payment_list); $GLOBALS['tmpl']->display("cart_index.html"); }