-- 海外微端上报
local Msg = require("core.Msg")
local Util = require("common.Util")
local PfLogic = require("platform.PfLogic")

function login(human)
	if not PfLogic.isHaiwaiWeiduan(human) then
		return
	end
	local msgRet = Msg.gc.GC_HWWD_REPORT
	msgRet.type = "login"
	local day = Util.diffDay(human.db.createTime)
	msgRet.param1 = day+1
	msgRet.param2 = 0
	msgRet.param3 = ""
	Msg.send(msgRet,human.fd)
end

function register(human)
	if not PfLogic.isHaiwaiWeiduan(human) then
		return
	end
	local msgRet = Msg.gc.GC_HWWD_REPORT
	msgRet.type = "register"
	msgRet.param1 = 0
	msgRet.param2 = 0
	msgRet.param3 = ""
	Msg.send(msgRet,human.fd)
end

function charge(human, orderID, amount)
	if not PfLogic.isHaiwaiWeiduan(human) then
		return
	end
	
	local msgRet = Msg.gc.GC_HWWD_REPORT
	msgRet.type = "charge"
	msgRet.param1 = amount
	msgRet.param2 = 0
	msgRet.param3 = ""
	if human.db.buyHis then
		local totalAmount = 0
		for k,v in ipairs(human.db.buyHis) do
			totalAmount = totalAmount + v.money
		end
		msgRet.param2 = totalAmount
		msgRet.param3 = human.db.buyHis[#human.db.buyHis].buyID..""
	end
	Msg.send(msgRet,human.fd)
end