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


PHP Currency::findById方法代码示例

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


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

示例1: EGOP_transaction_o_complete

 public static function EGOP_transaction_o_complete()
 {
     $id = Core::validate($_GET['id']);
     $hash = Core::validate($_GET['hash']);
     $at = new AtEgop();
     if (!$at->findById($id)) {
         header('Location: ' . URL_WRONG_DATA_INPUT);
         exit;
     }
     if ($hash != self::hash_for_money_output_link($at->getId(), $at->getUID())) {
         header('Location: ' . URL_WRONG_DATA_INPUT);
         exit;
     }
     $currency = new Currency();
     $currency->findById($at->getCurrencyId());
     $wallets = self::EGOP_MinAndMaxWallets($currency);
     $amount = $at->getAmount();
     if ($wallets['max'] == null || $wallets['max']['current_balance'] < $amount) {
         Core::write_log(EGOPAY_LOG_PATH, __FUNCTION__ . ' : Not enough money on this wallet (id) : ' . $wallets['max']['id'] . '(at_egop id=' . $at->getId() . ')');
         header('Location: ' . URL_SERVER_ERROR);
         exit;
     }
     $wallet = new WalletsEgop();
     $wallet->findById($wallets['max']['id']);
     $oAuth = new EgoPayAuth($wallet->getEmail(), $wallet->getApiId(), $wallet->getApiPassword());
     $oEgoPayJsonAgent = new EgoPayJsonApiAgent($oAuth);
     $oEgoPayJsonAgent->setVerifyPeer(false);
     try {
         $oResponse = $oEgoPayJsonAgent->getTransfer($at->getClientAccount(), $at->getAmount(), $currency->getName(), 'Transfer from Bitmonex');
         // for debug
         Core::write_log(EGOPAY_LOG_PATH, __FUNCTION__ . ' : getTransfer response: ' . print_r($oResponse, true));
         reset($oResponse);
         //
     } catch (EgoPayApiException $e) {
         // error codes from here: https://www.egopay.com/developers/api/payments/send-payment
         if ($e->getCode() == 11 || $e->getCode() == 12) {
             header('Location: ' . URL_WRONG_DATA_INPUT);
             exit;
         }
         Core::write_log(EGOPAY_LOG_PATH, __FUNCTION__ . ' : getTransfer Error: ' . $e->getCode() . " : " . $e->getMessage());
         header('Location: ' . URL_SERVER_ERROR);
         exit;
     }
     $limits = self::transactionLimits($currency->getId(), 'EGOP', 1);
     $feeVolume = $amount * $limits['fee'];
     $feeVolume = Core::round_up($feeVolume, 2);
     $purses = Purse::findBy(array('UID' => $at->getUID(), 'CurId' => $currency->getId()));
     $purse = new Purse();
     $purse->findById($purses[0]['id']);
     $purse->addValue(-($amount + $feeVolume));
     $purse->save();
     $systemFeeVolume = $amount * $limits['system_fee'];
     $systemFeeVolume = Core::round_up($systemFeeVolume, 2);
     $profit = ($feeVolume - $systemFeeVolume) * $wallet->getShare();
     $wallet->setProfit($wallet->getProfit() + $profit);
     $wallet->save();
     $at->setStatus(1);
     $at->setOurWalletId($wallet->getId());
     $at->setTransactionId($oResponse->transaction->sId);
     $at->setTimestamp(Core::timestamp_gmp());
     $at->save();
     header('Location: ' . URL_SUCCESS_PAYMENT);
 }
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:63,代码来源:moneyController.php

示例2: internal_fees

 public static function internal_fees()
 {
     $currency = new Currency();
     $rates = Rate::getAll();
     foreach ($rates as $key => $value) {
         $currency->findById($value['FirstId']);
         $rates[$key]['firstCurrency'] = $currency->getName();
         $currency->findById($value['SecondId']);
         $rates[$key]['secondCurrency'] = $currency->getName();
     }
     Core::runView('ViewTemplate/account', array('pageName' => 'Internal fees', 'activeMenu' => 'Internal fees', 'pagePath' => 'Administration/admin_internal_fees', 'user' => self::$user, 'rates' => $rates));
 }
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:12,代码来源:adminController.php

示例3: getPages

 public static function getPages()
 {
     $usr = usr::getCurrentUser(1);
     if (!isset($usr)) {
         return;
     }
     $widget = new Widget();
     $widget->setUID($usr->getId());
     $pages = $widget->getAllPages();
     foreach ($pages as $key => $value) {
         $id = $value['rate'];
         $rt = new Rate();
         $rt->setId($id);
         $rt->findById($id);
         $fcId = $rt->getFirstCurrencyId();
         $scId = $rt->getSecondCurrencyId();
         $cur = new Currency();
         $cur->findById($fcId);
         $firstCurr = $cur->getName();
         $cur->findById($scId);
         $secondCurr = $cur->getName();
         $arr = array();
         $arr['firstCurrency'] = $firstCurr;
         $arr['secondCurrency'] = $secondCurr;
         $pages[$key]['rate'] = $arr;
     }
     return $pages;
 }
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:28,代码来源:widgetControlController.php

