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


PHP Currency::findBy方法代码示例

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


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

示例1: EGOP_transaction_o

 public static function EGOP_transaction_o()
 {
     $usr = usr::getCurrentUser(1);
     if ($usr == null) {
         header('Location: /');
         exit;
     }
     $client_account = Core::validate($_POST['email']);
     $amount = Core::validate($_POST['amount']);
     $currency_name = Core::validate($_POST['currency']);
     if ($amount == 0 || !Core::isDouble($amount, 2)) {
         print json_encode(array('location' => URL_WRONG_MONEY_VALUE));
         exit;
     }
     if (!Core::isEmailAddress($client_account)) {
         print json_encode(array('location' => URL_WRONG_DATA_INPUT));
         exit;
     }
     $currency = new Currency();
     if (!$currency->findBy(array('Name' => $currency_name))) {
         print json_encode(array('location' => URL_SERVER_ERROR));
         exit;
     }
     $purseList = Purse::findBy(array('UID' => $usr->getId(), 'CurId' => $currency->getId()));
     if (empty($purseList)) {
         exit;
     }
     $limits = self::transactionLimits($currency->getId(), 'EGOP', 1);
     $feeVolume = $amount * $limits['fee'];
     $feeVolume = Core::round_up($feeVolume, 2);
     $purse = new Purse();
     $purse->findById($purseList[0]['id']);
     if ($purse->getValue() < $amount + $feeVolume) {
         print json_encode(array('location' => URL_WRONG_MONEY_VALUE));
         exit;
     }
     if ($amount < $limits['min']) {
         print json_encode(array('location' => URL_ERROR . self::LIMITS));
         return;
     }
     if ($limits['max'] != null) {
         $transaction_history = new AtEgop();
         $transactions = $transaction_history->findAllByForLastPeriod(array('UID' => $usr->getid(), 'type' => 1, 'status' => 1));
         $totalAmount = 0.0;
         if (isset($transactions)) {
             foreach ($transactions as $transaction) {
                 $totalAmount += $transaction['amount'];
             }
         }
         if ($totalAmount + $amount > $limits['max']) {
             print json_encode(array('location' => URL_ERROR . self::LIMITS));
             return;
         }
     }
     $at = new AtEgop();
     $at->setUID($usr->getId());
     $at->setClientAccount($client_account);
     $at->setAmount($amount);
     $at->setCurrencyId($currency->getId());
     $at->setType(1);
     $at->setStatus(0);
     $at->setTimestamp(Core::timestamp_gmp());
     $at->insert();
     $success = self::send_output_link('EGOP', $at->getId(), $usr);
     if (!$success) {
         print json_encode(array('location' => URL_SERVER_ERROR));
         return;
     }
     print json_encode(array('location' => URL_NOTIFICATION_SEND));
 }
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:70,代码来源:moneyController.php

