diff --git a/common/models/Job.php b/common/models/Job.php index 94865d3..01e1ace 100755 --- a/common/models/Job.php +++ b/common/models/Job.php @@ -69,8 +69,6 @@ [ [ 'user_id', - 'total_count', - 'complete_count', 'current', ], 'integer', @@ -91,6 +89,22 @@ 'match', 'pattern' => '/^(?:https?:\/\/)?(?:w{3}\.)?'.preg_quote($_SERVER['HTTP_HOST']).'\/company\/\w+\/\d+$/i', ], + [ + [ + 'total_count', + 'complete_count', + ], + 'integer', + 'min' => 0, + ], + [ + [ + 'complete_count', + ], + 'compare', + 'compareAttribute' => 'total_count', + 'operator' => '<=', + ] ]; } diff --git a/common/models/Portfolio.php b/common/models/Portfolio.php index 083ab3a..d94843e 100644 --- a/common/models/Portfolio.php +++ b/common/models/Portfolio.php @@ -70,7 +70,6 @@ [ 'name', 'preview', - 'link', 'city', 'cover' ], diff --git a/common/models/UserInfo.php b/common/models/UserInfo.php index 9b3f1f2..b2314a5 100755 --- a/common/models/UserInfo.php +++ b/common/models/UserInfo.php @@ -230,6 +230,9 @@ ], 'filter', 'filter' => function($value) { + if(empty($value)) { + return $value; + } if(!preg_match('/^https?:\/{2}.*$/', $value)) { $value = 'https://' . $value; } diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php index e9e96b8..c57589b 100755 --- a/frontend/controllers/AccountsController.php +++ b/frontend/controllers/AccountsController.php @@ -234,8 +234,8 @@ $user_info->load($post); $user_info->save(); $job = [ ]; - for($i = 0; $i < count($post[ 'Job' ]); $i++) { - $job[ $i ] = new Job([ + foreach($post['Job'] as $index => $value) { + $job[$index] = new Job([ 'user_id' => \Yii::$app->user->getId(), 'current' => 0, ]); @@ -795,6 +795,9 @@ */ public function actionService() { + /** + * @var User $user + */ $user = \Yii::$app->user->identity; $user_info = $user->userInfo; if(empty( $user_info )) { diff --git a/frontend/controllers/PerformerController.php b/frontend/controllers/PerformerController.php index a570057..c059059 100755 --- a/frontend/controllers/PerformerController.php +++ b/frontend/controllers/PerformerController.php @@ -74,7 +74,15 @@ $phones = Fields::getData($user->id, $user->className(), 'phone'); $sites = Fields::getData($user->id, $user->className(), 'site'); $soft = implode(', ', ArrayHelper::getColumn(Fields::getData($user->id, $user->className(), 'soft'), 'soft')); - + $geography = $user->getPortfolios() + ->select([ + 'count' => 'COUNT(*)', + 'city' => 'city', + ]) + ->groupBy('city') + ->asArray() + ->indexBy('city') + ->column(); return $this->render('common', [ 'user' => $user, 'educations' => $educations, @@ -83,6 +91,7 @@ 'phones' => $phones, 'sites' => $sites, 'soft' => $soft, + 'geography' => $geography, ]); } @@ -324,8 +333,8 @@ public function beforeAction($action) { - if(!empty(\Yii::$app->request->get('type'))) { - $action->controller->view->params['type'] = \Yii::$app->request->get('type'); + if(!empty( \Yii::$app->request->get('type') )) { + $action->controller->view->params[ 'type' ] = \Yii::$app->request->get('type'); } return parent::beforeAction($action); } diff --git a/frontend/views/accounts/_job_form.php b/frontend/views/accounts/_job_form.php index b17364d..484948d 100755 --- a/frontend/views/accounts/_job_form.php +++ b/frontend/views/accounts/_job_form.php @@ -82,10 +82,10 @@ ]); ?>