fixed
This commit is contained in:
@@ -6,10 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
|
|||||||
$baseDir = dirname($vendorDir);
|
$baseDir = dirname($vendorDir);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
|
||||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||||
'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
|
|
||||||
'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
|
||||||
'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
|
|
||||||
'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,11 +7,8 @@ $baseDir = dirname($vendorDir);
|
|||||||
|
|
||||||
return array(
|
return array(
|
||||||
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
|
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
|
|
||||||
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
|
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
|
||||||
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||||
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
|
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||||
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
|
|
||||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
|
||||||
'ffc1d7141d4fcbaeb47a6929f0811ed1' => $vendorDir . '/topthink/think-worker/src/command.php',
|
'ffc1d7141d4fcbaeb47a6929f0811ed1' => $vendorDir . '/topthink/think-worker/src/command.php',
|
||||||
);
|
);
|
||||||
|
|||||||
15
digital_doctor/vendor/composer/autoload_psr4.php
vendored
15
digital_doctor/vendor/composer/autoload_psr4.php
vendored
@@ -12,19 +12,6 @@ return array(
|
|||||||
'app\\' => array($baseDir . '/application'),
|
'app\\' => array($baseDir . '/application'),
|
||||||
'Workerman\\' => array($vendorDir . '/workerman/workerman'),
|
'Workerman\\' => array($vendorDir . '/workerman/workerman'),
|
||||||
'WebSocket\\' => array($vendorDir . '/textalk/websocket/lib'),
|
'WebSocket\\' => array($vendorDir . '/textalk/websocket/lib'),
|
||||||
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
|
|
||||||
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
|
|
||||||
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
|
|
||||||
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
|
|
||||||
'React\\Stream\\' => array($vendorDir . '/react/stream/src'),
|
|
||||||
'React\\Socket\\' => array($vendorDir . '/react/socket/src'),
|
|
||||||
'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
|
|
||||||
'React\\Http\\' => array($vendorDir . '/react/http/src'),
|
|
||||||
'React\\EventLoop\\' => array($vendorDir . '/react/event-loop/src'),
|
|
||||||
'React\\Dns\\' => array($vendorDir . '/react/dns/src'),
|
|
||||||
'React\\Cache\\' => array($vendorDir . '/react/cache/src'),
|
|
||||||
'Ratchet\\RFC6455\\' => array($vendorDir . '/ratchet/rfc6455/src'),
|
|
||||||
'Ratchet\\' => array($vendorDir . '/cboden/ratchet/src/Ratchet'),
|
|
||||||
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
||||||
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
|
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
|
||||||
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
|
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
|
||||||
@@ -38,6 +25,4 @@ return array(
|
|||||||
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
|
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
|
||||||
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
||||||
'GatewayWorker\\' => array($vendorDir . '/workerman/gateway-worker/src'),
|
'GatewayWorker\\' => array($vendorDir . '/workerman/gateway-worker/src'),
|
||||||
'Fig\\Http\\Message\\' => array($vendorDir . '/fig/http-message-util/src'),
|
|
||||||
'Evenement\\' => array($vendorDir . '/evenement/evenement/src'),
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,12 +8,9 @@ class ComposerStaticInit296bd8a1d28e39d56dcd80ce7be249f3
|
|||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
|
||||||
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
|
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
|
||||||
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||||
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
|
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
|
||||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
|
||||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
|
||||||
'ffc1d7141d4fcbaeb47a6929f0811ed1' => __DIR__ . '/..' . '/topthink/think-worker/src/command.php',
|
'ffc1d7141d4fcbaeb47a6929f0811ed1' => __DIR__ . '/..' . '/topthink/think-worker/src/command.php',
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -36,25 +33,6 @@ class ComposerStaticInit296bd8a1d28e39d56dcd80ce7be249f3
|
|||||||
'Workerman\\' => 10,
|
'Workerman\\' => 10,
|
||||||
'WebSocket\\' => 10,
|
'WebSocket\\' => 10,
|
||||||
),
|
),
|
||||||
'S' =>
|
|
||||||
array (
|
|
||||||
'Symfony\\Polyfill\\Php80\\' => 23,
|
|
||||||
'Symfony\\Polyfill\\Mbstring\\' => 26,
|
|
||||||
'Symfony\\Component\\Routing\\' => 26,
|
|
||||||
'Symfony\\Component\\HttpFoundation\\' => 33,
|
|
||||||
),
|
|
||||||
'R' =>
|
|
||||||
array (
|
|
||||||
'React\\Stream\\' => 13,
|
|
||||||
'React\\Socket\\' => 13,
|
|
||||||
'React\\Promise\\' => 14,
|
|
||||||
'React\\Http\\' => 11,
|
|
||||||
'React\\EventLoop\\' => 16,
|
|
||||||
'React\\Dns\\' => 10,
|
|
||||||
'React\\Cache\\' => 12,
|
|
||||||
'Ratchet\\RFC6455\\' => 16,
|
|
||||||
'Ratchet\\' => 8,
|
|
||||||
),
|
|
||||||
'P' =>
|
'P' =>
|
||||||
array (
|
array (
|
||||||
'Psr\\Log\\' => 8,
|
'Psr\\Log\\' => 8,
|
||||||
@@ -80,14 +58,6 @@ class ComposerStaticInit296bd8a1d28e39d56dcd80ce7be249f3
|
|||||||
'GuzzleHttp\\' => 11,
|
'GuzzleHttp\\' => 11,
|
||||||
'GatewayWorker\\' => 14,
|
'GatewayWorker\\' => 14,
|
||||||
),
|
),
|
||||||
'F' =>
|
|
||||||
array (
|
|
||||||
'Fig\\Http\\Message\\' => 17,
|
|
||||||
),
|
|
||||||
'E' =>
|
|
||||||
array (
|
|
||||||
'Evenement\\' => 10,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $prefixDirsPsr4 = array (
|
public static $prefixDirsPsr4 = array (
|
||||||
@@ -115,58 +85,6 @@ class ComposerStaticInit296bd8a1d28e39d56dcd80ce7be249f3
|
|||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/textalk/websocket/lib',
|
0 => __DIR__ . '/..' . '/textalk/websocket/lib',
|
||||||
),
|
),
|
||||||
'Symfony\\Polyfill\\Php80\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
|
|
||||||
),
|
|
||||||
'Symfony\\Polyfill\\Mbstring\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
|
|
||||||
),
|
|
||||||
'Symfony\\Component\\Routing\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/symfony/routing',
|
|
||||||
),
|
|
||||||
'Symfony\\Component\\HttpFoundation\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/symfony/http-foundation',
|
|
||||||
),
|
|
||||||
'React\\Stream\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/react/stream/src',
|
|
||||||
),
|
|
||||||
'React\\Socket\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/react/socket/src',
|
|
||||||
),
|
|
||||||
'React\\Promise\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/react/promise/src',
|
|
||||||
),
|
|
||||||
'React\\Http\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/react/http/src',
|
|
||||||
),
|
|
||||||
'React\\EventLoop\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/react/event-loop/src',
|
|
||||||
),
|
|
||||||
'React\\Dns\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/react/dns/src',
|
|
||||||
),
|
|
||||||
'React\\Cache\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/react/cache/src',
|
|
||||||
),
|
|
||||||
'Ratchet\\RFC6455\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/ratchet/rfc6455/src',
|
|
||||||
),
|
|
||||||
'Ratchet\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/cboden/ratchet/src/Ratchet',
|
|
||||||
),
|
|
||||||
'Psr\\Log\\' =>
|
'Psr\\Log\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
|
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
|
||||||
@@ -220,23 +138,10 @@ class ComposerStaticInit296bd8a1d28e39d56dcd80ce7be249f3
|
|||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/workerman/gateway-worker/src',
|
0 => __DIR__ . '/..' . '/workerman/gateway-worker/src',
|
||||||
),
|
),
|
||||||
'Fig\\Http\\Message\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/fig/http-message-util/src',
|
|
||||||
),
|
|
||||||
'Evenement\\' =>
|
|
||||||
array (
|
|
||||||
0 => __DIR__ . '/..' . '/evenement/evenement/src',
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public static $classMap = array (
|
public static $classMap = array (
|
||||||
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
|
||||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||||
'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
|
|
||||||
'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
|
||||||
'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
|
|
||||||
'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
|
|||||||
@@ -1209,12 +1209,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://gitee.com/drop_drop/general_utility_tools_php.git",
|
"url": "https://gitee.com/drop_drop/general_utility_tools_php.git",
|
||||||
"reference": "f31ce1f3910b7522d37a796759722f7f4c785dfe"
|
"reference": "622c42b186706c0d7354d04b8c957fe715d0c177"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"ext-json": "*"
|
"ext-json": "*"
|
||||||
},
|
},
|
||||||
"time": "2024-06-27T03:06:27+00:00",
|
"time": "2024-07-16T13:13:35+00:00",
|
||||||
"default-branch": true,
|
"default-branch": true,
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"installation-source": "source",
|
"installation-source": "source",
|
||||||
@@ -1223,6 +1223,7 @@
|
|||||||
"wanghua\\general_utility_tools_php\\": "src/"
|
"wanghua\\general_utility_tools_php\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
"Apache-2.0"
|
"Apache-2.0"
|
||||||
],
|
],
|
||||||
|
|||||||
6
digital_doctor/vendor/composer/installed.php
vendored
6
digital_doctor/vendor/composer/installed.php
vendored
@@ -5,7 +5,7 @@
|
|||||||
'type' => 'project',
|
'type' => 'project',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'reference' => '09ae48941229f26b04631d081e85a2f29bf91be2',
|
'reference' => '192dd13412c3c73d9be25f9bfece9451588338bf',
|
||||||
'name' => 'topthink/think',
|
'name' => 'topthink/think',
|
||||||
'dev' => true,
|
'dev' => true,
|
||||||
),
|
),
|
||||||
@@ -189,7 +189,7 @@
|
|||||||
'type' => 'project',
|
'type' => 'project',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
'reference' => '09ae48941229f26b04631d081e85a2f29bf91be2',
|
'reference' => '192dd13412c3c73d9be25f9bfece9451588338bf',
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'topthink/think-installer' => array(
|
'topthink/think-installer' => array(
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
'aliases' => array(
|
'aliases' => array(
|
||||||
0 => '9999999-dev',
|
0 => '9999999-dev',
|
||||||
),
|
),
|
||||||
'reference' => 'f31ce1f3910b7522d37a796759722f7f4c785dfe',
|
'reference' => '622c42b186706c0d7354d04b8c957fe715d0c177',
|
||||||
'dev_requirement' => false,
|
'dev_requirement' => false,
|
||||||
),
|
),
|
||||||
'workerman/gateway-worker' => array(
|
'workerman/gateway-worker' => array(
|
||||||
|
|||||||
160
digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/AlibabaAuth.php
vendored
Normal file
160
digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/AlibabaAuth.php
vendored
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/6/28} {14:36}
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba;
|
||||||
|
|
||||||
|
use wanghua\general_utility_tools_php\http\Curl;
|
||||||
|
use wanghua\general_utility_tools_php\tool\Tools;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权
|
||||||
|
*
|
||||||
|
* 注意:
|
||||||
|
* 分销自研自用版不需要授权,直接使用永久accessToken
|
||||||
|
* 请把当前账号添加为应用的日常测试账号
|
||||||
|
*
|
||||||
|
* Class Auth
|
||||||
|
* @package app\index\logic\alibaba
|
||||||
|
*/
|
||||||
|
class AlibabaAuth
|
||||||
|
{
|
||||||
|
public $base_url = '';//不同业务线,授权地址不一样
|
||||||
|
public $config = [];
|
||||||
|
public function __construct($config)
|
||||||
|
{
|
||||||
|
$this->config = $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
function trusteeshipAuth(){
|
||||||
|
//待开发
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc:授权分为托管式授权和WEB端授权,这里是WEB端授权(后去code临时凭证)
|
||||||
|
*
|
||||||
|
* author:wh
|
||||||
|
* @param string $appKey app注册时,分配给app的唯一标识
|
||||||
|
* @param string $redirect_uri app的入口地址,授权临时令牌会以queryString的形式跟在该url后返回。注意参数中回调地址的域名必须与app注册时填写的回调地址的域名匹配。
|
||||||
|
* @param string $site site参数标识当前授权的站点,直接填写1688
|
||||||
|
* @param string $state 可选,app自定义参数,回跳到redirect_uri时,会原样返回
|
||||||
|
* return 用户输入用户名密码,并确认授权,返回临时授权码code给app,具体返回方式,参照redirect_uri说明
|
||||||
|
*/
|
||||||
|
function webAppAuth($redirect_uri,$site='1688',$state=''){
|
||||||
|
$appKey = $this->config['appkey'];
|
||||||
|
|
||||||
|
$url = "https://auth.1688.com/oauth/authorize?client_id={$appKey}&site={$site}&redirect_uri={$redirect_uri}&state={$state}";
|
||||||
|
|
||||||
|
|
||||||
|
//$res = Curl::curl_post($url,[]);
|
||||||
|
return "<script>location.href='{$url}'</script>";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc:使用code获取令牌【code有效期(2分钟)】
|
||||||
|
*
|
||||||
|
* 注:此接口必须使用POST方法提交;必须使用https
|
||||||
|
getToken接口参数说明:
|
||||||
|
a) grant_type为授权类型,使用authorization_code即可
|
||||||
|
b) need_refresh_token为是否需要返回refresh_token,如果返回了refresh_token,原来获取的refresh_token也不会失效,除非超过半年有效期
|
||||||
|
c) client_id为app唯一标识,即appKey
|
||||||
|
d) client_secret为app密钥
|
||||||
|
e) redirect_uri为app入口地址
|
||||||
|
f) code为授权完成后返回的一次性令牌
|
||||||
|
g) 调用getToken接口不需要签名
|
||||||
|
注:如果超过code有效期(2分钟)或者已经使用code获取了一次令牌,code都将失效,需要返回第二步重新获取code
|
||||||
|
* author:wh
|
||||||
|
*/
|
||||||
|
function getTokenByCode($code,$redirect_uri){
|
||||||
|
$appkey = $this->config['appkey'];
|
||||||
|
$secret = $this->config['appsecret'];
|
||||||
|
$url = "https://gw.open.1688.com/openapi/";
|
||||||
|
$urlPath = "http/1/system.oauth2/getToken/".$appkey;
|
||||||
|
$paramstr = "?grant_type=authorization_code&need_refresh_token=true&client_id={$appkey}&client_secret={$secret}&redirect_uri={$redirect_uri}&code={$code}";
|
||||||
|
|
||||||
|
$url = $url.$urlPath.$paramstr;
|
||||||
|
return Curl::curl_post($url,[]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成签名
|
||||||
|
*
|
||||||
|
1、 构造urlPath。urlPath是url 中的一部分,从协议开始截取,到“?”为止,包含了协议、namespace、apiName和apiVersion,如urlPath=http/1/system/currentTime/1688
|
||||||
|
|
||||||
|
2、 拼装参数。首先将所有参数按照key+value拼装得到一个字符串数组(如[b1,a2]),然后对数组进行排序([a2,b1]),最后将排序后的数组合并为字符串(a2b1)
|
||||||
|
|
||||||
|
3、 合并。把前两步的字符串拼接(http/1/system/currentTime/1688a2b1)
|
||||||
|
|
||||||
|
4、 执行hmac_sha1算法。 Signature=uppercase (hex (hmac_sha1 (concatString, secretKey)),假设secretKey=test123,那么得到的签名为2F1E96587451DE0E171978F4AAE1A90FF9B2F94B
|
||||||
|
|
||||||
|
a) concatString为合并后的字符串
|
||||||
|
|
||||||
|
b) secretKey为签名密钥,与urlPath中的appKey(1000000)对应
|
||||||
|
|
||||||
|
c) hmac_sha1为通用的hmac_sha1算法,各编程语言一般都对应类库
|
||||||
|
|
||||||
|
d) hex为转为十六进制
|
||||||
|
|
||||||
|
e) uppercase为转为大写字符
|
||||||
|
* author:wh
|
||||||
|
* @param string $urlPath eg: param2/1/com.alibaba.trade/alibaba.trade.fastCreateOrder/7571561
|
||||||
|
* @param array $params 请求参数
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function signature($urlPath,$params)
|
||||||
|
{
|
||||||
|
$accessToken = $this->config['accessToken'];
|
||||||
|
$params['access_token'] = $accessToken;
|
||||||
|
//$url = 'http://gw.open.1688.com/openapi';//1688开放平台使用gw.open.1688.com域名
|
||||||
|
//$appKey = $this->config['appkey'];
|
||||||
|
$appSecret = $this->config['appsecret'];
|
||||||
|
|
||||||
|
//dump('$urlPath: '.$urlPath);
|
||||||
|
//$apiInfo = 'param2/1/system/currentTime/' . $appKey;//此处请用具体api进行替换
|
||||||
|
//$urlPath = $urlPath . $appKey;//此处请用具体api进行替换
|
||||||
|
|
||||||
|
//配置参数,请用apiInfo对应的api参数进行替换
|
||||||
|
$aliParams = array();
|
||||||
|
foreach ($params as $key => $val) {
|
||||||
|
$aliParams[] = $key . $val;
|
||||||
|
}
|
||||||
|
sort($aliParams);
|
||||||
|
$sign_str = join('', $aliParams);
|
||||||
|
$sign_str = $urlPath . $sign_str;
|
||||||
|
$code_sign = strtoupper(bin2hex(hash_hmac("sha1", $sign_str, $appSecret, true)));
|
||||||
|
|
||||||
|
return $code_sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc:发起请求,自动完成签名并返回结果
|
||||||
|
* author:wh
|
||||||
|
* @param string $urlPath eg: param2/1/com.alibaba.trade/alibaba.trade.fastCreateOrder/23222222
|
||||||
|
* @param array $request_data 接口请求数据
|
||||||
|
*/
|
||||||
|
function request($urlPath, $request_data){
|
||||||
|
set_time_limit(0);
|
||||||
|
$request_params_str = '';
|
||||||
|
foreach ($request_data as $k=>$v){
|
||||||
|
if($request_params_str == ''){
|
||||||
|
$request_params_str .= $k.'='.$v;
|
||||||
|
}else{
|
||||||
|
$request_params_str .= '&'.$k.'='.$v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$accessToken = $this->config['accessToken'];
|
||||||
|
//dump($request_params_str);
|
||||||
|
$_aop_signature = $this->signature($urlPath,$request_data);
|
||||||
|
//dump($_aop_signature);
|
||||||
|
//$request_data['_aop_signature'] = $_aop_signature;
|
||||||
|
|
||||||
|
$url = $this->base_url.$urlPath.'?'.$request_params_str.'&access_token='.$accessToken.'&_aop_signature='.$_aop_signature;
|
||||||
|
//dump($url);
|
||||||
|
$res = Curl::curl_post($url,[]);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/BaseStrict.php
vendored
Normal file
23
digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/BaseStrict.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/6/29} {12:23}
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba\distributes;
|
||||||
|
|
||||||
|
|
||||||
|
class BaseStrict
|
||||||
|
{
|
||||||
|
public $base_url = 'https://gw.open.1688.com/openapi/';
|
||||||
|
//授权对象
|
||||||
|
protected $authObj = null;
|
||||||
|
public function __construct($authObj)
|
||||||
|
{
|
||||||
|
$this->authObj = $authObj;
|
||||||
|
//初始化并设置当前模块的基础url
|
||||||
|
$this->authObj->base_url = $this->base_url;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/README.MD
vendored
Normal file
3
digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/README.MD
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## distributes 分销模块
|
||||||
|
|
||||||
|
### strict 分销中严选模块(商家自营)
|
||||||
144
digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/Testexample.php
vendored
Normal file
144
digital_doctor/vendor/wanghua/general-utility-tools-php/src/alibaba/distributes/Testexample.php
vendored
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/6/29} {12:57}
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba\distributes;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\TabConf;
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\AlibabaAuth;
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\strict\CustomerService;
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\strict\StrictCategory;
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\strict\StrictGoods;
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\strict\StrictLogistics;
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\strict\StrictOrder;
|
||||||
|
use think\Db;
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\strict\StrictPay;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试案例
|
||||||
|
*
|
||||||
|
* Class Testexample
|
||||||
|
* @package wanghua\general_utility_tools_php\alibaba\distributes
|
||||||
|
*/
|
||||||
|
class Testexample
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* desc:查询订单是否开通免密支付
|
||||||
|
*/
|
||||||
|
function queryOrderIsNoPassPay(){
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$obj = new StrictPay($authObj);
|
||||||
|
return $obj->queryOrderIsNoPassPay();
|
||||||
|
}
|
||||||
|
function getLogisticsTemplate(){
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$obj = new StrictLogistics($authObj);
|
||||||
|
return $obj->getLogisticsTemplate();
|
||||||
|
}
|
||||||
|
//物流模板详情
|
||||||
|
function getLogisticsTemplateDetail($template_id){
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$obj = new StrictLogistics($authObj);
|
||||||
|
return $obj->getLogisticsTemplateDetail($template_id);
|
||||||
|
}
|
||||||
|
function getGoodsList($where){
|
||||||
|
set_time_limit(0);
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$obj = new StrictGoods($authObj);
|
||||||
|
return $obj->getGoodsList($where);
|
||||||
|
}
|
||||||
|
function getGoodsListsPft($where){
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$obj = new StrictGoods($authObj);
|
||||||
|
return $obj->getGoodsListsPft($where);
|
||||||
|
}
|
||||||
|
function getGoodsDetail(array $itemIds){
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$obj = new StrictGoods($authObj);
|
||||||
|
return $obj->getGoodsDetail($itemIds);
|
||||||
|
}
|
||||||
|
function getCategoryByCID($category_id){
|
||||||
|
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$obj = new StrictCategory($authObj);
|
||||||
|
return $obj->getCategoryByCID($category_id);
|
||||||
|
}
|
||||||
|
function testGetRootCategory(){
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$obj = new StrictCategory($authObj);
|
||||||
|
return $obj->getRootCategory();
|
||||||
|
}
|
||||||
|
|
||||||
|
function testWebAuth($redirect_uri){
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$res = (new AlibabaAuth($config))->webAppAuth($redirect_uri);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
function getTokenByCode($code,$redirect_uri){
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$res = (new AlibabaAuth($config))->getTokenByCode($code,$redirect_uri);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
//测试创建订单
|
||||||
|
function createOrder(){
|
||||||
|
$order_info = Db::table(TabConf::$fa_order)
|
||||||
|
->where('orderid','mm70wgex1719586377768')
|
||||||
|
->find();
|
||||||
|
$address = Db::table(TabConf::$fa_useraddress)
|
||||||
|
->where('id',$order_info['useraddress_id'])
|
||||||
|
->where('users_id',$order_info['users_id'])
|
||||||
|
->find();
|
||||||
|
$goods = Db::table(TabConf::$fa_goods)
|
||||||
|
->where('id',$order_info['goods_id'])
|
||||||
|
->find();
|
||||||
|
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$order = new StrictOrder($authObj);
|
||||||
|
$order->setAddress($address);
|
||||||
|
$order->setGoods($goods,$order_info['buy_num']);
|
||||||
|
return $order->createOrder($order_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
function previewOrder(){
|
||||||
|
$order_info = Db::table(TabConf::$fa_order)
|
||||||
|
->where('orderid','mm70wgex1719586377768')
|
||||||
|
->find();
|
||||||
|
$address = Db::table(TabConf::$fa_useraddress)
|
||||||
|
->where('id',$order_info['useraddress_id'])
|
||||||
|
->where('users_id',$order_info['users_id'])
|
||||||
|
->find();
|
||||||
|
$goods = Db::table(TabConf::$fa_goods)
|
||||||
|
->where('id',$order_info['goods_id'])
|
||||||
|
->find();
|
||||||
|
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$order = new StrictOrder($authObj);
|
||||||
|
$order->setAddress($address);
|
||||||
|
$order->setGoods($goods,$order_info['buy_num']);
|
||||||
|
return $order->previewOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取唤起旺旺聊天的链接
|
||||||
|
function getCustomerServiceLink($toOpenUid){
|
||||||
|
$config = config('meebo_supply_config');
|
||||||
|
$authObj = new AlibabaAuth($config);
|
||||||
|
$order = new CustomerService($authObj);
|
||||||
|
return $order->getCustomerServiceLink($toOpenUid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/7/9} {13:42}
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba\distributes\notify;
|
||||||
|
|
||||||
|
use wanghua\general_utility_tools_php\Mmodel;
|
||||||
|
use wanghua\general_utility_tools_php\tool\Tools;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 弃用,通知属于业务模块,直接在业务控制器中处理,这里仅作参考
|
||||||
|
* 分销严选消息通知基类
|
||||||
|
*
|
||||||
|
* 初始化该基类,按需调用通知处理类
|
||||||
|
*
|
||||||
|
* Class BaseStrictNotify
|
||||||
|
* @package app\index\logic\alibaba\distributes\notify
|
||||||
|
*/
|
||||||
|
class BaseStrictNotify
|
||||||
|
{
|
||||||
|
|
||||||
|
private $object = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc:执行消息处理
|
||||||
|
* author:wh
|
||||||
|
* @param $callback
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function doMessage($callback=null){
|
||||||
|
return Mmodel::catch(function () use ($callback){
|
||||||
|
Tools::log_to_write_txt(['执行消息处理']);
|
||||||
|
//根据消息类型,选择对应的处理类
|
||||||
|
$message_data = input('message');
|
||||||
|
if(empty($message_data)){
|
||||||
|
return Tools::set_fail('message为空');
|
||||||
|
}
|
||||||
|
$message_data = json_decode($message_data,true);
|
||||||
|
Tools::log_to_write_txt(['消息解码'=>$message_data]);
|
||||||
|
if(empty($message_data['type'])){
|
||||||
|
return Tools::set_fail('type为空');
|
||||||
|
}
|
||||||
|
//获取消息类型
|
||||||
|
$fn = strtolower($message_data['type']);//类型即为方法名
|
||||||
|
//消息类型前缀即为类名
|
||||||
|
$class = '\\app\\index\\logic\\alibaba\\distributes\\notify\\'.ucfirst(explode('_',$fn)[0]).'Notify';
|
||||||
|
$this->object = (new $class());//实例化类
|
||||||
|
return $this->object->{$fn}($callback);//调用方法
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/7/9} {13:25}
|
||||||
|
*/
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba\distributes\notify;
|
||||||
|
|
||||||
|
use app\index\logic\alibaba\distributes\Testexample;
|
||||||
|
use wanghua\general_utility_tools_php\Mmodel;
|
||||||
|
use wanghua\general_utility_tools_php\tool\Tools;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 弃用,通知属于业务模块,直接在业务控制器中处理,这里仅作参考
|
||||||
|
* 产品 消息通知
|
||||||
|
*
|
||||||
|
* Class ProductNotify
|
||||||
|
* @package app\index\logic\alibaba\distributes\notify
|
||||||
|
*/
|
||||||
|
class ProductNotify extends BaseStrictNotify
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated 弃用,通知属于业务模块,直接在业务控制器中处理,这里仅作参考
|
||||||
|
* desc:商品上架通知
|
||||||
|
* author:wh
|
||||||
|
*
|
||||||
|
* 输出message
|
||||||
|
{"message":"{\"data\":{\"productIds\":\"107680826\",\"msgSendTime\":\"2018-05-30 20:29:37\",\"memberId\":\"shyxsscl\",\"status\":\"RELATION_VIEW_PRODUCT_REPOST\"},\"gmtBorn\":1720514151217,\"msgId\":88922343751,\"type\":\"PRODUCT_RELATION_VIEW_PRODUCT_REPOST\",\"userInfo\":\"b2b-1881150273\"}","_aop_signature":"03EB6538BB8864BC141ADB5A4923005BB0204F85"}
|
||||||
|
*/
|
||||||
|
function product_relation_view_product_repost($callback=null)
|
||||||
|
{
|
||||||
|
return Mmodel::catch(function () use ($callback){
|
||||||
|
$message_data = input('message');
|
||||||
|
if(empty($message_data)){
|
||||||
|
return Tools::set_fail('message不能为空');
|
||||||
|
}
|
||||||
|
$message_data = json_decode($message_data,true);
|
||||||
|
if(empty($message_data['data'])){
|
||||||
|
return Tools::set_fail('data不能为空');
|
||||||
|
}
|
||||||
|
$productIds = $data['productIds'];//商品ID集合,至少有一个,用逗号分割
|
||||||
|
$productIdsArr = explode(',',$productIds);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#这是异步通知案例
|
||||||
|
|
||||||
|
##业务逻辑自行编写
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/7/9} {0:43}
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba\distributes\strict;
|
||||||
|
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\BaseStrict;
|
||||||
|
|
||||||
|
class CustomerService extends BaseStrict
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc:获取唤起旺旺聊天的链接
|
||||||
|
* author:wh
|
||||||
|
* @param $toOpenUid
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function getCustomerServiceLink($toOpenUid){
|
||||||
|
$urlPath = "param2/1/com.alibaba.account/account.wangwangUrl.get/".$this->authObj->config['appkey'];
|
||||||
|
|
||||||
|
return $this->authObj->request($urlPath, ['toOpenUid'=>$toOpenUid]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
## 分销严选模块
|
||||||
|
只能使用分销严选方案里的接口
|
||||||
|
DOC:
|
||||||
|
https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.product:alibaba.category.get-1&aopApiCategory=category_new
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/6/29} {12:12}
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba\distributes\strict;
|
||||||
|
|
||||||
|
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\BaseStrict;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类目Id查询类目
|
||||||
|
*
|
||||||
|
* 传0获取所有一级类目,循环调用可以获取类目树
|
||||||
|
*
|
||||||
|
* 注意:类目id,必须大于等于0, 如果为0,则查询所有一级类目
|
||||||
|
*
|
||||||
|
* 类目查询。如果需要获取所有1688类目信息,需要从根类目开始遍历获取整个类目树。
|
||||||
|
* 即:先传0获取所有一级类目ID,然后在通过获取到的一级类目ID遍历获取所二级类目,最后通过遍历二级类目ID获取三级类目。
|
||||||
|
* 注意:1688类目仅三级,三级类目即发布商品所需的叶子类目。
|
||||||
|
*
|
||||||
|
* doc: https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.product:alibaba.category.get-1&aopApiCategory=category_new
|
||||||
|
* Class StrictCategory
|
||||||
|
* @package app\index\logic\alibaba\distributes\strict
|
||||||
|
*/
|
||||||
|
class StrictCategory extends BaseStrict
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct($authObj)
|
||||||
|
{
|
||||||
|
parent::__construct($authObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc:获取严选一级分类(顶级分类)
|
||||||
|
* author:wh
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function getRootCategory(){
|
||||||
|
//$base_url = "https://gw.open.1688.com/openapi/";
|
||||||
|
$urlPath = "param2/1/com.alibaba.product/alibaba.category.get/".$this->authObj->config['appkey'];
|
||||||
|
|
||||||
|
$request_data = [];
|
||||||
|
$request_data['categoryID'] = '0';
|
||||||
|
return $this->authObj->request($urlPath,$request_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc:根据类目id获取类目信息
|
||||||
|
* author:wh
|
||||||
|
* @param $category_id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function getCategoryByCID($category_id){
|
||||||
|
$urlPath = "param2/1/com.alibaba.product/alibaba.category.get/".$this->authObj->config['appkey'];
|
||||||
|
$request_data = [];
|
||||||
|
$request_data['categoryID'] = $category_id;
|
||||||
|
return $this->authObj->request($urlPath,$request_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/6/30} {1:54}
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba\distributes\strict;
|
||||||
|
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\BaseStrict;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流
|
||||||
|
* Class StrictLogistics
|
||||||
|
* @package app\index\logic\alibaba\distributes\strict
|
||||||
|
*/
|
||||||
|
class StrictLogistics extends BaseStrict
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取物流模板详情
|
||||||
|
*
|
||||||
|
* 根据物流模版ID获取卖家的物流模板。运费模板ID为0表示运费说明,为1表示卖家承担运费
|
||||||
|
*
|
||||||
|
* doc:https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.logistics:alibaba.logistics.myFreightTemplate.list.get-1&aopApiCategory=Logistics_NEW
|
||||||
|
*/
|
||||||
|
function getLogisticsTemplateDetail($template_id){
|
||||||
|
$urlPath = "param2/1/com.alibaba.logistics/alibaba.logistics.myFreightTemplate.list.get/".$this->authObj->config['appkey'];
|
||||||
|
|
||||||
|
return $this->authObj->request($urlPath, ['templateId'=>$template_id]);
|
||||||
|
}
|
||||||
|
function getLogisticsTemplate(){
|
||||||
|
$urlPath = "param2/1/com.alibaba.logistics/alibaba.logistics.myFreightTemplate.list.get/".$this->authObj->config['appkey'];
|
||||||
|
|
||||||
|
return $this->authObj->request($urlPath, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,250 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/6/28} {15:11}
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba\distributes\strict;
|
||||||
|
|
||||||
|
use think\Exception;
|
||||||
|
use wanghua\general_utility_tools_php\http\Curl;
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\BaseStrict;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销订单
|
||||||
|
* Class Order
|
||||||
|
* @package app\index\logic\alibaba\distributes
|
||||||
|
*/
|
||||||
|
class StrictOrder extends BaseStrict
|
||||||
|
{
|
||||||
|
//用户收货地址
|
||||||
|
private $address = [];
|
||||||
|
//商品信息
|
||||||
|
private $goods = [];
|
||||||
|
//发票信息
|
||||||
|
private $invoice = [];
|
||||||
|
//交易类型 由于不同的商品支持的交易方式不同,没有一种交易方式是全局通用的,所以当前下单可使用的交易方式必须通过下单预览接口的tradeModeNameList获取。
|
||||||
|
private $tradeType = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc:收货地址说明
|
||||||
|
1、使用保存的收货地址传参示例:{"addressId":593861699},其中addressId是调用“买家获取保存的收货地址信息列表”接口获取;
|
||||||
|
2、使用地址编码传参示例:{"address":"桃浦镇 金达路888号贸易8楼","phone": "0517-88990077","mobile": "15251667788","fullName": "张三","postCode": "000000","districtCode": "310107"},其中districtCode需要调用“根据地址解析地区码”接口获取;
|
||||||
|
3、直接使用文本地址示例:{"address":"网商路699号","phone": "0517-88990077","mobile": "15251667788","fullName": "张三","postCode": "000000","areaText": "滨江区","townText": "","cityText": "杭州市","provinceText": "浙江省"},省市区要传文本;
|
||||||
|
4、优先级说明,如果同时传入以上参数,系统按从1至3的优先级获取地址,满足1的条件下不会使用上示2中的参数,满足2的条件下不会使用上示3中的参数;
|
||||||
|
* author:wh
|
||||||
|
* @param $address
|
||||||
|
*/
|
||||||
|
function setAddress($address){
|
||||||
|
//{
|
||||||
|
//"address":"网商路699号",
|
||||||
|
//"phone":"0517-88990077",
|
||||||
|
//"mobile":"15251667788",
|
||||||
|
//"fullName":"张三",
|
||||||
|
//"postCode":"000000",
|
||||||
|
//"areaText":"滨江区",
|
||||||
|
//"townText":"",
|
||||||
|
//"cityText":"杭州市",
|
||||||
|
//"provinceText":"浙江省"
|
||||||
|
//}
|
||||||
|
//用户收货地址
|
||||||
|
$this->address = [
|
||||||
|
//'addressId'=>$address['id'],
|
||||||
|
'address'=>$address['address'],//街道地 网商路699号
|
||||||
|
'phone'=>$address['mobile'],//电话 0517-88990077
|
||||||
|
'mobile'=>$address['mobile'],//手机
|
||||||
|
'fullName'=>$address['name'],
|
||||||
|
'postCode'=>'000000',//邮编 000000
|
||||||
|
'areaText'=>$address['area'],//区文本
|
||||||
|
'townText'=>$address['town'],//镇文本
|
||||||
|
'cityText'=>$address['city'],//市文本
|
||||||
|
'provinceText'=>$address['provice'],//省份文本
|
||||||
|
//'districtCode'=>'000000',//地址编码 310107
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
function setGoods($goods,$buy_num){
|
||||||
|
$this->goods = [
|
||||||
|
'offerId'=>$goods['offerid'],
|
||||||
|
'specId'=>$goods['specid'],//商品规格id
|
||||||
|
'quantity'=>$buy_num,//$goods['quantity'],//商品数量(计算金额用)
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* desc:创建分销订单
|
||||||
|
*
|
||||||
|
* 获取订单运费,请调用预览订单接口 alibaba.createOrder.preview
|
||||||
|
* author:wh
|
||||||
|
*/
|
||||||
|
function createOrder($order){
|
||||||
|
if(empty($this->authObj)){
|
||||||
|
throw new Exception('未初始化授权对象');
|
||||||
|
}
|
||||||
|
if(empty($this->address)){
|
||||||
|
throw new Exception('未设置收货地址');
|
||||||
|
}
|
||||||
|
if(empty($this->goods)){
|
||||||
|
throw new Exception('未设置商品信息');
|
||||||
|
}
|
||||||
|
//$base_url = "https://gw.open.1688.com/openapi/";
|
||||||
|
$urlPath = "param2/1/com.alibaba.trade/alibaba.trade.fastCreateOrder/".$this->authObj->config['appkey'];
|
||||||
|
|
||||||
|
if(empty($this->tradeType)){
|
||||||
|
throw new Exception('交易类型必须');
|
||||||
|
}
|
||||||
|
$request_data = ['tradeType'=>$this->tradeType];
|
||||||
|
|
||||||
|
//boutiquefenxiao(新分销严选)
|
||||||
|
$request_data['flow'] = 'boutiquefenxiao';
|
||||||
|
$request_data['isvBizTypeStr'] = 'fenxiaoMedia';
|
||||||
|
|
||||||
|
$request_data['message'] = $order['remark'];//买家留言
|
||||||
|
//地址
|
||||||
|
$request_data['addressParam'] = json_encode($this->address,JSON_UNESCAPED_UNICODE);
|
||||||
|
//商品信息
|
||||||
|
$request_data['cargoParamList'] = json_encode($this->goods,JSON_UNESCAPED_UNICODE);
|
||||||
|
//发票信息
|
||||||
|
$request_data['invoiceParam'] = json_encode($this->invoice,JSON_UNESCAPED_UNICODE);
|
||||||
|
|
||||||
|
$res = $this->authObj->request($urlPath, $request_data);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建订单前预览数据接口
|
||||||
|
*
|
||||||
|
* 订单创建只允许购买同一个供应商的商品。
|
||||||
|
* 本接口返回创建订单相关的优惠等信息。
|
||||||
|
* 1、校验商品数据是否允许订购。 2、校验代销关系 3、校验库存、起批量、是否满足混批条件
|
||||||
|
*
|
||||||
|
* doc: https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.createOrder.preview-1&aopApiCategory=trade_new
|
||||||
|
*/
|
||||||
|
function previewOrder(){
|
||||||
|
$urlPath = "param2/1/com.alibaba.trade/alibaba.createOrder.preview/".$this->authObj->config['appkey'];
|
||||||
|
$request_data = [];
|
||||||
|
//boutiquefenxiao(新分销严选)
|
||||||
|
$request_data['flow'] = 'boutiquefenxiao';
|
||||||
|
//$request_data['isvBizTypeStr'] = 'fenxiaoMedia';
|
||||||
|
|
||||||
|
//$request_data['message'] = $order['remark'];//买家留言
|
||||||
|
//地址
|
||||||
|
$request_data['addressParam'] = json_encode($this->address,JSON_UNESCAPED_UNICODE);
|
||||||
|
//商品信息
|
||||||
|
$request_data['cargoParamList'] = json_encode($this->goods,JSON_UNESCAPED_UNICODE);
|
||||||
|
//发票信息
|
||||||
|
$request_data['invoiceParam'] = json_encode($this->invoice,JSON_UNESCAPED_UNICODE);
|
||||||
|
|
||||||
|
$res = $this->authObj->request($urlPath, $request_data);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消交易
|
||||||
|
*
|
||||||
|
* 买家或者卖家取消交易,注意只有特定状态的交易才能取消,1688可用于取消未付款的订单。
|
||||||
|
*
|
||||||
|
* doc: https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.cancel-1&aopApiCategory=trade_new
|
||||||
|
*
|
||||||
|
* author:wh
|
||||||
|
* @param string $order_id 订单号
|
||||||
|
* @param string $cancelReason 原因描述;buyerCancel:买家取消订单;sellerGoodsLack:卖家库存不足;other:其它
|
||||||
|
*
|
||||||
|
* 返回:{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
function cancelOrder($order_id, $cancelReason, $remark=''){
|
||||||
|
$urlPath = "param2/1/com.alibaba.trade/alibaba.trade.cancel/".$this->authObj->config['appkey'];
|
||||||
|
$request_data = [];
|
||||||
|
$request_data['tradeID'] = $order_id;
|
||||||
|
$request_data['webSite'] = 1688;
|
||||||
|
//原因描述;buyerCancel:买家取消订单;sellerGoodsLack:卖家库存不足;other:其它
|
||||||
|
$request_data['cancelReason'] = $cancelReason;
|
||||||
|
if($remark){
|
||||||
|
$request_data['remark'] = $remark;
|
||||||
|
}
|
||||||
|
$res = $this->authObj->request($urlPath, $request_data);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改订单备忘
|
||||||
|
*
|
||||||
|
* 授权用户为卖家修改卖家备忘,授权用户为买家修改买家备忘 注意:该接口可重复调用,备注内容将覆盖前一次调用
|
||||||
|
*
|
||||||
|
* doc: https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.order.memoAdd-1&aopApiCategory=trade_new
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function updateOrderRemark($order_id,$remark){
|
||||||
|
$urlPath = "param2/1/com.alibaba.trade/alibaba.order.memoAdd/".$this->authObj->config['appkey'];
|
||||||
|
$request_data = [];
|
||||||
|
$request_data['orderId'] = $order_id;
|
||||||
|
$request_data['memo'] = $remark;
|
||||||
|
//备忘图标,目前仅支持数字。1位红色图标,2为蓝色图标,3为绿色图标,4为黄色图标
|
||||||
|
$request_data['remarkIcon'] = 2;
|
||||||
|
|
||||||
|
$res = $this->authObj->request($urlPath, $request_data);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据地址解析地区码
|
||||||
|
*
|
||||||
|
* 根据地址信息,解析地区码
|
||||||
|
*
|
||||||
|
* doc:https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.addresscode.parse-1&aopApiCategory=trade_new
|
||||||
|
*
|
||||||
|
*返回:{
|
||||||
|
"result": {
|
||||||
|
"address": "网商路699号",
|
||||||
|
"addressCode": "330108",
|
||||||
|
"isDefault": false,
|
||||||
|
"latest": false,
|
||||||
|
"postCode": "310051"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
function getAreaCode($address){
|
||||||
|
$urlPath = "param2/1/com.alibaba.trade/alibaba.trade.addresscode.parse/".$this->authObj->config['appkey'];
|
||||||
|
$request_data = [];
|
||||||
|
//地址信息 eg: 浙江省 杭州市 滨江区网商路699号
|
||||||
|
$request_data['addressInfo'] = $address;
|
||||||
|
|
||||||
|
$res = $this->authObj->request($urlPath, $request_data);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易地址代码表详情
|
||||||
|
*
|
||||||
|
* 获取交易地址代码表,该API会返回输入code的详情和该code的下一级地区code.
|
||||||
|
*
|
||||||
|
* doc: https://open.1688.com/api/apidocdetail.htm?id=com.alibaba.trade:alibaba.trade.addresscode.get-1&aopApiCategory=trade_new
|
||||||
|
*
|
||||||
|
* 返回:{
|
||||||
|
"result": {
|
||||||
|
"code": "330108",
|
||||||
|
"name": "滨江区",
|
||||||
|
"parentCode": "330100",
|
||||||
|
"post": "310051",
|
||||||
|
"children": ["330108001",
|
||||||
|
"330108002",
|
||||||
|
"330108003"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
function getAreaCodeDetail($areaCode){
|
||||||
|
$urlPath = "param2/1/com.alibaba.trade/alibaba.trade.addresscode.get/".$this->authObj->config['appkey'];
|
||||||
|
$request_data = [];
|
||||||
|
//地址code码 eg: 330108
|
||||||
|
$request_data['areaCode'] = $areaCode;
|
||||||
|
$request_data['webSite'] = 1688;
|
||||||
|
|
||||||
|
$res = $this->authObj->request($urlPath, $request_data);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* description:
|
||||||
|
* author:wh
|
||||||
|
* email:
|
||||||
|
* createTime:{2024/6/30} {12:14}
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace wanghua\general_utility_tools_php\alibaba\distributes\strict;
|
||||||
|
|
||||||
|
|
||||||
|
use wanghua\general_utility_tools_php\alibaba\distributes\BaseStrict;
|
||||||
|
/**
|
||||||
|
* 支付相关
|
||||||
|
*
|
||||||
|
* Class StrictPay
|
||||||
|
* @package app\index\logic\alibaba\distributes\strict
|
||||||
|
*/
|
||||||
|
class StrictPay extends BaseStrict
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* desc: 查询订单是否开通免密支付
|
||||||
|
* author:wh
|
||||||
|
*/
|
||||||
|
function queryOrderIsNoPassPay(){
|
||||||
|
$urlPath = "param2/1/com.alibaba.trade/alibaba.trade.pay.protocolPay.isopen/".$this->authObj->config['appkey'];
|
||||||
|
$request_data = [];
|
||||||
|
|
||||||
|
$res = $this->authObj->request($urlPath, $request_data);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -122,10 +122,10 @@ class BaseWechatAuthController extends BaseController
|
|||||||
'unionid' => isset($wx_user_info['unionid']) ? $wx_user_info['unionid'] : '',
|
'unionid' => isset($wx_user_info['unionid']) ? $wx_user_info['unionid'] : '',
|
||||||
'privilege' => $wx_user_info['privilege'],
|
'privilege' => $wx_user_info['privilege'],
|
||||||
'sex' => $wx_user_info['sex'],
|
'sex' => $wx_user_info['sex'],
|
||||||
'arm_group' => '',
|
//'arm_group' => '',
|
||||||
'score' => 0,//积分
|
//'score' => 0,//积分
|
||||||
'group_buy_earnings' => 0,//拼团收益
|
//'group_buy_earnings' => 0,//拼团收益
|
||||||
'water_drop_balance' => 0,//水滴
|
//'water_drop_balance' => 0,//水滴
|
||||||
];
|
];
|
||||||
Db::table($this->wechat_user_table_name)
|
Db::table($this->wechat_user_table_name)
|
||||||
->data($data)
|
->data($data)
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ class Tools
|
|||||||
return json_encode($r, JSON_UNESCAPED_UNICODE);
|
return json_encode($r, JSON_UNESCAPED_UNICODE);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* @deprecated 废除,2027年1月1日以后移除
|
||||||
* desc:socket专用json格式
|
* desc:socket专用json格式
|
||||||
*
|
*
|
||||||
* author:wh
|
* author:wh
|
||||||
@@ -243,6 +244,67 @@ class Tools
|
|||||||
];
|
];
|
||||||
return json_encode($json, JSON_UNESCAPED_UNICODE);
|
return json_encode($json, JSON_UNESCAPED_UNICODE);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* desc:socket专用json格式
|
||||||
|
*
|
||||||
|
* author:wh
|
||||||
|
* @param $action
|
||||||
|
* @param string $msg
|
||||||
|
* @param array $items
|
||||||
|
* @param string $method
|
||||||
|
* @return false|string
|
||||||
|
*/
|
||||||
|
static function wss_json($action, $code=200, $msg='ok', $items=[]){
|
||||||
|
$json = [
|
||||||
|
'action'=>$action,//响应业务标识
|
||||||
|
'code'=>$code,//错误码
|
||||||
|
'msg'=>$msg,//错误消息
|
||||||
|
'items'=>$items//返回数据
|
||||||
|
];
|
||||||
|
return json_encode($json, JSON_UNESCAPED_UNICODE);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* desc:成功结果封装
|
||||||
|
*
|
||||||
|
* socket专用json格式
|
||||||
|
*
|
||||||
|
* author:wh
|
||||||
|
* @param $action
|
||||||
|
* @param string $msg
|
||||||
|
* @param array $items
|
||||||
|
* @param string $method
|
||||||
|
* @return false|string
|
||||||
|
*/
|
||||||
|
static function wss_json_ok($action, $msg='ok', $items=[]){
|
||||||
|
$json = [
|
||||||
|
'action'=>$action,//响应业务标识
|
||||||
|
'code'=>200,//错误码
|
||||||
|
'msg'=>$msg,//错误消息
|
||||||
|
'items'=>$items//返回数据
|
||||||
|
];
|
||||||
|
return json_encode($json, JSON_UNESCAPED_UNICODE);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* desc:失败结果封装
|
||||||
|
*
|
||||||
|
* socket专用json格式
|
||||||
|
*
|
||||||
|
* author:wh
|
||||||
|
* @param $action
|
||||||
|
* @param string $msg
|
||||||
|
* @param array $items
|
||||||
|
* @param string $method
|
||||||
|
* @return false|string
|
||||||
|
*/
|
||||||
|
static function wss_json_fail($action, $msg='操作失败.', $items=[]){
|
||||||
|
$json = [
|
||||||
|
'action'=>$action,//响应业务标识
|
||||||
|
'code'=>500,//错误码
|
||||||
|
'msg'=>$msg,//错误消息
|
||||||
|
'items'=>$items//返回数据
|
||||||
|
];
|
||||||
|
return json_encode($json, JSON_UNESCAPED_UNICODE);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* desc:获取框架版本[兼容各个ThinkPHP框架]
|
* desc:获取框架版本[兼容各个ThinkPHP框架]
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user