?下载php 版本
解压成文件夹,放入到项目vendor文件夹中
在composer.json中进行SDK的自动加载
添加代码
"autoload": {
"files": [
"vendor/taobao-sdk-PHP-auto/TopSdk.php"
],
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
执行命令进行加载
composer dump-autoload
/**
* 淘宝客-推广者-官方活动转链
* @param Request $request
*/
public function activity(Request $request)
{
$c = new TopClient;
$c->appkey = env('TAOBAO_APPKEY');
$c->secretKey = env('TAOBAO_SECRET');
$req = new TbkActivityInfoGetRequest;
$req->setAdzoneId(1115xxx);
$req->setSubPid("mm_35628234_1xxx00023");
$req->setActivityMaterialId("2015xxx002597");
$req->setUnionId("188xx380");
$resp = $c->execute($req);
dd($resp);
}
|