hisway / jd-union-sdk

v2.0.10 2024-05-12 14:43 UTC

This package is auto-updated.

Last update: 2024-09-12 15:44:24 UTC


README

京东联盟SDK

京东联盟SDK,基于新版的

PHP =>7.0

composer require hisway/jd-union-sdk

如果是在swoole 扩展下使用,支持协程并发,需要在编译swoole扩展的时候开启,系统会自动判断是否采用swoole

./configure --enable-openssl

由于自己没有高级接口,所以高级权限和基础权限封装是分开成两部分的。

没有获取高级权限的,可以申请Apith的高级接口:https://apith.cn/invite/92CCP19D (用github登录即可 ,28元/月,收费的哦)

使用示例

$config = [
    'appkey' => '', // AppId
    'appSecret' => '', // 密钥
    'unionId' => '', // 联盟ID
    'positionId' => '', // 推广位ID
    'siteId' => '', // 网站ID,
    'apithId' => '',  // 第三方网站Apith的appid (可选,不使用apith的,可以不用填写)
    'apithKey' => '', // 第三方网站Apith的appSecret (可选,不使用apith的,可以不用填写)
    'isCurl' => true // 设置为true的话,强制使用php的curl,为false的话,在swoole cli环境下自动启用 http协程客户端
];
$client = new \JdMediaSdk\JdFatory($config);
$result = $client->apith->querySeckillGoods();
if ($result == false ) {
    var_dump($client->getError());
}

var_dump($result);

说明文档

1.官方版本

以下官方版本传参参考:https://union.jd.com/#/openplatform/api

2.Apith版

没有Apith高级权限的,可以点击 https://apith.cn/invite/92CCP19D (用github登录即可 ,28元/月,收费的哦)。

许可协议

Apache