cloudycity/kuaishou-marketing-sdk

Kuaishou MarketingAPI SDK

v0.1.6 2021-06-02 09:05 UTC

This package is auto-updated.

Last update: 2024-10-29 06:05:38 UTC


README

Latest Version on Packagist Software License Build Status StyleCI Quality Score Total Downloads standard-readme compliant All Contributors

内容列表

安装

composer require cloudycity/kuaishou-marketing-sdk:*

使用说明

授权

use CloudyCity\KuaishouMarketingSDK\Auth;

// 获取token
$auth = new Auth(APPID, SECRET);
var_dump($auth->getTokens(AUTH_CODE));

// 刷新token
var_dump($auth->refreshTokens(REFRESH_TOKEN));

基础调用

参照所有方法

$client = new Client(ADVERTISE_ID, TOKEN);
var_dump($client->advertiser->getInfo());

参照示例

组件提供了一个Interface CloudyCity\KuaishouMarketingSDK\Kernel\Contracts\KuaishouService

这里以一个实现了Integerface的Service为例:

use CloudyCity\KuaishouMarketingSDK\Client;
use App\Services\KuaishouService;

$apps = KuaishouService::getApps();

// 遍历开发者应用
foreach ($apps as $app) {

    $service = new KuaishouService($app['id'], $app['secret']);
    $advertiserIds = $service->getAdvertiserIds();

    // 遍历应用下授权的广告主
    foreach ($advertiserIds as $advertiserId) {
        $tokens = $service->getTokenByCache($advertiserId);
        $client = new Client($tokens['advertiser_id'], $tokens['access_token']);

        // 处理业务逻辑
        try {
            $result = $client->advertiser->getFunds();
        } catch(\Exception $e) {
            //
        }
    }
}

所有方法

维护者

  • @CloudyCity

贡献者 ✨

Thanks goes to these wonderful people (emoji key):

项目遵循 all-contributors 规范。 欢迎任何形式的贡献!

如何贡献

非常欢迎你的加入!提一个 Issue 或者提交一个 Pull Request。

标准 Readme 遵循 Contributor Covenant 行为规范。

使用许可

MIT