clone saver framework and code cleanup

This commit is contained in:
2019-01-19 04:30:08 -06:00
parent 69f60b45ce
commit ddcb121b48
11 changed files with 36 additions and 203 deletions
+1 -12
View File
@@ -83,17 +83,6 @@ class CalculateMarketTax extends Command
$character = UserToCorporation::where(['character_id' => $info->character_id])->first();
//Store the value in the database
$bill = new MonthlyMarketTax;
$bill->character_id = $info->character_id;
$bill->character_name = $character->character_name;
$bill->corporation_id = $corp->corporation_id;
$bill->corporation_name = $character->corporation_name;
$bill->tax_owed = $finalTaxes;
$bill->month = $start->month;
$bill->year = $start->year;
$bill->save();
$mail = new EveMail;
$mail->sender = 93738489;
$mail->subject = 'Market Taxes Owed';
@@ -107,7 +96,7 @@ class CalculateMarketTax extends Command
$mail->recipient_type = 'character';
//$mail->save();
SendEveMail::dispatch($mail);
SendEveMail::dispatch($mail)->delay(Carbon::now()->addSeconds(15));
}
@@ -1,61 +0,0 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Commands\Library\CommandHelper;
use App\Models\Logistics\Contract;
use App\Models\ScheduledTask\ScheduleJob;
use Seat\Eseye\Cache\NullCache;
use Seat\Eseye\Configuration;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
class GetLogisticsContracts extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:logistics';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Get the logistics jobs.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//Create the command helper container
$task = new CommandHelper('CorpJournal');
//Add the entry into the jobs table saying the job is starting
$task->SetStartStatus();
//Create functionality to record contracts for logistical services
//Mark the job as finished
$task->SetStopStatus();
}
}
+5 -5
View File
@@ -13,7 +13,7 @@ use App\Library\Clones\CloneSaver;
use App\Models\Character\CharacterClone;
class runclonesaver extends Command
class RunCloneSaver extends Command
{
/**
* The name and signature of the console command.
@@ -60,6 +60,9 @@ class runclonesaver extends Command
}
private function CloneSaverMail() {
//Setup time frame job has been sent so we don't send too many mails
//Store a new eve mail model for the job to dispatch
$mail = new EveMail;
$mail->sender = $self;
@@ -69,9 +72,6 @@ class runclonesaver extends Command
$mail->recipient_type = 'character';
//Dispatch the job
SendEveMail::dispatch($mail);
//Setup time frame job has been sent so we don't send too many mails all at once
SendEveMail::dispatch($mail)->delay(Carbon::now()->addSeconds(1));
}
}
+4 -1
View File
@@ -19,8 +19,8 @@ class Kernel extends ConsoleKernel
Commands\UpdateMoonPricing::class,
Commands\DumpFleets::class,
Commands\CalculateMarketTax::class,
//Commands\GetLogisticsContracts::class,
Commands\holdingfinances::class,
Commands\RunCloneSaver::class,
];
/**
@@ -49,6 +49,9 @@ class Kernel extends ConsoleKernel
$schedule->command('services:holdingjournal')
->hourly()
->withoutOverlapping();
//$schedule->command('services:clonesaver')
// ->everyMinute()
// ->withoutOverlapping();
}
/**
+14 -5
View File
@@ -7,12 +7,21 @@ use Illuminate\Support\Facades\Auth;
use App\Models\Esi\EsiScope;
use App\Models\Esi\EsiToken;
use App\Models\User\UserPermission;
use App\Models\User\UserRole;
class CloneSaverController extends Controller
{
//
//Register display, this will register new scopes and the old scopes as well
public function displayRegister() {
}
//Remove display
public function removeRegister() {
}
//Display clones
public function displayClones() {
}
}
@@ -1,11 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class HelpDeskAdminController extends Controller
{
//
}
@@ -1,59 +0,0 @@
<?php
namespace App\Http\Controllers;
use Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\HelpDesk\HelpDeskTicket;
use App\Models\HelpDesk\HelpDeskTicketResponse;
class HelpDeskController extends Controller
{
/**
* Display form to submit a new ticket
*/
public function displayNewTicket() {
//Return the view form to create a new ticket
return view('helpdesk.newticket');
}
public function storeTicket(Request $request) {
//Using the request populate the ticket and save to the database
$ticket = new HelpDeskTicket;
$ticket->user_id = Auth()-user()->character_id;
$ticket->department = $request->department;
$ticket->subject = $request->subject;
$ticket->body = $request->body;
$ticket->save();
//Return the message the ticket has been submitted, and the main dashboard
return redirect('/dashboard')->with('success', 'Ticket submitted.');
}
/**
* Display current open tickets for the user
*/
public function displayMyTickets() {
//Get the active tickets from the database
$tickets = HelpDeskTicket::where(['user_id' => auth()->user()->character_id])->get();
//Return the view with the tickets variable
return view('helpdesk.mytickets')->with('tickets', $tickets);
}
/**
* Modify currently open ticket for the user
*/
public function editTicket(Request $request) {
//Update the ticket
HelpDeskTicket::where(['user_id' => auth()->user()->character_id, 'active' => 1])
->update([
'department' => $request->department,
'subject' => $request->subject,
'body' => $request->body,
]);
return redirect('/dashboard')->with('success', 'Ticket modified.');
}
}
+5 -8
View File
@@ -20,7 +20,7 @@ use App\Models\Mail\EveMail as EveMailModel;
class SendEveMail implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable;
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Class Variable for eve mail
@@ -60,9 +60,6 @@ class SendEveMail implements ShouldQueue
*/
public function handle()
{
//Access the model in the queue for processing
$mail = $this->eveMail;
//Retrieve the token for main character to send mails from
$token = EsiToken::where(['character_id'=> 93738489])->get();
@@ -81,12 +78,12 @@ class SendEveMail implements ShouldQueue
try {
$esi->setBody([
'approved_cost' => 0,
'body' => $mail->body,
'body' => $this->eveMail->body,
'recipients' => [[
'recipient_id' => (int)$mail->recipient,
'recipient_type' => $mail->recipient_type,
'recipient_id' => (int)$this->eveMail->recipient,
'recipient_type' => $this->eveMail->recipient_type,
]],
'subject' => $mail->subject,
'subject' => $this->eveMail->subject,
])->invoke('post', '/characters/{character_id}/mail/', [
'character_id'=> 93738489,
]);
-27
View File
@@ -1,27 +0,0 @@
<?php
namespace App\Models\Market;
use Illuminate\Database\Eloquent\Model;
class MonthlyMarketTax extends Model
{
// Table Name
protected $table = 'monthly_market_taxes';
// Timestamps
public $timestamps = true;
//Primary Key
public $primaryKey = 'id';
protected $fillable = [
'character_id',
'character_name',
'corporation_id',
'corporation_name',
'tax_owed',
'month',
'year',
];
}
+1 -1
View File
@@ -38,7 +38,7 @@ return [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'retry_after' => 30,
],
'beanstalkd' => [
+6 -13
View File
@@ -42,14 +42,6 @@ Route::group(['middleware' => ['auth']], function(){
Route::get('/wiki/changepassword', 'WikiController@displayChangePassword');
Route::post('/wiki/changepassword', 'WikiController@changePassword');
//Fleet Controller display pages
//Route::get('/fleets/display', 'FleetsController@displayFleets');
//Route::get('/fleets/register', 'FleetsController@displayRegisterFleet');
//Route::post('/fleets/register', 'Fleetscontroller@registerFleet');
//Route::get('/fleets/{fleet_id}/addpilot/{id}', 'FleetsController@addPilot')->name('addpilot');
//Route::get('/fleets/{fleet_id}/addpilot/{name}', 'Fleetscontroller@addPilotName');
//Route::get('/fleets/{fleet_id}/delete', 'FleetsController@deleteFleet')->name('deletefleet');
//Admin Controller display pages
Route::get('/admin/dashboard', 'AdminController@displayDashboard');
Route::post('/admin/addRole', 'AdminController@addRole');
@@ -72,11 +64,12 @@ Route::group(['middleware' => ['auth']], function(){
//Jump Bridge Controller display pages
//Help Desk Controller display pages
//Route::get('/helpdesk/tickets', 'HelpDeskController@displayMyTickets');
//Route::get('/helpdesk/tickets/edit', 'HelpDeskController@editTicket');
//Route::get('/helpdesk/tickets/new', 'HelpDeskController@displayNewTicket');
//Route::post('/helpdesk/tickets/new', 'HelpDeskController@storeTicket');
//Clone Saver display pages
Route::get('/clones/register', 'CloneSaverController@displayRegister');
Route::get('/clones/display', 'CloneSaverController@displayClones');
Route::get('/clones/remove', 'CloneSaverController@displayRemove');
Route::post('/clones/register', 'CloneSaverController@storeRegister');
Route::post('/clones/remove', 'CloneSavercontroller@deleteRegister');
});
//Login display pages