|
|
|
@ -21,6 +21,7 @@ class XlqyClient
|
|
|
|
|
// const SIGN_KEY = 'rKkoznJcEhWaVPSuBnH1QnC9goDd4TcB'; // IOS
|
|
|
|
|
|
|
|
|
|
protected $client;
|
|
|
|
|
protected $currentName;
|
|
|
|
|
|
|
|
|
|
private $apis = [
|
|
|
|
|
'send-email' => ['uri' => '/apip/payWM450S00/emRebate', 'method' => 'post'],
|
|
|
|
@ -37,6 +38,7 @@ class XlqyClient
|
|
|
|
|
|
|
|
|
|
public function api($name, array $params = [])
|
|
|
|
|
{
|
|
|
|
|
$this->currentName = $name;
|
|
|
|
|
$api = $this->apis[$name] ?? null;
|
|
|
|
|
if (is_null($api)) {
|
|
|
|
|
throw new \Exception('接口不存在');
|
|
|
|
@ -68,6 +70,9 @@ class XlqyClient
|
|
|
|
|
]);
|
|
|
|
|
$result = (string)$response->getBody();
|
|
|
|
|
Log::info('rebate:XLQY ' . $uri . ' -- '. json_encode($params) . ' -- '. $result);
|
|
|
|
|
if ($this->currentName == 'send-testing') {
|
|
|
|
|
return $this->prepareResult($result);
|
|
|
|
|
}
|
|
|
|
|
return json_decode($result, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -79,8 +84,26 @@ class XlqyClient
|
|
|
|
|
]);
|
|
|
|
|
$result = (string)$response->getBody();
|
|
|
|
|
Log::info('rebate:XLQY ' . $uri . ' -- '. json_encode($params) . ' -- '. $result);
|
|
|
|
|
if ($this->currentName == 'send-testing') {
|
|
|
|
|
return $this->prepareResult($result);
|
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
@ -100,7 +123,7 @@ class XlqyClient
|
|
|
|
|
$params['appId'] .
|
|
|
|
|
$params['orderNum'] .
|
|
|
|
|
$params['userId'] .
|
|
|
|
|
$params['MoneyYuan'] .
|
|
|
|
|
$params['moneyYuan'] .
|
|
|
|
|
$params['serviceId'] .
|
|
|
|
|
$params['roleId'] .
|
|
|
|
|
$params['time'] .
|
|
|
|
@ -158,25 +181,13 @@ class XlqyClient
|
|
|
|
|
'userId' => $role['user_id'],
|
|
|
|
|
'serviceId' => $role['server_id'],
|
|
|
|
|
'roleId' => $role['role_id'],
|
|
|
|
|
'MoneyYuan' => $order['ref_amount'],
|
|
|
|
|
'moneyYuan' => $order['ref_amount'],
|
|
|
|
|
'orderNum' => $order['order_no'],
|
|
|
|
|
'time' => time(),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$result = $this->api('send-testing', $data);
|
|
|
|
|
if ($result == 'SUCCESS') {
|
|
|
|
|
return [
|
|
|
|
|
'status' => true,
|
|
|
|
|
'message' => $result,
|
|
|
|
|
'result' => ['result' => $result]
|
|
|
|
|
];
|
|
|
|
|
} else {
|
|
|
|
|
return [
|
|
|
|
|
'status' => false,
|
|
|
|
|
'message' => $result,
|
|
|
|
|
'result' => ['result' => $result]
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
return $this->getCommonResult($result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getResourceTypes($deviceType)
|
|
|
|
|