Commit b7b5c008 by 冷斌

fix bug

parent a83684ea
...@@ -5,6 +5,16 @@ ...@@ -5,6 +5,16 @@
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="{:U('dynamic/index')}">列表</a></li> <li class="active"><a href="{:U('dynamic/index')}">列表</a></li>
</ul> </ul>
<form class="well form-search" name="form1" method="post" style="float:left" action="">
提交时间:
<input type="text" name="start_time" class="js-date date" id="start_time" value="{$formget.start_time}" style="width: 80px;" autocomplete="off">-
<input type="text" class="js-date date" name="end_time" id="end_time" value="{$formget.end_time}" style="width: 80px;" autocomplete="off"> &nbsp; &nbsp;
关键字:
<input type="text" name="keyword" style="width: 200px;" value="{$formget.keyword}" placeholder="发布人id.">
<input type="button" class="btn btn-primary" value="搜索" onclick="form1.action='{:U('Dynamic/index')}';form1.submit();"/>
</form>
<table class="table table-hover table-bordered"> <table class="table table-hover table-bordered">
<thead> <thead>
<tr> <tr>
......
...@@ -5,6 +5,14 @@ ...@@ -5,6 +5,14 @@
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="{:U('dynamic/report')}">列表</a></li> <li class="active"><a href="{:U('dynamic/report')}">列表</a></li>
</ul> </ul>
<form class="well form-search" name="form1" method="post" style="float:left" action="">
提交时间:
<input type="text" name="start_time" class="js-date date" id="start_time" value="{$formget.start_time}" style="width: 80px;" autocomplete="off">-
<input type="text" class="js-date date" name="end_time" id="end_time" value="{$formget.end_time}" style="width: 80px;" autocomplete="off"> &nbsp; &nbsp;
关键字:
<input type="text" name="keyword" style="width: 200px;" value="{$formget.keyword}" placeholder="举报人id">
<input type="button" class="btn btn-primary" value="搜索" onclick="form1.action='{:U('Dynamic/report')}';form1.submit();"/>
</form>
<table class="table table-hover table-bordered"> <table class="table table-hover table-bordered">
<thead> <thead>
<tr> <tr>
......
...@@ -14,9 +14,21 @@ class DynamicController extends AdminbaseController ...@@ -14,9 +14,21 @@ class DynamicController extends AdminbaseController
public function index() public function index()
{ {
$count = $this->dynamic_model->count(); if($_REQUEST['start_time']!=''){
$map['addtime']=array("gt",strtotime($_REQUEST['start_time']));
}
if($_REQUEST['end_time']!=''){
$map['addtime']=array("lt",strtotime($_REQUEST['end_time']));
}
if($_REQUEST['start_time']!='' && $_REQUEST['end_time']!='' ){
$map['addtime']=array("between",array(strtotime($_REQUEST['start_time']),strtotime($_REQUEST['end_time'])));
}
if($_REQUEST['keyword']!=''){
$map['uid']=array("like","%".$_REQUEST['keyword']."%");
}
$count = $this->dynamic_model->where($map)->count();
$page = $this->page($count, 20); $page = $this->page($count, 20);
$results = $this->dynamic_model->order("addtime DESC")->limit($page->firstRow . ',' . $page->listRows)->select(); $results = $this->dynamic_model->where($map)->order("addtime DESC")->limit($page->firstRow . ',' . $page->listRows)->select();
foreach ($results as $key => $v) { foreach ($results as $key => $v) {
$userinfo = getUserInfo($v['uid']); $userinfo = getUserInfo($v['uid']);
$results[$key]['user_nicename'] = $userinfo['user_nicename']; $results[$key]['user_nicename'] = $userinfo['user_nicename'];
...@@ -26,6 +38,7 @@ class DynamicController extends AdminbaseController ...@@ -26,6 +38,7 @@ class DynamicController extends AdminbaseController
} }
$this->assign("page", $page->show()); $this->assign("page", $page->show());
$this->assign("users", $results); $this->assign("users", $results);
$this->assign('formget', $_GET);
$this->display(); $this->display();
} }
public function delete() public function delete()
...@@ -42,10 +55,22 @@ class DynamicController extends AdminbaseController ...@@ -42,10 +55,22 @@ class DynamicController extends AdminbaseController
public function report() public function report()
{ {
if($_REQUEST['start_time']!=''){
$map['addtime']=array("gt",strtotime($_REQUEST['start_time']));
}
if($_REQUEST['end_time']!=''){
$map['addtime']=array("lt",strtotime($_REQUEST['end_time']));
}
if($_REQUEST['start_time']!='' && $_REQUEST['end_time']!='' ){
$map['addtime']=array("between",array(strtotime($_REQUEST['start_time']),strtotime($_REQUEST['end_time'])));
}
if($_REQUEST['keyword']!=''){
$map['uid']=array("like","%".$_REQUEST['keyword']."%");
}
$report = M("users_report_dynamic"); $report = M("users_report_dynamic");
$count = $report->count(); $count = $report->where($map)->count();
$page = $this->page($count, 20); $page = $this->page($count, 20);
$results = $report->order("addtime DESC")->limit($page->firstRow . ',' . $page->listRows)->select(); $results = $report->where($map)->order("addtime DESC")->limit($page->firstRow . ',' . $page->listRows)->select();
$status = ['待处理', '通过', '驳回']; $status = ['待处理', '通过', '驳回'];
foreach ($results as $key => $v) { foreach ($results as $key => $v) {
$results[$key]['addtime'] = date('Y-m-d H:i:s', $v['addtime']); $results[$key]['addtime'] = date('Y-m-d H:i:s', $v['addtime']);
...@@ -59,6 +84,7 @@ class DynamicController extends AdminbaseController ...@@ -59,6 +84,7 @@ class DynamicController extends AdminbaseController
} }
$this->assign("page", $page->show()); $this->assign("page", $page->show());
$this->assign("users", $results); $this->assign("users", $results);
$this->assign('formget', $_GET);
$this->display(); $this->display();
} }
......
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