|
@@ -91,10 +91,9 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
$resp = json_decode($resp, true);
|
|
|
if (empty($resp)) {
|
|
|
return [false, '网络错误', true];
|
|
|
- } elseif ($resp['respCode'] == 00) {
|
|
|
+ } elseif ($resp['respCode'] == '00') {
|
|
|
$notify_data = $this->notify_data_format($resp,true);
|
|
|
- //可替换延迟回调
|
|
|
- refill\util::push_notify('suning',$notify_data);
|
|
|
+ refill\util::async_notify('suning',$notify_data,1);
|
|
|
return [true, $resp['orderNo'], false];
|
|
|
} else {
|
|
|
return [false, $resp['message'], false];
|
|
@@ -125,10 +124,9 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
$resp = json_decode($resp, true);
|
|
|
if (empty($resp)) {
|
|
|
return [false, '网络错误', true];
|
|
|
- } elseif ($resp['respCode'] == 00) {
|
|
|
- $notify_data = $this->notify_data_format($resp,false);
|
|
|
- //可替换延迟回调
|
|
|
- refill\util::push_notify('suning',$notify_data);
|
|
|
+ } elseif ($resp['respCode'] == '00') {
|
|
|
+ $notify_data = $this->notify_data_format($resp, false);
|
|
|
+ refill\util::async_notify('suning', $notify_data, 1);
|
|
|
return [true, $resp['orderNo'], false];
|
|
|
} else {
|
|
|
return [false, $resp['message'], false];
|
|
@@ -136,6 +134,19 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private function rsa_decode($encrypted)
|
|
|
+ {
|
|
|
+ $ret = openssl_private_decrypt(base64_decode($encrypted), $decrypted, config::PRIVATE_KEY);
|
|
|
+ if ($ret) {
|
|
|
+ $result = json_decode($decrypted, true);
|
|
|
+ return $result;
|
|
|
+ } else {
|
|
|
+ $err = openssl_error_string();
|
|
|
+ Log::record("suning callback openssl_private_decrypt error={$err}",Log::ERR);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function query($refill_info)
|
|
|
{
|
|
|
return [false, '苏宁三方下单即回调,无需查询接口'];
|
|
@@ -164,14 +175,22 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
$data['orderNo'] = $params['orderNo'];
|
|
|
|
|
|
$card_list = $params['cardList'];
|
|
|
- if(count($card_list) == 1) {
|
|
|
- $data['card_info'] = $params['cardList'][0];
|
|
|
+ if(count($card_list) == 1)
|
|
|
+ {
|
|
|
+ $item = $params['cardList'][0];
|
|
|
+ if($fdirect) {
|
|
|
+ $data['card_info'] = ['type' => 'direct','card_no' => $item['cardNo'],'amount' => $item['amount'],'desc' => $item['cardCatalogName']];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $password = $this->rsa_decode($item['password']);
|
|
|
+ $data['card_info'] = ['type' => 'card_key',
|
|
|
+ 'card_no' => $item['cardNo'],'amount' => $item['amount'],'password' => $password,
|
|
|
+ 'desc' => $item['cardCatalogName']];
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
$data['card_info'] = [];
|
|
|
}
|
|
|
- $data['isDirect'] = $fdirect;
|
|
|
-
|
|
|
return $data;
|
|
|
}
|
|
|
}
|