|
@@ -319,7 +319,7 @@ class Money extends Common
|
|
}
|
|
}
|
|
|
|
|
|
// 内购支付回调
|
|
// 内购支付回调
|
|
- public function result() {
|
|
|
|
|
|
+ public function iosresult() {
|
|
//苹果内购的验证收据
|
|
//苹果内购的验证收据
|
|
$receipt_data = input('apple_receipt', '', 'trim');
|
|
$receipt_data = input('apple_receipt', '', 'trim');
|
|
$order_no = input('order_no', '', 'trim');
|
|
$order_no = input('order_no', '', 'trim');
|
|
@@ -346,7 +346,7 @@ class Money extends Common
|
|
}
|
|
}
|
|
|
|
|
|
// 验证支付状态
|
|
// 验证支付状态
|
|
- $result = $this->validate_apple_pay($receipt_data, $vipConfigInfo['bundle_id']);
|
|
|
|
|
|
+ $result = $this->validate_apple_pay($receipt_data);
|
|
if (!$result['status']) {
|
|
if (!$result['status']) {
|
|
// 验证不通过
|
|
// 验证不通过
|
|
//error_log(print_r($result, 1), 3, './result.txt');
|
|
//error_log(print_r($result, 1), 3, './result.txt');
|
|
@@ -356,7 +356,8 @@ class Money extends Common
|
|
$count = count($result['data']['receipt']['in_app']);
|
|
$count = count($result['data']['receipt']['in_app']);
|
|
$use_count = $count - 1;
|
|
$use_count = $count - 1;
|
|
//p($apple_id);p($result['data']['receipt']['in_app'][$use_count]['product_id']);die;
|
|
//p($apple_id);p($result['data']['receipt']['in_app'][$use_count]['product_id']);die;
|
|
- if ($result['data']['receipt']['in_app'][$use_count]['product_id'] != 'com.lnkj.authentication.3') {
|
|
|
|
|
|
+// if ($result['data']['receipt']['in_app'][$use_count]['product_id'] != 'com.lnkj.authentication.3') {
|
|
|
|
+ if ($result['data']['receipt']['in_app'][$use_count]['product_id'] != $vipConfigInfo['product_id']) {
|
|
$this->error('非法请求,请立刻停止');
|
|
$this->error('非法请求,请立刻停止');
|
|
}
|
|
}
|
|
|
|
|
|
@@ -401,7 +402,7 @@ class Money extends Common
|
|
* @param string $receipt_data 付款后凭证
|
|
* @param string $receipt_data 付款后凭证
|
|
* @return array 验证是否成功
|
|
* @return array 验证是否成功
|
|
*/
|
|
*/
|
|
- function validate_apple_pay($receipt_data = '', $bundle_id = '') {
|
|
|
|
|
|
+ function validate_apple_pay($receipt_data = '') {
|
|
// 验证参数
|
|
// 验证参数
|
|
if (strlen($receipt_data) < 20) {
|
|
if (strlen($receipt_data) < 20) {
|
|
$result = array(
|
|
$result = array(
|
|
@@ -420,17 +421,17 @@ class Money extends Common
|
|
}
|
|
}
|
|
|
|
|
|
// 如果是沙盒数据 则验证沙盒模式 21008;正式数据 21007
|
|
// 如果是沙盒数据 则验证沙盒模式 21008;正式数据 21007
|
|
- if ($data['status'] == '21007') {
|
|
|
|
- // 请求验证
|
|
|
|
- $html = $this->curl($receipt_data, 1);
|
|
|
|
- $data = json_decode($html, true);
|
|
|
|
- $data['sandbox'] = '1';
|
|
|
|
- }
|
|
|
|
|
|
+// if ($data['status'] == '21007') {
|
|
|
|
+// // 请求验证
|
|
|
|
+// $html = $this->curl($receipt_data, 1);
|
|
|
|
+// $data = json_decode($html, true);
|
|
|
|
+// $data['sandbox'] = '1';
|
|
|
|
+// }
|
|
if (isset($_GET['debug'])) {
|
|
if (isset($_GET['debug'])) {
|
|
exit(json_encode($data));
|
|
exit(json_encode($data));
|
|
}
|
|
}
|
|
// if ($data['receipt']['bundle_id'] != 'com.liuniukeji.mayivideo') {
|
|
// if ($data['receipt']['bundle_id'] != 'com.liuniukeji.mayivideo') {
|
|
- if ($data['receipt']['bundle_id'] != $bundle_id) {
|
|
|
|
|
|
+ if ($data['receipt']['bundle_id'] != 'com.nuoruiyang.fate') {
|
|
$result = array(
|
|
$result = array(
|
|
'status' => false,
|
|
'status' => false,
|
|
'message' => '非法请求',
|
|
'message' => '非法请求',
|
|
@@ -475,7 +476,8 @@ class Money extends Common
|
|
$url_buy = "https://buy.itunes.apple.com/verifyReceipt";
|
|
$url_buy = "https://buy.itunes.apple.com/verifyReceipt";
|
|
$url_sandbox = "https://sandbox.itunes.apple.com/verifyReceipt";
|
|
$url_sandbox = "https://sandbox.itunes.apple.com/verifyReceipt";
|
|
|
|
|
|
- if ($sandbox > 0) {
|
|
|
|
|
|
+// if ($sandbox > 0) {
|
|
|
|
+ if (config('site.ios_pay_sandbox') > 0) {
|
|
$url = $url_buy;
|
|
$url = $url_buy;
|
|
} else {
|
|
} else {
|
|
$url = $url_sandbox;
|
|
$url = $url_sandbox;
|