|
|
@@ -2,10 +2,8 @@
|
|
|
|
|
|
namespace www\controllers;
|
|
|
|
|
|
-use biz\merchant\classes\MerchantClass;
|
|
|
use biz\weixin\services\WxOpenService;
|
|
|
use common\services\xhMerchantExtendService;
|
|
|
-use common\services\xhTMessageService;
|
|
|
use Yii;
|
|
|
use common\services\xhApplyOrderService;
|
|
|
use common\services\xhWxMenuService;
|
|
|
@@ -17,9 +15,6 @@ use common\services\xhWxOpenService;
|
|
|
use common\components\stringUtil;
|
|
|
use common\components\wxUtil;
|
|
|
use common\services\xhSetMealService;
|
|
|
-use yii\helpers\Json;
|
|
|
-use common\models\xhWxOpen;
|
|
|
-use linslin\yii2\curl;
|
|
|
|
|
|
/**
|
|
|
* 微信开放平台相关
|
|
|
@@ -27,17 +22,16 @@ use linslin\yii2\curl;
|
|
|
class WxOpenController extends PublicController
|
|
|
{
|
|
|
|
|
|
- public $withoutLogin = ['callback-create-first-merchant'];
|
|
|
+ public $withoutLogin = [];
|
|
|
|
|
|
//开放平台开始授权 shish 2020.1.16
|
|
|
public function actionBeginAuth()
|
|
|
{
|
|
|
- $id = 1;
|
|
|
$merchantId = Yii::$app->request->get('id', 0);
|
|
|
$open = WxOpenService::getOpen();
|
|
|
- if (isset($open['merchantId']) && empty($open['merchantId'])) {
|
|
|
+ if (isset($open['merchantId']) && !empty($open['merchantId'])) {
|
|
|
if (!empty($merchantId)) {
|
|
|
- util::stop('请先将开放平台关联公众号');
|
|
|
+ util::stop('平台已经关联的公众号,无需重复关联');
|
|
|
}
|
|
|
}
|
|
|
$pre = wxUtil::getPreAuthCode($open);
|
|
|
@@ -45,12 +39,17 @@ class WxOpenController extends PublicController
|
|
|
$oData = [];
|
|
|
$oData['preAuthCodeTime'] = date("Y-m-d H:i:s");
|
|
|
//设置预授码过期,让下个用户可以获取新的预授码
|
|
|
- xhWxOpenService::updateById($id, $oData);
|
|
|
+ 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>";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ public function actionAddMerchant()
|
|
|
+ {
|
|
|
+ echo 'mmmm';
|
|
|
+ }
|
|
|
+
|
|
|
public function actionCheckMerchantName()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
@@ -153,10 +152,10 @@ class WxOpenController extends PublicController
|
|
|
$upData['wxRefreshToken'] = $authorize_refresh_token;
|
|
|
$upData['status'] = 1;//审核通过
|
|
|
xhMerchantService::updateById($id, $upData);
|
|
|
-
|
|
|
+
|
|
|
echo 'ok';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public function actionResult()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|