| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace console\controllers;
- use biz\admin\classes\AdminClass;
- use biz\shop\classes\ShopClass;
- use biz\sj\classes\SjClass;
- use bizHd\saas\classes\ApplyClass;
- use bizHd\saas\classes\StaffClass;
- use common\components\util;
- use yii\console\Controller;
- class SjController extends Controller
- {
- // 删除账号 ssh 2021.2.27
- // ./yii sj/del 17061583291 15280215347
- // ./yii.bat sj/del 17061583291 15280215347
- public function actionDel()
- {
- if (getenv('YII_ENV') == 'production') {
- echo "线上不允许操作";
- util::stop();
- }
- global $argv;
- foreach ($argv as $key => $item) {
- if ($key > 1) {
- $mobile = $item;
- $shop = ShopClass::getByCondition(['mobile' => $mobile], true);
- if (!empty($shop)) {
- $merchantName = $shop->merchantName ?? '';
- if (!empty($merchantName)) {
- SjClass::deleteByCondition(['name' => $merchantName]);
- }
- $shop->delete();
- }
- ApplyClass::deleteByCondition(['mobile' => $mobile]);
- $admin = AdminClass::getByCondition(['mobile' => $mobile], true);
- if (!empty($admin)) {
- $adminId = $admin->id ?? 0;
- StaffClass::deleteByCondition(['adminId' => $adminId]);
- $admin->delete();
- }
- }
- }
- }
- }
|