这里是以闪亮之名WIKI(建设中)
~本WIKI编辑权限开放,欢迎收藏起来防止迷路~
编辑帮助留言反馈


全站通知:

模块:首页时间

来自以闪亮之名WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

此模块的文档可以在模块:首页时间/doc创建

local p={}

function p.isleap(year)
	if (year%100~=0 and year%4==0 or year%400==0) then
		-- mw.log("true")
		return true
	else
		-- mw.log("false")
		return false
	end
end

function p.info(frame)
	
	if (frame==nil) then
		frame = mw.getCurrentFrame()
	end
	
	-- 当前时间信息
	local wkday = {"周日","周一","周二","周三","周四","周五","周六"}
	local gamedate = os.date("*t", os.time() - 4*60*60) --当前时间往前4小时,对应凌晨四点刷新日期
	local dmonth = gamedate["month"]
	local dday = gamedate["day"]
	local dwkday = gamedate["wday"]
	local text_date = [['''现在是:]]..dmonth..[[月]]..dday..[[日 ]]..wkday[dwkday]..[[''']]
	-- text_date = text_date.."  "..gamedate["hour"].."时"..gamedate["min"].."分"
	
	-- 生日祝福
	local text_birthday = frame:callParserFunction{name = '#Widget:生日祝福'}
	
	-- 以下代码用于输出结果,不要删
	-- local result = text_date..text_birthday.."<hr>"..text_material.."<hr>"..text_exchange
	local result = text_date
	mw.log(result)
	return result
end

function p.activity(frame)

	if (frame==nil) then
		frame = mw.getCurrentFrame()
	end
	local nowdate = os.date("%Y/%m/%d %H:%M", os.time())
	local expdate = os.date("%Y/%m/%d %H:%M", os.time()+5*24*3600) --提前五天预告活动开始
	local act_data = frame:callParserFunction{name="#ask:[[分类:活动信息]][[开始时间::<"..expdate.."]][[结束时间::>"..nowdate.."]]",args={
		"?开始描述",
		"?结束描述",
		"?开始时间#-F[Y-m-d H:i]",
		"?结束时间#-F[Y-m-d H:i]",
		format="template",
		template="首页活动/行",
		sort="开始时间,结束时间",
		order="desc",
		link="none",
		userparam=nowdate}}
	mw.log(act_data)
	return act_data
end

function p.rtime(frame)
	local nowdate = os.date("%Y-%m-%d %H:%M", os.time())
	mw.log(nowdate)
	return nowdate
end

return p