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) { $uris = File::where('id', 'in', $params['ids'])->column('uri'); File::destroy($params['ids']); // 同时删除存储里面的文件 UploadService::delete($uris); } /** * @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']); } }