WIP Contracts 2024-06-05

This commit is contained in:
Frank Schubert
2024-06-05 16:26:19 +02:00
parent 2855a45208
commit 51d2f7717a
5 changed files with 104 additions and 43 deletions

View File

@@ -15,8 +15,50 @@ $me = new User(1);
define("INTERNAL_USER_ID", $me->id);
define("INTERNAL_USER_USERNAME", $me->username);
$block = new Voicenumberblock(2);
$free = $block->getFreeNumbers();
$chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
$charsLength = strlen($chars);
echo implode("\n", $free);
echo "\n";
$c = 0;
$db = FronkDB::singleton();
$res = $db->query("SELECT id FROM Preorder WHERE oaid IS NOT NULL ORDER BY RAND()");
/*while($data = $db->fetch_object($res)) {
if($c > 1000) break;
$preorder = new Preorder($data->id);
if(!$preorder->oaid) {
echo "no oaid ".$preorder->id."\n";
}
$oaid = $preorder->oaid;
$ucode = '';
for($i = 0; $i < 20; $i++) {
$ucode .= $chars[rand(0, $charsLength - 1)];
}
echo "$oaid;$ucode\n";
$c++;
}*/
$stati = PreorderstatusModel::getAll();
while($data = $db->fetch_object($res)) {
if($c > 1000) break;
$preorder = new Preorder($data->id);
if(!$preorder->oaid) {
echo "no oaid ".$preorder->id."\n";
}
$oaid = $preorder->oaid;
$r = rand(0, count($stati)-1);
$new_status = $stati[$r];
if(!$new_status->code) {
fwrite(STDERR, "status not found\n");
continue;
}
echo "$oaid;".$new_status->code."\n";
$c++;
}