當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CSaleUserAccount::Withdraw方法代碼示例

本文整理匯總了PHP中CSaleUserAccount::Withdraw方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSaleUserAccount::Withdraw方法的具體用法?PHP CSaleUserAccount::Withdraw怎麽用?PHP CSaleUserAccount::Withdraw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CSaleUserAccount的用法示例。


在下文中一共展示了CSaleUserAccount::Withdraw方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: DoPayOrderFromAccount

 static function DoPayOrderFromAccount($userId, $currency, $orderId, $orderSum, $arOptions, &$arErrors)
 {
     if (!array_key_exists("ONLY_FULL_PAY_FROM_ACCOUNT", $arOptions)) {
         $arOptions["ONLY_FULL_PAY_FROM_ACCOUNT"] = COption::GetOptionString("sale", "ONLY_FULL_PAY_FROM_ACCOUNT", "N");
     }
     $dbUserAccount = CSaleUserAccount::GetList(array(), array("USER_ID" => $userId, "CURRENCY" => $currency));
     $arUserAccount = $dbUserAccount->Fetch();
     if (!$arUserAccount) {
         return false;
     }
     if ($arUserAccount["CURRENT_BUDGET"] <= 0) {
         return false;
     }
     if ($arOptions["ONLY_FULL_PAY_FROM_ACCOUNT"] == "Y" && doubleval($arUserAccount["CURRENT_BUDGET"]) < doubleval($orderSum)) {
         return false;
     }
     $withdrawSum = CSaleUserAccount::Withdraw($userId, $orderSum, $currency, $orderId);
     if ($withdrawSum > 0) {
         $arFields = array("SUM_PAID" => $withdrawSum, "USER_ID" => $userId);
         CSaleOrder::Update($orderId, $arFields);
         if ($withdrawSum == $orderSum) {
             CSaleOrder::PayOrder($orderId, "Y", False, False);
         }
         return true;
     }
     return false;
 }
開發者ID:andy-profi,項目名稱:bxApiDocs,代碼行數:27,代碼來源:user.php

示例2: IntVal

         $arFields["AFFILIATE_ID"] = $affiliateID;
     }
 } else {
     $arFields["AFFILIATE_ID"] = false;
 }
 $arResult["ORDER_ID"] = CSaleOrder::DoSaveOrder($arOrderDat, $arFields, 0, $arResult["ERROR"]);
 $arResult["ORDER_ID"] = IntVal($arResult["ORDER_ID"]);
 if ($arResult["ORDER_ID"] > 0 && empty($arResult["ERROR"])) {
     $arOrder = CSaleOrder::GetByID($arResult["ORDER_ID"]);
     CSaleBasket::OrderBasket($arResult["ORDER_ID"], CSaleBasket::GetBasketUserID(), SITE_ID, false);
     $arResult["ACCOUNT_NUMBER"] = $arResult["ORDER_ID"] <= 0 ? $arResult["ORDER_ID"] : $arOrder["ACCOUNT_NUMBER"];
 }
 $withdrawSum = 0.0;
 if (empty($arResult["ERROR"])) {
     if ($arResult["PAY_FROM_ACCOUNT"] == "Y" && $arUserResult["PAY_CURRENT_ACCOUNT"] == "Y" && ($arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] == "Y" && DoubleVal($arResult["USER_ACCOUNT"]["CURRENT_BUDGET"]) >= DoubleVal($orderTotalSum) || $arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] != "Y")) {
         $withdrawSum = CSaleUserAccount::Withdraw($USER->GetID(), $orderTotalSum, $arResult["BASE_LANG_CURRENCY"], $arResult["ORDER_ID"]);
         if ($withdrawSum > 0) {
             $arFields = array("SUM_PAID" => $withdrawSum, "USER_ID" => $USER->GetID());
             CSaleOrder::Update($arResult["ORDER_ID"], $arFields);
             if ($withdrawSum == $orderTotalSum) {
                 CSaleOrder::PayOrder($arResult["ORDER_ID"], "Y", False, False);
             }
         }
     }
     if ($arResult["HAVE_PREPAYMENT"]) {
         if ($psPreAction && $psPreAction->IsAction()) {
             $psPreAction->orderId = $arResult["ORDER_ID"];
             $psPreAction->orderAmount = $orderTotalSum;
             $psPreAction->deliveryAmount = $arResult["DELIVERY_PRICE"];
             $psPreAction->taxAmount = $arResult["TAX_PRICE"];
             $orderData = array();
開發者ID:sharapudinov,項目名稱:lovestore.top,代碼行數:31,代碼來源:component.php


注:本文中的CSaleUserAccount::Withdraw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。