作者 景龙
1 个管道 的构建 通过 耗费 8 秒

修改后台日期搜索

... ... @@ -1060,6 +1060,7 @@ class CommonController extends RestBaseController
}
})
->field('i.id,i.create_time,i.project_id,p.name project_name')
->order('i.id desc')
->group("DATE_FORMAT(FROM_UNIXTIME(i.create_time),'%Y-%m-%d')")
->select()
->toArray();
... ... @@ -1124,6 +1125,7 @@ class CommonController extends RestBaseController
}
})
->field('t.id,t.test_time,t.project_id,p.name project_name')
->order('t.id desc')
->select()
->toArray();
return $res;
... ...
... ... @@ -526,7 +526,7 @@ class AdminCommonController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('i.create_time', '>=', $startTime);
}
... ... @@ -583,7 +583,7 @@ class AdminCommonController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
if($table == 'check'){
$query->where('t.ins_m_time', '>=', $startTime);
... ... @@ -621,7 +621,7 @@ class AdminCommonController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('r.create_time', '>=', $startTime);
}
... ... @@ -729,7 +729,7 @@ class AdminCommonController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('t.test_time', '>=', $startTime);
}
... ... @@ -1059,4 +1059,15 @@ class AdminCommonController extends AdminBaseController
return $arr1;
}
//获取日期时间戳
public function getDate($time){
$dateStr = date('Y-m-d',$time);
//获取0点的时间戳
$time1 = strtotime($dateStr);
//获取24点的时间戳
$time2 = strtotime($dateStr) + 86400;
$arr = [$time1,$time2];
return $arr;
}
}
... ...
... ... @@ -35,7 +35,7 @@ class AdminExerciseController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('e.exercise_time', '>=', $startTime);
}
... ...
... ... @@ -44,7 +44,7 @@ class AdminInspectAController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('i.create_time', '>=', $startTime);
}
... ... @@ -80,8 +80,9 @@ class AdminInspectAController extends AdminBaseController
public function edit(){
$project_id = $this->request->param('project_id');
$create_time = $this->request->param('create_time');
$time = date('Y-m-d',$create_time);
$time1 = date('Y-m-d',$create_time+86400);
$common = new AdminCommonController();
$time = $common->getDate($create_time);
//查询巡检项目名称
$project = $this->getProject($project_id);
$arr['project_name'] = $project['project_name'];
... ... @@ -96,7 +97,7 @@ class AdminInspectAController extends AdminBaseController
->alias('i')
->join('user u','i.uid = u.id')
->where(['i.party'=>0,'i.project_id'=>$project_id])
->whereTime('i.create_time', [$time,$time1])
->whereTime('i.create_time', $time)
->field('u.user_login,i.id,i.status,i.point_id,i.images')
->select()
->toArray();
... ...
... ... @@ -41,7 +41,7 @@ class AdminInspectBController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('i.create_time', '>=', $startTime);
}
... ... @@ -76,8 +76,9 @@ class AdminInspectBController extends AdminBaseController
public function edit(){
$project_id = $this->request->param('project_id');
$create_time = $this->request->param('create_time');
$time = date('Y-m-d',$create_time);
$time1 = date('Y-m-d',$create_time+86400);
$common = new AdminCommonController();
$time = $common->getDate($create_time);
//查询巡检项目名称
$inspect_a = new AdminInspectAController();
... ... @@ -94,7 +95,7 @@ class AdminInspectBController extends AdminBaseController
->alias('i')
->join('user u','i.uid = u.id')
->where(['i.party'=>1,'i.project_id'=>$project_id])
->whereTime('i.create_time', [$time,$time1])
->whereTime('i.create_time', $time)
->field('u.user_login,i.id,i.status,i.point_id,i.images')
->select()
->toArray();
... ...
... ... @@ -36,7 +36,7 @@ class AdminProjectController extends AdminBaseController
$query->where('a_cid',$a_cid);
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('create_time', '>=', $startTime);
}
... ...
... ... @@ -36,7 +36,7 @@ class AdminReformAController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('r.create_time', '>=', $startTime);
}
... ...
... ... @@ -36,7 +36,7 @@ class AdminReformBController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('r.create_time', '>=', $startTime);
}
... ...
... ... @@ -36,7 +36,7 @@ class AdminRepairAController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('r.create_time', '>=', $startTime);
}
... ...
... ... @@ -36,7 +36,7 @@ class AdminRepairBController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('r.create_time', '>=', $startTime);
}
... ...
... ... @@ -35,7 +35,7 @@ class AdminTestController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('t.test_time', '>=', $startTime);
}
... ...
... ... @@ -35,7 +35,7 @@ class AdminTrainController extends AdminBaseController
$query->where('p.name', 'like', "%$keyword%");
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time'])+86400;
if (!empty($startTime)) {
$query->where('t.train_time', '>=', $startTime);
}
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
月检时间:
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminCheck/index')}">清空</a>
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
培训时间:
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminExercise/index')}">清空</a>
</form>
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
巡检时间:
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminInspectA/index')}">清空</a>
</form>
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
日检时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time" value="{$start_time|default=''}" id="start_time" style="width: 160px;" placeholder="请输入日检开始时间" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time" value="{$end_time|default=''}" id="end_time" style="width: 160px;" placeholder="请输入日检结束时间" autocomplete="off"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" name="start_time" value="{$start_time|default=''}" id="start_time" style="width: 160px;" placeholder="请输入日检开始时间" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-date" name="end_time" value="{$end_time|default=''}" id="end_time" style="width: 160px;" placeholder="请输入日检结束时间" autocomplete="off"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminInspectB/index')}">清空</a>
</form>
... ...
... ... @@ -25,12 +25,8 @@
</foreach>
</select>
时间:
<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
value="{$start_time|default=''}"
style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
value="{$end_time|default=''}"
style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
<input type="text" class="form-control js-bootstrap-date" name="start_time" value="{$start_time|default=''}" placeholder="请输入开始日期" style="width: 140px;" autocomplete="off">-
<input type="text" class="form-control js-bootstrap-date" name="end_time" value="{$end_time|default=''}" placeholder="请输入结束日期" style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminProject/index')}">清空</a>
</form>
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
改造时间:
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminReformA/index')}">清空</a>
</form>
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
改造时间:
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminReformB/index')}">清空</a>
</form>
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
报修时间:
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminRepairA/index')}">清空</a>
</form>
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
报修时间:
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminRepairB/index')}">清空</a>
</form>
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
检测时间:
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminTest/index')}">清空</a>
... ...
... ... @@ -10,8 +10,8 @@
<input class="form-control" type="text" name="name" style="width: 200px;" value="{:input('request.name')}" id="project_name" placeholder="请输入项目名称">
培训时间:
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-datetime" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="start_time" value="{$start_time|default=''}" autocomplete="off" id="start_time" placeholder="请输入开始时间">-
<input type="text" class="form-control js-bootstrap-date" style="width:160px;" name="end_time" value="{$end_time|default=''}" autocomplete="off" id="end_time" placeholder="请输入结束时间"> &nbsp;
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="{:url('AdminTrain/index')}">清空</a>
</form>
... ...