123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- /**
- * @Created by PhpStorm
- * @author: Kirin
- * @day: 2023/12/19
- * @time: 16:09
- */
- namespace crmeb\services;
- class WithdrawService
- {
- static $url = 'https://testshuichou.zhuoyankeji.com';
- // static $url = 'https://api.yeeshui.com';
- static $token;
- static $user_name = '星领测试';
- static $password = '123456';
- static $secret = '2a879ac637d65ced5ed5892e1bf82e4c';
- static $aeskey = '37d65ced5ed5892e';
- public static function init()
- {
- self::$token = CacheService::get('withdraw_token', '');
- if (!self::$token) {
- self::$token = self::login();
- CacheService::set('withdraw_token', 500);
- }
- }
- public static function login()
- {
- $data = [
- 'user_name' => self::$user_name,
- 'password' => self::$password,
- 'timestamp' => time(),
- ];
- ksort($data);
- $signString = http_build_query($data) . '&secret=' . self::$secret;
- var_dump($signString);
- $sign = md5($signString);
- var_dump($sign);
- $data['sign'] = $sign;
- $res = json_decode(HttpService::postRequest(self::$url . '/sdk/v1/login', $data, ['content-type:application/json']), true);
- var_dump($res);
- }
- public static function request($url, $data)
- {
- $url = self::$url . $url;
- $data = ['token' => self::$token, 'data' => $data];
- return json_decode(HttpService::postRequest($url, $data, ['content-type:application/json']), true);
- }
- }
|