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);
 }
示例#2
0
 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()
 {
     $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 = " . intval($GLOBALS['user_info']['id']) . "))");
     if (!$deal_info) {
         app_redirect(url("index"));
     }
     $deal_info = cache_deal_extra($deal_info);
     init_deal_page($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;
     $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']);
     $url = url_wap("deal#show", array("id" => $id));
     $root['url'] = $url;
     $last_time_key = "";
     foreach ($log_list as $k => $v) {
         $log_list[$k]['image'] = get_user_avatar_root($v["user_id"], "middle");
         //用户头像
         //$log_list[$k]['image'] = get_abs_img_root(get_spec_image($v['image'],640,240,1));
         $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'];
         $log_list[$k]['comment_data_cache'] = null;
         $log_list[$k]['deal_info_cache'] = null;
         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]);
     }
     $root['log_list'] = $log_list;
     //	require APP_ROOT_PATH.'app/Lib/page.php';
     //	$page = new Page($log_count,$page_size);   //初始化分页对象
     //	$p  =  $page->show();
     //	$root['pages'] = $p;
     $root['page'] = array("page" => $page, "page_total" => ceil($log_count / $page_size), "page_size" => intval($page_size), 'total' => intval($log_count));
     output($root);
 }
 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);
     init_deal_page($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;
     $comment_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where deal_id = " . $id . " and log_id = 0 order by create_time desc limit " . $limit);
     // $comment_list = $GLOBALS['db']->getAll("select * from
     // ".DB_PREFIX."deal_comment where deal_id = ".$id." and log_id = 0
     // order by create_time desc ");
     $comment_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where deal_id = " . $id . " and log_id = 0");
     foreach ($comment_list as $k => $v) {
         $comment_list[$k]['create_time'] = to_date($v['create_time'], 'Y-m-d');
         $comment_list[$k]["image"] = get_user_avatar_root($v["user_id"], "middle");
         $comment_list[$k]["url"] = url_root("home", array("id" => $v["user_id"]));
     }
     $root['comment_list'] = $comment_list;
     $root['comment_count'] = $comment_count;
     // require APP_ROOT_PATH.'app/Lib/page.php';
     // $page = new Page($comment_count,$page_size); //初始化分页对象
     // $p = $page->show();
     // $root['pages'] = $p;
     $root['page'] = array("page" => $page, "page_total" => ceil($comment_count / $page_size), "page_size" => intval($page_size), 'total' => intval($comment_count));
     output($root);
 }
 public function index()
 {
     $root = array();
     $root['response_code'] = 1;
     $id = intval($_REQUEST['id']);
     $update_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_log where id = " . $id);
     $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . intval($update_info['deal_id']) . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . "))");
     if (!$deal_info) {
         app_redirect(url("index"));
     }
     $deal_info = cache_deal_extra($deal_info);
     init_deal_page($deal_info);
     $log_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_log where id = " . $id);
     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]['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " and deal_id = " . $deal_info['id']);
         $page_size = $GLOBALS['m_config']['page_size'];
         $page = intval($_REQUEST['p']);
         if ($page == 0) {
             $page = 1;
         }
         $limit = ($page - 1) * $page_size . "," . $page_size;
         $log_list[$k]['comment_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " and deal_id = " . $deal_info['id'] . " order by create_time desc limit " . $limit);
         //	require APP_ROOT_PATH.'app/Lib/page.php';
         //	$page = new Page($log_list[$k]['comment_count'],$page_size);   //初始化分页对象
         //	$p  =  $page->show();
         //	$GLOBALS['tmpl']->assign('pages',$p);
         $root['page'] = array("page" => $page, "page_total" => ceil($log_list[$k]['comment_count'] / $page_size), "page_size" => intval($page_size), 'total' => intval($log_list[$k]['comment_count']));
     }
     $root['log_list'] = $log_list;
     output($root);
 }
 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);
 }
