vendor/codeages/plugin-bundle/Biz/Service/Impl/AppServiceImpl.php

(开头部分) 1KB

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

<?php

namespace Codeages\PluginBundle\Biz\Service\Impl;

use Codeages\PluginBundle\Biz\Service\AppService;
use Codeages\Biz\Framework\Service\BaseService;

class AppServiceImpl extends BaseService implements AppService
{
    public function getApp($id)
    {
        return $this->getAppDao()->get($id);
    }

    public function getAppByCode($code)
    {
        return $this->getAppDao()->getByCode($code);
    }

    public function findAllPlugins()
    {
        $total = $this->getAppDao()->countByType('plugin');
        if (empty($total)) {
            return array();
        }

        return $this->getAppDao()->findByType('plugin', 0, $total);
    }

    public function registerPlugin($plugin)
    {
        $app = array();

        $app['type'] = 'plugin';
        $app['code'] = $plugin['code'];
        $app['name'] = $plugin['name'];
        $app['description'] = $plugin['description'];
        $app['icon'] = '';
        // $app['author'] = $plugin['author'];
        $app['developerName'] = $plugin['author'];
        $app['version'] = $plugin['version'];
        $app['protocol'] = empty($plugin['protocol']) ? 3 : $plugin['protocol'];

        $app = $this->getAppDao()->create($app);

        return $app;
    }

    public function removePlugin($code)
    {
        $code = ucfirst($code);

        $app = $this->getAppByCode($code);
        if (!$app) {
            throw new \RuntimeException("Plugin `{$code}` is not installed.");
        }

        $this->getAppDao()->delete($app['id']);
    }

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

AI 解读 AI

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

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