| | |
| | | echo "no appID";
|
| | | exit();
|
| | | }
|
| | | logweb("开始导入:" . $Channel);
|
| | | logweb("开始导入:" . $Channel . " opt:" . $opt);
|
| | | if (array_key_exists("reset", $_GET)) {
|
| | | logweb("重置重新导出:" . $Channel);
|
| | | $AccountFirstLoginOK = \DBOper\Remove("AccountFirstLogin", array("Channel" => $Channel));
|
| | |
| | | }
|
| | | if (!$opt || $opt == "day") {
|
| | | logweb("daydaydaydayday:" . $Channel);
|
| | | impAccountDayActive();
|
| | | impAccountDayActive("rar");
|
| | | // impAccountDayActiveTestData();
|
| | | }
|
| | | if (!$opt || $opt == "rep") {
|
| | | logweb("repreprepreprep:" . $Channel);
|
| | | // 重导日活、重刷报表;前提是先试用 /Server/eventdata/ImportBakDailyActive.py 运行导出中心流向备档日活数据结果保存到json文件
|
| | | if ($opt == "reDayActive") {
|
| | | $AccountDayActiveOK = \DBOper\Remove("AccountDayActive", array("Channel" => $Channel));
|
| | | logweb("AccountDayActiveOK:" . $AccountDayActiveOK);
|
| | | impAccountDayActive("json");
|
| | | }
|
| | | if (!$opt || $opt == "rep" || $opt == "reDayActive") {
|
| | | logweb("开始导出每日报表:" . $Channel);
|
| | | if ($opt == "reDayActive") {
|
| | | $DailyReportOK = \DBOper\Remove("DailyReport", array("Channel" => $Channel));
|
| | | $AccountFirstLoginReportOK = \DBOper\Remove("AccountFirstLoginReport", array("Channel" => $Channel));
|
| | | $AccountFirstPayReportOK = \DBOper\Remove("AccountFirstPayReport", array("Channel" => $Channel));
|
| | | $eventYMDOK = \DBOper\Remove("ServerEvent", array("Key" => "FirstKeepReportYMD_" . $Channel));
|
| | | logweb("DailyReportOK:" . $DailyReportOK);
|
| | | logweb("AccountFirstLoginReportOK:" . $AccountFirstLoginReportOK);
|
| | | logweb("AccountFirstPayReportOK:" . $AccountFirstPayReportOK);
|
| | | logweb("eventYMDOK:" . $eventYMDOK);
|
| | | }
|
| | | \Report\CheckAndExportDailyReport($Channel);
|
| | | logweb("开始导出留存报表:" . $Channel);
|
| | | \Report\CheckAndExportFirstKeepReport($Channel);
|
| | | }
|
| | | logweb("处理完毕!");
|
| | |
| | | echo "<hr/>";
|
| | | }
|
| | |
|
| | | function impAccountDayActive()
|
| | | function impAccountDayActive($bakWay = "")
|
| | | {
|
| | | global $Channel;
|
| | | $startDate = $_GET["startDate"];
|
| | |
| | |
|
| | | $allDateAccIDInfo = array(); // 所有记录
|
| | | // 查询备份流向
|
| | | $pack_data = array();
|
| | | $pack_data["spID"] = $Channel;
|
| | | $pack_data["eventType"] = "QueryAccountLoginOut";
|
| | | $pack_data["queryCenterbak"] = 1; # 设置查询中心的
|
| | | $pack_data["allServer"] = 1; # 设置检索所有服务器流向
|
| | | $pack_data["startDate"] = $startDate;
|
| | | $pack_data["endDate"] = "";
|
| | | $centerToolUrl = 'http://' . $_SERVER['HTTP_HOST'] . "/Server/eventdata/toolcenter.php";
|
| | | logweb("centerToolUrl:" . $centerToolUrl);
|
| | | if ($bakWay == "rar") {
|
| | | $pack_data = array();
|
| | | $pack_data["spID"] = $Channel;
|
| | | $pack_data["eventType"] = "QueryAccountLoginOut";
|
| | | $pack_data["queryCenterbak"] = 1; # 设置查询中心的
|
| | | $pack_data["allServer"] = 1; # 设置检索所有服务器流向
|
| | | $pack_data["startDate"] = $startDate;
|
| | | $pack_data["endDate"] = "";
|
| | | $centerToolUrl = 'http://' . $_SERVER['HTTP_HOST'] . "/Server/eventdata/toolcenter.php";
|
| | | logweb("centerToolUrl:" . $centerToolUrl);
|
| | |
|
| | | $retStr = \CommFunc\DoPost($centerToolUrl, $pack_data, false, 300);
|
| | | $ret = json_decode($retStr, true);
|
| | | if (isset($ret)) {
|
| | | $allDateAccIDInfo = $ret[0];
|
| | | ksort($allDateAccIDInfo);
|
| | | foreach ($allDateAccIDInfo as $dateStr => $accIDInfo) {
|
| | | logweb("中心流向备档日活数量:" . " dateStr:" . $dateStr . " count:" . count($accIDInfo));
|
| | | // foreach ($accIDInfo as $accID => $loginoutInfo) {
|
| | | // logweb(" accID:" . $accID. json_encode($loginoutInfo));
|
| | | // }
|
| | | $retStr = \CommFunc\DoPost($centerToolUrl, $pack_data, false, 300);
|
| | | $ret = json_decode($retStr, true);
|
| | | if (isset($ret)) {
|
| | | $allDateAccIDInfo = $ret[0];
|
| | | } else {
|
| | | logweb("query center backup error: " . $retStr);
|
| | | return;
|
| | | }
|
| | | } else {
|
| | | logweb("query center backup error: " . $retStr);
|
| | | } elseif ($bakWay == "json") {
|
| | | if (!\CommFunc\GetConfig("ServerInfo", "PlayerCenterRoot", $PlayerCenterRoot)) {
|
| | | return "";
|
| | | }
|
| | | $jsonFile = $PlayerCenterRoot . "/Server/eventdata/BakDailyActive.json";
|
| | | logweb("jsonFile:" . $jsonFile);
|
| | | if (!file_exists($jsonFile)) {
|
| | | logweb("###jsonFile is not exists:" . $jsonFile);
|
| | | return;
|
| | | }
|
| | | $allDateAccIDInfo = json_decode(file_get_contents($jsonFile), true);
|
| | | }
|
| | | if (!isset($allDateAccIDInfo)) {
|
| | | logweb("###center bak AccountDayActive error.");
|
| | | return;
|
| | | }
|
| | | ksort($allDateAccIDInfo);
|
| | | foreach ($allDateAccIDInfo as $dateStr => $accIDInfo) {
|
| | | logweb("中心流向备档日活数量:" . " dateStr:" . $dateStr . " count:" . count($accIDInfo));
|
| | | }
|
| | |
|
| | | logweb("开始从子服导入日活数据! startDate:" . $startDate);
|
| | |
| | |
|
| | | ksort($allDateAccIDInfo);
|
| | | foreach ($allDateAccIDInfo as $dateStr => $accIDInfo) {
|
| | | logweb("最终日活数量:" . " dateStr:" . $dateStr . " count:" . count($accIDInfo));
|
| | | logweb("日活游戏账号数量:" . " dateStr:" . $dateStr . " count:" . count($accIDInfo));
|
| | | $accountIDArray = array();
|
| | | $dateInsInfo = array();
|
| | | foreach ($accIDInfo as $accID => $loginoutInfo) {
|
| | | // logweb(" accID:" . $accID. json_encode($loginoutInfo));
|
| | |
| | | $ActiveYMD = substr($LogoffTime, 0, 10);
|
| | | }
|
| | |
|
| | | if ($accountIDArray[$AccountID]) {
|
| | | logweb("###今日日活账号已存在:AccountID:" . $$AccountID . " accID:" . $accID);
|
| | | continue;
|
| | | }
|
| | | $accountIDArray[$AccountID] = 1;
|
| | | array_push($dateInsInfo, array(
|
| | | "Channel" => $Channel,
|
| | | "AccountID" => $AccountID,
|