示例4: tradeHistory

 public static function tradeHistory($firstCurrencyName = null, $secondCurrencyName = null, $count = null)
 {
     $user = usr::getCurrentUser(1);
     $isAjax = 0;
     if ($count == null) {
         $count = Core::validate(self::getVar('count'));
     }
     $from_id = Core::validate(self::getVar('from_id'));
     $end_id = Core::validate(self::getVar('end_id'));
     $order = Core::validate(self::getVar('order'));
     $since = Core::validate(self::getVar('since'));
     $end = Core::validate(self::getVar('end'));
     if ($firstCurrencyName == null) {
         $firstCurrencyName = Core::validate(self::getVar('firstCurrency'));
         $isAjax = 1;
     }
     if ($secondCurrencyName == null) {
         $secondCurrencyName = Core::validate(self::getVar('secondCurrency'));
         $isAjax = 1;
     }
     $rate = self::getRate($firstCurrencyName, $secondCurrencyName);
     if ($rate != null) {
         $params['RateId'] = $rate->getId();
     }
     $params['count'] = $count;
     $params['from_id'] = $from_id;
     $params['end_id'] = $end_id;
     $params['order'] = $order;
     $params['since'] = $since != null ? date("Y-m-d H:i:s", $since) : null;
     $params['end'] = $end != null ? date("Y-m-d H:i:s", $end) : null;
     $deals = Deal::getHistory($params);
     $return = array();
     $rate = new Rate();
     $currency = new Currency();
     foreach ($deals as $value) {
         $rate->findById($value['RateId']);
         $currency->findById($rate->getFirstCurrencyId());
         $deal['pair'] = $currency->getName();
         $currency->findById($rate->getSecondCurrencyId());
         $deal['pair'] .= " - " . $currency->getName();
         $deal['type'] = $value['Type'] == 0 ? "buy" : "sell";
         $deal['amount'] = $value['Volume'];
         $deal['rate'] = $value['Price'];
         $deal['order_id'] = $value['OrderId'];
         $deal['is_your_order'] = $user != null && $user->getId() == $value['UID'] ? 1 : 0;
         $deal['timestamp'] = strtotime($value['Date']);
         array_push($return, $deal);
     }
     $result['success'] = 1;
     $result['return'] = $return;
     if ($isAjax == 0) {
         return $result;
     }
     print json_encode($result);
 }
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:55,代码来源:apiController.php

示例5: history

 public static function history()
 {
     $usr = self::getCurrentUser(1);
     if (!isset($usr)) {
         header("Location: /");
         return;
     }
     $orders = Order::findBy(array('UID' => $usr->getId()), ' ORDER BY Date DESC');
     $rate = new Rate();
     $currency = new Currency();
     foreach ($orders as $key => $order) {
         $rate->findById($order['RateId']);
         $currency->findById($rate->getFirstCurrencyId());
         $orders[$key]['FirstCurrency'] = $currency->getName();
         $currency->findById($rate->getSecondCurrencyId());
         $orders[$key]['SecondCurrency'] = $currency->getName();
         $orders[$key]['Type'] = $order['Type'] == OrderType::BUY ? 'Buy' : 'Sell';
         $status = '';
         switch ($order['Status']) {
             case OrderStatus::ACTIVE:
                 $status = 'Active';
                 break;
             case OrderStatus::DONE:
                 $status = 'Done';
                 break;
             case OrderStatus::PARTIALLY_DONE:
                 $status = 'Partially done';
                 break;
             case OrderStatus::CANCELLED:
                 $status = 'Cancelled';
                 break;
         }
         $orders[$key]['Status'] = $status;
         $orderDeals = Deal::findByAndOrderByDate(array('OrderId' => $order['id']));
         $deals = array();
         foreach ($orderDeals as $dealKey => $deal) {
             $deals[$dealKey]['id'] = $deal['id'];
             $deals[$dealKey]['Price'] = $deal['Price'];
             $deals[$dealKey]['Volume'] = $deal['Volume'];
             $deals[$dealKey]['Date'] = $deal['Date'];
             $deals[$dealKey]['Status'] = $deal['Done'] == 0 ? 'Active' : 'Done';
         }
         $orders[$key]['deals'] = $deals;
     }
     Core::runView('ViewTemplate/account', array('pageName' => 'Deals history', 'activeMenu' => 'Deals history', 'pagePath' => 'AccountProfile/usr_dealshistory', 'user' => $usr, 'dealsHistory' => $orders));
 }
开发者ID:Christian1998,项目名称:php_btc_exchange,代码行数:46,代码来源:usrController.php


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