This commit is contained in:
root
2019-11-30 17:53:54 +08:00
parent 969762b98c
commit fdf63813df
22 changed files with 109 additions and 21 deletions

View File

@ -0,0 +1,67 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\User;
use App\Utils\Helper;
use App\Models\Order;
use Illuminate\Support\Facades\Redis;
class SystemCache extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'system:cache';
/**
* The console command description.
*
* @var string
*/
protected $description = '系统缓存任务';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->setMonthIncome();
$this->setMonthRegisterTotal();
}
private function setMonthIncome() {
Redis::set(
'getMonthIncome',
Order::where('created_at', '>', strtotime(date('Y-m-1')))
->where('created_at', '>', time())
->where('status', '3')
->where('callback_no', '!=', NULL)
->sum('total_amount')
);
}
private function setMonthRegisterTotal() {
Redis::set(
'getMonthRegisterTotal',
User::where('created_at', '>', strtotime(date('Y-m-1')))
->where('created_at', '>', time())
->count()
);
}
}

View File

@ -24,11 +24,14 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// check order
$schedule->command('check:order')->everyMinute();
// check expire
$schedule->command('check:expire')->everyMinute();
// check commission
$schedule->command('check:commission')->everyMinute();
// $schedule->command('inspire')
// ->hourly();
// system cache
$schedule->command('system:cache')->everyMinute();
}
/**

View File

@ -0,0 +1,18 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\Admin\ServerSave;
use App\Http\Requests\Admin\ServerUpdate;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\ServerGroup;
use App\Models\Server;
use App\Models\Plan;
use App\Models\User;
class StatController extends Controller
{
public function dashboard (Request $request) {
}
}