commit
7585a9c04a
@ -49,13 +49,15 @@ class UserCardController extends Controller
|
|||||||
|
|
||||||
$total = 0;
|
$total = 0;
|
||||||
if(Yii::$app->request->queryParams)
|
if(Yii::$app->request->queryParams)
|
||||||
foreach (Yii::$app->request->queryParams as $params)
|
foreach (Yii::$app->request->queryParams as $params) {
|
||||||
|
|
||||||
$total = \common\models\UserCard::find()->filterWhere([
|
$total = \common\models\UserCard::find()->filterWhere([
|
||||||
'fio' => $params['fio'],
|
'fio' => UserCard::getParameter($params, 'fio'),
|
||||||
'email' => $params['email'],
|
'email' => UserCard::getParameter($params, 'email'),
|
||||||
'status' => $params['status'],
|
'status' => UserCard::getParameter($params, 'status'),
|
||||||
'skills' => $params['skills'],
|
'skills' => UserCard::getParameter($params, 'skills'),
|
||||||
])->sum('salary');
|
])->sum('salary');
|
||||||
|
}
|
||||||
else $total = \common\models\UserCard::find()->sum('salary');
|
else $total = \common\models\UserCard::find()->sum('salary');
|
||||||
|
|
||||||
return $this->render('index', [
|
return $this->render('index', [
|
||||||
|
@ -158,4 +158,13 @@ class UserCard extends \common\models\UserCard
|
|||||||
if ($user_card_array) return "Данные успешно сгенерированы";
|
if ($user_card_array) return "Данные успешно сгенерированы";
|
||||||
else return "Нет данных для генерации";
|
else return "Нет данных для генерации";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getParameter($params, $key)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return $params[$key];
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user