| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace App\Jobs;
- use App\Feature;
- use App\Order;
- 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;
- /**
- * @Deprecated 结算账单计费
- */
- class ExecutePostBillHandler implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable;
- /**
- * @var \Closure $closure
- */
- protected $closure;
- /**
- * @var Collection $collection
- */
- protected $collection;
- /**
- * @var string $modelClass
- */
- protected $modelClass;
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct(\Closure $closure, Collection $collection, string $modelClass)
- {
- $this->closure = $closure;
- $this->connection = $collection;
- $this->modelClass = $modelClass;
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- $closure = $this->closure;
- switch ($this->modelClass){
- case Store::class:
- foreach ($this->collection as $detail){
- $closure(Feature::MAPPING["store"],$detail->store,$detail);
- }
- break;
- case Order::class:
- foreach ($this->collection as $detail){
- $closure(Feature::MAPPING["order"],$detail->order,$detail);
- }
- }
- }
- }
|