master
ljl 2 years ago
parent a7d754e053
commit 554de62e19

@ -11,6 +11,7 @@ use Base\Tool\GameResource\LeyouClient;
use Base\Tool\GameResource\SlzqClient; use Base\Tool\GameResource\SlzqClient;
use Base\Tool\GameResource\XlqyClient; use Base\Tool\GameResource\XlqyClient;
use Base\Tool\GameResource\XyyClient; use Base\Tool\GameResource\XyyClient;
use Base\Tool\GameResource\YhxxjClient;
/** /**
* 游戏资源接口 * 游戏资源接口
@ -51,6 +52,8 @@ class GameResource
308 => LeyouClient::class, // 云中如梦令(苹果版) 308 => LeyouClient::class, // 云中如梦令(苹果版)
337 => LeyouClient::class, // 混沌天决(安卓版) 337 => LeyouClient::class, // 混沌天决(安卓版)
338 => LeyouClient::class, // 混沌天决(苹果版) 338 => LeyouClient::class, // 混沌天决(苹果版)
363 => YhxxjClient::class, // 云海寻仙记(安卓版)
364 => YhxxjClient::class, // 云海寻仙记(苹果版)
]; ];
public function __construct($game) public function __construct($game)

@ -12,22 +12,17 @@ use GuzzleHttp\Exception\RequestException;
class YhxxjClient class YhxxjClient
{ {
const SIGN_NAME = 'sign'; const SIGN_NAME = 'sign';
const SUCCESS = '0000';
const APP_ID = 'FD32BDA67D6024D71'; const APP_ID = 'wmtx';
const SIGN_KEY = 'FzYrrm23eN8sMkomGiHM0QG2Uvk8uAPw'; const SIGN_KEY = 'aiuh1i2349oijo3aa232423aq3215490gu34khb23';
// const APP_ID = '77A38AE4C5CAD6756'; // IOS
// const SIGN_KEY = 'rKkoznJcEhWaVPSuBnH1QnC9goDd4TcB'; // IOS
protected $logTag = 'rebate:YHXXJ '; protected $logTag = 'rebate:YHXXJ ';
protected $baseUrl = 'http://xx2api.hnputihd.com'; protected $baseUrl = 'http://fross.jfungame.com:13996';
protected $client; protected $client;
protected $currentName;
protected $apis = [ protected $apis = [
'send-testing' => ['uri' => '/apip/payWM450S00/testingOrder', 'method' => 'post'], 'send-testing' => ['uri' => '/oss.php?r=API/Rebate/rebate', 'method' => 'post'],
]; ];
public function __construct($game = null) public function __construct($game = null)
@ -40,17 +35,12 @@ class YhxxjClient
public function api($name, array $params = []) public function api($name, array $params = [])
{ {
$this->currentName = $name;
$api = $this->apis[$name] ?? null; $api = $this->apis[$name] ?? null;
if (is_null($api)) { if (is_null($api)) {
throw new \Exception('接口不存在'); throw new \Exception('接口不存在');
} }
$params[static::SIGN_NAME] = $this->sign($name, $params); $params[static::SIGN_NAME] = $this->sign($name, $params);
// 发放道具接口特殊处理
if ($name == 'send-props') {
$params = ['data' => json_encode($params)];
}
try { try {
return $this->request($api, $params); return $this->request($api, $params);
} catch (\Exception $e) { } catch (\Exception $e) {
@ -77,9 +67,6 @@ class YhxxjClient
]); ]);
$result = (string)$response->getBody(); $result = (string)$response->getBody();
Log::info($this->logTag . $uri . ' -- '. json_encode($params) . ' -- '. $result); Log::info($this->logTag . $uri . ' -- '. json_encode($params) . ' -- '. $result);
if ($this->currentName == 'send-testing') {
return $this->prepareResult($result);
}
return json_decode($result, true); return json_decode($result, true);
} }
@ -91,27 +78,9 @@ class YhxxjClient
]); ]);
$result = (string)$response->getBody(); $result = (string)$response->getBody();
Log::info($this->logTag . $uri . ' -- '. json_encode($params) . ' -- '. $result); Log::info($this->logTag . $uri . ' -- '. json_encode($params) . ' -- '. $result);
if ($this->currentName == 'send-testing') {
return $this->prepareResult($result);
}
return json_decode($result, true); return json_decode($result, true);
} }
protected function prepareResult($result)
{
if ($result == 'SUCCESS') {
return [
'code' => 0,
'msg' => $result,
];
} else {
return [
'code' => 1,
'msg' => $result,
];
}
}
protected function sign($name, $params) protected function sign($name, $params)
{ {
return md5( return md5(

Loading…
Cancel
Save