本文整理汇总了PHP中CCatalogDiscountSave::__UpdateUserInfoByDiscount方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogDiscountSave::__UpdateUserInfoByDiscount方法的具体用法?PHP CCatalogDiscountSave::__UpdateUserInfoByDiscount怎么用?PHP CCatalogDiscountSave::__UpdateUserInfoByDiscount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogDiscountSave
的用法示例。
在下文中一共展示了CCatalogDiscountSave::__UpdateUserInfoByDiscount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetDiscount
//.........这里部分代码省略.........
}
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)) {
continue;
}
}
}
if ($strActionPeriod == self::ACTION_TIME_PERIOD) {
if ($strCountPeriod == self::COUNT_TIME_PERIOD) {
$arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriodBack, $intCountTime))));
if (is_array($arStartDate) && !empty($arStartDate)) {
$arOldOrderFilter['<DATE_INSERT'] = $arStartDate['ACTIVE_FROM_FORMAT'];
$arOldOrderFilter['>=DATE_INSERT'] = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT'])));
$arOldOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOldOrderFilter, $arDiscSave['CURRENCY']);
}
} else {
$arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID), array('ACTIVE_FROM' => false, 'DELETE' => false));
if (is_array($arStartDate) && !empty($arStartDate)) {
$intTimeStart = MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT']);
$intTimeFinish = MakeTimeStamp($arStartDate['ACTIVE_TO_FORMAT']);
if (!($intTimeStart <= $intCountTime && $intTimeFinish >= $intCountTime)) {
continue;
} else {
$boolPeriodInsert = false;
}
}
}
}
$intTimeStart = false;
$intTimeFinish = false;
if ($strCountPeriod == self::COUNT_TIME_INTERVAL) {
$intTimeStart = !empty($arDiscSave['COUNT_FROM']) ? $arDiscSave['COUNT_FROM'] : false;
$intTimeFinish = !empty($arDiscSave['COUNT_TO']) ? $arDiscSave['COUNT_TO'] : false;
} elseif ($strCountPeriod == self::COUNT_TIME_PERIOD) {
$intTimeStart = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, $intCountTime));
}
if ($intTimeStart) {
$arOrderFilter['>=DATE_INSERT'] = $intTimeStart;
}
if ($intTimeFinish) {
$arOrderFilter['<DATE_INSERT'] = $intTimeFinish;
}
$arOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOrderFilter, $arDiscSave['CURRENCY']);
if (is_array($arOldOrderSumm) && 0 < $arOldOrderSumm['RANGE_SUMM']) {
if ($arOrderSumm['RANGE_SUMM'] <= $arOldOrderSumm['RANGE_SUMM']) {
$arOrderSumm = $arOldOrderSumm;
} else {
$arOldOrderSumm = false;
}
}
$rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'DESC'), array('DISCOUNT_ID' => $arDiscSave['ID'], '<=RANGE_FROM' => $arOrderSumm['RANGE_SUMM']), false, array('nTopCount' => 1));
$arRange = $rsRanges->Fetch();
if (!empty($arRange) || $getAll) {
if (!empty($arRange)) {
if ($strActionPeriod == self::ACTION_TIME_PERIOD) {
if ($strCountPeriod == self::COUNT_TIME_PERIOD) {
if (!is_array($arOldOrderSumm)) {
CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1));
}
} else {
if ($boolPeriodInsert) {
CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1), array('SEARCH' => true, 'DELETE' => false));
}
}
}
}
unset($arDiscSave['ACTIVE_FROM_UT'], $arDiscSave['ACTIVE_TO_UT'], $arDiscSave['COUNT_FROM_UT'], $arDiscSave['COUNT_TO_UT']);
$arOneResult = $arDiscSave;
if (!empty($arRange)) {
$arOneResult['VALUE'] = $arRange['VALUE'];
$arOneResult['VALUE_TYPE'] = $arRange['TYPE'];
$arOneResult['RANGE_FROM'] = $arRange['RANGE_FROM'];
$arOneResult['MAX_DISCOUNT'] = 0;
} else {
$arOneResult['VALUE'] = 0;
$arOneResult['VALUE_TYPE'] = self::TYPE_PERCENT;
$arOneResult['MAX_DISCOUNT'] = 0;
$rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'ASC'), array('DISCOUNT_ID' => $arDiscSave['ID']), false, array('nTopCount' => 1));
$arRange = $rsRanges->Fetch();
$arOneResult['NEXT_RANGE_FROM'] = $arRange['RANGE_FROM'];
$arOneResult['NEXT_VALUE'] = $arRange['VALUE'];
$arOneResult['NEXT_VALUE_TYPE'] = $arRange['TYPE'];
}
$arOneResult['SUMM'] = $arOrderSumm['SUMM'];
$arOneResult['SUMM_CURRENCY'] = $arOrderSumm['CURRENCY'];
$arOneResult['RANGE_SUMM'] = $arOrderSumm['RANGE_SUMM'];
$arOneResult['LAST_ORDER_DATE'] = $arOrderSumm['LAST_ORDER_DATE'];
$arResult[] = $arOneResult;
}
}
}
return $arResult;
}
示例2: GetDiscount
//.........这里部分代码省略.........
$arDiscSave['COUNT_TO'] = ConvertTimeStamp($intCountTime, 'FULL');
}
}
} elseif (0 < $arDiscSave['COUNT_SIZE'] && in_array($arDiscSave['COUNT_TYPE'], array('D', 'M', 'Y'))) {
$strCountPeriod = 'P';
$arCountPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['COUNT_SIZE'], $arDiscSave['COUNT_TYPE']);
}
if ('D' == $strCountPeriod) {
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 ('P' == $strActionPeriod && $arDiscSave['COUNT_TO_UT'] < AddToTimeStamp($arActionPeriodBack, $intCountTime)) {
continue;
}
}
}
if ('P' == $strActionPeriod) {
if ('P' == $strCountPeriod) {
$arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriodBack, $intCountTime))));
if (is_array($arStartDate) && !empty($arStartDate)) {
$arOldOrderFilter['<DATE_INSERT'] = $arStartDate['ACTIVE_FROM_FORMAT'];
$arOldOrderFilter['>=DATE_INSERT'] = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT'])));
$arOldOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOldOrderFilter, $arDiscSave['CURRENCY']);
}
} else {
$arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID), array('ACTIVE_FROM' => false, 'DELETE' => false));
if (is_array($arStartDate) && !empty($arStartDate)) {
$intTimeStart = MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT']);
$intTimeFinish = MakeTimeStamp($arStartDate['ACTIVE_TO_FORMAT']);
if (!($intTimeStart <= $intCountTime && $intTimeFinish >= $intCountTime)) {
continue;
} else {
$boolPeriodInsert = false;
}
}
}
}
$intTimeStart = false;
$intTimeFinish = false;
if ('D' == $strCountPeriod) {
$intTimeStart = !empty($arDiscSave['COUNT_FROM']) ? $arDiscSave['COUNT_FROM'] : false;
$intTimeFinish = !empty($arDiscSave['COUNT_TO']) ? $arDiscSave['COUNT_TO'] : false;
} elseif ('P' == $strCountPeriod) {
$intTimeStart = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, $intCountTime));
}
if ($intTimeStart) {
$arOrderFilter['>=DATE_INSERT'] = $intTimeStart;
}
if ($intTimeFinish) {
$arOrderFilter['<DATE_INSERT'] = $intTimeFinish;
}
$arOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOrderFilter, $arDiscSave['CURRENCY']);
if (is_array($arOldOrderSumm) && 0 < $arOldOrderSumm['RANGE_SUMM']) {
if ($arOrderSumm['RANGE_SUMM'] <= $arOldOrderSumm['RANGE_SUMM']) {
$arOrderSumm = $arOldOrderSumm;
} else {
$arOldOrderSumm = false;
}
}
$rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'desc'), array('DISCOUNT_ID' => $arDiscSave['ID'], '<=RANGE_FROM' => $arOrderSumm['RANGE_SUMM']), false, array('nTopCount' => 1));
if ($arRange = $rsRanges->Fetch()) {
if ('P' == $strActionPeriod) {
if ('P' == $strCountPeriod) {
if (!is_array($arOldOrderSumm)) {
CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1));
}
} else {
if ($boolPeriodInsert) {
CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1), array('SEARCH' => true, 'DELETE' => false));
}
}
}
unset($arDiscSave['ACTIVE_FROM_UT']);
unset($arDiscSave['ACTIVE_TO_UT']);
unset($arDiscSave['COUNT_FROM_UT']);
unset($arDiscSave['COUNT_TO_UT']);
$arOneResult = array();
$arOneResult = $arDiscSave;
$arOneResult['VALUE'] = $arRange['VALUE'];
$arOneResult['VALUE_TYPE'] = $arRange['TYPE'];
$arOneResult['RANGE_FROM'] = $arRange['RANGE_FROM'];
$arOneResult['SUMM'] = $arOrderSumm['SUMM'];
$arOneResult['SUMM_CURRENCY'] = $arOrderSumm['CURRENCY'];
$arOneResult['RANGE_SUMM'] = $arOrderSumm['RANGE_SUMM'];
$arOneResult['LAST_ORDER_DATE'] = $arOrderSumm['LAST_ORDER_DATE'];
$arResult[] = $arOneResult;
}
}
}
return $arResult;
}