zy/jstan

聚水潭-php-sdk

dev-main 2024-05-23 01:31 UTC

This package is not auto-updated.

Last update: 2025-06-19 06:23:20 UTC


README

Latest Stable Version Total Downloads License Monthly Downloads Daily Downloads Version PHP Version Require

介绍

修改支持php >= 7.1

要求

  • php >= 7.1

安装

composer require zy/jstan

laravel 使用移步至 laravel-jsTan

配置

如果下面的示例比较晦涩,请查看测试用例

config全局配置

private array $config = [
  // 授权地址
  'authUrl' => 'https://openweb.jushuitan.com/auth',
  // 接口地址
  'baseUrl' => 'https://dev-api.jushuitan.com/',
  // 授权接口地址
  'apiUrl' => 'https://openapi.jushuitan.com/',
  // 授权token
  'accessToken' => 'b7e3b1e24e174593af8ca5c397e53dad',
  // 应用key
  'appKey' => 'b0b7d1db226d4216a3d58df9ffa2dde5',
  // 应用secret
  'appSecret' => '99c4cef262f34ca882975a7064de0b87',
  // 版本号
  'version' => '2',
  // 字符集
  'charset' => 'utf-8',
  // 是否验证证书
  'verify' => false,
  // 超时时间
  'timeout' => 0
];

api调用

use JsTan\Client;
use JsTan\Route;

/****/

$client = Client::getInstance($this->config);
$route = Route::getInstance();


//路由可使用 Route::QUERY_SHOPS || $route->getRoute('QUERY_SHOPS') || 'open/logisticscompany/query'
// 常量传入,getRoute 传入,字符串传入,看自己喜好

/**
* 查询门店列表(请求示例)
*/
$response = $client->request($route->getRoute('QUERY_SHOPS'), [
  'page_index' => 1,
  'page_size' => 10
]);


/**
* 获取access_token (请求示例)
*/
$response = $client->getAccessToken('001');


/**
* 刷新access_token (请求示例)
*/
$response = $client->refreshToken('001');


print_r($response);

License

JsTan is made available under the MIT License (MIT). Please see License File for more information.

交流

点击链接加入群聊【聚水潭phpsdk使用交流Q】