hxp
2025-06-09 6c3f6335c70859ded94a1ad8d218acb0ac34239c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
 
include_once "../../../Common/CommFunc.php";
include_once "../../../Common/Logging.php";
include_once '../../../Common/MongoDB7.php';
 
\Logging\CreateLogging("queryWorldRankTestData.php");
 
$count = $_GET['count'];
$datas = [];
for ($i = 1; $i <= $count; $i++) {
    array_push($datas, array(
        "openid" => "testopenid" . $i,
        "nickName" => "测试玩家" . $i,
        "weekScore" => 5,
        "highestScore" => 6,
        "missionNum" => 7,
        "city" => "test",
    ));
}
 
if (!$datas) {
    echo "no insert data!";
    return;
}
 
$gamename = "mandown";
$gameconfig = parse_ini_file("config/" . $gamename . ".ini", true);
$dbOpt = new \MongoDB7\MongoDb("Player", $gameconfig["db"]);
$delCount = $dbOpt->delete(['city' => 'test'], 0);
echo "delCount: " . $delCount . "<br/>";
 
$dbOpt = new \MongoDB7\MongoDb("Player", $gameconfig["db"]);
$insCount = $dbOpt->insertbatch($datas);
echo "insCount: " . $insCount . "<br/>";
echo time();