public function show()
 {
     //获取项目的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']);
     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);
     init_deal_page($deal_info);
     $GLOBALS['tmpl']->display("deal_show.html");
 }
Example #2
0
 public function show()
 {
     $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']) . "))");
     if (!$deal_info) {
         app_redirect(url("index"));
     }
     if ($deal_info['is_effect'] == 1) {
         log_deal_visit($deal_info['id']);
     }
     if ($deal_info['is_effect'] == 1) {
         $deal_faq_list = $GLOBALS['db']->getAllCached("select * from " . DB_PREFIX . "deal_faq where deal_id = " . $deal_info['id'] . " order by sort asc");
     } else {
         $deal_faq_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_faq where deal_id = " . $deal_info['id'] . " order by sort asc");
     }
     $GLOBALS['tmpl']->assign("deal_faq_list", $deal_faq_list);
     init_deal_page($deal_info);
     $GLOBALS['tmpl']->display("deal_show.html");
 }
 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 info()
 {
     //获取项目的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']);
     if (!$deal_info) {
         app_redirect(url_wap("index"));
     }
     if ($deal_info['is_effect'] == 1) {
         log_deal_visit($deal_info['id']);
     }
     $deal_info = cache_deal_extra($deal_info);
     init_deal_page($deal_info);
     $GLOBALS['tmpl']->assign("deal_index_url", url_wap("deal#index", array("id" => $id)));
     $GLOBALS['tmpl']->assign("usermessage_url", url_wap("ajax#usermessage", array("id" => $deal_info['user_id'])));
     $GLOBALS['tmpl']->assign("home_url", url_wap("deal#home", array("id" => $deal_info['user_id'])));
     $GLOBALS['tmpl']->assign("deal_info", $deal_info);
     $GLOBALS['tmpl']->display("deal_info.html");
 }
 public function show()
 {
     //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']) . "))");
     $access = get_level_access($GLOBALS['user_info'], $deal_info);
     $GLOBALS['tmpl']->assign("access", $access);
     $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']);
     if (!$deal_info) {
         app_redirect(url("index"));
     }
     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);
     $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);
     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');
     }
     if ($deal_info['type'] == 1) {
         if (app_conf("INVEST_STATUS") == 1) {
             showErr("股权众筹已经关闭");
         }
         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);
         //编辑及管理团队
         $stock_list = unserialize($deal_info['stock']);
         $GLOBALS['tmpl']->assign("stock_list", $stock_list);
         $unstock_list = unserialize($deal_info['unstock']);
         $GLOBALS['tmpl']->assign("unstock_list", $unstock_list);
         //项目历史执行资料
         $history_list = unserialize($deal_info['history']);
         $GLOBALS['tmpl']->assign("history_list", $history_list);
         $total_history_income = 0;
         $total_history_out = 0;
         $total_history = 0;
         foreach ($history_list as $key => $v) {
             $total_history_income += floatval($v["info"]["item_income"]);
             $total_history_out += floatval($v["info"]["item_out"]);
             $total_history = $total_history_income - $total_history_out;
         }
         $GLOBALS['tmpl']->assign("total_history_income", $total_history_income);
         $GLOBALS['tmpl']->assign("total_history_out", $total_history_out);
         $GLOBALS['tmpl']->assign("total_history", $total_history);
         //未来三年内计划
         $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 += floatval($v["info"]["item_income"]);
             $total_plan_out += floatval($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);
         //项目附件
         $attach_list = unserialize($deal_info['attach']);
         $GLOBALS['tmpl']->assign("attach_list", $attach_list);
         //资质证明
         $audit_data_list = unserialize($deal_info['audit_data']);
         $GLOBALS['tmpl']->assign("audit_data_list", $audit_data_list);
         //跟投、领投信息列表
         get_investor_info($id);
         //var_dump($deal_info);
         $GLOBALS['tmpl']->assign("deal_item", $deal_info);
         //热门的项目
         $deal_hot_result = get_deal_list($limit, 'is_hot=1', 'support_count desc');
         $GLOBALS['tmpl']->assign("deal_hot_list", $deal_hot_result['list']);
         $GLOBALS['tmpl']->display("deal_investor_show.html");
     } else {
         //普通众筹
         $GLOBALS['tmpl']->display("deal_show.html");
     }
 }
