BugStorePartnerCommand.php 804 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Console\Commands\User;
  3. use App\Jobs\StoreSelfPartnerJob;
  4. use App\Models\Partner\ThumbActionModel;
  5. use App\Models\User\UserModel;
  6. use Illuminate\Console\Command;
  7. use Illuminate\Support\Facades\DB;
  8. class BugStorePartnerCommand extends Command
  9. {
  10. protected $signature = "bug:storepartner";
  11. protected $description = "";
  12. public function handle()
  13. {
  14. $users = ThumbActionModel::where('thumb', 1)->select(DB::raw("DISTINCT(`uid`) as uid"))->get();
  15. foreach ($users as $user) {
  16. try {
  17. $um = UserModel::findOrFail($user->uid);
  18. if ($um->partner_id > 0) {
  19. dump(StoreSelfPartnerJob::dispatch($um->uid));
  20. }
  21. } catch (\Exception $exception) {
  22. }
  23. }
  24. }
  25. }