wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Services\Tasks\Notification;
|
||||
|
||||
use App\Models\PersonalNotificationSend;
|
||||
|
||||
class CheckSend
|
||||
{
|
||||
public static function check($event_id, $user_id, $bookmaker_id, $alarm_level_id, $fieldname, $sendtype)
|
||||
{
|
||||
$res = PersonalNotificationSend::where('event_id', $event_id)
|
||||
->where('user_id', $user_id)
|
||||
->where('bookmaker_id', $bookmaker_id)
|
||||
->where('alarm_level_id', $alarm_level_id)
|
||||
->where('fieldname', $fieldname)
|
||||
->where($sendtype, 1)
|
||||
->first();
|
||||
if (! $res) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $res->id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Services\Tasks\Notification;
|
||||
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\OddsTable;
|
||||
use App\Models\PersonalNotification;
|
||||
|
||||
class LoadAlarmEvents
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
$map = OddsTable::alarm_fieldnames_by_sport();
|
||||
|
||||
$users = PersonalNotification::where('notify_by_system', 1)->orwhere('notify_by_email', 1)->orderby('bookmaker_id')->get();
|
||||
|
||||
$alarms = [];
|
||||
|
||||
foreach ($users as $user) {
|
||||
|
||||
$events = EventBookmaker::where('bookmaker_id', $user->bookmaker_id)->get();
|
||||
|
||||
foreach ($events as $event) {
|
||||
|
||||
foreach ($map[$event->sport_id] as $field) {
|
||||
if ($event[$field] == $user->alarm_level_id) {
|
||||
if ($user->notify_by_system) {
|
||||
$alarms[$event->event_id][$user->user_id][$user->bookmaker_id]['system'][$field] = $event[$field];
|
||||
}
|
||||
if ($user->notify_by_email) {
|
||||
$alarms[$event->event_id][$user->user_id][$user->bookmaker_id]['mail'][$field] = $event[$field];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $alarms;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user