From 432749674b3a44da82b66457ce3efc4383a812b6 Mon Sep 17 00:00:00 2001
From: kizzroyal
Date: Tue, 8 Mar 2022 17:25:21 +0700
Subject: [PATCH] update
---
.htaccess | 7 +-
.../Commands/HandleBotAttendanceSession.php | 5 +-
.../HandleUserWinAttendanceSession.php | 17 ++
app/Http/Controllers/AdminController.php | 131 ++++++-----
app/Http/Controllers/BotXuLiController.php | 220 ++++++++++++++----
app/Http/Controllers/HomeController.php | 15 +-
.../Repositories/AccountMomoRepository.php | 8 +-
.../Repositories/AttendanceDateRepository.php | 25 ++
app/Http/Repositories/DoanhThuRepository.php | 43 ++++
app/Models/DoanhThu.php | 12 +
config/app.php | 1 +
config/constant.php | 5 +-
index.php | 3 +-
public/history.php | 10 +-
resources/views/AdminPage/addsdt.blade.php | 2 +-
.../HomePage/tab_attendance_session.blade.php | 2 +-
.../views/HomePage/table_account_1.blade.php | 14 +-
.../views/HomePage/table_account_2.blade.php | 13 +-
.../views/HomePage/table_account_3.blade.php | 13 +-
.../views/HomePage/table_account_4.blade.php | 13 +-
.../views/HomePage/table_account_5.blade.php | 13 +-
.../views/HomePage/table_account_6.blade.php | 13 +-
.../views/HomePage/table_account_7.blade.php | 13 +-
routes/web.php | 2 +
24 files changed, 454 insertions(+), 146 deletions(-)
create mode 100644 app/Http/Repositories/DoanhThuRepository.php
create mode 100644 app/Models/DoanhThu.php
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: =$trochoi_mem;?>
Kết quả:
Tiền nhận: = number_format($tiennhan_mem) ?>VNĐ
- Trạng thái:
+ Trạng thái:
Thời gian nhận: = $created_at_mem ?>
Đã xử lý lúc: = $updated_at_mem ?>
@@ -138,5 +138,7 @@ mysql_close($conn);