public function edit_vip(){ if($_GET['ac']=="add"){ $user_vip=D('user_vip'); if($user_vip->create()){ if($user_vip->add()){ $this->success('添加成功,返回上级页面'); }else{ $this->error('添加失败,返回上级页面'); } }else{ $this->error($user_vip->getError()); } }elseif($_GET['ac']=="del"){ $user_vip=D('user_vip'); if($user_vip->delete($_GET['id'])){ $this->success('删除成功'); }else{ $this->error('删除失败'); } }elseif($_GET['ac']=="edit"){ $user_vip=M('user_vip'); $id=(int)$_GET['id']; if($id){ $list=$user_vip->where("id=$id")->find(); $this->assign('data',$list); } $this->display(); }elseif($_GET['ac']=="update"){ $user_vip=M('user_vip'); if($user_vip->create()){ $insertid=$user_vip->save(); if($insertid){ $this->success('更新成功,受影响的行数为'.$insertid); }else{ $this->error('更新失败'); } } }else{ $user_vip=M('user_vip'); $list=$user_vip->select(); $this->assign('data',$list); $this->display(); } }