锘??xml version="1.0" encoding="utf-8" standalone="yes"?>中文字幕一区二区三区久久网站,精品久久久久久久中文字幕,久久久久久久精品妇女99http://www.shnenglu.com/egametang/zh-cnTue, 06 May 2025 20:28:17 GMTTue, 06 May 2025 20:28:17 GMT60C++ protobuf 涓嶄粎浠呮槸搴忓垪鍖栤︹?/title><link>http://www.shnenglu.com/egametang/archive/2012/04/12/171063.html</link><dc:creator>鍞愯瘲</dc:creator><author>鍞愯瘲</author><pubDate>Thu, 12 Apr 2012 04:09:00 GMT</pubDate><guid>http://www.shnenglu.com/egametang/archive/2012/04/12/171063.html</guid><wfw:comment>http://www.shnenglu.com/egametang/comments/171063.html</wfw:comment><comments>http://www.shnenglu.com/egametang/archive/2012/04/12/171063.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/egametang/comments/commentRss/171063.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/egametang/services/trackbacks/171063.html</trackback:ping><description><![CDATA[<div><span style="font-size: 12px;">涓鐐瑰皬鐗㈤獨 cppblog鍜屽崥瀹㈠洯鏄暐鍏崇郴鍛紵鍚屼袱杈圭殑浜轟氦嫻佷氦嫻?闅鵑亾鎴戜袱杈歸兘瑕佸彂涓閬嶏紵<br /><br />      C++涓璸rotobuf鏄釜甯哥敤鐨勫簭鍒楀寲搴擄紝緗戠粶娑堟伅鍙戦侊紝娑堟伅瑙f瀽閮藉崄鍒嗘柟渚匡紝xml鍙互騫茬殑錛屽畠閮借兘騫層備絾鏄畠緇濅笉浠呬粎鏄簭鍒楀寲搴撱?/span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">綆鍗曠殑璇達紝protobuf緇機++澧炲姞浜咰# attribute鐨勫姛鑳姐侰++浠庢灝辨湁浜嗗厓鏁版嵁浜嗭紒浼歝#鐨勫悓瀛﹁偗瀹氭槑鐧戒簡榪欏彞璇濈殑鎰忎箟浜嗐?/span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">涓. protobuf鐢ㄤ綔閰嶇疆鏂囦歡錛?/span></div><div><span style="font-size: 12px;">protobuf鎻愪緵浜嗕竴縐峵extformat鐨勫簭鍒楀寲鏍煎紡錛岀被浼糺son鏍煎紡錛屾竻鏅版槗璇匯傛瘮濡備竴媯佃涓烘爲鑺傜偣鎻忚堪鏂囦歡錛?/span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">鏁版嵁瀹氫箟涓猴細</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message BehaviorNodeConf</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 type = 1;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 鏉′歡闇瑕佺殑鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>repeated int32 args = 2;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 鍖呭惈澶氫釜瀛愯妭鐐?/span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>repeated BehaviorNodeConf node = 3;</span></div><div><span style="font-size: 12px;">};</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message BehaviorTreeConf</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 琛屼負鏍戠被鍨? AI, ON_HIT, ON_HITTED ...</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 type = 1;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 琛屼負鏍戣妭鐐?/span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required BehaviorNodeConf node = 2;</span></div><div><span style="font-size: 12px;">};閰嶇疆鏂囦歡涓猴細</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">type: 5</span></div><div><span style="font-size: 12px;">node:</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 1</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>node:</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 101</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: 2</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>node:</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 1</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>node:</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 1001</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: 0</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: 100</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>node:</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 1001</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: 1</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: -100</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;">} 浠ヤ笅涓よ浠g爜鍗沖彲瑙f瀽榪欎釜閰嶇疆鏂囦歡錛欱ehaviorTreeConf conf;</span></div><div><span style="font-size: 12px;">google::protobuf::TextFormat::ParseFromString(fileContent, &conf);浜? protobuf鐨勫弽灝勭敤娉?/span></div><div><span style="font-size: 12px;">寰堝浜洪兘璇碈++寰堥毦鍋歄rm錛屽洜涓烘病鏈夊弽灝勭瓑絳夛紝鏈変簡protobuf榪欎竴鍒囬兘涓嶆槸闂浜嗭紝濡備笅錛?/span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">select鎿嶄綔錛氳嚜鍔ㄧ敓鎴恠elect璇彞錛屾煡璇竴鏉¤褰曟妸瀹冧繚瀛樺埌person鍙橀噺閲岄潰</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>try</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>DbHelper dbHelper("tcp://127.0.0.1:3306", "root", "111111");</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>DbResultPtr result = dbHelper.Execute(</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>Select<Person>(Column("*")).</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>Where(Column("age") > 10)</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>);</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>auto person = boost::make_shared<Person>();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>result->One(person);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>ASSERT_EQ(26, person->age());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>catch (const Exception& e)</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}  update鎿嶄綔: 鑷姩鐢熸垚update璇彞錛岃繖孌典唬鐮佹槸浠庢垜鐨勫崟鍏冩祴璇曢噷闈㈡姞鍑烘潵鐨勶紝澶у鏄庣櫧鎰忔濆氨琛屼簡TEST_F(UpdateTest, Update_Where)</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>std::string expectedSql;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>expectedSql =</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>"update Egametang.Person "</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>"set guid = 1, age = 18, comment = 'a good student!' "</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>"where age > 10";</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>Person person;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>person.set_guid(1);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>person.set_age(18);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>person.set_comment("a good student!");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>Update update(person);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>update.Where(Column("age") > 10);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>EXPECT_EQ(expectedSql, update.ToString());</span></div><div><span style="font-size: 12px;">} 涓?protbuf 綾諱技c# attribute鍔熻兘</span></div><div><span style="font-size: 12px;">鐪嬪涓嬩竴孌祊rotobuf瀹氫箟錛歩mport "google/protobuf/descriptor.proto";</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">extend google.protobuf.FileOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional string my_file_option = 50000;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.MessageOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional int32 my_message_option = 50001;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.FieldOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional float my_field_option = 50002;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.EnumOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional bool my_enum_option = 50003;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.EnumValueOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional uint32 my_enum_value_option = 50004;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.ServiceOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional MyEnum my_service_option = 50005;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.MethodOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional MyMessage my_method_option = 50006;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">option (my_file_option) = "Hello world!";</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message MyMessage </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    option (my_message_option) = 1234;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">    optional int32 foo = 1 [(my_field_option) = 4.5];</span></div><div><span style="font-size: 12px;">    optional string bar = 2;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">enum MyEnum </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    option (my_enum_option) = true;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">    FOO = 1 [(my_enum_value_option) = 321];</span></div><div><span style="font-size: 12px;">    BAR = 2;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message RequestType {}</span></div><div><span style="font-size: 12px;">message ResponseType {}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">service MyService </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    option (my_service_option) = FOO;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">    rpc MyMethod(RequestType) returns(ResponseType) </span></div><div><span style="font-size: 12px;">    {</span></div><div><span style="font-size: 12px;">        // Note:  my_method_option has type MyMessage.  We can set each field</span></div><div><span style="font-size: 12px;">        //   within it using a separate "option" line.</span></div><div><span style="font-size: 12px;">        option (my_method_option).foo = 567;</span></div><div><span style="font-size: 12px;">        option (my_method_option).bar = "Some string";</span></div><div><span style="font-size: 12px;">    }</span></div><div><span style="font-size: 12px;">}protobuf涓殑option灝辨槸C#涓殑attribute錛宱ption鍚屾牱鍙互鏀懼湪message錛堝悓c#鐨刢lass錛?service錛堝悓c#鐨勬柟娉曪級 浠ュ強message鐨刦ield涓婇潰</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">鍥?娓告垙寮鍙戜腑濡備綍鍒╃敤protobuf鐨勮繖鍔熻兘鍛紵</span></div><div><span style="font-size: 12px;">1.絳栧垝浣跨敤protobuf浣滀負閰嶇疆鏂囦歡錛屾垜鍙互鍦ㄦ暟鎹畾涔変腑璁劇疆鏌愪釜瀛楁鐨刼ption涓篊#鐨勫摢涓帶浠訛紝</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">緙栬緫鍣ㄨ鍒拌繖涓暟鎹畾涔夊氨鍙互鐩存帴鐢熸垚涓涓帶浠訛紝鍥犳鍙互鏍規嵁鏁版嵁瀹氫箟鐢熸垚緙栬緫鍣ㄧ粰絳栧垝濉啓鏁版嵁銆備緥濡傦細</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message BehaviorNodeConf</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 type = 1 [control = "textbox" max = 100 min = 0];</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 鏉′歡闇瑕佺殑鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>repeated int32 args = 2 [control = "textbox"];</span></div><div><span style="font-size: 12px;">}; 2.鍐嶅錛?鎶鑳藉彲浠ユ柦鏀綽uff錛屾瘡涓猙uff閮藉簲璇ユ湁涓涓叧鑱旂殑鎶鑳斤紝閭d箞絳栧垝濉〃鐨勬椂鍊欒濉竴涓妧鑳界殑proto琛ㄨ繕瑕佸~涓涓猙uff鐨刾roto琛紝涓ゅ紶琛ㄧ瓥鍒掑緢瀹規槗灝卞~婕忎簡鎴戜滑鍙互鍔犱笂涓涓害鏉燂紝鐢辯紪杈戝櫒鍘繪鏌ワ細message Spell</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 id = 1;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>optional int32 buffId = 2 [ref = "Buff.id"];</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message Buff</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 id = 1 [ref = "Spell.buffId"];</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>optional int32 time = 2;</span></div><div><span style="font-size: 12px;">}緙栬緫鍣ㄥ~鍐欎竴涓猙uff浼氬幓媯鏌ユ槸鍚︽湁鍏寵仈榪欎釜buff鐨勬妧鑳藉瓨鍦紝濉妧鑳界殑鏃跺欏鏋滃~浜哹uff涔熻寮哄埗閰嶇疆鐩稿簲鐨刡uff錛岃繖鏍峰ぇ澶у噺灝戜簡閰嶇疆閿欒錛岀瓥鍒掍粠姝や粠濉〃閿欒涓В鑴卞嚭鏉ャ? 絳栧垝鐖戒簡錛岀▼搴忓憳鐨勭埥榪樿繙鍚楋紵 浠栧ソ鎴戜篃濂斤紒 protobuf鍐欑殑涓涓畝鏄搊rm,鐩墠瀹炵幇浜唖elect鍜寀pdate錛屽叾瀹冪殑鍚庣畫澧炲姞錛屽師鐞嗘槸涓鏍風殑浠g爜鍦板潃錛?https://github.com/egametang/Egametang/tree/master/Cpp/Platform/Orm</span></div><img src ="http://www.shnenglu.com/egametang/aggbug/171063.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/egametang/" target="_blank">鍞愯瘲</a> 2012-04-12 12:09 <a href="http://www.shnenglu.com/egametang/archive/2012/04/12/171063.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.vlln.cn" target="_blank">国产精品一久久香蕉国产线看</a>| <a href="http://www.hadonghoon.cn" target="_blank">久久精品国产精品青草app</a>| <a href="http://www.zhihuzhuanlan.com.cn" target="_blank">国内精品欧美久久精品</a>| <a href="http://www.fengguan1688.cn" target="_blank">欧美麻豆久久久久久中文</a>| <a href="http://www.zixunlawyer.com.cn" target="_blank">久久国产精品偷99</a>| <a href="http://www.hongyun2000.cn" target="_blank">性做久久久久久久久浪潮</a>| <a href="http://www.deografenny.com.cn" target="_blank">亚洲熟妇无码另类久久久</a>| <a href="http://www.996acg.cn" target="_blank">久久精品九九亚洲精品天堂</a>| <a href="http://www.tuht.cn" target="_blank">欧美大战日韩91综合一区婷婷久久青草</a>| <a href="http://www.thesmarterwaytofaster.cn" target="_blank">青青久久精品国产免费看</a>| <a href="http://www.arouk.cn" target="_blank">久久久国产精品亚洲一区</a>| <a href="http://www.510dpw.cn" target="_blank">久久久WWW免费人成精品</a>| <a href="http://www.squc.cn" target="_blank">久久国产免费直播</a>| <a href="http://www.fnrbnpj.cn" target="_blank">国产精品免费久久久久久久久</a>| <a href="http://www.huadamachine.com.cn" target="_blank">综合久久给合久久狠狠狠97色</a>| <a href="http://www.23tlbb.cn" target="_blank">国产欧美久久一区二区</a>| <a href="http://www.ilebo.cn" target="_blank">色播久久人人爽人人爽人人片AV</a>| <a href="http://www.63552277.cn" target="_blank">久久精品国产影库免费看</a>| <a href="http://www.d8950.cn" target="_blank">亚洲精品白浆高清久久久久久 </a>| <a href="http://www.ccjump.cn" target="_blank">久久免费观看视频</a>| <a href="http://www.hongneiku.cn" target="_blank">久久久久无码精品国产</a>| <a href="http://www.sobseo.cn" target="_blank">超级97碰碰碰碰久久久久最新</a>| <a href="http://www.adidas2009.cn" target="_blank">热99re久久国超精品首页</a>| <a href="http://www.ailazi.com.cn" target="_blank">囯产精品久久久久久久久蜜桃 </a>| <a href="http://www.j8hq8.cn" target="_blank">国产精品久久新婚兰兰</a>| <a href="http://www.antsgogo.cn" target="_blank">国产美女久久久</a>| <a href="http://www.airesou.cn" target="_blank">久久精品天天中文字幕人妻 </a>| <a href="http://www.cizbuk.cn" target="_blank">久久免费香蕉视频</a>| <a href="http://www.kiterunner.com.cn" target="_blank">狠色狠色狠狠色综合久久</a>| <a href="http://www.baizen.cn" target="_blank">久久亚洲中文字幕精品有坂深雪</a>| <a href="http://www.yicheng688.cn" target="_blank">国产L精品国产亚洲区久久</a>| <a href="http://www.8812345.com.cn" target="_blank">久久久久女人精品毛片</a>| <a href="http://www.splh.net.cn" target="_blank">亚洲精品乱码久久久久久按摩</a>| <a href="http://www.dlucai.cn" target="_blank">国产精品中文久久久久久久</a>| <a href="http://www.khdv.cn" target="_blank">欧美一级久久久久久久大片</a>| <a href="http://www.hrbtwlh.cn" target="_blank">精品久久久久中文字</a>| <a href="http://www.tvhhm.cn" target="_blank">99久久免费国产精品</a>| <a href="http://www.philadelphiausa.cn" target="_blank">Xx性欧美肥妇精品久久久久久</a>| <a href="http://www.b8800.cn" target="_blank">久久综合久久久</a>| <a href="http://www.aoshidun.com.cn" target="_blank">久久久中文字幕</a>| <a href="http://www.shdad.cn" target="_blank">久久久久国产精品嫩草影院</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>