post['page'])&&$this->post['page']!="" ? intval($this->post['page']) : 1; $size = isset($this->post['size'])&&$this->post['size']!="" ? intval($this->post['size']) :10; $count= Db::name("version")->count(); $total = ceil($count/$size); $page = $page>=$total? $total:$page; $list = Db::name("version")->page($page,$size)->order("addtime desc")->select(); return app_show(0,"获取成功",["list"=>$list,"count"=>$count]); } public function create(){ $title = isset($this->post['title'])&&$this->post['title']!="" ? $this->post['title']:""; if($title==""){ return error_show(1004,"参数title 不能为空"); } $content = isset($this->post['content'])&&$this->post['content']!="" ? $this->post['content']:""; if($content==""){ return error_show(1004,"参数content 不能为空"); } $version = isset($this->post['version'])&&$this->post['version']!="" ? $this->post['version']:""; if($version==""){ return error_show(1004,"参数version 不能为空"); } $data=[ "title"=>$title, "content"=>$content, "version"=>$version, "addtime"=>date("Y-m-d H:i:s") ]; $inert= Db::name("version")->insert($data); if($inert){ write_log("版本{$version}新建成功",$this->userinfo,"version","add"); return app_show(0,"版本信息新建成功"); }else{ return app_show(0,"版本信息新建失败"); } } }