diff --git a/application/api/model/AliRealNameVerify.php b/application/api/model/AliRealNameVerify.php index ea1fa9c0..3cc78851 100644 --- a/application/api/model/AliRealNameVerify.php +++ b/application/api/model/AliRealNameVerify.php @@ -9,7 +9,7 @@ class AliRealNameVerify extends Model { //身份证二要素认证 - public function real_name_verify($real_name, $card_id) + public function real_name_verifys($real_name, $card_id) { $host = "https://eid.shumaidata.com"; @@ -53,4 +53,71 @@ class AliRealNameVerify extends Model } return ['code' => 201, 'msg' => '验证错误', 'data' => null]; } + + //身份证二要素认证 + public function real_name_verify($real_name, $card_id) + { + // 云市场分配的密钥Id + $secretId = '3WXZQgBTyuyDH1bX'; + // 云市场分配的密钥Key + $secretKey = 'XeZT5WBiUwQcjJ0QuxmPRPE8cJaIxKVM'; + + // 签名 + $datetime = gmdate('D, d M Y H:i:s T'); + $signStr = sprintf("x-date: %s", $datetime); + $sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true)); + $auth = sprintf('{"id": "%s", "x-date": "%s" , "signature": "%s"}', $secretId, $datetime, $sign); + + // 请求方法 + $method = 'GET'; + // 请求头 + $headers = array( + 'Authorization' => $auth, + ); + // 查询参数 + $queryParams = array ( + 'cardNo' => $card_id, + 'realName' => $real_name, + ); + // body参数(POST方法下) + $bodyParams = array ( + + ); + $sendData = http_build_query($bodyParams); + // url参数拼接 + $url = 'https://ap-beijing.cloudmarket-apigw.com/service-hcgajsa5/idcard/VerifyIdcardv2'; + if (count($queryParams) > 0) { + $url .= '?' . http_build_query($queryParams); + } + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 60); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); + if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) { + $headers['Content-Type'] = 'application/x-www-form-urlencoded'; + curl_setopt($ch, CURLOPT_POSTFIELDS, $sendData); + } + curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) { + return $k . ': ' . $v; + }, array_values($headers), array_keys($headers))); + +// $data = json_decode(curl_exec($ch), true); + $result = curl_exec($ch); + if($result) { + $data = json_decode($result, true); +// var_dump($data);exit; + if ($data['error_code'] == 0) { + if ($data['result']['isok']) { + return ['code' => 200, 'msg' => '验证成功', 'data' => null]; + } else { + return ['code' => 201, 'msg' => '信息有误' . json_encode($data), 'data' => null]; + } + } else { + return ['code' => 201, 'msg' => '信息有误' . json_encode($data), 'data' => null]; + } + } + return ['code' => 201, 'msg' => '信息有误', 'data' => null]; + } } diff --git a/application/api/model/UserRecharge.php b/application/api/model/UserRecharge.php index e01227a4..e908e892 100644 --- a/application/api/model/UserRecharge.php +++ b/application/api/model/UserRecharge.php @@ -443,7 +443,7 @@ class UserRecharge extends Model $bizcontent = json_encode($arr, JSON_UNESCAPED_UNICODE); // $request->setNotifyUrl("http://" . $_SERVER['HTTP_HOST'] . "/api/pay_notify/ali_pay_notify"); - $request->setNotifyUrl("http://119.45.115.72:621/api/pay_notify/ali_pay_notify"); + $request->setNotifyUrl("http://119.45.183.246/api/pay_notify/ali_pay_notify"); $request->setBizContent($bizcontent); //这里和普通的接口调用不同,使用的是sdkExecute $response = $aop->sdkExecute($request); @@ -463,7 +463,7 @@ class UserRecharge extends Model $params['trade_type'] = 'APP'; //交易类型 JSAPI | NATIVE | APP | WAP $params['attach'] = '123'; //附加参数 // $params['notify_url'] = "http://" . $_SERVER['HTTP_HOST'] . "/api/pay_notify/wx_pay_notify"; - $params['notify_url'] = "http://119.45.115.72:621/api/pay_notify/wx_pay_notify"; + $params['notify_url'] = "http://119.45.183.246/api/pay_notify/wx_pay_notify"; $result = $WxPay->unifiedOrder($params); // dump($result);die; if ($result['prepay_id']) {