|
|
@@ -3,6 +3,7 @@
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
+use App\Http\Models\Config;
|
|
|
use App\Http\Models\User;
|
|
|
use Log;
|
|
|
|
|
|
@@ -19,8 +20,26 @@ class autoDisableExpireUserJob extends Command
|
|
|
public function handle()
|
|
|
{
|
|
|
// 到期账号禁用
|
|
|
+ $config = $this->systemConfig();
|
|
|
+ if ($config['is_ban_status']) {
|
|
|
+ User::query()->where('enable', 1)->where('expire_time', '<=', date('Y-m-d'))->update(['enable' => 0, 'status' => -1]);
|
|
|
+ }
|
|
|
+ else{
|
|
|
User::query()->where('enable', 1)->where('expire_time', '<=', date('Y-m-d'))->update(['enable' => 0]);
|
|
|
+ }
|
|
|
|
|
|
Log::info('定时任务:' . $this->description);
|
|
|
}
|
|
|
+
|
|
|
+ // 系统配置
|
|
|
+ private function systemConfig()
|
|
|
+ {
|
|
|
+ $config = Config::query()->get();
|
|
|
+ $data = [];
|
|
|
+ foreach ($config as $vo) {
|
|
|
+ $data[$vo->name] = $vo->value;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
}
|