查询条件处理

This commit is contained in:
wanyongkang
2020-10-24 15:40:56 +08:00
parent 6390d6f8a7
commit 565a159745
4 changed files with 110 additions and 20 deletions

View File

@@ -5,7 +5,7 @@
* @Author: kangkang
* @Date: 2020-10-13 19:52:37
* @LastEditors: kangkang
* @LastEditTime: 2020-10-23 18:26:27
* @LastEditTime: 2020-10-24 14:23:06
*/
/*
* @Descripttion:
@@ -34,31 +34,40 @@ class IncomeCheck extends Controller
if (isset($_GET['PageIndex'])) {
$page = ($_GET['PageIndex'] - 1) * 50;
}
if (isset($_GET['ProductId'])){
if (isset($_GET['ProductId'])) {
$where['ProductId'] = $_GET['ProductId'];
}
if (isset($_GET['PackageId'])){
if (isset($_GET['PackageId'])) {
$where['PackageId'] = $_GET['PackageId'];
}
if (!empty($_GET['keyWord'])){
if (!empty($_GET['keyWord'])) {
$where['OrderNo'] = $_GET['keyWord'];
}
$check_model = new CheckModel;
$list = $check_model->getListPage([], '*', 'id desc', "$page,50");
foreach ($list as $k => &$v) {
$v['day_time'] = date('Y-m-d', strtotime($v['day_time']) - 86400);
}
$data = [
'Code' => 10000,
'data' => $list,
'msg' => '',
'count' => (int)$check_model->getCount()['count'],
'count' => (int) $check_model->getCount()['count'],
];
echo json_encode($data);
}
public function search(){
public function search()
{
$data = json_decode(file_get_contents("php://input"), true)['time'];
$data[0] = date('Y-m-d', strtotime($data[0]) + 86400) . ' 00:00:00';
$data[1] = date('Y-m-d', strtotime($data[1]) + 86400) . ' 23:59:59';
$check_model = new CheckModel;
$list = $check_model->getListPage(['day_time'=>['>',$data[0]],'day_time'=>['<',$data[1]]], '*', 'id desc', "10000");
$list = $check_model->getListPages(['day_time' => [['>' , $data[0]], ['<' , $data[1]]]], '*', 'id desc', "10000");
foreach ($list as $k => &$v) {
$v['day_time'] = date('Y-m-d', strtotime($v['day_time']) - 86400);
}
$data = [
'Code' => 30000,
'data' => $list,