master
elf 2 years ago
parent e0c3aa652b
commit c6ad3eb590

@ -5,6 +5,8 @@ declare(strict_types=1);
namespace App\Command; namespace App\Command;
use App\Helper\Client\Lanhuo; use App\Helper\Client\Lanhuo;
use App\Model\DeviceRecord;
use App\Model\UserLoginRecord;
use Hyperf\Command\Command as HyperfCommand; use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command; use Hyperf\Command\Annotation\Command;
use Hyperf\Contract\ContainerInterface; use Hyperf\Contract\ContainerInterface;
@ -93,6 +95,65 @@ class JinlingCommand extends HyperfCommand
'status' => 1, //支付状态(待支付 0 已支付 1 支付失败 2) 'status' => 1, //支付状态(待支付 0 已支付 1 支付失败 2)
]); */ ]); */
var_dump(Lanhuo::auth()); // var_dump(Lanhuo::auth());
}
public function deleteUserLoginRecord() {
$gameIds = $this->getNeedDeleteGameIds();
$this->info('deleteUserLoginRecord:' . implode(',', $gameIds));
foreach ($gameIds as $gameId) {
$this->deleteUserLoginRecordByGameId($gameId);
}
}
private function getNeedDeleteGameIds() {
$gameIds = explode(',', '274,229,230,199,197,189,172,168,77,164,159,224,200,198,190,173,169,78,165,160,221,225,226,271');
$gameIds = array_merge($gameIds, explode(',', '201,155,217,237,269,202,156,218,238,270'));
$gameIds = array_merge($gameIds, explode(',', '193,183,179,203,209,227,241,243,249,251,194,184,180,204,210,228,242,244,250,252'));
$gameIds = array_merge($gameIds, explode(',', '153,231,258,272,291,154,232,259,273,292'));
$gameIds = array_merge($gameIds, explode(',', '213,214,233,234'));
return $gameIds;
}
private function deleteUserLoginRecordByGameId($gameId) {
$this->info('======= begin delete game_id ' . $gameId . ' =======');
$firstId = 0;
$hasMore = true;
do {
$this->info('delete game_id ' . $gameId . ' from id' . $firstId);
// UserLoginRecord::query()->where('game_id', $gameId)->where('id', '>=', $firstId)->limit(10000)->delete();
$record = UserLoginRecord::query()->where('game_id', $gameId)->first();
if (empty($record)) {
$hasMore = false;
} else {
$firstId = $record->id;
}
} while($hasMore);
$this->info('======= end delete game_id ' . $gameId . ' =======');
}
public function deleteDeviceRecord() {
$gameIds = $this->getNeedDeleteGameIds();
$this->info('deleteDeviceRecord:' . implode(',', $gameIds));
foreach ($gameIds as $gameId) {
$this->deleteDeviceRecordByGameId($gameId);
}
}
private function deleteDeviceRecordByGameId($gameId) {
$this->info('======= begin delete game_id ' . $gameId . ' =======');
$firstId = 0;
$hasMore = true;
do {
$this->info('delete game_id ' . $gameId . ' from id' . $firstId);
// DeviceRecord::query()->where('game_id', $gameId)->where('id', '>=', $firstId)->limit(10000)->delete();
$record = DeviceRecord::query()->where('game_id', $gameId)->first();
if (empty($record)) {
$hasMore = false;
} else {
$firstId = $record->id;
}
} while($hasMore);
$this->info('======= end delete game_id ' . $gameId . ' =======');
} }
} }

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace App\Model;
class DeviceRecord extends Model
{
protected $table = 'tab_device_record';
}

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace App\Model;
class UserLoginRecord extends Model
{
protected $table = 'tab_user_login_record';
}
Loading…
Cancel
Save