bounsPerf = $bounsPerf->fresh(); $this->price = $price; $this->bouns = $bouns; } public function handle() { try { $perf = bcadd(bcmul($this->bounsPerf->old_perf, 0.3, 4), bcmul($this->bounsPerf->new_perf, 0.7, 4), 4); $this->bounsPerf->price = $this->price; $this->bounsPerf->amount = $this->price * $perf; $this->bounsPerf->user->account->rule('star_balance', $this->bounsPerf->amount, false, [ 'remark' => Bouns::TYPES[$this->bouns->type], 'star' => $this->bouns->type, ]); } catch (\Exception $e) { $this->bounsPerf->status = BounsUserPerf::STATUS_ERROR; } $this->bounsPerf->save(); if (Job::where('queue', 'BONUS')->where('payload', 'like', '%SendBounsJob%')->count() <= 1) { $this->bouns->doEnd(); } } }