|
@@ -0,0 +1,66 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Console\Commands;
|
|
|
+
|
|
|
+use App\Modules\User\Models\QappPackage;
|
|
|
+use App\Modules\User\Models\QappUser;
|
|
|
+use App\Modules\User\Models\User;
|
|
|
+use Illuminate\Console\Command;
|
|
|
+
|
|
|
+class delQappUser extends Command
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * The name and signature of the console command.
|
|
|
+ *
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $signature = 'qappUser:del';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * The console command description.
|
|
|
+ *
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $description = 'Command description';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create a new command instance.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ parent::__construct();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Execute the console command.
|
|
|
+ *
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function handle()
|
|
|
+ {
|
|
|
+ $this->info('用户删除开始');
|
|
|
+ try {
|
|
|
+ $uid = $this->ask('请输入你想要删除的用户uid?');
|
|
|
+ $user = QappUser::getUserByUid($uid);
|
|
|
+ if ($user) {
|
|
|
+ $channel = QappPackage::where(['channel_id' => $user['channel_id']])->value("name");
|
|
|
+ if ($this->confirm("确定要删除" . $channel . "的uid为{$uid}的用户吗? [y|N]")) {
|
|
|
+ $this->info("用户删除中........");
|
|
|
+ QappUser::where(['uid' => $user['uid']])->update(['device_no' => $user['androidid'].$user['uid']]);
|
|
|
+ User::where(['id' => $user['uid']])->update(['openid' => $user['androidid'].$user['uid']]);
|
|
|
+ } else {
|
|
|
+ $this->info("取消删除");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $this->info("UID为{$uid}的用户不存在");
|
|
|
+ }
|
|
|
+ $this->info("操作完成");
|
|
|
+ } catch (\Exception $exception) {
|
|
|
+ $this->error("uid 为{$uid}的用户删除你是失败");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|