You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
3.3 KiB
PHP
90 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace Base\Tool;
|
|
|
|
use GuzzleHttp\Client;
|
|
use GuzzleHttp\Exception\RequestException;
|
|
|
|
use Base\Tool\GameResource\YzchzbClient;
|
|
use Base\Tool\GameResource\LsxxClient;
|
|
use Base\Tool\GameResource\LeyouClient;
|
|
use Base\Tool\GameResource\SlzqClient;
|
|
use Base\Tool\GameResource\XlqyClient;
|
|
use Base\Tool\GameResource\XyyClient;
|
|
|
|
/**
|
|
* 游戏资源接口
|
|
*/
|
|
class GameResource
|
|
{
|
|
private $client;
|
|
private $game;
|
|
|
|
private $clientMap = [
|
|
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, // 剑破长空(苹果版)
|
|
275 => LeyouClient::class, // 一梦仙境(安卓版)
|
|
276 => LeyouClient::class, // 一梦仙境(苹果版)
|
|
280 => LeyouClient::class, // 万剑八荒(安卓版)
|
|
281 => LeyouClient::class, // 万剑八荒(苹果版)
|
|
279 => LeyouClient::class, // 烈火长歌行(苹果版)
|
|
286 => LeyouClient::class, // 烈火长歌行(安卓版)
|
|
291 => XlqyClient::class, // 玄灵契约(安卓版)
|
|
292 => XlqyClient::class, // 玄灵契约(苹果版)
|
|
256 => XyyClient::class, // 逍遥游(安卓版)
|
|
257 => XyyClient::class, // 逍遥游(苹果版)
|
|
293 => XyyClient::class, // 逍遥游之仙魔之战(安卓版)
|
|
294 => XyyClient::class, // 逍遥游之仙魔之战(苹果版)
|
|
299 => ZxjClient::class, // 诛神记(安卓版)
|
|
300 => ZxjClient::class, // 诛神记(苹果版)
|
|
303 => SlzqClient::class, // 神灵之契(安卓版)
|
|
304 => SlzqClient::class, // 神灵之契(苹果版)
|
|
307 => LeyouClient::class, // 云中如梦令(安卓版)
|
|
308 => LeyouClient::class, // 云中如梦令(苹果版)
|
|
337 => LeyouClient::class, // 混沌天决(安卓版)
|
|
338 => LeyouClient::class, // 混沌天决(苹果版)
|
|
];
|
|
|
|
public function __construct($game)
|
|
{
|
|
$this->game = $game;
|
|
$this->client = $this->createClient($game);
|
|
}
|
|
|
|
private function createClient($game)
|
|
{
|
|
$clientClass = '';
|
|
$gameId = intval($game['id']);
|
|
if (isset($this->clientMap[$gameId])) {
|
|
$clientClass = $this->clientMap[$gameId];
|
|
} else {
|
|
throw new \Exception('游戏资源客户端未配置');
|
|
}
|
|
return new $clientClass($game);
|
|
}
|
|
|
|
public function getResourceTypes()
|
|
{
|
|
$deviceType = $this->game['sdk_version'] == 1 ? 'andriod' : 'ios';
|
|
return $this->client->getResourceTypes($deviceType);
|
|
}
|
|
|
|
public function getResources($typeId = null)
|
|
{
|
|
$deviceType = $this->game['sdk_version'] == 1 ? 'andriod' : 'ios';
|
|
return $this->client->getResources($typeId, $deviceType);
|
|
}
|
|
|
|
public function apply($order, $role)
|
|
{
|
|
return $this->client->apply($order, $role);
|
|
}
|
|
} |