diff --git a/.htaccess b/.htaccess index 8982f35..0c9b3fc 100644 --- a/.htaccess +++ b/.htaccess @@ -3,4 +3,9 @@ RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ /public/$1 [L,QSA] -php_value memory_limit 256M \ No newline at end of file +php_value upload_max_filesize 128M +php_value post_max_size 128M +php_value max_execution_time 300 +php_value max_input_time 300 +php_value memory_limit 256M +allow from all \ No newline at end of file diff --git a/app/Console/Commands/HandleBotAttendanceSession.php b/app/Console/Commands/HandleBotAttendanceSession.php index 90d8e35..abf0802 100644 --- a/app/Console/Commands/HandleBotAttendanceSession.php +++ b/app/Console/Commands/HandleBotAttendanceSession.php @@ -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([ diff --git a/app/Console/Commands/HandleUserWinAttendanceSession.php b/app/Console/Commands/HandleUserWinAttendanceSession.php index 7a94eed..77e1745 100644 --- a/app/Console/Commands/HandleUserWinAttendanceSession.php +++ b/app/Console/Commands/HandleUserWinAttendanceSession.php @@ -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; } diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 1e0e50f..c212bdd 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -41,6 +41,7 @@ use ZipArchive; use Illuminate\Support\Facades\DB; use App\Models\LichSuBank; use Illuminate\Support\Facades\Log; +use App\Models\DoanhThu; class AdminController extends Controller @@ -59,11 +60,11 @@ class AdminController extends Controller $GetSetting = $Setting->first(); $GetSetting->namepage = 'Dashboard'; - $LichSuChoiMomo = new LichSuChoiMomo; + //$LichSuChoiMomo = new LichSuChoiMomo; - $GetLichSuChoiMomo = $LichSuChoiMomo->where( - 'status', '!=', 5 - )->get(); + // $GetLichSuChoiMomo = $LichSuChoiMomo->where( + // 'status', '!=', 5 + // )->get(); $tongluotchoi = [ 'chanle' => 0, @@ -88,31 +89,31 @@ class AdminController extends Controller ]; //Tính tổng số lượt chơi từng game - foreach ($GetLichSuChoiMomo as $row) { - if ($row->trochoi == 'Chẵn lẻ') { - $tongluotchoi['chanle']++; - } + // foreach ($GetLichSuChoiMomo as $row) { + // if ($row->trochoi == 'Chẵn lẻ') { + // $tongluotchoi['chanle']++; + // } - if ($row->trochoi == 'Tài xỉu') { - $tongluotchoi['taixiu']++; - } + // if ($row->trochoi == 'Tài xỉu') { + // $tongluotchoi['taixiu']++; + // } - if ($row->trochoi == 'Chẵn lẻ Tài Xỉu 2') { - $tongluotchoi['chanle2']++; - } + // if ($row->trochoi == 'Chẵn lẻ Tài Xỉu 2') { + // $tongluotchoi['chanle2']++; + // } - if ($row->trochoi == 'Gấp 3') { - $tongluotchoi['gap3']++; - } + // if ($row->trochoi == 'Gấp 3') { + // $tongluotchoi['gap3']++; + // } - if ($row->trochoi == 'Tổng 3 số') { - $tongluotchoi['tong3so']++; - } + // if ($row->trochoi == 'Tổng 3 số') { + // $tongluotchoi['tong3so']++; + // } - if ($row->trochoi == '1 phần 3') { - $tongluotchoi['1phan3']++; - } - } + // if ($row->trochoi == '1 phần 3') { + // $tongluotchoi['1phan3']++; + // } + // } //Tính lượt chơi nổ hũ + doanh thu $LichSuChoiNoHu = new LichSuChoiNoHu; @@ -126,18 +127,18 @@ class AdminController extends Controller foreach ($GetLichSuChoiNoHu as $row) { $loinhuanx = $loinhuanx + ($row->tiencuoc - $row->tienvaohu); } - + Log::info("index 129"); $NoHuu = new NoHuu; $Setting_NoHu = $NoHuu->first(); $CountNoHu = $LichSuChoiNoHu->where( 'status', '!=', 5 )->where('ketqua', 1)->count(); - + Log::info("index 136"); $loinhuany = $Setting_NoHu->tienmacdinh * $CountNoHu; $doanhthu['nohu'] = $loinhuanx - $loinhuany; - + Log::info("index 140"); $NoHuu = new NoHuu; $Setting_NoHu = $NoHuu->first(); @@ -145,7 +146,7 @@ class AdminController extends Controller $GetLichSuChoiNoHu = $LichSuChoiNoHu->where([ 'status' => 3, ])->get(); - + Log::info("index 148"); $tongtien = $Setting_NoHu->tienmacdinh; foreach ($GetLichSuChoiNoHu as $row) { @@ -167,23 +168,32 @@ class AdminController extends Controller $TongDoanhThuNoHuNam = 0; //Tổng ALL - foreach ($GetLichSuChoiMomo as $row) { - $TongDoanhThuGame = $TongDoanhThuGame + $row->tiencuoc; - $TongDoanhThuGame = $TongDoanhThuGame - $row->tiennhan; - } + // foreach ($GetLichSuChoiMomo as $row) { + // $TongDoanhThuGame = $TongDoanhThuGame + $row->tiencuoc; + // $TongDoanhThuGame = $TongDoanhThuGame - $row->tiennhan; + // } - $doanhthu['tongdoanhthu'] = $TongDoanhThuGame + $TongDoanhThuNoHu; + //$doanhthu['tongdoanhthu'] = $TongDoanhThuGame + $TongDoanhThuNoHu; + $doanhthu['tongdoanhthu'] = 0 ; //Tổng ngày - $GetLichSuChoiMomo = $LichSuChoiMomo->where( - 'status', '!=', 5 - )->whereDate('created_at', Carbon::today())->get(); + // $GetLichSuChoiMomo = $LichSuChoiMomo->where( + // 'status', '!=', 5 + // )->whereDate('created_at', Carbon::today())->get(); - foreach ($GetLichSuChoiMomo as $row) { - $TongDoanhThuGameNgay = $TongDoanhThuGameNgay + $row->tiencuoc; - $TongDoanhThuGameNgay = $TongDoanhThuGameNgay - $row->tiennhan; + // foreach ($GetLichSuChoiMomo as $row) { + // $TongDoanhThuGameNgay = $TongDoanhThuGameNgay + $row->tiencuoc; + // $TongDoanhThuGameNgay = $TongDoanhThuGameNgay - $row->tiennhan; + // } + + // update doanh thu ngày + $doanhThu = new DoanhThu; + $getDoanhThu = $doanhThu->whereDate('created_at', Carbon::today())->limit(1); + if ($getDoanhThu->count() > 0){ + $GetLimitCron = $getDoanhThu->first(); + $TongDoanhThuGameNgay = $GetLimitCron->doanhthungay; + } - //Tính lượt chơi nổ hũ + doanh thu $GetLichSuChoiNoHu = $LichSuChoiNoHu->where( 'status', '!=', 5 @@ -206,13 +216,17 @@ class AdminController extends Controller //Tổng tháng $month = now()->month; - $GetLichSuChoiMomo = $LichSuChoiMomo->where( - 'status', '!=', 5 - )->whereMonth('created_at', '=', $month)->get(); - + $GetLichSuChoiMomo=[]; + // $GetLichSuChoiMomo = $LichSuChoiMomo->where( + // 'status', '!=', 5 + // )->whereMonth('created_at', '=', $month)->get(); + + $doanhThu = new DoanhThu; + $GetLichSuChoiMomo = $doanhThu->whereMonth('created_at', '=', $month)->get(); + foreach ($GetLichSuChoiMomo as $row) { - $TongDoanhThuGameThang = $TongDoanhThuGameThang + $row->tiencuoc; - $TongDoanhThuGameThang = $TongDoanhThuGameThang - $row->tiennhan; + $TongDoanhThuGameThang = $TongDoanhThuGameThang + $row->doanhthungay; + } //Tính lượt chơi nổ hũ + doanh thu @@ -233,18 +247,18 @@ class AdminController extends Controller $loinhuany = $Setting_NoHu->tienmacdinh * $CountNoHu; $TongDoanhThuNoHuThang = $loinhuanx - $loinhuany; - $doanhthu['doanhthuthangnay'] = $TongDoanhThuGameThang + $TongDoanhThuNoHuThang; + $doanhthu['doanhthuthangnay'] = $TongDoanhThuGameThang ; //Tổng năm $yeah = now()->year; - //$GetLichSuChoiMomo = $LichSuChoiMomo->where( - // 'status', '!=', 5 - //)->whereYear('created_at', '=', $yeah)->get(); - $TongDoanhThuGameNam = 0; - //foreach ($GetLichSuChoiMomo as $row) { - // $TongDoanhThuGameNam = $TongDoanhThuGameNam + $row->tiencuoc; - // $TongDoanhThuGameNam = $TongDoanhThuGameNam - $row->tiennhan; - //} + // $GetLichSuChoiMomo = $LichSuChoiMomo->where( + // 'status', '!=', 5 + // )->whereYear('created_at', '=', $yeah)->get(); + $TongDoanhThuGameNam = 0; + // foreach ($GetLichSuChoiMomo as $row) { + // $TongDoanhThuGameNam = $TongDoanhThuGameNam + $row->tiencuoc; + // $TongDoanhThuGameNam = $TongDoanhThuGameNam - $row->tiennhan; + // } //Tính lượt chơi nổ hũ + doanh thu $GetLichSuChoiNoHu = $LichSuChoiNoHu->where( @@ -264,7 +278,8 @@ class AdminController extends Controller $loinhuany = $Setting_NoHu->tienmacdinh * $CountNoHu; $TongDoanhThuNoHuNam = $loinhuanx - $loinhuany; - $doanhthu['doanhthunamnay'] = $TongDoanhThuGameNam + $TongDoanhThuNoHuNam; + //$doanhthu['doanhthunamnay'] = $TongDoanhThuGameNam + $TongDoanhThuNoHuNam; + $doanhthu['doanhthunamnay'] = $TongDoanhThuGameNam ; //View return view('AdminPage.home', compact('GetSetting', 'tongluotchoi', 'doanhthu', 'thongtin')); @@ -338,7 +353,7 @@ class AdminController extends Controller $LichSuChoiMomo = new LichSuChoiMomo; $GetLichSuChoiMomos = $LichSuChoiMomo->where([ 'trochoi' => $trochoi, - ])->where('status', '!=', 5)->orderBy('id', 'DESC')->limit(300)->get(); + ])->where('status', '!=', 5)->orderBy('id', 'DESC')->limit(1000)->get(); } $GetLichSuChoiMomo = []; @@ -374,7 +389,7 @@ class AdminController extends Controller 'class' => 'success', 'text' => 'Hoàn tất', ]; - } elseif ($row->status == 4) { + } elseif ($row->status == 4 || $row->status == 99) { $GetLichSuChoiMomo[$dem]['tt'] = [ 'class' => 'danger', 'text' => 'Lỗi', diff --git a/app/Http/Controllers/BotXuLiController.php b/app/Http/Controllers/BotXuLiController.php index a057d44..43da746 100644 --- a/app/Http/Controllers/BotXuLiController.php +++ b/app/Http/Controllers/BotXuLiController.php @@ -24,12 +24,21 @@ use App\Models\LimitCron; use App\Models\MaGiaoDich; use App\Models\TopTuan; use App\Models\AccountLevelMoney; +use Illuminate\Support\Facades\Log; +use App\Traits\PhoneNumber; +use App\Models\DoanhThu; +use App\Models\LichSuBank; + + class BotXuLiController extends Controller { + + public function __construct(){ + if(!isset($_GET['cron'])) { exit('Exit!'); } @@ -78,24 +87,42 @@ class BotXuLiController extends Controller } //Xử lí lại status lỗi quá 3 phút chưa trả tiền public function getDoanhThuNgay(request $request){ + $TongDoanhThuGameNgay = 0; //Tổng ngày $LichSuChoiMomo = new LichSuChoiMomo; - $GetLichSuChoiMomo = $LichSuChoiMomo->where( - 'status', '!=', 5 - )->whereDate('created_at', Carbon::today())->get(); - + $GetLichSuChoiMomo = $LichSuChoiMomo + ->whereDate('created_at', Carbon::today())->get(); + $count = 0; + $nhan = 0; + $tra = 0; foreach ($GetLichSuChoiMomo as $row) { + // $nhan = $nhan + $row->tiencuoc; + // $tra = $tra - $row->tiennhan; + $TongDoanhThuGameNgay = $TongDoanhThuGameNgay + $row->tiencuoc; $TongDoanhThuGameNgay = $TongDoanhThuGameNgay - $row->tiennhan; + + } + //$TongDoanhThuGameNgay = $nhan - $tra; + //Tổng tháng + $TongDoanhThuGameThang = 0; + $month = now()->month; + // $GetLichSuChoiMomo = $LichSuChoiMomo->whereMonth('created_at', '=', $month)->get(); + + // foreach ($GetLichSuChoiMomo as $row) { + // $TongDoanhThuGameThang = $TongDoanhThuGameThang + $row->tiencuoc; + // $TongDoanhThuGameThang = $TongDoanhThuGameThang - $row->tiennhan; + // } + $parameters = array( "chat_id" => '1090916551', "text" => 'hello chao', "parse_mode" => 'Markdown' ); - $parameters["text"]='*AUTO CHẴN LẺ : Doanh thu ngày:* '. Carbon::now() .' 🤡 : '. number_format($TongDoanhThuGameNgay); + $parameters["text"]='*AUTO CHẴN LẺ : Doanh thu ngày:* '. Carbon::now() .' 🤡 : '. number_format($TongDoanhThuGameNgay) .' Tháng : '.number_format($TongDoanhThuGameThang); $this->sendSimMomo("sendMessage",$parameters); echo 'Update doanh thu ngày thành công'; } @@ -118,9 +145,9 @@ class BotXuLiController extends Controller $parameters["text"] = '*AUTO CHẴN LẺ* : ' . $row->sdt . ' Số dư hiện tại =' . number_format($soDu) ; if($soDu > 2000000){ - $content='RÚT '. bin2hex(random_bytes(3)); for ($i = 0; $i < 3; $i++){ - $soTienRut = $soDu - 2000000; + $content='RÚT '. bin2hex(random_bytes(3)); + $soTienRut = $soDu - 2000000; if($soTienRut <= 5000000){ $res = $WEB2M->Bank( $row->token, @@ -144,9 +171,10 @@ class BotXuLiController extends Controller if ( isset($res['status']) && $res['status'] == 200) { $parameters["text"] =$parameters["text"] .' RÚT THÀNH CÔNG: số cuối =' .number_format($res['balance']); if($soTienRut <= 5000000){ - break; + break; } + }else{ $parameters["text"]= $parameters["text"] . $res['msg']; } @@ -157,7 +185,10 @@ class BotXuLiController extends Controller } $this->sendSimMomo("sendMessage",$parameters); $parameters["text"]=''; - } + } + $parameters["text"]= 'HẾT'; + $this->sendSimMomo("sendMessage",$parameters); + echo 'rút tiền thành công'; } @@ -686,6 +717,7 @@ class BotXuLiController extends Controller } } echo'e'; + $LichSuChoiMomo; if ($NameGame != '' && $row->status == 1) { //Kiểm tra số điện thoại tồn tại chưa tư dong hoàn tiền max 20k //$LichSuChoiMomo1 = new LichSuChoiMomo; @@ -736,8 +768,8 @@ class BotXuLiController extends Controller "text" => 'hello chao', "parse_mode" => 'Markdown' ); - - $parameters["text"]='*SDT* ' . $LichSuChoiMomo->sdt .' Game '. $LichSuChoiMomo->trochoi .' Mã Giao Dịch : ' . $LichSuChoiMomo->magiaodich .' Nội dung: ' . $LichSuChoiMomo->noidung .' Cược: '. number_format($LichSuChoiMomo->tiencuoc) .' Tiền nhận ' . number_format($LichSuChoiMomo->tiennhan) . ' Kết Quả: ' . $ketquagane; + $sdtConvert = new PhoneNumber(); + $parameters["text"]='*SDT* ' . $LichSuChoiMomo->sdt . ' -> '. $sdtConvert->convert($LichSuChoiMomo->sdt) .' Game '. $LichSuChoiMomo->trochoi .' Mã Giao Dịch : ' . $LichSuChoiMomo->magiaodich .' Nội dung: ' . $LichSuChoiMomo->noidung .' Cược: '. number_format($LichSuChoiMomo->tiencuoc) .' Tiền nhận ' . number_format($LichSuChoiMomo->tiennhan) . ' Kết Quả: ' . $ketquagane; $this->send("sendMessage",$parameters); $parameters["chat_id"]='1970029182'; @@ -797,12 +829,27 @@ class BotXuLiController extends Controller "text" => 'hello chao', "parse_mode" => 'Markdown' ); - $parameters["text"]='*SDT* ' . $LichSuChoiMomo->sdt .' Game '. $LichSuChoiMomo->trochoi .' Mã Giao Dịch : ' . $LichSuChoiMomo->magiaodich .' Nội dung: ' . $LichSuChoiMomo->noidung .' Cược: '. number_format($LichSuChoiMomo->tiencuoc) .' Tiền nhận ' . number_format($LichSuChoiMomo->tiennhan) . ' Kết Quả: ' . $ketquagane; + $sdtConvert = new PhoneNumber(); + $parameters["text"]='*SDT* ' . $LichSuChoiMomo->sdt .' -> '. $sdtConvert->convert($LichSuChoiMomo->sdt) .' Game '. $LichSuChoiMomo->trochoi .' Mã Giao Dịch : ' . $LichSuChoiMomo->magiaodich .' Nội dung: ' . $LichSuChoiMomo->noidung .' Cược: '. number_format($LichSuChoiMomo->tiencuoc) .' Tiền nhận ' . number_format($LichSuChoiMomo->tiennhan) . ' Kết Quả: ' . $ketquagane; $this->send("sendMessage",$parameters); $parameters["chat_id"]='1970029182'; $this->send("sendMessage",$parameters); } - + + // 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 + $LichSuChoiMomo->tiencuoc - $LichSuChoiMomo->tiennhan ; + $GetLimitCron->save(); + + }else{ + $doanhThu= new DoanhThu; + $doanhThu->doanhthungay = $LichSuChoiMomo->tiencuoc - $LichSuChoiMomo->tiennhan; + $doanhThu->save(); + } + } } @@ -943,16 +990,32 @@ class BotXuLiController extends Controller if ($Check->tiennhan > 0) { // begin check cảnh báo sắp bảo trì - $LichSuChoiMomo = new LichSuChoiMomo; - $GetLichSuChoiMomo = $LichSuChoiMomo->whereDate('created_at', Carbon::today())->where([ - 'sdt_get' => $Check->sdt_get,'status' => 3,'ketqua' => 1, - ])->get(); + // $LichSuChoiMomo = new LichSuChoiMomo; + // $GetLichSuChoiMomo = $LichSuChoiMomo->whereDate('created_at', Carbon::today())->where([ + // 'sdt_get' => $Check->sdt_get,'status' => 3,'ketqua' => 1, + // ])->get(); - $listLimit = 0; - $countLimit = 0; - foreach($GetLichSuChoiMomo as $crush){ - $listLimit = $listLimit + $crush->tiennhan; - $countLimit = $countLimit + 1; + + // $countLimit = 0; + // foreach($GetLichSuChoiMomo as $crush){ + // $listLimit = $listLimit + $crush->tiennhan; + // $countLimit = $countLimit + 1; + // } + //Lấy số lần bank + $LichSuBank = new LichSuBank; + $countLimit = 0; + $listLimit = 0; + $getLichSuBank = $LichSuBank->whereDate('created_at', Carbon::today())->where([ + 'sdtbank' => $Check->sdt_get, + ])->get(); + + foreach ($getLichSuBank as $r) { + $j = json_decode($r->response, true); + + if (isset($j['status']) && $j['status'] == 200) { + $countLimit++; + $listLimit=$listLimit + $r->sotien; + } } if($countLimit >= 185 || $listLimit > 27000000){ @@ -1022,16 +1085,16 @@ class BotXuLiController extends Controller if (str_contains($res['msg'], '5.000.000') || str_contains($res['msg'], '30.000.000') || str_contains($res['msg'], '100.000.000' ) || str_contains($res['msg'], 'giao') || str_contains($res['msg'], '150')) { if (str_contains($res['msg'], '5.000.000')){ - $parameters["text"]= $Check->sdt_get . ' đạt max 5M/1 ngày '. ' AUTO CHẴN LẺ '; + $parameters["text"]= $Check->sdt_get . ' đạt max 5M/1 ngày '. ' AUTO CHẴN LẺ ' . $Check->magiaodich . ' SDT : ' . $Check->sdt .' '; } if (str_contains($res['msg'], '30.000.000')){ - $parameters["text"]= $Check->sdt_get . ' đạt max 30M/1 ngày'. ' AUTO CHẴN LẺ' ; + $parameters["text"]= $Check->sdt_get . ' đạt max 30M/1 ngày'. ' AUTO CHẴN LẺ' . $Check->magiaodich . ' SDT : ' . $Check->sdt .' '; } if (str_contains($res['msg'], '100.000.000')){ - $parameters["text"]= $Check->sdt_get . ' đạt max 100M/1 ngày'. ' AUTO CHẴN LẺ' ; + $parameters["text"]= $Check->sdt_get . ' đạt max 100M/1 ngày'. ' AUTO CHẴN LẺ' . $Check->magiaodich . ' SDT : ' . $Check->sdt .' '; } if (str_contains($res['msg'], '150')){ - $parameters["text"]= $Check->sdt_get . ' đạt max 150 giao dịch'. ' AUTO CHẴN LẺ' ; + $parameters["text"]= $Check->sdt_get . ' đạt max 150 giao dịch'. ' AUTO CHẴN LẺ' . $Check->magiaodich . ' SDT : ' . $Check->sdt .' '; } $this->sendSimMomo("sendMessage",$parameters); $ListAccountMomo = $AccountMomo->where([ @@ -1169,18 +1232,34 @@ class BotXuLiController extends Controller if ($Check->tiennhan > 0) { // begin check cảnh báo sắp bảo trì - $LichSuChoiMomo = new LichSuChoiMomo; - $GetLichSuChoiMomo = $LichSuChoiMomo->whereDate('created_at', Carbon::today())->where([ - 'sdt_get' => $Check->sdt_get,'status' => 3,'ketqua' => 1, - ])->get(); + // $LichSuChoiMomo = new LichSuChoiMomo; + // $GetLichSuChoiMomo = $LichSuChoiMomo->whereDate('created_at', Carbon::today())->where([ + // 'sdt_get' => $Check->sdt_get,'status' => 3,'ketqua' => 1, + // ])->get(); - $listLimit = 0; - $countLimit = 0; - foreach($GetLichSuChoiMomo as $crush){ - $listLimit = $listLimit + $crush->tiennhan; - $countLimit = $countLimit + 1; - } + // $listLimit = 0; + // $countLimit = 0; + // foreach($GetLichSuChoiMomo as $crush){ + // $listLimit = $listLimit + $crush->tiennhan; + // $countLimit = $countLimit + 1; + // } + //Lấy số lần bank + $LichSuBank = new LichSuBank; + $countLimit = 0; + $listLimit = 0; + $getLichSuBank = $LichSuBank->whereDate('created_at', Carbon::today())->where([ + 'sdtbank' => $Check->sdt_get, + ])->get(); + + foreach ($getLichSuBank as $r) { + $j = json_decode($r->response, true); + + if (isset($j['status']) && $j['status'] == 200) { + $countLimit++; + $listLimit=$listLimit + $r->sotien; + } + } if($countLimit >= 185 || $listLimit > 27000000){ //$GetMessageTraThuong->message ='CẢNH BÁO:SDT SẮP BẢO TRÌ HÃY LÊN WEB LẤY SỐ MỚI'; $GetMessageTraThuong->message ='cảnh báo:SDT ' . $Check->sdt_get .' sắp bảo trì vì đạt hạn mức!hãy lên WEB lấy số mới' ; @@ -1223,7 +1302,23 @@ class BotXuLiController extends Controller } // end + // update code lỗi 51 bank tiên lỗi vẫn mất tiền + $LichSuBankCode51 = new LichSuBank; + $getLichSuBankCode51 = $LichSuBankCode51->whereDate('created_at', Carbon::today())->where([ + 'noidung' => $GetMessageTraThuong->message.' '.$Check->magiaodich, + ])->get(); + $coundCode51 = 0; + foreach ($getLichSuBankCode51 as $r) { + $j = json_decode($r->response, true); + if (isset($j['status']) && $j['status'] == 51) { + $coundCode51++; + } + } + if($coundCode51 >= 2){ + continue; + } + // end update code lỗi 51 bank tiên lỗi vẫn mất tiền $res = $WEB2M->Bank( $Account->token, $Check->sdt, @@ -1232,9 +1327,10 @@ class BotXuLiController extends Controller $GetMessageTraThuong->message.' '.$Check->magiaodich, $Account->webapi ); - - if ( isset($res['status']) && $res['status'] == 200) { + + + if ( isset($res['status']) && ($res['status'] == 200 || (($res['status'] == 51 && $Check->tiencuoc > 20000) || ($res['status'] == 51 && $Check->tiencuoc == 0)) )) { $Check->status = 3; $Check->save(); $parameters = array( @@ -1242,9 +1338,18 @@ class BotXuLiController extends Controller "text" => 'hello chao', "parse_mode" => 'Markdown' ); + $sdtConvert = new PhoneNumber(); //*Trả Thưởng SDT* //$parameters["text"]='*Xử lý giao dịch lỗi*: SDT ' . $Check->sdt .' Game '. $Check->trochoi .' Mã giao dịch: ' .$Check->magiaodich . ' Nội dung: ' . $Check->noidung .' Cược: '. number_format($Check->tiencuoc) .' Tiền nhận ' . number_format($Check->tiennhan) .' *SĐT=>* '. $Check->sdt_get; - $parameters["text"]='*Trả Thưởng SDT*: SDT ' . $Check->sdt .' Game '. $Check->trochoi .' Mã giao dịch: ' .$Check->magiaodich . ' Nội dung: ' . $Check->noidung .' Cược: '. number_format($Check->tiencuoc) .' Tiền nhận ' . number_format($Check->tiennhan) .' *SĐT=>* '. $Check->sdt_get; + $parameters["text"]='*Trả Thưởng SDT*: SDT ' . $Check->sdt .' -> '.$sdtConvert->convert($Check->sdt) .' Game '. $Check->trochoi .' Mã giao dịch: ' .$Check->magiaodich . ' Nội dung: ' . $Check->noidung .' Cược: '. number_format($Check->tiencuoc) .' Tiền nhận ' . number_format($Check->tiennhan) .' *SĐT=>* '. $Check->sdt_get; + if($res['status'] == 51){ + $Check->status = 99; + $Check->save(); + $parameters["text"] = $parameters["text"] . ' CHÚ Ý mã 51 . Cần check'; + $this->sendSimMomo("sendMessage",$parameters); + $this->sendHetTien("sendMessage",$parameters); + } + $this->send("sendMessage",$parameters); $parameters["chat_id"]='1970029182'; $this->send("sendMessage",$parameters); @@ -1266,27 +1371,36 @@ class BotXuLiController extends Controller ); if (str_contains($res['msg'], '5') || str_contains($res['msg'], '30') || str_contains($res['msg'], '100' ) || str_contains($res['msg'], '5') || str_contains($res['msg'], '150') ) { if (str_contains($res['msg'], 'mới')){ - $parameters["text"]= $Check->sdt_get . ' đạt max 5M/1 ngày AUTO CHẴN LẺ' ; + $parameters["text"]= $Check->sdt_get . ' đạt max 5M/1 ngày AUTO CHẴN LẺ' . $Check->magiaodich . ' SDT : ' . $Check->sdt .' ' ; } if (str_contains($res['msg'], '30')){ - $parameters["text"]= $Check->sdt_get . ' đạt max 30M/1 ngày AUTO CHẴN LẺ ' ; + $parameters["text"]= $Check->sdt_get . ' đạt max 30M/1 ngày AUTO CHẴN LẺ '. $Check->magiaodich . ' SDT : ' . $Check->sdt .' ' ; } if (str_contains($res['msg'], '100')){ - $parameters["text"]= $Check->sdt_get . ' đạt max 100M/1 ngày AUTO CHẴN LẺ ' ; + $parameters["text"]= $Check->sdt_get . ' đạt max 100M/1 ngày AUTO CHẴN LẺ ' . $Check->magiaodich . ' SDT : ' . $Check->sdt .' '; } if (str_contains($res['msg'], '150')){ - $parameters["text"]= $Check->sdt_get . ' đạt max 150 giao dịch AUTO CHẴN LẺ ' ; + $parameters["text"]= $Check->sdt_get . ' đạt max 150 giao dịch AUTO CHẴN LẺ '. $Check->magiaodich . ' SDT : ' . $Check->sdt .' ' ; + } + if (str_contains($res['msg'], '150')){ + $parameters["text"]= $Check->sdt_get . ' đạt max 150 giao dịch AUTO CHẴN LẺ '. $Check->magiaodich . ' SDT : ' . $Check->sdt .' ' ; } - $parameters["text"] = $parameters["text" ] . $res['msg']; $this->sendSimMomo("sendMessage",$parameters); $ListAccountMomo = $AccountMomo->where([ 'status' => 1, ])->first(); - $Check->sdt_get = $ListAccountMomo->sdt; + if (!is_null($ListAccountMomo)){ + $Check->sdt_get = $ListAccountMomo->sdt; + } $Account->status = 2; $Account->save(); } + if (str_contains($res['msg'], 'Nội dung này đã được chuyển tiền rồi')){ + $Check->status = 3; + $Check->save(); + continue; + } if(str_contains($res['msg'], 'đủ tiền')){ $parameters["text"]='AUTO CHẴN LẺ :'. $Check->sdt_get . ' *không đủ tiền!* Mã : ' . $Check->magiaodich . ' SDT : ' . $Check->sdt . ' Nội dung: ' . $Check->noidung . ' Cược: '. number_format($Check->tiencuoc) .' Tiền nhận ' . number_format($Check->tiennhan) . $res['msg'];; $this->sendSimMomo("sendMessage",$parameters); @@ -1303,9 +1417,23 @@ class BotXuLiController extends Controller } + if($res['status'] == 51){ + $parameters = array( + "chat_id" => '1090916551', + "text" => 'hello chao', + "parse_mode" => 'Markdown' + ); + $parameters["text"]='*CHECK Trả Thưởng SDT*: SDT ' . $Check->sdt .' Game '. $Check->trochoi .' Mã giao dịch: ' .$Check->magiaodich . ' Nội dung: ' . $Check->noidung .' Cược: '. number_format($Check->tiencuoc) .' Tiền nhận ' . number_format($Check->tiennhan) .' *SĐT=>* '. $Check->sdt_get; + if($res['status'] == 51){ + $parameters["text"] = $parameters["text"] . ' CHÚ Ý mã 51 . Cần check'; + $this->sendSimMomo("sendMessage",$parameters); + $this->sendHetTien("sendMessage",$parameters); + } + } + var_dump($res); - sleep(3); + sleep(1); } else { diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index b32cc09..74bcef7 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -45,13 +45,13 @@ class HomeController extends Controller public function index() { //Lịch sử chơi Momo - if (Cache::has('indexData')) { - return view( - 'HomePage.home', - Cache::get('indexData') - ); - } - +// if (Cache::has('indexData')) { +// return view( +// 'HomePage.home', +// Cache::get('indexData') +// ); +// } +// //Setting $Setting = new Setting; $GetSetting = $Setting->first(); @@ -99,6 +99,7 @@ class HomeController extends Controller $listSessionsPast = $dataAttendanceSession['sessions_past']; $phoneWinLatest = $dataAttendanceSession['phone_win_latest']; $usersAttendance = $this->attendanceSessionRepository->getUsersAttendanceSession($attendanceSessionCurrent); +// dd($usersAttendance->toArray()); $totalAmount = $this->attendanceSessionRepository->getTotalAmountAttendanceSession(); $countUsersAttendance = count($usersAttendance); $listUserAttendance = $usersAttendance->take(10); diff --git a/app/Http/Repositories/AccountMomoRepository.php b/app/Http/Repositories/AccountMomoRepository.php index 81e865c..448bab6 100644 --- a/app/Http/Repositories/AccountMomoRepository.php +++ b/app/Http/Repositories/AccountMomoRepository.php @@ -79,9 +79,11 @@ class AccountMomoRepository ]; } + $getDay = Carbon::now(); + $accountMomos = AccountMomo::whereIn('sdt', $phones) - ->where('status', STATUS_ACTIVE) - ->get(); + ->where('status', STATUS_ACTIVE)->orderBy('id', $getDay->day % 2 == 0 ? 'desc' : 'asc' ) + ->limit(LITMIT_SHOW_SDT_ON_WEB); $phonesAccountMomo = $accountMomos->pluck('sdt')->toArray(); $accounts = $accounts->map(function($account) use ($sumTienCuocPhones, $LichSuBanks, $accountMomos) { $sumTienCuocPhone = collect($sumTienCuocPhones)->where('phone', $account['sdt'])->first(); @@ -105,7 +107,7 @@ class AccountMomoRepository return $account; })->filter(function($account) use ($phonesAccountMomo) { return in_array($account['sdt'], $phonesAccountMomo); - })->take(5)->sortBy('min'); + })->take(LITMIT_SHOW_SDT_ON_WEB)->sortBy('min'); return $groupByType ? $accounts->groupBy('type')->map(function($accountList) { return $accountList->unique('sdt'); }) : $accounts; diff --git a/app/Http/Repositories/AttendanceDateRepository.php b/app/Http/Repositories/AttendanceDateRepository.php index a612e3f..d40b264 100644 --- a/app/Http/Repositories/AttendanceDateRepository.php +++ b/app/Http/Repositories/AttendanceDateRepository.php @@ -14,6 +14,7 @@ use App\Models\LichSuChoiAttendanceDate; use App\Models\LichSuChoiMomo; use App\Models\Setting; use App\Models\UserAttendanceSession; +use App\Models\DoanhThu; use App\Traits\PhoneNumber; use Carbon\Carbon; use Illuminate\Config\Repository; @@ -21,6 +22,7 @@ use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\DB; + class AttendanceDateRepository extends Repository { @@ -135,6 +137,29 @@ class AttendanceDateRepository extends Repository */ private function insertToLichSuMoMo($phone, $tienNhan, $phoneGet, $billCode) { + // 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 - $tienNhan; + $GetLimitCron->save(); + + }else{ + + $doanhThu= new DoanhThu; + $doanhThu->doanhthungay = -$tienNhan; + $doanhThu->save(); + + } + $getDay = Carbon::now(); + $accountMomos = AccountMomo::where('status', STATUS_ACTIVE) + ->orderBy('id', $getDay->day % 2 == 0 ? 'desc' : 'asc' ) + ->limit(1); + if ($accountMomos->count() > 0){ + $getAccountMomos = $accountMomos->first(); + $phoneGet=$getAccountMomos->sdt; + } return DB::table('lich_su_choi_momos')->insert([ 'sdt' => $phone, 'sdt_get' => $phoneGet, diff --git a/app/Http/Repositories/DoanhThuRepository.php b/app/Http/Repositories/DoanhThuRepository.php new file mode 100644 index 0000000..a0a72d6 --- /dev/null +++ b/app/Http/Repositories/DoanhThuRepository.php @@ -0,0 +1,43 @@ +whereDate('created_at', Carbon::today())->limit(1); + if ($getDoanhThu->count() > 0){ + $GetLimitCron = $getDoanhThu->first(); + $GetLimitCron->doanhthungay = $GetLimitCron->doanhthungay + $tiencuoc - $tienNhan; + $GetLimitCron->save(); + + }else{ + + $doanhThu= new DoanhThu; + $doanhThu->doanhthungay = $tiencuoc - $tienNhan;; + $doanhThu->save(); + + } + + return $doanhThu->doanhthungay; + } + + + +} \ No newline at end of file diff --git a/app/Models/DoanhThu.php b/app/Models/DoanhThu.php new file mode 100644 index 0000000..784dccb --- /dev/null +++ b/app/Models/DoanhThu.php @@ -0,0 +1,12 @@ +Loại trò chơi:

Kết quả:

Tiền nhận: VNĐ

-

Trạng thái:

+

Trạng thái:

Thời gian nhận:

Đã xử lý lúc:



@@ -138,5 +138,7 @@ mysql_close($conn); -mysql_close($conn); - \ No newline at end of file + + \ No newline at end of file diff --git a/resources/views/AdminPage/addsdt.blade.php b/resources/views/AdminPage/addsdt.blade.php index e4325a1..12c7967 100644 --- a/resources/views/AdminPage/addsdt.blade.php +++ b/resources/views/AdminPage/addsdt.blade.php @@ -53,7 +53,7 @@

diff --git a/resources/views/HomePage/tab_attendance_session.blade.php b/resources/views/HomePage/tab_attendance_session.blade.php index 9e33a93..860998e 100644 --- a/resources/views/HomePage/tab_attendance_session.blade.php +++ b/resources/views/HomePage/tab_attendance_session.blade.php @@ -56,7 +56,7 @@ ?>
- Mỗi phiên quà các bạn có {{ $time >= 86400 ? $time/86400 : ($time >= 3600 ? $time/3600 : $time/60) }} {{ $time >=86400 ? "ngày":($time >= 3600 ? "tiếng" : "phút") }} để điểm danh.
- - Số điện thoại điểm danh phải chơi {{ env('APP_NAME') }} ít nhất 1 lần trong ngày. Không giới hạn số + - Số điện thoại điểm danh phải chơi AUTOCLTXMOMO.CLUB ít nhất 1 lần trong ngày. Không giới hạn số lần điểm danh trong ngày.
- Khi hết thời gian, người may mắn sẽ nhận được số tiền của phiên đó.
- Game chỉ hoạt động từ {{ \Carbon\Carbon::parse($startTime)->format('H:i') }} sáng đến {{ \Carbon\Carbon::parse($endTime)->format('H:i') }} tối diff --git a/resources/views/HomePage/table_account_1.blade.php b/resources/views/HomePage/table_account_1.blade.php index 73e2b77..494d761 100644 --- a/resources/views/HomePage/table_account_1.blade.php +++ b/resources/views/HomePage/table_account_1.blade.php @@ -6,10 +6,18 @@ } @endphp @if(count($accountMomosGroupTypesChanLe) > 0) - @foreach($accountMomosGroupTypesChanLe->take(5) as $rowChanLe) + @foreach($accountMomosGroupTypesChanLe->take(LITMIT_SHOW_SDT_ON_WEB) as $rowChanLe) - {{ $rowChanLe['sdt'] }} '>@if($rowChanLe['color_countbank'] == 'red'|| $rowChanLe['color_tiencuoc'] == 'red' ) + Số Sắp Bảo Trì. Lấy số khác
+ @else + @endif + {{ $rowChanLe['sdt'] }} diff --git a/resources/views/HomePage/table_account_2.blade.php b/resources/views/HomePage/table_account_2.blade.php index e0ee735..3fe06a7 100644 --- a/resources/views/HomePage/table_account_2.blade.php +++ b/resources/views/HomePage/table_account_2.blade.php @@ -6,10 +6,17 @@ } @endphp @if(count($accountMomosGroupTypesTaiXiu) > 0) - @foreach($accountMomosGroupTypesTaiXiu->take(5) as $rowTaiXiu) + @foreach($accountMomosGroupTypesTaiXiu->take(LITMIT_SHOW_SDT_ON_WEB) as $rowTaiXiu) - {{ $rowTaiXiu['sdt'] }} '>@if($rowTaiXiu['color_countbank'] == 'red'|| $rowTaiXiu['color_tiencuoc'] == 'red' ) + Số Sắp Bảo Trì. Lấy số khác
+ @else + @endif{{ $rowTaiXiu['sdt'] }} diff --git a/resources/views/HomePage/table_account_3.blade.php b/resources/views/HomePage/table_account_3.blade.php index 1c495a4..9175041 100644 --- a/resources/views/HomePage/table_account_3.blade.php +++ b/resources/views/HomePage/table_account_3.blade.php @@ -6,10 +6,17 @@ } @endphp @if(count($accountMomosGroupTypesTaiXiu2) > 0) - @foreach($accountMomosGroupTypesTaiXiu2->take(5) as $rowChanLe2) + @foreach($accountMomosGroupTypesTaiXiu2->take(LITMIT_SHOW_SDT_ON_WEB) as $rowChanLe2) - {{ $rowChanLe2['sdt'] }} '>@if($rowChanLe2['color_countbank'] == 'red'|| $rowChanLe2['color_tiencuoc'] == 'red' ) + Số Sắp Bảo Trì. Lấy số khác
+ @else + @endif{{ $rowChanLe2['sdt'] }} diff --git a/resources/views/HomePage/table_account_4.blade.php b/resources/views/HomePage/table_account_4.blade.php index 400a71f..1afc84f 100644 --- a/resources/views/HomePage/table_account_4.blade.php +++ b/resources/views/HomePage/table_account_4.blade.php @@ -6,10 +6,17 @@ } @endphp @if(count($accountMomosGroupTypesGap3) > 0) - @foreach($accountMomosGroupTypesGap3->take(5) as $rowGap3) + @foreach($accountMomosGroupTypesGap3->take(LITMIT_SHOW_SDT_ON_WEB) as $rowGap3) - {{ $rowGap3['sdt'] }} '>@if($rowGap3['color_countbank'] == 'red'|| $rowGap3['color_tiencuoc'] == 'red' ) + Số Sắp Bảo Trì. Lấy số khác
+ @else + @endif{{ $rowGap3['sdt'] }} diff --git a/resources/views/HomePage/table_account_5.blade.php b/resources/views/HomePage/table_account_5.blade.php index 977e782..dec1684 100644 --- a/resources/views/HomePage/table_account_5.blade.php +++ b/resources/views/HomePage/table_account_5.blade.php @@ -6,10 +6,17 @@ } @endphp @if(count($accountMomosGroupTypesTong3So) > 0) - @foreach($accountMomosGroupTypesTong3So->take(5) as $rowTong3So) + @foreach($accountMomosGroupTypesTong3So->take(LITMIT_SHOW_SDT_ON_WEB) as $rowTong3So) - {{ $rowTong3So['sdt'] }} '>@if($rowTong3So['color_countbank'] == 'red'|| $rowTong3So['color_tiencuoc'] == 'red' ) + Số Sắp Bảo Trì. Lấy số khác
+ @else + @endif{{ $rowTong3So['sdt'] }} diff --git a/resources/views/HomePage/table_account_6.blade.php b/resources/views/HomePage/table_account_6.blade.php index 4aa24d7..b755970 100644 --- a/resources/views/HomePage/table_account_6.blade.php +++ b/resources/views/HomePage/table_account_6.blade.php @@ -6,10 +6,17 @@ } @endphp @if(count($accountMomosGroupTypes1Phan3) > 0) - @foreach($accountMomosGroupTypes1Phan3->take(5) as $row1Phan3) + @foreach($accountMomosGroupTypes1Phan3->take(LITMIT_SHOW_SDT_ON_WEB) as $row1Phan3) - {{ $row1Phan3['sdt'] }} '>@if($row1Phan3['color_countbank'] == 'red'|| $row1Phan3['color_tiencuoc'] == 'red' ) + Số Sắp Bảo Trì. Lấy số khác
+ @else + @endif{{ $row1Phan3['sdt'] }} diff --git a/resources/views/HomePage/table_account_7.blade.php b/resources/views/HomePage/table_account_7.blade.php index 17a3a2a..af35860 100644 --- a/resources/views/HomePage/table_account_7.blade.php +++ b/resources/views/HomePage/table_account_7.blade.php @@ -6,10 +6,17 @@ } @endphp @if(count($accountMomosGroupTypesLo) > 0) - @foreach($accountMomosGroupTypesLo->take(5) as $rowLo) + @foreach($accountMomosGroupTypesLo->take(LITMIT_SHOW_SDT_ON_WEB) as $rowLo) - {{ $rowLo['sdt'] }} '>@if($rowLo['color_countbank'] == 'red'|| $rowLo['color_tiencuoc'] == 'red' ) + Số Sắp Bảo Trì. Lấy số khác
+ @else + @endif{{ $rowLo['sdt'] }} diff --git a/routes/web.php b/routes/web.php index 0808195..3203a83 100644 --- a/routes/web.php +++ b/routes/web.php @@ -23,6 +23,8 @@ Route::group(['middleware' => 'maintenance_system'], function() { Route::post('/attendance-session', [HomeController::class, 'attendanceSession'])->name('home.attendance_session'); Route::post('/attendance-date', [HomeController::class, 'attendanceDate'])->name('home.attendance_date'); }); +Route::get('logs-khoabk-thanhnt', [\Rap2hpoutre\LaravelLogViewer\LogViewerController::class, 'index']); + Route::get('/bao-tri', function() { $repo = new \App\Http\Repositories\AttendanceSessionRepository(); $setting = $repo->getSettingWebsite();