当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::getDateWeekType方法代码示例

本文整理汇总了PHP中Library\Utility\Helper::getDateWeekType方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::getDateWeekType方法的具体用法?PHP Helper::getDateWeekType怎么用?PHP Helper::getDateWeekType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Library\Utility\Helper的用法示例。


在下文中一共展示了Helper::getDateWeekType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updatePriceByApartmentId

 /**
  * @param $apartmentId
  * @param $amount
  * @param $dateFrom
  * @param $dateTo
  * @param $weekDays
  * @param $priceType
  * @param int $setLockPrice
  * @param $forceLockPrice
  * @throws \Exception
  */
 public function updatePriceByApartmentId($apartmentId, $amount, $dateFrom, $dateTo, $weekDays, $priceType, $setLockPrice = 0, $forceLockPrice)
 {
     /**
      * @var \DDD\Dao\Apartment\Rate $rateDao
      * @var \DDD\Dao\Apartment\Inventory $inventoryDao
      */
     $rateDao = $this->getServiceLocator()->get('dao_apartment_rate');
     $inventoryDao = $this->getServiceLocator()->get('dao_apartment_inventory');
     // get parent rate
     $parentRateId = $rateDao->getApartmentParentRate($apartmentId);
     // update parent rate price by range
     $inventoryDao->updateParentRatePriceByRang($amount, $priceType, $parentRateId['id'], $dateFrom, $dateTo, $weekDays, $forceLockPrice);
     // get rates without parent rate
     $rates = $rateDao->getApartmentRatesWithoutParent($apartmentId);
     $rates = iterator_to_array($rates);
     // get parent inventory date by range
     $parentInventoryData = $inventoryDao->getRateInventoryData($apartmentId, $dateFrom, $dateTo, $weekDays, $forceLockPrice);
     // for check rate date already updated or not
     $checkRateIdDateCombination = [];
     foreach ($parentInventoryData as $parentRate) {
         // get date name
         $percentField = Helper::getDateWeekType($parentRate['date']);
         $parentRatePrice = $parentRate['price'];
         // update all rate without parent
         foreach ($rates as $rate) {
             if (isset($checkRateIdDateCombination[$parentRate['date']]) && in_array($rate['id'], $checkRateIdDateCombination[$parentRate['date']])) {
                 continue;
             }
             $checkRateIdDateCombination[$parentRate['date']][] = $rate['id'];
             $childPrice = round($parentRatePrice + $parentRatePrice * $rate[$percentField] / 100, 2);
             $inventoryDao->update(['price' => $childPrice], ['rate_id' => $rate['id'], 'date' => $parentRate['date']]);
         }
     }
     // set lock price bit
     $inventoryDao->updateLockPriceBit($apartmentId, $dateFrom, $dateTo, $weekDays, $setLockPrice, $forceLockPrice);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:47,代码来源:Inventory.php


注:本文中的Library\Utility\Helper::getDateWeekType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。