Kirin 2 anni fa
parent
commit
9eed86560b

+ 5 - 4
app/controller/api/v1/PublicController.php

@@ -33,6 +33,7 @@ use app\services\user\UserInvoiceServices;
 use app\services\user\UserServices;
 use app\services\wechat\WechatUserServices;
 use app\webscoket\SocketPush;
+use crmeb\services\WithdrawService;
 use Joypack\Tencent\Map\Bundle\Location;
 use Joypack\Tencent\Map\Bundle\LocationOption;
 use app\Request;
@@ -56,10 +57,10 @@ class PublicController extends BaseController
         return app('json')->successful(compact('version', 'apk'));
     }
 
-//    public function test()
-//    {
-//        var_dump(app()->make(IntegralJob::class)->autoExtract(app()->make(UserAwardIntegralServices::class)->getPrice()));
-//    }
+    public function test()
+    {
+        WithdrawService::login();
+    }
 
     /**
      * 主页获取

+ 55 - 0
crmeb/services/WithdrawService.php

@@ -0,0 +1,55 @@
+<?php
+/**
+ * @Created by PhpStorm
+ * @author: Kirin
+ * @day: 2023/12/19
+ * @time: 16:09
+ */
+
+namespace crmeb\services;
+
+
+class WithdrawService
+{
+    static $url = 'http://testshuichou.zhuoyankeji.com';
+    //    static $url = 'https://api.yeeshui.com';
+    static $token;
+    static $user_name = '';
+    static $password = '';
+    static $secret = '';
+    static $aeskey = '';
+
+
+    public 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::$user_name,
+            'timestamp' => time(),
+        ];
+        ksort($data);
+        $signString = http_build_query($data) . '&secret=' . self::$secret;
+        $sign = md5($signString);
+        $data['sign'] = $sign;
+        $res = HttpService::postRequest(self::$url . '/sdk/v1/login', $data, ['content-type:application/json']);
+        dump($res);
+    }
+
+
+    public static function request($url, $data)
+    {
+        $url = self::$url . $url;
+        $data = ['token' => self::$token, 'data' => $data];
+        return HttpService::postRequest($url, $data, ['content-type:application/json']);
+    }
+}