示例#1
0
 function prepare($args)
 {
     if (parent::prepare($args)) {
         $this->notice = empty($this->tag) ? $this->user->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) : $this->user->getTaggedNotices($this->tag, ($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null);
         return true;
     } else {
         return false;
     }
 }
示例#2
0
 function prepare($args)
 {
     if (parent::prepare($args)) {
         $stream = new InboxNoticeStream($this->user->getProfile(), $this->scoped);
         $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, null, null);
         return true;
     } else {
         return false;
     }
 }
示例#3
0
 function prepare($args)
 {
     if (parent::prepare($args)) {
         $cur = common_current_user();
         $stream = new InboxNoticeStream($this->user, $cur->getProfile());
         $this->notice = $stream->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, null, null);
         return true;
     } else {
         return false;
     }
 }
示例#4
0
 function prepare($args)
 {
     if (parent::prepare($args)) {
         $cur = common_current_user();
         if (!empty($cur) && $cur->id == $this->user->id) {
             $this->notice = $this->user->noticeInbox(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
         } else {
             $this->notice = $this->user->noticesWithFriends(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
         }
         return true;
     } else {
         return false;
     }
 }
 function map($x, $y)
 {
     $user_request_model = M('User_request');
     $user_request_row = $user_request_model->where(array('token' => $this->_get('token'), 'msgtype' => 'text', 'uid' => $this->data['FromUserName']))->find();
     if (!(strpos($user_request_row['keyword'], '附近') === FALSE)) {
         $user = M('Nearby_user')->where(array('token' => $this->_get('token'), 'uid' => $this->data['FromUserName']))->find();
         $keyword = $user['keyword'];
         $radius = 2000;
         $str = file_get_contents(C('site_url') . '/map.php?keyword=' . urlencode($keyword) . '&x=' . $x . '&y=' . $y);
         $array = json_decode($str);
         $map = array();
         foreach ($array as $key => $vo) {
             $map[] = array($vo->title, $key, rtrim(C('site_url'), '/') . '/tpl/static/images/home.jpg', $vo->url);
         }
         return array($map, 'news');
     } else {
         import("Home.Action.MapAction");
         $mapAction = new MapAction();
         if (!(strpos($user_request_row['keyword'], '开车去') === FALSE) || !(strpos($user_request_row['keyword'], '坐公交') === FALSE) || !(strpos($user_request_row['keyword'], '步行去') === FALSE)) {
             if (!(strpos($user_request_row['keyword'], '步行去') === FALSE)) {
                 $companyid = str_replace('步行去', '', $user_request_row['keyword']);
                 if (!$companyid) {
                     $companyid = 1;
                 }
                 return $mapAction->walk($x, $y, $companyid);
             }
             if (!(strpos($user_request_row['keyword'], '开车去') === FALSE)) {
                 $companyid = str_replace('开车去', '', $user_request_row['keyword']);
                 if (!$companyid) {
                     $companyid = 1;
                 }
                 return $mapAction->drive($x, $y, $companyid);
             }
             if (!(strpos($user_request_row['keyword'], '坐公交') === FALSE)) {
                 $companyid = str_replace('坐公交', '', $user_request_row['keyword']);
                 if (!$companyid) {
                     $companyid = 1;
                 }
                 return $mapAction->bus($x, $y, $companyid);
             }
         } else {
             switch ($user_request_row['keyword']) {
                 case '最近的':
                     return $mapAction->nearest($x, $y);
                     break;
             }
         }
     }
 }
示例#6
0
 public function map($x, $y)
 {
     $transUrl = 'http://api.map.baidu.com/ag/coord/convert?from=2&to=4&x=' . $x . '&y=' . $y;
     $json = Http::fsockopenDownload($transUrl);
     if ($json == false) {
         $json = file_get_contents($transUrl);
     }
     $arr = json_decode($json, true);
     $x = base64_decode($arr['x']);
     $y = base64_decode($arr['y']);
     $user_request_model = M('User_request');
     $urWhere = array('token' => $this->_get('token'), 'msgtype' => 'text', 'uid' => $this->data['FromUserName']);
     $urWhere['time'] = array('gt', time() - 5 * 60);
     $user_request_row = $user_request_model->where($urWhere)->find();
     if (!(strpos($user_request_row['keyword'], '附近') === FALSE)) {
         $user = M('Nearby_user')->where(array('token' => $this->_get('token'), 'uid' => $this->data['FromUserName']))->find();
         $keyword = $user['keyword'];
         $radius = 2000;
         $map = new baiduMap($keyword, $x, $y);
         $str = $map->echoJson();
         $array = json_decode($str);
         $map = array();
         foreach ($array as $key => $vo) {
             $map[] = array($vo->title, $key, rtrim($this->siteUrl, '/') . '/tpl/static/images/home.jpg', $vo->url);
         }
         if ($map) {
             return array($map, 'news');
         } else {
             $str = file_get_contents($this->siteUrl . '/map.php?keyword=' . urlencode($keyword) . '&x=' . $x . '&y=' . $y);
             $array = json_decode($str);
             $map = array();
             foreach ($array as $key => $vo) {
                 $map[] = array($vo->title, $key, rtrim($this->siteUrl, '/') . '/tpl/static/images/home.jpg', $vo->url);
             }
             if ($map) {
                 return array($map, 'news');
             } else {
                 return array('附近信息无法调出,请稍候再试一下(关键词' . $keyword . ',坐标:' . $x . '-' . $y . ')', 'text');
             }
         }
     } else {
         if (!(strpos($this->fun, 'lbsNews') === FALSE)) {
             $lbsImgClass = new lbsImgNews($this->token, $this->data['FromUserName'], $this->siteUrl);
             return $lbsImgClass->news($x, $y);
         }
         import("Home.Action.MapAction");
         $mapAction = new MapAction();
         if (!(strpos($user_request_row['keyword'], '开车去') === FALSE) || !(strpos($user_request_row['keyword'], '坐公交') === FALSE) || !(strpos($user_request_row['keyword'], '步行去') === FALSE)) {
             if (!(strpos($user_request_row['keyword'], '步行去') === FALSE)) {
                 $companyid = str_replace('步行去', '', $user_request_row['keyword']);
                 if (!$companyid) {
                     $companyid = 1;
                 }
                 return $mapAction->walk($x, $y, $companyid);
             }
             if (!(strpos($user_request_row['keyword'], '开车去') === FALSE)) {
                 $companyid = str_replace('开车去', '', $user_request_row['keyword']);
                 if (!$companyid) {
                     $companyid = 1;
                 }
                 return $mapAction->drive($x, $y, $companyid);
             }
             if (!(strpos($user_request_row['keyword'], '坐公交') === FALSE)) {
                 $companyid = str_replace('坐公交', '', $user_request_row['keyword']);
                 if (!$companyid) {
                     $companyid = 1;
                 }
                 return $mapAction->bus($x, $y, $companyid);
             }
         } else {
             switch ($user_request_row['keyword']) {
                 default:
                     return $this->companyMap();
                     break;
                 case '最近的':
                     return $mapAction->nearest($x, $y);
                     break;
             }
         }
     }
 }
示例#7
0
 function companyMap()
 {
     import("Home.Action.MapAction");
     $mapAction = new MapAction();
     return $mapAction->staticCompanyMap();
 }