1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Console\Commands;
- use App\DataApi\Helper\AppUserHelper;
- use Illuminate\Support\Facades\Log;
- //保存在线人数数据
- class saveOnlineUserCount extends \Illuminate\Console\Command
- {
- protected $signature = "save_online_user_count:sync";
- protected $description = 'save_online_user_count sync';
- public function __construct()
- {
- parent::__construct();
- }
- public function handle()
- {
- $AppUserHelper = new AppUserHelper;
- $AppUserHelper->getOnlineUserCount(1);
- Log::info('同步保存在线人数数据成功,请等待下次更新');
- $i = 0;
- //五分钟同步一次
- while ($i < 300) {
- sleep(1);
- $i++;
- }
- $this->handle();
- }
- }
|