|
@@ -25,14 +25,19 @@ void WorldController::show(const QString &pk)
|
|
render();
|
|
render();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void WorldController::queries()
|
|
|
|
+{
|
|
|
|
+ queries("1");
|
|
|
|
+}
|
|
|
|
+
|
|
void WorldController::queries(const QString &num)
|
|
void WorldController::queries(const QString &num)
|
|
{
|
|
{
|
|
QList<QVariantMap> worlds;
|
|
QList<QVariantMap> worlds;
|
|
- int d = num.toInt();
|
|
|
|
|
|
+ int d = qMin(qMax(num.toInt(), 1), 500);
|
|
|
|
+
|
|
for (int i = 0; i < d; ++i) {
|
|
for (int i = 0; i < d; ++i) {
|
|
int id = Tf::random(9999) + 1;
|
|
int id = Tf::random(9999) + 1;
|
|
- World world = World::get(id);
|
|
|
|
- worlds << world.toVariantMap();
|
|
|
|
|
|
+ worlds << World::get(id).toVariantMap();
|
|
}
|
|
}
|
|
setContentType("application/json; charset=UTF-8");
|
|
setContentType("application/json; charset=UTF-8");
|
|
renderText(jsonEncode(worlds), false);
|
|
renderText(jsonEncode(worlds), false);
|
|
@@ -124,9 +129,11 @@ void WorldController::updates(const QString &num)
|
|
{
|
|
{
|
|
QList<QVariantMap> worlds;
|
|
QList<QVariantMap> worlds;
|
|
int d = num.toInt();
|
|
int d = num.toInt();
|
|
|
|
+ World world;
|
|
|
|
+
|
|
for (int i = 0; i < d; ++i) {
|
|
for (int i = 0; i < d; ++i) {
|
|
int id = Tf::random(9999) + 1;
|
|
int id = Tf::random(9999) + 1;
|
|
- World world = World::get(id);
|
|
|
|
|
|
+ world = World::get(id);
|
|
world.setRandomNumber( Tf::random(9999) + 1 );
|
|
world.setRandomNumber( Tf::random(9999) + 1 );
|
|
world.update();
|
|
world.update();
|
|
worlds << world.toVariantMap();
|
|
worlds << world.toVariantMap();
|