PHP code example of sparkinzy / kwaishop-sdk
1. Go to this page and download the library: Download sparkinzy/kwaishop-sdk library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sparkinzy / kwaishop-sdk example snippets
return [
'app_key' => '123',
'app_secret' => '123',
'sign_secret' => '123',
'state' => time(),
'redirect_uri' => 'http://kuaishou.xxx.com',
'debug' => false,
'access_token' => 'access_token',
'log'=>[
'name'=>'kuaishou',
'file'=> __DIR__.'/kuaishou.log',
'level'=>'debug',
'permission'=> 0777
]
];
$config = new \Sparkinzy\KwaishopSdk\Kwaishop($config);
# 自动跳转到授权页面
$kwaishop->authorize();
$config = new \Sparkinzy\KwaishopSdk\Kwaishop($config);
$result = $kwaishop->token();
$kwaishop = new \Sparkinzy\KwaishopSdk\Kwaishop($config);
$user = $kwaishop->user->request('open.user.seller.get');
''""$kwaishop = new \Sparkinzy\KwaishopSdk\Kwaishop($config);
// 获取商品类目列表
$categories = $kwaishop->item->request('open.item.category');
// 获取商品列表
$param = [
'kwaiItemId'=>null,
'relItemId'=> null,
'itemStatus'=> null,
'itemType'=> null,
'pageNumber'=> 1,
'pageSize'=>20
];
$list = $kwaishop->item->request('open.item.list',$param);
// 新增商品
$param = [
'relItemId'=>null,
'title'=> null,
'imageUrls'=> null,
'details'=> null,
'expressFee'=> 1,
'categoryId'=>20,
];
$item = $kwaishop->item->request('open.item.add',$param,'POST');