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


PHP Status::sumFields方法代码示例

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


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

示例1: insert

 public static function insert($is_btc = false, $bank_account_currency = false, $amount = false, $btc_address = false, $account_number = false)
 {
     global $CFG;
     $bank_account_currency = preg_replace("/[^0-9]/", "", $bank_account_currency);
     $amount = preg_replace("/[^0-9\\.]/", "", $amount);
     $account_number = preg_replace("/[^0-9]/", "", $account_number);
     $btc_address = preg_replace("/[^0-9a-zA-Z]/", '', $btc_address);
     if (!$CFG->session_active) {
         return false;
     }
     if ($CFG->withdrawals_status == 'suspended') {
         return false;
     }
     $available = User::getAvailable();
     if ($is_btc) {
         if (round($amount, 8) > round($available['BTC'], 8)) {
             return false;
         }
     } else {
         $currency_info = $CFG->currencies[$bank_account_currency];
         if ($amount > $available[$currency_info['currency']]) {
             return false;
         }
     }
     if ($is_btc) {
         if ((User::$info['verified_authy'] == 'Y' || User::$info['verified_google'] == 'Y') && User::$info['confirm_withdrawal_2fa_btc'] == 'Y' && !($CFG->token_verified || $CFG->session_api)) {
             return false;
         }
         if ((User::$info['verified_authy'] == 'Y' || User::$info['verified_google'] == 'Y') && User::$info['confirm_withdrawal_2fa_bank'] == 'Y' && !($CFG->token_verified || $CFG->session_api)) {
             return false;
         }
         $status = User::$info['confirm_withdrawal_email_btc'] == 'Y' && !($CFG->token_verified || $CFG->session_api) ? $CFG->request_awaiting_id : $CFG->request_pending_id;
         $request_id = db_insert('requests', array('date' => date('Y-m-d H:i:s'), 'site_user' => User::$info['id'], 'currency' => $CFG->btc_currency_id, 'amount' => $amount, 'description' => $CFG->withdraw_btc_desc, 'request_status' => $status, 'request_type' => $CFG->request_withdrawal_id, 'send_address' => $btc_address, 'fee' => $CFG->bitcoin_sending_fee, 'net_amount' => $amount - $CFG->bitcoin_sending_fee));
         db_insert('history', array('date' => date('Y-m-d H:i:s'), 'ip' => $CFG->client_ip, 'history_action' => $CFG->history_withdraw_id, 'site_user' => User::$info['id'], 'request_id' => $request_id, 'bitcoin_address' => $btc_address, 'balance_before' => User::$info['btc'], 'balance_after' => User::$info['btc'] - $amount));
         if (User::$info['confirm_withdrawal_email_btc'] == 'Y' && !($CFG->token_verified || $CFG->session_api) && $request_id > 0) {
             Status::sumFields(array('pending_withdrawals' => $amount));
             $email_token = User::randomPassword(12);
             $vars = User::$info;
             $vars['authcode'] = urlencode(Encryption::encrypt($email_token));
             $vars['baseurl'] = $CFG->frontend_baseurl;
             db_update('requests', $request_id, array('email_token' => $email_token));
             $email = SiteEmail::getRecord('request-auth');
             Email::send($CFG->form_email, User::$info['email'], $email['title'], $CFG->form_email_from, false, $email['content'], $vars);
         } elseif (User::$info['notify_withdraw_btc'] == 'Y') {
             $info['amount'] = $amount;
             $info['currency'] = 'BTC';
             $info['first_name'] = User::$info['first_name'];
             $info['last_name'] = User::$info['last_name'];
             $info['id'] = $request_id;
             $email = SiteEmail::getRecord('new-withdrawal');
             Email::send($CFG->form_email, User::$info['email'], str_replace('[amount]', $amount, str_replace('[currency]', 'BTC', $email['title'])), $CFG->form_email_from, false, $email['content'], $info);
         }
     } else {
         if ((User::$info['verified_authy'] == 'Y' || User::$info['verified_google'] == 'Y') && User::$info['confirm_withdrawal_2fa_bank'] == 'Y' && !($CFG->token_verified || $CFG->session_api)) {
             return false;
         }
         $amount = round($amount, 2, PHP_ROUND_HALF_UP);
         $status = User::$info['confirm_withdrawal_email_bank'] == 'Y' && !($CFG->token_verified || $CFG->session_api) ? $CFG->request_awaiting_id : $CFG->request_pending_id;
         $request_id = db_insert('requests', array('date' => date('Y-m-d H:i:s'), 'site_user' => User::$info['id'], 'currency' => $bank_account_currency, 'amount' => $amount, 'description' => $CFG->withdraw_fiat_desc, 'request_status' => $status, 'request_type' => $CFG->request_withdrawal_id, 'account' => $account_number, 'fee' => $CFG->fiat_withdraw_fee, 'net_amount' => $amount - $CFG->fiat_withdraw_fee));
         db_insert('history', array('date' => date('Y-m-d H:i:s'), 'ip' => $CFG->client_ip, 'history_action' => $CFG->history_withdraw_id, 'site_user' => User::$info['id'], 'request_id' => $request_id, 'balance_before' => User::$info[strtolower($currency_info['currency'])], 'balance_after' => User::$info[strtolower($currency_info['currency'])] - $amount));
         if (User::$info['confirm_withdrawal_email_bank'] == 'Y' && !($CFG->token_verified || $CFG->session_api) && $request_id > 0) {
             $vars = User::$info;
             $email_token = User::randomPassword(12);
             $vars['authcode'] = urlencode(Encryption::encrypt($email_token));
             $vars['baseurl'] = $CFG->frontend_baseurl;
             db_update('requests', $request_id, array('email_token' => $email_token));
             $email = SiteEmail::getRecord('request-auth');
             Email::send($CFG->form_email, User::$info['email'], $email['title'], $CFG->form_email_from, false, $email['content'], $vars);
         } elseif (User::$info['notify_withdraw_bank'] == 'Y') {
             $info['amount'] = number_format($amount, 2);
             $info['currency'] = $currency_info['currency'];
             $info['first_name'] = User::$info['first_name'];
             $info['last_name'] = User::$info['last_name'];
             $info['id'] = $request_id;
             $email = SiteEmail::getRecord('new-withdrawal');
             Email::send($CFG->form_email, User::$info['email'], str_replace('[amount]', number_format($amount, 2), str_replace('[currency]', $currency_info['currency'], $email['title'])), $CFG->form_email_from, false, $email['content'], $info);
         }
     }
     if ($request_id && $CFG->memcached) {
         $CFG->unset_cache['balances'][User::$info['id']] = 2;
         self::unsetCache(User::$info['id']);
     }
     if ($CFG->session_api && $request_id > 0) {
         $result = self::get(false, false, false, false, false, false, 1, $request_id);
         return $result[0];
     } else {
         return $request_id;
     }
 }
