Error Info: Array ( [requestMethod] => GET [requestUrl] => http://58.215.201.90:10200/zi_fanwen/_doc/_search [requestBody] => {"_source":["id","title","cate_id","title_url","smalltext"],"size":30,"query":{"bool":{"must":[{"term":{"status":1}},{"term":{"cate_id":null}}]}},"sort":[{"onclick":"desc"}]} [responseCode] => 400 [responseHeaders] => Array ( [content-type] => application/json; charset=UTF-8 [content-length] => 310 ) [responseBody] => Array ( [error] => Array ( [root_cause] => Array ( [0] => Array ( [type] => x_content_parse_exception [reason] => [1:141] [bool] failed to parse field [must] ) ) [type] => x_content_parse_exception [reason] => [1:141] [bool] failed to parse field [must] [caused_by] => Array ( [type] => illegal_argument_exception [reason] => field name is null or empty ) ) [status] => 400 ) )
'requestBody' => $requestBody, 'responseCode' => $responseCode, 'responseHeaders' => $headers, 'responseBody' => $this->decodeErrorBody($body), ]); } } elseif ($responseCode == 404) { return false; } else { throw new Exception("Elasticsearch request failed with code $responseCode. Response body:\n{$body}", [ 'requestMethod' => $method, 'requestUrl' => $url, 'requestBody' => $requestBody, 'responseCode' => $responseCode, 'responseHeaders' => $headers, 'responseBody' => $this->decodeErrorBody($body), ]); } }
* @throws Exception * @throws InvalidConfigException */ public function get($url, $options = [], $body = null, $raw = false) { $this->open(); return $this->httpRequest('GET', $this->createUrl($url, $options), $body, $raw); } /** * Performs HEAD HTTP request * * @param string|array $url URL
if ($this->db->dslVersion < 7 && $this->type !== null) { $url[] = $this->type; } $url[] = '_search'; return $this->db->get($url, array_merge($this->options, $options), $query); } /** * Sends a request to the delete by query * @param array $options URL options * @return mixed
*/ public function all($db = null) { if ($this->emulateExecution) { return []; } $result = $this->createCommand($db)->search(); if ($result === false) { throw new Exception('Elasticsearch search query failed.'); } if (empty($result['hits']['hits'])) { return []; }
* @param Connection $db the DB connection used to create the DB command. * If null, the DB connection returned by [[modelClass]] will be used. * @return array the query results. If the query results in nothing, an empty array will be returned. */ public function all($db = null) { return parent::all($db); } /** * Converts found rows into model instances * @param array $rows * @return array|ActiveRecord[]
if ($data == false){ $fields = ['id','title','cate_id','title_url','smalltext']; $data = self::find(); $esWhere = []; $esWhere['bool']['must'][] = ['term' => ['status' => 1]]; $esWhere['bool']['must'][] = ['term' => ["cate_id" => $cate_id]]; $data = $data->source($fields)->query($esWhere)->orderBy($order)->limit($limit)->offset($offset)->asArray()->all(); $data = BaseArrayHelper::getColumn($data, '_source'); if (count($data)>0){ foreach ($data as $k=>$v){ $data[$k]['cate_name'] = EsCate::getDataById($v['cate_id'])['cate_name']; $data[$k]['cate_url'] = EsCate::getDataById($v['cate_id'])['cate_url']; }
$es = Yii::$app->params['is_es']; if ($es){ //栏目id $cate_data = EsCate::getCateIdByPinyin($small_pinyin); $list_top30 = EsFanwenNew::getListByCateId($cate_data['id'],30); $list50 = EsFanwenNew::getListByCateId($cate_data['id'],50,'create_time desc'); $new_list10 = EsFanwenNew::getListByCateId($cate_data['id'],10,'onclick desc',30); //文章榜 $new2_list10 = EsFanwenNew::getListByCateId($cate_data['id'],10,'onclick desc',40);
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require(__DIR__ . '/../../common/config/main.php'), require(__DIR__ . '/../../common/config/main-local.php'), require(__DIR__ . '/../config/main.php'), require(__DIR__ . '/../config/main-local.php') ); (new yii\web\Application($config))->run();
$_GET = [ 'type' => 'about', 'cate' => 'index', 'info_type' => '4', 'id' => '169', 'title' => '太史公自序', ];