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


PHP getdbosql函数代码示例

本文整理汇总了PHP中getdbosql函数的典型用法代码示例。如果您正苦于以下问题:PHP getdbosql函数的具体用法?PHP getdbosql怎么用?PHP getdbosql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: doPoloniexTrading

function doPoloniexTrading()
{
    //	debuglog('-------------- doPoloniexTrading()');
    $flushall = rand(0, 4) == 0;
    $poloniex = new poloniex();
    $tickers = $poloniex->get_ticker();
    if (!$tickers) {
        return;
    }
    // upgrade orders
    $coins = getdbolist('db_coins', "enable and id in (select distinct coinid from markets where name='poloniex')");
    foreach ($coins as $coin) {
        if ($coin->dontsell) {
            continue;
        }
        $pair = "BTC_{$coin->symbol}";
        if (!isset($tickers[$pair])) {
            continue;
        }
        $orders = $poloniex->get_open_orders($pair);
        if (!$orders || !isset($orders[0])) {
            dborun("delete from orders where coinid={$coin->id} and market='poloniex'");
            continue;
        }
        foreach ($orders as $order) {
            if (!isset($order['orderNumber'])) {
                debuglog($order);
                continue;
            }
            if ($order['rate'] > $tickers[$pair]['lowestAsk'] + 5.0E-8 || $flushall) {
                //				debuglog("poloniex cancel order for $pair {$order['orderNumber']}");
                $poloniex->cancel_order($pair, $order['orderNumber']);
                $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $order['orderNumber']));
                if ($db_order) {
                    $db_order->delete();
                }
                sleep(1);
            } else {
                $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $order['orderNumber']));
                if ($db_order) {
                    continue;
                }
                debuglog("poloniex adding order {$coin->symbol}");
                $db_order = new db_orders();
                $db_order->market = 'poloniex';
                $db_order->coinid = $coin->id;
                $db_order->amount = $order['amount'];
                $db_order->price = $order['rate'];
                $db_order->ask = $tickers[$pair]['lowestAsk'];
                $db_order->bid = $tickers[$pair]['highestBid'];
                $db_order->uuid = $order['orderNumber'];
                $db_order->created = time();
                $db_order->save();
            }
        }
        $list = getdbolist('db_orders', "coinid={$coin->id} and market='poloniex'");
        foreach ($list as $db_order) {
            $found = false;
            foreach ($orders as $order) {
                if (!isset($order['orderNumber'])) {
                    debuglog($order);
                    continue;
                }
                if ($order['orderNumber'] == $db_order->uuid) {
                    $found = true;
                    break;
                }
            }
            if (!$found) {
                debuglog("poloniex deleting order {$coin->name} {$db_order->amount}");
                $db_order->delete();
            }
        }
    }
    // add orders
    $savebalance = getdbosql('db_balances', "name='poloniex'");
    $balances = $poloniex->get_balances();
    foreach ($balances as $symbol => $balance) {
        if (!$balance) {
            continue;
        }
        if ($symbol == 'BTC') {
            $savebalance->balance = $balance;
            $savebalance->save();
            continue;
        }
        $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol));
        if (!$coin || $coin->dontsell) {
            continue;
        }
        $market = getdbosql('db_markets', "coinid={$coin->id} and name='poloniex'");
        if ($market) {
            $market->lasttraded = time();
            $market->save();
        }
        $pair = "BTC_{$symbol}";
        if (!isset($tickers[$pair])) {
            continue;
        }
        $sellprice = $tickers[$pair]['highestBid'];
//.........这里部分代码省略.........
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:101,代码来源:poloniex_trading.php

示例2: getrenterparam

function getrenterparam($address)
{
    if (empty($address)) {
        return null;
    }
    $address = substr($address, 0, 34);
    $renter = getdbosql('db_renters', "address=:ad", array(':ad' => $address));
    return $renter;
}
开发者ID:zarethernet,项目名称:yaamp,代码行数:9,代码来源:libUtil.php

示例3: __construct

 public function __construct($coin, $marketname)
 {
     $this->coin = $coin;
     $this->marketname = $marketname;
     $this->market = getdbosql('db_markets', "coinid={$coin->id} and name='{$marketname}'");
     if (!$this->market) {
         return;
     }
 }