开发者ID:MirellJ,项目名称:wlox-api,代码行数:89,代码来源:Requests.php

示例2: elseif

            Status::sumFields(array('hot_wallet_btc' => 0 - $transferred - $transfer_fees, 'warm_wallet_btc' => $transferred, 'total_btc' => 0 - $transfer_fees));
            echo 'Transferred ' . $reserve_surplus . ' to warm wallet. TX: ' . $response . PHP_EOL;
        }
    }
} elseif ($reserve['hot_wallet_btc'] > $CFG->bitcoin_reserve_min && $warm_wallet && $reserve_surplus > 0) {
    //$warm_wallet_a = BitcoinAddresses::getWarmWallet();
    $warm_wallet_a['address'] = $warm_wallet;
    $hot_wallet_a = BitcoinAddresses::getHotWallet();
    $bitcoin->walletpassphrase($CFG->bitcoin_passphrase, 3);
    $response = $bitcoin->sendfrom($CFG->bitcoin_accountname, $warm_wallet_a['address'], floatval($reserve_surplus));
    $transferred = 0;
    echo $bitcoin->error;
    if ($response && !$bitcoin->error) {
        $transferred = $reserve_surplus;
        $transfer_fees = 0;
        $transaction = $bitcoin->gettransaction($response);
        foreach ($transaction['details'] as $detail) {
            if ($detail['category'] == 'send') {
                $detail['fee'] = abs($detail['fee']);
                if ($detail['fee'] > 0) {
                    $transfer_fees += $detail['fee'];
                    db_insert('fees', array('fee' => $detail['fee'], 'date' => date('Y-m-d H:i:s')));
                }
            }
        }
        Status::sumFields(array('hot_wallet_btc' => 0 - $transferred - $transfer_fees, 'warm_wallet_btc' => $transferred, 'total_btc' => 0 - $transfer_fees));
        echo 'Transferred ' . $reserve_surplus . ' to warm wallet. TX: ' . $response . PHP_EOL;
    }
}
db_update('status', 1, array('cron_receive_bitcoin' => date('Y-m-d H:i:s'), 'last_sweep' => date('Y-m-d H:i:s')));
echo 'done' . PHP_EOL;
开发者ID:MirellJ,项目名称:wlox-cron,代码行数:31,代码来源:receive_bitcoin.php

示例3: bcsub

            $response = $bitcoin->sendfrom($CFG->bitcoin_accountname, $address, (double) bcsub($amount, $CFG->bitcoin_sending_fee, 8));
            $fees_charged += $CFG->bitcoin_sending_fee;
            if (!empty($bitcoin->error)) {
                echo $bitcoin->error . PHP_EOL;
            }
        }
    }
}
if (!empty($response) && $users && !$bitcoin->error) {
    echo 'Transactions sent: ' . $response . PHP_EOL;
    $total = 0;
    $transaction = $bitcoin->gettransaction($response);
    $actual_fee_difference = $fees_charged - abs($transaction['fee']);
    foreach ($users as $site_user => $amount) {
        $total += $amount;
        User::updateBalances($site_user, array('btc' => -1 * $amount), true);
    }
    foreach ($requests as $request_id) {
        db_update('requests', $request_id, array('request_status' => $CFG->request_completed_id));
    }
    if ($total > 0) {
        Status::sumFields(array('hot_wallet_btc' => 0 - $total + $actual_fee_difference, 'total_btc' => 0 - $total + $actual_fee_difference));
        Status::updateEscrows(array($CFG->btc_currency_id => $actual_fee_difference));
        db_update('status', 1, array('pending_withdrawals' => $pending - $total));
    }
}
if (empty($pending)) {
    db_update('status', 1, array('deficit_btc' => '0'));
}
db_update('status', 1, array('cron_send_bitcoin' => date('Y-m-d H:i:s')));
echo 'done' . PHP_EOL;
开发者ID:MirellJ,项目名称:wlox-cron,代码行数:31,代码来源:send_bitcoin.php


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