first commit
This commit is contained in:
117
app/Http/Controllers/AccountLevelMoneyController.php
Normal file
117
app/Http/Controllers/AccountLevelMoneyController.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Http\Repositories\AccountMomoRepository;
|
||||
use App\Models\AccountLevelMoney;
|
||||
use App\Models\AccountMomo;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use stdClass;
|
||||
|
||||
class AccountLevelMoneyController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
$GetSetting = new stdClass;
|
||||
$accountMomoRepo = new AccountMomoRepository();
|
||||
$accounts = $accountMomoRepo->getListAccountMomosLevels();
|
||||
$accountsMomo = $accountMomoRepo->getListAccountMomos(true);
|
||||
$GetSetting->namepage = 'Quản lý hạn mức SĐT';
|
||||
$GetSetting->title = 'Quản lý hạn mức SĐT';
|
||||
$GetSetting->description = 'Quản lý hạn mức SĐT';
|
||||
$GetSetting->description = 'Tạo mới';
|
||||
$titleModal = 'Tạo mới';
|
||||
$types = Config::get('constant.list_game');
|
||||
return view('AdminPage.AccountLevelMoney.index',
|
||||
compact('GetSetting', 'titleModal', 'accounts', 'accountsMomo', 'types'));
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$data = request()->all();
|
||||
$paramKeys = ['sdt', 'type', 'min', 'max'];
|
||||
if (!$this->validateParameterKeys($paramKeys, $data)) {
|
||||
return $this->responseMissingParameters();
|
||||
}
|
||||
if (!is_numeric($data['min']) || !is_numeric($data['max']) || !is_numeric($data['sdt'])) {
|
||||
return $this->responseError($data, "Dữ liệu gửi lên không hợp lệ");
|
||||
}
|
||||
if ((int)($data['min']) >= (int)$data['max']) {
|
||||
return $this->responseError($data, "Giá trị min phải nhỏ hơn giá trị max");
|
||||
}
|
||||
AccountLevelMoney::create($data);
|
||||
Cache::forget('cache_list_account_momos_active');
|
||||
Session::flash('message', 'Lưu dữ liệu thành công');
|
||||
return $this->responseSuccess();
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$data = request()->all();
|
||||
$paramKeys = ['id'];
|
||||
if (!$this->validateParameterKeys($paramKeys, $data)) {
|
||||
return $this->responseMissingParameters();
|
||||
}
|
||||
$account = AccountLevelMoney::where('id', $data['id'])->first();
|
||||
if (is_null($account)) {
|
||||
return $this->responseMissingParameters();
|
||||
}
|
||||
$accountMomoRepo = new AccountMomoRepository();
|
||||
$accountsMomo = $accountMomoRepo->getListAccountMomos();
|
||||
$types = Config::get('constant.list_game');
|
||||
|
||||
$titleModal = "Cập nhật";
|
||||
return view('AdminPage.AccountLevelMoney.form_template',
|
||||
compact('account', 'titleModal', 'accountsMomo', 'types'));
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$data = request()->all();
|
||||
$paramKeys = ['id', 'sdt', 'type', 'min', 'max'];
|
||||
if (!$this->validateParameterKeys($paramKeys, $data)) {
|
||||
return $this->responseMissingParameters();
|
||||
}
|
||||
if (!is_numeric($data['min']) || !is_numeric($data['max']) || !is_numeric($data['sdt'])) {
|
||||
return $this->responseError($data, "Dữ liệu gửi lên không hợp lệ");
|
||||
}
|
||||
if ((int)($data['min']) >= (int)$data['max']) {
|
||||
return $this->responseError($data, "Giá trị min phải nhỏ hơn giá trị max");
|
||||
}
|
||||
$account = AccountLevelMoney::where('id', $data['id'])->update($data);
|
||||
if (!$account) {
|
||||
return $this->responseMissingParameters();
|
||||
}
|
||||
$account = AccountLevelMoney::where('id', $data['id'])->first();
|
||||
Cache::forget('cache_list_account_momos_active');
|
||||
return view('AdminPage.AccountLevelMoney.row', compact('account'));
|
||||
}
|
||||
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$data = request()->all();
|
||||
$paramKeys = ['id'];
|
||||
if (!$this->validateParameterKeys($paramKeys, $data)) {
|
||||
return $this->responseMissingParameters();
|
||||
}
|
||||
$account = AccountLevelMoney::where('id', $data['id'])->update(['status' => STATUS_DE_ACTIVE]);
|
||||
if (is_null($account)) {
|
||||
return $this->responseMissingParameters();
|
||||
}
|
||||
Cache::forget('cache_list_account_momos_active');
|
||||
return $this->responseSuccess();
|
||||
}
|
||||
|
||||
|
||||
}
|
1183
app/Http/Controllers/AdminController.php
Normal file
1183
app/Http/Controllers/AdminController.php
Normal file
File diff suppressed because it is too large
Load Diff
1830
app/Http/Controllers/BotXuLiController.php
Normal file
1830
app/Http/Controllers/BotXuLiController.php
Normal file
File diff suppressed because it is too large
Load Diff
54
app/Http/Controllers/Controller.php
Normal file
54
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
|
||||
public function validateParameterKeys($paramKeys, $data)
|
||||
{
|
||||
$validate = true;
|
||||
|
||||
foreach ($paramKeys as $key) {
|
||||
if (!isset($data[$key])) {
|
||||
$validate = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $validate;
|
||||
}
|
||||
|
||||
public function responseMissingParameters()
|
||||
{
|
||||
return [
|
||||
'status' => 2,
|
||||
'message' => 'Thiếu dữ liệu gửi lên',
|
||||
];
|
||||
}
|
||||
|
||||
public function responseSuccess($data = [], $message = "")
|
||||
{
|
||||
return [
|
||||
'status' => 1,
|
||||
'message' => $message,
|
||||
'data' => $data,
|
||||
];
|
||||
}
|
||||
|
||||
public function responseError($data = [], $message = "")
|
||||
{
|
||||
return [
|
||||
'status' => 2,
|
||||
'message' => $message,
|
||||
'data' => $data,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
465
app/Http/Controllers/HomeController.php
Normal file
465
app/Http/Controllers/HomeController.php
Normal file
@@ -0,0 +1,465 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Repositories\AccountMomoRepository;
|
||||
use App\Http\Repositories\AttendanceDateRepository;
|
||||
use App\Http\Repositories\AttendanceSessionRepository;
|
||||
use App\Traits\PhoneNumber;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Setting;
|
||||
use App\Models\ChanLe;
|
||||
use App\Models\TaiXiu;
|
||||
use App\Models\ChanLe2;
|
||||
use App\Models\Gap3;
|
||||
use App\Models\Tong3So;
|
||||
use App\Models\X1Phan3;
|
||||
use App\Models\AccountMomo;
|
||||
use App\Models\LichSuChoiMomo;
|
||||
use App\Models\SettingPhanThuongTop;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\NoHuu;
|
||||
use App\Models\LichSuChoiNoHu;
|
||||
use App\Models\LichSuBank;
|
||||
use App\Models\TopTuan;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Cache;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
|
||||
//index
|
||||
protected $attendanceSessionRepository;
|
||||
protected $attendanceDateRepository;
|
||||
protected $accountMomoRepo;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->attendanceSessionRepository = new AttendanceSessionRepository();
|
||||
$this->attendanceDateRepository = new AttendanceDateRepository();
|
||||
$this->accountMomoRepo = new AccountMomoRepository();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
//Lịch sử chơi Momo
|
||||
if (Cache::has('indexData')) {
|
||||
return view(
|
||||
'HomePage.home',
|
||||
Cache::get('indexData')
|
||||
);
|
||||
}
|
||||
|
||||
//Setting
|
||||
$Setting = new Setting;
|
||||
$GetSetting = $Setting->first();
|
||||
$GetSetting->namepage = 'Trang chủ';
|
||||
// $accountMomosGroupTypes = $this->accountMomoRepo->getListAccountMomosGroupType();
|
||||
//Bảo trì
|
||||
//Chẵn lẻ
|
||||
[
|
||||
$Setting_ChanLe,
|
||||
$Setting_TaiXiu,
|
||||
$Setting_ChanLe2,
|
||||
$Setting_Gap3,
|
||||
$Setting_Tong3So,
|
||||
$Setting_1Phan3,
|
||||
] = $this->getSetingGame();
|
||||
|
||||
$UserTopTuan = [];
|
||||
//Phần thưởng tuần
|
||||
$SettingPhanThuongTop = new SettingPhanThuongTop;
|
||||
$GetSettingPhanThuongTop = $SettingPhanThuongTop->get();
|
||||
|
||||
//Setting nổ hũ
|
||||
$NoHuu = new NoHuu;
|
||||
$Setting_NoHu = $NoHuu->first();
|
||||
|
||||
//Thông báo nổ hũ
|
||||
$LichSuChoiNoHu = new LichSuChoiNoHu;
|
||||
$GetLichSuChoiNoHu = $LichSuChoiNoHu->where([
|
||||
'status' => 3,
|
||||
'ketqua' => 1,
|
||||
])->get();
|
||||
|
||||
$GetLichSuChoiNoHus = [];
|
||||
$dem = 0;
|
||||
|
||||
foreach ($GetLichSuChoiNoHu as $row) {
|
||||
$GetLichSuChoiNoHus[$dem] = $row;
|
||||
$GetLichSuChoiNoHus[$dem]['sdt2'] = substr($row['sdt'], 0, 6).'******';
|
||||
$GetLichSuChoiNoHus[$dem]['tiennhan2'] = $row['tiennhan'] + $Setting_NoHu->tienmacdinh;
|
||||
$dem++;
|
||||
}
|
||||
$secondRealTime = $this->attendanceSessionRepository->getSecondsRealtime();
|
||||
$dataAttendanceSession = $this->attendanceSessionRepository->getDataAttendanceSession();
|
||||
$attendanceSessionCurrent = $dataAttendanceSession['current'];
|
||||
$listSessionsPast = $dataAttendanceSession['sessions_past'];
|
||||
$phoneWinLatest = $dataAttendanceSession['phone_win_latest'];
|
||||
$usersAttendance = $this->attendanceSessionRepository->getUsersAttendanceSession($attendanceSessionCurrent);
|
||||
$totalAmount = $this->attendanceSessionRepository->getTotalAmountAttendanceSession();
|
||||
$countUsersAttendance = count($usersAttendance);
|
||||
$listUserAttendance = $usersAttendance->take(10);
|
||||
$checkCanAttendance = $this->attendanceSessionRepository->checkTurOnAttendance();
|
||||
$checkCanAttendanceDate = $this->attendanceDateRepository->checkTurOnAttendanceDate();
|
||||
$setting = $this->attendanceSessionRepository->getAttendanceSetting();
|
||||
$timeEach = $setting['time_each'] ?? TIME_EACH_ATTENDANCE_SESSION;
|
||||
$startTime = isset($setting['start_time']) ? Carbon::parse($setting['start_time']) : Carbon::parse(TIME_START_ATTENDANCE);
|
||||
$endTime = isset($setting['end_time']) ? Carbon::parse($setting['end_time']) : Carbon::parse(TIME_END_ATTENDANCE);
|
||||
$now = Carbon::now();
|
||||
$canAttendance = $now->between($startTime, $endTime) && $checkCanAttendance;
|
||||
$configAttendanceDate = $this->attendanceDateRepository->getMocchoi();
|
||||
//View
|
||||
$data = view(
|
||||
'HomePage.home',
|
||||
compact(
|
||||
'GetSetting',
|
||||
// 'accountMomosGroupTypes',
|
||||
'Setting_ChanLe',
|
||||
'Setting_TaiXiu',
|
||||
'Setting_ChanLe2',
|
||||
'Setting_Gap3',
|
||||
'Setting_Tong3So',
|
||||
'Setting_1Phan3',
|
||||
'UserTopTuan',
|
||||
'GetSettingPhanThuongTop',
|
||||
'GetLichSuChoiNoHus',
|
||||
'attendanceSessionCurrent',
|
||||
'secondRealTime',
|
||||
'listSessionsPast',
|
||||
'countUsersAttendance',
|
||||
'phoneWinLatest',
|
||||
'usersAttendance',
|
||||
'listUserAttendance',
|
||||
'canAttendance',
|
||||
'totalAmount',
|
||||
'checkCanAttendance',
|
||||
'setting',
|
||||
'timeEach',
|
||||
'checkCanAttendanceDate',
|
||||
'configAttendanceDate',
|
||||
)
|
||||
);
|
||||
Cache::put('indexData', compact(
|
||||
'GetSetting',
|
||||
// 'accountMomosGroupTypes',
|
||||
'Setting_ChanLe',
|
||||
'Setting_TaiXiu',
|
||||
'Setting_ChanLe2',
|
||||
'Setting_Gap3',
|
||||
'Setting_Tong3So',
|
||||
'Setting_1Phan3',
|
||||
'UserTopTuan',
|
||||
'GetSettingPhanThuongTop',
|
||||
'GetLichSuChoiNoHus',
|
||||
'attendanceSessionCurrent',
|
||||
'secondRealTime',
|
||||
'listSessionsPast',
|
||||
'countUsersAttendance',
|
||||
'phoneWinLatest',
|
||||
'usersAttendance',
|
||||
'listUserAttendance',
|
||||
'canAttendance',
|
||||
'totalAmount',
|
||||
'checkCanAttendance',
|
||||
'setting',
|
||||
'timeEach',
|
||||
'checkCanAttendanceDate',
|
||||
'configAttendanceDate',
|
||||
), TIME_CACHE_LOAD_DATA + 30);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function realTimeAttendance(Request $request)
|
||||
{
|
||||
$timeLast = $request->all();
|
||||
$updateCache = $timeLast % 20 == 0;
|
||||
$secondsRealtime = $this->attendanceSessionRepository->getSecondsRealtime($updateCache);
|
||||
$dataAttendanceSession = $this->attendanceSessionRepository->getDataAttendanceSession();
|
||||
$attendanceSessionCurrent = $dataAttendanceSession['current'];
|
||||
$phoneWinLatest = $dataAttendanceSession['phone_win_latest'];
|
||||
$listSessionsPast = $dataAttendanceSession['sessions_past'];
|
||||
|
||||
$usersAttendance = $this->attendanceSessionRepository->getUsersAttendanceSession($attendanceSessionCurrent);
|
||||
$countUsersAttendance = count($usersAttendance);
|
||||
$usersAttendance = $usersAttendance->transform(function($user) {
|
||||
$user->phone = $user->getPhone();
|
||||
return $user;
|
||||
});
|
||||
$phoneUsersAttendance = $usersAttendance->pluck('phone')->toArray();
|
||||
$totalAmount = $this->attendanceSessionRepository->getTotalAmountAttendanceSession();
|
||||
|
||||
$phonesAttendance = view('HomePage.phone_user_attendance', compact('phoneUsersAttendance'))->render();
|
||||
$viewListSessionPast = view('HomePage.table_sessions_attendance', compact('listSessionsPast'))->render();
|
||||
return json_encode([
|
||||
'session_current_code' => $attendanceSessionCurrent->id,
|
||||
'phone_win_latest' => $phoneWinLatest,
|
||||
'count_users_attendance' => $countUsersAttendance,
|
||||
'phones_attendance' => $phonesAttendance,
|
||||
'total_amount' => number_format($totalAmount),
|
||||
'view_list_session_past' => $viewListSessionPast,
|
||||
'second_realtime' => $secondsRealtime,
|
||||
], true);
|
||||
}
|
||||
|
||||
public function attendanceSession(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
if (!isset($data['phone'])) {
|
||||
return response(['status' => 2, 'message' => "Có lỗi xảy ra vui lòng thử lại"]);
|
||||
}
|
||||
if (!is_numeric($data['phone']) || !$this->isDigits($data['phone'])) {
|
||||
return response(['status' => 2, 'message' => "Số điện thoại sai định dạng. Vui lòng kiểm tra lại"]);
|
||||
}
|
||||
$startTime = Carbon::parse(TIME_START_ATTENDANCE);
|
||||
$endTime = Carbon::parse(TIME_END_ATTENDANCE);
|
||||
$now = Carbon::now();
|
||||
if (!$now->between($startTime, $endTime)) {
|
||||
return response(['status' => 2, 'message' => "Thời gian bắt đầu điểm danh từ 7h sáng đến 11h hằng ngày!"]);
|
||||
}
|
||||
if ($this->checkPhoneHasAttendanceSessionCurrent($data['phone'])) {
|
||||
return response(['status' => 2, 'message' => "Số điện thoại của bạn đã điểm danh trong phiên này!"]);
|
||||
}
|
||||
$this->attendanceSessionRepository->insertUsersAttendanceSession($data);
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
public function attendanceDate(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
if (!isset($data['phone'])) {
|
||||
return response(['status' => 2, 'message' => "Có lỗi xảy ra vui lòng thử lại"]);
|
||||
}
|
||||
if (!$this->attendanceDateRepository->checkTurOnAttendanceDate()) {
|
||||
return response(['status' => 2, 'message' => "Hệ thống đang bảo trì"]);
|
||||
}
|
||||
$data = $this->attendanceDateRepository->handleAttendanceDate($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function checkPhoneHasAttendanceSessionCurrent($phone)
|
||||
{
|
||||
$recordsOfPhone = $this->attendanceSessionRepository->queryUsersAttendanceByPhone($phone);
|
||||
return count($recordsOfPhone) > 0;
|
||||
}
|
||||
|
||||
public function isDigits(string $s, int $minDigits = 9, int $maxDigits = 14): bool
|
||||
{
|
||||
return preg_match('/^[0-9]{'.$minDigits.','.$maxDigits.'}\z/', $s);
|
||||
}
|
||||
|
||||
public function getDataAfterLoad()
|
||||
{
|
||||
//Lịch sử chơi Momo
|
||||
if (Cache::has('AllData')) {
|
||||
return Cache::get('AllData');
|
||||
}
|
||||
//Lịch sử chơi Momo
|
||||
$LichSuChoiMomo = new LichSuChoiMomo;
|
||||
$LichSuChoiMomoToDay = $LichSuChoiMomo->whereDate('created_at', Carbon::today())->where([
|
||||
'ketqua' => 1,
|
||||
'status' => 3,
|
||||
])->orderBy('id', 'desc')->get();
|
||||
$accountMomosGroupTypes = $this->accountMomoRepo->getListAccountMomosWithAccountLevel();
|
||||
$accountMomosGroupTypesAllGames = collect();
|
||||
if (!is_null($accountMomosGroupTypes->get(CONFIG_ALL_GAME)) && count($accountMomosGroupTypes->get(CONFIG_ALL_GAME)) > 0) {
|
||||
$accountMomosGroupTypesAllGames = $accountMomosGroupTypes->get(CONFIG_ALL_GAME);
|
||||
}
|
||||
$ListLichSuChoiMomo = $LichSuChoiMomoToDay->take(5);
|
||||
$ListAccounts = $this->getTrangthaiMomo();
|
||||
|
||||
$UserTopTuan = $this->getTopTuan($LichSuChoiMomo);
|
||||
//$UserTopTuan=[];
|
||||
[
|
||||
$Setting_ChanLe,
|
||||
$Setting_TaiXiu,
|
||||
$Setting_ChanLe2,
|
||||
$Setting_Gap3,
|
||||
$Setting_Tong3So,
|
||||
$Setting_1Phan3,
|
||||
] = $this->getSetingGame();
|
||||
$viewLichSuThang = view('HomePage.table_lich_su_thang', compact('ListLichSuChoiMomo'))->render();
|
||||
$viewUserTopTuan = view('HomePage.top_tuan', compact('UserTopTuan'))->render();
|
||||
$viewTrangthaiMomo = view('HomePage.table_trang_thai_momo', compact('ListAccounts'))->render();
|
||||
$viewTaleAccount = [];
|
||||
$types = Config::get('constant.list_game');
|
||||
foreach ($types as $type => $label) {
|
||||
if (!view()->exists('HomePage.table_account_'.$type)) {
|
||||
continue;
|
||||
}
|
||||
$viewTaleAccount[$type] = view('HomePage.table_account_'.$type,
|
||||
compact('accountMomosGroupTypes', 'accountMomosGroupTypesAllGames'))->render();
|
||||
}
|
||||
$data=[
|
||||
'lich_su_thang' => $viewLichSuThang,
|
||||
'view_table_account' => $viewTaleAccount,
|
||||
'view_table_trang_thai_momo' => $viewTrangthaiMomo,
|
||||
'view_top_tuan' => $viewUserTopTuan,
|
||||
'tiencuoc_'.CONFIG_CHAN_LE => $Setting_ChanLe['tile'],
|
||||
'tiencuoc_'.CONFIG_TAI_XIU => $Setting_TaiXiu['tile'],
|
||||
'tiencuoc_'.CONFIG_CHAN_LE_TAI_XIU_2 => $Setting_ChanLe2['tile'],
|
||||
'tiencuoc_'.CONFIG_1_PHAN_3 => $Setting_1Phan3['tile'],
|
||||
'tiencuoc_'.CONFIG_GAP_3.'_1' => $Setting_Gap3['tile1'],
|
||||
'tiencuoc_'.CONFIG_GAP_3.'_2' => $Setting_Gap3['tile2'],
|
||||
'tiencuoc_'.CONFIG_GAP_3.'_3' => $Setting_Gap3['tile3'],
|
||||
'tiencuoc_'.CONFIG_TONG_3_SO.'_1' => $Setting_Tong3So['tile1'],
|
||||
'tiencuoc_'.CONFIG_TONG_3_SO.'_2' => $Setting_Tong3So['tile2'],
|
||||
'tiencuoc_'.CONFIG_TONG_3_SO.'_3' => $Setting_Tong3So['tile3'],
|
||||
];
|
||||
// set cache tồn tại trong 30s
|
||||
Cache::put('AllData', $data, TIME_CACHE_LOAD_DATA);
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
public function getPhone($phone)
|
||||
{
|
||||
$middle_string = "";
|
||||
$length = strlen($phone);
|
||||
if ($length < 3) {
|
||||
return $length == 1 ? "*" : "*".substr($phone, -1);
|
||||
} else {
|
||||
$part_size = floor($length / 3);
|
||||
$middle_part_size = $length - ($part_size * 2);
|
||||
for ($i = 0; $i < $middle_part_size; $i++) {
|
||||
$middle_string .= "*";
|
||||
}
|
||||
return substr($phone, 0, $part_size).$middle_string.substr($phone, -$part_size);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \App\Models\AccountMomo $AccountMomo
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getSetingGame(): array
|
||||
{
|
||||
$AccountMomo = new AccountMomo;
|
||||
|
||||
$ChanLe = new ChanLe;
|
||||
$Setting_ChanLe = $ChanLe->first();
|
||||
$Setting_ChanLe->sdt2 = $AccountMomo->GetListAccountID($Setting_ChanLe->sdt);
|
||||
$Setting_ChanLe = $Setting_ChanLe->toArray();
|
||||
|
||||
//Tài xỉu
|
||||
$TaiXiu = new TaiXiu;
|
||||
$Setting_TaiXiu = $TaiXiu->first();
|
||||
$Setting_TaiXiu->sdt2 = $AccountMomo->GetListAccountID($Setting_TaiXiu->sdt);
|
||||
$Setting_TaiXiu = $Setting_TaiXiu->toArray();
|
||||
|
||||
//Chẵn lẻ 2
|
||||
$ChanLe2 = new ChanLe2;
|
||||
$Setting_ChanLe2 = $ChanLe2->first();
|
||||
$Setting_ChanLe2->sdt2 = $AccountMomo->GetListAccountID($Setting_ChanLe2->sdt);
|
||||
|
||||
$Setting_ChanLe2 = $Setting_ChanLe2->toArray();
|
||||
|
||||
//Gấp 3
|
||||
$Gap3 = new Gap3;
|
||||
$Setting_Gap3 = $Gap3->first();
|
||||
$Setting_Gap3->sdt2 = $AccountMomo->GetListAccountID($Setting_Gap3->sdt);
|
||||
|
||||
$Setting_Gap3 = $Setting_Gap3->toArray();
|
||||
|
||||
//Tổng 3 Số
|
||||
$Tong3So = new Tong3So;
|
||||
$Setting_Tong3So = $Tong3So->first();
|
||||
$Setting_Tong3So->sdt2 = $AccountMomo->GetListAccountID($Setting_Tong3So->sdt);
|
||||
|
||||
$Setting_Tong3So = $Setting_Tong3So->toArray();
|
||||
|
||||
//1 Phần 3
|
||||
$X1Phan3 = new X1Phan3;
|
||||
$Setting_1Phan3 = $X1Phan3->first();
|
||||
$Setting_1Phan3->sdt2 = $AccountMomo->GetListAccountID($Setting_1Phan3->sdt);
|
||||
|
||||
$Setting_1Phan3 = $Setting_1Phan3->toArray();
|
||||
return [
|
||||
$Setting_ChanLe,
|
||||
$Setting_TaiXiu,
|
||||
$Setting_ChanLe2,
|
||||
$Setting_Gap3,
|
||||
$Setting_Tong3So,
|
||||
$Setting_1Phan3,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \App\Models\LichSuChoiMomo $LichSuChoiMomo
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function getTopTuan(LichSuChoiMomo $LichSuChoiMomo)
|
||||
{
|
||||
$topTuan= new TopTuan;
|
||||
$UserTopTuan=[];
|
||||
$getTopTuan = $topTuan->whereBetween('created_at',
|
||||
[Carbon::today()->startOfWeek(), Carbon::today()->endOfWeek()])
|
||||
->orderBy('tongtientuan', 'desc')->limit(5)->get();
|
||||
foreach($getTopTuan as $row){
|
||||
$UserTopTuan[$this->getPhone($row->sdt)] = $row->tongtientuan;
|
||||
}
|
||||
return $UserTopTuan;
|
||||
// $lichSuChoiMomoTuan = $LichSuChoiMomo->whereBetween('created_at',
|
||||
// [Carbon::today()->startOfWeek(), Carbon::today()->endOfWeek()])
|
||||
// // ->where('ketqua', 1)
|
||||
// ->where('status', 3)
|
||||
// ->get();
|
||||
|
||||
// $UserTopTuan = $lichSuChoiMomoTuan->map(function($lichSu) {
|
||||
// $phoneConvert = new PhoneNumber();
|
||||
// $lichSu->sdt = $phoneConvert->convert($lichSu->sdt, true);
|
||||
// $lichSu->sdt = $this->getPhone($lichSu->sdt);
|
||||
// return $lichSu;
|
||||
// })->groupBy('sdt')->map(function($lichSuPhone) {
|
||||
// return $lichSuPhone->sum('tiencuoc');
|
||||
// })->sortByDesc(function($tiencuoc) {
|
||||
// return $tiencuoc;
|
||||
// })->take(5)->toArray();
|
||||
// return $UserTopTuan;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
private function getTrangthaiMomo(): \Illuminate\Support\Collection
|
||||
{
|
||||
//Trạng thái MOMO
|
||||
|
||||
$ListAccounts = $this->accountMomoRepo->getListAccountMomosWithAccountLevel(false);
|
||||
return $ListAccounts->map(function($account) {
|
||||
$account['status_class'] = "success";
|
||||
$account['status_text'] = "hoạt động";
|
||||
return $account;
|
||||
});
|
||||
// $LichSuBank = new LichSuBank;
|
||||
// $accounts = collect($this->accountMomoRepo->getListAccountMomos());
|
||||
// $LichSuBanks = $LichSuBank->whereDate('created_at', Carbon::today())->get();
|
||||
// $ListAccounts = collect($accounts)->map(function($account) use (
|
||||
// $LichSuChoiMomoToDay,
|
||||
// $LichSuBanks
|
||||
// ) {
|
||||
// $GetLichSuChoiMomo = $LichSuChoiMomoToDay->where('sdt_get', $account['sdt']);
|
||||
// $getLichSuBank = $LichSuBanks->where('sdtbank', $account['sdt']);
|
||||
// $responseLichSuBank = $getLichSuBank->pluck('response')->toArray();
|
||||
// $countbank = 0;
|
||||
// foreach ($responseLichSuBank as $response) {
|
||||
// $j = json_decode($response, true);
|
||||
// if (isset($j['status']) && $j['status'] == 200) {
|
||||
// $countbank++;
|
||||
// }
|
||||
// }
|
||||
// $account['sent_money'] = $GetLichSuChoiMomo->sum('tiennhan');
|
||||
// $account['status_class'] = "success";
|
||||
// $account['status_text'] = "hoạt động";
|
||||
// $account['countbank'] = $countbank;
|
||||
//
|
||||
// return $account;
|
||||
// })->take(5);
|
||||
return $ListAccounts;
|
||||
}
|
||||
|
||||
}
|
77
app/Http/Controllers/NoHuController.php
Normal file
77
app/Http/Controllers/NoHuController.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\NoHuu;
|
||||
use App\Models\LichSuChoiNoHu;
|
||||
use App\Models\AccountMomo;
|
||||
|
||||
class NoHuController extends Controller
|
||||
{
|
||||
//
|
||||
public function Get_Hu(request $request){
|
||||
//Setting nổ hũ
|
||||
$NoHuu = new NoHuu;
|
||||
$Setting_NoHu = $NoHuu->first();
|
||||
|
||||
$LichSuChoiNoHu = new LichSuChoiNoHu;
|
||||
$GetLichSuChoiNoHu = $LichSuChoiNoHu->where([
|
||||
'status' => 3,
|
||||
])->get();
|
||||
|
||||
$tongtien = $Setting_NoHu->tienmacdinh;
|
||||
|
||||
foreach ($GetLichSuChoiNoHu as $row) {
|
||||
$tongtien = $tongtien + $row->tienvaohu;
|
||||
$tongtien = $tongtien - $row->tiennhan;
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'tongtien' => $tongtien,
|
||||
]);
|
||||
}
|
||||
|
||||
public function Load_Hu(request $request){
|
||||
//Setting nổ hũ
|
||||
$NoHuu = new NoHuu;
|
||||
$Setting_NoHu = $NoHuu->first();
|
||||
|
||||
$LichSuChoiNoHu = new LichSuChoiNoHu;
|
||||
$GetLichSuChoiNoHu = $LichSuChoiNoHu->where([
|
||||
'status' => 3,
|
||||
])->get();
|
||||
|
||||
$tongtien = $Setting_NoHu->tienmacdinh;
|
||||
|
||||
foreach ($GetLichSuChoiNoHu as $row) {
|
||||
$tongtien = $tongtien + $row->tienvaohu;
|
||||
$tongtien = $tongtien - $row->tiennhan;
|
||||
}
|
||||
|
||||
//
|
||||
$AccountMomo = new AccountMomo;
|
||||
$GetAccountMomo = $AccountMomo->where([
|
||||
'status' => 1,
|
||||
])->get();
|
||||
|
||||
$GetAccountMomos = [];
|
||||
$dem = 0;
|
||||
|
||||
foreach ($GetAccountMomo as $row) {
|
||||
$GetAccountMomos[$dem]['sdt'] = $row->sdt;
|
||||
$dem ++;
|
||||
}
|
||||
|
||||
$sotienchuyen = $Setting_NoHu->tiencuoc;
|
||||
|
||||
//
|
||||
return response()->json([
|
||||
'tongtien' => $tongtien,
|
||||
'tongtien_format' => number_format($tongtien),
|
||||
'list_sdt' => $GetAccountMomos,
|
||||
'sotienchuyen' => $sotienchuyen,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
67
app/Http/Kernel.php
Normal file
67
app/Http/Kernel.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'maintenance_system' => \App\Http\Middleware\MaintenanceSystem::class,
|
||||
];
|
||||
}
|
21
app/Http/Middleware/Authenticate.php
Normal file
21
app/Http/Middleware/Authenticate.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
26
app/Http/Middleware/MaintenanceSystem.php
Normal file
26
app/Http/Middleware/MaintenanceSystem.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Http\Repositories\AttendanceSessionRepository;
|
||||
use Closure;
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class MaintenanceSystem extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$repo = new AttendanceSessionRepository();
|
||||
$config = $repo->getSettingWebsite();
|
||||
if ($config['baotri'] == 1){
|
||||
return redirect(route('bao_tri'));
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
32
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
32
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null ...$guards
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect()->route('admin_home');
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
19
app/Http/Middleware/TrimStrings.php
Normal file
19
app/Http/Middleware/TrimStrings.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
20
app/Http/Middleware/TrustHosts.php
Normal file
20
app/Http/Middleware/TrustHosts.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
23
app/Http/Middleware/TrustProxies.php
Normal file
23
app/Http/Middleware/TrustProxies.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
114
app/Http/Repositories/AccountMomoRepository.php
Normal file
114
app/Http/Repositories/AccountMomoRepository.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
*File name : AccountMomoRepository.php / Date: 1/4/2022 - 8:55 PM
|
||||
*Code Owner: Thanhnt/ Email: Thanhnt@omt.com.vn/ Phone: 0384428234
|
||||
*/
|
||||
|
||||
namespace App\Http\Repositories;
|
||||
|
||||
use App\Models\AccountLevelMoney;
|
||||
use App\Models\AccountMomo;
|
||||
use App\Models\LichSuBank;
|
||||
use App\Models\LichSuChoiMomo;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AccountMomoRepository
|
||||
{
|
||||
|
||||
public function getListAccountMomosLevels()
|
||||
{
|
||||
$cache = Cache::get('cache_list_account_momos_active');
|
||||
$cache = null;
|
||||
if (!is_null($cache)) {
|
||||
return $cache;
|
||||
}
|
||||
$listAccountMomos = $this->getListAccountMomos(true, [STATUS_ACTIVE, STATUS_MAINTENANCE]);
|
||||
$levelAccounts = AccountLevelMoney::where('status', STATUS_ACTIVE)->get()->map(function($account) use (
|
||||
$listAccountMomos
|
||||
) {
|
||||
$accountMomo = collect($listAccountMomos)->where('sdt', $account->sdt)->first();
|
||||
$account->game = $account->getGameAttribute();
|
||||
if (!is_null($accountMomo)) {
|
||||
if ($accountMomo['status'] == STATUS_MAINTENANCE) {
|
||||
$account->text_status = "Bảo trì";
|
||||
$account->class_status = "warning";
|
||||
} else {
|
||||
$account->text_status = "Hoạt động";
|
||||
$account->class_status = "success";
|
||||
}
|
||||
} else {
|
||||
$account->notExist = "true";
|
||||
}
|
||||
return $account;
|
||||
})->filter(function($account) {
|
||||
return !isset($account->notExist);
|
||||
})->toArray();
|
||||
Cache::put('cache_list_account_momos_active', $levelAccounts, Carbon::now()->addMinutes(60));
|
||||
return $levelAccounts;
|
||||
}
|
||||
|
||||
public function getListAccountMomos($forCreate = false, $status = [STATUS_ACTIVE])
|
||||
{
|
||||
$phones = [];
|
||||
if (!$forCreate) {
|
||||
$accountListMomoLevel = $this->getListAccountMomosLevels();
|
||||
$phones = collect($accountListMomoLevel)->pluck('sdt')->toArray();
|
||||
}
|
||||
$query = AccountMomo::whereIn('status', $status);
|
||||
$query = !$forCreate ? $query->whereIn('sdt', $phones)->limit(5) : $query;
|
||||
return $query->get()->unique('sdt')->toArray();
|
||||
}
|
||||
|
||||
public function getListAccountMomosWithAccountLevel($groupByType = true)
|
||||
{
|
||||
$accounts = collect($this->getListAccountMomosLevels());
|
||||
$phones = $accounts->pluck('sdt')->unique()->toArray();
|
||||
$LichSuBank = new LichSuBank;
|
||||
$LichSuBanks = $LichSuBank->whereDate('created_at', \Illuminate\Support\Carbon::today())->get();
|
||||
$sumTienCuocPhones = [];
|
||||
foreach ($phones as $index => $phone) {
|
||||
$sumTienCuocPhones[] = [
|
||||
'phone' => $phone,
|
||||
'sum' => DB::table('lich_su_choi_momos')
|
||||
->whereDate('created_at', Carbon::today())
|
||||
->where('ketqua', 1)
|
||||
->where('sdt_get', $phone)
|
||||
->sum('tiennhan'),
|
||||
|
||||
];
|
||||
}
|
||||
$accountMomos = AccountMomo::whereIn('sdt', $phones)
|
||||
->where('status', STATUS_ACTIVE)
|
||||
->get();
|
||||
$phonesAccountMomo = $accountMomos->pluck('sdt')->toArray();
|
||||
$accounts = $accounts->map(function($account) use ($sumTienCuocPhones, $LichSuBanks, $accountMomos) {
|
||||
$sumTienCuocPhone = collect($sumTienCuocPhones)->where('phone', $account['sdt'])->first();
|
||||
$accountMomo = $accountMomos->where('sdt', $account['sdt'])->first();
|
||||
$account['sumTienCuoc'] = is_null($sumTienCuocPhone) ? 0 : $sumTienCuocPhone['sum'];
|
||||
$account['gioihan'] = is_null($accountMomo) ? 0 : $accountMomo['gioihan'];
|
||||
$getLichSuBank = $LichSuBanks->where('sdtbank', $account['sdt']);
|
||||
$countbank = 0;
|
||||
$responseLichSuBank = $getLichSuBank->pluck('response')->toArray();
|
||||
foreach ($responseLichSuBank as $response) {
|
||||
$j = json_decode($response, true);
|
||||
if (isset($j['status']) && $j['status'] == 200) {
|
||||
$countbank++;
|
||||
}
|
||||
}
|
||||
$account['countbank'] = $countbank;
|
||||
$account['color_min'] = $account['min'] > CONFIG_COMPARE_TIEN_CUOC_MIN ? "blue" : "";
|
||||
$account['color_max'] = $account['max'] > CONFIG_COMPARE_TIEN_CUOC_MIN ? "blue" : "";
|
||||
$account['color_tiencuoc'] = $account['sumTienCuoc'] > CONFIG_MAX_SUM_TIEN_CUOC ? "red" : "green";
|
||||
$account['color_countbank'] = $countbank > CONFIG_MAX_COUNT_BANK ? "red" : "green";
|
||||
return $account;
|
||||
})->filter(function($account) use ($phonesAccountMomo) {
|
||||
return in_array($account['sdt'], $phonesAccountMomo);
|
||||
})->take(5)->sortBy('min');
|
||||
return $groupByType ? $accounts->groupBy('type')->map(function($accountList) {
|
||||
return $accountList->unique('sdt');
|
||||
}) : $accounts;
|
||||
}
|
||||
|
||||
}
|
204
app/Http/Repositories/AttendanceDateRepository.php
Normal file
204
app/Http/Repositories/AttendanceDateRepository.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
/**
|
||||
*File name : AttendanceSessionRepository.php / Date: 10/26/2021 - 9:39 PM
|
||||
|
||||
*/
|
||||
|
||||
namespace App\Http\Repositories;
|
||||
|
||||
use App\Models\AccountMomo;
|
||||
use App\Models\AttendanceDateSetting;
|
||||
use App\Models\AttendanceSession;
|
||||
use App\Models\AttendanceSetting;
|
||||
use App\Models\LichSuChoiAttendanceDate;
|
||||
use App\Models\LichSuChoiMomo;
|
||||
use App\Models\Setting;
|
||||
use App\Models\UserAttendanceSession;
|
||||
use App\Traits\PhoneNumber;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Config\Repository;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AttendanceDateRepository extends Repository
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function getMocchoi()
|
||||
{
|
||||
return AttendanceDateSetting::orderBy('mocchoi')->get()->toArray();
|
||||
}
|
||||
|
||||
public function checkTurOnAttendanceDate()
|
||||
{
|
||||
$attendanceRepo = new AttendanceSessionRepository();
|
||||
$setting = $attendanceRepo->getSettingWebsite();
|
||||
if (isset($setting['baotri']) && $setting['baotri'] == 1) {
|
||||
return false;
|
||||
}
|
||||
if (!isset($setting['on_diemdanh_ngay'])) {
|
||||
return true;
|
||||
}
|
||||
return $setting['on_diemdanh_ngay'] == TURN_ON_SETTING;
|
||||
}
|
||||
|
||||
|
||||
public function handleAttendanceDate($data)
|
||||
{
|
||||
$attendanceDateRepo = new AttendanceDateRepository();
|
||||
$phone = (new PhoneNumber)->convert($data['phone']);
|
||||
$phoneOld = (new PhoneNumber)->convert($data['phone'], true);
|
||||
$phonesAccount = AccountMomo::where('sdt', $phone)->orWhere('sdt', $phoneOld)->get();
|
||||
$date = Carbon::today()->toDateString();
|
||||
$lichSuMomosOfPhone = LichSuChoiMomo::where('sdt', $phone)
|
||||
->where('created_at', '>=', $date)
|
||||
->orWhere(function($query) use ($phoneOld, $date) {
|
||||
$query->where('sdt', $phoneOld)
|
||||
->where('created_at', '>=', $date);
|
||||
})
|
||||
->get();
|
||||
if (count($lichSuMomosOfPhone) == 0 && count($phonesAccount) == 0) {
|
||||
return $this->responseResult("Oh !! Số điện thoại này chưa chơi game nào, hãy kiểm tra lại");
|
||||
}
|
||||
$mocchois = $attendanceDateRepo->getMocchoi();
|
||||
$mocchoiFirst = collect($mocchois)->first();
|
||||
if (count($mocchois) == 0) {
|
||||
return $this->responseResult("Hệ thống đang bảo trì vui lòng thử lại sau!");
|
||||
}
|
||||
$sumTien = $lichSuMomosOfPhone->sum('tiencuoc');
|
||||
$lichsuChoi = $this->getLichSuChoiDiemDanhNgay($date, $phone, $phoneOld);
|
||||
if (count($lichsuChoi) == 0) {
|
||||
if ($sumTien < $mocchoiFirst['mocchoi']) {
|
||||
return $this->responseResult("Oh !! . Nay bạn đã chơi hết: ".number_format($sumTien)." VNĐ. Bạn chưa đủ mốc tiền để nhận thưởng trong ngày hôm nay. Cố gắng chơi thêm nhé!!!");
|
||||
}
|
||||
$mocSumTien = collect($mocchois)->where('mocchoi', "<=", $sumTien)->last();
|
||||
|
||||
if (is_null($mocSumTien)) {
|
||||
return $this->responseResult("Hệ thống đang bảo trì vui lòng thử lại sau!");
|
||||
}
|
||||
$tiennhan = $mocSumTien['tiennhan'];
|
||||
$this->insertPhoneToTableLichSu($phoneOld, $mocSumTien['mocchoi'], $tiennhan);
|
||||
} else {
|
||||
$mocDaChoiMax = array_key_last($lichsuChoi);
|
||||
$mocSumTien = collect($mocchois)->where('mocchoi', "<=", $sumTien)->last();
|
||||
// $mocTiepTheo = collect($mocchois)->where('mocchoi', ">", $mocDaChoiMax)->first();
|
||||
if (is_null($mocSumTien) || $this->mocchoiIsMax(collect($mocchois)->last(), $mocDaChoiMax)) {
|
||||
return $this->responseResult("Bạn đã nhận thưởng hết trong ngày hôm nay. Vui lòng quay lại trò chơi vào ngày mai!!!");
|
||||
}
|
||||
if ($mocDaChoiMax)
|
||||
// $mocSumTien['mocchoi'] == $mocDaChoiMax
|
||||
$mocDatTiepTheo = $mocSumTien['mocchoi'];
|
||||
if ($mocDaChoiMax == $mocDatTiepTheo){
|
||||
return $this->responseResult("Oh !! . Nay bạn đã chơi hết: ".number_format($sumTien)." VNĐ. Bạn chưa đủ mốc tiền tiếp theo để nhận thưởng thêm trong hôm nay. Cố gắng Pang thêm nhé!!!");
|
||||
}
|
||||
if ($sumTien >= $mocDatTiepTheo) {
|
||||
$tiennhan = $mocSumTien['tiennhan'];
|
||||
$this->insertPhoneToTableLichSu($phoneOld, $mocDatTiepTheo, $tiennhan);
|
||||
} else {
|
||||
return $this->responseResult("Oh !! . Nay bạn đã chơi hết: ".number_format($sumTien)." VNĐ. Bạn chưa đủ mốc tiền tiếp theo để nhận thưởng thêm trong hôm nay. Cố gắng Pang thêm nhé!!!");
|
||||
}
|
||||
}
|
||||
return $this->responseResult("Oh!! Chúc mừng bạn đã nhận được ".number_format($tiennhan)." VNĐ ĐỚP ÍT THÔI!!");
|
||||
}
|
||||
|
||||
private function getPhoneAccountMomo()
|
||||
{
|
||||
$cache = Cache::get('cache_get_sdt_account_momo');
|
||||
if (!is_null($cache)) {
|
||||
return $cache;
|
||||
}
|
||||
$account = AccountMomo::orderBy('status')->first();
|
||||
$phone = $account->sdt;
|
||||
Cache::put('cache_get_sdt_account_momo', $phone, Carbon::now()->addMinutes(10));
|
||||
return $phone;
|
||||
}
|
||||
|
||||
|
||||
private function insertPhoneToTableLichSu($phone, $mocchoi, $tienNhan)
|
||||
{
|
||||
$phoneGet = $this->getPhoneAccountMomo();
|
||||
$billCode = 'Nghiệm vụ ngày '.bin2hex(random_bytes(3)).time();
|
||||
$this->insertToLichSuMoMo($phone, $tienNhan, $phoneGet, $billCode);
|
||||
$this->insertToLichSuDiemDanhNgay($phone, $mocchoi, $tienNhan, $phoneGet, $billCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $phone
|
||||
* @param $tienNhan
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function insertToLichSuMoMo($phone, $tienNhan, $phoneGet, $billCode)
|
||||
{
|
||||
return DB::table('lich_su_choi_momos')->insert([
|
||||
'sdt' => $phone,
|
||||
'sdt_get' => $phoneGet,
|
||||
'magiaodich' => $billCode,
|
||||
'tiencuoc' => 0,
|
||||
'tiennhan' => $tienNhan,
|
||||
'trochoi' => "Nghiệm vụ ngày",
|
||||
'noidung' => "NVN",
|
||||
'ketqua' => 1,
|
||||
'status' => STATUS_LSMOMO_TAM_THOI,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
]);
|
||||
}
|
||||
|
||||
private function insertToLichSuDiemDanhNgay($phone, $mocchoi, $tienNhan, $phoneGet, $billCode)
|
||||
{
|
||||
return DB::table('lich_su_attendance_date')->insert([
|
||||
'date' => Carbon::today()->toDateString(),
|
||||
'phone' => $phone,
|
||||
'mocchoi' => $mocchoi,
|
||||
'tiennhan' => $tienNhan,
|
||||
'sdt_get' => $phoneGet,
|
||||
'magiaodich' => $billCode,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function responseResult($message): array
|
||||
{
|
||||
return [
|
||||
'status' => 2,
|
||||
'message' => $message,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $date
|
||||
* @param array $phone
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function getLichSuChoiDiemDanhNgay($date, $phone, $phoneOld)
|
||||
{
|
||||
$lichsuChoi = LichSuChoiAttendanceDate::whereDate('date', $date)
|
||||
->where('phone', $phone)
|
||||
->orWhere(function($query) use ($phoneOld, $date) {
|
||||
$query->where('phone', $phoneOld)
|
||||
->whereDate('date', $date);
|
||||
})
|
||||
->orderBy("mocchoi")
|
||||
->get()
|
||||
->pluck('tiennhan', 'mocchoi')
|
||||
->toArray();
|
||||
return $lichsuChoi;
|
||||
}
|
||||
|
||||
public function mocchoiIsMax($mocchoiMax, $mocchoiCheck)
|
||||
{
|
||||
return $mocchoiMax['mocchoi'] == $mocchoiCheck;
|
||||
}
|
||||
|
||||
}
|
239
app/Http/Repositories/AttendanceSessionRepository.php
Normal file
239
app/Http/Repositories/AttendanceSessionRepository.php
Normal file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/**
|
||||
*File name : AttendanceSessionRepository.php / Date: 10/26/2021 - 9:39 PM
|
||||
|
||||
*/
|
||||
|
||||
namespace App\Http\Repositories;
|
||||
|
||||
use App\Models\AttendanceSession;
|
||||
use App\Models\AttendanceSetting;
|
||||
use App\Models\Setting;
|
||||
use App\Models\UserAttendanceSession;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Config\Repository;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AttendanceSessionRepository extends Repository
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function getSecondsRealtime($updateCache = false)
|
||||
{
|
||||
$now = Carbon::now();
|
||||
$hour = $now->hour;
|
||||
$setting = $this->getAttendanceSetting();
|
||||
$timeEach = (int)$setting['time_each'];
|
||||
$timeStart = $this->getTimeStartByConfigTimeEach($timeEach, $hour, $now);
|
||||
// $minute = (int)floor($now->minute / 10) * 3;
|
||||
// $timeStart = Carbon::parse($hour.":".$minute);
|
||||
// $abc = $now->minute - $now->minute%3;
|
||||
// dd($hour.":".$abc, $hour.":".(int)floor($now->minute / 10) * 10);
|
||||
|
||||
$realTimeSeconds = $timeEach - (int)($now->timestamp - $timeStart->timestamp);
|
||||
if ($realTimeSeconds <= 1 || $updateCache) {
|
||||
$this->forgetCacheDatAttendanceSession();
|
||||
}
|
||||
return $realTimeSeconds;
|
||||
}
|
||||
|
||||
private function getTimeStartByConfigTimeEach($timeEach, $hour, Carbon $now)
|
||||
{
|
||||
switch ($timeEach) {
|
||||
case 60:
|
||||
default;
|
||||
return Carbon::parse($hour.":".$now->minute);
|
||||
case 180:
|
||||
$minute = $now->minute - $now->minute % 3;
|
||||
return Carbon::parse($hour.":".$minute);
|
||||
case 300:
|
||||
$minute = $now->minute - $now->minute % 5;
|
||||
return Carbon::parse($hour.":".$minute);
|
||||
case 600:
|
||||
$minute = (int)floor($now->minute / 10) * 10;
|
||||
return Carbon::parse($hour.":".$minute);
|
||||
case 900:
|
||||
$minute = $now->minute - $now->minute % 15;
|
||||
return Carbon::parse($hour.":".$minute);
|
||||
case 1200:
|
||||
$minute = $now->minute - $now->minute % 20;
|
||||
return Carbon::parse($hour.":".$minute);
|
||||
case 1800:
|
||||
$minute = $now->minute - $now->minute % 30;
|
||||
return Carbon::parse($hour.":".$minute);
|
||||
case 3600:
|
||||
return $now->startOfHour();
|
||||
case 21600:
|
||||
$hour = $hour - $hour % 6;
|
||||
return Carbon::parse($hour.":00");
|
||||
case 86400:
|
||||
return Carbon::today();
|
||||
}
|
||||
}
|
||||
|
||||
public function getDataAttendanceSession()
|
||||
{
|
||||
$cache = Cache::get('cache_data_attendance_session');
|
||||
$cache = null;
|
||||
if (!is_null($cache)) {
|
||||
return $cache;
|
||||
}
|
||||
return $this->updateCacheDataAttendanceSession();
|
||||
}
|
||||
|
||||
public function getCurrentAttendanceSession()
|
||||
{
|
||||
return $this->getDataAttendanceSession()['current'];
|
||||
}
|
||||
|
||||
public function getTotalAmountAttendanceSession()
|
||||
{
|
||||
$cache = Cache::get('cache_total_amount_attendance_session');
|
||||
if (!is_null($cache)) {
|
||||
return $cache;
|
||||
}
|
||||
$totalAmount = DB::table('attendance_session')->sum('amount');
|
||||
Cache::put('cache_total_amount_attendance_session', $totalAmount,
|
||||
Carbon::now()->addSeconds($this->getSecondsRealtime()));
|
||||
return $totalAmount;
|
||||
}
|
||||
|
||||
public function getUsersAttendanceSession($attendanceSessionCurrent = null)
|
||||
{
|
||||
$attendanceSessionCurrent = !is_null($attendanceSessionCurrent) ? $attendanceSessionCurrent : $this->getDataAttendanceSession()['current'];
|
||||
return $attendanceSessionCurrent->usersAttendanceSession()->get();
|
||||
}
|
||||
|
||||
|
||||
public function insertUsersAttendanceSession($data)
|
||||
{
|
||||
$attendanceSessionCurrent = $this->getDataAttendanceSession()['current'];
|
||||
return UserAttendanceSession::create([
|
||||
'session_id' => $attendanceSessionCurrent->id,
|
||||
'phone' => $data['phone'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function queryUsersAttendanceByPhone($phone)
|
||||
{
|
||||
$attendanceSessionCurrent = $this->getDataAttendanceSession()['current'];
|
||||
return UserAttendanceSession::where('phone', $phone)->where('session_id', $attendanceSessionCurrent->id)->get();
|
||||
}
|
||||
|
||||
public function createNewAttendanceSession($currentAttendanceSession)
|
||||
{
|
||||
$currentAttendanceSession->update(['status' => STATUS_DE_ACTIVE]);
|
||||
$attendanceSession = AttendanceSession::create([
|
||||
'date' => Carbon::today()->toDateString(),
|
||||
'status' => STATUS_ACTIVE,
|
||||
]);
|
||||
$this->forgetCacheDatAttendanceSession();
|
||||
return $attendanceSession;
|
||||
}
|
||||
|
||||
public function getPhoneAttendanceSessionBots()
|
||||
{
|
||||
$cache = Cache::get('cache_phone_attendance_session_bots');
|
||||
if (!is_null($cache)) {
|
||||
return $cache;
|
||||
}
|
||||
$phones = collect(DB::table('attendance_session_bots')->select('phone')->get());
|
||||
$phones = $phones->pluck('phone')->toArray();
|
||||
Cache::put('cache_phone_attendance_session_bots', $phones, Carbon::now()->addDay());
|
||||
return $phones;
|
||||
}
|
||||
|
||||
public function getRandomBotsAttendance($botRate = 10, $phoneUserAttendance = [])
|
||||
{
|
||||
$totalBot = count(DB::table('attendance_session_bots')->get());
|
||||
return DB::table('attendance_session_bots')
|
||||
->whereNotIn('phone', $phoneUserAttendance)
|
||||
->orderBy(DB::raw('RAND()'))
|
||||
->take(round(($botRate / 100) * $totalBot))
|
||||
->get();
|
||||
}
|
||||
|
||||
public function checkTurOnAttendance()
|
||||
{
|
||||
$setting = $this->getSettingWebsite();
|
||||
if (isset($setting['baotri']) && $setting['baotri'] == 1) {
|
||||
return false;
|
||||
}
|
||||
if (!isset($setting['on_diemdanh'])) {
|
||||
return true;
|
||||
}
|
||||
return $setting['on_diemdanh'] == TURN_ON_SETTING;
|
||||
}
|
||||
|
||||
public function getSettingWebsite()
|
||||
{
|
||||
$cache = Cache::get('cache_website_setting');
|
||||
$cache = null;
|
||||
if (!is_null($cache)) {
|
||||
return $cache;
|
||||
}
|
||||
$setting = Setting::first()->toArray();
|
||||
Cache::put('cache_website_setting', $setting, Carbon::now()->addDay());
|
||||
return $setting;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function updateCacheDataAttendanceSession()
|
||||
{
|
||||
$records = AttendanceSession::where('date', Carbon::today()->toDateString())
|
||||
->orderBy('created_at', 'DESC')
|
||||
->with(['usersAttendanceSession'])
|
||||
->get();
|
||||
if (count($records) == 0) {
|
||||
return [
|
||||
'current' => AttendanceSession::create(['date' => Carbon::today()->toDateString()]),
|
||||
'phone_win_latest' => "*",
|
||||
'sessions_past' => collect(),
|
||||
];
|
||||
}
|
||||
$current = $records->where('status', STATUS_ACTIVE)->last();
|
||||
$current = is_null($current) ? $records->last() : $current;
|
||||
$sessionsPast = $records->except($current->id)->take(5);
|
||||
$result = [
|
||||
'current' => $current,
|
||||
'phone_win_latest' => count($sessionsPast) > 0 ? $sessionsPast->first()->getPhone() : "*",
|
||||
'sessions_past' => count($sessionsPast) > 0 ? $sessionsPast : collect(),
|
||||
];
|
||||
Cache::put('cache_data_attendance_session', $result, Carbon::now()->addSeconds($this->getSecondsRealtime()));
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function forgetCacheDatAttendanceSession()
|
||||
{
|
||||
Cache::forget('cache_data_attendance_session');
|
||||
Cache::forget('cache_total_amount_attendance_session');
|
||||
}
|
||||
|
||||
public function getAttendanceSetting()
|
||||
{
|
||||
$cache = Cache::get('cache_attendance_setting');
|
||||
if (!is_null($cache)) {
|
||||
return $cache;
|
||||
}
|
||||
$attendance = AttendanceSetting::first();
|
||||
$config = !is_null($attendance) ? AttendanceSetting::first()->toArray() : AttendanceSetting::create([
|
||||
'win_rate' => 10,
|
||||
'start_time' => TIME_START_ATTENDANCE,
|
||||
'end_time' => TIME_END_ATTENDANCE,
|
||||
'money_min' => MONEY_MIN_WIN_ATTENDANCE,
|
||||
'money_max' => MONEY_MAX_WIN_ATTENDANCE,
|
||||
'time_each' => TIME_EACH_ATTENDANCE_SESSION,
|
||||
])->toArray();
|
||||
Cache::put('cache_attendance_setting', $config, Carbon::now()->addDay());
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
}
|
34
app/Http/Requests/AdminSettingGameRequest.php
Normal file
34
app/Http/Requests/AdminSettingGameRequest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AdminSettingGameRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
'min' => 'required|integer',
|
||||
'max' => 'required|integer',
|
||||
'sdt' => 'required',
|
||||
'tile' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
36
app/Http/Requests/AdminSettingGameRequest2.php
Normal file
36
app/Http/Requests/AdminSettingGameRequest2.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AdminSettingGameRequest2 extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
'min' => 'required|integer',
|
||||
'max' => 'required|integer',
|
||||
'sdt' => 'required',
|
||||
'tile1' => 'required',
|
||||
'tile2' => 'required',
|
||||
'tile3' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
33
app/Http/Requests/AdminSettingGameRequest3.php
Normal file
33
app/Http/Requests/AdminSettingGameRequest3.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AdminSettingGameRequest3 extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
'tiencuoc' => 'required|integer',
|
||||
'tienmacdinh' => 'required|integer',
|
||||
'ptvaohu' => 'required|integer',
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/ChangePasswordAdminRequest.php
Normal file
32
app/Http/Requests/ChangePasswordAdminRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ChangePasswordAdminRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
'old_password' => 'required',
|
||||
'password' => 'required|string|min:6|confirmed',
|
||||
];
|
||||
}
|
||||
}
|
31
app/Http/Requests/CronMomoRequest.php
Normal file
31
app/Http/Requests/CronMomoRequest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CronMomoRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
'account_id' => 'integer|min:1|required',
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/LoginAdminRequest.php
Normal file
32
app/Http/Requests/LoginAdminRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LoginAdminRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user