Commit 9b2fd912 authored by jianghaiming's avatar jianghaiming

update:修改

parent 6e3d59cd
...@@ -22,7 +22,7 @@ class UserService ...@@ -22,7 +22,7 @@ class UserService
private static $code = ''; private static $code = '';
private static $grantType = 'authorization_code'; private static $grantType = 'authorization_code';
private static $loginUrl = 'https://api.weixin.qq.com/sns/jscode2session'; private static $loginUrl = 'https://api.weixin.qq.com/sns/jscode2session';
private static $appid = ''; private static $wechatAppId = '';
private static $secret = ""; private static $secret = "";
private static $redis = ""; private static $redis = "";
private static $keyCode = ""; private static $keyCode = "";
...@@ -64,7 +64,7 @@ class UserService ...@@ -64,7 +64,7 @@ class UserService
'activity_type' => $activityType, 'activity_type' => $activityType,
'create_time' => date("Y-m-d H:i:s"), 'create_time' => date("Y-m-d H:i:s"),
'appid' => $appid, 'appid' => $appid,
'wechat_app_id' => self::$appid, 'wechat_app_id' => self::$wechatAppId,
]; ];
$sessionKey = !empty($response['session_key']) ? $response['session_key'] : ''; $sessionKey = !empty($response['session_key']) ? $response['session_key'] : '';
...@@ -123,7 +123,7 @@ class UserService ...@@ -123,7 +123,7 @@ class UserService
public static function setWechatConfig($wechatFrom) public static function setWechatConfig($wechatFrom)
{ {
//需要授权微信 //需要授权微信
self::$appid = \Yaf\Registry::get('config')->wechat->appid->$wechatFrom; self::$wechatAppId = \Yaf\Registry::get('config')->wechat->appid->$wechatFrom;
self::$secret = \Yaf\Registry::get('config')->wechat->secret->$wechatFrom; self::$secret = \Yaf\Registry::get('config')->wechat->secret->$wechatFrom;
} }
...@@ -159,7 +159,7 @@ class UserService ...@@ -159,7 +159,7 @@ class UserService
public static function getJscode2session(){ public static function getJscode2session(){
//请求接口,获取用户openid //请求接口,获取用户openid
$params = [ $params = [
'appid' => self::$appid, 'appid' => self::$wechatAppId,
'secret' => self::$secret, 'secret' => self::$secret,
'js_code' => self::$code, 'js_code' => self::$code,
'grant_type' => self::$grantType, 'grant_type' => self::$grantType,
...@@ -299,7 +299,7 @@ class UserService ...@@ -299,7 +299,7 @@ class UserService
//解密 //解密
$decryptData = []; $decryptData = [];
$wXBizDataCrypt = new WxBizDataCrypt(self::$appid, $sessionKey); $wXBizDataCrypt = new WxBizDataCrypt(self::$wechatAppId, $sessionKey);
$errCode = $wXBizDataCrypt->decryptData($encryptedData, $iv, $decryptData); $errCode = $wXBizDataCrypt->decryptData($encryptedData, $iv, $decryptData);
if ($errCode) { if ($errCode) {
...@@ -319,7 +319,7 @@ class UserService ...@@ -319,7 +319,7 @@ class UserService
if ($params['appid'] == 'merchant-pub-pin') { if ($params['appid'] == 'merchant-pub-pin') {
$user = UserWechatBind::getRecordMaster(['phone' => $phoneNumber]); $user = UserWechatBind::getRecordMaster(['phone' => $phoneNumber]);
}else{ }else{
$user = UserWechatBind::getRecordMaster(['phone' => $phoneNumber,'wechat_app_id' => self::$appid]); $user = UserWechatBind::getRecordMaster(['phone' => $phoneNumber,'wechat_app_id' => self::$wechatAppId]);
} }
if (!empty($user) && $openid != $user['openid']) { if (!empty($user) && $openid != $user['openid']) {
......
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