wip
This commit is contained in:
1 parent
23cf804865
commit
4e77862aa7
14 files changed
+113
-49
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace App\Console\Commands\Services\Tasks;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\AlarmLevel;
|
||||
use App\Models\AlarmSetting;
|
||||
use App\Models\BettypeUser;
|
||||
use App\Models\Bookmaker;
|
||||
@@ -25,6 +26,11 @@ class GenerateSetting
|
||||
Notice::note('GENERATE DEFAULT SETTING', 'b');
|
||||
}
|
||||
|
||||
$clients = Client::get();
|
||||
$users = User::get();
|
||||
$alarm_levels = AlarmLevel::get();
|
||||
$sports = Sport::getActiveSports();
|
||||
|
||||
/**************************************************
|
||||
* 1) ALARM BOOKMAKER
|
||||
**************************************************/
|
||||
@@ -33,10 +39,6 @@ class GenerateSetting
|
||||
Notice::note('1) ALARM BOOKMAKER', 'p');
|
||||
}
|
||||
|
||||
$alarm_thresholds = [1 => 0.01, 2 => 0.2, 3 => 0.3];
|
||||
|
||||
$clients = Client::get();
|
||||
|
||||
foreach ($clients as $client) {
|
||||
|
||||
foreach ($client->sport as $sport_id) {
|
||||
@@ -47,11 +49,11 @@ class GenerateSetting
|
||||
|
||||
foreach ($multilines as $multiline_id) {
|
||||
|
||||
foreach ($alarm_thresholds as $level_id => $alarm_threshold) {
|
||||
foreach ($alarm_levels as $alarm_level) {
|
||||
|
||||
AlarmSetting::firstOrCreate(
|
||||
['client_bookmaker_id' => $client_bookmaker_id, 'sport_id' => $sport_id, 'multiline_setting_id' => $multiline_id, 'level_id' => $level_id],
|
||||
['name' => "LEVEL $level_id", 'alarm_threshold' => $alarm_threshold]
|
||||
['client_bookmaker_id' => $client_bookmaker_id, 'sport_id' => $sport_id, 'multiline_setting_id' => $multiline_id, 'alarm_level_id' => $alarm_level->id],
|
||||
['alarm_threshold' => $alarm_level->default_threshold]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -69,8 +71,6 @@ class GenerateSetting
|
||||
|
||||
$bookmaker_slots = [1 => 6, 2 => 30, 3 => 649, 4 => 126];
|
||||
|
||||
$clients = Client::get();
|
||||
|
||||
foreach ($clients as $client) {
|
||||
|
||||
foreach ($client->sport as $sport_id) {
|
||||
@@ -101,8 +101,6 @@ class GenerateSetting
|
||||
Notice::note('3) GENERATOR BETTYPES IM COMPARATORE FOR USERS', 'p');
|
||||
}
|
||||
|
||||
$users = User::get();
|
||||
|
||||
foreach ($users as $user) {
|
||||
|
||||
$multilines = MultilineSetting::orderBy('sport_id')->pluck('sport_id', 'id');
|
||||
@@ -126,13 +124,11 @@ class GenerateSetting
|
||||
Notice::note('4) COMPARING BOOKMAKER', 'p');
|
||||
}
|
||||
|
||||
$res = Client::get();
|
||||
|
||||
$bookmakers_soccer = Bookmaker::where('in_soccer', 1)->orderBy('name')->pluck('id')->toArray();
|
||||
|
||||
ComparingBookmaker::where('method_id', 1)->where('sport_id', 1)->whereNotIn('bookmaker_id', $bookmakers_soccer)->delete();
|
||||
|
||||
foreach ($res as $client) {
|
||||
foreach ($clients as $client) {
|
||||
|
||||
$client_bookmakers = $client->bookmaker;
|
||||
|
||||
@@ -159,7 +155,7 @@ class GenerateSetting
|
||||
|
||||
ComparingBookmaker::where('method_id', 1)->whereIn('sport_id', $sports)->whereNotIn('bookmaker_id', $bookmakers_other)->delete();
|
||||
|
||||
foreach ($res as $client) {
|
||||
foreach ($clients as $client) {
|
||||
|
||||
$client_bookmakers = $client->bookmaker;
|
||||
|
||||
@@ -195,16 +191,16 @@ class GenerateSetting
|
||||
$sports = Client::find($user->client_id)->value('sport');
|
||||
}
|
||||
foreach ($sports as $sport_id) {
|
||||
foreach ([2, 3] as $alarm_level_id) {
|
||||
foreach ($alarm_levels as $alarm_level) {
|
||||
|
||||
PersonalNotification::firstOrCreate(
|
||||
['sport_id' => $sport_id, 'user_id' => $user->id, 'bookmaker_id' => $user->bookmaker_id, 'alarm_level_id' => $alarm_level_id],
|
||||
['sport_id' => $sport_id, 'user_id' => $user->id, 'bookmaker_id' => $user->bookmaker_id, 'alarm_level_id' => $alarm_level->id],
|
||||
['notify_by_system' => 0, 'notify_by_email' => 0]
|
||||
);
|
||||
|
||||
if ($user->partner_bookmaker_id) {
|
||||
PersonalNotification::firstOrCreate(
|
||||
['sport_id' => $sport_id, 'user_id' => $user->id, 'bookmaker_id' => $user->partner_bookmaker_id, 'alarm_level_id' => $alarm_level_id],
|
||||
['sport_id' => $sport_id, 'user_id' => $user->id, 'bookmaker_id' => $user->partner_bookmaker_id, 'alarm_level_id' => $alarm_level->id],
|
||||
['notify_by_system' => 0, 'notify_by_email' => 0]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user