|
|
@@ -4,13 +4,11 @@ namespace App\Jobs;
|
|
|
|
|
|
use App\Services\LogService;
|
|
|
use App\Services\StoreService;
|
|
|
-use App\Store;
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
|
-use Illuminate\Queue\SerializesModels;
|
|
|
|
|
|
class StoreCreateInstantBill implements ShouldQueue
|
|
|
{
|
|
|
@@ -38,13 +36,14 @@ class StoreCreateInstantBill implements ShouldQueue
|
|
|
*/
|
|
|
public function handle(StoreService $service)
|
|
|
{
|
|
|
+ if (!$this->stores)return;
|
|
|
$errors = [];
|
|
|
foreach ($this->stores as $store){
|
|
|
try{
|
|
|
$service->createInstantBill($store);
|
|
|
- }catch (\Exception $e){
|
|
|
+ }catch (\Error|\Exception $e){
|
|
|
LogService::log(__METHOD__,"ERROR-入库生成即时账单",$store->toJson()." | ".$e->getMessage());
|
|
|
- $errors = ["order_".$store->id.":".$e->getMessage()];
|
|
|
+ $errors = ["store_".$store->id.":".$e->getMessage()];
|
|
|
}
|
|
|
}
|
|
|
if ($errors)throw new \Exception(json_encode($errors));
|