public function actionUpdate($id) { $params = $this->getParams(); $accountId = $this->getAccountId(); $id = new \MongoId($id); if (empty($params['badge'])) { throw new InvalidParameterException(['number' => Yii::t('common', 'required_filed')]); } $helpDesk = HelpDesk::getByBadge($params['badge'], $accountId); if (!empty($helpDesk)) { throw new InvalidParameterException(['number' => Yii::t('helpDesk', 'badge_has_used')]); } else { HelpDesk::updateAll(['badge' => $params['badge']], ['_id' => $id]); $helpDesk = HelpDesk::findOne(['_id' => $id]); return $helpDesk; } }