game/cron/comission.php
2022-06-07 00:30:34 +03:00

46 lines
2.4 KiB
PHP

<?php
define('GAME',true);
setlocale(LC_CTYPE ,"ru_RU.CP1251");
include('/home/newcom1/public_html/_incl_data/__config.php');
include('/home/newcom1/public_html/_incl_data/class/__db_connect.php');
include('/home/newcom1/public_html/_incl_data/class/__user.php');
/*
CRON Êîìèññèîííîãî ìàãàçèíà
Äåéñòâèÿ:
1. Åñëè ïðåäìåò âèñèò óæå 2 è áîëåå íåäåëü, ïðîäàâàòü ïðåäìåò çà 50% îò åãî ñòîèìîñòè ñ ó÷åòîì èçíîñà
äåíüãè îòñûëàþòñÿ íà ïî÷òó.
*/
$time_last = 86400 * 6; //2 íåäåëè
$sp = mysql_query('SELECT * FROM `items_users` WHERE `inShop` = 30');
while( $pl = mysql_fetch_array($sp) )
{
$i = mysql_fetch_array(mysql_query('SELECT `im`.`price1`,`im`.`name`,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "'.$pl['id'].'" AND `iu`.`inShop` = "30" AND `iu`.`delete` = "0" LIMIT 1'));
if( isset($i['inGroup']) AND $i['inGroup'] > 0 )
{
$col = $u->itemsX($i['id']);
if($col > 1)
{
mysql_query('UPDATE `items_users` SET `inShop` = 0, `1price` = "'.$i['price1'].'" WHERE `item_id`="'.$i['item_id'].'" AND `inShop` = "30" AND `uid`="'.$i['uid'].'" AND `inGroup` = "'.$i['inGroup'].'" LIMIT '.$col.'');
$ld = $u->addDelo(1,$i['uid'],'&quot;<font color=#C65F00>Shop.capitalcity</font>&quot;: Âîçâðàò èç êîìèññèîííîãî ìàãàçèíà ïðåäìåò: [id="'.$i['item_id'].'"/ Íàçâàíèå : "'.$i['name'].'"/ Öåíà : "'.$i['price1'].'"/ Ãðóïåðîâàííî : "'.$i['inGroup'].'+1"].',time(),$u->info['city'],'Shop.comission',0,0);
}
else
{
mysql_query('UPDATE `items_users` SET `inShop` = 0, `1price` = "'.$i['price1'].'" WHERE `uid` = "'.$pl['uid'].'" AND `id` = "'.$pl['id'].'" AND `inOdet` = "0" AND `delete` = "0" ');
$ld = $u->addDelo(1,$i['uid'],'&quot;<font color=#C65F00>Shop.capitalcity</font>&quot;: Âîçâðàò èç êîìèññèîííîãî ìàãàçèíà ïðåäìåò: [id="'.$i['item_id'].'"/ Íàçâàíèå : "'.$i['name'].'"/ Öåíà : "'.$i['price1'].'"].',time(),$u->info['city'],'Shop.comission',0,0);
}
}
else
{
mysql_query('UPDATE `items_users` SET `inShop` = 0, `1price` = "'.$i['price1'].'" WHERE `id` = "'.$pl['id'].'" and `inShop` = "30" LIMIT 1');
$ld = $u->addDelo(1,$i['uid'],'&quot;<font color=#C65F00>Shop.capitalcity</font>&quot;: Âîçâðàò èç êîìèññèîííîãî ìàãàçèíà ïðåäìåò: [id="'.$i['item_id'].'"/ Íàçâàíèå : "'.$i['name'].'"/ Öåíà : "'.$i['price1'].'"].',time(),$u->info['city'],'Shop.comission',0,0);
}
}
?>