You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

64 lines
2.1 KiB

using Sog;
using Sog.Log;
using System.Collections.Generic;
using ProtoCSStruct;
namespace Version
{
public class IosReviewCheckAlertSvc
{
private static HashSet<string> reviewIpSet = new HashSet<string>();
//这个是为了防止运营那边没通知版本服务器修改审核服务器指向就直接对外了,告警,免得事态扩大,造成大损失
public static void DoCheck(ref CSVersionCheckReq req, string ip)
{
VersionSvc m_versionSvc = VersionMsgHandler.GetInstance().GetVersionSvcObj();
ServerApp m_app = VersionMsgHandler.GetInstance().GetApp();
string os = req.Version.Os.GetString();
if(os != "ios")
{
return;
}
m_versionSvc.SelectGateUrl(ip, ref req, out var forReview);
if(forReview == 0)
{
return;
}
long currVer = m_versionSvc.GetCurrentVersion(ref req.Version, false);
long currdebugVer = m_versionSvc.GetCurrentVersion(ref req.Version, true);
//如果debug版本和正式版本不一致,表示正在停服测试或者维护,则不判断
if(currVer != currdebugVer)
{
return;
}
//apk版本肯定得和最新的版本一致
long apkVersion = AppVersion.ToIntVersion(req.ApkVersion.GetString());
if(apkVersion != currVer)
{
return;
}
if(reviewIpSet.Contains(ip))
{
return;
}
reviewIpSet.Add(ip);
int alertCountConfig = VersionServerUtils.GetServerConfig().alertIosReviewClientIpCount;
if (alertCountConfig > 0 && reviewIpSet.Count > alertCountConfig)
{
string message = string.Format("fetal error:VersionServer ios review ip count {0}!", reviewIpSet.Count);
TraceLog.Error(message);
m_app.Alerter.AlertMsg(message, 300, false);
}
}
}
}