mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
refactor: setMovementProc() to take one or multiple IDs for update
This commit is contained in:
@@ -982,14 +982,19 @@ class Automation {
|
||||
}
|
||||
$q1 = "SELECT send, moveid, `to`, wood, clay, iron, crop, `from` FROM ".TB_PREFIX."movement WHERE proc = 0 and sort_type = 2 and endtime < $time";
|
||||
$dataarray1 = $database->query_return($q1);
|
||||
$completedIDs = [];
|
||||
foreach($dataarray1 as $data1) {
|
||||
$database->setMovementProc($data1['moveid']);
|
||||
$completedIDs[] = $data1['moveid'];
|
||||
if($data1['send'] > 1){
|
||||
$targettribe1 = $tribes[$data1['to']];
|
||||
$send = $data1['send']-1;
|
||||
$this->sendResource2($data1['wood'],$data1['clay'],$data1['iron'],$data1['crop'],$data1['to'],$data1['from'],$targettribe1,$send);
|
||||
}
|
||||
}
|
||||
|
||||
// updated processed records
|
||||
$database->setMovementProc(implode(', ', $completedIDs));
|
||||
|
||||
if(file_exists("GameEngine/Prevention/market.txt")) {
|
||||
unlink("GameEngine/Prevention/market.txt");
|
||||
}
|
||||
|
||||
@@ -3562,9 +3562,11 @@ class MYSQLi_DB implements IDbConnection {
|
||||
}
|
||||
|
||||
function setMovementProc($moveid) {
|
||||
list($moveid) = $this->escape_input((int) $moveid);
|
||||
if (!Math::isInt($moveid)) {
|
||||
list($moveid) = $this->escape_input($moveid);
|
||||
}
|
||||
|
||||
$q = "UPDATE " . TB_PREFIX . "movement set proc = 1 where moveid = $moveid";
|
||||
$q = "UPDATE " . TB_PREFIX . "movement set proc = 1 where moveid IN($moveid)";
|
||||
return mysqli_query($this->dblink,$q);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user