# JsTan **Repository Path**: drz666/JsTan ## Basic Information - **Project Name**: JsTan - **Description**: 聚水潭 sdk(2.0) - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: https://gitee.com/drz666/JsTan - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-03-07 - **Last Updated**: 2024-11-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 聚水潭 sdk(2.0) ## 介绍 聚水潭php-sdk 遇到问题先去查阅官方文档 [聚水潭文档](https://openweb.jushuitan.com/dev-doc) ## 要求 - php >= 7.4(其他 php 版本理论支持,但是未经过测试,请自行修改 php 版本号) ## 安装 ``` composer require mrhd/jstan ``` ### laravel 使用移步至 [laravel-jushuitan](https://gitee.com/drz666/laravel-jushuitan) ## 配置 > 如果下面的示例比较晦涩,请查看测试用例 `config`全局配置 ```php $isProd = env('STAN_IS_PROD',true); private array $config = [ //是否正式环境 'isProd' => $isProd, // 服务商授权拼接地址 'authUrl' => $isProd?env('STAN_AUTH_URL', 'https://openweb.jushuitan.com/auth'):'https://isv-openweb.jushuitan.com/auth', // (服务商和自研)获取access_token和自研用refresh_token刷新access_token地址,服务商不支持刷新access_token // 接口地址 'apiUrl' => $isProd?env('STAN_API_URL','https://openapi.jushuitan.com/'):'https://dev-api.jushuitan.com/', // 授权token 'accessToken' => $isProd?env('STAN_ACCESS_TOKEN',''):'', // 应用key 'appKey' =>$isProd?env('STAN_APP_KEY',''):'', // 应用secret 'appSecret' => $isProd?env('STAN_APP_SECRET',''):'', // 版本号 'version' => '2', // 字符集 'charset' => 'utf-8', // 是否验证证书 'verify' => env('STAN_VERIFY',false), // 超时时间 'timeout' => env('STAN_TIMEOUT',0) ]; ``` ### api调用 ```php 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.