Commit 3df9764d by 冷斌

update

parent c0843de1
......@@ -6,6 +6,11 @@
<li class="active"><a href="{:U('Vip/user_index')}">列表</a></li>
<li><a href="{:U('Vip/user_add')}">添加</a></li>
</ul>
<form class="well form-search" name="form1" method="post" action="{:U('Vip/user_index')}">
关键字:
<input type="text" name="keyword" style="width: 200px;" value="{$formget.keyword}" placeholder="请输入会员id、昵称...">
<input type="submit" class="btn btn-primary" value="搜索">
</form>
<form method="post" class="js-ajax-form" action="{:U('Vip/user_listorders')}">
<table class="table table-hover table-bordered">
<thead>
......@@ -21,11 +26,11 @@
<foreach name="lists" item="vo">
<tr>
<td align="center">{$vo.id}</td>
<td>{$vo['uid']}</td>
<td>{$vo['userinfo']['user_nicename']}</td>
<td>{$vo.endtime|date="Y-m-d H:i:s",###}</td>
<td align="center">
<td align="center">
<a href="{:U('Vip/user_edit',array('id'=>$vo['id']))}" >编辑</a>
<a href="{:U('Vip/user_del',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn" data-msg="您确定要删除吗?">删除</a>
</td>
......@@ -38,4 +43,4 @@
</div>
<script src="__PUBLIC__/js/common.js"></script>
</body>
</html>
\ No newline at end of file
</html>
......@@ -13,7 +13,7 @@ class VipController extends AdminbaseController {
'6'=>'6个月',
'12'=>'12个月',
);
function index(){
function index(){
$Vip=M("vip");
$count=$Vip->count();
$page = $this->page($count, 20);
......@@ -24,35 +24,35 @@ class VipController extends AdminbaseController {
$this->assign('lists', $lists);
$this->assign('long', $this->long);
$this->assign("page", $page->show('Admin'));
$this->display();
}
function del(){
$id=intval($_GET['id']);
if($id){
$result=M("vip")->delete($id);
$result=M("vip")->delete($id);
if($result){
$action="删除VIP:{$id}";
setAdminLog($action);
$this->success('删除成功');
}else{
$this->error('删除失败');
}
}else{
}
}else{
$this->error('数据传入失败!');
}
$this->display();
}
}
$this->display();
}
//排序
public function listorders() {
public function listorders() {
$ids = $_POST['listorders'];
foreach ($ids as $key => $r) {
$data['orderno'] = $r;
M("vip")->where(array('id' => $key))->save($data);
}
$status = true;
if ($status) {
$action="更新VIP排序";
......@@ -61,27 +61,27 @@ class VipController extends AdminbaseController {
} else {
$this->error("排序更新失败!");
}
}
}
function add(){
$this->assign('long', $this->long);
$this->display();
}
$this->display();
}
function add_post(){
if(IS_POST){
if(IS_POST){
$Vip=M("vip");
$length=I("length");
$isexist=$Vip->where("length='{$length}' ")->find();
if($isexist){
$this->error('已存在相同类型 时长的设置');
}
$Vip->create();
$Vip->addtime=time();
$result=$Vip->add();
$result=$Vip->add();
if($result!==false){
$action="添加VIP:{$id}";
setAdminLog($action);
......@@ -89,34 +89,34 @@ class VipController extends AdminbaseController {
}else{
$this->error('添加失败');
}
}
}
}
}
function edit(){
$id=intval($_GET['id']);
if($id){
$vip=M("vip")->find($id);
$this->assign('vip', $vip);
$this->assign('vip', $vip);
$this->assign('long', $this->long);
}else{
}else{
$this->error('数据传入失败!');
}
$this->display();
}
$this->display();
}
function edit_post(){
if(IS_POST){
if(IS_POST){
$Vip=M("vip");
//$length=I("length");
$id=I("id");
/* $isexist=$Vip->where(" length='{$length}' and id!='{$id}'")->find();
if($isexist){
$this->error('已存在相同类型 时长的设置');
} */
$Vip->create();
$result=$Vip->save();
$result=$Vip->save();
if($result!==false){
$action="修改VIP:{$id}";
setAdminLog($action);
......@@ -124,15 +124,20 @@ class VipController extends AdminbaseController {
}else{
$this->error('修改失败');
}
}
}
}
function user_index(){
$map = [];
if($_REQUEST['keyword']!=''){
$map['uid|user_nicename']=array("like","%".$_REQUEST['keyword']."%");
$_GET['keyword']=$_REQUEST['keyword'];
}
$Vip_u=M("users_vip");
$count=$Vip_u->count();
$count=$Vip_u->where($map)->count();
$page = $this->page($count, 20);
$lists = $Vip_u
->where($map)
->order("endtime desc")
->limit($page->firstRow . ',' . $page->listRows)
->select();
......@@ -143,32 +148,32 @@ class VipController extends AdminbaseController {
$this->assign("page", $page->show('Admin'));
$this->display();
}
}
function user_del(){
$id=intval($_GET['id']);
if($id){
$data =M("users_vip")->where("id={$id}")->find();
$result=M("users_vip")->delete($id);
$result=M("users_vip")->delete($id);
if($result){
$action="删除用户VIP:{$data['uid']}";
setAdminLog($action);
$this->success('删除成功');
}else{
$this->error('删除失败');
}
}else{
}
}else{
$this->error('数据传入失败!');
}
$this->display();
}
function user_add(){
}
$this->display();
}
function user_add(){
$this->display();
}
}
function do_user_add(){
if(IS_POST){
if(IS_POST){
$uid=$_POST['uid'];
if($uid==''){
$this->error('用户ID不能为空');
......@@ -177,17 +182,17 @@ class VipController extends AdminbaseController {
if(!$isexist){
$this->error('该用户不存在');
}
$Vip_u=M("users_vip");
$isexist2=$Vip_u->field("id")->where("uid={$uid}")->find();
if($isexist2){
$this->error('该用户已购买过会员');
}
$Vip_u->create();
$Vip_u->addtime=time();
$Vip_u->endtime=strtotime($_POST['endtime']);
$result=$Vip_u->add();
$result=$Vip_u->add();
if($result!==false){
$action="添加用户VIP:{$uid}";
setAdminLog($action);
......@@ -195,28 +200,28 @@ class VipController extends AdminbaseController {
}else{
$this->error('添加失败');
}
}
}
}
}
function user_edit(){
$id=intval($_GET['id']);
if($id){
$data =M("users_vip")->where("id={$id}")->find();
$data['userinfo']=getUserInfo($data['uid']);
$this->assign('data', $data);
}else{
$this->assign('data', $data);
}else{
$this->error('数据传入失败!');
}
}
$this->display();
}
}
function do_user_edit(){
if(IS_POST){
if(IS_POST){
$Vip_u=M("users_vip");
$data =$Vip_u->where("id={$_POST['id']}")->find();
$Vip_u->create();
$Vip_u->endtime=strtotime($_POST['endtime']);
$result=$Vip_u->save();
$result=$Vip_u->save();
if($result!==false){
$action="修改用户VIP:{$data['uid']}";
setAdminLog($action);
......@@ -224,6 +229,6 @@ class VipController extends AdminbaseController {
}else{
$this->error('修改失败');
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment