|
|
|
@ -17,8 +17,9 @@ class JtxcClient
|
|
|
|
|
|
|
|
|
|
protected $client;
|
|
|
|
|
|
|
|
|
|
// http://chat.leniu.com/api/game/sendGold/zhuimeng/jxlm/57972
|
|
|
|
|
private $apis = [
|
|
|
|
|
'provide' => ['uri' => '/api/game/sendGold/zhuimeng/jxlm/53334', 'method' => 'post'],
|
|
|
|
|
'provide' => ['uri' => '/api/game/sendGold/zhuimeng/jxlm/57972', 'method' => 'post'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
@ -40,7 +41,7 @@ class JtxcClient
|
|
|
|
|
return $this->request($api, $params);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
$env = C('APP_ENV', null, 'prod');
|
|
|
|
|
return ['code' => 1000, 'state' => 1000, 'message' => '接口请求错误。' . ($env == 'prod' ? '' : $e->getMessage()) , 'data' => []];
|
|
|
|
|
return $e->getMessage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -59,8 +60,7 @@ class JtxcClient
|
|
|
|
|
'verify' => false,
|
|
|
|
|
'form_params' => $params,
|
|
|
|
|
]);
|
|
|
|
|
$result = (string)$response->getBody();
|
|
|
|
|
return json_decode($result, true);
|
|
|
|
|
return (string)$response->getBody();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function get($uri, array $params = [])
|
|
|
|
@ -69,8 +69,7 @@ class JtxcClient
|
|
|
|
|
'verify' => false,
|
|
|
|
|
'query' => $params,
|
|
|
|
|
]);
|
|
|
|
|
$result = (string)$response->getBody();
|
|
|
|
|
return json_decode($result, true);
|
|
|
|
|
return (string)$response->getBody();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function sign($params)
|
|
|
|
@ -88,22 +87,22 @@ class JtxcClient
|
|
|
|
|
{
|
|
|
|
|
$result = $this->api('provide', [
|
|
|
|
|
'role_id' => $role['role_id'],
|
|
|
|
|
'money' => intval($order['ref_amount']),
|
|
|
|
|
'money' => intval($order['ref_amount']) * 10,
|
|
|
|
|
'type' => 2,
|
|
|
|
|
// 'goods_id' => 0,
|
|
|
|
|
'server_no' => $role['user_account'],
|
|
|
|
|
'server_no' => $role['server_id'],
|
|
|
|
|
]);
|
|
|
|
|
if ($result['state'] == 1 && $result['data']) {
|
|
|
|
|
if ($result == 'SUCCESS') {
|
|
|
|
|
return [
|
|
|
|
|
'status' => true,
|
|
|
|
|
'message' => $result['msg'],
|
|
|
|
|
'result' => $result
|
|
|
|
|
'message' => $result,
|
|
|
|
|
'result' => ['result' => $result]
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
return [
|
|
|
|
|
'status' => false,
|
|
|
|
|
'message' => $result['msg'],
|
|
|
|
|
'result' => $result ?? []
|
|
|
|
|
'message' => $result,
|
|
|
|
|
'result' => ['result' => $result]
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|