|
|
@@ -33,11 +33,8 @@ class WxOpenController extends PublicController
|
|
|
{
|
|
|
$merchantId = Yii::$app->request->get('id', 0);
|
|
|
$open = WxOpenService::getOpen();
|
|
|
- if (isset($open['merchantId']) && !empty($open['merchantId'])) {
|
|
|
- if (!empty($merchantId)) {
|
|
|
- util::stop('平台已经关联的公众号,无需重复关联');
|
|
|
- }
|
|
|
- }
|
|
|
+ //1只显示公众号 2只显示小程序 3显示公众号和小程序
|
|
|
+ $authType = Yii::$app->request->get('authType', 3);
|
|
|
$pre = wxUtil::getPreAuthCode($open);
|
|
|
$appId = $open['appId'];
|
|
|
$oData = [];
|
|
|
@@ -45,7 +42,6 @@ class WxOpenController extends PublicController
|
|
|
//设置预授码过期,让下个用户可以获取新的预授码
|
|
|
xhWxOpenService::updateById(1, $oData);
|
|
|
$url = Yii::$app->params['wHost'] . '/wx-open-callback/' . $merchantId;
|
|
|
- $authType = Yii::$app->request->get('authType', 3);
|
|
|
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>";
|
|
|
}
|
|
|
|