示例2: addNewEGOPWallet

 public static function addNewEGOPWallet()
 {
     $email = Core::validate($_POST['EMAIL']);
     $api_id = Core::validate($_POST['API_ID']);
     $api_password = Core::validate($_POST['API_PASSWORD']);
     $store_id = Core::validate($_POST['STORE_ID']);
     $store_password = Core::validate($_POST['STORE_PASSWORD']);
     $checksum_key = Core::validate($_POST['CHECKSUM_KEY']);
     $currency_name = Core::validate($_POST['CURRENCY']);
     $share = Core::validate($_POST['SHARE']);
     // percent
     if ($email == null || $api_id == null || $api_password == null || $store_id == null || $store_password == null || $checksum_key == null || $currency_name == null || $share == null || !Core::isDouble($share)) {
         print 'Incorrect data';
         exit;
     }
     $currency = new Currency();
     if (!$currency->findBy(array('Name' => $currency_name))) {
         exit;
     }
     $result = WalletsEgop::findBy(array('currency_id' => $currency->getId(), 'email' => $email));
     if (!empty($result)) {
         print 'This wallet already exists';
         exit;
     }
     $oAuth = new EgoPayAuth($email, $api_id, $api_password);
     $oEgoPayJsonAgent = new EgoPayJsonApiAgent($oAuth);
     $oEgoPayJsonAgent->setVerifyPeer(false);
     try {
         $balance = $oEgoPayJsonAgent->getBalance($currency->getName());
     } catch (EgoPayApiException $e) {
         Core::write_log(EGOPAY_LOG_PATH, __FUNCTION__ . ' : getBalance Error: ' . $e->getCode() . " : " . $e->getMessage());
         print $e->getMessage();
         exit;
     }
     $wallet = new WalletsEgop();
     $wallet->setCurrencyId($currency->getId());
     $wallet->setEmail($email);
     $wallet->setApiId($api_id);
     $wallet->setApiPassword($api_password);
     $wallet->setStoreId($store_id);
     $wallet->setStorePassword($store_password);
     $wallet->setChecksumKey($checksum_key);
     $wallet->setValue($balance);
     $wallet->setShare($share / 100.0);
     $wallet->insert();
     header('Location: /admin/egop');
 }
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:47,代码来源:adminController.php

示例3: foreach

<?php 
    foreach ($return['return']['funds'] as $key => $value) {
        ?>
    <?php 
        if ($key == $data[0]['rate']['firstCurrency'] || $key == $data[0]['rate']['secondCurrency']) {
            ?>
        <div class="wallet">
            <div class="wallet-icon left"><img src="/public/img/curr/<?php 
            print $key;
            ?>
.png" style=""></div>
            <div class="wallet-title left"><span id="<?php 
            print $key;
            ?>
" class="greenMark"><?php 
            $cur->findBy(array('Name' => $key));
            print $cur->getTradeName();
            ?>
</span></div>
            <br>
            <div class="wallet-list">
                <div class="wallet-list-item">
                    <b id="val<?php 
            print $key;
            ?>
"><?php 
            print $value;
            ?>
</b> (<?php 
            print $key;
            ?>
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:31,代码来源:account_balance.php

示例4: trade

 public static function trade()
 {
     $user = usr::getCurrentUser(1);
     if ($user == null) {
         self::printErrorJson("You are not authorized");
         return;
     }
     $firstCurName = Core::validate(self::getVar('firstCurrency'));
     $secondCurName = Core::validate(self::getVar('secondCurrency'));
     $type = Core::validate(self::getVar('type'));
     $price = Core::validate(self::getVar('rate'));
     $volume = Core::validate(self::getVar('amount'));
     if ($firstCurName == null || $secondCurName == null || $type == null || $price == null || $volume == null) {
         self::printErrorJson("not all parameters are defined");
         return;
     }
     if (!Core::isDouble($price) || !Core::isDouble($volume)) {
         self::printErrorJson("parameters are defined incorrectly");
         return;
     }
     $rate = self::getRate($firstCurName, $secondCurName);
     if ($rate == null) {
         self::printErrorJson("rate {$firstCurName}" . "_" . " {$secondCurName} not exist");
         return;
     }
     $currency = new Currency();
     $currency->findBy(array('Name' => $firstCurName));
     if ($volume < $currency->getMinOrderAmount()) {
         self::printErrorJson("Please, check min order amount for this currency");
         return;
     }
     if ($type == 'buy') {
         $orderType = OrderType::BUY;
     } elseif ($type = 'sell') {
         $orderType = OrderType::SELL;
     } else {
         self::printErrorJson("undefined order type");
         return;
     }
     $orderId = OrderModel::createOrder($user->getId(), $rate, $orderType, $volume, $price);
     if ($orderId === false) {
         self::printErrorJson(OrderModel::getErrorMessage());
         return;
     }
     $return['order_id'] = $orderId;
     $return['funds'] = self::getFunds($user->getId());
     $result['success'] = 1;
     $result['return'] = $return;
     print json_encode($result);
 }
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:50,代码来源:apiController.php


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