Commit 3df9764d by 冷斌

update

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