Example #1
0
 public function get()
 {
     $key_word = check_empty($this->input->get('keyword'), '');
     $city_id = input_int($this->input->cookie('cityid'), 100000, FALSE, '530700');
     //默认丽江
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 1, 20, 10);
     $category = input_int($this->input->get('cid'), 0, FALSE, 0);
     $category_id = input_int($this->input->get('ccid'), 0, FALSE, 0);
     $dest_id = input_int($this->input->get('dest'), 0, FALSE, 0);
     $local_id = input_int($this->input->get('local'), 0, FALSE, 0);
     $sort = input_string($this->input->get('sort'), array('time', 'local', 'highp', 'lowp'), 'time');
     $today = input_int($this->input->get('today'), 0, 2, 0);
     $order_by = array('time' => 'update_time DESC', 'local' => 'local', 'highp' => 'bought_count DESC', 'lowp' => 'price ASC');
     $type = input_string($this->input->get('type'), array('item', 'inn'), 'item');
     $search = array('category' => $category, 'category_id' => $category_id, 'city_id' => $city_id, 'local_id' => $local_id, 'dest_id' => $dest_id, 'state' => 'T', 'today' => $today, 'type' => $type, 'key_word' => $key_word);
     if ($order_by[$sort] == 'local') {
         $search['lat'] = $this->get_current_data('lat');
         $search['lon'] = $this->get_current_data('lon');
     }
     if ($type == 'item') {
         $data = $this->model->get_products($search, $order_by[$sort], build_limit($page, $perpage));
     } else {
         $data = $this->model->get_inns($search, $order_by[$sort], build_limit($page, $perpage));
     }
     response_row($data);
 }
Example #2
0
 /**
  * 查看所有的提现记录
  */
 public function cashout()
 {
     $this->moduleTag = 'cashout';
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 1, 500, 20);
     $state = $this->input->get("state") ? $this->input->get("state") : 'applying';
     $data = $this->finance_model->search_cash_apply_by_state(build_limit($page, $perpage), $state);
     $userinfo = array();
     if ($data['data']) {
         $user_ids = array();
         foreach ($data['data'] as $key => $row) {
             $user_ids[$row['apply_user_id']] = $row['apply_user_id'];
             $user_ids[$row['cashier_id']] = $row['cashier_id'];
         }
         if (isset($user_ids['0'])) {
             unset($user_ids['0']);
         }
         if ($user_ids) {
             $user_ids = $this->model->get_user_info_in_ids(implode(',', $user_ids), 'ui.user_id,ui.real_name', FALSE, TRUE);
             foreach ($user_ids as $key => $row) {
                 $userinfo[$row['user_id']]['real_name'] = $row['real_name'] ? $row['real_name'] : $row['user_name'];
             }
         }
         $userinfo['0']['real_name'] = '系统';
     }
     $pageInfo = array('total' => $data['total'], 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $data['total'] / $perpage, 'url' => makePageUrl($page));
     $this->viewData = array('state' => $state, 'users' => $userinfo, 'data' => $data['data'], 'pageInfo' => $pageInfo);
 }
Example #3
0
 /**
  * 得到店铺内商品
  * @param SQLchar $type IN格式
  * @param int $inn_id
  * @return array
  */
 public function get_products($search, $order_by = 'update_time DESC', $page, $per_page)
 {
     $select = "SELECT p.*,i.inn_name,d.dest_name,l.local_name FROM ";
     $selectfrom = 'products as p JOIN inns as i ON p.inn_id = i.inn_id ';
     $selectjoin = 'LEFT JOIN china_dest as d ON d.dest_id = i.dest_id ';
     $selectjoin .= 'LEFT JOIN china_dest_local as l ON l.local_id = i.local_id ';
     $orderby = 'ORDER BY p.' . $order_by;
     if ($search['state']) {
         $where = 'WHERE p.state = ' . $search['state'] . ' ';
     } else {
         $where = 'WHERE p.state != "D" ';
     }
     switch ($search['key']) {
         case 'inn':
             if ($search['key_id']) {
                 $where .= ' AND p.inn_id = ' . $search['key_id'] . ' ';
             }
             break;
         case 'local':
             if ($search['key_id']) {
                 $where .= ' AND i.local_id = ' . $search['key_id'] . ' ';
                 $where .= ' AND i.is_qieyou = 0 ';
             }
             break;
         case 'dest':
             if ($search['key_id']) {
                 $where .= ' AND i.dest_id = ' . $search['key_id'] . ' ';
                 $where .= ' AND i.is_qieyou = 0 ';
             }
             break;
         case 'qieyou':
             if ($search['key_id']) {
                 $where .= ' AND p.inn_id = ' . $search['key_id'] . ' ';
             }
             $select = "SELECT p.*,i.inn_name FROM ";
             $selectfrom = 'products as p LEFT JOIN inns as i ON p.inn_id = i.inn_id ';
             $selectjoin = '';
             break;
         default:
             $where .= ' AND i.is_qieyou = 0 ';
             break;
     }
     if ($search['cid']) {
         $where .= ' AND p.category = ' . $search['cid'] . ' ';
     }
     if ($search['keyword'] != "") {
         $where .= " AND p.product_name LIKE '%" . $search['keyword'] . "%'";
     }
     $totalsql = $selectfrom . $where;
     $total = $this->get_query_count($totalsql);
     $orders = array();
     if ($total && $total > ($page - 1) * $per_page) {
         $limit = build_limit($page, $per_page);
         $sql = $select . $selectfrom . $selectjoin . $where . $orderby . $limit;
         $orders = $this->db->query($sql)->result_array();
     }
     return array('total' => $total, 'list' => $orders);
 }
