public function actionUpdate($id)
 {
     $params = $this->getParams();
     $accountId = $this->getAccountId();
     //check the product name
     $id = new MongoId($id);
     $where = ["_id" => $id];
     $product = Product::findOne($where);
     if (empty($product)) {
         throw new InvalidParameterException(Yii::t('product', 'product_deleted'));
     }
     $oldName = $product['name'];
     $oldSku = $product['sku'];
     $oldCategoryId = isset($product['category']['id']) ? $product['category']['id'] . '' : '';
     unset($params['sku']);
     //cant not update the sku
     //check the property whether to  be required
     Product::checkParam($params, $accountId);
     $intro = isset($params['intro']) ? $params['intro'] : " ";
     unset($params['intro']);
     $product->load($params, '');
     if ($product->save()) {
         //update goods and storeGoods
         $productCategory = $product->category;
         if ($oldName !== $product->name || (string) $productCategory['id'] != $oldCategoryId) {
             $this->attachBehavior('ProductBehavior', new ProductBehavior());
             $this->update($product->_id, $product->name, $productCategory['id']);
         }
         //update the intro
         $productInfo = ProductInfo::findByPk($product->_id);
         $productInfo->intro = $intro;
         $productInfo->save();
         return $product;
     } else {
         throw new ServerErrorHttpException('Fail to update product');
     }
 }