NotFound.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Http\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class NotFound extends Model
  5. {
  6. protected $primaryKey = 'id';
  7. protected $table = 'site_status';
  8. public static function get404List($siteId)
  9. {
  10. //过滤
  11. $list1 = self::where('status', 404)
  12. ->where('url', 'like', '%javascript:%')
  13. ->where('site_id', $siteId)->pluck('id')->toArray();
  14. $list2 = self::where('status', 404)
  15. ->where('url', 'like', '%tel:%')
  16. ->where('site_id', $siteId)->pluck('id')->toArray();
  17. $list3 = self::where('status', 404)
  18. ->where('url', 'like', '%mailto:%')
  19. ->where('site_id', $siteId)->pluck('id')->toArray();
  20. $list4 = self::where('status', 404)
  21. ->where('url', 'like', '%$%')
  22. ->where('site_id', $siteId)->pluck('id')->toArray();
  23. $list5 = self::where('status', 404)
  24. ->where('url', 'like', '%skype:%')
  25. ->where('site_id', $siteId)->pluck('id')->toArray();
  26. $list6 = self::where('status', 404)
  27. ->where('url', 'like', '%whatsapp:%')
  28. ->where('site_id', $siteId)->pluck('id')->toArray();
  29. $ids = array_merge($list1, $list2, $list3, $list4, $list5, $list6);
  30. $list = self::where('status', 404)
  31. ->where('site_id', $siteId)->pluck('id')->toArray();
  32. $ids = array_diff($list, $ids);
  33. return $ids;
  34. }
  35. }