Example #4
0
 public function use_coupon($search, $page, $per_page)
 {
     $select = "SELECT q.*,i.user_name,c.quan_name FROM ";
     $selectfrom = ' user_quan as q LEFT JOIN user_info as i ON q.user_id = i.user_id';
     $selectjoin = ' LEFT JOIN cash_coupon as c ON q.quan_id = c.quan_id';
     $where = " WHERE q.overdue=1 AND q.use_time<>0";
     if ($search['starttime']) {
         $where .= ' AND q.use_time > ' . $search['starttime'];
     }
     if ($search['endtime']) {
         $where .= ' AND q.use_time < ' . $search['endtime'];
     }
     $totalsql = $selectfrom . $where;
     $total = $this->get_query_count($totalsql);
     $list = array();
     if ($total && $total > ($page - 1) * $per_page) {
         $limit = build_limit($page, $per_page);
         $sql = $select . $selectfrom . $selectjoin . $where . " order by q.use_time DESC" . $limit;
         $list = $this->db->query($sql)->result_array();
     }
     return array('total' => $total, 'list' => $list);
 }
Example #5
0
 public function get_user_feedback($search, $page, $per_page)
 {
     $select = "SELECT q.*,i.user_name FROM ";
     $selectfrom = ' feedbacks as q LEFT JOIN user_info as i ON q.user_id = i.user_id';
     $selectjoin = ' ';
     $where = " where q.is_del=0 ";
     if ($search['starttime']) {
         $where .= ' AND q.create_time > ' . $search['starttime'];
     }
     if ($search['endtime']) {
         $where .= ' AND q.create_time < ' . $search['endtime'];
     }
     $totalsql = $selectfrom . $where;
     $total = $this->get_query_count($totalsql);
     $list = array();
     if ($total && $total > ($page - 1) * $per_page) {
         $limit = build_limit($page, $per_page);
         $sql = $select . $selectfrom . $selectjoin . $where . " order by create_time DESC" . $limit;
         $list = $this->db->query($sql)->result_array();
     }
     return array('total' => $total, 'list' => $list);
 }
Example #6
0
 public function get_config($class, $page, $perpage)
 {
     $select = '';
     $selectjoin = '';
     switch ($class) {
         case 'banner':
             $select = "SELECT r.* FROM ";
             $selectfrom = ' recommend_config as r ';
             break;
         case 'group':
             $select = "SELECT r.*,g.*,u.user_mobile FROM ";
             $selectfrom = ' recommend_config as r LEFT JOIN groups as g ON r.type_id = g.group_id';
             $selectjoin = ' LEFT JOIN users as u ON u.user_id = g.create_by';
             break;
         case 'product':
             $select = "SELECT r.*,g.*,i.inn_name,d.dest_name,l.local_name FROM ";
             $selectfrom = ' recommend_config as r LEFT JOIN products as g ON r.type_id = g.product_id';
             $selectjoin = ' LEFT JOIN inns as i ON g.inn_id = i.inn_id';
             $selectjoin .= ' LEFT JOIN china_dest as d ON d.dest_id = i.dest_id';
             $selectjoin .= ' LEFT JOIN china_dest_local as l ON l.local_id = i.local_id';
             break;
         case 'jianren':
             $select = "SELECT r.*,g.*,u.user_name FROM ";
             $selectfrom = ' recommend_config as r LEFT JOIN forum_jianren as g ON r.type_id = g.forum_id';
             $selectjoin = ' LEFT JOIN users as u ON g.create_user = u.user_id';
             break;
     }
     $where = " where r.is_delete=0 AND r.type ='" . $class . "'";
     $totalsql = $selectfrom . $where;
     $total = $this->get_query_count($totalsql);
     $list = array();
     if ($total && $total > ($page - 1) * $perpage) {
         $limit = build_limit($page, $perpage);
         $sql = $select . $selectfrom . $selectjoin . $where . " order by r.sort ASC" . $limit;
         $list = $this->db->query($sql)->result_array();
     }
     return array('total' => $total, 'list' => $list);
 }
Example #7
0
 /**
  * 团购入口
  */
 public function tuan()
 {
     $category = input_int($this->input->get('cid'), 0, FALSE, 0);
     $category_id = input_int($this->input->get('ccid'), 0, FALSE, 0);
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 1, 20, 10);
     $city_id = input_int($this->input->get('city'), 100000, FALSE, '530700');
     //默认丽江
     $dest_id = input_int($this->input->get('dest'), 0, FALSE, 0);
     $local_id = input_int($this->input->get('local'), 0, FALSE, 0);
     $key_word = input_empty($this->input->get('keyword'), '');
     $sort = input_string($this->input->get('sort'), array('time', 'local', 'highp', 'lowp'), 'time');
     $today = input_int($this->input->get('today'), 0, 2, 0);
     $order_by = array('time' => 'update_time DESC', 'local' => 'local', 'highp' => 'bought_count DESC', 'lowp' => 'price ASC');
     $search = array('category' => $category, 'category_id' => $category_id, 'city_id' => $city_id, 'local_id' => $local_id, 'dest_id' => $dest_id, 'state' => 'T', 'today' => $today, 'key_word' => $key_word);
     if ($order_by[$sort] == 'local') {
         $search['lat'] = $this->input->get('lat');
         $search['lon'] = $this->input->get('lon');
     }
     $products = $this->model->get_products($search, $order_by[$sort], build_limit($page, $perpage));
     response_data($products);
 }
Example #8
0
 public function searchKeyWord()
 {
     $keyword = check_empty(trimall(strip_tags($this->input->get('keyword', TRUE))), '');
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 1, 20, 10);
     $list = array();
     if (!$keyword) {
         response_row($list);
     }
     if ($page == 1) {
         $list['group'] = $this->model->search_group_name($keyword);
     }
     $limit = build_limit($page, $perpage);
     $search = array('keyword' => $keyword);
     $order_by = 'create_time DESC';
     $forum = $this->model->get_forum_list($search, $order_by, $limit);
     if ($forum) {
         $forum_detail = $this->model->get_forum_detail($forum);
         //获取列表所需数据  用户信息等
         foreach ($forum as $key => $row) {
             $row['create_time'] = showTime($row['create_time']);
             $list['forum'][] = array_merge($row, $forum_detail[$row['forum_id']]);
         }
     } else {
         $list['forum'] = array();
     }
     response_row($list);
 }
Example #9
0
 /**
  *
  * @param string $type
  * @param timestamp starttime
  * @param timestamp endtime
  * @return int
  */
 public function get_backend_users_by_param($search, $page, $per_page)
 {
     $starttime = $search['starttime'];
     $endtime = $search['endtime'];
     $type = $search['type'];
     $user_name = $search['user_name'];
     $nick_name = $search['nick_name'];
     $select = 'SELECT * FROM ';
     $where = 'where';
     $selectjoin = 'JOIN user_info as ui ON u.user_id = ui.user_id ';
     $where .= $starttime ? ' u.create_time >= ' . $starttime . ' ' : '';
     $where .= $endtime ? $where == 'where' ? ' u.create_time <= ' . ($endtime + 86399) . ' ' : ' AND u.create_time <= ' . ($endtime + 86399) . ' ' : '';
     if ($user_name) {
         if ($where == 'where') {
             $where .= " u.user_name = '" . $user_name . "'";
         } else {
             $where .= " AND u.user_name = '" . $user_name . "'";
         }
     }
     if ($type != 'all') {
         $where .= $where == 'where' ? ' u.role = "' . $type . '"' : ' AND ' . ' u.role = "' . $type . '"';
         if ($type == 'innholder') {
             $select = 'SELECT u.*,ui.*,i.inn_name,d.dest_name,l.local_name FROM ';
             $selectjoin .= ' LEFT JOIN inns as i ON i.innholder_id = u.user_id ';
             $selectjoin .= ' LEFT JOIN china_dest as d ON d.dest_id = i.dest_id ';
             $selectjoin .= ' LEFT JOIN china_dest_local as l ON l.local_id = i.local_id ';
         }
     }
     if ($where == 'where') {
         $where .= ' 1 ';
     }
     $selecttable = 'users as u ';
     $totalsql = $selecttable . $where;
     $total = $this->get_query_count($totalsql);
     $users = array();
     if ($total && $total > ($page - 1) * $per_page) {
         $limit = build_limit($page, $per_page);
         if ($nick_name) {
             if ($where == 'where') {
                 $where .= " ui.nick_name = '" . $nick_name . "'";
             } else {
                 $where .= " AND ui.nick_name = '" . $nick_name . "'";
             }
         }
         $sql = $select . $selecttable . $selectjoin . $where . ' ORDER BY u.create_time DESC ' . $limit;
         $users = $this->db->query($sql)->result_array();
     }
     return array('total' => $total, 'list' => $users);
 }
