12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Http\Models;
- use Illuminate\Database\Eloquent\Model;
- class NotFound extends Model
- {
- protected $primaryKey = 'id';
- protected $table = 'site_status';
- public static function get404List($siteId)
- {
- //过滤
- $list1 = self::where('status', 404)
- ->where('url', 'like', '%javascript:%')
- ->where('site_id', $siteId)->pluck('id')->toArray();
- $list2 = self::where('status', 404)
- ->where('url', 'like', '%tel:%')
- ->where('site_id', $siteId)->pluck('id')->toArray();
- $list3 = self::where('status', 404)
- ->where('url', 'like', '%mailto:%')
- ->where('site_id', $siteId)->pluck('id')->toArray();
- $list4 = self::where('status', 404)
- ->where('url', 'like', '%$%')
- ->where('site_id', $siteId)->pluck('id')->toArray();
- $list5 = self::where('status', 404)
- ->where('url', 'like', '%skype:%')
- ->where('site_id', $siteId)->pluck('id')->toArray();
- $list6 = self::where('status', 404)
- ->where('url', 'like', '%whatsapp:%')
- ->where('site_id', $siteId)->pluck('id')->toArray();
- $ids = array_merge($list1, $list2, $list3, $list4, $list5, $list6);
- $list = self::where('status', 404)
- ->where('site_id', $siteId)->pluck('id')->toArray();
- $ids = array_diff($list, $ids);
- return $ids;
- }
- }
|