ContentTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Console\Commands\ContentManage;
  3. use http\Exception\RuntimeException;
  4. use Illuminate\Console\Command;
  5. use Illuminate\Support\Facades\DB;
  6. use Illuminate\Support\Facades\Redis;
  7. use Modules\Common\Errors\Errors;
  8. use Modules\Common\Exceptions\CommonBusinessException;
  9. class ContentTest extends Command
  10. {
  11. /**
  12. * The name and signature of the console command.
  13. *
  14. * @var string
  15. */
  16. protected $signature = 'app:contenttest';
  17. /**
  18. * The console command description.
  19. *
  20. * @var string
  21. */
  22. protected $description = 'Command description';
  23. /**
  24. * Execute the console command.
  25. */
  26. public function handle(): void
  27. {
  28. $result = DB::table('promotions')
  29. ->where(['puid' => 0])
  30. ->get();
  31. foreach ($result as $item) {
  32. DB::table('promotions')
  33. ->where('id', $item->id)
  34. ->update([
  35. 'puid' => DB::table('users')->where('id', $item->uid)->value('pid')
  36. ]);
  37. }
  38. }
  39. }