From 07c95d2ea7fab1e61ca5c20e073c868324f3e7dc Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 20 Jan 2021 11:12:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=89=91=E7=A0=B4=E9=95=BF=E7=A9=BA?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Base/Tool/GameResource.class.php | 18 +- .../Tool/GameResource/JxjClient.class.php | 155 ------------------ ...Client.class.php => LeyouClient.class.php} | 4 +- 3 files changed, 12 insertions(+), 165 deletions(-) delete mode 100644 Application/Base/Tool/GameResource/JxjClient.class.php rename Application/Base/Tool/GameResource/{JtxcClient.class.php => LeyouClient.class.php} (99%) diff --git a/Application/Base/Tool/GameResource.class.php b/Application/Base/Tool/GameResource.class.php index c7992b47f..4e7e7a12f 100644 --- a/Application/Base/Tool/GameResource.class.php +++ b/Application/Base/Tool/GameResource.class.php @@ -19,14 +19,16 @@ class GameResource private $game; private $clientMap = [ - 191 => JtxcClient::class, - 192 => JtxcClient::class, - 231 => LsxxClient::class, - 232 => LsxxClient::class, - 229 => YzchzbClient::class, - 230 => YzchzbClient::class, - 239 => JxjClient::class, - 240 => JxjClient::class, + 191 => LeyouClient::class, // 九天仙尘(安卓版) + 192 => LeyouClient::class, // 九天仙尘(苹果版) + 229 => YzchzbClient::class, // 远征手游之楚汉争霸(安卓版) + 230 => YzchzbClient::class, // 远征手游之楚汉争霸(苹果版) + 231 => LsxxClient::class, // 乱世枭雄(安卓版) + 232 => LsxxClient::class, // 乱世枭雄(苹果版) + 239 => LeyouClient::class, // 剑仙诀(安卓版) + 240 => LeyouClient::class, // 剑仙诀(苹果版) + 247 => LeyouClient::class, // 剑破长空(安卓版) + 248 => LeyouClient::class, // 剑破长空(苹果版) ]; public function __construct($game) diff --git a/Application/Base/Tool/GameResource/JxjClient.class.php b/Application/Base/Tool/GameResource/JxjClient.class.php deleted file mode 100644 index 85b38eb8c..000000000 --- a/Application/Base/Tool/GameResource/JxjClient.class.php +++ /dev/null @@ -1,155 +0,0 @@ - ['uri' => '/api/game/sendGold/zhuimeng/jxlm/57972', 'method' => 'post'], - ]; - - public function __construct() - { - $this->client = new Client([ - 'base_uri' => 'http://chat.leniu.com', - 'timeout' => 10.0, - ]); - } - - public function api($api, array $params = []) - { - $api = $this->apis[$api] ?? null; - if (is_null($api)) { - throw new \Exception('接口不存在'); - } - $params[self::SIGN_NAME] = $this->sign($params); - try { - return $this->request($api, $params); - } catch (\Exception $e) { - $env = C('APP_ENV', null, 'prod'); - return $e->getMessage(); - } - } - - public function request($api, $params) - { - if ($api['method'] == 'get') { - return $this->get($api['uri'], $params); - } else { - return $this->post($api['uri'], $params); - } - } - - protected function post($uri, array $params = []) - { - $response = $this->client->post($uri, [ - 'verify' => false, - 'form_params' => $params, - ]); - return (string)$response->getBody(); - } - - protected function get($uri, array $params = []) - { - $response = $this->client->get($uri, [ - 'verify' => false, - 'query' => $params, - ]); - return (string)$response->getBody(); - } - - protected function sign($params) - { - unset($params[self::SIGN_NAME]); - ksort($params); - $signRows = []; - foreach ($params as $key => $value) { - $signRows[] = $key . '=' . $value; - } - return md5(implode('&', $signRows) . self::KEY); - } - - public function apply($order, $role) - { - $result = $this->api('provide', [ - 'role_id' => $role['role_id'], - 'money' => intval($order['ref_amount']) * 10, - 'type' => 2, - // 'goods_id' => 0, - 'server_no' => $role['server_id'], - ]); - if ($result == 'SUCCESS') { - return [ - 'status' => true, - 'message' => $result, - 'result' => ['result' => $result] - ]; - } else { - return [ - 'status' => false, - 'message' => $result, - 'result' => ['result' => $result] - ]; - } - } - - public function getResourceTypes($deviceType) - { - if ($deviceType == 'andriod') { - return [['id' => 1, 'name' => '通用', 'device_type' => 'andriod']]; - } elseif ($deviceType == 'ios') { - return [['id' => 2, 'name' => '通用', 'device_type' => 'ios']]; - } - } - - public function getResources($typeId, $deviceType) - { - return [ - 1 => ['ref_id' => 1, 'name' => '60元宝', 'amount' => 6], - 2 => ['ref_id' => 2, 'name' => '300元宝', 'amount' => 30], - 3 => ['ref_id' => 3, 'name' => '980元宝', 'amount' => 98], - 4 => ['ref_id' => 4, 'name' => '1280元宝', 'amount' => 128], - 5 => ['ref_id' => 5, 'name' => '1980元宝', 'amount' => 198], - 6 => ['ref_id' => 6, 'name' => '3280元宝', 'amount' => 328], - 7 => ['ref_id' => 7, 'name' => '6480元宝', 'amount' => 648], - 8 => ['ref_id' => 8, 'name' => '10000元宝', 'amount' => 1000], - 9 => ['ref_id' => 9, 'name' => '20000元宝', 'amount' => 2000], - 10 => ['ref_id' => 10, 'name' => '30000元宝', 'amount' => 3000], - 11 => ['ref_id' => 11, 'name' => '50000元宝', 'amount' => 5000], - 12 => ['ref_id' => 12, 'name' => '100000元宝', 'amount' => 10000], - 13 => ['ref_id' => 13, 'name' => '200000元宝', 'amount' => 20000], - 14 => ['ref_id' => 14, 'name' => '680元宝', 'amount' => 68], - ]; - - /* return [ - ['ref_id' => 121209, 'name' => '6元充值卡', 'amount' => 6], - ['ref_id' => 121210, 'name' => '30元充值卡', 'amount' => 30], - ['ref_id' => 121211, 'name' => '98元充值卡', 'amount' => 98], - ['ref_id' => 121212, 'name' => '128元充值卡', 'amount' => 128], - ['ref_id' => 121213, 'name' => '198元充值卡', 'amount' => 198], - ['ref_id' => 121214, 'name' => '328元充值卡', 'amount' => 328], - ['ref_id' => 121215, 'name' => '648元充值卡', 'amount' => 648], - ['ref_id' => 121216, 'name' => '1000元充值卡', 'amount' => 1000], - ['ref_id' => 121217, 'name' => '2000元充值卡', 'amount' => 2000], - ['ref_id' => 121218, 'name' => '3000元充值卡', 'amount' => 3000], - ['ref_id' => 121219, 'name' => '5000元充值卡', 'amount' => 5000], - ['ref_id' => 121220, 'name' => '10000元充值卡', 'amount' => 10000], - ['ref_id' => 121221, 'name' => '20000元充值卡', 'amount' => 20000], - ['ref_id' => 121222, 'name' => '68元充值卡', 'amount' => 68], - ]; */ - } -} \ No newline at end of file diff --git a/Application/Base/Tool/GameResource/JtxcClient.class.php b/Application/Base/Tool/GameResource/LeyouClient.class.php similarity index 99% rename from Application/Base/Tool/GameResource/JtxcClient.class.php rename to Application/Base/Tool/GameResource/LeyouClient.class.php index a1ef1b961..126cad57d 100644 --- a/Application/Base/Tool/GameResource/JtxcClient.class.php +++ b/Application/Base/Tool/GameResource/LeyouClient.class.php @@ -6,9 +6,9 @@ use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; /** - * 九天仙尘-测试资源接口 + * 乐游-通用测试资源接口 */ -class JtxcClient +class LeyouClient { const SIGN_NAME = 'sign'; const SUCCESS = '0000'; From d08df7febae9549e94831b4e8539b6c523166b87 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 20 Jan 2021 14:29:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Base/Tool/GameResource.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Application/Base/Tool/GameResource.class.php b/Application/Base/Tool/GameResource.class.php index 4e7e7a12f..28f52881d 100644 --- a/Application/Base/Tool/GameResource.class.php +++ b/Application/Base/Tool/GameResource.class.php @@ -7,8 +7,7 @@ use GuzzleHttp\Exception\RequestException; use Base\Tool\GameResource\YzchzbClient; use Base\Tool\GameResource\LsxxClient; -use Base\Tool\GameResource\JtxcClient; -use Base\Tool\GameResource\JxjClient; +use Base\Tool\GameResource\LeyouClient; /** * 游戏资源接口