开发者ID:zarethernet,项目名称:yaamp,代码行数:9,代码来源:CExchangeCoin.php

示例4: getparam

<?php

/////////////////////////////////////////////////////////////////////////////////////////////////
$symbol = getparam('symbol');
$coin = null;
if ($symbol == 'all') {
    $users = getdbolist('db_accounts', "balance>.001 order by balance desc");
} else {
    $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol));
    if (!$coin) {
        return;
    }
    $users = getdbolist('db_accounts', "balance>.001 and coinid={$coin->id} order by balance desc");
}
//echo "<br><table class='dataGrid'>";
showTableSorter('maintable');
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>Wallet</th>";
echo "<th>Last</th>";
echo "<th align=right>Miners</th>";
echo "<th align=right>Hashrate</th>";
echo "<th align=right>Bad</th>";
echo "<th></th>";
echo "<th align=right>Blocks</th>";
echo "<th align=right>Diff/Paid</th>";
echo "<th align=right>Balance</th>";
echo "<th align=right>Total Paid</th>";
echo "<th></th>";
echo "</tr>";
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:31,代码来源:user_results.php

示例5: yaamp_convert_earnings_user

function yaamp_convert_earnings_user($user, $status)
{
    $refcoin = getdbo('db_coins', $user->coinid);
    if (!$refcoin) {
        $refcoin = getdbosql('db_coins', "symbol='BTC'");
    }
    if (!$refcoin || $refcoin->price2 <= 0) {
        return 0;
    }
    $value = dboscalar("select sum(amount*price) from earnings where {$status} and userid={$user->id}");
    $value = $value / $refcoin->price2;
    return $value;
}
开发者ID:zarethernet,项目名称:yaamp,代码行数:13,代码来源:yaamp.php

示例6: actionAlgo

 public function actionAlgo()
 {
     $algo = substr(getparam('algo'), 0, 32);
     $a = getdbosql('db_algos', "name=:name", array(':name' => $algo));
     if ($a) {
         user()->setState('yaamp-algo', $a->name);
     } else {
         user()->setState('yaamp-algo', 'all');
     }
     $this->goback();
 }
开发者ID:zarethernet,项目名称:yaamp,代码行数:11,代码来源:SiteController.php

示例7: BackendCoinPayments

