Exemplo n.º 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);
 }
Exemplo n.º 2
0
 /**
  * 忘记密码短信接口
  **/
 public function forgotPassSMS()
 {
     $mobile = input_mobilenum($this->input->post('mobile'), '5001');
     $rs = $this->model->get_user_auth_by_mobile($mobile, TRUE);
     if (!$rs) {
         response_code('4005');
     }
     $mobile_cache = $this->model->check_mobile_send($mobile);
     //缓存取数据
     if ($mobile_cache && $mobile_cache['sms_sendtime'] < TIME_NOW - 60) {
         response_code('5008');
     }
     $mobile_identify = make_mobile_identify_code();
     $current = array('check_mobile' => $mobile, 'sms_sendtime' => TIME_NOW);
     $this->set_current_data($current);
     $mobile_cache = array('mobile_identify' => $mobile_identify, 'sms_sendtime' => TIME_NOW);
     $this->model->save_mobile_identify($mobile, $mobile_cache);
     $message = array('type' => 'forgotUser', 'mobile' => $mobile, 'param' => array($mobile_identify, '5'));
     $rs = $this->sendSMS($message);
     $rs = json_decode($rs, TRUE);
     if (isset($rs['respCode'])) {
         log_message('ERROR', json_encode($rs));
         if ($rs['respCode'] == '105122') {
             response_row(array('code' => '-1', 'msg' => '同一手机每天只能发送8条短信'));
         }
     }
     response_code('1');
 }
Exemplo n.º 3
0
 /**
  * 首页
  */
 public function index()
 {
     $user_id = $this->get_user_id(TRUE);
     $type = $this->input->get('type');
     $thumbs = array();
     switch ($type) {
         case 'userhead':
             $thumbs[] = array('width' => 160, 'height' => 160, 'thumb_marker' => 's', 'maintain_ratio' => FALSE);
             $link = 'user/headimg/';
             break;
         case 'topic':
         case 'forum':
             $thumbs[] = array('width' => 150, 'height' => 150, 'thumb_marker' => 's', 'maintain_ratio' => TRUE, 'master_dim' => 'width');
             $thumbs[] = array('width' => 640, 'height' => 640, 'thumb_marker' => 'm', 'maintain_ratio' => TRUE, 'master_dim' => 'width');
             $link = 'forum/';
             break;
         case 'grouphead':
             $thumbs[] = array('width' => 160, 'height' => 160, 'thumb_marker' => 's', 'maintain_ratio' => FALSE);
             $link = 'forum/group/';
             break;
         case 'comments':
             $thumbs[] = array('width' => 160, 'height' => 160, 'thumb_marker' => 's', 'maintain_ratio' => TRUE, 'master_dim' => 'width');
             $link = 'uploads/comment/';
             break;
         case 'feedback':
             //不需要压缩 控制图片大小即可
             $link = 'uploads/feedback/';
             break;
         default:
             $thumbs[] = array('width' => 160, 'height' => 160, 'thumb_marker' => 's', 'maintain_ratio' => FALSE);
             $link = 'uploads/';
             break;
     }
     $rs = $this->model->getUploadedNames($link);
     //保存图片 得到图片链接
     if ($rs['code'] == '1' && $thumbs) {
         $this->load->library('image_lib');
         foreach ($thumbs as $key => $thumb) {
             $thumb = array_merge($this->model->thumbConfig, $thumb);
             $thumb['source_image'] = $this->config->item('uploaded_img_path') . $rs['msg'];
             $this->image_lib->initialize($thumb);
             $this->image_lib->resize();
         }
     }
     response_row($rs);
 }
Exemplo n.º 4
0
 /**
  * 圈子首页获取列表 
  **/
 public function get()
 {
     $type = input_string($this->input->get('type'), array('live', 'wenda', 'jianren', 'tour', 'rank'), 'live');
     $last_id = input_int($this->input->get('lastid'), 0, FALSE, 0);
     $limit = input_int($this->input->get('limit'), 1, 50, 10);
     $list = array();
     if ($type == 'rank') {
         $page = input_int($this->input->get('page'), 1, FALSE, 1);
         $perpage = input_int($this->input->get('limit'), 1, 50, 20);
         $user_id = $this->get_user_id();
         $list = $this->model->get_groups($user_id, $page, $perpage);
     } else {
         $forum_index = $this->model->get_group_forum($type, $last_id, $limit);
         if ($forum_index) {
             $forum_detail = $this->model->get_forum_detail($forum_index);
             //获取列表所需数据  用户信息等
             foreach ($forum_index as $key => $row) {
                 $row['create_time'] = showTime($row['create_time']);
                 $list[] = array_merge($row, $forum_detail[$row['forum_id']]);
             }
         }
     }
     response_row($list);
 }
Exemplo n.º 5
0
 public function wap()
 {
     $user_id = $this->get_user_id(TRUE);
     $type = $this->input->get('type');
     $thumbs = array();
     switch ($type) {
         case 'userhead':
             $thumbs[] = array('width' => 160, 'height' => 160, 'thumb_marker' => 's', 'maintain_ratio' => FALSE);
             $link = 'user/headimg/';
             break;
         case 'grouphead':
             $thumbs[] = array('width' => 160, 'height' => 160, 'thumb_marker' => 's', 'maintain_ratio' => FALSE);
             $link = 'forum/group/';
             break;
     }
     $rs = $this->model->getWapUploadedNames($link);
     //保存图片 得到图片链接
     if ($rs['code'] == '1' && $thumbs) {
         $this->load->library('image_lib');
         foreach ($thumbs as $key => $thumb) {
             $thumb = array_merge($this->model->thumbConfig, $thumb);
             $thumb['source_image'] = $this->config->item('uploaded_img_path') . $rs['msg'];
             $this->image_lib->initialize($thumb);
             $this->image_lib->resize();
         }
     }
     response_row($rs);
 }