64 lines
1.5 KiB
PHP
64 lines
1.5 KiB
PHP
#!/usr/bin/php
|
|
<?php
|
|
|
|
//require 'vendor/autoload.php';
|
|
require("../config/config.php");
|
|
|
|
define('FRONKDB_SQLDEBUG',false);
|
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
|
|
|
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
|
|
|
$me = new User(1);
|
|
define("INTERNAL_USER_ID", $me->id);
|
|
define("INTERNAL_USER_USERNAME", $me->username);
|
|
|
|
$chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
|
|
$charsLength = strlen($chars);
|
|
|
|
$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++;
|
|
} |