本文整理汇总了PHP中Pw::checkOnline方法的典型用法代码示例。如果您正苦于以下问题:PHP Pw::checkOnline方法的具体用法?PHP Pw::checkOnline怎么用?PHP Pw::checkOnline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pw
的用法示例。
在下文中一共展示了Pw::checkOnline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
list($uid, $username) = $this->getInput(array('uid', 'username'));
if ($uid) {
} elseif ($username) {
$info = Wekit::load('user.PwUser')->getUserByName($username);
$uid = $info['uid'];
} else {
$uid = 0;
}
$user = new PwUserBo($uid, true);
$medals = array();
if ($uid) {
/* @var $service PwAttention */
$service = Wekit::load('attention.PwAttention');
$isFollowed = $service->isFollowed($this->loginUser->uid, $uid);
$isFans = $service->isFollowed($uid, $this->loginUser->uid);
$follow2num = $isFollowed || $uid == $this->loginUser->uid ? 0 : $service->countFollowToFollow($this->loginUser->uid, $uid);
if ($follow2num > 0) {
$uids = $service->getFollowToFollow($this->loginUser->uid, $uid, 2);
$usernames = Wekit::load('user.PwUser')->fetchUserByUid(array_keys($uids));
$this->setOutput($usernames, 'usernames');
}
if (Wekit::C('site', 'medal.isopen')) {
$medalIds = explode(',', $user->info['medal_ids']);
$medals = Wekit::load('medal.srv.PwMedalCache')->fetchMedal($medalIds);
}
} else {
$isFollowed = false;
$isFans = false;
$follow2num = 0;
$user->info['follows'] = 0;
$user->info['fans'] = 0;
$user->info['postnum'] = 0;
}
$this->setOutput($user->info['gender'] == 1, 'female');
$this->setOutput(Pw::checkOnline($user->info['lastvisit']), 'isol');
$this->setOutput($uid, 'uid');
$this->setOutput($follow2num, 'follow2num');
$this->setOutput($isFollowed, 'isFollowed');
$this->setOutput($isFans, 'isFans');
$this->setOutput($user, 'user');
$this->setOutput($medals, 'medals');
$this->setOutput(count($medals), 'medalNum');
$this->setTemplate('TPL:common.card_run');
}