public function actionUpdateRemains()
 {
     $post = Yii::$app->request->post('remain', null);
     if (isset($post)) {
         Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         $remainId = current(array_keys($post));
         /** @var WarehouseProduct $model */
         $model = WarehouseProduct::findOne($remainId);
         if ($model === null) {
             throw new NotFoundHttpException();
         }
         $model->setAttributes(current($post));
         TagDependency::invalidate(Yii::$app->cache, ActiveRecordHelper::getObjectTag(\app\modules\shop\models\Product::className(), $model->product_id));
         return $model->save();
     } else {
         throw new HttpException(400);
     }
 }