e7c_corp / easytbk
淘客六合一SDK,支持淘宝联盟、京东联盟、多多进宝、唯品会、苏宁、蘑菇街
dev-master
2022-03-31 01:57 UTC
Requires
- php: >=7.0.0
- graham-campbell/manager: ^2.0|^3.0|^4.0
- illuminate/support: ~5.8|~6.0|~7.0
- laravel/helpers: ^1.2
This package is not auto-updated.
Last update: 2025-03-28 14:12:04 UTC
README
1、修改vendor包
1.1、/vendor/e7c_corp/easytbk/src/pinduoduo/request/DdkGoodsDetailRequest.php
增加:
private $goodsSign;
public function setGoodsSign($goodsSign)
{
$this->goodsSign = $goodsSign;
}
public function getGoodsSign()
{
return $this->goodsSign;
}
修改返回值:
return [
'type' => $this->type,
// 'goods_id_list' => $this->goodsIdList //去掉这行
'goods_sign' => $this->goodsSign //增加这一行
];
1.2、vendor/e7c_corp/easytbk/src/pinduoduo/request/DdkGoodsPromotionUrlGenerateRequest.php
增加
private goodsSignList;
public function setGoodsSignList($goodsSignList)
{
$this->goodsSignList = $goodsSignList;
}
public function getGoodsSignList()
{
return $this->goodsSignList;
}
//修改返回值
//'goods_id_list' => $this->goodsIdList, //去掉这行
'goods_sign_list' => $this->goodsSign, //增加这一行
介绍
这个SDK只支持laravel!
安装
1、安装扩展包,该扩展包只支持laravel
composer require e7c_corp/easytbk
2、执行下面的命令,然后修改config/easytbk.php
php artisan vendor:publish --provider "E7cCorp\EasyTBK\ServiceProvider"
初始化SDK
每个平台SDK的具体调用方法参考各平台的文档
1、淘宝SDK初始化
<?php
use E7cCorp\EasyTBK\Factory;
use E7cCorp\EasyTBK\TaoBao\Request\TbkItemInfoGetRequest;
$client = Factory::taobao ();
$req = new TbkItemInfoGetRequest;
$req->setNumIids ($numIids);
return $client->execute ($req);
2、京东SDK初始化
<?php
use E7cCorp\EasyTBK\Factory;
use E7cCorp\EasyTBK\JingDong\Request\JdUnionGoodsPromotiongoodsinfoQueryRequest;
$jd = Factory::jingdong();
$req = new JdUnionGoodsPromotiongoodsinfoQueryRequest();
$req->setSkuIds("$itemid");
return $jd->execute($req);
3、拼多多SDK初始化
<?php
use E7cCorp\EasyTBK\Factory;
use E7cCorp\EasyTBK\PinDuoDuo\Request\DdkGoodsDetailRequest;
$pdd = Factory::pinduoduo();
$req = new DdkGoodsDetailRequest();
$req->setGoodsIdList("[$itemid]");
return $pdd->execute($req);
4、唯品会SDK初始化
<?php
use E7cCorp\EasyTBK\Factory;
use E7cCorp\EasyTBK\Vip\Request\PidGenRequest;
use E7cCorp\EasyTBK\Vip\Request\UnionPidServiceClient;
// 唯品会官方的sdk写的比较垃圾,用法和其他平台稍微不一样
$service= UnionPidServiceClient::getService();
Factory::vip();
$pidGenRequest1 = new PidGenRequest();
$pidNameList2 = array();
$pidNameList2[0] = "value";
$pidGenRequest1->pidNameList = $pidNameList2;
$pidGenRequest1->requestId = "requestId";
dd($service->genPidWithOauth($pidGenRequest1));
5、苏宁连联盟SDK初始化
<?php
use E7cCorp\EasyTBK\Factory;
use E7cCorp\EasyTBK\SuNing\Request\Netalliance\CouponproductQueryRequest;
$c = Factory::suning();
$req = new CouponproductQueryRequest();
$req->setPageNo("1");
$req->setPageSize("10");
$req->setPositionId("12");
$resp = $c->execute($req);
dd($resp);
6、蘑菇街
蘑菇街使用人数太少,不值得耗费精力开发,所以暂时不打算集成。