src/Biz/CloudPlatform/QueueJob/SearchJob.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Biz\CloudPlatform\QueueJob;

use Biz\CloudPlatform\Service\SearchService;
use Codeages\Biz\Framework\Queue\AbstractJob;

class SearchJob extends AbstractJob
{
    public function execute()
    {
        $context = $this->getBody();
        $type = $context['type'];
        $args = $context['args'];
        if (!in_array($type, array('delete', 'update'))) {
            return array(
                self::FAILED,
                "只支持delete,update两种类型,你的类型是{$type}",
            );
        }

        try {
            if ('update' == $type) {
                $result = $this->getSearchService()->notifyUpdate($args);
            }

            if ('delete' == $type) {
                $result = $this->getSearchService()->notifyDelete($args);
            }
            if (!empty($result['error'])) {
                return array(
                    self::FAILED,
                    $result['error'],
                );
            }
        } catch (\Exception $e) {
            return array(
                self::FAILED,
                $e->getMessage(),
            );
        }
    }

    /**
     * @return SearchService
     */
    protected function getSearchService()
    {
        return $this->biz->service('CloudPlatform:SearchService');
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。