Example #6
0
 public function show()
 {
     //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']) . "))");
     if (!$deal_info) {
         app_redirect(url("index"));
     }
     $access = get_level_access($GLOBALS['user_info'], $deal_info);
     $GLOBALS['tmpl']->assign("access", $access);
     $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"]);
     $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分"));
     //添加结束
     /*$buy_right_number = 0;
      		if($deal_info['type']==3||$deal_info['type']==4){//企业众筹和币创投
      			$rights = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."user_right where deal_id = ".$deal_info["id"]." and user_id = ".intval($GLOBALS['user_info']['id'])."");
      			if(count($rights)>0){ 
      				foreach ($rights as $k=>$v){
      					$buy_right_number += $v["right_amount"] + $v["frozen_right_amount"];
     
      				}
      			}  
      		}*/
     $buy_right_number = get_zc_right_number($deal_info["id"], intval($GLOBALS['user_info']['id']));
     $deal_info["zc_amount_limit"] = intval($deal_info["zc_amount_limit"]);
     $GLOBALS['tmpl']->assign("buy_right_number", intval($buy_right_number));
     $GLOBALS['tmpl']->assign("can_buy_right_number", intval($deal_info["zc_amount_limit"] - $buy_right_number));
     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);
     //获取正在进行的活动(收益活动,赠金券活动)   后期必须加入状态
     $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);
     $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);
     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');
     }
     if ($deal_info['type'] == 1) {
         if (app_conf("INVEST_STATUS") == 1) {
             showErr("股权众筹已经关闭");
         }
         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);
         //编辑及管理团队
         $stock_list = unserialize($deal_info['stock']);
         $GLOBALS['tmpl']->assign("stock_list", $stock_list);
         $unstock_list = unserialize($deal_info['unstock']);
         $GLOBALS['tmpl']->assign("unstock_list", $unstock_list);
         //项目历史执行资料
         $history_list = unserialize($deal_info['history']);
         $GLOBALS['tmpl']->assign("history_list", $history_list);
         $total_history_income = 0;
         $total_history_out = 0;
         $total_history = 0;
         foreach ($history_list as $key => $v) {
             $total_history_income += floatval($v["info"]["item_income"]);
             $total_history_out += floatval($v["info"]["item_out"]);
             $total_history = $total_history_income - $total_history_out;
         }
         $GLOBALS['tmpl']->assign("total_history_income", $total_history_income);
         $GLOBALS['tmpl']->assign("total_history_out", $total_history_out);
         $GLOBALS['tmpl']->assign("total_history", $total_history);
         //未来三年内计划
         $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 += floatval($v["info"]["item_income"]);
             $total_plan_out += floatval($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);
         //项目附件
         $attach_list = unserialize($deal_info['attach']);
         $GLOBALS['tmpl']->assign("attach_list", $attach_list);
         //资质证明
         $audit_data_list = unserialize($deal_info['audit_data']);
         $GLOBALS['tmpl']->assign("audit_data_list", $audit_data_list);
         //跟投、领投信息列表
         get_investor_info($id);
         //var_dump($deal_info);
         $GLOBALS['tmpl']->assign("deal_item", $deal_info);
         //热门的项目
         $deal_hot_result = get_deal_list($limit, 'is_hot=1', 'support_count desc');
         $GLOBALS['tmpl']->assign("deal_hot_list", $deal_hot_result['list']);
         $GLOBALS['tmpl']->display("deal_investor_show.html");
     } else {
         //普通众筹
         $GLOBALS['tmpl']->display("deal_show.html");
     }
 }
Example #7
0
 public function show()
 {
     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);
     $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=deal&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=deal&act=show&id=' . $id . '&p=' . $i . '" class="last">' . $i . '</a></li>';
     }
     if ($p < $allPNum) {
         $page .= '<li><a href="/index.php?ctl=deal&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');
     }
     if ($deal_info['type'] == 1) {
         if (app_conf("INVEST_STATUS") == 1) {
             showErr("股权众筹已经关闭");
         }
         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);
         //编辑及管理团队
         $stock_list = unserialize($deal_info['stock']);
         $GLOBALS['tmpl']->assign("stock_list", $stock_list);
         $unstock_list = unserialize($deal_info['unstock']);
         $GLOBALS['tmpl']->assign("unstock_list", $unstock_list);
         //项目历史执行资料
         $history_list = unserialize($deal_info['history']);
         $GLOBALS['tmpl']->assign("history_list", $history_list);
         $total_history_income = 0;
         $total_history_out = 0;
         $total_history = 0;
         foreach ($history_list as $key => $v) {
             $total_history_income += intval($v["info"]["item_income"]);
             $total_history_out += intval($v["info"]["item_out"]);
             $total_history = $total_history_income - $total_history_out;
         }
         $GLOBALS['tmpl']->assign("total_history_income", $total_history_income);
         $GLOBALS['tmpl']->assign("total_history_out", $total_history_out);
         $GLOBALS['tmpl']->assign("total_history", $total_history);
         //未来三年内计划
         $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);
         //项目附件
         $attach_list = unserialize($deal_info['attach']);
         $GLOBALS['tmpl']->assign("attach_list", $attach_list);
         //资质证明
         $audit_data_list = unserialize($deal_info['audit_data']);
         $GLOBALS['tmpl']->assign("audit_data_list", $audit_data_list);
         //跟投、领投信息列表
         get_investor_info($id);
         //var_dump($deal_info);
         $GLOBALS['tmpl']->assign("deal_item", $deal_info);
         $GLOBALS['tmpl']->display("deal_investor_show.html");
     } else {
         //普通众筹
         $GLOBALS['tmpl']->display("deal_show.html");
     }
 }
Example #8
0
 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");
 }