function BackendCoinPayments($coin)
{
    //	debuglog("BackendCoinPayments $coin->symbol");
    $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
    $info = $remote->getinfo();
    if (!$info) {
        debuglog("{$coin->symbol} cant connect to coin");
        return;
    }
    $min = 0.001;
    // 	if(date("w", time()) == 0 && date("H", time()) > 12)		// sunday afternoon
    // 		$min = 0.0001;
    $users = getdbolist('db_accounts', "balance>{$min} and coinid={$coin->id}");
    if ($coin->symbol == 'MUE' || $coin->symbol == 'DIME') {
        foreach ($users as $user) {
            $user = getdbo('db_accounts', $user->id);
            if (!$user) {
                continue;
            }
            $amount = $user->balance;
            while ($user->balance > $min && $amount > $min) {
                debuglog("{$coin->symbol} sendtoaddress {$user->username} {$amount}");
                $tx = $remote->sendtoaddress($user->username, round($amount, 8));
                if (!$tx) {
                    debuglog("error {$remote->error}, {$user->username}, {$amount}");
                    if ($remote->error == 'transaction too large' || $remote->error == 'invalid amount') {
                        $amount /= 2;
                        continue;
                    }
                    break;
                }
                $payout = new db_payouts();
                $payout->account_id = $user->id;
                $payout->time = time();
                $payout->amount = bitcoinvaluetoa($amount);
                $payout->fee = 0;
                $payout->tx = $tx;
                $payout->save();
                $user->balance -= $amount;
                $user->save();
            }
        }
        debuglog("payment done");
        return;
    }
    $total_to_pay = 0;
    $addresses = array();
    foreach ($users as $user) {
        $total_to_pay += round($user->balance, 8);
        $addresses[$user->username] = round($user->balance, 8);
    }
    if (!$total_to_pay) {
        //	debuglog("nothing to pay");
        return;
    }
    if ($info['balance'] - 0.001 < $total_to_pay) {
        debuglog("{$coin->symbol} wallet insufficient funds for payment {$info['balance']} < {$total_to_pay}");
        return;
    }
    if ($coin->symbol == 'BTC') {
        global $cold_wallet_table;
        $balance = $info['balance'];
        $stats = getdbosql('db_stats', "1 order by time desc");
        $renter = dboscalar("select sum(balance) from renters");
        $pie = $balance - $total_to_pay - $renter - 1;
        debuglog("pie to split is {$pie}");
        if ($pie > 0) {
            foreach ($cold_wallet_table as $coldwallet => $percent) {
                $coldamount = round($pie * $percent, 8);
                if ($coldamount < $min) {
                    break;
                }
                debuglog("paying cold wallet {$coldwallet} {$coldamount}");
                $addresses[$coldwallet] = $coldamount;
                $total_to_pay += $coldamount;
            }
        }
    }
    debuglog("paying {$total_to_pay} {$coin->symbol} min is {$min}");
    $tx = $remote->sendmany('', $addresses, 1, '');
    if (!$tx) {
        debuglog($remote->error);
        return;
    }
    foreach ($users as $user) {
        $user = getdbo('db_accounts', $user->id);
        if (!$user) {
            continue;
        }
        $payout = new db_payouts();
        $payout->account_id = $user->id;
        $payout->time = time();
        $payout->amount = bitcoinvaluetoa($user->balance);
        $payout->fee = 0;
        $payout->tx = $tx;
        $payout->save();
        $user->balance = 0;
        $user->save();
    }
    debuglog("payment done");
//.........这里部分代码省略.........
开发者ID:zarethernet,项目名称:yaamp,代码行数:101,代码来源:payment.php

示例8: updateYobitMarkets

function updateYobitMarkets()
{
    $res = yobit_api_query('info');
    if (!$res) {
        return;
    }
    foreach ($res->pairs as $i => $item) {
        $e = explode('_', $i);
        $symbol = strtoupper($e[0]);
        if ($e[1] != 'btc') {
            continue;
        }
        if ($symbol == 'BTC') {
            continue;
        }
        $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol));
        if (!$coin || !$coin->installed) {
            continue;
        }
        $market = getdbosql('db_markets', "coinid={$coin->id} and name='yobit'");
        if (!$market) {
            $market = new db_markets();
            $market->coinid = $coin->id;
            $market->name = 'yobit';
        }
        $pair = strtolower($coin->symbol) . '_btc';
        $ticker = yobit_api_query("ticker/{$pair}");
        if (!$ticker) {
            continue;
        }
        $price2 = ($ticker->{$pair}->buy + $ticker->{$pair}->sell) / 2;
        $market->price2 = AverageIncrement($market->price2, $price2);
        $market->price = AverageIncrement($market->price, $ticker->{$pair}->buy);
        $market->save();
    }
}
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:36,代码来源:markets.php

