【防沉迷】游戏内添加未成年人判断
parent
7d8bb2bc36
commit
17001dd7d8
|
@ -146,3 +146,23 @@ end
|
||||||
function PackageManager.GetCCCode()
|
function PackageManager.GetCCCode()
|
||||||
return ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.PACKAGE_CC_CODE) or ""
|
return ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.PACKAGE_CC_CODE) or ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取APPID
|
||||||
|
local AppIDConfig = {
|
||||||
|
["com.tcxsw.project"] = "6a7c5e329e565fbecb9761f4ebdff709",
|
||||||
|
["com.tcxkf.project"] = "6a7c5e329e565fbecb9761f4ebdff709",
|
||||||
|
["com.tcxxqcs.project"] = "6a7c5e329e565fbecb9761f4ebdff709",
|
||||||
|
["com.tcxxq.project"] = "2c3239afdb0c14631e8ad97b35e289d9",
|
||||||
|
["com.tcx.project"] = "4bffbf7342f2bbb161734e7b3fe30ffe",
|
||||||
|
["com.tcxzb.project"] = "4bffbf7342f2bbb161734e7b3fe30ffe",
|
||||||
|
["com.tcxttml.project"] = "2cf98795b423de90af647d369efd3419",
|
||||||
|
["com.tcxcsb.project"] = "2806a89515659caecc964d727dbd49c8",
|
||||||
|
["com.tcxcn.test"] = "a3ad5f4090d59aecc42332088987f83b",
|
||||||
|
["com.tcxcn.project"] = "a3ad5f4090d59aecc42332088987f83b",
|
||||||
|
["com.tcxqd.project"] = "d4263a2ed36fd2b34ab8fa23e1f95dea",
|
||||||
|
}
|
||||||
|
function PackageManager.GetAppID()
|
||||||
|
if AppIDConfig[this.PackageName] then
|
||||||
|
return AppIDConfig[this.PackageName]
|
||||||
|
end
|
||||||
|
end
|
|
@ -63,6 +63,8 @@ function this.Initialize()
|
||||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
-- 防沉迷检测
|
||||||
|
this.CheckRealName()
|
||||||
else
|
else
|
||||||
local errCode = result[2]
|
local errCode = result[2]
|
||||||
if not errCode then
|
if not errCode then
|
||||||
|
@ -92,8 +94,46 @@ function this.Initialize()
|
||||||
-- 发送登出事件
|
-- 发送登出事件
|
||||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLogout)
|
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLogout)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
end
|
||||||
|
local _Time
|
||||||
|
function this.CheckRealName()
|
||||||
|
local appId = PackageManager.GetAppID()
|
||||||
|
if appId then
|
||||||
|
local url = "http://identity.tyu89.wang/cp/nppa/loop"
|
||||||
|
local jsonData = string.format("appId;%s;userId;%s", appId, AppConst.OpenId)
|
||||||
|
networkMgr:SendHttpPost_Json_Lua(url, jsonData, function(msg)
|
||||||
|
local json = require 'cjson'
|
||||||
|
local context = json.decode(msg)
|
||||||
|
if context and context.code == 200 then
|
||||||
|
if context.data.allowPlay then
|
||||||
|
if context.data.needLoop then
|
||||||
|
-- 每隔60秒请求一次
|
||||||
|
if _Time then
|
||||||
|
_Time:Stop()
|
||||||
|
end
|
||||||
|
_Time = Timer.New(this.CheckRealName, 60)
|
||||||
|
_Time:Start()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if context.data.allowRemind then
|
||||||
|
MsgPanel.ShowOne(context.data.remindMessage, function()
|
||||||
|
if _Time then
|
||||||
|
_Time:Stop()
|
||||||
|
end
|
||||||
|
Game.Restart()
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
if _Time then
|
||||||
|
_Time:Stop()
|
||||||
|
end
|
||||||
|
Game.Restart()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
-- 检测是否是新账户
|
-- 检测是否是新账户
|
||||||
function this.CheckIsRegister(openId, func)
|
function this.CheckIsRegister(openId, func)
|
||||||
if func then
|
if func then
|
||||||
|
|
Loading…
Reference in New Issue