Error Info: Array ( [0] => 42S02 [1] => 1146 [2] => Table 'puamap_pc.puamap_answers' doesn't exist )
in /www/wwwroot/www.langji520.com/langji520.com/vendor/yiisoft/yii2/db/Command.php at line 900
$exceptionClass = '\yii\db\Exception'; foreach ($this->exceptionMap as $error => $class) { if (strpos($e->getMessage(), $error) !== false) { $exceptionClass = $class; } } $message = $e->getMessage() . "\nThe SQL being executed was: $rawSql"; $errorInfo = $e instanceof \PDOException ? $e->errorInfo : null; return new $exceptionClass($message, $errorInfo, (int) $e->getCode(), $e); } /** * Returns a value indicating whether a SQL statement is for read purpose. * @param string $sql the SQL statement * @return boolean whether a SQL statement is for read purpose. */ public function isReadQuery($sql) {
$this->pdoStatement->closeCursor(); } Yii::endProfile($token, 'yii\db\Command::query'); } catch (\Exception $e) { Yii::endProfile($token, 'yii\db\Command::query'); throw $this->db->getSchema()->convertException($e, $rawSql); } if (isset($cache, $cacheKey, $info)) { $cache->set($cacheKey, [$result], $info[1], $info[2]); Yii::trace('Saved query result in cache', 'yii\db\Command::query'); }
* @return string|null|false the value of the first column in the first row of the query result. * False is returned if there is no value. * @throws Exception execution failed */ public function queryScalar() { $result = $this->queryInternal('fetchColumn', 0); if (is_resource($result) && get_resource_type($result) === 'stream') { return stream_get_contents($result); } else { return $result; } }
$this->select = $select; $this->limit = $limit; $this->offset = $offset; if (empty($this->groupBy) && empty($this->having) && empty($this->union) && !$this->distinct) { return $command->queryScalar(); } else { return (new Query)->select([$selectExpression]) ->from(['c' => $this]) ->createCommand($command->db) ->queryScalar(); }
* If this parameter is not given (or null), the `db` application component will be used. * @return integer|string number of records. The result may be a string depending on the * underlying database engine and to support integer values higher than a 32bit PHP integer can handle. */ public function count($q = '*', $db = null) { return $this->queryScalar("COUNT($q)", $db); } /** * Returns the sum of the specified column values. * @param string $q the column name or expression. * Make sure you properly [quote](guide:db-dao#quoting-table-and-column-names) column names in the expression.
public function getPersonAnswer($person_id,$page){ $pageSize = \Yii::$app->params['PAGESIZE']; $offset = ($page - 1) * $pageSize; $query = (new Query())->select("a.id,a.question_id,a.content,a.is_best,a.create_time,q.title")->from("puamap_pc.puamap_answers as a") ->leftJoin("puamap_pc.puamap_question as q",'a.question_id=q.id') ->where(['q.is_del'=>static::$_del_0,'a.person_id'=>$person_id]); $totalCell = $query->count("*",\Yii::$app->db2); $items = $query->orderBy(['a.id'=>SORT_DESC])->offset($offset)->limit($pageSize)->all(\Yii::$app->db2); return [ 'totalCell'=>$totalCell, 'pageSize'=>$pageSize, 'items'=>$items, 'currentPage'=>$page
* @param $person_id * @param $page * @return array * 获取用户的回答 */ public function getPersonAnswer($person_id,$page){ return self::$model->getPersonAnswer($person_id,$page); } public function personAnswer($person_id,$page){ return $this->getPersonAnswerFromCache($person_id,$page); } public function getInfo($id){
public function __call($name, $args) { if(substr($name,-9) == 'FromCache'){ if(ConfigUtils::getRedisMemcacheOpen()){ return $this->classesCache($name, $args); } $name = substr($name,0,-9); return call_user_func_array( array( $this, $name ), $args ); } return parent::__call($name, $args); } /** * 高度缓存时间及依赖
* 获取用户的回答 */ public function getPersonAnswer($person_id,$page){ return self::$model->getPersonAnswer($person_id,$page); } public function personAnswer($person_id,$page){ return $this->getPersonAnswerFromCache($person_id,$page); } public function getInfo($id){ return self::$model->getInfo($id); } public function info($id){
class AnswerController extends PersonBaseController { public function actionIndex($id,$page=1) { $lc_answer = new LcAnswer(); $data = $lc_answer->personAnswer($id,$page); $this->params['data'] = $data; $this->params['flag'] = 'a'; return $this->render($this->action->id,$this->params); } public function actionIndex_m($id,$page=1){
$args = $this->controller->bindActionParams($this, $params); Yii::trace('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; } else {
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
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__ . '/../../pc/config/web.php'), require(__DIR__ . '/../../pc/config/web-local.php') ); (new yii\web\Application($config))->run();
$_GET = [ 'id' => '100', ];