ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` $params = $request->post();           $file = $request->file('images');         $fileName = \\think\\facade\\Filesystem::disk('public')                   ->putFile( '/', $file);         $params\['image'\] = 'http://tps.com/storage/' . $fileName;         $book = UserModel::where('title','=',$params\['title'\])             ->findOrEmpty();             if (!$book->isEmpty()){                 return json(\[                     'errorCode'=>'10001',                     'msg'=>'该图书已存在,请重新添加!',                 \]);             }             //添加图书               $result=(new UserModel())->save($params);               return json(\[                 'errorCode'=>'0',                 'msg'=>'创建成功',                 'result'=>$result             \]);  删除     public function dele($id){         $result=UserModel::destroy($id);         if($result){             return '删除成功';         }     } 修改  public function upda($id){        $data=UserModel::where('id',$id)->select();       if($data){           return View::fetch('show/upda',compact('data'));       }     } public function update($id){        $data=input();         $res=UserModel::update($data);         if($res){             return '修改成功';         }     }  状态修改 public function status(Request $request){        $id=$request\['id'\];        $status=$request\['status'\];        if($status==1){            $name\['status'\]=0;        }else{            $name\['status'\]=1;        }        $uname=UserModel::where('id',$id)->update($name);        if($uname){            return redirect('list');        }     } ```