2022-06-06 21:30:34 +00:00
|
|
|
|
<?php
|
2022-12-30 19:03:37 +00:00
|
|
|
|
|
|
|
|
|
use Core\Db;
|
|
|
|
|
|
|
|
|
|
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'autoload.php';
|
|
|
|
|
|
2022-08-11 10:38:38 +00:00
|
|
|
|
/**
|
|
|
|
|
* CRON <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><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> 2 <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> 50% <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><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><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><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><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><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
2022-12-30 19:03:37 +00:00
|
|
|
|
*
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|
|
|
|
*
|
2022-08-11 10:38:38 +00:00
|
|
|
|
* @author Ivor Barhansky <me@lopar.space>
|
2022-12-30 19:03:37 +00:00
|
|
|
|
* @todo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> cshop_returnToOwner.
|
|
|
|
|
* @todo <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> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><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><EFBFBD><EFBFBD><EFBFBD>?
|
2022-08-11 10:38:38 +00:00
|
|
|
|
*/
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2022-08-11 10:38:38 +00:00
|
|
|
|
const TIME_LAST = 86400; // 1 day
|
|
|
|
|
const AUC = '<span style="color: #009966;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></span>';
|
|
|
|
|
const AUC_WIN = '<27><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "%s" <20><> <b>%s <20><>.</b> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.';
|
|
|
|
|
const AUC_SELL = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "%s" <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <b>%s</b> <20><>. <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>.';
|
|
|
|
|
const AUC_SELL_LOG = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "%s" <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <b>%s <20><></b>.';
|
|
|
|
|
const AUC_NOT_SELL = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "%s" <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.';
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2022-08-11 10:38:38 +00:00
|
|
|
|
$query = [ //all queries
|
|
|
|
|
'insert into chat (new, login, `to`, text, time, type) values (1, ?, ?, ?, unix_timestamp(), 6)',
|
|
|
|
|
'select * from items_auc where time_end = 0 and time < unix_timestamp() - ? order by user_buy',
|
|
|
|
|
'select login from users where id = ?',
|
|
|
|
|
'select count(*) from users where id = ?',
|
|
|
|
|
'update items_users set uid = ?, lastUPD = unix_timestamp() where (id = ? or inGroup = ?) and uid = 0',
|
|
|
|
|
'insert into items_users (`delete`, item_id, 1price, uid, lastUPD, `data`) values (0, 1220, ?, ?, unix_timestamp(), ?)',
|
|
|
|
|
'insert into post (uid, sender_id, time, money, text) values (?, 0, unix_timestamp(), ?, ?)',
|
|
|
|
|
'update items_auc set time_end = unix_timestamp() where id = ?',
|
|
|
|
|
];
|
2022-06-06 21:30:34 +00:00
|
|
|
|
|
2022-08-11 10:38:38 +00:00
|
|
|
|
$sp = Db::getRow($query[1], [TIME_LAST]);
|
|
|
|
|
foreach ($sp as $pl) {
|
|
|
|
|
if ($pl['x'] > 0) {
|
|
|
|
|
$pl['name'] .= ' (x' . $pl['x'] . ')';
|
|
|
|
|
}
|
|
|
|
|
$userLogin = Db::getValue($query[2], [$pl['uid']]);
|
|
|
|
|
if ($pl['user_buy'] && Db::getValue($query[3], [$pl['user_buy']])) {
|
|
|
|
|
Db::sql($query[4], [$pl['user_buy'], $pl['item_id'], $pl['item_id']]);
|
|
|
|
|
Db::sql($query[0], [AUC, $pl['user_buy'], sprintf(AUC_WIN, $pl['name'], $pl['price'])]);
|
|
|
|
|
if ($userLogin) {
|
|
|
|
|
Db::sql($query[0], [AUC, $userLogin, sprintf(AUC_SELL, $pl['name'], $pl['price'])]);
|
|
|
|
|
Db::sql($query[5], [$pl['price'], '-51' . $pl['uid'], '']);
|
|
|
|
|
Db::sql($query[6], [$pl['uid'], $pl['price'], sprintf(AUC_SELL_LOG, $pl['name'], $pl['price'])]);
|
|
|
|
|
}
|
|
|
|
|
} elseif ($userLogin) {
|
|
|
|
|
Db::sql($query[4], [$pl['uid'], $pl['item_id'], $pl['item_id']]);
|
|
|
|
|
Db::sql($query[0], [AUC, $userLogin, sprintf(AUC_NOT_SELL, $pl['name'])]);
|
|
|
|
|
}
|
|
|
|
|
Db::sql($query[7], [$pl['id']]);
|
2022-06-06 21:30:34 +00:00
|
|
|
|
}
|