Example #10
0
 /**
  * 查看当前用户的提现记录
  */
 public function cashout()
 {
     $this->moduleTag = 'innsCashout';
     $inn_id = $this->model->getUserInnId();
     $page = $this->input->get('page') ? $this->input->get('page') : '1';
     $perpage = DEFAULT_PERPAGE;
     $data = $this->model->search_cash_apply_by_inns(build_limit($page, $perpage), $inn_id);
     $account = $this->inns_model->get_inns_account_balance($inn_id, true);
     $pageInfo = array('total' => $data['total'], 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $data['total'] / $perpage, 'url' => makePageUrl($page));
     $this->viewData = array('data' => $data['data'], 'account' => $account, 'totalAmout' => $data['totalAmount'], 'pageInfo' => $pageInfo);
 }
Example #11
0
 public function get_reply($search, $page, $perpage)
 {
     $select = "SELECT p.*,f.type,u.user_name,i.user_name as reply_username,g.group_name FROM ";
     $selectfrom = ' forum_post as p LEFT JOIN forums as f ON p.forum_id = f.forum_id';
     $selectjoin = ' LEFT JOIN user_info as u ON p.create_user = u.user_id  LEFT JOIN user_info as i ON p.reply_user = i.user_id LEFT JOIN groups as g ON f.group_id=g.group_id';
     $where = ' where p.is_delete = ' . $search['is_del'] . ' AND reply_pid=0';
     if ($search['starttime']) {
         $where .= ' AND p.create_time > ' . $search['starttime'];
     }
     if ($search['endtime']) {
         $where .= ' AND p.create_time < ' . $search['endtime'];
     }
     if ($search['class']) {
         if ($search['class'] != 'all') {
             $where .= " AND f.type='" . $search['class'] . "'";
         }
     }
     if ($search['keyword']) {
         $groups = $this->get_id_by_group_name($search['keyword']);
         if ($groups) {
             $where .= ' AND f.group_id = ' . $groups['group_id'];
         } else {
             $where .= ' AND 1!=1';
         }
     }
     $totalsql = $selectfrom . $where;
     $total = $this->get_query_count($totalsql);
     $list = array();
     if ($total && $total > ($page - 1) * $perpage) {
         $limit = build_limit($page, $perpage);
         $sql = $select . $selectfrom . $selectjoin . $where . " order by p.create_time DESC" . $limit;
         $list = $this->db->query($sql)->result_array();
     }
     return array('total' => $total, 'list' => $list);
 }