示例#7
0
 public function project_follow()
 {
     //获取项目的ID
     $id = intval($_REQUEST['deal_id']);
     $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and is_effect = 1");
     $deal_info['deal_type'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id=" . $deal_info['cate_id']);
     $deal_info = cache_deal_extra($deal_info);
     //		$comment_count = $GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."deal_comment where deal_id = ".$id." and log_id = 0 and status=1");
     //		$GLOBALS['tmpl']->assign('comment_count',$comment_count);
     $this->init_deal_page(@$deal_info);
     set_deal_status($deal_info);
     //股权众筹
     $GLOBALS['tmpl']->assign("id", $id);
     $user_name = $GLOBALS['user_info']['user_name'];
     $GLOBALS['tmpl']->assign("user_name", $user_name);
     $cate = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id =" . $deal_info['cate_id']);
     $GLOBALS['tmpl']->assign("cate", $cate);
     //跟投、领投信息列表
     get_investor_info($id, 1);
     $GLOBALS['tmpl']->display("project_follow.html");
 }
 public function project_follow()
 {
     if (app_conf("INVEST_STATUS") == 1) {
         showErr("股权众筹已经关闭");
     }
     //get_mortgate();
     $access = get_level_access($GLOBALS['user_info'], $deal_info);
     $GLOBALS['tmpl']->assign("access", $access);
     //获取项目的ID
     $id = intval($_REQUEST['deal_id']);
     $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and is_effect = 1");
     $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']);
     $deal_info['user_icon'] = $GLOBALS['user_level'][$deal_info['user_level']]['icon'];
     $deal_info['is_investor'] = $GLOBALS['db']->getOne("select is_investor from " . DB_PREFIX . "user where id=" . $deal_info['user_id']);
     $deal_info = cache_deal_extra($deal_info);
     //		$comment_count = $GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."deal_comment where deal_id = ".$id." and log_id = 0 and status=1");
     //		$GLOBALS['tmpl']->assign('comment_count',$comment_count);
     $this->init_deal_page(@$deal_info);
     set_deal_status($deal_info);
     //股权众筹
     $GLOBALS['tmpl']->assign("id", $id);
     $user_name = $GLOBALS['user_info']['user_name'];
     $GLOBALS['tmpl']->assign("user_name", $user_name);
     $cate = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "deal_cate where id =" . $deal_info['cate_id']);
     $GLOBALS['tmpl']->assign("cate", $cate);
     //跟投、领投信息列表
     get_investor_info($id, 1);
     $GLOBALS['tmpl']->display("project_follow.html");
 }
 public function updatedetail()
 {
     $id = intval($_REQUEST['id']);
     $update_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_log where id = " . $id);
     $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . intval($update_info['deal_id']) . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . "))");
     if (!$deal_info) {
         app_redirect(url("index"));
     }
     $deal_info = cache_deal_extra($deal_info);
     init_deal_page($deal_info);
     $log_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_log where id = " . $id);
     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]['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " and deal_id = " . $deal_info['id']);
         $page_size = DEAL_COMMENT_PAGE_SIZE;
         $page = intval($_REQUEST['p']);
         if ($page == 0) {
             $page = 1;
         }
         $limit = ($page - 1) * $page_size . "," . $page_size;
         $log_list[$k]['comment_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_comment where log_id = " . $v['id'] . " and deal_id = " . $deal_info['id'] . " order by create_time desc limit " . $limit);
         require APP_ROOT_PATH . 'app/Lib/page.php';
         $page = new Page($log_list[$k]['comment_count'], $page_size);
         //初始化分页对象
         $p = $page->show();
         $GLOBALS['tmpl']->assign('pages', $p);
     }
     $GLOBALS['tmpl']->assign("log_list", $log_list);
     $GLOBALS['tmpl']->display("deal_updatedetail.html");
 }
示例#10
0
 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");
 }
示例#11
0
 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");
     }
 }
示例#12
0
 public function activity()
 {
     $access = get_level_access($GLOBALS['user_info'], $deal_info);
     $GLOBALS['tmpl']->assign("access", $access);
     $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']);
     $deal_info['user_icon'] = $GLOBALS['user_level'][$deal_info['user_level']]['icon'];
     $deal_info['is_investor'] = $GLOBALS['db']->getOne("select is_investor from " . DB_PREFIX . "user where id=" . $deal_info['user_id']);
     //权益交易相关参数
     //程超 2015-11-13
     $deal_info['deal_title'] = "【" . $deal_info['deal_code'] . "】" . $deal_info['name'];
     $deal_info["repaid_day"] = $GLOBALS['db']->getOne("select repaid_day from " . DB_PREFIX . "deal_item where deal_id = " . $deal_info["id"] . " limit 0,1");
     //$trade_begin_time = intval($deal_info["end_time"])+24*3600;
     $delivery_begin_time = intval($deal_info["trade_end_time"]) + intval($deal_info["repaid_day"]) * 24 * 3600;
     $GLOBALS['tmpl']->assign("trade_begin_time", to_date($deal_info["trade_begin_time"], "Y年m月d日H时i分"));
     $GLOBALS['tmpl']->assign("delivery_begin_time", to_date($delivery_begin_time, "Y年m月d日H时i分"));
     //添加结束
     $profit_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "profit where deal_id =" . $id);
     $ticket_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "ticket where deal_id =" . $id);
     $activity_count = $profit_count + $ticket_count;
     $GLOBALS['tmpl']->assign("activity_count", $activity_count);
     if (!$deal_info) {
         app_redirect(url("index"));
     }
     $deal_info = cache_deal_extra($deal_info);
     $this->init_deal_page($deal_info);
     $comment_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_comment where deal_id = " . $id . " and log_id = 0 and status=1");
     $GLOBALS['tmpl']->assign('comment_count', $comment_count);
     $id = intval($_REQUEST['id']);
     $ticket_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "ticket where deal_id=" . $id);
     $GLOBALS['tmpl']->assign("ticket_list", $ticket_list);
     $profit_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "profit where deal_id =" . $id);
     $GLOBALS['tmpl']->assign("profit_list", $profit_list);
     $GLOBALS['tmpl']->display("deal_activity.html");
 }