Exemplo n.º 1
0
 /**
  * Update recent transaction count
  * @param MongoId $accountId
  */
 private function updateMemberRecentTransactionCount($accountId)
 {
     $operatTimeFrom = new MongoDate(strtotime(date('Y-m-d') . ' -6 months'));
     $operatTimeTo = new MongoDate(strtotime(date('Y-m-d')));
     $recentTransactionStats = Order::getMemberTransactionCount($accountId, $operatTimeFrom, $operatTimeTo);
     foreach ($recentTransactionStats as $recentTransactionStat) {
         ModelStatsMemberOrder::updateAll(['$set' => ['recentTransactionCount' => $recentTransactionStat['count']]], ['consumerId' => $recentTransactionStat['_id']]);
     }
 }