fix login api
This commit is contained in:
@ -63,7 +63,7 @@ class UserController extends ActiveController
|
||||
$model = new LoginForm();
|
||||
if ($model->load(Yii::$app->getRequest()->getBodyParams(), '') && $model->login()) {
|
||||
return [
|
||||
'access_token' => $model->login(),
|
||||
'access_token' => $model->login(), 'access_token_expired_at' => $model->getUser()->getTokenExpiredAt()
|
||||
];
|
||||
} else {
|
||||
throw new BadRequestHttpException(json_encode($model->errors));
|
||||
|
@ -59,7 +59,7 @@ class LoginForm extends Model
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getUser()
|
||||
public function getUser()
|
||||
{
|
||||
if ($this->_user === null) {
|
||||
$this->_user = User::findByUsername($this->username);
|
||||
|
@ -38,7 +38,8 @@ class ReportSearchForm extends Model
|
||||
public function byParams()
|
||||
{
|
||||
$queryBuilder = Reports::find()
|
||||
->andWhere(['between', 'created_at', $this->fromDate, $this->toDate, $this->user_id])
|
||||
->with('task')
|
||||
->andWhere(['between', 'reports.created_at', $this->fromDate, $this->toDate, $this->user_id])
|
||||
->limit($this->limit)
|
||||
->offset($this->offset);
|
||||
|
||||
@ -47,7 +48,7 @@ class ReportSearchForm extends Model
|
||||
$queryBuilder->andWhere(['user_card_id' => $userCardId]);
|
||||
}
|
||||
|
||||
$data = $queryBuilder->all();
|
||||
$data = $queryBuilder->asArray()->all();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
Reference in New Issue
Block a user