request; if ($retuest->isAjax) { if ($retuest->isPost) { $post = Yii::$app->request->post(); // 检查提交的参数 $res = Yii::$app->services->validate->validate($post,[ [['id','level'], 'integer'], [['title','consumer_name','order_status','date_end','date_start'], 'safe'], [['limit'],'default','value' => '15'], ]); if($res === false) return $this->error(Yii::$app->services->validate->getErrorMessage()); $post = PlatformOrder::exceptNullVal($post); if($post['date_start'] && $post['date_end']) $where[] = ['between', 'created_at', strtotime($post['date_start']),strtotime($post['date_end'])]; if($post['title']) $where[] = ['like', 'title', $post['title']]; if($post['consumer_name']) $where[] = ['like', 'consumer_name', $post['consumer_name']]; if(isset($post['order_status']) && $post['order_status'] !== '') $where[] = ['=', 'order_status', $post['order_status']]; $where[] = ['=','status',StatusEnum::ENABLED]; $order = 'id desc'; $params = array('where' => $where, 'order'=>$order, 'limit' => $post['limit']); $list = PlatformOrder::listPage($params); $select = 'sum(order_num) as order_num,sum(pay_num) as pay_num,sum(cancel_order_num) as cancel_order_num'; $statics = PlatformOrderStatisticsDay::getOne('',true,'','id desc',$select); $list['statistics'] = $statics; $list['consumer_type'] = PlatformEnum::getConsumerTypeMap(); $list['from_type'] = PlatformEnum::getFromTypeMap(); $this->success('获取成功', $list); } } else { return $this->render($this->action->id); } } }