<!DOCTYPE html>
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>内容安全评估报告</title>
	<style>
		@page {
			size: A4 portrait;
		}

		p {
			margin: 0;
		}

		table td {
			border-bottom-color: #000000;
			border-bottom-style: solid;
			border-bottom-width: 0.75pt;
			border-left-color: #000000;
			border-left-style: solid;
			border-left-width: 0.75pt;
			border-right-color: #000000;
			border-right-style: solid;
			border-right-width: 0.75pt;
			border-top-color: #000000;
			border-top-style: solid;
			border-top-width: 0.75pt;
			padding: 8px;
			vertical-align: middle;
		}

		.logo {
			width: 158px;
			height: 160px;
			margin: 0 auto;
		}

		.ellipsis {
			display: inline-block;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
	</style>
</head>

<body>
	<a style="display:none;" id="request_token_head" token="{{session[g.get_csrf_html_token_key]}}"></a>
	<div style="width: 840px; margin: 0 auto;">
		<div class="content">
			<p style="text-align: center; padding-top: 112pt">
				<span style="font-family: MicrosoftYaHei-Bold; font-size: 32pt; font-weight: bold">堡塔安全 </span><span
					style="font-family: MicrosoftYaHei-Bold; font-size: 32pt; font-weight: bold">"</span><span
					style="font-family: MicrosoftYaHei-Bold; font-size: 32pt; font-weight: bold">内容</span><span
					style="font-family: MicrosoftYaHei-Bold; font-size: 32pt; font-weight: bold">安全系统"</span>
			</p>
			<p style="text-align: center">
				<span style="font-family: MicrosoftYaHei-Bold; font-size: 32pt; font-weight: bold">内容</span><span
					style="font-family: MicrosoftYaHei-Bold; font-size: 32pt; font-weight: bold">安全</span><span
					style="font-family: MicrosoftYaHei-Bold; font-size: 32pt; font-weight: bold">评估报告</span>
			</p>
			<p style="text-align: center; margin-top: 126pt">
				<img class="logo"
					src="data:image/png;base64, "></img>
			</p>
			<p style="margin-top: 200pt; text-align: center">
				<span style="font-family: 微软雅黑; font-size: 20pt">报表生成时间 </span>
				<span class="report_time" style="font-family: 微软雅黑; font-size: 20pt">--</span>
			</p>
			<p style="margin-top: 40pt; padding-bottom: 1px; text-align: center; border-bottom: 1px solid #000;"></p>
		</div>
		<div class="content">
			<p style="margin-top: 40pt; margin-bottom: 22pt; text-align: center">
				<span style="font-family: 黑体; font-size: 22pt">目录</span>
			</p>
			<p style="text-align: center;">
			<div style="display: flex; font-family: 微软雅黑; font-size: 12pt">
				<span>1 参考标准</span>
				<span style="flex: 1; width: 0; margin: 0 12pt; overflow: hidden; white-space: nowrap;">
					········································································································································································································
				</span>
				<span>3</span>
			</div>
			</p>
			<p style="text-align: center;  margin-top: 16pt;">
			<div style="display: flex; font-family: 微软雅黑; font-size: 12pt">
				<span>2 网站概括</span>
				<span style="flex: 1; width: 0; margin: 0 12pt; overflow: hidden; white-space: nowrap;">
					········································································································································································································
				</span>
				<span>4</span>
			</div>
			</p>
			<p style="text-align: center;  margin-top: 16pt;">
			<div style="display: flex; font-family: 微软雅黑; font-size: 12pt">
				<span>3 风险信息</span>
				<span style="flex: 1; width: 0; margin: 0 11pt; overflow: hidden; white-space: nowrap;">
					········································································································································································································
				</span>
				<span>5</span>
			</div>
			</p>
			<p style="text-align: center;  margin-top: 16pt;">
			<div style="display: flex; font-family: 微软雅黑; font-size: 12pt">
				<span>4 被修改网页信息</span>
				<span style="flex: 1; width: 0; margin: 0 11pt; overflow: hidden; white-space: nowrap;">
					········································································································································································································
				</span>
				<span>6</span>
			</div>
			</p>
		</div>
		<div class="content">
			<p style="margin-bottom: 1em;">
				<span style="font-family: 黑体; font-size: 15pt; font-weight: bold">1 参考标准</span>
			</p>
			<p style="margin-bottom: 21px">
				<span style="font-size: 12pt; font-weight: bold">1.1 单一关键词等级评分标准</span>
			</p>
			<table cellspacing="0" cellpadding="0" style="border-collapse: collapse; margin-left: 0pt; width: 100%">
				<tr style="height: 25.65pt">
					<td style="background-color: #4f81bd; width: 126.7pt">
						<p style="font-size: 10pt; line-height: 150%;"><span
								style="color: #ffffff; font-size: 10pt; font-style: normal; font-weight: bold;">危险程度</span></p>
					</td>
					<td style="background-color: #4f81bd; width: 148.75pt">
						<p style="font-size: 10pt; line-height: 150%;"><span
								style="color: #ffffff; font-size: 10pt; font-style: normal; font-weight: bold;">危险值区域</span></p>
					</td>
					<td style="background-color: #4f81bd; width: 139.05pt">
						<p style="font-size: 10pt; line-height: 150%;"><span
								style="color: #ffffff; font-size: 10pt; font-style: normal; font-weight: bold;">危险程度说明</span></p>
					</td>
				</tr>
				<tr style="height: 25.65pt">
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="color: #ff0000; font-size: 10pt; font-style: normal; font-weight: bold;">高</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">扣10分</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10.5pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">存涉政关键词,国家领导人</span>
						</p>
					</td>
				</tr>
				<tr style="height: 25.65pt">
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="color: #ffc000; font-size: 10pt; font-style: normal; font-weight: bold;">中</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">扣5分</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">色情、赌博风险关键词</span>
						</p>
					</td>
				</tr>
				<tr style="height: 27.25pt">
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="color: #92d050; font-size: 10pt; font-style: normal; font-weight: bold;">低</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">扣3分</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">黑灰产、水军、自定义词</span>
						</p>
					</td>
				</tr>
			</table>
			<p style="margin: 21px 0">
				<span style="font-size: 12pt; font-weight: bold">1.2 网站内容评分标准明细（初始分值100分）</span>
			</p>
			<table cellspacing="0" cellpadding="0" style="border-collapse: collapse; margin-left: 0pt; width: 100%">
				<tr style="height: 25.65pt">
					<td style="background-color: #4f81bd; width: 126.7pt">
						<p style="font-size: 10pt; line-height: 150%;"><span
								style="color: #ffffff; font-size: 10pt; font-style: normal; font-weight: bold;">危险程度</span></p>
					</td>
					<td style="background-color: #4f81bd; width: 148.75pt">
						<p style="font-size: 10pt; line-height: 150%;"><span
								style="color: #ffffff; font-size: 10pt; font-style: normal; font-weight: bold;">危险值区域</span></p>
					</td>
				</tr>
				<tr style="height: 25.65pt">
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="color: #ff0000; font-size: 10pt; font-style: normal; font-weight: bold;">非常危险</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">小于80分</span>
						</p>
					</td>
				</tr>
				<tr style="height: 25.65pt">
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="color: #ff0000; font-size: 10pt; font-style: normal; font-weight: bold;">危险</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">80~84分</span>
						</p>
					</td>
				</tr>
				<tr style="height: 27.25pt">
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="color: #ffc000; font-size: 10pt; font-style: normal; font-weight: bold;">存在风险</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">85~97分</span>
						</p>
					</td>
				</tr>
				<tr style="height: 27.25pt">
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="color: #92d050; font-size: 10pt; font-style: normal; font-weight: bold;">未发现风险</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt; line-height: 150%;">
							<span style="font-size: 10pt; font-style: normal;">98~100分</span>
						</p>
					</td>
				</tr>
			</table>
		</div>
		<div class="content">
			<p style="margin-bottom: 1em;">
				<span style="font-family: 黑体; font-size: 15pt; font-weight: bold">2 网站概括</span>
			</p>
			<table cellspacing="0" cellpadding="0" style="border-collapse: collapse; margin-left: 0pt; width: 100%">
				<tr>
					<td style="width: 198.35pt;">
						<p style="font-size: 10pt;">
							<span class="site_rating_title"
								style="font-size: 10pt; font-style: normal; font-weight: bold;">网站内容评分</span>
						</p>
					</td>
					<td>
						<p style="font-size: 10pt;">
							<span class="site_rating_value"
								style="color: #ff0000; font-size: 10pt; font-style: normal; font-weight: bold;">--</span>
						</p>
					</td>
				</tr>
				<tr>
					<td>
						<p>
							<span style="font-size: 10pt; font-style: normal;">网站域名</span>
						</p>
					</td>
					<td style="width: 203pt">
						<p>
							<span class="site_name" style="color: #0000ff; font-size: 10pt; font-style: normal;">--</span>
						</p>
					</td>
				</tr>
				<tr>
					<td>
						<p><span style="font-size: 10pt; font-style: normal;">扫描URL总数</span></p>
					</td>
					<td style="width: 203pt">
						<p><span class="scans_total" style="font-size: 10pt; font-style: normal;">0</span></p>
					</td>
				</tr>
				<tr>
					<td>
						<p><span style="font-size: 10pt; font-style: normal;">发现风险数量</span></p>
					</td>
					<td style="width: 203pt">
						<p><span class="risk_num" style="font-size: 10pt; font-style: normal;">0</span></p>
					</td>
				</tr>
				<tr>
					<td>
						<p><span style="font-size: 10pt; font-style: normal;">扫描发起时间</span></p>
					</td>
					<td style="width: 203pt">
						<p>
							<span class="start_time" style="font-size: 10pt; font-style: normal;">--</span>
						</p>
					</td>
				</tr>
				<tr>
					<td>
						<p><span style="font-size: 10pt; font-style: normal;">扫描结束时间</span></p>
					</td>
					<td style="width: 203pt">
						<p>
							<span class="end_time" style="font-size: 10pt; font-style: normal;">--</span>
						</p>
					</td>
				</tr>
				<tr>
					<td>
						<p><span style="font-size: 10pt; font-style: normal;">关键词模板</span></p>
					</td>
					<td style="width: 203pt">
						<p>
							<span style="font-size: 10pt; font-style: normal;">默认关键词,自定义关键词</span>
						</p>
					</td>
				</tr>
				<tr>
					<td>
						<p><span style="font-size: 10pt; font-style: normal;">风险评分</span></p>
					</td>
					<td style="width: 203pt">
						<p>
							<span class="risk_rating_value" style="font-size: 10pt; font-style: normal;">--</span>
						</p>
					</td>
				</tr>
			</table>
		</div>
		<div class="content">
			<p style="margin-bottom: 21pt">
				<span style="font-family: 黑体; font-size: 15pt; font-weight: bold">3 风险信息</span>
			</p>
			<table id="risk-table" cellspacing="0" cellpadding="0"
				style="border-collapse: collapse; margin-left: 0pt; width: 100%">
				<thead>
					<tr>
						<td colspan="5">
							<p style="text-align: center">
								<span style="font-size: 10.5pt; font-style: normal; font-weight: bold;">本机网站扫描</span>
							</p>
						</td>
					</tr>
					<tr>
						<td style="background-color: #4f81bd;">
							<span style="color: #ffffff; font-size: 12px; font-style: normal; font-weight: bold;">风险url</span>
						</td>
						<td style="background-color: #4f81bd; width: 50px;">
							<span style="color: #ffffff; font-size: 12px; font-style: normal; font-weight: bold;">关键词</span>
						</td>
						<td style="background-color: #4f81bd; width: 50px;">
							<span style="color: #ffffff; font-size: 12px; font-style: normal; font-weight: bold;">关键词类型</span>
						</td>
						<td style="background-color: #4f81bd; width: 100px;">
							<span style="color: #ffffff; font-size: 12px; font-style: normal; font-weight: bold;">发现时间</span>
						</td>
						<td style="background-color: #4f81bd; width: 50px;">
							<span style="color: #ffffff; font-size: 12px; font-style: normal; font-weight: bold;">风险评分</span>
						</td>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td colspan="5">
							<p style="text-align: center;">
								<span style="font-size: 8pt; font-style: normal;">暂无数据</span>
							</p>
						</td>
					</tr>
				</tbody>
			</table>
			<p style="margin-top: 120pt; margin-bottom: 22pt;">
				<span style="font-family: 黑体; font-size: 15pt; font-weight: bold">4 被修改网页信息</span>
			</p>
			<table id="update-table" cellspacing="0" cellpadding="0" style="border-collapse: collapse; width: 100%">
				<thead>
					<tr>
						<td colspan="5">
							<p style="text-align: center">
								<span style="font-size: 10.5pt; font-style: normal; font-weight: bold;">本机网站扫描</span>
							</p>
						</td>
					</tr>
					<tr>
						<td style="background-color: #4f81bd; width: 110px;">
							<span style="color: #ffffff; font-size: 8pt; font-style: normal; font-weight: bold;">更改位置</span>
						</td>
						<td style="background-color: #4f81bd;">
							<span style="color: #ffffff; font-size: 8pt; font-style: normal; font-weight: bold;">url</span>
						</td>
						<td style="background-color: #4f81bd;">
							<span style="color: #ffffff; font-size: 8pt; font-style: normal; font-weight: bold;">更改前的内容</span>
						</td>
						<td style="background-color: #4f81bd;">
							<span style="color: #ffffff; font-size: 8pt; font-style: normal; font-weight: bold;">更改后的内容</span>
						</td>
						<td style="background-color: #4f81bd; width: 140px;">
							<span style="color: #ffffff; font-size: 8pt; font-style: normal; font-weight: bold;">发现时间</span>
						</td>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td colspan="5">
							<p style="text-align: center;">
								<span style="font-size: 8pt; font-style: normal;">暂无数据</span>
							</p>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
	<script src="{{g.cdn_url}}/js/jquery-2.2.4.min.js"></script>
	<script type="text/javascript" src="{{g.cdn_url}}/layer/layer.js?version={{g['version']}}"></script>
	<script>
		window.vite_public_request_token = '{{session[g.get_csrf_html_token_key]}}' // csrf_token，用于请求
		$(function () {
			//获取当前页面的url
			var url = window.location.href;
			//获取当前页面的url中的参数
			var id = url.split("?")[1].split("=")[1];

			function resize() {
				$('.content').css({
					'min-height': $(window).height() + 'px'
				});
			}


			function getDpi() {
				for (var i = 56; i < 2000; i++) {
					if (matchMedia("(max-resolution: " + i + "dpi)").matches === true) {
						return i;
					}
				}
			}

			resize();

			if (id) {
				$.ajax({
					url: '/project/content/get_report',
					type: 'POST',
					data: {
						data: JSON.stringify({
							testing_id: id
						})
					},
					headers: {
						'x-http-token': window.vite_public_request_token
					},
					success: function (res) {
						renderInfo(res);
						renderRisk(res.risk);
						renderUpdate(res.risk_update);
					},
					error: function (err) {
						console.log('Error:', err);
					}
				});
				// $.post('/project/content/get_report', {
				// 	data: JSON.stringify({
				// 		testing_id: id
				// 	})
				// }, function (res) {
				// 	renderInfo(res);
				// 	renderRisk(res.risk);
				// 	renderUpdate(res.risk_update);
				// })
			}

			function renderInfo(res) {
				var info = res.info;
				setStatus(res.score);
				$('.site_name').text(info.site_name);
				$('.start_time').text(format_date(info.start_time));
				$('.end_time').text(format_date(info.end_time));
				$('.scans_total').text(info.scans);
				$('.risk_num').text(info.risks);
				$('.report_time').text(format_date(info.end_time + 60));
			}

			function renderRisk(risk) {
				if (risk && risk.length > 0) {
					var tbody = '';
					$.each(risk, function (i, item) {
						if (i >= 80) return;
						var score = getScore(item.risk_content);
						tbody += '\
						<tr>\
							<td style="width: 380px;">\
								<div style="display: flex; width: 100%;">\
									<a class="ellipsis" href="' + item.url +
							'" target="_blank" style="width: 0; flex: 1; color: #0000ff; font-size: 8pt; font-style: normal;" title="' +
							item.url + '">' + item.url + '</a>\
								</div>\
							</td>\
							<td>\
								<span style="font-size: 8pt; font-style: normal;">' + item.content + '</span>\
							</td>\
							<td>\
								<span style="font-size: 8pt; font-style: normal;">' + item.risk_content + '</span>\
							</td>\
							<td>\
								<span style="font-size: 8pt; font-style: normal;">' + format_date(item.time) + '</span>\
							</td>\
							<td>\
								<span style="font-size: 8pt; font-style: normal; color: #f0ad4e;">-' + score + '</span>\
							</td>\
						</tr>';
					});
					$('#risk-table tbody').html(tbody);
				}
			}

			function renderUpdate(risk) {
				if (risk && risk.length > 0) {
					var tbody = '';
					$.each(risk, function (i, item) {
						var typeMap = {
							title: '标题',
							body: '网页内',
							keywords: '关键词',
							descriptions: '描述',
							title_update: '标题更新',
							keywords_update: '关键词更新',
							description_update: '描述更新',
							tail_hash_update: '尾部script代码块更新',
							title_hash_update: '头部head代码块更新',
						}
						var baseUrl = '/www/server/panel/class/projectModel/content/source/';
						if (item.risk_type === 'title_hash_update' || item.risk_type === 'tail_hash_update') {
							baseUrl = '/www/server/panel/class/projectModel/content/hash/' + item.site_name + '/';
						}
						var type = typeMap[item.risk_type];
						var bPath = baseUrl + item.source_content_file;
						var nPath = baseUrl + item.new_content_file;
						tbody += '\
						<tr>\
							<td>\
								<span style="font-size: 8pt; font-style: normal;">' + type + '</span>\
							</td>\
							<td>\
								<a class="ellipsis" href="' + item.url +
							'" target="_blank" style="width: 130px; color: #0000ff; font-size: 8pt; font-style: normal;" title="' +
							item.url + '">' + item.url + '</a>\
							</td>\
							<td>\
								<span class="ellipsis" style="width: 180px; font-size: 8pt; font-style: normal;" title="' + bPath + '">' +
							bPath + '</span>\
							</td>\
							<td>\
								<span class="ellipsis" style="width: 180px; font-size: 8pt; font-style: normal;" title="' + nPath + '">' +
							nPath + '</span>\
							</td>\
							<td>\
								<span style="font-size: 8pt; font-style: normal;">' + format_date(item.time) + '</span>\
							</td>\
						</tr>';
					});
					$('#update-table tbody').html(tbody);
				}
			}

			function setStatus(score) {
				var tips = '未发现风险';
				var color = '#20a53a';
				if (score < 80) {
					tips = '非常危险';
					color = '#ff0000';
				} else if (score >= 80 && score < 85) {
					tips = '危险';
					color = '#ff0000';
				} else if (score >= 85 && score < 97) {
					tips = '存在风险';
					color = '#f0ad4e';
				}
				$('.site_rating_value').text(tips + '(' + score + '分)')
				$('.site_rating_value').css('color', color);
				$('.site_rating_title').css('color', color);
				$('.risk_rating_value').text(score);
				$('.risk_rating_value').css('color', color);
			}

			function getScore(type) {
				if (type == '国家领导人' || type == '涉政') return 10;
				if (type == '色情' || type == '赌博') return 5;
				return 3;
			}

			function format_date(tm, format) {
				if (format == undefined) format = "yyyy/MM/dd hh:mm:ss";
				tm = tm.toString();
				if (tm.length > 10) {
					tm = tm.substring(0, 10);
				}
				var data = new Date(parseInt(tm) * 1000);
				var o = {
					"M+": data.getMonth() + 1, //month
					"d+": data.getDate(), //day
					"h+": data.getHours(), //hour
					"m+": data.getMinutes(), //minute
					"s+": data.getSeconds(), //second
					"q+": Math.floor((data.getMonth() + 3) / 3), //quarter
					"S": data.getMilliseconds() //millisecond
				}
				if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
					(data.getFullYear() + "").substr(4 - RegExp.$1.length));
				for (var k in o)
					if (new RegExp("(" + k + ")").test(format))
						format = format.replace(RegExp.$1,
							RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));

				return format;
			}

		});
	</script>
</body>

</html>