2 Star 6 Fork 4

Yeardley / easytbk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

介绍

本项目由 https://github.com/niugengyun/easytbk 提供源码,稍微改动以便支持laravel之外的其他框架

淘宝联盟、京东联盟、多多进宝、唯品客、苏宁推客SDK封装

安装

1、安装扩展包

composer require yeardley/easytbk

初始化SDK

每个平台SDK的具体调用方法参考各平台的文档

1、淘宝SDK初始化

<?php
use YearDley\EasyTBK\Factory;
use YearDley\EasyTBK\TaoBao\Request\TbkItemInfoGetRequest;

$client = Factory::taobao([
    'app_key' => 'TAOBAO_APP_KEY',
    'app_secret' => 'TAOBAO_APP_SECRET',
    'format' => 'json'
]);
$req = new TbkItemInfoGetRequest;
$req->setNumIids('$numIids');
return $client->execute ($req);

2、京东SDK初始化

<?php
use YearDley\EasyTBK\Factory;
use YearDley\EasyTBK\JingDong\Request\JdUnionGoodsPromotiongoodsinfoQueryRequest;

$jd = Factory::jingdong([
    'app_key' => 'JD_APP_KEY',
    'app_secret' => 'JD_APP_SECRET',
    'format' => 'json',
]);
$req = new JdUnionGoodsPromotiongoodsinfoQueryRequest();
$req->setSkuIds('$itemid');
return $jd->execute($req);

3、拼多多SDK初始化

<?php
use YearDley\EasyTBK\Factory;
use YearDley\EasyTBK\PinDuoDuo\Request\DdkGoodsDetailRequest;

$pdd = Factory::pinduoduo([
    'client_id' => 'PDD_CLIENT_ID',
    'client_secret' => 'PDD_CLIENT_SECRET',
    'format' => 'json',
]);
$req = new DdkGoodsDetailRequest();
$req->setGoodsIdList('[$itemid]');
return  $pdd->execute($req);

4、唯品会SDK初始化

<?php
use YearDley\EasyTBK\Factory;
use YearDley\EasyTBK\Vip\Request\PidGenRequest;
use YearDley\EasyTBK\Vip\Request\UnionPidServiceClient;

// 唯品会官方的sdk写的比较垃圾,用法和其他平台稍微不一样
$service= UnionPidServiceClient::getService();
Factory::vip([
    'app_key' => 'VIP_APP_KEY',
    'app_secret' => 'VIP_APP_SECRET',
    'access_token' => 'VIP_APP_ACCESS_TOKEN',
    'format' => 'json',
]);
$pidGenRequest1 = new PidGenRequest();
$pidNameList2 = array();
$pidNameList2[0] = "value";
$pidGenRequest1->pidNameList = $pidNameList2;
$pidGenRequest1->requestId = "requestId";
print_r($service->genPidWithOauth($pidGenRequest1));

5、苏宁连联盟SDK初始化

<?php
use YearDley\EasyTBK\Factory;
use YearDley\EasyTBK\SuNing\Request\Netalliance\CouponproductQueryRequest;

$c = Factory::suning([
    'app_key' => 'SUNING_APP_KEY',
    'app_secret' => 'SUNING_APP_SECRET',
    'format' => 'json',
]);
$req = new CouponproductQueryRequest();
$req->setPageNo("1");
$req->setPageSize("10");
$req->setPositionId("12");
$resp = $c->execute($req);
print_r($resp);
MIT License Copyright (c) 2020 Debug Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

淘客5合一SDK,支持淘宝联盟、京东联盟、多多进宝、唯品会、苏宁 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/yeardley/easytbk.git
git@gitee.com:yeardley/easytbk.git
yeardley
easytbk
easytbk
master

搜索帮助