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
<?php
include_once "../../../Common/CommFunc.php";
include_once "../../../Common/Logging.php";
include_once '../../../Common/MongoDB7.php';
include_once "errorCode.php";
 
\Logging\CreateLogging("syncLocalDataToServer.php");
 
$code = $_POST['code'];
$openid = $_POST['openid'];
$gamename = $_POST['gamename'];
$playerData = json_decode($_POST['playerData'], true);
\Logging\LogInfo('_POST: ' . print_r($_POST, true));
\Logging\LogInfo('playerData: ' . print_r($playerData, true));
 
 
// 验证同步更新权限等...
 
 
if ($playerData) {
    $playerData['syncDataTime'] = date("Y-m-d H:i:s", time());
    \Logging\LogInfo('更新玩家社交信息 openid=' . $openid . '  playerData=' . print_r($playerData, true));
    $gameconfig = parse_ini_file("config/" . $gamename . ".ini", true);
    $dbOpt = new \MongoDB7\MongoDb("Player", $gameconfig["db"]);
    $where = ['openid' => $openid];
    $modCount = $dbOpt->update($where, $playerData);
    \Logging\LogInfo('更新条数: ' . $modCount);
}
$ret = ErrorCode::retOK();
echo json_encode($ret);