延时更新检查 返回false表示需要延时
否则返回实际写入的数值
@access public
@param string $guid  写入标识
@param integer $step  写入步进值
@param integer $lazyTime  延时时间(s)
@return false|integer
766032
protected function lazyWrite($guid,$step,$lazyTime) {
        if(false !== ($value = S($guid))) { // 存在缓存写入数据
            if(NOW_TIME > S($guid.'_time')+$lazyTime) {
                // 延时更新时间到了，删除缓存数据 并实际写入数据库
                S($guid,NULL);
                S($guid.'_time',NULL);
                return $value+$step;
            }else{
                // 追加数据到缓存
                S($guid,$value+$step);
                return false;
            }
        }else{ // 没有缓存数据
            S($guid,$step);
            // 计时开始
            S($guid.'_time',NOW_TIME);
            return false;
        }
    }
884279
private function performStep($sessionId, Step $step)
    {
        switch (true) {
            case $step instanceof Action:
                return $this->actionMapping->action($sessionId, $step->getAction(), $step->getParameters(), $step->getContexts());
                break;
            case $step instanceof Speech:
                return $this->actionMapping->speech($sessionId, $step->getSpeech(), $step->getContexts());
                break;
        }

        return false;
    }
1109186
protected function reachStep(ModelInterface $model, Step $step, ModelState $currentModelState = null)
    {
        try {
            $this->checkCredentials($model, $step);
        } catch (AccessDeniedException $e) {
            $violations = new ViolationList();
            $violations->add(new Violation($e->getMessage()));

            $modelState = $this->storage->newModelStateError($model, $this->process->getName(), $step->getName(), $violations, $currentModelState);

            $eventName = sprintf('%s.%s.bad_credentials', $this->process->getName(), $step->getName());
            $this->dispatcher->dispatch($eventName, new StepEvent($step, $model, $modelState));

            if ($step->getOnInvalid()) {
                $step = $this->getProcessStep($step->getOnInvalid());
                $modelState = $this->reachStep($model, $step);
            }

            return $modelState;
        }

        $event = new ValidateStepEvent($step, $model, new ViolationList());
        $eventName = sprintf('%s.%s.validate', $this->process->getName(), $step->getName());
        $this->dispatcher->dispatch($eventName, $event);

        if (0 === count($event->getViolationList())) {
            $modelState = $this->storage->newModelStateSuccess($model, $this->process->getName(), $step->getName(), $currentModelState);

            // update model status
            if ($step->hasModelStatus()) {
                list($method, $constant) = $step->getModelStatus();
                $model->$method(constant($constant));
            }

            $eventName = sprintf('%s.%s.reached', $this->process->getName(), $step->getName());
            $this->dispatcher->dispatch($eventName, new StepEvent($step, $model, $modelState));
        } else {
            $modelState = $this->storage->newModelStateError($model, $this->process->getName(), $step->getName(), $event->getViolationList(), $currentModelState);

            $eventName = sprintf('%s.%s.validation_fail', $this->process->getName(), $step->getName());
            $this->dispatcher->dispatch($eventName, new StepEvent($step, $model, $modelState));

            if ($step->getOnInvalid()) {
                $step = $this->getProcessStep($step->getOnInvalid());
                $modelState = $this->reachStep($model, $step);
            }
        }

        return $modelState;
    }
570050
def eatfd(self, fd):
        '''
        

        '''
        fd.seek(0)
        byts = fd.read(10000000)
        while byts:
            self.update(byts)
            byts = fd.read(10000000)

        return self.guid()
768660
public function getGatewayCustomerId($uid)
    {
		$result = 0;
		$user   = $this->findUser( $uid );
		if (! is_null($user)) {
			$result = intval($user->getGatewayCustomerId());
		}

		return $result;
	}
982770
protected function kickUid($uid)
    {
        if (Start::$testUnity) {
            $this->testUnitSendStack[] = ['action' => 'kickUid', 'uid' => $uid];
        } else {
            get_instance()->kickUid($uid);
        }
    }
192918
public function bindUid($fd, $uid, $isKick = true)
    {
        if (!is_string($uid) && !is_int($uid)) {
            throw new \Exception('uid必须为string或者int');
        }
        //这里转换成string型的uid，不然ds/Set有bug
        $uid = (string) $uid;
        if ($isKick) {
            $this->kickUid($uid, false);
        }
        $this->uid_fd_table->set($uid, ['fd' => $fd]);
        $this->fd_uid_table->set($fd, ['uid' => $uid]);
        if ($this->isCluster()) {
            ProcessManager::getInstance()->getRpcCall(ClusterProcess::class, true)->my_addUid($uid);
        } else {
            get_instance()->pub('$SYS/uidcount', $this->uid_fd_table->count());
        }
    }
1005736
private function performStep($sessionId, Step $step, Context $context, $currentIteration)
    {
        switch (true) {
            case $step instanceof Merge:
                $newContext = $this->actionMapping->merge($sessionId, $context, $step);
                $context = $this->converse($sessionId, null, $newContext, --$currentIteration);
                break;
            case $step instanceof Message:
                $this->actionMapping->say($sessionId, $context, $step);
                $context = $this->converse($sessionId, null, $context, --$currentIteration);
                break;
            case $step instanceof Action:
                $newContext = $this->actionMapping->action($sessionId, $context, $step);
                $context = $this->converse($sessionId, null, $newContext, --$currentIteration);
                break;
            case $step instanceof Stop:
                $this->actionMapping->stop($sessionId, $context, $step);
                break;
        }

        return $context;
    }
