update
This commit is contained in:
@@ -74,7 +74,7 @@ class HandleBotAttendanceSession extends Command
|
||||
$botRate = $attendanceSetting['bot_rate'] ?? 10;
|
||||
$bots = $this->attendanceSessionRepository->getRandomBotsAttendance($botRate,
|
||||
$phoneUserAttendance);
|
||||
$randomNumberTakeBot = random_int(10, 40);
|
||||
$randomNumberTakeBot = random_int(40, 90);
|
||||
$phoneBots = collect($bots)
|
||||
->take(round(($randomNumberTakeBot / 100) * count($bots)))
|
||||
->pluck("phone")
|
||||
@@ -94,7 +94,8 @@ class HandleBotAttendanceSession extends Command
|
||||
} else {
|
||||
$numberBotInsert = random_int(0, 5);
|
||||
}
|
||||
Log::warning("BOT INSERT: ".$numberBotInsert);
|
||||
Log::info("BOT INSERT: ".$numberBotInsert);
|
||||
Log::info("CURRENT_SESSION: ".$attendanceSessionCurrent->id);
|
||||
$botsHandling = collect($phoneBots)->take($numberBotInsert)->toArray();
|
||||
foreach ($botsHandling as $index => $phoneBot) {
|
||||
DB::table('users_attendance_session')->insert([
|
||||
|
@@ -8,6 +8,8 @@ use App\Models\AttendanceSetting;
|
||||
use App\Models\LichSuChoiMomo;
|
||||
use App\Models\Setting;
|
||||
use App\Traits\PhoneNumber;
|
||||
use App\Models\DoanhThu;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Queue\Listener;
|
||||
@@ -166,6 +168,7 @@ class HandleUserWinAttendanceSession extends Command
|
||||
$phoneWin = $setPhoneWin;
|
||||
AttendanceSetting::first()->update(['setphonewin' => null]);
|
||||
}
|
||||
|
||||
// Log::info("end phone win");
|
||||
DB::table('lich_su_choi_momos')->insert([
|
||||
'sdt' => $phoneWin,
|
||||
@@ -180,6 +183,20 @@ class HandleUserWinAttendanceSession extends Command
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
]);
|
||||
// update doanh thu ngày
|
||||
$doanhThu = new DoanhThu;
|
||||
$getDoanhThu = $doanhThu->whereDate('created_at', Carbon::today())->limit(1);
|
||||
if ($getDoanhThu->count() > 0){
|
||||
$GetLimitCron = $getDoanhThu->first();
|
||||
$GetLimitCron->doanhthungay = $GetLimitCron->doanhthungay - $amount;
|
||||
$GetLimitCron->save();
|
||||
|
||||
}else{
|
||||
$doanhThu= new DoanhThu;
|
||||
$doanhThu->doanhthungay = -$amount;
|
||||
$doanhThu->save();
|
||||
|
||||
}
|
||||
}
|
||||
return $phoneWin;
|
||||
}
|
||||
|
Reference in New Issue
Block a user