shish 6 лет назад
Родитель
Сommit
80b72f9b8a
1 измененных файлов с 17 добавлено и 1 удалено
  1. 17 1
      app/saas/controllers/MerchantController.php

+ 17 - 1
app/saas/controllers/MerchantController.php

@@ -2,6 +2,7 @@
 
 namespace saas\controllers;
 
+use biz\merchant\services\MerchantExtendService;
 use Yii;
 use biz\admin\services\AdminService;
 use biz\merchant\services\MerchantService;
@@ -197,7 +198,22 @@ class MerchantController extends BaseController
 	//注释商家 shish 2020.3.4
 	public function actionCancel()
 	{
+		if (getenv('YII_ENV') != 'test') {
+			util::fail('只有测试环境才能操作');
+		}
+		$id = Yii::$app->request->get('id', 0);
+		$merchant = MerchantService::getById($id, true);
+		if (isset($merchant->wxAppId) && empty($merchant->wxAppId)) {
+			util::fail('已注销/未授权');
+		}
+		$merchant->wxAppId = '';
+		$merchant->miniAppId = '';
+		$merchant->save();
+		$extend = MerchantExtendService::getByMerchantId($id, true);
+		$extend->miniAppId = '';
+		$extend->wxAppId = '';
+		$extend->save();
 		util::ok();
 	}
-
+	
 }