首页SEO优化

This commit is contained in:
xiaoyang 2021-05-28 11:51:11 +08:00
parent 9de47ce697
commit d6c0337c09
52 changed files with 134 additions and 3278 deletions

View File

@ -55,7 +55,7 @@ public class NovelFilter implements Filter {
userMark = UUIDUtil.getUUID32();
CookieUtil.setCookie(resp,Constants.USER_CLIENT_MARK_KEY,userMark);
}
ThreadLocalUtil.setCientId(userMark);
ThreadLocalUtil.setClientId(userMark);
//根据浏览器类型选择前端模板
String to = req.getParameter("to");
CacheService cacheService = SpringUtil.getBean(CacheService.class);

View File

@ -41,7 +41,7 @@ public class ThreadLocalUtil {
/**
* 设置当前访问线程的客户端ID
* */
public static void setCientId(String id){
public static void setClientId(String id){
clientId.set(id);
}

View File

@ -77,7 +77,8 @@ public class PageController extends BaseController {
* 首页
*/
@RequestMapping(path = {"/", "/index", "/index.html"})
public String index() {
public String index(Model model) {
model.addAttribute("bookMap",bookService.listBookSettingVO());
return ThreadLocalUtil.getTemplateDir() + "index";
}

View File

@ -3,16 +3,6 @@ var UserPay = {
czPayPalData: [[20, "10000屋币"], [50, "25000屋币"], [100, "50000屋币"], [80, "全站包年阅读"]],
sendPay: function () {
$("#payform").submit();
},
GetPayState: function (payId) {
$.post("/api/book.aspx", { act: "getpaystatus", pid: payId }, function (data, textStatus) {
if (data == "1") {
location.href = '/pay/wx_return.aspx?out_trade_no=sc'+payId;
}
else {
setTimeout("UserPay.GetPayState("+payId+")",3000);
}
}, "html");
}
}
@ -46,20 +36,6 @@ $(function () {
$("#ulZFWXXJ").show();
}
var postUrl = "";
switch (type)
{
case "1":
postUrl = "sendalipay.aspx";
break;
case "2":
postUrl = "sendwxpaynowqr.aspx";
break;
case "3":
postUrl = "sendpaypal.aspx";
break;
}
$("#payform").attr("action", postUrl);
})
$("#ulZFWX li").click(function () {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

View File

@ -1,270 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Aspose.Words for .NET 15.1.0.0"/>
<title>RestTemplate中文乱码问题源码分析与解决</title></head>
<body>
<div><p style="font-size:18pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_499-1566046872517"></a><a
style="color:#003884" href="http://www.zinglizingli.xyz"><span
style="background-color:#ffffff; color:#003884; font-family:'Times New Roman'; font-size:18pt; font-weight:bold; text-decoration:underline">RestTemplate中文乱码问题源码分析与解决</span></a>
</p>
<p style="font-size:18pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_668-1566076102707"></a><span
style="background-color:#ffffff; color:#393939; font-family:'Times New Roman'; font-size:18pt; font-weight:bold">---  请求响应数据乱码源码原理分析</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_359-1566070296357"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_090-1566070299368"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="margin:0pt"><a name="_374-1566070299635"></a><span
style="background-color:#ffffff; color:#df402a; font-family:微软雅黑; font-size:15pt; font-weight:bold">============================原理===================</span>
</p>
<p style="margin:0pt"><a name="_115-1566075419335"></a><span
style="color:#7b5ba1; font-family:SimSun; font-size:11pt; font-style:italic">//默认方式</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_398-1566075426884"></a><span
style="color:#7b5ba1; font-family:SimSun; font-size:11pt; font-style:italic">//RestTemplate restTemplate = new RestTemplate();</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_535-1566075426884"></a><span
style="color:#7b5ba1; font-family:SimSun; font-size:11pt; font-style:italic">// 当返回的response-header的content-type属性有charset值时</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_832-1566075426884"></a><span
style="color:#7b5ba1; font-family:SimSun; font-size:11pt; font-style:italic">// restTemplate的 StringHttpMessageConverter会读取该charset值并使用该值进行</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_044-1566081046911"></a><span
style="color:#7b5ba1; font-family:SimSun; font-size:11pt; font-style:italic">//IO流 = 字符串的转换否则则使用默认的字符集</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_025-1566075590776"></a><span
style="color:#7b5ba1; font-family:SimSun; font-size:11pt; font-style:italic">// </span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_437-1566081514760"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_917-1566081515252"></a><span
style="color:#7b5ba1; font-family:SimSun; font-size:11pt; font-style:italic">通过源码可以发现restTemplate底层默认使用了</span><span
style="background-color:#ff0000; color:#ffffff; font-family:SimSun; font-size:11pt">HttpURLConnection</span><span
style="background-color:#ffffff; color:#7b5ba1; font-family:SimSun; font-size:11pt">可以支持其他多种http客户端,如httpclientokhttp等通过</span><span
style="background-color:#ffffff; color:#df402a; font-family:SimSun; font-size:11pt">工厂方法模式</span><span
style="background-color:#ffffff; color:#7b5ba1; font-family:SimSun; font-size:11pt">创建请求</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_345-1566082269458"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_991-1566082211397"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.001.png" width="553" height="144" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_880-1566082349718"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_793-1566082349718"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.002.png" width="553" height="345" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_565-1566082347503"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_974-1566082347716"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_859-1566082347902"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_055-1566082348093"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_542-1566081537855"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.003.png" width="553" height="277" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_721-1566075426884"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_131-1566077535593"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:0pt"><span
style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><a
name="_460-1566077535917"></a><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">restTemplate调用excute方法</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_598-1566077659788"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.004.png" width="553" height="271" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:0pt"><span
style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><a
name="_383-1566077653687"></a><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">restTemplate调用了doExecute方法</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_000-1566077736808"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.005.png" width="553" height="236" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:0pt"><span
style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><a
name="_340-1566077732786"></a><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">执行请求调用</span><span
style="background-color:#ffffff; color:#df402a; font-family:SimSun; font-size:11pt">ResponseExtractor </span><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">responseExtractor.extractData()对相应结果进行数据提取</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_150-1566078107678"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.006.png" width="553" height="382" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:0pt"><span
style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><a
name="_593-1566078099144"></a><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">调用</span><span
style="color:#df402a; font-family:'Times New Roman'; font-size:11pt">HttpMessageConverterExtractor </span><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">this.delegate.extractData()执行抽取数据的操作</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_666-1566078333273"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.007.png" width="553" height="285" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:0pt"><span
style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><a
name="_657-1566078289591"></a><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">获取response-header的content-type</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_561-1566078994408"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.008.png" width="553" height="316" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_699-1566078994408"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_240-1566078897012"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.009.png" width="553" height="303" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:0pt"><span
style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><a
name="_090-1566078895423"></a><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">判断消息转换器对应的支持媒体类型supportMediaType是否包含该content-type</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_470-1566079766383"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.010.png" width="553" height="275" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:0pt"><span
style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><a
name="_142-1566079701403"></a><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">调用第一个包含该content-type的</span><span
style="background-color:#ffffff; color:#df402a; font-family:SimSun; font-size:11pt">GenericHttpMessageConverter转换数据读取数据</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_247-1566080661650"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.011.png" width="553" height="247" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_813-1566080714156"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_896-1566080714156"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.012.png" width="553" height="308" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:0pt"><span
style="font:7.0pt 'Times New Roman'">&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; </span><a
name="_223-1566080677140"></a><span style="color:#df402a; font-family:'Times New Roman'; font-size:11pt">读取数据的时候会再一次获取</span><span
style="color:#df402a; font-family:SimSun; font-size:11pt; font-style:italic">response-header的content-type</span><span
style="color:#df402a; font-family:'Times New Roman'; font-size:11pt">的字符集</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:21pt"><a name="_092-1566080909997"></a><span
style="color:#df402a; font-family:'Times New Roman'; font-size:11pt">如果该字符集存在则使用该字符集进行 IO流 =字符串 转换</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_512-1566080804579"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.013.png" width="553" height="294" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_470-1566080966519"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_225-1566080966519"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.014.png" width="553" height="307" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_627-1566078282891"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_729-1566075429719"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_937-1566081177561"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="margin:0pt"><a name="_699-1566081177711"></a><span
style="color:#df402a; font-family:微软雅黑; font-size:15pt; font-weight:bold">案例</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_026-1566075429891"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_059-1566071031255"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.015.png" width="553" height="251" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:42pt"><a name="_176-1566070330576"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:42pt"><a name="_530-1566072661453"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_299-1566072723246"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.016.png" width="367" height="101" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:42pt"><a name="_671-1566072721602"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:12pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:42pt"><a name="_075-1566072855176"></a><span
style="color:#df402a; font-family:'Times New Roman'; font-size:12pt; font-weight:bold">响应头中并没有content-type的header照理说浏览器应该不知道服务端返回的输入流编码如果和浏览器默认的编码不匹配应该会出现乱码但是现在浏览器有编码自动识别功能所以上面的代码没有加content-type的Header也没有问题</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:42pt"><a name="_245-1566072658054"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt; text-indent:42pt"><a name="_872-1566072191117"></a><span
style="font-family:'Times New Roman'; font-size:11pt">          </span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_972-1566072692409"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.017.png" width="439" height="462" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_066-1566072088274"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_580-1566075732276"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_942-1566075732559"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="margin:0pt"><a name="_150-1566075732802"></a><span
style="color:#df402a; font-family:微软雅黑; font-size:15pt; font-weight:bold">实际上下面的做法更规范</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_139-1566072089816"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.018.png" width="553" height="188" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="margin:0pt"><a name="_337-1566070344498"></a><span
style="color:#df402a; font-family:微软雅黑; font-size:15pt; font-weight:bold">源码</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_773-1566073175445"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.019.png" width="553" height="366" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_074-1566085375320"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_689-1566085375320"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.020.png" width="553" height="222" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_837-1566085044019"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_120-1566085034872"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.021.png" width="553" height="127" alt="clipboard.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="margin:0pt"><a name="_080-1566073168924"></a><span style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span>
</p>
<p style="margin:0pt"><a name="_415-1566085038805"></a><span style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span>
</p>
<p style="margin:0pt"><a name="_122-1566085039048"></a><span
style="background-color:#ffffff; color:#df402a; font-family:微软雅黑; font-size:15pt; font-weight:bold">============================原理=====================</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_073-1566070331260"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_256-1566070331284"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_812-1566070331308"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_451-1566070331332"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_130-1566070331359"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_999-1566070331383"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_029-1566070331405"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_074-1566070331428"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_078-1566046874710"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_579-1566047010084"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.022.png" width="553" height="1"
alt="初探RestTemplate--解决中文乱码问题 - mryang125的博客 - CSDN博客.jpg"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_666-1566047010084"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p></div>
</body>
</html>

View File

@ -1,280 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Aspose.Words for .NET 15.1.0.0"/>
<title>服务器跨域处理</title></head>
<body>
<div><p style="margin:0pt"><a name="_073-1565689474241"></a><span
style="font-family:微软雅黑; font-size:15pt; font-weight:bold"><a href="http://m.zinglizingli.xyz">跨域处理</a></span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_011-1565689506880"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_400-1565689507090"></a><span
style="font-family:'Times New Roman'; font-size:11pt">跨域是什么浏览器从一个域名的网页去请求另一个域名的资源时域名端口 协议任一不同都是跨域 我们是采用前后端分离开发的也是前后端分离部署的必然会存在跨域问题 怎么解决跨域很简单只需要在controller类上添加注解 @CrossOrigin 即可这个注解其实是CORS的实现 </span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_460-1565689522680"></a><span
style="font-family:'Times New Roman'; font-size:11pt">CORS(Cross-Origin Resource Sharing, 跨源资源共享)是W3C出的一个标准其思 想是使用自定义的HTTP头部让浏览器与服务器进行沟通从而决定请求或响应是应该成 还是应该失败因此要想实现CORS进行跨域需要服务器进行一些设置同时前端也需要做一些配置和分析本文简单的对服务端的配置和前端的一些设置进行分析</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_845-1565689480275"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_065-1565689480471"></a><span
style="font-family:'Times New Roman'; font-size:11pt">1</span><span
style="color:#df402a; font-family:'Times New Roman'; font-size:11pt">在controller类上添加注解 @CrossOrigin表示Controller上的所以方法允许跨域在方法上添加注解 @CrossOrigin表示该方法允许跨域</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_231-1565689931759"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_436-1565689932017"></a><span
style="font-family:'Times New Roman'; font-size:11pt">@Target({ ElementType.METHOD, ElementType.TYPE })</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_134-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">@Retention(RetentionPolicy.RUNTIME)</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_249-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">@Documented</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_993-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">public @interface CrossOrigin {</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_860-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_082-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    String[] DEFAULT_ORIGINS = { "*" };</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_340-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_077-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    String[] DEFAULT_ALLOWED_HEADERS = { "*" };</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_080-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_672-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    boolean DEFAULT_ALLOW_CREDENTIALS = true;</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_262-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_435-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    long DEFAULT_MAX_AGE = 1800;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_682-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_040-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_925-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    /**</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_940-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * 同origins属性一样</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_047-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     */</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_939-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    @AliasFor("origins")</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_774-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    String[] value() default {};</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_570-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_575-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    /**</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_114-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * 所有支持域的集合例如"http://domain1.com"</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_373-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * &lt;p&gt;这些值都显示在请求头中的Access-Control-Allow-Origin</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_316-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * "*"代表所有域的请求都支持</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_011-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * &lt;p&gt;如果没有定义所有请求的域都支持</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_880-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * @see #value</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_783-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     */</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_681-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    @AliasFor("value")</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_042-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    String[] origins() default {};</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_140-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_747-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    /**</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_226-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * 允许请求头中的header默认都支持</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_485-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     */</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_047-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    String[] allowedHeaders() default {};</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_052-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_280-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    /**</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_742-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * 响应头中允许访问的header默认为空</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_186-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     */</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_068-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    String[] exposedHeaders() default {};</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_680-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_547-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    /**</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_089-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * 请求支持的方法例如"{RequestMethod.GET, RequestMethod.POST}"}</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_880-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * 默认支持RequestMapping中设置的方法</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_922-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     */</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_840-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    RequestMethod[] methods() default {};</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_090-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_066-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    /**</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_985-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * 是否允许cookie随请求发送使用时必须指定具体的域</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_972-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     */</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_119-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    String allowCredentials() default "";</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_127-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_478-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    /**</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_580-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     * 预请求的结果的有效期默认30分钟</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_510-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">     */</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_534-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">    long maxAge() default -1;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_743-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_586-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">}</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_052-1565689932796"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_129-1565689558428"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_873-1565689558663"></a><span
style="font-family:'Times New Roman'; font-size:11pt">2</span><span
style="color:#df402a; font-family:'Times New Roman'; font-size:11pt">配置 CorsFilter(全局配置)</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_025-1565690417616"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_510-1565690417783"></a><span
style="background-color:#ffffff; color:#808000; font-family:SimSun; font-size:11pt">@Configuration</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_314-1565690418407"></a><span
style="background-color:#ffffff; color:#000080; font-family:SimSun; font-size:11pt; font-weight:bold">public class </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">GlobalCorsConfig {</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_117-1565690418407"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_834-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">    </span><span
style="background-color:#ffffff; color:#808000; font-family:SimSun; font-size:11pt">@Bean</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_074-1565690418407"></a><span
style="background-color:#ffffff; color:#808000; font-family:SimSun; font-size:11pt">    </span><span
style="background-color:#ffffff; color:#000080; font-family:SimSun; font-size:11pt; font-weight:bold">public </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">CorsFilter corsFilter() {</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_037-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        </span><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">//1.添加CORS配置信息</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_231-1565690418407"></a><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">        </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">CorsConfiguration config = </span><span
style="background-color:#ffffff; color:#000080; font-family:SimSun; font-size:11pt; font-weight:bold">new </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">CorsConfiguration();</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_560-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        </span><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">//1) 允许的域,不要写*否则cookie就无法使用了</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_937-1565690418407"></a><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">        </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">config.addAllowedOrigin(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"http://manage.shop.com"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_288-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        config.addAllowedOrigin(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"http://www.shop.com"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_712-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        </span><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">//2) 是否发送Cookie信息</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_250-1565690418407"></a><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">        </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">config.setAllowCredentials(</span><span
style="background-color:#ffffff; color:#000080; font-family:SimSun; font-size:11pt; font-weight:bold">true</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_149-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        </span><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">//3) 允许的请求方式</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_028-1565690418407"></a><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">        </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">config.addAllowedMethod(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"OPTIONS"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_040-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        config.addAllowedMethod(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"HEAD"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_940-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        config.addAllowedMethod(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"GET"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_487-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        config.addAllowedMethod(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"PUT"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_065-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        config.addAllowedMethod(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"POST"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_034-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        config.addAllowedMethod(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"DELETE"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_286-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        config.addAllowedMethod(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"PATCH"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_584-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        </span><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">// 4允许的头信息</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_339-1565690418407"></a><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">        </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">config.addAllowedHeader(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"*"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_440-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        </span><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">// 5) 有效时长</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_023-1565690418407"></a><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">//        config.setMaxAge(3600L);</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_025-1565690418407"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_612-1565690418407"></a><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">        //2.添加映射路径我们拦截一切请求</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_816-1565690418407"></a><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">        </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">UrlBasedCorsConfigurationSource configSource = </span><span
style="background-color:#ffffff; color:#000080; font-family:SimSun; font-size:11pt; font-weight:bold">new </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">UrlBasedCorsConfigurationSource();</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_520-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        configSource.registerCorsConfiguration(</span><span
style="background-color:#ffffff; color:#008000; font-family:SimSun; font-size:11pt; font-weight:bold">"/**"</span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">, config);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_929-1565690418407"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_591-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">        </span><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">//3.返回新的CorsFilter.</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_259-1565690418407"></a><span
style="background-color:#ffffff; color:#808080; font-family:SimSun; font-size:11pt; font-style:italic">        </span><span
style="background-color:#ffffff; color:#000080; font-family:SimSun; font-size:11pt; font-weight:bold">return new </span><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">CorsFilter(configSource);</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_877-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">    }</span></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_415-1565690418407"></a><span
style="background-color:#ffffff; font-family:SimSun; font-size:11pt">}</span></p></div>
</body>
</html>

View File

@ -1,243 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<meta name="generator" content="Aspose.Words for .NET 15.1.0.0"/>
<title>对分布式事务的理解</title></head>
<body>
<div><p style="font-size:18pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_848-1565404932800"></a><a
style="color:#000000" href="http://www.zinglizingli.xyz"><span
style="background-color:#ffffff; font-family:Verdana; font-size:18pt">对分布式事务及两阶段提交和三阶段提交的理解</span></a></p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_635-1565404934953"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="margin:0pt 0pt 10pt"><a name="_338-1565404935257"></a><span
style="background-color:#ffffff; color:#008000; font-family:Verdana; font-size:16pt; font-weight:bold">分布式数据一致性</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_989-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">在分布式系统中为了保证数据的高可用通常会将数据保留多个副本(replica)这些副本会放置在不同的物理的机器上</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_565-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">1.什么是数据一致性</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_151-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">在数据有多份副本的情况下如果网络服务器或者软件出现故障会导致部分副本写入成功部分副本写入失败这就造成各个副本之间的数据不一致数据内容冲突</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_436-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">造成事实上的数据不一致</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_810-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">2.CAP定理</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_066-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">CAP理论认为在分布式的环境下设计和部署系统时有3个核心的需求</span>
</p>
<p style="font-size:12pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_928-1565405011043"></a><span
style="background-color:#ffffff; color:#800000; font-family:Verdana; font-size:12pt; font-weight:bold">ConsistencyAvailability和Partition Tolerance即CAP</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_842-1565405011043"></a><span
style="font-family:'Times New Roman'; font-size:11pt">&#xa0;</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_811-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">Consistency一致性这个和数据库ACID的一致性类似但这里关注的所有数据节点上的数据一致性和正确性而数据库的ACID关注的是在在一个事务内对数据的一些约束系统在执行过某项操作后仍然处于一致的状态在分布式系统中更新操作执行成功后所有的用户都应该读取到最新值</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_016-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">Availability可用性每一个操作总是能够在一定时间内返回结果需要注意一定时间返回结果一定时间是指系统结果必须在给定时间内返回返回结果是指系统返回操作成功或失败的结果</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_115-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">Partition Tolerance分区容忍性是否可以对数据进行分区这是考虑到性能和可伸缩性</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_237-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">3.数据一致性模型</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_943-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">一些分布式系统通过复制数据来提高系统的可靠性和容错性并且将数据的不同的副本存放在不同的机器</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_047-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">强一致性</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_172-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">当更新操作完成之后任何多个后续进程或者线程的访问都会返回最新的更新过的值这种是对用户最友好的就是用户上一次写什么下一次就保证能读到什么根据 CAP 理论这种实现需要牺牲可用性</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_182-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">弱一致性</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_317-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">系统并不保证续进程或者线程的访问都会返回最新的更新过的值用户读到某一操作对系统特定数据的更新需要一段时间我们称这段时间为不一致性窗口系统在数据写入成功之后不承诺立即可以读到最新写入的值也不会具体的承诺多久之后可以读到</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_443-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">最终一致性</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_483-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">是弱一致性的一种特例系统保证在没有后续更新的前提下系统最终返回上一次更新操作的值在没有故障发生的前提下不一致窗口的时间主要受通信延迟系统负载和复制副本的个数影响DNS 是一个典型的最终一致性系统</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_856-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">&#xa0;</span></p>
<p style="margin:0pt 0pt 10pt"><a name="_788-1565405011043"></a><span
style="background-color:#ffffff; color:#008000; font-family:Verdana; font-size:16pt; font-weight:bold">典型的分布式事务实例</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_082-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">跨行转账问题是一个典型的分布式事务用户A向B的一个转账1000要进行A的余额-1000B的余额+1000显然必须保证这两个操作的事务性</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_085-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">类似的还有电商系统中当有用户下单后除了在订单表插入记还要在商品表更新库存等特别是随着微服务架构的流行分布式事务的场景更变得更普遍</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_090-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">&#xa0;</span></p>
<p style="margin:0pt 0pt 10pt"><a name="_157-1565405011043"></a><span
style="background-color:#ffffff; color:#008000; font-family:Verdana; font-size:16pt; font-weight:bold">两阶段提交协议</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_571-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">两阶段提交协议是协调所有分布式原子事务参与者并决定提交或取消回滚的分布式算法</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_016-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">1.协议参与者</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_050-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">在两阶段提交协议中系统一般包含两类机器或节点一类为协调者coordinator通常一个系统中只有一个另一类为事务参与者participantscohorts或workers一般包含多个在数据存储系统中可以理解为数据副本的个数协议中假设每个节点都会记录写前日志write-ahead log并持久性存储即使节点发生故障日志也不会丢失协议中同时假设节点不会发生永久性故障而且任意两个节点都可以互相通信</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_760-1565405011043"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.023.png" width="553" height="358" alt="61-160357634.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_560-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">2.两个阶段的执行</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_474-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">1.请求阶段commit-request phase或称表决阶段voting phase</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_786-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">在请求阶段协调者将通知事务参与者准备提交或取消事务然后进入表决过程</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_710-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">在表决过程中参与者将告知协调者自己的决策同意事务参与者本地作业执行成功或取消本地作业执行故障</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_125-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">2.提交阶段commit phase</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_067-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">在该阶段协调者将基于第一个阶段的投票结果进行决策提交或取消</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_981-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">当且仅当所有的参与者同意提交事务协调者才通知所有的参与者提交事务否则协调者将通知所有的参与者取消事务</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_532-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">参与者在接收到协调者发来的消息后将执行响应的操作</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_080-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">3两阶段提交的缺点</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_646-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">1.同步阻塞问题执行过程中所有参与节点都是事务阻塞型的</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_014-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">当参与者占有公共资源时其他第三方节点访问公共资源不得不处于阻塞状态</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_488-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">2.单点故障由于协调者的重要性一旦协调者发生故障</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_765-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">参与者会一直阻塞下去尤其在第二阶段协调者发生故障那么所有的参与者还都处于锁定事务资源的状态中而无法继续完成事务操作如果是协调者挂掉可以重新选举一个协调者但是无法解决因为协调者宕机导致的参与者处于阻塞状态的问题</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_010-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">3.数据不一致在二阶段提交的阶段二中当协调者向参与者发送commit请求之后发生了局部网络异常或者在发送commit请求过程中协调者发生了故障这回导致只有一部分参与者接受到了commit请求</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_785-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">而在这部分参与者接到commit请求之后就会执行commit操作但是其他部分未接到commit请求的机器则无法执行事务提交于是整个分布式系统便出现了数据部一致性的现象</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">4两阶段提交无法解决的问题</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_450-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">当协调者出错同时参与者也出错时两阶段无法保证事务执行的完整性</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_279-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">考虑协调者再发出commit消息之后宕机而唯一接收到这条消息的参与者同时也宕机了</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_793-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">那么即使协调者通过选举协议产生了新的协调者这条事务的状态也是不确定的没人知道事务是否被已经提交</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_037-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">&#xa0;</span></p>
<p style="margin:0pt 0pt 10pt"><a name="_052-1565405011043"></a><span
style="background-color:#ffffff; color:#008000; font-family:Verdana; font-size:16pt; font-weight:bold">三阶段提交协议</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_420-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">三阶段提交协议在协调者和参与者中都引入超时机制并且把两阶段提交协议的第一个阶段拆分成了两步询问然后再锁资源最后真正提交</span>
</p>
<p style="font-size:11pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_180-1565405011043"></a><img
src="9a4a540e-1759-4268-90fa-7fb652c3604a.024.png" width="553" height="479" alt="92-920273519.png"
style="-aw-left-pos:0pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:0pt; -aw-wrap-type:inline"/>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_743-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">1三个阶段的执行</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_294-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">1.CanCommit阶段</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_945-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">3PC的CanCommit阶段其实和2PC的准备阶段很像</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_981-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">协调者向参与者发送commit请求参与者如果可以提交就返回Yes响应否则返回No响应</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_220-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">2.PreCommit阶段</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_740-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">Coordinator根据Cohort的反应情况来决定是否可以继续事务的PreCommit操作</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_866-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">根据响应情况有以下两种可能</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_992-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">A.假如Coordinator从所有的Cohort获得的反馈都是Yes响应那么就会进行事务的预执行</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_627-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">发送预提交请求Coordinator向Cohort发送PreCommit请求并进入Prepared阶段</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_214-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">事务预提交Cohort接收到PreCommit请求后会执行事务操作并将undo和redo信息记录到事务日志中</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_012-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">响应反馈如果Cohort成功的执行了事务操作则返回ACK响应同时开始等待最终指令</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_068-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">B.假如有任何一个Cohort向Coordinator发送了No响应或者等待超时之后Coordinator都没有接到Cohort的响应那么就中断事务</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_646-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">发送中断请求Coordinator向所有Cohort发送abort请求</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_143-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">中断事务Cohort收到来自Coordinator的abort请求之后或超时之后仍未收到Cohort的请求执行事务的中断</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_223-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">3.DoCommit阶段</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_678-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">该阶段进行真正的事务提交也可以分为以下两种情况:</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_532-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">执行提交</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_431-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">A.发送提交请求Coordinator接收到Cohort发送的ACK响应那么他将从预提交状态进入到提交状态并向所有Cohort发送doCommit请求</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_533-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">B.事务提交Cohort接收到doCommit请求之后执行正式的事务提交并在完成事务提交之后释放所有事务资源</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_010-1565405011043"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">C.响应反馈事务提交完之后向Coordinator发送ACK响应</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_145-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">D.完成事务Coordinator接收到所有Cohort的ACK响应之后完成事务</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_084-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">中断事务</span></p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_752-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">Coordinator没有接收到Cohort发送的ACK响应可能是接受者发送的不是ACK响应也可能响应超时那么就会执行中断事务</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_841-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">2三阶段提交协议和两阶段提交协议的不同</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_499-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">对于协调者(Coordinator)和参与者(Cohort)都设置了超时机制在2PC中只有协调者拥有超时机制即如果在一定时间内没有收到cohort的消息则默认失败</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_629-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">在2PC的准备阶段和提交阶段之间插入预提交阶段使3PC拥有CanCommitPreCommitDoCommit三个阶段</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_049-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">PreCommit是一个缓冲保证了在最后提交阶段之前各参与节点的状态是一致的</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_674-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt; font-weight:bold">2三阶段提交协议的缺点</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_085-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">如果进入PreCommit后Coordinator发出的是abort请求假设只有一个Cohort收到并进行了abort操作</span>
</p>
<p style="font-size:10pt; line-height:115%; margin:0pt 0pt 10pt"><a name="_298-1565405011044"></a><span
style="background-color:#ffffff; font-family:Verdana; font-size:10pt">而其他对于系统状态未知的Cohort会根据3PC选择继续Commit此时系统状态发生不一致性</span>
</p></div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -43,17 +43,6 @@
<div class="userBox cf">
<form method="post" action="./register.html" id="form2">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKLTIzNjMxNDQxNw9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZOquoASBvnvPbc/TYIQiLhSPJ8GKnYQrmk7jGhb5AC5Q">
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="23AA6834">
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEdAAVece19BIZ9HiByRfHz3pfnqKSXUE1UN51mNFrIuw38c3Y2+Mc6SrnAqio3oCKbxYZZ1lS+gZUZKpbsAea8j7ASAv40DHFcQ/NE7tJUnABeyQ3d9sFDIcFCYNqlVtprfLoh4JFy0U+R/CcMuyAiWTz7">
</div>
<div class="user_l">
<div></div>
<h3>小说基本信息填写</h3>

View File

@ -40,17 +40,6 @@
<div class="userBox cf">
<form method="post" action="./register.html" id="form2">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKLTIzNjMxNDQxNw9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZOquoASBvnvPbc/TYIQiLhSPJ8GKnYQrmk7jGhb5AC5Q">
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="23AA6834">
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEdAAVece19BIZ9HiByRfHz3pfnqKSXUE1UN51mNFrIuw38c3Y2+Mc6SrnAqio3oCKbxYZZ1lS+gZUZKpbsAea8j7ASAv40DHFcQ/NE7tJUnABeyQ3d9sFDIcFCYNqlVtprfLoh4JFy0U+R/CcMuyAiWTz7">
</div>
<div class="user_l">
<div></div>
<h3>小说章节内容填写</h3>

View File

@ -38,17 +38,6 @@
<div class="userBox cf">
<form method="post" action="./register.html" id="form2">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKLTIzNjMxNDQxNw9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZOquoASBvnvPbc/TYIQiLhSPJ8GKnYQrmk7jGhb5AC5Q">
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="23AA6834">
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEdAAVece19BIZ9HiByRfHz3pfnqKSXUE1UN51mNFrIuw38c3Y2+Mc6SrnAqio3oCKbxYZZ1lS+gZUZKpbsAea8j7ASAv40DHFcQ/NE7tJUnABeyQ3d9sFDIcFCYNqlVtprfLoh4JFy0U+R/CcMuyAiWTz7">
</div>
<div class="user_l">
<div></div>
<h3>小说章节内容填写</h3>

View File

@ -33,15 +33,6 @@
<body style="background-color: #444;">
<div style="width: 800px; margin-left: auto; margin-right: auto; margin-top: 150px;">
<form method="post" action="/author/register.html" id="form1" onsubmit="return $(this).form(&quot;validate&quot;);">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTcyNTY0MjQ5NGRk++It0MqlJDSbyu54vkeAbEa5OUhkaoZyC53OelRtDeg=" />
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="799CC77D" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAkIOs3R4B2+v3nSsFBLSe3g1MEpq666rzQ7jjzhNwecX7wsg773N8DhSUPLdYYjtuwvQ8kN6tkIkhd/68qh+xm6RWIUm/02TrSmncT3Z6CDZUrw+Qm6bt8NGm9h/X+a2xTq1sAiXqGUGwYVZVK+kL9fPOaW1pQztoQA36D1w/+bXZEqukB3SRMoY9NENNgXVe/neqc7kNqcr4JW0Rj8Hcw3qispLYQVy/s36rQl1WiEaw==" />
</div>
<div id="main">
<table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic" style="line-height:40px;">
<tr>

View File

@ -106,15 +106,6 @@
<div id="showBooking" class="orderBox">
<h3>此章为VIP章节需要订阅后才能继续阅读</h3>
<form method="post" action="./2052117.html?bid=302&amp;cid=2052117" id="Form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTI5NzI4MTkzMQ9kFgRmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kAgEPZBYIZg8WAh8ABQnkupHmg7PlrrlkAgEPFgIfAAUEMTE0NmQCAg8WAh8ABREyMDIwLzEvNyAxMDoxOTo1MWQCBA9kFgICAQ9kFg5mDxYCHwAFBDExNDZkAgEPFgIfAAUBNmQCAg8WAh8ABQEwZAIDDxYCHwAFATBkAgQPFgIeB1Zpc2libGVnZAIFDxYCHwFnZAIGDxYCHwFoZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAQUOY2J4QXV0b0Jvb2tpbmfqQ909Hciz2aB+AfEr2lQsyt0OxDFr478jb+bXR8kVYA==">
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="0F20AF34">
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAX4WEeZOhVYVmRzc9paH9JSy/08L4LdXX0bnEtd0tA2crFh4MPja1O/9L0Y0B5Q7Mkw2OnJlkYmOh3/iyqfPkkn99UiP/cCDJ38/2cPKg8P57VHEmkKJr8/tJbwExBtkfhGxxoA1kMIQUaw59BH5iPe">
</div>
<ul class="order_list">
<li>价格<span class="red" th:text="${bookIndex.bookPrice}+'屋币(1元=100屋币)'"></span></li>
<li id="panelPay" class="btns"><a class="btn_red" href="javascript:buyBookIndex()" >购买</a></li>

View File

@ -21,18 +21,29 @@
<div class="channelWrap channelBanner cf">
<div class="leftBox">
<div class="sliderContent">
<dl class="scBigImg" id="carouseBig">
<dl class="scBigImg" id="carouseBig" th:if="${bookMap['0']}" >
<dd th:each="book,iterStat : ${bookMap['0']}" th:class="${iterStat.first}? 'on'"><a th:href="'/book/'+${book.bookId}+'.html'">
<img th:src="${book.picUrl}" th:alt="${book.bookName}"/></a></dd>
</dl>
<div class="scSmallImg" id="carouseSmall">
<ul>
<div class="scSmallImg" id="carouseSmall" >
<ul th:if="${bookMap['0']}">
<li th:each="book,iterStat : ${bookMap['0']}" th:class="${iterStat.first}? 'on'">
<img th:src="${book.picUrl}" th:alt="${book.bookName}"/></li>
</ul>
</div>
</div>
<div class="hot_articles">
<dl class="hot_recommend" id="topBooks1">
<dl class="hot_recommend" id="topBooks1" th:if="${bookMap['1']} and ${#lists.size(bookMap['1']) > 0}">
<dt><a th:href="'/book/'+${bookMap['1'][0].bookId}+'.html'" th:text="${bookMap['1'][0].bookName}"></a></dt>
<dd th:if="${#lists.size(bookMap['1']) > 1}"><a th:href="'/book/'+${bookMap['1'][1].bookId}+'.html'" th:text="${bookMap['1'][1].bookName}"></a><a th:if="${#lists.size(bookMap['1']) > 2}" th:href="'/book/'+${bookMap['1'][1].bookId}+'.html'" th:text="${bookMap['1'][1].bookName}"></a></dd>
<dd th:if="${#lists.size(bookMap['1']) > 3}"><a th:href="'/book/'+${bookMap['1'][3].bookId}+'.html'" th:text="${bookMap['1'][3].bookName}"></a><a th:if="${#lists.size(bookMap['1']) > 4}" th:href="'/book/'+${bookMap['1'][4].bookId}+'.html'" th:text="${bookMap['1'][4].bookName}"></a></dd>
</dl>
<dl class="hot_recommend" id="topBooks2">
<dl class="hot_recommend" id="topBooks2" th:if="${bookMap['1']} and ${#lists.size(bookMap['1']) > 5}">
<dt><a th:href="'/book/'+${bookMap['1'][5].bookId}+'.html'" th:text="${bookMap['1'][5].bookName}"></a></dt>
<dd th:if="${#lists.size(bookMap['1']) > 6}"><a th:href="'/book/'+${bookMap['1'][6].bookId}+'.html'" th:text="${bookMap['1'][6].bookName}"></a><a th:if="${#lists.size(bookMap['1']) > 7}" th:href="'/book/'+${bookMap['1'][7].bookId}+'.html'" th:text="${bookMap['1'][7].bookName}"></a></dd>
<dd th:if="${#lists.size(bookMap['1']) > 8}"><a th:href="'/book/'+${bookMap['1'][8].bookId}+'.html'" th:text="${bookMap['1'][8].bookName}"></a><a th:if="${#lists.size(bookMap['1']) > 9}" th:href="'/book/'+${bookMap['1'][9].bookId}+'.html'" th:text="${bookMap['1'][9].bookName}"></a></dd>
</dl>
<dl class="hot_notice" id="indexNews">
</dl>
@ -43,7 +54,15 @@
<h3>本周强推</h3>
</div>
<div class="rightList">
<ul id="currentWeek">
<ul id="currentWeek" th:if="${bookMap['2']}">
<li th:each="book,iterStat : ${bookMap['2']}" th:class="${iterStat.first}? 'on num1': (${iterStat.index < 3}? 'num'+${iterStat.index+1})">
<div class="book_name"><i th:text="${iterStat.index+1}"></i><a class="name" th:href="'/book/'+${book.bookId}+'.html'" th:text="${book.bookName}"></a></div>
<div class="book_intro">
<div class="cover"><a th:href="'/book/'+${book.bookId}+'.html'"><img th:src="${book.picUrl}" th:alt="${book.bookName}"></a>
</div>
<a class="txt" th:href="'/book/'+${book.bookId}+'.html'" th:utext="${book.bookDesc}"></a>
</div>
</li>
</ul>
</div>
</div>
@ -54,8 +73,18 @@
<div class="title">
<h2 class="on">热门推荐</h2>
</div>
<div class="picRecommend cf" id="hotRecBooks">
<div class="picRecommend cf" id="hotRecBooks" th:if="${bookMap['3']}">
<div class="itemsList" th:each="book : ${bookMap['3']}">
<a class="items_img" th:href="'/book/'+${book.bookId}+'.html'">
<img class="lazyload" src="/images/default.gif" th:data-src="${book.picUrl}" th:alt="${book.bookName}">
</a>
<div class="items_txt">
<h4><a th:href="'/book/'+${book.bookId}+'.html'" th:text="${book.bookName}"></a></h4>
<p class="author"><a href="javascript:void(0)" th:text="'作者'+${book.authorName}"></a></p>
<p class="intro"><a th:href="'/book/'+${book.bookId}+'.html'" th:utext="${book.bookDesc}"></a>
</p>
</div>
</div>
</div>
</div>
@ -79,8 +108,18 @@
<div class="title">
<h2>精品推荐</h2>
</div>
<div class="picRecommend cf" id="classicBooks">
<div class="picRecommend cf" id="classicBooks" th:if="${bookMap['4']}">
<div class="itemsList" th:each="book : ${bookMap['4']}">
<a class="items_img" th:href="'/book/'+${book.bookId}+'.html'">
<img class="lazyload" src="/images/default.gif" th:data-src="${book.picUrl}" th:alt="${book.bookName}">
</a>
<div class="items_txt">
<h4><a th:href="'/book/'+${book.bookId}+'.html'" th:text="${book.bookName}"></a></h4>
<p class="author"><a href="javascript:void(0)" th:text="'作者'+${book.authorName}"></a></p>
<p class="intro"><a th:href="'/book/'+${book.bookId}+'.html'" th:utext="${book.bookDesc}"></a>
</p>
</div>
</div>
</div>
</div>
@ -153,183 +192,44 @@
<div th:replace="common/js :: js"></div>
<script src="/javascript/lazyload.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(function () {
//加载首页书籍设置数据
$.ajax({
type: "get",
url: "/book/listBookSetting",
data: {},
dataType: "json",
success: function (data) {
if (data.code == 200) {
var $div = $('.scBigImg dl');//放置大图容器
var $nav = $('.scSmallImg li');//放置缩略图容器
var num = -1;
var open;
//轮播图设置
var carouselBooks = data.data[0];
var carouseBigHtml = "";
var carouseSmallHtml = "";
for (var i = 0; i < carouselBooks.length; i++) {
var carouselBook = carouselBooks[i];
var classHtml = "";
if (i == 0) {
classHtml = "on";
}
carouseBigHtml += ("<dd class=\"" + classHtml + "\"><a href=\"/book/" + carouselBook.bookId + ".html\">" +
"<img src=\"" + carouselBook.picUrl + "\" alt=\"" + carouselBook.bookName + "\"/></a></dd>");
function changeKv() {
if (num >= $nav.length - 1) {
num = 0;
} else {
num++;
}
$nav.eq(num).trigger('mouseenter');
open = setTimeout(changeKv, 3000);
}
carouseSmallHtml += " <li class=\"" + classHtml + "\">" +
"<img src=\"" + carouselBook.picUrl + "\" alt=\"" + carouselBook.bookName + "\"/></li>";
}
$("#carouseBig").html(carouseBigHtml);
$("#carouseSmall").html(carouseSmallHtml);
var $div = $('.scBigImg dl');//放置大图容器
var $nav = $('.scSmallImg li');//放置缩略图容器
var num = -1;
var open;
function changeKv() {
if (num >= $nav.length - 1) {
num = 0;
} else {
num++;
}
$nav.eq(num).trigger('mouseenter');
open = setTimeout(changeKv, 3000);
}
changeKv();
$nav.each(function (index) {
$(this).off('mouseenter').on('mouseenter', function () {
clearTimeout(open);
$(this).addClass('on').siblings().removeClass('on');
$('.scBigImg dd').eq(index).addClass('on').siblings().removeClass('on');
$('.scSmallImg').off('mouseleave').on('mouseleave', function () {
num = index;
setTimeout(function () {
changeKv();
$nav.each(function (index) {
$(this).off('mouseenter').on('mouseenter', function () {
clearTimeout(open);
}, 3000)
})
});
});
$div.each(function () {
$(this).off('mouseenter').on('mouseenter', function () {
clearTimeout(open);
});
});
$(this).addClass('on').siblings().removeClass('on');
$('.scBigImg dd').eq(index).addClass('on').siblings().removeClass('on');
$('.scSmallImg').off('mouseleave').on('mouseleave', function () {
num = index;
setTimeout(function () {
changeKv();
}, 3000)
})
});
});
$div.each(function (index) {
$(this).off('mouseenter').on('mouseenter', function () {
clearTimeout(open);
});
});
//顶部小说栏设置
var topBooks = data.data[1];
var topBooks1Html = "";
var topBooks2Html = "";
for (var i = 0; i < topBooks.length; i++) {
var toBook = topBooks[i];
if (i < 5) {
if (i == 0) {
topBooks1Html += "<dt>";
} else if (i % 2 == 1) {
topBooks1Html += "<dd>";
}
topBooks1Html += ("<a href=\"book/" + toBook.bookId + ".html\">" + toBook.bookName + "</a>");
if (i == 0) {
topBooks1Html += "</dt>";
} else if (i % 2 == 0) {
topBooks1Html += "</dd>";
}
} else {
if (i == 5) {
topBooks2Html += "<dt>";
} else if (i % 2 == 0) {
topBooks2Html += "<dd>";
}
topBooks2Html += ("<a href=\"book/" + toBook.bookId + ".html\">" + toBook.bookName + "</a>");
if (i == 5) {
topBooks2Html += "</dt>";
} else if (i % 2 == 1) {
topBooks2Html += "</dd>";
}
}
}
$("#topBooks1").html(topBooks1Html);
$("#topBooks2").html(topBooks2Html);
//本周强推
var rightListBooks = data.data[2];
var rightListBooksHtml = "";
for (var i = 0; i < rightListBooks.length; i++) {
var rightListBook = rightListBooks[i];
var classHtml = "";
var imageHtml = "";
if (i == 0) {
classHtml = "on";
imageHtml = "<img src=\"" + rightListBook.picUrl + "\" alt=\"" + rightListBook.bookName + "\"/></a>\n";
}
if (i < 3) {
classHtml += (" num" + (i + 1));
}
rightListBooksHtml += ("<li class=\"" + classHtml + "\">\n" +
" <div class=\"book_name\"><i>" + (i + 1) + "</i><a class=\"name\" href=\"/book/" + rightListBook.bookId + ".html\">" + rightListBook.bookName + "</a></div>\n" +
" <div class=\"book_intro\">\n" +
" <div class=\"cover\"><a href=\"/book/" + rightListBook.bookId + ".html\">" + imageHtml +
" </div>\n" +
" <a class=\"txt\" href=\"/book/" + rightListBook.bookId + ".html\">" + rightListBook.bookDesc + "</a>\n" +
" </div>\n" +
" </li>");
}
$("#currentWeek").html(rightListBooksHtml);
//热门推荐
var hotRecBooks = data.data[3];
var hotRecBooksHtml = "";
for (var i = 0; i < hotRecBooks.length; i++) {
var hotRecBook = hotRecBooks[i];
hotRecBooksHtml += (" <div class=\"itemsList\">\n" +
" <a class=\"items_img\" href=\"/book/" + hotRecBook.bookId + ".html\">\n" +
" <img class=\"lazyload\" src='/images/default.gif' data-src=\"" + hotRecBook.picUrl + "\" alt=\"" + hotRecBook.bookName + "\"/>\n" +
" </a>\n" +
" <div class=\"items_txt\">\n" +
" <h4><a href=\"/book/" + hotRecBook.bookId + ".html\">" + hotRecBook.bookName + "</a></h4>\n" +
" <p class=\"author\"><a href=\"javascript:void(0)\">作者:" + hotRecBook.authorName + "</a></p>\n" +
" <p class=\"intro\"><a href=\"/book/" + hotRecBook.bookId + ".html\">" + hotRecBook.bookDesc + "</a>\n" +
" </p>\n" +
" </div>\n" +
" </div>");
}
$("#hotRecBooks").html(hotRecBooksHtml);
//精品推荐
var classicBooks = data.data[4];
var classicBooksHtml = "";
for (var i = 0; i < classicBooks.length; i++) {
var classicBook = classicBooks[i];
classicBooksHtml += (" <div class=\"itemsList\">\n" +
" <a class=\"items_img\" href=\"/book/" + classicBook.bookId + ".html\">\n" +
" <img class=\"lazyload\" src='/images/default.gif' data-src=\"" + classicBook.picUrl + "\" alt=\"" + classicBook.bookName + "\"/>\n" +
" </a>\n" +
" <div class=\"items_txt\">\n" +
" <h4><a href=\"/book/" + classicBook.bookId + ".html\">" + classicBook.bookName + "</a></h4>\n" +
" <p class=\"author\"><a href=\"javascript:void(0)\">作者:" + classicBook.authorName + "</a></p>\n" +
" <p class=\"intro\"><a href=\"/book/" + classicBook.bookId + ".html\">" + classicBook.bookDesc + "</a>\n" +
" </p>\n" +
" </div>\n" +
" </div>");
}
$("#classicBooks").html(classicBooksHtml);
lazyload();
} else {
layer.alert(data.msg);
}
},
error: function () {
layer.alert('网络异常');
}
})
lazyload();
$(function () {
//首页新闻查询
$.ajax({
type: "get",

View File

@ -49,7 +49,7 @@
<!-- 你的HTML代码 -->
<a name="top"></a>
<ul class="layui-nav app" lay-filter="" style="display:none;padding:0 10px;text-align: center">
<ul class="layui-nav app" lay-filter="" style="display:none;padding:0 10px;text-align: center">
<li class="layui-nav-item"><a>分类</a>
<dl class="layui-nav-child">
<dd><a href="/book/book_ranking.html?catId=1&sort=last_index_update_time">玄幻小说</a></dd>
@ -145,46 +145,48 @@
</blockquote>
<div class="layui-container" style="padding: 0px">
<div class="layui-container" style="padding: 0px">
<div class="layui-row" style="text-align: center" id="currentWeek">
</div>
<div class="layui-row" style="text-align: center" id="currentWeek" th:if="${bookMap['4']}">
<span th:each="book,iterStat : ${bookMap['4']}" th:if="${iterStat.index<3}">
<a th:href="'/book/'+${book.bookId}+'.html'">
<div style="padding: 1%" class="layui-col-xs4 layui-col-sm4 layui-col-md4 layui-col-lg4">
<img style=" width:100px; height:125px; max-width:100%; max-height:100%;"
th:src="${book.picUrl}">
<br>
<span th:text="${#strings.length(book.bookName) > 5}? (${#strings.substring(book.bookName,0,5)}+'...'): ${book.bookName} "></span>
</div>
</a>
</span>
</div>
</div>
</div>
<div class="layui-colla-item">
<blockquote class="layui-elem-quote" style="text-align: left;font-size: 16px">
热门推荐
</blockquote>
<div class="layui-container">
<div class="layui-row" id="hotRecBooks">
<div class="layui-container">
<div class="layui-row" id="hotRecBooks" th:if="${bookMap['3']}">
<div th:each="book,iterStat : ${bookMap['3']}" th:if="${iterStat.index<6}" style="margin-bottom: 5px" class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4">
<a th:href="'/book/'+${book.bookId}+'.html'">
<div class="layui-col-xs5 layui-col-sm4 layui-col-md4 layui-col-lg4">
<img style=" width:100px; height:125px;" th:src="${book.picUrl}">
<!--<div th:each="hotBook : ${hotBooks}" style="margin-top: 1%"
class="layui-col-xs12 layui-col-sm6 layui-col-md6 layui-col-lg6">
<a th:href="'/book/'+${hotBook.id}+'.html'">
<div class="layui-col-xs5 layui-col-sm3 layui-col-md3 layui-col-lg3">
<img style=" width:100px; height:125px;"
th:src="${hotBook.picUrl}"/>
</div>
<div class="layui-col-xs7 layui-col-sm6 layui-col-md7 layui-col-lg7"
style="float: left;padding-right: 10px">
<div><b th:text="${hotBook.bookName}"></b></div>
<div class="layui-col-xs8 layui-col-sm9 layui-col-md10 layui-col-lg10"
th:text="'作者:'+ ${hotBook.author}"></div>
<div class="layui-col-xs3 layui-col-sm2 layui-col-md1 layui-col-lg1" style="text-align: right;">
<b><i style="color: red"
th:text="${hotBook.score} + '分'"></i></b></div>
</div>
<div class="layui-elip layui-col-xs12 layui-col-sm9 layui-col-md10 layui-col-lg10 layui-col-sm9 layui-col-md10 layui-col-lg10"
th:text="${hotBook.bookDesc}">
</div>
<div class="layui-col-xs5 layui-col-sm6 layui-col-md6 layui-col-lg6">
<ul>
<li style="padding-bottom: 2px" class="line-limit-length" th:text="${book.bookName}"></li>
<li style="padding-bottom: 2px;color: #a6a6a6" th:text="'作者:'+${book.authorName}"></li>
<li style="color: #a6a6a6;width: 180px;height:60px;overflow: hidden" th:utext="${book.bookDesc}"> </li></ul>
</div>
<div style="font-style: italic;color: red" class="layui-col-xs2 layui-col-sm2 layui-col-md2 layui-col-lg2"></div>
</a>
</div>-->
</div>
</div>
</div>
@ -209,7 +211,6 @@
<div class="layui-row" id="updateRankBooks">
</div>
</div>
@ -227,87 +228,6 @@
<script>
//加载首页书籍设置数据
$.ajax({
type: "get",
url: "/book/listBookSetting",
data: {},
dataType: "json",
success: function (data) {
if (data.code == 200) {
//精品推荐
var rightListBooks = data.data[4];
var rightListBooksHtml = "";
for (var i = 0; i < 3; i++) {
var rightListBook = rightListBooks[i];
var classHtml = "";
if (i == 0) {
classHtml = "on";
}
if (i < 3) {
classHtml += (" num" + (i + 1));
}
rightListBooksHtml += (" <span>\n" +
" <a href=\"/book/"+rightListBook.bookId+".html\">\n" +
" <div style=\"padding: 1%\" class=\"layui-col-xs4 layui-col-sm4 layui-col-md4 layui-col-lg4\">\n" +
" <img style=\" width:100px; height:125px; max-width:100%; max-height:100%;\"\n" +
" src=\""+rightListBook.picUrl+"\"/>\n" +
"\n" +
" <br/>\n" +
" <span >"+(rightListBook.bookName.length>5?(rightListBook.bookName.substr(0,5)+'...'):rightListBook.bookName)+"</span>\n" +
"\n" +
" </div>\n" +
" </a>\n" +
" </span>");
}
$("#currentWeek").html(rightListBooksHtml);
//热门推荐
var hotRecBooks = data.data[3];
var hotRecBooksHtml = "";
for (var i = 0; i < 6; i++) {
var hotRecBook = hotRecBooks[i];
if(hotRecBook.bookDesc){
hotRecBook.bookDesc = hotRecBook.bookDesc.replace(/<[^>]+>/g,"").replace(/\s+/g,"");
}
//手机浏览器不支持String.replaceAll()方法
hotRecBooksHtml += ("<div style=\"margin-bottom: 5px\" class=\"layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4\">\n" +
" <a href=\"/book/"+hotRecBook.bookId+".html\">\n" +
" <div class=\"layui-col-xs5 layui-col-sm4 layui-col-md4 layui-col-lg4\" >\n" +
" <img style=\" width:100px; height:125px;\"\n" +
" src=\""+hotRecBook.picUrl+"\"/>\n" +
"\n" +
" </div>\n" +
" <div class=\"layui-col-xs5 layui-col-sm6 layui-col-md6 layui-col-lg6\">\n" +
" <ul>\n" +
" <li style='padding-bottom: 2px' class=\"line-limit-length\" >"+hotRecBook.bookName+"</li>\n" +
" <li style='padding-bottom: 2px;color: #a6a6a6'>作者:"+hotRecBook.authorName+"</li>\n" +
" <li style=\"color: #a6a6a6;width: 180px;height:60px;overflow: hidden\">"+hotRecBook.bookDesc +
" </ul>\n" +
" </div>\n" +
" <div style=\"font-style: italic;color: red\"\n" +
" class=\"layui-col-xs2 layui-col-sm2 layui-col-md2 layui-col-lg2\"></div>\n" +
" </a>\n" +
" </div>");
}
$("#hotRecBooks").html(hotRecBooksHtml);
} else {
layer.alert(data.msg);
}
},
error: function () {
layer.alert('网络异常');
}
})
//更新榜单查询
@ -323,26 +243,24 @@
for (var i = 0; i < 10; i++) {
var updateRankBook = updateRankBooks[i];
if(updateRankBook.bookDesc){
updateRankBook.bookDesc = updateRankBook.bookDesc.replace(/<[^>]+>/g,"").replace(/\s+/g,"");
if (updateRankBook.bookDesc) {
updateRankBook.bookDesc = updateRankBook.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "");
}
updateRankBookHtml += ("<div style=\"padding-bottom: 30px\"\n" +
" class=\"layui-col-xs12 layui-col-sm6 layui-col-md6 layui-col-lg6\">\n" +
"\n" +
" <a href=\"/book/"+updateRankBook.id+".html\">\n" +
" <div class=\"line-limit-length layui-col-xs8 layui-col-sm6 layui-col-md6 layui-col-lg6\"><span '>"+(i+1)+"."+updateRankBook.bookName+"</span> - <span class=\"layui-elip\" style='color: #a6a6a6;'>"+updateRankBook.authorName+"</span>\n" +
" </div>\n" +
" <div class=\"layui-col-sm3 layui-col-md3 layui-col-lg3\"\n" +
" style=\"color: #FF5722;float: right;margin-right:5px\"><i>"+updateRankBook.lastIndexUpdateTime+"</i></div>\n" +
"\n" +
" <div style=\"clear: both\"></div>\n" +
" <div style=\"color: #a6a6a6;padding-left: 5px;padding-top: 5px\"\n" +
" class=\"layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11\">简介:  "+updateRankBook.bookDesc+"" +
" </div></a>\n" +
" </div>");
updateRankBookHtml += ("<div style=\"padding-bottom: 30px\"\n" +
" class=\"layui-col-xs12 layui-col-sm6 layui-col-md6 layui-col-lg6\">\n" +
"\n" +
" <a href=\"/book/" + updateRankBook.id + ".html\">\n" +
" <div class=\"line-limit-length layui-col-xs8 layui-col-sm6 layui-col-md6 layui-col-lg6\"><span '>" + (i + 1) + "." + updateRankBook.bookName + "</span> - <span class=\"layui-elip\" style='color: #a6a6a6;'>" + updateRankBook.authorName + "</span>\n" +
" </div>\n" +
" <div class=\"layui-col-sm3 layui-col-md3 layui-col-lg3\"\n" +
" style=\"color: #FF5722;float: right;margin-right:5px\"><i>" + updateRankBook.lastIndexUpdateTime + "</i></div>\n" +
"\n" +
" <div style=\"clear: both\"></div>\n" +
" <div style=\"color: #a6a6a6;padding-left: 5px;padding-top: 5px\"\n" +
" class=\"layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11\">简介:  " + updateRankBook.bookDesc + "" +
" </div></a>\n" +
" </div>");
}
@ -359,7 +277,6 @@
})
function moreNewBooks(event) {
window.location.href = "/book/book_ranking.html?sortBy=last_index_update_time";
}

View File

@ -22,9 +22,6 @@
<div class="fl">
充值账号<span class="user_name" id="my_name"></span>余额:<em class="red" id="accountBalance">0</em>屋币<!--<em class="red">+0</em>代金券-->
</div>
<!--<div class="fr">
<a class="btn_gray" href="/user/pay_record.aspx" target="_blank">充值记录</a><a class="btn_gray" href="/user/my_order.aspx" target="_blank">消费记录</a>
</div>-->
</div>
<div class="payCon">
<h5>选择充值方式</h5>

View File

@ -23,18 +23,6 @@
<form method="post" action="/" id="Form1"
onsubmit="javascript:return checkForm();">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKLTI0NTcxNzYzNQ9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZOKmHcn3Hx3hiIXMcMpQUjAD9MIGLnq1zjEfYvQaVwy3"/>
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR"
value="EC00F135"/>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEdAAOgvD0TAZWHlMabubpkV5BnBh62Mb2K7OVw5a48s/sFVJZYgDymPir0Zp4mFYzbkIhNun0nyr9cDo847Ee31BA4NS8zv4PJDmcEpjfg+YdsoQ=="/>
</div>
<ul class="reg_list">
<li>
<textarea name="txtDescription" rows="2" cols="20" id="txtDescription"

View File

@ -17,15 +17,6 @@
<div class="userBox cf">
<div class="user_l">
<form method="post" action="./login.html" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJLTU4MDE1Nzc3D2QWAmYPZBYCZg8WAh4EVGV4dAWoATxhIGhyZWY9Ii9zZWFyY2guYXNweD9zZWFyY2hLZXk95Za75a6J6Zuv77yM54uE5rO977yM54G15byC77yM5YmN5LiW5LuK55Sf77yM5Yal546L6ay85aSrIiB0YXJnZXQ9Il9ibGFuayI+5Za75a6J6Zuv77yM54uE5rO977yM54G15byC77yM5YmN5LiW5LuK55Sf77yM5Yal546L6ay85aSrPC9hPmRke+U5PV/m7ho155TiR+flEgGjh+T6z8Hjoa5q62rCUFg=" />
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C93BE1AE" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAXkRxK+hbBn9D6bVAXo8t/4qKSXUE1UN51mNFrIuw38c3Y2+Mc6SrnAqio3oCKbxYainihG6d/Xh3PZm3b5AoMQ2xnvcKe7Apj/DdmzfeCXoTjAjITeRewsBR3AmjdQ75+yP5bUUcdUUiZlMKONJDef" />
</div>
<h3 th:text="'登陆'+${application.website.name}"></h3>
<ul class="log_list">
<li><span id="LabErr"></span></li>

View File

@ -16,17 +16,6 @@
<div class="main box_center cf">
<div class="userBox cf">
<form method="post" action="./register.html" id="form2">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKLTIzNjMxNDQxNw9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZOquoASBvnvPbc/TYIQiLhSPJ8GKnYQrmk7jGhb5AC5Q"/>
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="23AA6834"/>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEdAAVece19BIZ9HiByRfHz3pfnqKSXUE1UN51mNFrIuw38c3Y2+Mc6SrnAqio3oCKbxYZZ1lS+gZUZKpbsAea8j7ASAv40DHFcQ/NE7tJUnABeyQ3d9sFDIcFCYNqlVtprfLoh4JFy0U+R/CcMuyAiWTz7"/>
</div>
<div class="user_l">
<h3 th:text="'注册'+${application.website.name}+'小说账号'"></h3>
<ul class="log_list">

View File

@ -25,17 +25,6 @@
<div class="my_r">
<div class="my_info cf">
<div class="my_info_txt">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKMTI5MzkzMzQyMw9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZLj1Uo6akAHRsP9HH/tJWCPmjwlzm9tv02sZRfbbCnBA"/>
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="6C876674"/>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEdAAO8SPdUDpH0Q7nHjeqbvI7ld2C+OxfjpZOniBJbql7XdnRgTJ25FWigbeFr84Vgoxdi/cg2vS37N0KER6F1nyr1wKHztnXmDR5zls+9dCeAZg=="/>
</div>
<ul class="mytab_list">
<li><i class="tit">我的昵称</i><input name="txtNiceName" type="text" value="15171695474"
maxlength="20" id="txtNiceName" class="s_input"

View File

@ -24,15 +24,6 @@
<div class="my_r">
<div class="my_info cf">
<div class="my_info_txt">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE5NTM3Mjc0MTkPZBYEZg9kFgJmDxYCHgRUZXh0BagBPGEgaHJlZj0iL3NlYXJjaC5hc3B4P3NlYXJjaEtleT3llrvlronpm6/vvIzni4Tms73vvIzngbXlvILvvIzliY3kuJbku4rnlJ/vvIzlhqXnjovprLzlpKsiIHRhcmdldD0iX2JsYW5rIj7llrvlronpm6/vvIzni4Tms73vvIzngbXlvILvvIzliY3kuJbku4rnlJ/vvIzlhqXnjovprLzlpKs8L2E+ZAICD2QWAgIJDw8WAh8ABSHkuKTmrKHovpPlhaXnmoTmlrDlr4bnoIHkuI3ljLnphY1kZGRhp36YOW0VXvnzag3X7ggb4GZjGR2iOhc3esYV+gLQoA==" />
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="65B8FACB" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAX/+YBS+s4SAkXd5M3/Ah/txr1QWsMVpxihbk+u9oMvC/bi8V6FV2PI0iftNhvgoqk7nMhcHLH9bj8jEonVtSua9n7/EOPGKgFySK9U6TwmXfgmt+UwsLWDkQL9tHgrPR3yuBzIgg7/7BXfGNHKEmhv" />
</div>
<ul class="mytab_list">
<li><i class="tit">我的密码</i><input name="oldPass" type="password" id="txtOldPass" class="s_input" placeholder="请输入原密码" /></li>
<li><i class="tit">&nbsp;</i><input name="txtNewPass1" type="password" id="txtNewPass1" class="s_input" placeholder="请输入新密码" /></li>

View File

@ -24,15 +24,6 @@
<div class="my_r">
<div class="my_info cf">
<div class="my_info_txt">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTkyODgwMDQwMA9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZMZ5uDacrADq981tXsiwhce7e3YhhhJ5JQQTUHxIrSut" />
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="5DBBC1A2" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAIB0+ZH6KYdr1mTvok41QcAdGBMnbkVaKBt4WvzhWCjFyKLzSsxk3yjFX2xXrDnmlabnJvU11tPMoHIge4rg3hW" />
</div>
<ul class="mytab_list">
<li><i class="tit">我的性别</i>
<label><input type="radio" name="sex" value="0" />&nbsp;男生</label>

View File

@ -16,17 +16,6 @@
<div class="main box_center cf">
<div class="userBox cf">
<form method="post" action="./register.html" id="form2">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKLTIzNjMxNDQxNw9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZOquoASBvnvPbc/TYIQiLhSPJ8GKnYQrmk7jGhb5AC5Q"/>
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="23AA6834"/>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEdAAVece19BIZ9HiByRfHz3pfnqKSXUE1UN51mNFrIuw38c3Y2+Mc6SrnAqio3oCKbxYZZ1lS+gZUZKpbsAea8j7ASAv40DHFcQ/NE7tJUnABeyQ3d9sFDIcFCYNqlVtprfLoh4JFy0U+R/CcMuyAiWTz7"/>
</div>
<div class="user_l">
<h3 th:text="'注册'+${application.website.name}+'小说账号'"></h3>
<ul class="log_list">