src/Biz/Marketing/Service/Impl/MarketingPlatformServiceImpl.php

(开头部分) 1KB

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

<?php

namespace Biz\Marketing\Service\Impl;

use Biz\BaseService;
use Biz\Marketing\Service\MarketingPlatformService;
use Biz\Marketing\MarketingAPIFactory;
use Biz\User\UserException;

class MarketingPlatformServiceImpl extends BaseService implements MarketingPlatformService
{
    public function simpleLogin($userId)
    {
        $client = $this->getMarketingAPIClient();
        $user = $this->getUserService()->getUser($userId);
        if (empty($user) || !$this->getUserService()->hasAdminRoles($userId)) {
            throw UserException::PERMISSION_DENIED();
        }
        $client->post(
            '/simple_login',
            array(
                'user_id' => $user['id'],
                'user_name' => $user['nickname'],
            )
        );
    }

    public function getActivity($activityId)
    {
        $systemUser = $this->getUserService()->getUserByType('system');
        $this->simpleLogin($systemUser['id']);
        $client = $this->getMarketingAPIClient();

        return $client->get(
            '/activities/'.$activityId,
            array('from' => 'edusoho'),
            array('MERCHANT-USER-ID: '.$systemUser['id'])
        );
    }

    protected function getMarketingAPIClient()
    {
        return MarketingAPIFactory::create();
    }

    protected function getUserService()
    {
        return $this->createService('User:UserService');
    }
}

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

AI 解读 AI

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

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