134 lines
3.7 KiB
PHP
134 lines
3.7 KiB
PHP
|
<?php
|
|||
|
|
|||
|
use Core\Db;
|
|||
|
|
|||
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
|||
|
|
|||
|
/**
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
*/
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$ub = [];
|
|||
|
$ui = [];
|
|||
|
|
|||
|
$payOperations = Db::getRows('select * from pay_operation where good > 0 order by id desc');
|
|||
|
foreach ($payOperations as $operation) {
|
|||
|
if (!isset($ub[$operation['uid']])) {
|
|||
|
$ui[] = $operation['uid'];
|
|||
|
}
|
|||
|
$ub[$operation['uid']][date('d.m.Y', $operation['good'])] = $operation['ekr'];
|
|||
|
}
|
|||
|
|
|||
|
// <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>?!
|
|||
|
foreach ($ui as $item) {
|
|||
|
if (!$item) {
|
|||
|
continue;
|
|||
|
}
|
|||
|
$k = 0;
|
|||
|
$nj = 0;
|
|||
|
for ($i = 0; $i <= 1000; $i++) {
|
|||
|
$date = date('d.m.Y', time() - (86400 * $i));
|
|||
|
if (isset($ub[$item][$date])) {
|
|||
|
$k++;
|
|||
|
$nj = 0;
|
|||
|
} elseif ($i > 0 && $nj >= 6) {
|
|||
|
$j = 1000;
|
|||
|
} else {
|
|||
|
$nj++;
|
|||
|
}
|
|||
|
}
|
|||
|
Db::sql('replace into users_paybonus (id, level) values (?,?)', [$item, $k]);
|
|||
|
}
|
|||
|
|
|||
|
$log_list = [];
|
|||
|
$add_exp_list = [];
|
|||
|
$all_exp_list = [];
|
|||
|
$exp_list = [];
|
|||
|
$win_list = [];
|
|||
|
$global_exp = 0;
|
|||
|
|
|||
|
Db::sql('delete from aaa_reting_list where date = ?', [date('dmY')]);
|
|||
|
|
|||
|
$users = Db::getRows(
|
|||
|
'
|
|||
|
select
|
|||
|
stats.id,
|
|||
|
login,
|
|||
|
users.win as uwin,
|
|||
|
stats.exp as sexp,
|
|||
|
repexp,
|
|||
|
aaa_reting_list.exp as aexp,
|
|||
|
global,
|
|||
|
exp_real
|
|||
|
from users
|
|||
|
left join stats on stats.id = users.id
|
|||
|
left join aaa_reting_list on users.id = uid
|
|||
|
where `real` = 1 and admin = 0 and bot = 0
|
|||
|
'
|
|||
|
);
|
|||
|
foreach ($users as $user) {
|
|||
|
$exp_list[$user['id']] = $user['sexp'];
|
|||
|
$win_list[$user['id']] = $user['uwin'];
|
|||
|
$log_list[$user['id']] = $user['login'];
|
|||
|
$add_exp = $user['sexp'];
|
|||
|
|
|||
|
if (idate('d') !== 1) { //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<><31> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$global_exp = round($user['global']);
|
|||
|
}
|
|||
|
|
|||
|
$global_exp = $global_exp + round($user['repexp']);
|
|||
|
$add_exp_list[$user['id']] = $add_exp; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$all_exp_list[$user['id']] = $global_exp;// + $add_exp; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> + <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
arsort($all_exp_list);
|
|||
|
|
|||
|
$keys = array_keys($all_exp_list);
|
|||
|
|
|||
|
$i = 0;
|
|||
|
foreach ($keys as $key) {
|
|||
|
if (!$key) {
|
|||
|
continue;
|
|||
|
}
|
|||
|
$i++;
|
|||
|
Db::sql(
|
|||
|
'insert into aaa_reting_list (uid, pos, global, exp, exp_real, date, time, win) values (?,?,?,?,?,?,unix_timestamp(),?)',
|
|||
|
[
|
|||
|
$key,
|
|||
|
$i,
|
|||
|
$all_exp_list[$key],
|
|||
|
$add_exp_list[$key],
|
|||
|
$exp_list[$key],
|
|||
|
date('dmY'),
|
|||
|
$win_list[$key],
|
|||
|
]
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
$stmt = Db::prepare('update users set money2 = money2 + ? where id = ?');
|
|||
|
$stmt->execute([1, $keys[0]]);
|
|||
|
$stmt->execute([0.75, $keys[1]]);
|
|||
|
$stmt->execute([0.5, $keys[2]]);
|
|||
|
$stmt->execute([0.25, $keys[3]]);
|
|||
|
$stmt->execute([0.15, $keys[4]]);
|
|||
|
|
|||
|
Db::sql(
|
|||
|
'insert into chat (text, city, type, new, time) values
|
|||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
|||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
|||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
|||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
|||
|
(?,\'capitalcity\',6,1,unix_timestamp()),
|
|||
|
(?,\'capitalcity\',6,1,unix_timestamp())',
|
|||
|
[
|
|||
|
'<span style="color: red; font-weight: bold;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ' . date('d-m-Y') . ' </span>',
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD> ' . $log_list[0] . ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD>. <20><> 1-<2D> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD> ' . $log_list[1] . ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0.75 <20><><EFBFBD>. <20><> 2-<2D> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD> ' . $log_list[2] . ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0.5 <20><><EFBFBD>. <20><> 3-<2D> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD> ' . $log_list[3] . ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0.25 <20><><EFBFBD>. <20><> 4-<2D> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',
|
|||
|
'<27><><EFBFBD><EFBFBD><EFBFBD> ' . $log_list[4] . ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0.15 <20><><EFBFBD>. <20><> 5-<2D> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!',
|
|||
|
]
|
|||
|
);
|