示例9: sectoa

            echo "main {$i} ";
        }
    }
}
echo "</span>";
$block_time = sectoa(time() - memcache_get($this->memcache->memcache, "cronjob_block_time_start"));
$loop2_time = sectoa(time() - memcache_get($this->memcache->memcache, "cronjob_loop2_time_start"));
$main_time2 = sectoa(time() - memcache_get($this->memcache->memcache, "cronjob_main_time_start"));
$main_time = sectoa(memcache_get($this->memcache->memcache, "cronjob_main_time"));
$main_text = cronstate2text($state_main);
echo "*** main  ({$main_time}) {$state_main} {$main_text} ({$main_time2}), loop2 ({$loop2_time}), block ({$block_time})<br>";
$topay = dboscalar("select sum(balance) from accounts where coinid={$btc->id}");
//here: take other currencies too
$topay2 = bitcoinvaluetoa(dboscalar("select sum(balance) from accounts where coinid={$btc->id} and balance>0.001"));
$renter = dboscalar("select sum(balance) from renters");
$stats = getdbosql('db_stats', "1 order by time desc");
$margin2 = bitcoinvaluetoa($btc->balance - $topay - $renter + $stats->balances + $stats->onsell + $stats->wallets);
$margin = bitcoinvaluetoa($btc->balance - $topay - $renter);
$topay = bitcoinvaluetoa($topay);
$renter = bitcoinvaluetoa($renter);
$immature = dboscalar("select sum(amount*price) from earnings where status=0");
$mints = dboscalar("select sum(mint*price) from coins where enable");
$off = $mints - $immature;
$immature = bitcoinvaluetoa($immature);
$mints = bitcoinvaluetoa($mints);
$off = bitcoinvaluetoa($off);
$btcaddr = YAAMP_BTCADDRESS;
//'14LS7Uda6EZGXLtRrFEZ2kWmarrxobkyu9';
echo "<a href='https://www.okcoin.com/market.do' target=_blank>Bitstamp {$mining->usdbtc}</a>, ";
echo "<a href='https://blockchain.info/address/{$btcaddr}' target=_blank>wallet {$btc->balance}</a>, next payout {$topay2}<br>";
echo "pay {$topay}, renter {$renter}, marg {$margin}, {$margin2}<br>";
开发者ID:Excalibur201010,项目名称:yiimp,代码行数:31,代码来源:common_results.php

示例10: BackendUpdateServices

