/** * Render product module mobile pages */ public function actionProduct($page) { if ($page === 'detail') { $goodsId = Yii::$app->request->get('goodsId'); Goods::updateAll(['$inc' => ['clicks' => 1]], ['_id' => new \MongoId($goodsId)]); } if ($page === 'list' || $page === 'detail') { $this->registerBodyJsFile(self::VENDOR_PATH . 'Swiper/dist/js/swiper.min.js'); } $js = '$($(".mb-breadcrumb-back").click(function(){window.history.back()}))'; $this->view->registerJs($js, View::POS_END); $params = Yii::$app->request->get(); $isPreview = !empty($params['preview']); return $this->renderPage($page, false, !$isPreview, !$isPreview); }
/** * @args {"description": "Delay: Goods on sale every minute"} * @see \backend\components\resque\SchedulerJob::perform() */ public function perform() { Goods::updateAll(['$set' => ['status' => Goods::STATUS_ON]], ['status' => Goods::STATUS_OFF, 'onSaleTime' => ['$lte' => new MongoDate(strtotime('+1 minute'))]]); }
public function update($productId, $name, $categoryId) { Goods::updateAll(['$set' => ['productName' => $name, 'categoryId' => $categoryId]], ['productId' => $productId]); StoreGoods::updateAll(['$set' => ['productName' => $name, 'categoryId' => $categoryId]], ['productId' => $productId]); PromotionCodeAnalysis::updateAll(['$set' => ['productName' => $name]], ['productId' => $productId]); }
private function _rollBackUsedCount($successExchanges) { foreach ($successExchanges as $goodsId => $goodsRollbackModifier) { Goods::updateAll($goodsRollbackModifier, ['_id' => new \MongoId($goodsId)]); } }
/** * Update the status of goods for goods module. */ public function actionGoodsSale() { $result = Goods::updateAll(['$set' => ['status' => Goods::STATUS_ON]], ['status' => Goods::STATUS_OFF, 'onSaleTime' => ['$lte' => new \MongoDate(strtotime('+1 minute'))]]); echo $result; }