Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 /**
  * @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'))]]);
 }
Ejemplo n.º 3
0
 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]);
 }
Ejemplo n.º 4
0
 private function _rollBackUsedCount($successExchanges)
 {
     foreach ($successExchanges as $goodsId => $goodsRollbackModifier) {
         Goods::updateAll($goodsRollbackModifier, ['_id' => new \MongoId($goodsId)]);
     }
 }
Ejemplo n.º 5
0
 /**
  * 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;
 }