當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XDateTime::hourDiff方法代碼示例

本文整理匯總了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());
            } 
        } 
    }/*}}}*/
開發者ID:sdgdsffdsfff,項目名稱:hdf-client,代碼行數:25,代碼來源:casedatabucket.php

示例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;
 }/*}}}*/
開發者ID:sdgdsffdsfff,項目名稱:hdf-client,代碼行數:31,代碼來源:threadcontroller.php

示例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);
 }
開發者ID:sdgdsffdsfff,項目名稱:hdf-client,代碼行數:10,代碼來源:recommendthreadcontroller.php


注:本文中的XDateTime::hourDiff方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。