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"); }
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"); }
public function update() { $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']); if (!$deal_info) { app_redirect(url_wap("index")); } $deal_info = cache_deal_extra($deal_info); init_deal_page_wap($deal_info); $page_size = 15; $step_size = 5; $step = intval($_REQUEST['step']); if ($step == 0) { $step = 1; } $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size; $GLOBALS['tmpl']->assign("current_page", $page); $log_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_log where deal_id = " . $deal_info['id'] . " order by create_time desc limit " . $limit); $log_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_log where deal_id = " . $deal_info['id']); if (!$log_list || ($page - 1) * $page_size + ($step - 1) * $step_size + count($log_list) >= $log_count) { //最后一页 $log_list[] = array("deal_id" => $deal_info['id'], "create_time" => $deal_info['begin_time'] + 1, "id" => 0); } $last_time_key = ""; foreach ($log_list as $k => $v) { $log_list[$k]['pass_time'] = pass_date($v['create_time']); $online_time = online_date($v['create_time'], $deal_info['begin_time']); $log_list[$k]['online_time'] = $online_time['info']; if ($online_time['key'] != $last_time_key) { $last_time_key = $log_list[$k]['online_time_key'] = $online_time['key']; } $log_list[$k] = cache_log_comment($log_list[$k]); } $GLOBALS['tmpl']->assign("log_list", $log_list); require APP_ROOT_PATH . 'wap/app/page.php'; $page = new Page($log_count, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->display("deal_update.html"); }
public function plans() { $id = intval($_REQUEST['id']); $deal_info = $GLOBALS['db']->getRow("select d.*,dl.level as deal_level,dc.name as deal_type from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_level as dl on dl.id=d.user_level left join " . DB_PREFIX . "deal_cate as dc on dc.id=d.cate_id where d.id = " . $id . " and d.is_delete = 0 and (d.is_effect = 1 or (d.is_effect = 0 and d.user_id = " . intval($GLOBALS['user_info']['id']) . "))"); $deal_info = cache_deal_extra($deal_info); if ($deal_info['type'] == 1) { $this->init_deal_page(@$deal_info); } else { init_deal_page_wap(@$deal_info); } if ($deal_info['type'] == 1) { set_deal_status($deal_info); $GLOBALS['tmpl']->assign("id", $id); $user_name = $GLOBALS['user_info']['user_name']; $GLOBALS['tmpl']->assign("user_name", $user_name); $deal_info['business_create_time'] = to_date($deal_info['business_create_time'], 'Y-m-d'); $cate = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id =" . $deal_info['cate_id']); $GLOBALS['tmpl']->assign("cate", $cate); //未来三年内计划 $plan_list = unserialize($deal_info['plan']); $GLOBALS['tmpl']->assign("plan_list", $plan_list); $total_plan_income = 0; $total_plan_out = 0; $total_plan = 0; foreach ($plan_list as $key => $v) { $total_plan_income += intval($v["info"]["item_income"]); $total_plan_out += intval($v["info"]["item_out"]); $total_plan = $total_plan_income - $total_plan_out; } $GLOBALS['tmpl']->assign("total_plan_income", $total_plan_income); $GLOBALS['tmpl']->assign("total_plan_out", $total_plan_out); $GLOBALS['tmpl']->assign("total_plan", $total_plan); $GLOBALS['tmpl']->assign('now', NOW_TIME); $GLOBALS['tmpl']->assign("deal_item", $deal_info); $GLOBALS['tmpl']->display("investor_plans_mapi.html"); } }