示例#1
0
 public function mine_investor_status()
 {
     if (!$GLOBALS['user_info']) {
         app_redirect(url_wap("user#login"));
     }
     $user_id = $GLOBALS['user_info']['id'];
     $type = intval($_REQUEST['type']);
     $page_size = ACCOUNT_PAGE_SIZE;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $investor_list = $GLOBALS['db']->getAll("select invest.*,d.end_time,d.pay_end_time,d.begin_time,d.name as deal_name ,d.image as deal_image,d.id as deal_id" . " from  " . DB_PREFIX . "investment_list as invest left join " . DB_PREFIX . "deal as d on d.id=invest.deal_id where  invest.type={$type} and invest.user_id={$user_id} order by invest.id desc limit {$limit} ");
     $investor_list_num = $GLOBALS['db']->getOne("select count(*) from  " . DB_PREFIX . "investment_list where  type={$type} and user_id={$user_id}  ");
     $now_time = NOW_TIME;
     if ($type == 0 || $type == 2 || $type == 1) {
         foreach ($investor_list as $k => $v) {
             if ($type == 1) {
                 if ($now_time > $v['end_time']) {
                     $investor_list[$k]['status'] = 2;
                     $GLOBALS['db']->query("UPDATE  " . DB_PREFIX . "investment_list set status=2 where id= " . $v['id']);
                 }
             }
             if ($v['investor_money_status'] == 0 && $now_time > $v['end_time']) {
                 $investor_list[$k]['investor_money_status'] = 2;
                 $GLOBALS['db']->query("UPDATE  " . DB_PREFIX . "investment_list set investor_money_status=2 where id= " . $v['id']);
             } elseif ($v['investor_money_status'] == 1 && $now_time > $v['pay_end_time']) {
                 $investor_list[$k]['investor_money_status'] = 4;
                 deal_invest_break($v['id']);
             }
         }
     }
     $title = '';
     switch ($type) {
         case 1:
             $title = '领投列表';
             break;
         case 2:
             $title = '跟投列表';
             break;
         case 0:
             $title = '询价列表';
             break;
     }
     $page = new Page($investor_list_num, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('type', $type);
     $GLOBALS['tmpl']->assign('title', $title);
     $GLOBALS['tmpl']->assign('investor_list', $investor_list);
     $GLOBALS['tmpl']->display("account_mine_investor.html");
 }
 public function get_investor_status()
 {
     if (!$GLOBALS['user_info']) {
         app_redirect(url("user#login"));
     }
     $parameter = array();
     $deal_id = $_REQUEST['id'];
     $type = intval($_REQUEST['type']);
     $user_name_i = strim($_REQUEST['user_name_i']);
     $money_status = intval($_REQUEST['money_status']);
     $more_search = intval($_REQUEST['more_search']);
     $begin_time = strim($_REQUEST['begin_time']);
     $end_time = strim($_REQUEST['end_time']);
     $GLOBALS['tmpl']->assign('user_name_i', $user_name_i);
     $GLOBALS['tmpl']->assign('money_status', $money_status);
     $GLOBALS['tmpl']->assign('more_search', $more_search);
     $GLOBALS['tmpl']->assign('end_time', $end_time);
     $GLOBALS['tmpl']->assign('begin_time', $begin_time);
     $GLOBALS['tmpl']->assign('deal_id', $deal_id);
     $parameter[] = "type=" . $type;
     if ($deal_id > 0) {
         $parameter[] = "id=" . $deal_id;
     }
     if ($money_status > 0) {
         $parameter[] = "money_status=" . $money_status;
     }
     if ($money_status > 0) {
         $parameter[] = "money_status=" . $money_status;
     }
     if ($end_time != '') {
         $parameter[] = "end_time=" . $end_time;
     }
     if ($begin_time != '') {
         $parameter[] = "begin_time=" . $begin_time;
     }
     $deal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id={$deal_id} and user_id=" . $GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign('deal', $deal);
     $page_size = ACCOUNT_PAGE_SIZE;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     if ($type == 1) {
         $condition = " and  invest.type=1 and invest.deal_id={$deal_id} and invest.money>0 and invest.status=1 ";
     } else {
         $condition = " and  invest.type={$type} and invest.deal_id={$deal_id} ";
     }
     if ($user_name_i != '') {
         $condition .= " and u.user_name like '%" . $user_name_i . "%' ";
     }
     if ($money_status > 0) {
         if ($money_status == 5) {
             $money_status = 0;
         }
         if ($money_status == 1) {
             $condition .= " and (invest.investor_money_status =1 or invest.investor_money_status >2)";
         } else {
             $condition .= " and invest.investor_money_status =" . $money_status . "";
         }
     }
     $begin_time_val = to_timespan($begin_time);
     $end_time_val = to_timespan($end_time);
     if ($begin_time != '' && $end_time != '') {
         $condition = " and invest.create_time >=" . $begin_time_val . " and invest.create_time <=" . $end_time_val . "";
     } elseif ($begin_time != '' && $end_time == '') {
         $condition = " and invest.create_time >= " . $begin_time_val . " ";
     } elseif ($begin_time == '' && $end_time != '') {
         $condition = "and invest.create_time <=" . $end_time_val . " ";
     }
     $investor_list = $GLOBALS['db']->getAll("select invest.*,u.user_name from  " . DB_PREFIX . "investment_list as invest left join " . DB_PREFIX . "user as u on invest.user_id=u.id where 1=1 {$condition} order by id desc limit {$limit} ");
     $investor_list_num = $GLOBALS['db']->getOne("select count( invest.id) from  " . DB_PREFIX . "investment_list as invest left join " . DB_PREFIX . "user as u on invest.user_id=u.id where 1=1 {$condition}  ");
     $now_time = NOW_TIME;
     if ($type == 0 || $type == 2 || $type == 1) {
         foreach ($investor_list as $k => $v) {
             if ($type == 1) {
                 if ($v['status'] == 0 && $now_time > $deal['end_time']) {
                     $investor_list[$k]['status'] = 2;
                     $GLOBALS['db']->query("UPDATE  " . DB_PREFIX . "investment_list set status=2 where id= " . $v['id']);
                 }
             }
             if ($v['investor_money_status'] == 0 && $now_time > $deal['end_time']) {
                 $investor_list[$k]['investor_money_status'] = 2;
                 $GLOBALS['db']->query("UPDATE  " . DB_PREFIX . "investment_list set investor_money_status=2 where id= " . $v['id']);
             } elseif ($v['investor_money_status'] == 1 && $now_time > $deal['pay_end_time']) {
                 $investor_list[$k]['investor_money_status'] = 4;
                 deal_invest_break($v['id']);
             }
         }
     }
     $title = '';
     switch ($type) {
         case 1:
             $title = '领投列表';
             break;
         case 2:
             $title = '跟投列表';
             break;
         case 0:
             $title = '询价列表';
             break;
     }
     $parameter_str = "&" . implode("&", $parameter);
     $page = new Page($investor_list_num, $page_size, $parameter_str);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('type', $type);
     $GLOBALS['tmpl']->assign('deal_id', $deal_id);
     $GLOBALS['tmpl']->assign('title', $title);
     $GLOBALS['tmpl']->assign('investor_list', $investor_list);
     $GLOBALS['tmpl']->display("account_investor_list.html");
 }
 public function get_investor_status()
 {
     if (!$GLOBALS['user_info']) {
         app_redirect(url_wap("user#login"));
     }
     $parameter = array();
     $deal_id = $_REQUEST['id'];
     $type = intval($_REQUEST['type']);
     $GLOBALS['tmpl']->assign('deal_id', $deal_id);
     $deal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id={$deal_id} and user_id=" . $GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign('deal', $deal);
     $page_size = ACCOUNT_PAGE_SIZE;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     if ($type == 1) {
         $condition = " and  invest.type=1 and invest.deal_id={$deal_id} and invest.money>0 and invest.status=1 ";
     } else {
         $condition = " and  invest.type={$type} and invest.deal_id={$deal_id} ";
     }
     $investor_list = $GLOBALS['db']->getAll("select invest.*,u.user_name from  " . DB_PREFIX . "investment_list as invest left join " . DB_PREFIX . "user as u on invest.user_id=u.id where 1=1 {$condition} order by id desc limit {$limit} ");
     $investor_list_num = $GLOBALS['db']->getOne("select count( invest.id) from  " . DB_PREFIX . "investment_list as invest left join " . DB_PREFIX . "user as u on invest.user_id=u.id where 1=1 {$condition}  ");
     $now_time = NOW_TIME;
     if ($type == 0 || $type == 2 || $type == 1) {
         foreach ($investor_list as $k => $v) {
             if ($type == 1) {
                 if ($v['status'] == 0 && $now_time > $deal['end_time']) {
                     $investor_list[$k]['status'] = 2;
                     $GLOBALS['db']->query("UPDATE  " . DB_PREFIX . "investment_list set status=2 where id= " . $v['id']);
                 }
             }
             if ($v['investor_money_status'] == 0 && $now_time > $deal['end_time']) {
                 $investor_list[$k]['investor_money_status'] = 2;
                 $GLOBALS['db']->query("UPDATE  " . DB_PREFIX . "investment_list set investor_money_status=2 where id= " . $v['id']);
             } elseif ($v['investor_money_status'] == 1 && $now_time > $deal['pay_end_time']) {
                 $investor_list[$k]['investor_money_status'] = 4;
                 deal_invest_break($v['id']);
             }
         }
     }
     $title = '';
     switch ($type) {
         case 1:
             $title = '领投列表';
             break;
         case 2:
             $title = '跟投列表';
             break;
         case 0:
             $title = '询价列表';
             break;
     }
     $parameter_str = "&" . implode("&", $parameter);
     $page = new Page($investor_list_num, $page_size, $parameter_str);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign('type', $type);
     $GLOBALS['tmpl']->assign('deal_id', $deal_id);
     $GLOBALS['tmpl']->assign('title', $title);
     $GLOBALS['tmpl']->assign('investor_list', $investor_list);
     $GLOBALS['tmpl']->assign("page_title", "申请列表");
     $GLOBALS['tmpl']->display("account_investor_list.html");
 }