mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
sql: rename account last_login to last_earning
this column name was confusing, add an index btw... beware with this commit, need mysql change + memcache restart
This commit is contained in:
parent
2a23f05b8f
commit
a338131f28
7 changed files with 17 additions and 12 deletions
7
sql/2016-04-03-accounts.sql
Normal file
7
sql/2016-04-03-accounts.sql
Normal file
|
@ -0,0 +1,7 @@
|
|||
-- Recent additions to add after db init (.gz)
|
||||
-- mysql yaamp -p < file.sql
|
||||
|
||||
ALTER TABLE `accounts` CHANGE COLUMN `last_login` `last_earning` INT(10) NULL;
|
||||
|
||||
ALTER TABLE `accounts` ADD INDEX `earning` (`last_earning` DESC);
|
||||
|
|
@ -51,7 +51,7 @@ function BackendBlockNew($coin, $db_block)
|
|||
if (!$earning->save())
|
||||
debuglog(__FUNCTION__.": Unable to insert earning!");
|
||||
|
||||
$user->last_login = time();
|
||||
$user->last_earning = time();
|
||||
$user->save();
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ function BackendRentingPayout()
|
|||
|
||||
// $value = yaamp_convert_amount_user($coin, $earning->amount, $user);
|
||||
|
||||
$user->last_login = time();
|
||||
$user->last_earning = time();
|
||||
$user->balance += $value;
|
||||
$user->save();
|
||||
}
|
||||
|
|
|
@ -323,7 +323,7 @@ function BackendStatsUpdate2()
|
|||
$tm = floor(time()/$step/60)*$step*60;
|
||||
$d = time()-24*60*60;
|
||||
|
||||
$list = getdbolist('db_accounts', "balance>0 or last_login>$d");
|
||||
$list = getdbolist('db_accounts', "balance>0 OR last_earning>$d");
|
||||
foreach($list as $user)
|
||||
{
|
||||
$stats = getdbosql('db_balanceuser', "time=$tm and userid=$user->id");
|
||||
|
|
|
@ -77,8 +77,8 @@ function BackendUsersUpdate()
|
|||
}
|
||||
|
||||
// $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 = dborun("UPDATE coins SET dontsell=1 WHERE id in (SELECT coinid FROM accounts WHERE balance>0 OR last_earning>$delay GROUP BY coinid)");
|
||||
// $list = dborun("UPDATE coins SET dontsell=0 WHERE id not in (SELECT coinid FROM accounts WHERE balance>0 OR last_earning>$delay GROUP BY coinid)");
|
||||
|
||||
|
||||
// $list = getdbolist('db_workers', "dns is null");
|
||||
|
|
|
@ -49,7 +49,7 @@ function showUser($userid, $what)
|
|||
$user = getdbo('db_accounts', $userid);
|
||||
if(!$user) return;
|
||||
|
||||
$d = datetoa2($user->last_login);
|
||||
$d = datetoa2($user->last_earning);
|
||||
$balance = bitcoinvaluetoa($user->balance);
|
||||
$paid = dboscalar("select sum(amount) from payouts where account_id=$user->id");
|
||||
$paid = bitcoinvaluetoa($paid);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
// PS: account last_login is not related to user logins... its the last backend payment loop, todo: rename it..
|
||||
|
||||
JavascriptFile("/yaamp/ui/js/jquery.metadata.js");
|
||||
JavascriptFile("/yaamp/ui/js/jquery.tablesorter.widgets.js");
|
||||
|
||||
|
@ -82,14 +80,14 @@ if (!empty($data)) foreach ($data as $row) {
|
|||
}
|
||||
|
||||
$list = getdbolist('db_accounts', "coinid!=6 $sqlFilter AND (".
|
||||
"balance > 0 OR last_login > (UNIX_TIMESTAMP()-60*60) OR id IN (SELECT DISTINCT account_id FROM payouts WHERE tx IS NULL)".
|
||||
") ORDER BY last_login DESC limit 50");
|
||||
"balance > 0 OR last_earning > (UNIX_TIMESTAMP()-60*60) OR id IN (SELECT DISTINCT account_id FROM payouts WHERE tx IS NULL)".
|
||||
") ORDER BY last_earning DESC limit 50");
|
||||
|
||||
$total = 0.; $totalimmat = 0.; $totalfailed = 0.;
|
||||
foreach($list as $user)
|
||||
{
|
||||
$coin = getdbo('db_coins', $user->coinid);
|
||||
$d = datetoa2($user->last_login);
|
||||
$d = datetoa2($user->last_earning);
|
||||
|
||||
echo '<tr class="ssrow">';
|
||||
|
||||
|
@ -145,4 +143,4 @@ if ($coin_id) {
|
|||
echo '<tr class="red"><th>Failed</th><td>'.bitcoinvaluetoa($totalfailed)." $symbol</td></tr>";
|
||||
echo '</tr></table>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue