public function actionCreate()
 {
     $params = $this->getParams();
     $accountId = $this->getAccountId();
     if (empty($params['email'])) {
         throw new InvalidParameterException(['email' => Yii::t('common', 'required_filed')]);
     }
     if (empty($params['badge'])) {
         throw new InvalidParameterException(['number' => Yii::t('common', 'required_filed')]);
     }
     $email = $params['email'];
     $badge = $params['badge'];
     if (!StringUtil::isEmail($email)) {
         throw new InvalidParameterException(['email' => Yii::t('helpDesk', 'email_format_wrong')]);
     }
     $helpDesk = HelpDesk::getByEmail($email);
     if (!empty($helpDesk)) {
         throw new InvalidParameterException(['email' => Yii::t('helpDesk', 'email_has_used')]);
     } else {
         $helpDesk = HelpDesk::getByBadge($params['badge'], $accountId);
         if (!empty($helpDesk)) {
             throw new InvalidParameterException(['number' => Yii::t('helpDesk', 'badge_has_used')]);
         }
     }
     $helpDesk = new HelpDesk();
     $helpDesk->email = $email;
     $helpDesk->badge = $badge;
     $helpDesk->accountId = $accountId;
     $currentUser = $this->getUser();
     if ($helpDesk->save()) {
         $link = Yii::$app->request->hostInfo . '/site/invite/code?type=1';
         //type=1 means invite helpdesk account
         $result = EmailUtil::sendInviteEmail($helpDesk, $currentUser->name, $link, self::SUBJECT, 'helpdeskinvition');
         if ($result) {
             return ['email' => $helpDesk->email];
         } else {
             throw new ServerErrorHttpException("validation save fail");
         }
     }
     throw new ServerErrorHttpException("helpDesk save fail");
 }