From c9cd377d4f89377444fa0542e057030d0cf9b065 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Mon, 17 Aug 2020 19:44:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/GameApiController.class.php | 19 +++++++++++++++---- .../Service/TestingResourceService.class.php | 12 ++++++------ Application/Base/Tool/GameCatClient.class.php | 4 +++- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Application/Admin/Controller/GameApiController.class.php b/Application/Admin/Controller/GameApiController.class.php index d8b43e514..e5db067f7 100644 --- a/Application/Admin/Controller/GameApiController.class.php +++ b/Application/Admin/Controller/GameApiController.class.php @@ -7,7 +7,7 @@ use Admin\Model\SpendModel; use Think\Think; use Base\Tool\Printer; use Base\Tool\TaskClient; -use Base\Service\PromoteService; +use Base\Service\TestingResourceService; use GuzzleHttp\Client; use think\Db; use Base\Tool\GameCatClient; @@ -19,9 +19,20 @@ class GameApiController extends Think { C(api('Config/lists')); } - public function getGameCatPayTypes() { - $gameCatClient = new GameCatClient(); - $result = $gameCatClient->api('get-pay-type'); + public function provice() { + $role = [ + 'role_id' => '1027690927', + 'user_id' => '90319', + 'sdk_version' => 1, + ]; + $order = [ + 'ref_amount' => 10, + 'ref_id' => '8', + 'remark' => 'ELF测试资源发放', + 'order_no' => date('YmdHis') . rand(1000, 9999) . '_1', + ]; + $service = new TestingResourceService(); + $result = $service->provideFromGameCat($order, $role); var_dump($result); } } diff --git a/Application/Base/Service/TestingResourceService.class.php b/Application/Base/Service/TestingResourceService.class.php index 161ee1c5b..5837647cf 100644 --- a/Application/Base/Service/TestingResourceService.class.php +++ b/Application/Base/Service/TestingResourceService.class.php @@ -103,23 +103,23 @@ class TestingResourceService 'roleId' => $role['role_id'], 'amount' => $order['ref_amount'], 'supportItem' => $order['ref_id'], - 'supportType' => 0, + 'supportType' => '0', 'channelUid' => $role['user_id'], 'applyRemark' => $order['remark'], 'applyId' => $order['order_no'], - 'device_type' => $deviceType, + 'device_type' => $role['sdk_version'] == 1 ? 'andriod' : 'ios', ]); - if ($result['code'] == 1 && $result['data']) { + if ($result['state'] == 1 && $result['data']) { return [ 'status' => true, - 'message' => $result['message'], + 'message' => $result['msg'], 'code' => 1, ]; } else { return [ 'status' => false, - 'message' => $result['message'], - 'code' => $result['code'], + 'msg' => $result['msg'], + 'code' => $result['state'], ]; } } diff --git a/Application/Base/Tool/GameCatClient.class.php b/Application/Base/Tool/GameCatClient.class.php index 60b9dbdcb..c92c499ea 100644 --- a/Application/Base/Tool/GameCatClient.class.php +++ b/Application/Base/Tool/GameCatClient.class.php @@ -53,7 +53,6 @@ class GameCatClient $params['channelId'] = $this->channelIds[$deviceType] ?? $this->channelIds['andriod']; $params['timestamp'] = time(); $params[self::SIGN_NAME] = $this->sign($params); - try { return $this->request($api, $params); } catch (\Exception $e) { @@ -78,6 +77,9 @@ class GameCatClient 'form_params' => $params, ]); $result = (string)$response->getBody(); + var_dump($uri); + var_dump($params); + var_dump($result); return json_decode($result, true); }