Beispiel #1
0
 public static function updateStatusByIds($storeGoodsIds, $status, $onSaleTime, $offShelfTime = null)
 {
     $attributes = ['status' => $status, 'onSaleTime' => $onSaleTime];
     if ($offShelfTime !== null) {
         $attributes['offShelfTime'] = $offShelfTime;
     }
     StoreGoods::updateAll(['$set' => $attributes], ['_id' => ['$in' => $storeGoodsIds]]);
 }
 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]);
 }
 /**
  * @args {"description": "Delay: Store goods on sale every minute"}
  */
 public function perform()
 {
     StoreGoods::updateAll(['$set' => ['status' => StoreGoods::STATUS_ON]], ['status' => StoreGoods::STATUS_OFF, 'onSaleTime' => ['$lte' => new MongoDate(strtotime('+1 minute'))]]);
 }
 /**
  * Update the status of goods for store module.
  */
 public function actionStoreGoodsSale()
 {
     $result = StoreGoods::updateAll(['$set' => ['status' => StoreGoods::STATUS_ON]], ['status' => StoreGoods::STATUS_OFF, 'onSaleTime' => ['$lte' => new \MongoDate(strtotime('+1 minute'))]]);
     echo $result;
 }