Commit e13eb703 authored by pengfei's avatar pengfei

Merge branch 'colonel' of https://git.yidian-inc.com:8021/bp/goods into colonel

parents 3666d304 5b7ba7b4
...@@ -92,10 +92,16 @@ class UserService ...@@ -92,10 +92,16 @@ class UserService
return $user; return $user;
} }
/**
* 绑定手机号
* @param $params
* @return \Api\PhpUtils\Mysql\MysqlBase
* @throws UserException
* @throws \App\Exception\custom\CodeSpecialException
* @throws \App\Exception\custom\InterfaceException
*/
public static function bindPhone($params) public static function bindPhone($params)
{ {
$openid = !empty($params['openid']) ? $params['openid'] : ''; $openid = !empty($params['openid']) ? $params['openid'] : '';
$encryptedData = !empty($params['encryptedData']) ? $params['encryptedData'] : ''; $encryptedData = !empty($params['encryptedData']) ? $params['encryptedData'] : '';
$iv = !empty($params['iv']) ? $params['iv'] : ''; $iv = !empty($params['iv']) ? $params['iv'] : '';
...@@ -116,19 +122,11 @@ class UserService ...@@ -116,19 +122,11 @@ class UserService
throw new UserException(['cus' => 5]); throw new UserException(['cus' => 5]);
} }
//解密 //解密
$decryptData = []; $decryptData = [];
$wXBizDataCrypt = new WxBizDataCrypt($appid, $sessionKey); $wXBizDataCrypt = new WxBizDataCrypt($appid, $sessionKey);
$errCode = $wXBizDataCrypt->decryptData($encryptedData, $iv, $decryptData); $errCode = $wXBizDataCrypt->decryptData($encryptedData, $iv, $decryptData);
if ($errCode) { if ($errCode) {
throw new UserException(['cus' => 6]); throw new UserException(['cus' => 6]);
} }
...@@ -139,7 +137,6 @@ class UserService ...@@ -139,7 +137,6 @@ class UserService
} }
$phoneNumber = strval($decryptData['phoneNumber']); $phoneNumber = strval($decryptData['phoneNumber']);
//判断是否已 //判断是否已
$user = UserWechatBind::getRecord(['phone' => $phoneNumber]); $user = UserWechatBind::getRecord(['phone' => $phoneNumber]);
if (!empty($user) && $openid != $user['openid']) { if (!empty($user) && $openid != $user['openid']) {
...@@ -164,8 +161,6 @@ class UserService ...@@ -164,8 +161,6 @@ class UserService
throw new UserException(['cus' => 8]); throw new UserException(['cus' => 8]);
} }
CommonService::isNewUser($params);
$isNewUser = CommonService::isNewUser(['openid' => $openid]); $isNewUser = CommonService::isNewUser(['openid' => $openid]);
if (!empty($isNewUser) && $isNewUser['is_new_user'] == 1) { if (!empty($isNewUser) && $isNewUser['is_new_user'] == 1) {
$userInfo['is_pop_up'] = 1; $userInfo['is_pop_up'] = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment