|
@@ -9,6 +9,8 @@
|
|
|
namespace crmeb\services;
|
|
namespace crmeb\services;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+use crmeb\exceptions\ApiException;
|
|
|
|
|
+
|
|
|
class WithdrawService
|
|
class WithdrawService
|
|
|
{
|
|
{
|
|
|
static $url = 'https://testshuichou.zhuoyankeji.com';
|
|
static $url = 'https://testshuichou.zhuoyankeji.com';
|
|
@@ -25,7 +27,7 @@ class WithdrawService
|
|
|
self::$token = CacheService::get('withdraw_token', '');
|
|
self::$token = CacheService::get('withdraw_token', '');
|
|
|
if (!self::$token) {
|
|
if (!self::$token) {
|
|
|
self::$token = self::login();
|
|
self::$token = self::login();
|
|
|
- CacheService::set('withdraw_token', 500);
|
|
|
|
|
|
|
+ CacheService::set('withdraw_token', self::$token, 500);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -38,18 +40,15 @@ class WithdrawService
|
|
|
'timestamp' => time(),
|
|
'timestamp' => time(),
|
|
|
];
|
|
];
|
|
|
ksort($data);
|
|
ksort($data);
|
|
|
- var_dump($data);
|
|
|
|
|
- echo "\n";
|
|
|
|
|
$signString = http_build_query($data) . '&secret=' . self::$secret;
|
|
$signString = http_build_query($data) . '&secret=' . self::$secret;
|
|
|
- var_dump($signString);
|
|
|
|
|
- echo "\n";
|
|
|
|
|
$sign = md5($signString);
|
|
$sign = md5($signString);
|
|
|
- var_dump($sign);
|
|
|
|
|
- echo "\n";
|
|
|
|
|
$data['sign'] = $sign;
|
|
$data['sign'] = $sign;
|
|
|
- var_dump($data);
|
|
|
|
|
$res = json_decode(self::do_request(self::$url . '/sdk/v1/login', $data, ['content-type:application/json'], true, true), true);
|
|
$res = json_decode(self::do_request(self::$url . '/sdk/v1/login', $data, ['content-type:application/json'], true, true), true);
|
|
|
- var_dump($res);
|
|
|
|
|
|
|
+ if ($res['code'] == 200) {
|
|
|
|
|
+ return $res['token'];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new ApiException($res['msg'] ?? '企业登陆失败');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|