From 82bc905b453369f2b5c30091f87ae5beac0ead88 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 4 Aug 2021 16:52:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=88=A9=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/GameApiController.class.php | 18 ++++++++++++++++++ .../Base/Service/GameRebateService.class.php | 5 ++++- .../Tool/GameResource/SbcqClient.class.php | 11 +++++++---- .../Base/Tool/GameResource/XyyClient.class.php | 9 ++++++--- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Application/Admin/Controller/GameApiController.class.php b/Application/Admin/Controller/GameApiController.class.php index a8a5a2c95..7ed10785a 100644 --- a/Application/Admin/Controller/GameApiController.class.php +++ b/Application/Admin/Controller/GameApiController.class.php @@ -12,6 +12,7 @@ use Base\Service\TestingResourceService; use GuzzleHttp\Client; use think\Db; use Base\Tool\GameResource; +use Base\Tool\GameResource\SbcqClient; class GameApiController extends Think { @@ -63,6 +64,23 @@ class GameApiController extends Think { public function send() { + $giftItem = [ + 'id' => 1782, + 'num' => 1, + ]; + $order = [ + 'user_account' => '13110873520', + 'server_id' => '1', + 'role_name' => '十六', + ]; + $client = new SbcqClient(); + /* $result = $client->sendEmail($giftItem, $order); + var_dump($result); */ + + $result = $client->sendGold(25000, $order); + var_dump($result); + + return; // 229 // 231 $game = M('game', 'tab_')->field(['id', 'sdk_version'])->where(['id' => 231])->find(); diff --git a/Application/Base/Service/GameRebateService.class.php b/Application/Base/Service/GameRebateService.class.php index 44bcc4d30..f929b79d3 100644 --- a/Application/Base/Service/GameRebateService.class.php +++ b/Application/Base/Service/GameRebateService.class.php @@ -10,7 +10,7 @@ class GameRebateService { public function sendByOrder($order) { - $gift = M('rebate_gifts', 'tab_')->where(['type' => $order['type'], 'gift_key' => $order['gift_key']])->find(); + $gift = M('rebate_gifts', 'tab_')->where(['base_game_id' => $order['base_game_id'], 'type' => $order['type'], 'gift_key' => $order['gift_key']])->find(); $hasError = false; $sendResult = ''; if ($gift['game_currency'] > 0) { @@ -45,6 +45,9 @@ class GameRebateService case 73: $client = new SbcqClient(); break; + /* case 9: + $client = new SbcqClient(); + break; */ default: throw new \Exception('客户端未实现'); break; diff --git a/Application/Base/Tool/GameResource/SbcqClient.class.php b/Application/Base/Tool/GameResource/SbcqClient.class.php index 16ad9ee85..412439fde 100644 --- a/Application/Base/Tool/GameResource/SbcqClient.class.php +++ b/Application/Base/Tool/GameResource/SbcqClient.class.php @@ -4,6 +4,7 @@ namespace Base\Tool\GameResource; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; +use Think\Log; /** * 双倍传奇-测试资源接口 @@ -18,14 +19,14 @@ class SbcqClient protected $client; private $apis = [ - 'send-gold' => ['uri' => '/sendgold', 'method' => 'get'], - 'send-email' => ['uri' => '/sendemail', 'method' => 'get'], + 'send-gold' => ['uri' => 'sendgold', 'method' => 'post'], + 'send-email' => ['uri' => 'sendemail', 'method' => 'post'], ]; public function __construct() { $this->client = new Client([ - 'base_uri' => 'http://api.tlcq.90wqiji.com/wan/game', + 'base_uri' => 'http://api.tlcq.90wqiji.com/wan/game/', 'timeout' => 10.0, ]); } @@ -61,6 +62,7 @@ class SbcqClient 'form_params' => $params, ]); $result = (string)$response->getBody(); + Log::record('rebate:SBCQ ' . $uri . ' -- '. json_encode($params) . ' -- '. $result); return json_decode($result, true); } @@ -71,6 +73,7 @@ class SbcqClient 'query' => $params, ]); $result = (string)$response->getBody(); + Log::record('rebate:SBCQ ' . $uri . ' -- '. json_encode($params) . ' -- '. $result); return json_decode($result, true); } @@ -87,7 +90,7 @@ class SbcqClient 'num' => $giftItem['num'], 'name' => $giftItem['id'], 'role' => $order['role_name'], - 'content' => '', + 'content' => '您的福利已到账,请查收', ]; $result = $this->api('send-email', $data); diff --git a/Application/Base/Tool/GameResource/XyyClient.class.php b/Application/Base/Tool/GameResource/XyyClient.class.php index 9f145112b..1895f879e 100644 --- a/Application/Base/Tool/GameResource/XyyClient.class.php +++ b/Application/Base/Tool/GameResource/XyyClient.class.php @@ -4,6 +4,7 @@ namespace Base\Tool\GameResource; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; +use Think\Log; /** * 逍遥游之仙魔降世-测试资源接口 @@ -18,9 +19,9 @@ class XyyClient protected $client; private $apis = [ - 'sendgold' => ['uri' => '', 'method' => 'get'], - 'send_email' => ['uri' => '', 'method' => 'get'], - 'self_apply_foster' => ['uri' => '', 'method' => 'get'], + 'send-gold' => ['uri' => '', 'method' => 'get'], + 'send-email' => ['uri' => '', 'method' => 'get'], + 'self-apply-foster' => ['uri' => '', 'method' => 'get'], ]; public function __construct() @@ -62,6 +63,7 @@ class XyyClient 'form_params' => $params, ]); $result = (string)$response->getBody(); + Log::record('rebate:XYY ' . $uri . ' -- '. json_encode($params) . ' -- '. $result); return json_decode($result, true); } @@ -72,6 +74,7 @@ class XyyClient 'query' => $params, ]); $result = (string)$response->getBody(); + Log::record('rebate:XYY ' . $uri . ' -- '. json_encode($params) . ' -- '. $result); return json_decode($result, true); }