示例#1
0
 public function actionUpdate($id)
 {
     $params = $this->getParams();
     $user = User::findByPk($id);
     $token = $this->getAccessToken();
     $name = $this->getParams('name');
     if (empty($name)) {
         throw new InvalidParameterException(['name' => Yii::t('common', 'required_filed')]);
     }
     $user->load($params, '');
     $lauguage = $user->language;
     if ($user->save() && Token::channgeLanguage($token, $lauguage)) {
         $user->_id .= '';
         return $user;
     } else {
         throw new ServerErrorHttpException('Fail to update user');
     }
 }
 public function actionUpdate($id)
 {
     $params = $this->getParams();
     $helpDesk = HelpDesk::findByPk($id);
     $token = $this->getQuery('accesstoken');
     $helpDesk->load($params, '');
     $lauguage = $helpDesk->language;
     if ($helpDesk->save() && Token::channgeLanguage($token, $lauguage)) {
         $helpDesk->_id .= '';
         return $helpDesk;
     } else {
         throw new ServerErrorHttpException('Fail to update help desk');
     }
 }