Commit 9b2fd912 authored by jianghaiming's avatar jianghaiming

update:修改

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