954977
public function chown($uid, $gid = -1, $cb = null, $pri = EIO_PRI_DEFAULT)
    {
        $cb = CallbackWrapper::forceWrap($cb);
        if (!$this->fd) {
            if ($cb) {
                $cb($this, false);
            }
            return false;
        }
        if (!FileSystem::$supported) {
            $r = chown($this->path, $uid);
            if ($gid !== -1) {
                $r = $r && chgrp($this->path, $gid);
            }
            if ($cb) {
                $cb($this, $r);
            }
            return false;
        }
        return eio_fchown($this->fd, $uid, $gid, $pri, $cb, $this);
    }
360398
protected function getItemByUid($data, $uid)
    {
        /* @var Shopgate_Model_Abstract $item */
        foreach ($data as $item) {
            if ($item->getData(self::DEFAULT_IDENTIFIER_UID) == $uid) {
                return $item;
            }
        }

        return false;
    }
388811
public function fetchDoc($guid, $options = [])
    {
        $options['guid'] = $guid;
        return $this->_request(self::FETCH_DOC, $options);
    }
806577
public function nextStep($step = null)
    {
        $steps = $this->getStepsArray();
        $key = array_search($step, $steps);

        if (is_int($key) && $key < count($steps)-1) {
            return $steps[$key+1];
        }

        return false;
    }
629739
public function guid($guid, $isPermalink = false)
    {
        $this->guid = $guid;
        $this->isPermalink = $isPermalink;

        return $this;
    }
811836
public static function create($id,$guid,$context_id,$debug=false) {
        global $CFG;
        $pt = $CFG->cookiepad.'::'.$id.'::'.$guid.'::'.$context_id;
        if ( $debug ) echo("PT1: $pt\n");
        $ct = \Tsugi\Crypt\AesCtr::encrypt($pt, $CFG->cookiesecret, 256) ;
        return $ct;
    }
1321031
public function actionPost($cid = null, $fid = null, $tid = null, $pid = null)
    {
        $thread = Thread::find()->where([
                'id' => $tid,
                'category_id' => $cid,
                'forum_id' => $fid
            ])->limit(1)->one();
        if (empty($thread)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the thread you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        if ($thread->locked == 1 && !User::can(Rbac::PERM_UPDATE_THREAD, ['item' => $thread])) {
            $this->info(Yii::t('podium/flash', 'This thread is locked.'));
            return $this->redirect([
                'forum/thread',
                'cid' => $thread->forum->category->id,
                'fid' => $thread->forum->id,
                'id' => $thread->id,
                'slug' => $thread->slug
            ]);
        }

        if (!User::can(Rbac::PERM_CREATE_POST)) {
            $this->error(Yii::t('podium/flash', 'Sorry! You do not have the required permission to perform this action.'));
            return $this->redirect(['forum/index']);
        }

        $model = new Post();
        $model->subscribe = 1;
        $postData = Yii::$app->request->post();
        $replyFor = null;
        if (is_numeric($pid) && $pid > 0) {
            $replyFor = Post::find()->where(['id' => $pid])->limit(1)->one();
            if ($replyFor) {
                $model->content = Helper::prepareQuote($replyFor, Yii::$app->request->post('quote'));
            }
        }

        $preview = false;
        $previous = Post::find()->where(['thread_id' => $thread->id])->orderBy(['id' => SORT_DESC])->limit(1)->one();
        if ($model->load($postData)) {
            $model->thread_id = $thread->id;
            $model->forum_id = $thread->forum->id;
            $model->author_id = User::loggedId();
            if ($model->validate()) {
                if (isset($postData['preview-button'])) {
                    $preview = true;
                } else {
                    if ($model->podiumNew($previous)) {
                        $this->success(Yii::t('podium/flash', 'New reply has been added.'));
                        if (!empty($previous) && $previous->author_id == User::loggedId() && $this->module->podiumConfig->get('merge_posts')) {
                            return $this->redirect(['forum/show', 'id' => $previous->id]);
                        }
                        return $this->redirect(['forum/show', 'id' => $model->id]);
                    }
                    $this->error(Yii::t('podium/flash', 'Sorry! There was an error while adding the reply. Contact administrator about this problem.'));
                }
            }
        }
        return $this->render('post', [
            'replyFor' => $replyFor,
            'preview' => $preview,
            'model' => $model,
            'thread' => $thread,
            'previous' => $previous,
        ]);
    }
940618
public function getNextImage($guid) {
		$imageList = $this->getImageList();
		$key = array_search($guid, $imageList);
		if ($key === false) {
			return null;
		}
		$key++;
		if ($key >= count($imageList)) {
			return get_entity($imageList[0]);
		}
		return get_entity($imageList[$key]);
	}
890449
public function guid($guid, $like = false)
    {
        /* @var $this ActiveQuery */
        $model = $this->noInitModel;
        return $this->likeCondition((string)$guid, $model->guidAttribute, $like);
    }