|
@@ -21,10 +21,11 @@ use common\services\xhSetMealService;
|
|
|
*/
|
|
*/
|
|
|
class WxOpenController extends PublicController
|
|
class WxOpenController extends PublicController
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
public $withoutLogin = ['callback-create-first-merchant'];
|
|
public $withoutLogin = ['callback-create-first-merchant'];
|
|
|
-
|
|
|
|
|
- public function actionAuthUrl()
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //开放平台开始授权 shish 2020.1.16
|
|
|
|
|
+ public function actionBeginAuth()
|
|
|
{
|
|
{
|
|
|
$id = 1;
|
|
$id = 1;
|
|
|
$open = xhWxOpenService::getById($id);
|
|
$open = xhWxOpenService::getById($id);
|
|
@@ -40,25 +41,7 @@ class WxOpenController extends PublicController
|
|
|
}
|
|
}
|
|
|
echo "<a href='https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid={$appId}&pre_auth_code={$pre}&redirect_uri={$url}'>授权</a>";
|
|
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;
|
|
|
|
|
- $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';
|
|
|
|
|
- }
|
|
|
|
|
- $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()
|
|
public function actionCheckMerchantName()
|
|
|
{
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
$get = Yii::$app->request->get();
|