本文整理汇总了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);
}