private function _saveUserLocation($uid, $longitude, $latitude, $location) { // 插入用户定位开关设置 $count = (int) DbUtils::getDzDbUtils(true)->queryScalar(' SELECT COUNT(*) FROM %t WHERE uid=%d AND ukey=%s ', array('appbyme_user_setting', $uid, AppbymeUserSetting::KEY_GPS_LOCATION)); if (!$count) { AppbymeUserSetting::saveNewSettings($uid, array(AppbymeUserSetting::KEY_GPS_LOCATION => AppbymeUserSetting::VALUE_GPS_LOCATION_ON)); } !empty($location) && SurroundingInfo::saveUserLocation($uid, $longitude, $latitude, $location); }
private function _getTopicInfos($uid, $longitude, $latitude, $radius, $page, $pageSize) { $topicInfos = array('count' => 0, 'list' => array()); $count = SurroundingInfo::getTopicCountByTid($uid, $longitude, $latitude, $radius); $surroundTopics = SurroundingInfo::getAllTopicsByTid($uid, $longitude, $latitude, $radius, $page, $pageSize); $list = array(); foreach ($surroundTopics as $topic) { $topicInfo = array(); $topicId = (int) $topic['object_id']; // $tmpTopicInfo = ForumUtils::getTopicInfo($topicId); $tmpTopicInfo = $topic; if (!empty($tmpTopicInfo)) { $tmpUid = (int) $tmpTopicInfo['authorid']; $tmpFid = (int) $tmpTopicInfo['fid']; $topicInfo['distance'] = $topic['distance']; $topicInfo['location'] = $topic['location']; $topicInfo['board_id'] = $tmpFid; $topicInfo['board_name'] = ForumUtils::getForumName($tmpFid); $topicInfo['topic_id'] = $topicId; $topicInfo['title'] = $tmpTopicInfo['subject']; $topicInfo['uid'] = $tmpUid; $topicInfo['user_nick_name'] = $tmpTopicInfo['author']; $topicInfo['vote'] = ForumUtils::isVoteTopic($tmpTopicInfo) ? 1 : 0; $topicInfo['hot'] = ForumUtils::isHotTopic($tmpTopicInfo) ? 1 : 0; $topicInfo['hits'] = (int) $tmpTopicInfo['views']; $topicInfo['replies'] = (int) $tmpTopicInfo['replies']; $topicInfo['essence'] = ForumUtils::isMarrowTopic($tmpTopicInfo) ? 1 : 0; $topicInfo['top'] = ForumUtils::isTopTopic($tmpTopicInfo) ? 1 : 0; $topicInfo['last_reply_date'] = $tmpTopicInfo['lastpost'] . '000'; $topicInfo['replies'] = (int) $tmpTopicInfo['replies']; $topicSummary = ForumUtils::getTopicSummary($topicId); $topicInfo['subject'] = $topicSummary['msg']; $topicInfo['pic_path'] = $topicSummary['image']; // $topicInfo['type_id'] = (int)$tmpTopicInfo['typeid']; // $topicInfo['sort_id'] = (int)$tmpTopicInfo['sortid']; // $topicInfo['poll'] = $tmpTopicInfo['lastpost']; $list[] = $topicInfo; } } $topicInfos['count'] = $count; $topicInfos['list'] = $list; return $topicInfos; }
public static function getPostLocation($pid) { return SurroundingInfo::getLocationById($pid, SurroundingInfo::TYPE_POST); }
public static function getSqlDistance($longitude, $latitude) { return SurroundingInfo::getSqlDistance($longitude, $latitude); }
private function _getSaveUserLocation($longitude, $latitude, $location) { global $_G; $uid = $_G['uid']; SurroundingInfo::saveUserLocation($uid, $longitude, $latitude, $location); }