本文整理汇总了PHP中XDateTime::hourDiff方法的典型用法代码示例。如果您正苦于以下问题:PHP XDateTime::hourDiff方法的具体用法?PHP XDateTime::hourDiff怎么用?PHP XDateTime::hourDiff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDateTime
的用法示例。
在下文中一共展示了XDateTime::hourDiff方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pullDailyRecommendThreads
public function pullDailyRecommendThreads($spaceId)
{/*{{{*/
$space = DAL::get()->find('space', $spaceId);
if($space->isNull())
{
$this->setErrorCode(328);
return 0;
}
$firstLoginTime = '';
$spaceexp= DAL::get()->find_by_userid('spaceexp', $space->user->id);
if(false == $spaceexp->isNull())
{
$firstLoginTime = $spaceexp->firstLoginTime;
}
if(empty($firstLoginTime)
|| false == empty($firstLoginTime) && (XDateTime::hourDiff(XDateTime::valueOf($firstLoginTime),XDateTime::now()) > 24))
{
$proposalIds = ProposalClient::getInstance()->autoPullRecommends($space);
error_log("[".XDateTime::now()."] ".$space->user->name."\n", 3, "/tmp/mobile_autopull.log");
if (false == empty($proposalIds))
{
SpaceExpClient::getInstance()->createSpaceExp($space->user->id, XDateTime::now());
}
}
}/*}}}*/
示例2: ajaxGetNextRecommendThread
public function ajaxGetNextRecommendThread($request, $response)
{/*{{{*/
header('Content-Type: application/json; charset=UTF-8');
//判断是否推送的判断变量
$isCanAutoPull = (false === empty($_COOKIE["userinfo"]["hosttype"])
&& 'Doctor' == $_COOKIE["userinfo"]['hosttype']) ;
$cookie = new HdfCookie();
$isSuccess = 0;
if($isCanAutoPull
&& (false === isset($_COOKIE['firstlogintime'])
|| (false == empty($_COOKIE['firstlogintime'])
&& (XDateTime::hourDiff(XDateTime::valueOf($_COOKIE['firstlogintime']), XDateTime::now()) > 24))))
{
$auto = ThreadClient::getInstance()->autoPullRecommendThreads($this->_newUser);
if ($auto)
{
$cookie->set("firstlogintime", XDateTime::now(), 7*24*3600);
SpaceExpClient::getInstance()->createSpaceExp($this->_newUser->id, XDateTime::now());
$isSuccess = 1;
}
}
$unUnreadCaseCount = FlowClient::getInstance()->getUnReadCount($this->_newSpace->id);
$callback = $request->callback;
echo "\n".$callback.'(';
echo Json::encode($unUnreadCaseCount);
echo ');';
//方便测试
echo "\nisCanAuto:".$isCanAutoPull;
echo "\nisSuccess:".$isSuccess;
exit;
}/*}}}*/
示例3: canRecommend
private function canRecommend()
{
/*{{{*/
$userClient = UserClient::getInstance();
$isDoctor = 'Doctor' == $userClient->getSeed('hosttype');
$firstlogintime = $userClient->getSeed('firstlogintime');
$this->log->addDebug("isDoctor:" . (int) $isDoctor);
$this->log->addDebug("firstlogintime:" . (int) $firstlogintime);
return $isDoctor && (null === $firstlogintime || $firstlogintime && XDateTime::hourDiff(XDateTime::valueOf($firstlogintime), XDateTime::now()) > 24);
}