|
@@ -2074,33 +2074,44 @@ class User extends Api
|
|
|
$data['realname'] = $user['realname']; //真实姓名
|
|
|
$data['gender'] = $user['gender']; //性别:1=男,2=女
|
|
|
$data['birthday'] = date('Y-m-d', $user['birthday']); //生日
|
|
|
+ $data['is_vip'] = 0; //vip是否到期:0到期 1未到期
|
|
|
//查询vip是否到期
|
|
|
$url = 'http://' . config('pay_ip') . '/HDC/bizauth/phone/auth';
|
|
|
- $post_data = [
|
|
|
- 'phoneNumber' => $this->auth->mobile,
|
|
|
- 'productCodes' => [config('product_code')],
|
|
|
- 'channel' => '01'
|
|
|
- ];
|
|
|
- $post_data = json_encode($post_data, 320);
|
|
|
|
|
|
- //获取鉴权token
|
|
|
- $sign_bytes = '/bizauth/phone/auth' . $this->base16_encode(md5($post_data));
|
|
|
+ //产品编码集合
|
|
|
+ $product_codes = [config('product_code'), '005912cp0028', '005912cp0004', '0002112cp0030', '005911cp0022', '005912cp0051', '005912cp0052', '005912cp0035', '005912cp0044', '005912cp0047', '005912cp0043', '005912cp0034', '005912cp0046', '005912cp0039', '0002112cp0031T1', '0002112cp0031T9', '0002112cp0031T19', '0002112cp0029', '005912cp0002', '0002112cp0031Z39', '0002112cp0031', '005912cp0040', '005912cp0036', '005912cp0021', '005912cp0012', '005912cp0037', '005911cp0001', '005911cp0005', '005911cp0002', '008888cp0004', '2400000560_YRHY', '005912cp0017', '2000012947_ZY'];
|
|
|
+
|
|
|
+ $product_codes_count = count($product_codes);
|
|
|
+ $i_max = ceil($product_codes_count / 6);
|
|
|
+ for ($i = 0; $i < $i_max; $i++) {
|
|
|
+ $post_product_codes = array_slice($product_codes, $i * 6, 6);
|
|
|
+ $post_data = [
|
|
|
+ 'phoneNumber' => $this->auth->mobile,
|
|
|
+ 'productCodes' => $post_product_codes,
|
|
|
+ 'channel' => '01'
|
|
|
+ ];
|
|
|
+ $post_data = json_encode($post_data, 320);
|
|
|
+
|
|
|
+ //获取鉴权token
|
|
|
+ $sign_bytes = '/bizauth/phone/auth' . $this->base16_encode(md5($post_data));
|
|
|
// $hdc_token = base64_encode(hash_hmac('sha256', $sign_bytes, config('pay_appkey'), true));
|
|
|
- $hdc_token = hash_hmac('sha256', $sign_bytes, base64_decode(config('pay_appkey')), false);
|
|
|
- $header = [
|
|
|
- 'Host:' . config('pay_ip'),
|
|
|
- 'Content-Type:application/json',
|
|
|
- 'Authorization: HDCAUTH appid="' . config('pay_appid') . '",token="' . $hdc_token . '"'
|
|
|
- ];
|
|
|
- $rs = httpRequest($url, 'POST', $post_data, $header);
|
|
|
- if (!$rs) {
|
|
|
- $data['is_vip'] = 0;
|
|
|
- } else {
|
|
|
- $rs = json_decode($rs, true);
|
|
|
- if ($rs['code'] == '00' && $rs['result'][0]['isOrder'] == true) {
|
|
|
- $data['is_vip'] = 1;
|
|
|
- } else {
|
|
|
- $data['is_vip'] = 0;
|
|
|
+ $hdc_token = hash_hmac('sha256', $sign_bytes, base64_decode(config('pay_appkey')), false);
|
|
|
+ $header = [
|
|
|
+ 'Host:' . config('pay_ip'),
|
|
|
+ 'Content-Type:application/json',
|
|
|
+ 'Authorization: HDCAUTH appid="' . config('pay_appid') . '",token="' . $hdc_token . '"'
|
|
|
+ ];
|
|
|
+ $rs = httpRequest($url, 'POST', $post_data, $header);
|
|
|
+ if ($rs) {
|
|
|
+ $rs = json_decode($rs, true);
|
|
|
+ if ($rs['code'] == '00') {
|
|
|
+ foreach ($rs['result'] as &$v) {
|
|
|
+ if ($v['isOrder'] == true) {
|
|
|
+ $data['is_vip'] = 1;
|
|
|
+ break 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|