| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- /**
- * 描述.
- *
- * @author nj
- * @date 2021-08-02 12:21
- */
- namespace App\Jobs\Statistics;
- use App\Constants\PayConstant;
- use App\Models\Mysql\StatisticsPayModel;
- use App\Repositories\Statistics\StatisticsPayRepository;
- use Carbon\Carbon;
- use Illuminate\Bus\Queueable;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Queue\SerializesModels;
- use App\Models\Mysql\ChannelModel;
- class RecordCommissionEveryLevelByRootJob implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- /**
- * 定义仓库.
- * @var null|StatisticsPayRepository
- */
- protected $repo = null;
- protected $logs = [];
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct($logs = [])
- {
- $this->logs = $logs;
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- if (!empty($this->logs)) {
- foreach ($this->logs as $log) {
- $logId = $log['log_id'];
- $this->getRepo()->recordCommissionOneDayByRoot($logId);
- }
- }
- }
- /**
- * 发送通知, 重新读取数据然后拼接数据,发送邮箱或者tg.
- */
- private function notify()
- {
- // Todo 发送通知, 重新读取数据然后拼接数据,发送邮箱或者tg.
- }
- /**
- * 获取仓库.
- * @return StatisticsPayRepository
- */
- private function getRepo()
- {
- if (!$this->repo instanceof StatisticsPayRepository) {
- $this->repo = new StatisticsPayRepository();
- }
- return $this->repo;
- }
- }
|