AwardCreatorBuyVideoJob.php 778 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Jobs;
  3. use App\Repositories\CreatorRepository;
  4. use Hyperf\AsyncQueue\Job;
  5. class AwardCreatorBuyVideoJob extends Job
  6. {
  7. protected $params = [];
  8. public function __construct($params = [])
  9. {
  10. $this->params = $params;
  11. }
  12. public function handle()
  13. {
  14. $videoId = $this->params['video_id'];
  15. $buyerUid = $this->params['buyer_uid'];
  16. $sellerUid = $this->params['seller_uid'] ?? '';
  17. $isDeduction = $this->params['is_deduction'] ?? 0; // 是否扣量
  18. $creatorRepo = make(CreatorRepository::class);
  19. $creatorRepo->handleAwardBuyVideo($videoId, $buyerUid);
  20. if (!empty($sellerUid)) {
  21. // 检查升级.
  22. $creatorRepo->checkAndUpgrade($sellerUid);
  23. }
  24. }
  25. }