whereIn('id', $params['ids']) ->update([ 'cid' => $params['cid'], 'update_time' => time() ]); } /** * @notes 重命名文件 * @param $params * @author 张无忌 * @date 2021/7/29 17:16 */ public static function rename($params) { (new File())->where('id', $params['id']) ->update([ 'name' => $params['name'], 'update_time' => time() ]); } /** * @notes 批量删除文件 * @param $params * @author 张无忌 * @date 2021/7/28 15:41 */ public static function delete($params) { $result = File::whereIn('id', $params['ids'])->select(); $StorageDriver = new StorageDriver([ 'default' => ConfigService::get('storage', 'default', 'local'), 'engine' => ConfigService::get('storage') ?? ['local'=>[]], ]); foreach ($result as $item) { $StorageDriver->delete($item['uri']); } File::destroy($params['ids']); } /** * @notes 添加文件分类 * @param $params * @author 张无忌 * @date 2021/7/28 11:32 */ public static function addCate($params) { FileCate::create([ 'type' => $params['type'], 'pid' => $params['pid'], 'name' => $params['name'] ]); } /** * @notes 编辑文件分类 * @param $params * @author 张无忌 * @date 2021/7/28 14:03 */ public static function editCate($params) { FileCate::update([ 'name' => $params['name'], 'update_time' => time() ], ['id' => $params['id']]); } /** * @notes 删除文件分类 * @param $params * @author 张无忌 * @date 2021/7/28 14:21 */ public static function delCate($params) { FileCate::destroy($params['id']); } }