Answer the question
In order to leave comments, you need to log in
How to tell Vue.js that queue:work has finished?
Hello.
There is such a function:
update: function () {
//запускаем выполнение скрипта в потоке
axios.get('/show/'+ this.site.site +'/update').then((response) =>{
this.urldata1 = response.data;
//тут нужно сообщить что воркер выполнил работу и после этого запустить код ниже.
if (response.status === 200) {
for(var i = 0; i<this.urldata.keyAll.length; i++) {
axios.get('/show/' + this.site.site + '/getJson/1').then((response) => {
this.urldata = response.data;
});
}
}
});
},
namespace App\Jobs;
use App\Models\AddProject;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Auth;
class JobCreatCheck implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $parameters;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($parameters)
{
$this->parameters = $parameters;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//переменые с контроллера
$url = $this->parameters['url'];
$site = $this->parameters['site'];
$key_value = $this->parameters['key_value'];
$auth_id = $this->parameters['auth_id'];
$todayDate = $this->parameters['todayDate'];
//тут код вы полнения убрал для краткости
//сохранить результат в БД
$flight = AddProject::updateOrCreate(
[
'user_id' => $auth_id,
'site' => $site,
'textarea' => $key_value,
'date' => $todayDate
],
[
'num_check' => $saveNumCheck
]
);
$flight->save();
}
public function failed($exception)
{
echo $exception;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question