delete(); } //获取列表 public static function getList($limit = 10, $where = [], $orders = ['sort'=>'asc']) { return self::order($orders) ->when(!empty($where), function ($q) use ($where) { $q->where($where); }) ->when($limit > 0, function ($q) use ($limit) { $q->limit($limit); }) ->select() ->toArray(); } public static function onAfterInsert($item) { $item->sort = $item->id; $item->save(); } //获取涉及到的文件 public static function getFilesInUse() { $items = self::select()->toArray(); $data = []; foreach($items as $item){ $src = trim($item['src']); if(!empty($src)){ $key = getKeyByPath($src); $data[$key] = $src; } } return $data; } }