<?php
|
include_once "../../../Common/CommFunc.php";
|
include_once "../../../Common/Logging.php";
|
include_once '../../../Common/MongoDB7.php';
|
|
\Logging\CreateLogging("socialUserInfo.php");
|
|
$openid = $_GET['openid'];
|
$gamename = $_GET['gamename'];
|
if (!$openid) {
|
\Logging\LogInfo('没有openid,不处理!');
|
return;
|
}
|
|
// 可更新的字段列表,只允许更新列表中字段
|
$fieldList = ["avatarUrl", "nickName", "gender", "country", "province", "city"];
|
|
$update = [];
|
foreach ($fieldList as $field) {
|
if (array_key_exists($field, $_GET)) {
|
$update[$field] = $_GET[$field];
|
}
|
}
|
|
if ($update) {
|
\Logging\LogInfo('更新玩家社交信息 openid=' . $openid . ' update=' . print_r($update, true));
|
$gameconfig = parse_ini_file("config/" . $gamename . ".ini", true);
|
$dbOpt = new \MongoDB7\MongoDb("Player", $gameconfig["db"]);
|
$where = ['openid' => $openid];
|
$modCount = $dbOpt->update($where, $update);
|
\Logging\LogInfo('更新条数: ' . $modCount);
|
} else {
|
\Logging\LogInfo('没有需要更新的社交信息');
|
}
|