Example #12
0
 /**
  * 获取所有订单
  *
  * @param SQLChar $order_ids 用于查看所有订单的用户
  * @return int
  */
 public function get_orders($search, $page = 1, $per_page = 20, $search_keyword = false)
 {
     $select = "SELECT o.*,i.inn_name FROM ";
     $selectjoin = 'orders as o ';
     $selectjoin .= 'JOIN inns as i ON o.inn_id = i.inn_id ';
     $where = '';
     $orderby = 'ORDER BY o.create_time DESC';
     switch ($search['key']) {
         case 'inn':
             if ($search['key_id']) {
                 $where .= ' o.inn_id = ' . $search['key_id'];
             }
             break;
         case 'local':
             $where .= ' i.is_qieyou = 0';
             $where .= ' AND o.order_type = "normal"';
             if ($search['key_id']) {
                 $where .= ' AND i.local_id = ' . $search['key_id'];
             }
             break;
         case 'dest':
             $where .= ' i.is_qieyou = 0';
             $where .= ' AND o.order_type = "normal"';
             if ($search['key_id']) {
                 $where .= ' AND i.dest_id = ' . $search['key_id'];
             }
             break;
         case 'tuan':
             $where .= ' i.is_qieyou = 0';
             $where .= ' AND o.order_type = "tuan"';
             if ($search['key_id']) {
                 $where .= ' AND i.city_id = ' . $search['key_id'];
             } else {
                 if ($search['inn_id']) {
                     $where .= ' AND o.inn_id = ' . $search['key_id'];
                 }
             }
             break;
         case 'qieyou':
             if ($search['key_id']) {
                 $where .= ' i.inn_id = ' . $search['key_id'];
             }
             break;
         default:
             $where .= ' o.order_type = "normal"';
             break;
     }
     if ($search_keyword['keyword'] != "") {
         if ($search_keyword['key'] == '1') {
             $where .= " AND o.order_num LIKE '%" . $search_keyword['keyword'] . "%'";
         } elseif ($search_keyword['key'] == '2') {
             $where .= " AND o.telephone LIKE '%" . $search_keyword['keyword'] . "%'";
         }
     }
     if ($search['state']) {
         $where .= $where ? ' AND' : '';
         $where .= ' o.state = ' . $search['state'];
     }
     if ($search['st']) {
         $where .= $where ? ' AND' : '';
         $where .= ' o.create_time > ' . $search['st'];
     }
     if ($search['ed']) {
         $where .= $where ? ' AND' : '';
         $where .= ' o.create_time < ' . $search['ed'];
     }
     if ($search['cid']) {
         $selectjoin .= 'JOIN order_products as op ON op.category = ' . $search['cid'] . ' AND op.order_num = o.order_num ';
     }
     $where = $where ? 'WHERE' . $where . ' ' : 'WHERE 1 ';
     //防止db报错
     $totalsql = $selectjoin . $where;
     $total = $this->get_query_count($totalsql);
     $orders = array();
     if ($total && $total > ($page - 1) * $per_page) {
         $limit = build_limit($page, $per_page);
         $sql = $select . $selectjoin . $where . $orderby . $limit;
         $orders = $this->db->query($sql)->result_array();
     }
     return array('total' => $total, 'list' => $orders);
 }
Example #13
0
    }
} else {
    $order = $_REQUEST['order'];
    $order_by = '';
    if ($order == 'date') {
        $order_by = " ORDER BY releaseDate DESC";
    } else {
        if ($order == 'price') {
            $order_by = " ORDER BY formattedPrice DESC";
        } else {
            if ($order == 'rating') {
                $order_by = " ORDER BY averageUserRating DESC";
            }
        }
    }
    $sql = "SELECT * FROM {$app_tb} {$where} {$order_by} " . build_limit($page, $perpage);
    $mem_key = $app_tb . '_list_' . $cat . $order . $page . $search_key;
    $rows_app = $mem->get($mem_key);
    if (!$rows_app) {
        if ($miss_hit) {
            echo '<p>cat miss';
        }
        $rows_app = mysql_query($sql, $conn);
        $mem->set($mem_key, $rows_app, 0, 600);
    } else {
        if ($miss_hit) {
            echo '<p>cat hit';
        }
    }
    $url = './?' . ($cat != '' ? 'cat=' . $cat . '&' : '') . ($search_key != '' ? 'search_key=' . $search_key . '&' : '') . ($order != '' ? 'order=' . $order . '&' : '') . 'pg=__page__';
    $pagebar = build_pagebar($total['total'], $perpage, $page, $url);
Example #14
0
 public function searchDestInns()
 {
     $this->moduleTag = 'searchDestInns';
     $dest_id = input_int($this->input->get('tid'), 1, FALSE, 0);
     $local_id = input_int($this->input->get('lid'), 1, FALSE, 0);
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = DEFAULT_PERPAGE;
     $arr = $this->model->get_localArr(0, $local_id, $dest_id);
     $destInfo = $arr['destInfo'];
     $localArr = $arr['localArr'];
     $destInnsInfo = $this->model->searchInnsBy_dest_Id(build_limit($page, $perpage), $dest_id, $local_id);
     $pageInfo = array('total' => $destInnsInfo['total'], 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $destInnsInfo['total'] / $perpage, 'url' => makePageUrl($page));
     $this->viewData = array('destInnsInfo' => $destInnsInfo, 'destInfo' => $destInfo, 'localArr' => $localArr, 'pageInfo' => $pageInfo);
 }