本文整理汇总了PHP中CCatalogDiscountSave::__GetTimeStampArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscountSave::__GetTimeStampArray方法的具体用法?PHP CCatalogDiscountSave::__GetTimeStampArray怎么用?PHP CCatalogDiscountSave::__GetTimeStampArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscountSave
的用法示例。
在下文中一共展示了CCatalogDiscountSave::__GetTimeStampArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetDiscount
//.........这里部分代码省略.........
$rsDiscSaves = CCatalogDiscountSave::GetList(array(), $arFilter);
CTimeZone::Enable();
while ($arDiscSave = $rsDiscSaves->Fetch()) {
$arDiscSave['ACTION_SIZE'] = (int) $arDiscSave['ACTION_SIZE'];
$arDiscSave['COUNT_SIZE'] = (int) $arDiscSave['COUNT_SIZE'];
$arDiscSave['ACTIVE_FROM_UT'] = false;
$arDiscSave['ACTIVE_TO_UT'] = false;
$arDiscSave['COUNT_FROM_UT'] = false;
$arDiscSave['COUNT_TO_UT'] = false;
$arDiscSave['TYPE'] = (int) $arDiscSave['TYPE'];
$arDiscSave['MODULE_ID'] = 'catalog';
$strCountPeriod = self::COUNT_TIME_ALL;
$strActionPeriod = self::ACTION_TIME_ALL;
$arCountPeriodBack = array();
$arActionPeriodBack = array();
$arActionPeriod = array();
$arStartDate = false;
$arOldOrderSumm = false;
$arOrderSumm = false;
$boolPeriodInsert = true;
$intCountTime = $intCurrentTime;
$arOrderFilter = array('USER_ID' => $intUserID, 'LID' => $arDiscSave['SITE_ID'], 'PAYED' => 'Y', 'CANCELED' => 'N');
$arOldOrderFilter = $arOrderFilter;
if (!empty($arDiscSave['ACTIVE_FROM']) || !empty($arDiscSave['ACTIVE_TO'])) {
$strActionPeriod = self::ACTION_TIME_INTERVAL;
if (!empty($arDiscSave['ACTIVE_FROM'])) {
$arDiscSave['ACTIVE_FROM_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_FROM']);
}
if (!empty($arDiscSave['ACTIVE_TO'])) {
$arDiscSave['ACTIVE_TO_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_TO']);
}
} elseif ($arDiscSave['ACTION_SIZE'] > 0 && in_array($arDiscSave['ACTION_TYPE'], array('D', 'M', 'Y'))) {
$strActionPeriod = self::ACTION_TIME_PERIOD;
$arActionPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE']);
$arActionPeriod = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE'], true);
}
if (!empty($arDiscSave['COUNT_FROM']) || !empty($arDiscSave['COUNT_TO'])) {
$strCountPeriod = self::COUNT_TIME_INTERVAL;
if (!empty($arDiscSave['COUNT_FROM'])) {
$arDiscSave['COUNT_FROM_UT'] = MakeTimeStamp($arDiscSave['COUNT_FROM']);
}
if (!empty($arDiscSave['COUNT_TO'])) {
$arDiscSave['COUNT_TO_UT'] = MakeTimeStamp($arDiscSave['COUNT_TO']);
if ($arDiscSave['COUNT_TO_UT'] > $intCountTime) {
$arDiscSave['COUNT_TO_UT'] = $intCountTime;
$arDiscSave['COUNT_TO'] = ConvertTimeStamp($intCountTime, 'FULL');
}
}
} elseif ($arDiscSave['COUNT_SIZE'] > 0 && in_array($arDiscSave['COUNT_TYPE'], array('D', 'M', 'Y'))) {
$strCountPeriod = self::COUNT_TIME_PERIOD;
$arCountPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['COUNT_SIZE'], $arDiscSave['COUNT_TYPE']);
}
if ($strCountPeriod == self::COUNT_TIME_INTERVAL) {
if (false !== $arDiscSave['COUNT_FROM_UT']) {
if ($arDiscSave['COUNT_FROM_UT'] > $intCountTime) {
continue;
}
if (false !== $arDiscSave['COUNT_TO_UT'] && $arDiscSave['COUNT_TO_UT'] <= $arDiscSave['COUNT_FROM_UT']) {
continue;
}
if (false !== $arDiscSave['ACTIVE_TO_UT'] && $arDiscSave['COUNT_FROM_UT'] >= $arDiscSave['ACTIVE_TO_UT']) {
continue;
}
}
if (false !== $arDiscSave['COUNT_TO_UT']) {
if ($strActionPeriod == self::ACTION_TIME_PERIOD && $arDiscSave['COUNT_TO_UT'] < AddToTimeStamp($arActionPeriodBack, $intCountTime)) {
示例2: GetDiscount
public function GetDiscount($arParams = array())
{
global $DB;
global $USER;
$arResult = array();
if (!(isset($USER) && $USER instanceof CUser && 'CUser' == get_class($USER))) {
return $arResult;
}
if (!$USER->IsAuthorized()) {
return $arResult;
}
if (!self::IsEnabled()) {
return $arResult;
}
foreach (GetModuleEvents("catalog", "OnGetDiscountSave", true) as $arEvent) {
$mxResult = ExecuteModuleEventEx($arEvent, $arParams);
if (true !== $mxResult) {
return $mxResult;
}
}
if (!is_array($arParams) || empty($arParams)) {
return $arResult;
}
$intUserID = 0;
$arUserGroups = array();
$strSiteID = false;
if (isset($arParams['USER_ID'])) {
$intUserID = $arParams['USER_ID'];
}
if (isset($arParams['USER_GROUPS'])) {
$arUserGroups = $arParams['USER_GROUPS'];
}
if (isset($arParams['SITE_ID'])) {
$strSiteID = $arParams['SITE_ID'];
}
if (0 < self::GetDiscountUserID()) {
$intUserID = self::GetDiscountUserID();
$arUserGroups = $USER->GetUserGroup($intUserID);
} else {
$intUserID = intval($intUserID);
if (0 >= $intUserID) {
$intUserID = $USER->GetID();
$arUserGroups = $USER->GetUserGroupArray();
} else {
if (empty($arUserGroups)) {
$arUserGroups = $USER->GetUserGroup($intUserID);
}
}
}
if (!is_array($arUserGroups) || empty($arUserGroups) || 0 >= $intUserID) {
return $arResult;
}
$key = array_search(2, $arUserGroups);
if (false !== $key) {
unset($arUserGroups[$key]);
}
if (empty($arUserGroups)) {
return $arResult;
}
if ($strSiteID === false) {
$strSiteID = SITE_ID;
}
$arCurrentDiscountID = CCatalogDiscountSave::__GetDiscountIDByGroup($arUserGroups);
if (!empty($arCurrentDiscountID)) {
$intCurrentTime = getmicrotime();
$arFilter = array("ID" => $arCurrentDiscountID, 'SITE_ID' => $strSiteID, "TYPE" => DISCOUNT_TYPE_SAVE, 'ACTIVE' => 'Y', "+<=ACTIVE_FROM" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCurrentTime), "+>=ACTIVE_TO" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCurrentTime));
$rsDiscSaves = CCatalogDiscountSave::GetList(array(), $arFilter);
while ($arDiscSave = $rsDiscSaves->Fetch()) {
$arDiscSave['ACTION_SIZE'] = intval($arDiscSave['ACTION_SIZE']);
$arDiscSave['COUNT_SIZE'] = intval($arDiscSave['COUNT_SIZE']);
$arDiscSave['ACTIVE_FROM_UT'] = false;
$arDiscSave['ACTIVE_TO_UT'] = false;
$arDiscSave['COUNT_FROM_UT'] = false;
$arDiscSave['COUNT_TO_UT'] = false;
$strCountPeriod = 'U';
$strActionPeriod = 'U';
$arCountPeriodBack = array();
$arActionPeriodBack = array();
$arActionPeriod = array();
$arStartDate = false;
$arOldOrderSumm = false;
$arOrderSumm = false;
$boolPeriodInsert = true;
$intCountTime = $intCurrentTime;
$arOrderFilter = array("USER_ID" => $intUserID, "LID" => $arDiscSave['SITE_ID'], "PAYED" => "Y", "CANCELED" => "N");
$arOldOrderFilter = $arOrderFilter;
if (!empty($arDiscSave['ACTIVE_FROM']) || !empty($arDiscSave['ACTIVE_TO'])) {
$strActionPeriod = 'D';
if (!empty($arDiscSave['ACTIVE_FROM'])) {
$arDiscSave['ACTIVE_FROM_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_FROM']);
}
if (!empty($arDiscSave['ACTIVE_TO'])) {
$arDiscSave['ACTIVE_TO_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_TO']);
}
} elseif (0 < $arDiscSave['ACTION_SIZE'] && in_array($arDiscSave['ACTION_TYPE'], array('D', 'M', 'Y'))) {
$strActionPeriod = 'P';
$arActionPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE']);
$arActionPeriod = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE'], true);
}
if (!empty($arDiscSave['COUNT_FROM']) || !empty($arDiscSave['COUNT_TO'])) {
//.........这里部分代码省略.........