sparkinzy/kwaishop-sdk

There is no license information available for the latest version (1.0.2) of this package.

快手电商SDK

1.0.2 2020-12-22 03:32 UTC

This package is auto-updated.

Last update: 2024-04-22 11:04:11 UTC


README

配置项

config.php

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   = include __DIR__.'/config.php';
$kwaishop = new \Sparkinzy\KwaishopSdk\Kwaishop($config);
# 自动跳转到授权页面
$kwaishop->authorize();

获取token

$config   = include __DIR__.'/config.php';
$kwaishop = 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');