|
|
@@ -24,6 +24,23 @@ class WxOpenController extends PublicController
|
|
|
|
|
|
public $withoutLogin = ['callback-create-first-merchant'];
|
|
|
|
|
|
+ public function actionAuthUrl()
|
|
|
+ {
|
|
|
+ $id = 1;
|
|
|
+ $open = xhWxOpenService::getById($id);
|
|
|
+ $pre = weixinOpenUtil::getPreAuthCode($open);
|
|
|
+ $appId = $open['appId'];
|
|
|
+ $oData = [];
|
|
|
+ $oData['preAuthCodeTime'] = date("Y-m-d H:i:s");//设置预授码过期,让下个用户可以获取新的预授码
|
|
|
+ xhWxOpenService::updateById($id, $oData);
|
|
|
+ $url = Yii::$app->params['w'] . '/join/callback';
|
|
|
+ $merchantId = $open['merchantId'];//如果平台没有绑定商家,先去创建第一个商家
|
|
|
+ if (empty($merchantId)) {
|
|
|
+ $url = Yii::$app->params['w'] . '/join/callback-create-first-merchant';
|
|
|
+ }
|
|
|
+ echo "<a href='https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid={$appId}&pre_auth_code={$pre}&redirect_uri={$url}'>授权</a>";
|
|
|
+ }
|
|
|
+
|
|
|
public function actionGetAuthUrl()
|
|
|
{
|
|
|
$id = 1;
|
|
|
@@ -41,7 +58,7 @@ class WxOpenController extends PublicController
|
|
|
$redirect = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid={$appId}&pre_auth_code={$pre}&redirect_uri={$url}";
|
|
|
util::success(['url' => $redirect]);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function actionCheckMerchantName()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|