function BackendUpdateServices()
{
    //	debuglog(__FUNCTION__);
    $table = array(0 => 'scrypt', 1 => 'sha256', 2 => 'scryptn', 3 => 'x11', 4 => 'x13', 5 => 'keccak', 6 => 'x15', 7 => 'nist5', 8 => 'neoscrypt', 9 => 'lyra2', 10 => 'whirlx', 11 => 'qubit', 12 => 'quark', 111 => 'c11');
    $res = fetch_url('https://www.nicehash.com/api?method=stats.global.current');
    if (!$res) {
        return;
    }
    $a = json_decode($res);
    if (!$a || !isset($a->result)) {
        return;
    }
    foreach ($a->result->stats as $stat) {
        if ($stat->price <= 0) {
            continue;
        }
        if (!isset($table[$stat->algo])) {
            continue;
        }
        $algo = $table[$stat->algo];
        $service = getdbosql('db_services', "name='Nicehash' and algo=:algo", array(':algo' => $algo));
        if (!$service) {
            $service = new db_services();
            $service->name = 'Nicehash';
            $service->algo = $algo;
        }
        $service->price = $stat->price / 1000;
        $service->speed = $stat->speed * 1000000000;
        $service->save();
        $list = getdbolist('db_jobs', "percent>0 and algo=:algo and (host='stratum.westhash.com' or host='stratum.nicehash.com')", array(':algo' => $algo));
        foreach ($list as $job) {
            $job->price = round($service->price * 1000 * (100 - $job->percent) / 100, 2);
            $job->save();
        }
    }
    $list = getdbolist('db_renters', "custom_address is not null and custom_server is not null");
    foreach ($list as $renter) {
        $res = fetch_url("https://{$renter->custom_server}/api?method=stats.provider&addr={$renter->custom_address}");
        if (!$res) {
            continue;
        }
        $renter->custom_balance = 0;
        $renter->custom_accept = 0;
        $renter->custom_reject = 0;
        $a = json_decode($res);
        foreach ($a->result->stats as $stat) {
            if (!isset($table[$stat->algo])) {
                continue;
            }
            $algo = $table[$stat->algo];
            $renter->custom_balance += $stat->balance;
            $renter->custom_accept += $stat->accepted_speed * 1000000000;
            $renter->custom_reject += $stat->rejected_speed * 1000000000;
        }
        $renter->save();
    }
    ///////////////////////////////////////////////////////////////////////////
    // renting from nicehash
    if (!YAAMP_PRODUCTION) {
        return;
    }
    return;
    $apikey = 'c9534a11-0e4e-4d00-be64-a00e34cd927a';
    $apiid = '7215';
    $deposit = '1C23KmLeCaQSLLyKVykHEUse1R7jRDv9j9';
    $amount = '0.01';
    $res = fetch_url("https://www.nicehash.com/api?method=balance&id={$apiid}&key={$apikey}");
    $a = json_decode($res);
    $balance = $a->result->balance_confirmed;
    foreach ($table as $i => $algo) {
        $nicehash = getdbosql('db_nicehash', "algo=:algo", array(':algo' => $algo));
        if (!$nicehash) {
            $nicehash = new db_nicehash();
            $nicehash->active = false;
            $nicehash->algo = $algo;
        }
        if (!$nicehash->active) {
            if ($nicehash->orderid) {
                $res = fetch_url("https://www.nicehash.com/api?method=orders.remove&id={$apiid}&key={$apikey}&algo={$i}&order={$nicehash->orderid}");
                debuglog($res);
                $nicehash->orderid = null;
            }
            $nicehash->btc = null;
            $nicehash->price = null;
            $nicehash->speed = null;
            $nicehash->last_decrease = null;
            $nicehash->save();
            continue;
        }
        $price = dboscalar("select price from hashrate where algo=:algo order by time desc limit 1", array(':algo' => $algo));
        $minprice = $price * 0.5;
        $setprice = $price * 0.7;
        $maxprice = $price * 0.9;
        $cancelprice = $price * 1.1;
        $res = fetch_url("https://www.nicehash.com/api?method=orders.get&my&id={$apiid}&key={$apikey}&algo={$i}");
        if (!$res) {
            break;
        }
        $a = json_decode($res);
        if (count($a->result->orders) == 0) {
//.........这里部分代码省略.........
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:101,代码来源:services.php

示例11: updateRawCoin

function updateRawCoin($marketname, $symbol, $name = 'unknown')
{
    if ($symbol == 'BTC') {
        return;
    }
    $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol));
    if (!$coin) {
        debuglog("new coin {$marketname} {$symbol} {$name}");
        $coin = new db_coins();
        $coin->txmessage = true;
        $coin->hassubmitblock = true;
        $coin->name = $name;
        $coin->symbol = $symbol;
        $coin->created = time();
        $coin->save();
        mail(YAAMP_ADMIN_EMAIL, "New coin {$symbol}", "new coin {$symbol} ({$name}) on {$marketname}");
        sleep(30);
    } else {
        if ($coin->name == 'unknown' && $name != 'unknown') {
            $coin->name = $name;
            $coin->save();
        }
    }
    $list = getdbolist('db_coins', "symbol=:symbol or symbol2=:symbol", array(':symbol' => $symbol));
    foreach ($list as $coin) {
        $market = getdbosql('db_markets', "coinid={$coin->id} and name='{$marketname}'");
        if (!$market) {
            $market = new db_markets();
            $market->coinid = $coin->id;
            $market->name = $marketname;
        }
        $market->deleted = false;
        $market->save();
    }
    /////////
    // 	if($coin->enable || !empty($coin->algo) || !empty($coin->errors) || $coin->name == 'unknown') return;
    // 	debuglog("http://www.cryptocoinrank.com/$coin->name");
    //  	$data = file_get_contents("http://www.cryptocoinrank.com/$coin->name");
    //  	if($data)
    //  	{
    // 	 	$b = preg_match('/Algo: <span class=\"d-gray\">(.*)<\/span>/', $data, $m);
    // 	 	if($b)
    // 	 	{
    // 	 		$coin->errors = trim($m[1]);
    // 			$coin->save();
    // 	 	}
    //  	}
}
开发者ID:Bitcoinsulting,项目名称:yiimp,代码行数:48,代码来源:rawcoins.php

示例12: doBleutradeTrading

function doBleutradeTrading($quick = false)
{
    $flushall = rand(0, 4) == 0;
    if ($quick) {
        $flushall = false;
    }
    //	debuglog("-------------- dobleutradeTrading() flushall $flushall");
    $orders = bleutrade_api_query('market/getopenorders');
    if (!$orders) {
        return;
    }
    foreach ($orders->result as $order) {
        $e = explode('_', $order->Exchange);
        $symbol = $e[0];
        /// "Exchange" : "LTC_BTC",
        $pair = $order->Exchange;
        $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol));
        if (!$coin) {
            continue;
        }
        if ($coin->dontsell) {
            continue;
        }
        $ticker = bleutrade_api_query('public/getticker', "&market={$pair}");
        if (!$ticker || !$ticker->success || !isset($ticker->result[0])) {
            continue;
        }
        $ask = bitcoinvaluetoa($ticker->result[0]->Ask);
        $sellprice = bitcoinvaluetoa($order->Price);
        // flush orders not on the ask
        if ($ask + 5.0E-8 < $sellprice || $flushall) {
            //			debuglog("bleutrade cancel order $order->Exchange $sellprice -> $ask");
            bleutrade_api_query('market/cancel', "&orderid={$order->OrderId}");
            $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $order->OrderId));
            if ($db_order) {
                $db_order->delete();
            }
            sleep(1);
        } else {
            $db_order = getdbosql('db_orders', "uuid=:uuid", array(':uuid' => $order->OrderId));
            if ($db_order) {
                continue;
            }
            debuglog("bleutrade adding order {$coin->symbol}");
            //	$ticker = bleutrade_api_query('public/getticker', "&market=$pair");
            //	$sellprice = bitcoinvaluetoa($ticker->result->Ask);
            $db_order = new db_orders();
            $db_order->market = 'bleutrade';
            $db_order->coinid = $coin->id;
            $db_order->amount = $order->Quantity;
            $db_order->price = $sellprice;
            $db_order->ask = $ticker->result[0]->Ask;
            $db_order->bid = $ticker->result[0]->Bid;
            $db_order->uuid = $order->OrderId;
            $db_order->created = time();
            $db_order->save();
        }
    }
    // flush obsolete orders
    $list = getdbolist('db_orders', "market='bleutrade'");
    foreach ($list as $db_order) {
        $coin = getdbo('db_coins', $db_order->coinid);
        if (!$coin) {
            continue;
        }
        $found = false;
        foreach ($orders->result as $order) {
            if ($order->OrderId == $db_order->uuid) {
                $found = true;
                break;
            }
        }
        if (!$found) {
            debuglog("bleutrade deleting order {$coin->name} {$db_order->amount}");
            $db_order->delete();
        }
    }
    // 	if($flushall)
    // 	{
    //		debuglog("bleutrade flushall got here");
    // 		return;
    // 	}
    sleep(2);
    // add orders
    $balances = bleutrade_api_query('account/getbalances');
    //	debuglog($balances);
    if (!$balances || !isset($balances->result) || !$balances->success) {
        return;
    }
    $savebalance = getdbosql('db_balances', "name='bleutrade'");
    $savebalance->balance = 0;
    foreach ($balances->result as $balance) {
        if ($balance->Currency == 'BTC') {
            $savebalance->balance = $balance->Available;
            continue;
        }
        $amount = floatval($balance->Available);
        if (!$amount) {
            continue;
        }
//.........这里部分代码省略.........
开发者ID:Excalibur201010,项目名称:yiimp,代码行数:101,代码来源:bleutrade_trading.php

示例13: BackendUsersUpdate

function BackendUsersUpdate()
{
    $t1 = microtime(true);
    $list = getdbolist('db_accounts', "coinid is null or coinsymbol != ''");
    foreach ($list as $user) {
        //	debuglog("testing user $user->username, $user->coinsymbol");
        if (!empty($user->coinsymbol)) {
            $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $user->coinsymbol));
            $user->coinsymbol = '';
            if ($coin) {
                if ($user->coinid == $coin->id) {
                    $user->save();
                    continue;
                }
                $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
                $b = $remote->validateaddress($user->username);
                if ($b && isset($b['isvalid']) && $b['isvalid']) {
                    if ($user->balance > 0) {
                        $coinref = getdbo('db_coins', $user->coinid);
                        if (!$coinref) {
                            $coinref = getdbosql('db_coins', "symbol='BTC'");
                        }
                        $user->balance = $user->balance * $coinref->price / $coin->price;
                    }
                    $user->coinid = $coin->id;
                    $user->save();
                    debuglog("{$user->username} set to {$coin->symbol}, balance {$user->balance}");
                    continue;
                }
            }
        }
        $user->coinid = 0;
        $coins = getdbolist('db_coins', "enable order by difficulty desc");
        foreach ($coins as $coin) {
            $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport);
            $b = $remote->validateaddress($user->username);
            if (!$b || !isset($b['isvalid']) || !$b['isvalid']) {
                continue;
            }
            $user->balance = 0;
            $user->coinid = $coin->id;
            debuglog("{$user->username} set to {$coin->symbol}, balance {$user->balance}");
            break;
        }
        $user->save();
    }
    //	$delay=time()-60*60;
    // 	$list = dborun("update coins set dontsell=1 where id in (select coinid from accounts where balance>0 or last_login>$delay group by coinid)");
    // 	$list = dborun("update coins set dontsell=0 where id not in (select coinid from accounts where balance>0 or last_login>$delay group by coinid)");
    // 	$list = getdbolist('db_workers', "dns is null");
    // 	foreach($list as $worker)
    // 	{
    // 		$worker->dns = $worker->ip;
    // 		$res = system("resolveip $worker->ip");
    // 		if($res)
    // 		{
    // 			$a = explode(' ', $res);
    // 			if($a && isset($a[5]))
    // 				$worker->dns = $a[5];
    // 		}
    // 		$worker->save();
    // 	}
    $d1 = microtime(true) - $t1;
    controller()->memcache->add_monitoring_function(__METHOD__, $d1);
}
开发者ID:zarethernet,项目名称:yaamp,代码行数:65,代码来源:users.php

