|
@@ -46,11 +46,12 @@ class WxOpenController extends PublicController
|
|
|
//1只显示公众号 2只显示小程序 3显示公众号和小程序
|
|
//1只显示公众号 2只显示小程序 3显示公众号和小程序
|
|
|
$authType = Yii::$app->request->get('authType', 3);
|
|
$authType = Yii::$app->request->get('authType', 3);
|
|
|
$pre = wxUtil::getPreAuthCode($open);
|
|
$pre = wxUtil::getPreAuthCode($open);
|
|
|
- $appId = $open['appId'];
|
|
|
|
|
|
|
+ $appId = $open['appId'] ?? '';
|
|
|
|
|
+ $openId = $open['id'] ?? 0;
|
|
|
$oData = [];
|
|
$oData = [];
|
|
|
$oData['preAuthCodeTime'] = date("Y-m-d H:i:s");
|
|
$oData['preAuthCodeTime'] = date("Y-m-d H:i:s");
|
|
|
//设置预授码过期,让下个用户可以获取新的预授码
|
|
//设置预授码过期,让下个用户可以获取新的预授码
|
|
|
- xhWxOpenService::updateById(1, $oData);
|
|
|
|
|
|
|
+ xhWxOpenService::updateById($openId, $oData);
|
|
|
Yii::info('callbackUrl:' . $url);
|
|
Yii::info('callbackUrl:' . $url);
|
|
|
echo "<a href='https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid={$appId}&pre_auth_code={$pre}&redirect_uri={$url}&auth_type={$authType}'>授权</a>";
|
|
echo "<a href='https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid={$appId}&pre_auth_code={$pre}&redirect_uri={$url}&auth_type={$authType}'>授权</a>";
|
|
|
}
|
|
}
|