Skip to content

zmoyi/JsTan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

聚水潭 sdk(2.0)

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

介绍

时隔一年,没有怎么维护旧版本,并且有很多问题,代码如屎山,这次进行了重构,2.0 版本(虽然代码还是屎山)

聚水潭php-sdk

遇到问题先去查阅官方文档 聚水潭文档

要求

  • php >= 8.1(其他 php 版本理论支持,但是未经过测试,请自行修改 php 版本号)

安装

composer require zmoyi/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】