示例14: showPageHeader

function showPageHeader()
{
    echo "<div class='tabmenu-out'>";
    echo "<div class='tabmenu-inner'>";
    //	echo "&nbsp;&nbsp;&nbsp;&nbsp;<a href='/'>Yet Another Anonymous Mining Pool</a>";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $action = controller()->action->id;
    $wallet = user()->getState('yaamp-wallet');
    $ad = isset($_GET['address']);
    showItemHeader(controller()->id == 'site' && $action == 'index' && !$ad, '/', 'Home');
    showItemHeader($action == 'mining', '/site/mining', 'Pool');
    showItemHeader(controller()->id == 'site' && ($action == 'index' || $action == 'wallet') && $ad, "/?address={$wallet}", 'Wallet');
    showItemHeader(controller()->id == 'stats', '/stats', 'Graphs');
    showItemHeader($action == 'miners', '/site/miners', 'Miners');
    showItemHeader(controller()->id == 'renting', '/renting', 'Rental');
    if (controller()->admin) {
        //		debuglog("admin {$_SERVER['REMOTE_ADDR']}");
        //		$algo = user()->getState('yaamp-algo');
        showItemHeader(controller()->id == 'explorer', '/explorer', 'Explorers');
        //		showItemHeader(controller()->id=='coin', '/coin', 'Coins');
        showItemHeader($action == 'common', '/site/common', 'Admin');
        showItemHeader(controller()->id == 'site' && $action == 'admin', "/site/admin", 'List');
        //		showItemHeader(controller()->id=='renting' && $action=='admin', '/renting/admin', 'Jobs');
        //		showItemHeader(controller()->id=='trading', '/trading', 'Trading');
        //		showItemHeader(controller()->id=='nicehash', '/nicehash', 'Nicehash');
    }
    echo "<span style='float: right;'>";
    $mining = getdbosql('db_mining');
    $nextpayment = date('H:i', $mining->last_payout + YAAMP_PAYMENTS_FREQ);
    echo "<span style='font-size: .8em;'>Next Payout: {$nextpayment} EUST</span>";
    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&copy; yiimp.ccminer.org</span>";
    echo "</div>";
    echo "</div>";
}
开发者ID:Excalibur201010,项目名称:yiimp,代码行数:34,代码来源:main.php

示例15: actionRental_stop

 public function actionRental_stop()
 {
     $key = getparam('key');
     $renter = getdbosql('db_renters', "apikey=:apikey", array(':apikey' => $key));
     if (!$renter) {
         return;
     }
     $jobid = getparam('jobid');
     $job = getdbo('db_jobs', $jobid);
     if ($job->renterid != $renter->id) {
         return;
     }
     $job->ready = false;
     $job->time = time();
     $job->save();
 }
开发者ID:zarethernet,项目名称:yaamp,代码行数:16,代码来源:ApiController.php


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