Your Name %!s(int64=6) %!d(string=hai) anos
pai
achega
9eccfea6dd

+ 148 - 181
hg3535/.idea/workspace.xml

@@ -4,14 +4,15 @@
     <list default="true" id="7fa42e97-ddea-4404-91db-5a9ccc162649" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/items.py" beforeDir="false" afterPath="$PROJECT_DIR$/items.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/pipeline/guanjun.py" beforeDir="false" afterPath="$PROJECT_DIR$/pipeline/guanjun.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/pipeline/roll_bangqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/pipeline/roll_bangqiu.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/pipeline/jieshu.py" beforeDir="false" afterPath="$PROJECT_DIR$/pipeline/jieshu.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/pipeline/roll_zuqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/pipeline/roll_zuqiu.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/pipeline/zuqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/pipeline/zuqiu.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/settings.py" beforeDir="false" afterPath="$PROJECT_DIR$/settings.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/spiders/guanjun.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/guanjun.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/spiders/roll_bangqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/roll_bangqiu.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/spiders/jieshu.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/jieshu.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/spiders/roll_zuqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/roll_zuqiu.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/spiders/zuqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/zuqiu.py" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
@@ -21,7 +22,7 @@
   </component>
   <component name="CoverageDataManager">
     <SUITE FILE_PATH="coverage/hg3535$items.coverage" NAME="items Coverage Results" MODIFIED="1554291398794" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
-    <SUITE FILE_PATH="coverage/hg3535$main.coverage" NAME="main Coverage Results" MODIFIED="1567586454353" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
+    <SUITE FILE_PATH="coverage/hg3535$main.coverage" NAME="main Coverage Results" MODIFIED="1567677951857" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
     <SUITE FILE_PATH="coverage/hg3535$hgjieshu.coverage" NAME="hgjieshu Coverage Results" MODIFIED="1558494720094" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/spiders" />
     <SUITE FILE_PATH="coverage/hg3535$halffull.coverage" NAME="halffull Coverage Results" MODIFIED="1554544334424" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/spiders" />
     <SUITE FILE_PATH="coverage/hg3535$pipelines.coverage" NAME="pipelines Coverage Results" MODIFIED="1554290866137" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
@@ -53,7 +54,7 @@
         <entry file="file://$PROJECT_DIR$/main.py">
           <provider selected="true" editor-type-id="text-editor">
             <state relative-caret-position="280">
-              <caret line="14" column="48" lean-forward="true" selection-start-line="14" selection-start-column="48" selection-end-line="14" selection-end-column="48" />
+              <caret line="14" column="42" lean-forward="true" selection-start-line="14" selection-start-column="42" selection-end-line="14" selection-end-column="42" />
               <folding>
                 <element signature="e#0#10#0" expanded="true" />
               </folding>
@@ -62,58 +63,67 @@
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/settings.py">
+        <entry file="file://$PROJECT_DIR$/spiders/roll_zuqiu.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="404">
+              <caret line="438" column="60" selection-start-line="438" selection-start-column="60" selection-end-line="438" selection-end-column="60" />
+              <folding>
+                <element signature="e#38#53#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/spiders/jieshu.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="125">
-              <caret line="153" column="43" selection-start-line="153" selection-start-column="43" selection-end-line="153" selection-end-column="43" />
+            <state relative-caret-position="180">
+              <caret line="9" column="4" selection-start-line="9" selection-end-line="9" selection-end-column="55" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/pipeline/roll_zuqiu.py">
+        <entry file="file://$PROJECT_DIR$/pipeline/jieshu.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="109">
-              <caret line="446" selection-start-line="446" selection-end-line="446" />
+            <state relative-caret-position="-464">
+              <caret line="14" column="32" lean-forward="true" selection-start-line="14" selection-start-column="32" selection-end-line="14" selection-end-column="32" />
               <folding>
-                <element signature="e#18#33#0" expanded="true" />
+                <element signature="e#18#32#0" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/spiders/roll_zuqiu.py">
+        <entry file="file://$PROJECT_DIR$/spiders/zuqiu.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="7409">
-              <caret line="406" column="29" lean-forward="true" selection-start-line="406" selection-start-column="29" selection-end-line="406" selection-end-column="29" />
+            <state relative-caret-position="-1622">
+              <caret line="410" column="64" selection-start-line="410" selection-start-column="64" selection-end-line="410" selection-end-column="64" />
               <folding>
-                <element signature="e#38#53#0" expanded="true" />
+                <element signature="e#24#35#0" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/spiders/guanjun.py">
+        <entry file="file://$PROJECT_DIR$/pipeline/zuqiu.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="20">
-              <caret line="52" column="46" selection-start-line="52" selection-start-column="46" selection-end-line="52" selection-end-column="46" />
+            <state relative-caret-position="-275">
+              <caret line="569" column="17" lean-forward="true" selection-start-line="569" selection-start-column="17" selection-end-line="569" selection-end-column="17" />
               <folding>
-                <element signature="e#38#53#0" expanded="true" />
+                <element signature="e#0#15#0" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/pipeline/guanjun.py">
+        <entry file="file://$PROJECT_DIR$/settings.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="2222">
-              <caret line="127" column="25" lean-forward="true" selection-start-line="127" selection-start-column="25" selection-end-line="127" selection-end-column="25" />
-              <folding>
-                <element signature="e#18#32#0" expanded="true" />
-              </folding>
+            <state relative-caret-position="61">
+              <caret line="148" column="40" selection-start-line="148" selection-start-column="40" selection-end-line="148" selection-end-column="40" />
             </state>
           </provider>
         </entry>
@@ -129,10 +139,6 @@
   </component>
   <component name="FindInProjectRecents">
     <findStrings>
-      <find>psycopg2.extras</find>
-      <find>pt</find>
-      <find>Lanqiustatus</find>
-      <find>new_times</find>
       <find>status</find>
       <find>3206572</find>
       <find>get_pcode</find>
@@ -159,6 +165,10 @@
       <find>triangle</find>
       <find>match_score_dict</find>
       <find>南美自由杯2019</find>
+      <find>爱尔兰甲组联赛2019</find>
+      <find>爱尔兰甲组联赛</find>
+      <find>corner_ball</find>
+      <find>Hgjieshu</find>
     </findStrings>
     <replaceStrings>
       <replace>&quot;&quot;</replace>
@@ -241,35 +251,35 @@
         <option value="$PROJECT_DIR$/.gitignore" />
         <option value="$PROJECT_DIR$/utils/helper.py" />
         <option value="$PROJECT_DIR$/pipeline/ball_func.py" />
-        <option value="$PROJECT_DIR$/spiders/zuqiu.py" />
         <option value="$PROJECT_DIR$/pipeline/saiguo.py" />
         <option value="$PROJECT_DIR$/spiders/saiguo.py" />
         <option value="$PROJECT_DIR$/pipeline/wangqiu.py" />
         <option value="$PROJECT_DIR$/pipeline/bangqiu.py" />
-        <option value="$PROJECT_DIR$/pipeline/zuqiu.py" />
         <option value="$PROJECT_DIR$/pipeline/roll_wangqiu.py" />
         <option value="$PROJECT_DIR$/spiders/roll_wangqiu.py" />
         <option value="$PROJECT_DIR$/spiders/roll_lanqiu.py" />
-        <option value="$PROJECT_DIR$/pipeline/jieshu.py" />
-        <option value="$PROJECT_DIR$/spiders/jieshu.py" />
         <option value="$PROJECT_DIR$/pipeline/roll_lanqiu.py" />
         <option value="$PROJECT_DIR$/pipeline/lanqiu.py" />
         <option value="$PROJECT_DIR$/spiders/lanqiu.py" />
         <option value="$PROJECT_DIR$/spiders/roll_bangqiu.py" />
         <option value="$PROJECT_DIR$/pipeline/roll_bangqiu.py" />
-        <option value="$PROJECT_DIR$/items.py" />
-        <option value="$PROJECT_DIR$/settings.py" />
         <option value="$PROJECT_DIR$/spiders/guanjun.py" />
+        <option value="$PROJECT_DIR$/pipeline/guanjun.py" />
         <option value="$PROJECT_DIR$/pipeline/roll_zuqiu.py" />
+        <option value="$PROJECT_DIR$/items.py" />
+        <option value="$PROJECT_DIR$/spiders/jieshu.py" />
+        <option value="$PROJECT_DIR$/pipeline/jieshu.py" />
+        <option value="$PROJECT_DIR$/settings.py" />
+        <option value="$PROJECT_DIR$/pipeline/zuqiu.py" />
         <option value="$PROJECT_DIR$/main.py" />
-        <option value="$PROJECT_DIR$/pipeline/guanjun.py" />
         <option value="$PROJECT_DIR$/spiders/roll_zuqiu.py" />
+        <option value="$PROJECT_DIR$/spiders/zuqiu.py" />
       </list>
     </option>
   </component>
   <component name="ProjectFrameBounds" extendedState="6">
-    <option name="x" value="-404" />
-    <option name="y" value="79" />
+    <option name="x" value="-152" />
+    <option name="y" value="94" />
     <option name="width" value="1458" />
     <option name="height" value="1017" />
   </component>
@@ -286,11 +296,6 @@
               <item name="hg3535" type="b2602c69:ProjectViewProjectNode" />
               <item name="hg3535" type="462c0819:PsiDirectoryNode" />
             </path>
-            <path>
-              <item name="hg3535" type="b2602c69:ProjectViewProjectNode" />
-              <item name="hg3535" type="462c0819:PsiDirectoryNode" />
-              <item name="log" type="462c0819:PsiDirectoryNode" />
-            </path>
             <path>
               <item name="hg3535" type="b2602c69:ProjectViewProjectNode" />
               <item name="hg3535" type="462c0819:PsiDirectoryNode" />
@@ -301,11 +306,6 @@
               <item name="hg3535" type="462c0819:PsiDirectoryNode" />
               <item name="spiders" type="462c0819:PsiDirectoryNode" />
             </path>
-            <path>
-              <item name="hg3535" type="b2602c69:ProjectViewProjectNode" />
-              <item name="hg3535" type="462c0819:PsiDirectoryNode" />
-              <item name="utils" type="462c0819:PsiDirectoryNode" />
-            </path>
           </expand>
           <select />
         </subPane>
@@ -580,7 +580,7 @@
       <workItem from="1566976369645" duration="4000" />
       <workItem from="1566976385269" duration="13184000" />
       <workItem from="1566990066292" duration="35762000" />
-      <workItem from="1567126891838" duration="141987000" />
+      <workItem from="1567126891838" duration="169372000" />
     </task>
     <task id="LOCAL-00001" summary="修改后,版本二">
       <created>1555727493584</created>
@@ -890,11 +890,18 @@
       <option name="project" value="LOCAL" />
       <updated>1567567386386</updated>
     </task>
-    <option name="localTasksCounter" value="45" />
+    <task id="LOCAL-00045" summary="updata">
+      <created>1567588210355</created>
+      <option name="number" value="00045" />
+      <option name="presentableId" value="LOCAL-00045" />
+      <option name="project" value="LOCAL" />
+      <updated>1567588210355</updated>
+    </task>
+    <option name="localTasksCounter" value="46" />
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="1820661000" />
+    <option name="totallyTimeSpent" value="1848046000" />
   </component>
   <component name="TodoView">
     <todo-panel id="selected-file">
@@ -907,13 +914,14 @@
   </component>
   <component name="ToolWindowManager">
     <frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
+    <editor active="true" />
     <layout>
-      <window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.71173847" visible="true" weight="0.1705757" />
+      <window_info content_ui="combo" id="Project" order="0" sideWeight="0.71173847" visible="true" weight="0.15298508" />
       <window_info id="Structure" order="1" sideWeight="0.2882615" side_tool="true" weight="0.1108742" />
       <window_info id="Favorites" order="2" sideWeight="0.5013405" side_tool="true" weight="0.108208954" />
       <window_info anchor="bottom" id="Message" order="0" />
       <window_info anchor="bottom" id="Find" order="1" weight="0.32832617" />
-      <window_info anchor="bottom" id="Debug" order="2" sideWeight="0.49946696" visible="true" weight="0.2811159" />
+      <window_info anchor="bottom" id="Debug" order="2" sideWeight="0.49946696" weight="0.49570817" />
       <window_info anchor="bottom" id="Cvs" order="3" weight="0.25" />
       <window_info anchor="bottom" id="Inspection" order="4" weight="0.4" />
       <window_info anchor="bottom" id="TODO" order="5" weight="0.32832617" />
@@ -923,7 +931,7 @@
       <window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.50692964" side_tool="true" weight="0.38519314" />
       <window_info anchor="bottom" x="22" y="376" width="1876" height="298" id="Terminal" order="10" sideWeight="0.49307036" weight="0.3530043" />
       <window_info anchor="bottom" id="Python Console" order="11" sideWeight="0.49946696" weight="0.4356223" />
-      <window_info anchor="bottom" id="Run" order="12" sideWeight="0.87473345" weight="0.24892704" />
+      <window_info active="true" anchor="bottom" id="Run" order="12" sideWeight="0.87473345" visible="true" weight="0.5075107" />
       <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
       <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
       <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
@@ -1037,31 +1045,11 @@
           <line>84</line>
           <option name="timeStamp" value="4" />
         </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/pipeline/zuqiu.py</url>
-          <line>251</line>
-          <option name="timeStamp" value="46" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/spiders/zuqiu.py</url>
-          <line>355</line>
-          <option name="timeStamp" value="55" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/spiders/zuqiu.py</url>
-          <line>379</line>
-          <option name="timeStamp" value="56" />
-        </line-breakpoint>
         <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
           <url>file://$PROJECT_DIR$/pipeline/roll_bangqiu.py</url>
           <line>91</line>
           <option name="timeStamp" value="58" />
         </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/pipeline/zuqiu.py</url>
-          <line>274</line>
-          <option name="timeStamp" value="62" />
-        </line-breakpoint>
         <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
           <url>file://$PROJECT_DIR$/pipeline/zuqiu.py</url>
           <line>208</line>
@@ -1082,21 +1070,6 @@
           <line>276</line>
           <option name="timeStamp" value="71" />
         </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/spiders/zuqiu.py</url>
-          <line>341</line>
-          <option name="timeStamp" value="72" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/spiders/zuqiu.py</url>
-          <line>342</line>
-          <option name="timeStamp" value="73" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/spiders/zuqiu.py</url>
-          <line>366</line>
-          <option name="timeStamp" value="74" />
-        </line-breakpoint>
         <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
           <url>file://$PROJECT_DIR$/spiders/saiguo.py</url>
           <line>86</line>
@@ -1173,19 +1146,14 @@
           <option name="timeStamp" value="169" />
         </line-breakpoint>
         <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/spiders/roll_zuqiu.py</url>
-          <line>392</line>
-          <option name="timeStamp" value="179" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/spiders/roll_zuqiu.py</url>
-          <line>386</line>
-          <option name="timeStamp" value="180" />
+          <url>file://$PROJECT_DIR$/spiders/zuqiu.py</url>
+          <line>60</line>
+          <option name="timeStamp" value="189" />
         </line-breakpoint>
         <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/spiders/roll_zuqiu.py</url>
-          <line>388</line>
-          <option name="timeStamp" value="181" />
+          <url>file://$PROJECT_DIR$/spiders/zuqiu.py</url>
+          <line>423</line>
+          <option name="timeStamp" value="190" />
         </line-breakpoint>
       </breakpoints>
       <default-breakpoints>
@@ -1343,9 +1311,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/jianting.py">
-      <provider selected="true" editor-type-id="text-editor" />
-    </entry>
     <entry file="file://$PROJECT_DIR$/not_roll.py">
       <provider selected="true" editor-type-id="text-editor">
         <state>
@@ -1371,16 +1336,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pipeline/saiguo.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="46">
-          <caret line="29" column="9" selection-start-line="29" selection-start-column="8" selection-end-line="29" selection-end-column="44" />
-          <folding>
-            <element signature="e#18#33#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/spiders/saiguo.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="260">
@@ -1401,16 +1356,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pipeline/jieshu.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="150">
-          <caret line="29" selection-start-line="29" selection-end-line="29" />
-          <folding>
-            <element signature="e#18#32#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/spiders/bangqiu.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="-180" />
@@ -1426,16 +1371,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/zuqiu.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-5836">
-          <caret line="40" column="21" lean-forward="true" selection-start-line="40" selection-start-column="14" selection-end-line="40" selection-end-column="70" />
-          <folding>
-            <element signature="e#24#35#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/spiders/lanqiu.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="342">
@@ -1456,16 +1391,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/jieshu.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="395">
-          <caret line="39" selection-start-line="39" selection-end-line="39" />
-          <folding>
-            <element signature="e#0#15#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/spiders/roll_wangqiu.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="420">
@@ -1496,16 +1421,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pipeline/zuqiu.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="226">
-          <caret line="73" column="31" selection-start-line="73" selection-start-column="31" selection-end-line="73" selection-end-column="31" />
-          <folding>
-            <element signature="e#0#15#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/pipeline/bangqiu.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="-3820">
@@ -1547,76 +1462,128 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/items.py">
+    <entry file="file://$PROJECT_DIR$/log/guanjun_2019_9_4.log">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="591">
-          <caret line="73" column="8" selection-start-line="73" selection-start-column="4" selection-end-line="73" selection-end-column="10" />
+        <state relative-caret-position="-19721">
+          <caret line="586" selection-start-line="586" selection-end-line="586" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/settings.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="125">
-          <caret line="153" column="43" selection-start-line="153" selection-start-column="43" selection-end-line="153" selection-end-column="43" />
-        </state>
-      </provider>
+    <entry file="file://$PROJECT_DIR$/jianting.py">
+      <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/log/guanjun_2019_9_4.log">
+    <entry file="file://$PROJECT_DIR$/pipeline/saiguo.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="368">
-          <caret line="2217" column="53" lean-forward="true" selection-start-line="2217" selection-end-line="2218" />
+        <state relative-caret-position="46">
+          <caret line="29" column="9" selection-start-line="29" selection-start-column="8" selection-end-line="29" selection-end-column="44" />
+          <folding>
+            <element signature="e#18#33#0" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/main.py">
+    <entry file="file://$PROJECT_DIR$/pipeline/roll_zuqiu.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="280">
-          <caret line="14" column="48" lean-forward="true" selection-start-line="14" selection-start-column="48" selection-end-line="14" selection-end-column="48" />
+        <state relative-caret-position="3573">
+          <caret line="595" column="30" selection-start-line="593" selection-end-line="599" selection-end-column="43" />
           <folding>
-            <element signature="e#0#10#0" expanded="true" />
+            <element signature="e#18#33#0" expanded="true" />
+            <element signature="e#2583#3563#0" />
+            <element signature="e#3728#4959#0" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pipeline/roll_zuqiu.py">
+    <entry file="file://$PROJECT_DIR$/pipeline/guanjun.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="109">
-          <caret line="446" selection-start-line="446" selection-end-line="446" />
+        <state relative-caret-position="238">
+          <caret line="12" selection-start-line="12" selection-end-line="13" />
           <folding>
-            <element signature="e#18#33#0" expanded="true" />
+            <element signature="e#18#32#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/spiders/guanjun.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="20">
-          <caret line="52" column="46" selection-start-line="52" selection-start-column="46" selection-end-line="52" selection-end-column="46" />
+        <state relative-caret-position="28">
+          <caret line="20" column="10" lean-forward="true" selection-start-line="20" selection-start-column="10" selection-end-line="20" selection-end-column="10" />
           <folding>
             <element signature="e#38#53#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pipeline/guanjun.py">
+    <entry file="file://$PROJECT_DIR$/items.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="138">
+          <caret line="478" column="14" lean-forward="true" selection-start-line="478" selection-start-column="14" selection-end-line="478" selection-end-column="14" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/jieshu.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="2222">
-          <caret line="127" column="25" lean-forward="true" selection-start-line="127" selection-start-column="25" selection-end-line="127" selection-end-column="25" />
+        <state relative-caret-position="180">
+          <caret line="9" column="4" selection-start-line="9" selection-end-line="9" selection-end-column="55" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/settings.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="61">
+          <caret line="148" column="40" selection-start-line="148" selection-start-column="40" selection-end-line="148" selection-end-column="40" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/pipeline/jieshu.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-464">
+          <caret line="14" column="32" lean-forward="true" selection-start-line="14" selection-start-column="32" selection-end-line="14" selection-end-column="32" />
           <folding>
             <element signature="e#18#32#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/pipeline/zuqiu.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-275">
+          <caret line="569" column="17" lean-forward="true" selection-start-line="569" selection-start-column="17" selection-end-line="569" selection-end-column="17" />
+          <folding>
+            <element signature="e#0#15#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/main.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="280">
+          <caret line="14" column="42" lean-forward="true" selection-start-line="14" selection-start-column="42" selection-end-line="14" selection-end-column="42" />
+          <folding>
+            <element signature="e#0#10#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
     <entry file="file://$PROJECT_DIR$/spiders/roll_zuqiu.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="7409">
-          <caret line="406" column="29" lean-forward="true" selection-start-line="406" selection-start-column="29" selection-end-line="406" selection-end-column="29" />
+        <state relative-caret-position="404">
+          <caret line="438" column="60" selection-start-line="438" selection-start-column="60" selection-end-line="438" selection-end-column="60" />
           <folding>
             <element signature="e#38#53#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/zuqiu.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="-1622">
+          <caret line="410" column="64" selection-start-line="410" selection-start-column="64" selection-end-line="410" selection-end-column="64" />
+          <folding>
+            <element signature="e#24#35#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
   </component>
 </project>

+ 12 - 1
hg3535/items.py

@@ -137,6 +137,11 @@ class Zuqiu(scrapy.Field):
     # 足球 最先进球/最后进球
     first_last_ball = scrapy.Field()
     zuqiu = scrapy.Field()
+    horn_ou_dict = scrapy.Field()
+    horn_ou_dict_rule = scrapy.Field()
+    horn_oe_dict = scrapy.Field()
+    horn_oe_dict_rule = scrapy.Field()
+    horn_team = scrapy.Field()
 
 
 # 网球 让球&大小盘--------------------------------------------------------------------------------------------------------
@@ -271,7 +276,7 @@ class Roll_Zuqiu(scrapy.Field):
     time_game = scrapy.Field()
     half_way = scrapy.Field()
     pt = scrapy.Field()
-    corner_ball = scrapy.Field()
+    horn_team = scrapy.Field()
     zhuangtai = scrapy.Field()
     # 球队进球大小
     full_data = scrapy.Field()
@@ -321,6 +326,11 @@ class Roll_Zuqiu(scrapy.Field):
     score_guest = scrapy.Field()
     score_home = scrapy.Field()
 
+    horn_ou_dict = scrapy.Field()
+    horn_ou_dict_rule = scrapy.Field()
+    horn_oe_dict = scrapy.Field()
+    horn_oe_dict_rule = scrapy.Field()
+
 
 class Zuqiustatus(scrapy.Field):
     match_id = scrapy.Field()
@@ -470,4 +480,5 @@ class Hgjieshu(scrapy.Field):
     # status = scrapy.Field()
     ball = scrapy.Field()
     match_id = scrapy.Field()
+    status = scrapy.Field()
 

+ 12 - 13
hg3535/pipeline/guanjun.py

@@ -78,27 +78,26 @@ class Guanjunpipeline(object):
                 res = Helper.async_post(LEAGUE_URL, l_payload)
                 if res:
                     if "成功" in res:
-                        logger.info('{}冠军联赛, 提交成功, {}'.format(game_code, res))
+                        logger.info('{}, {}冠军联赛, 提交成功, {}'.format(game_code, league_name, res))
                         logger.info(league_list)
                         self.db[league_table].insert(league_list)
                     else:
-                        logger.warning('{}, 冠军联赛, 提交失败, {}'.format(game_code, res))
+                        logger.warning('{}, {}, 冠军联赛, 提交失败, {}'.format(game_code, league_name, res))
                         logger.warning(l_payload)
                 else:
-                    logger.warning('{}, 冠军联赛, 接口异常, 提交失败, {}'.format(game_code, res))
+                    logger.warning('{}, {}, 冠军联赛, 接口异常, 提交失败, {}'.format(game_code, league_name, res))
                     logger.warning(l_payload)
             except Exception as e:
                 logger.warning('冠军联赛接口异常, 提交失败, {}'.format(e))
                 logger.warning(e)
         else:
             logging.info('{},冠军联赛数据已存在'.format(league_name))
-        payload_key1 = ['game_code', 'title', 'source', 'lg_id']
-        payload_value1 = [game_code, 'odds_ch', 'hg3535', league_id]
+        payload_key1 = ['game_code', 'title', 'source', 'lg_id', 'uuid']
+        payload_value1 = [game_code, 'odds_ch', 'hg3535', league_id, uuid]
         chain_dict = dict(zip(payload_key1, payload_value1))
         data_list = []
         only_list = []
         set_id = item['set_id']
-        # self.db[odds_table].find({'league_id': league_id, 'match_id': set_id})
         for champion_data in champion_datas:
             mn = champion_data['mn']
             odd_datas = champion_data['o']
@@ -108,13 +107,13 @@ class Guanjunpipeline(object):
                 sole = Helper.genearte_MD5(mn + str(league_id) + league_name + new_league_name + tema, 0)
                 odds_only = Helper.genearte_MD5(
                     mn + str(league_id) + league_name + new_league_name + str(odd) + tema, 0)
-                if self.db[odds_table].find({'odds_only': odds_only}).count() < 1:
-                    data_key = ['match_id', 'lg_id', 'odds_code', 'status', 'sort', 'p_code', 'odds',
-                                'condition', 'odds_only', 'sole', 'source', 'type', 'team', 'uuid']
-                    data_value = [set_id, league_id, mn, '0', '0', new_league_name, odd, '0', odds_only,
-                                  sole, 'hg3535', '1', tema, uuid]
-                    chain_data = dict(zip(data_key, data_value))
-                    data_list.append(chain_data)
+                # if self.db[odds_table].find({'odds_only': odds_only}).count() < 1:
+                data_key = ['match_id', 'lg_id', 'odds_code', 'status', 'sort', 'p_code', 'odds',
+                            'condition', 'odds_only', 'sole', 'source', 'type', 'team', 'uuid']
+                data_value = [set_id, league_id, mn, '0', '0', new_league_name, odd, '0', odds_only,
+                              sole, 'hg3535', '1', tema, uuid]
+                chain_data = dict(zip(data_key, data_value))
+                data_list.append(chain_data)
         if data_list:
             chain_dict['data'] = data_list
             chain_dict['odds_only'] = only_list

+ 11 - 4
hg3535/pipeline/jieshu.py

@@ -5,10 +5,11 @@ import logging
 
 # import redis
 # from twisted.internet import defer, reactor
+import redis
 
 from ..settings import M_HOST, M_USER, M_PASSWORD, M_POST, M_DB, MATCH_STATUS
 from ..utils.helper import Helper
-
+from ..settings import R_HOST, R_PASSWORD, R_POST, R_DB
 
 # 滚球足球 插入
 class Jieshuqiupipeline(object):
@@ -16,8 +17,8 @@ class Jieshuqiupipeline(object):
     def open_spider(self, spider):
         self.mongo = pymongo.MongoClient(host=M_HOST, username=M_USER, password=M_PASSWORD, port=M_POST)
         self.db = self.mongo[M_DB]
-        # cls = redis.Redis(host='192.168.0.110', port=6379, db=0)
-    #
+        self.rls = redis.Redis(host=R_HOST, port=R_POST, db=R_DB, password=R_PASSWORD)
+
     # @defer.inlineCallbacks
     # def process_item(self, item, spider):
     #     out = defer.Deferred()
@@ -30,6 +31,7 @@ class Jieshuqiupipeline(object):
         logger = logging.getLogger(__name__)
         ball = item['ball']
         match_id = item['match_id']
+        status = item['status']
         if ball == '足球':
             game_code = "zq"
         elif ball == '篮球':
@@ -38,9 +40,14 @@ class Jieshuqiupipeline(object):
             game_code = "wq"
         else:
             game_code = "bq"
+        if status:
+            roll_status = 1
+            self.rls.srem('hg3535.gunqiu.ids', match_id)
+        else:
+            roll_status = 2
         status_dict = {"game_code": game_code, "title": "match_status", "source": "hg3535"}
         data_list = []
-        data = {'match_id': match_id, 'status': 2, "is_rollball": 0, "is_today": 0, "is_morningplate": 0, "is_stringscene": 0, "is_horn": 0}
+        data = {'match_id': match_id, 'status': roll_status, "is_rollball": 0, "is_today": 0, "is_morningplate": 0, "is_stringscene": 0, "is_horn": 0}
         data_list.append(data)
         status_dict['data'] = data_list
         res = Helper.async_post(MATCH_STATUS, status_dict)

+ 561 - 19
hg3535/pipeline/roll_zuqiu.py

@@ -20,15 +20,15 @@ class Roll_Zuqiupipeline(object):
         self.mongo = pymongo.MongoClient(host=M_HOST, username=M_USER, password=M_PASSWORD, port=M_POST)
         self.db = self.mongo[M_DB]
 
-    # @defer.inlineCallbacks
-    # def process_item(self, item, spider):
-    #     out = defer.Deferred()
-    #     reactor.callInThread(self._do_calculation, item, out)
-    #     yield out
-    #     defer.returnValue(item)
-
+    @defer.inlineCallbacks
     def process_item(self, item, spider):
-    # def _do_calculation(self, item, out):
+        out = defer.Deferred()
+        reactor.callInThread(self._do_calculation, item, out)
+        yield out
+        defer.returnValue(item)
+
+    # def process_item(self, item, spider):
+    def _do_calculation(self, item, out):
         logger = logging.getLogger(__name__)
         pt = 4
         # 比赛日期
@@ -65,10 +65,10 @@ class Roll_Zuqiupipeline(object):
         all_goal = int(score_home) + int(score_guest)
         half_way = item['half_way']
         match_score = "{}:{}".format(score_home, score_guest)
-        corner_ball = item['corner_ball']
         last_time = '{}-12-31 23:59:59'.format(datetime.datetime.now().year)
         league_list = []
         uuid = Helper.genearte_uuid(league_name + 'hg3535')
+        horn_team = item['horn_team']
         if self.db.zq_league35.find({'league_id': league_id}).count() < 1:
             league_dict = {"game_code": "zq", "title": "league", "source": "hg3535"}
             league_key = ["name_chinese", "kind", "match_mode", "if_stop", "last_time", "lg_id", "source", "uuid"]
@@ -90,14 +90,15 @@ class Roll_Zuqiupipeline(object):
                 logger.warning(league_dict)
         else:
             logger.info('足球滚球联赛已存在, 不存在')
+
         if self.db.zq_competition35.find({"match_id": match_id, 'is_rollball': 1}).count() < 1:
             match_list = []
             match_dict = {"game_code": "zq", "title": "match", "source": "hg3535"}
             match_kay = ["home_team", "guest_team", "lg_id", "status", "match_id", "match_date", "match_time",
                          "tag", "source", "is_rollball", "is_morningplate", "is_stringscene", "us_time", "uuid",
-                         "half_match_id", "is_today"]
+                         "half_match_id", "is_today", "is_horn"]
             match_value = [team_home, team_guest, league_id, 1, match_id, match_date, '00:00', number,
-                           "hg3535", 1, 0, 0, utime, uuid, 0, 0]
+                           "hg3535", 1, 0, 0, utime, uuid, 0, 0, 0]
             match_data = dict(zip(match_kay, match_value))
             match_list.append(match_data)
             match_dict['data'] = match_list
@@ -258,7 +259,7 @@ class Roll_Zuqiupipeline(object):
             concede_guest_data = dict(zip(concede_home_key, concede_home_value))
             data_list.append(concede_guest_data)
 
-        # 独赢----------------------------------------------------------------------------------------------------------
+        # 独赢-------------------------------------------------------------------------------------------------------
         p_code = 'C'
         half_capot_home = item["half_capot_home"]
         half_capot_guest = item["half_capot_guest"]
@@ -338,7 +339,7 @@ class Roll_Zuqiupipeline(object):
         capot_guest_data = dict(zip(capot_guest_key, capot_guest_value))
         data_list.append(capot_guest_data)
 
-        # 入球数单双-----------------------------------------------------------------------------------------------------
+        # 入球数单双--------------------------------------------------------------------------------------------------
         p_code = 'TS'
         odd_even_odd = item["odd_even_odd"]
         odd_even_even = item["odd_even_even"]
@@ -394,9 +395,9 @@ class Roll_Zuqiupipeline(object):
         data_list.append(half_single_data)
 
         p_code = 'TG'
-        # 总入球数 ------------------------------------------------------------------------------------------------------
+        # 总入球数 ---------------------------------------------------------------------------------------------------
         total_goals = item['total_goal']
-        total_dict = {'tg0': '0-1', 'tg1': '2-3', 'tg2': '4-6','tg3': '7或以上', 'tg0_h': '0', "tg1_h": '1',
+        total_dict = {'tg0': '0-1', 'tg1': '2-3', 'tg2': '4-6', 'tg3': '7或以上', 'tg0_h': '0', "tg1_h": '1',
                       "tg2_h": '2', "tg3_h": '3或以上'}
         # 全场入球数 单双
         for key, value in total_goals.items():
@@ -411,7 +412,7 @@ class Roll_Zuqiupipeline(object):
             total_goals_data = dict(zip(total_goals_key, total_goals_value))
             data_list.append(total_goals_data)
 
-        # 全场半场 ------------------------------------------------------------------------------------------------------
+        # 全场半场 ---------------------------------------------------------------------------------------------------
         half_fulls = item['half_full']
         # p_code, p_id = get_pcode(corner_ball, 'half_full')
         p_code = 'HF'
@@ -430,7 +431,7 @@ class Roll_Zuqiupipeline(object):
                 half_fulls_data = dict(zip(half_fulls_key, half_fulls_value))
                 data_list.append(half_fulls_data)
 
-        # 波胆-----------------------------------------------------------------------------------------------------------
+        # 波胆-------------------------------------------------------------------------------------------------------
         p_code = 'B'
         bodan_datas = item['bodan_data']
         # p_code, p_id = get_pcode(corner_ball, 'bodan')
@@ -455,7 +456,7 @@ class Roll_Zuqiupipeline(object):
                 bodan_dict_data = dict(zip(bodan_dict_key, bodan_dict_value))
                 data_list.append(bodan_dict_data)
 
-        # 最先进球/最后进球 ----------------------------------------------------------------------------------------------
+        # 最先进球/最后进球 -------------------------------------------------------------------------------------------
         first_last_balls = item['first_last_ball']
         p_code = 'FLB'
         first_last_dict = {"flbfh": "最先进球", "flbfg": "最先进球", "flblh": "最后进球", "flblg": "最后进球", "flbn": "没有进球"}
@@ -505,6 +506,39 @@ class Roll_Zuqiupipeline(object):
                                     odds_only, sole, "hg3535", "0", ""]
                 half_dicts_data = dict(zip(half_dicts_key, half_dicts_value))
                 data_list.append(half_dicts_data)
+
+        p_code = 'CB'
+        # 球队得分全场,上半场
+        horn_ou_dict = item['horn_ou_dict']
+        horn_ou_dict_rule = item['horn_ou_dict_rule']
+        horn_oe_dict = item['horn_oe_dict']
+        horn_oe_dict_rule = item['horn_oe_dict_rule']
+        if horn_ou_dict:
+            for key, value in horn_ou_dict.items():
+                hash_str = p_code + key + '0' + horn_ou_dict_rule[key] + str(value) + "hg3535" + str(match_id)
+                sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                horn_ou_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                  "condition", "odds_only", "sole", "source", "type", "team"]
+                horn_ou_value = [match_id, league_id, key, "0", 0, p_code, value, horn_ou_dict_rule[key],
+                                    odds_only, sole, "hg3535", "0", ""]
+                horn_ou_data = dict(zip(horn_ou_key, horn_ou_value))
+                data_list.append(horn_ou_data)
+
+        if horn_oe_dict:
+            for key, value in horn_oe_dict.items():
+                hash_str = p_code + key + '0' + horn_oe_dict_rule[key] + str(value) + "hg3535" + str(match_id)
+                sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                horn_oe_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                  "condition", "odds_only", "sole", "source", "type", "team"]
+                horn_oe_value = [match_id, league_id, key, "0", 0, p_code, value, horn_oe_dict_rule[key],
+                                    odds_only, sole, "hg3535", "0", ""]
+                horn_oe_data = dict(zip(horn_oe_key, horn_oe_value))
+                data_list.append(horn_oe_data)
+
         odds_key = ["game_code", "title", "match_id", "lg_id", "data", "source", "odds_only", "tag", "uuid",
                     "is_stringscene", "utime", "pt"]
         odds_value = ["zq", "odds", match_id, league_id, data_list, "hg3535", odds_onlys, number, uuid,
@@ -555,7 +589,515 @@ class Roll_Zuqiupipeline(object):
                     logger.warning(r_data_dict)
             except Exception as e:
                 logger.warning('滚球数据接口异常,提交失败, {}'.format(e))
-        # reactor.callFromThread(out.callback, item)
+
+        #   角球分割处理--------------------------------------------------------------------------------------------------
+        if horn_team:
+            team_home = horn_team['horn_home']
+            team_guest = horn_team['horn_guest']
+            horn_scoreh = horn_team['horn_scoreh']
+            horn_scoreg = horn_team['horn_scoreg']
+            all_goal = int(horn_scoreh) + int(horn_scoreg)
+            match_id = horn_team['horn_id']
+            # half_way = item['half_way']
+            match_score = "{}:{}".format(horn_scoreh, horn_scoreg)
+            if self.db.zq_competition35.find({"match_id": match_id, 'is_rollball': 1}).count() < 1:
+                match_list = []
+                match_dict = {"game_code": "zq", "title": "match", "source": "hg3535"}
+                match_kay = ["home_team", "guest_team", "lg_id", "status", "match_id", "match_date", "match_time",
+                             "tag", "source", "is_rollball", "is_morningplate", "is_stringscene", "us_time", "uuid",
+                             "half_match_id", "is_today", "is_horn"]
+                match_value = [team_home, team_guest, league_id, 1, match_id, match_date, '00:00', number,
+                               "hg3535", 1, 0, 0, utime, uuid, 0, 0, 1]
+                match_data = dict(zip(match_kay, match_value))
+                match_list.append(match_data)
+                match_dict['data'] = match_list
+                res = Helper.async_post(MATCH_URL, match_dict)
+                if res:
+                    if "成功" in res:
+                        self.db.zq_competition35.insert(match_data)
+                        logger.info('足球滚球角球, 赛事提交成功, {}'.format(res))
+                        logger.info(match_data)
+                    else:
+                        logger.warning('足球滚球赛事, 角球提交失败, {}'.format(res))
+                        logger.warning(match_data)
+                else:
+                    logger.warning('足球滚球赛事接口异常, 角球赛事提交失败, {}'.format(res))
+                    logger.warning(match_data)
+            else:
+                logger.info('足球滚球赛事已存在, 不提交')
+            p_code = "GS"
+            # 构建唯一索引
+            half_size_guest = item["half_size_guest"]
+            half_size_guest_rule = item["half_size_guest_rule"]
+            half_size_home = item["half_size_home"]
+            half_size_home_rule = item["half_size_home_rule"]
+            data_list = []
+            odds_onlys = []
+
+            # half_size_guest
+            for index, value in enumerate(half_size_guest):
+                hash_str = p_code + "gss_h" + str(index) + str(half_size_guest_rule[index]) + str(
+                    value) + "hg3535" + str(match_id)
+                sole_str = p_code + "gss_h" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                half_size_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                       "odds_only", "sole", "source", "type", "team"]
+                condition = half_size_guest_rule[index]
+                half_size_guest_value = [match_id, league_id, "gss_h", "0", index, p_code, value, condition,
+                                         odds_only, sole, "hg3535", "0", ""]
+                half_size_guest_data = dict(zip(half_size_guest_key, half_size_guest_value))
+                data_list.append(half_size_guest_data)
+
+            # half_size_home
+            for index, value in enumerate(half_size_home):
+                hash_str = p_code + "gsb_h" + str(index) + str(half_size_home_rule[index]) + str(
+                    value) + "hg3535" + str(match_id)
+                sole_str = p_code + "gsb_h" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                half_size_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                      "odds_only", "sole", "source", "type", "team"]
+                condition = half_size_home_rule[index]
+                half_size_home_value = [match_id, league_id, "gsb_h", "0", index, p_code, value, condition,
+                                        odds_only, sole, "hg3535", "0", ""]
+                half_size_home_data = dict(zip(half_size_home_key, half_size_home_value))
+                data_list.append(half_size_home_data)
+
+            # 全场场大小
+            size_guest = item["size_guest"]
+            size_guest_rule = item["size_guest_rule"]
+            size_home = item["size_home"]
+            size_home_rule = item["size_home_rule"]
+            # size_home
+            for index, value in enumerate(size_home):
+                hash_str = p_code + "gsb" + str(index) + str(size_home_rule[index]) + str(value) + "hg3535" + str(
+                    match_id)
+                sole_str = p_code + "gsb" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                size_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                 "odds_only", "sole", "source", "type", "team"]
+                condition = size_home_rule[index]
+                size_home_value = [match_id, league_id, "gsb", "0", index, p_code, value, condition, odds_only,
+                                   sole, "hg3535", "0", ""]
+                size_home_data = dict(zip(size_home_key, size_home_value))
+                data_list.append(size_home_data)
+
+            # size_guest
+            for index, value in enumerate(size_guest):
+                hash_str = p_code + "gss" + str(index) + str(size_guest_rule[index]) + str(value) + "hg3535" + str(
+                    match_id)
+                sole_str = p_code + "gss" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                size_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                  "odds_only", "sole", "source", "type", "team"]
+                condition = size_guest_rule[index]
+                size_guest_value = [match_id, league_id, "gss", "0", index, p_code, value, condition, odds_only,
+                                    sole, "hg3535", "0", ""]
+                size_home_data = dict(zip(size_guest_key, size_guest_value))
+                data_list.append(size_home_data)
+
+            p_code = 'CO'
+            half_concede_home_rule = item["half_concede_home_rule"]
+            half_concede_home = item["half_concede_home"]
+            half_concede_guest_rule = item["half_concede_guest_rule"]
+            half_concede_guest = item["half_concede_guest"]
+            # half_concede_home
+            for index, value in enumerate(half_concede_guest):
+                hash_str = p_code + "cog_h" + str(index) + str(half_concede_guest_rule[index]) + str(
+                    value) + "hg3535" + str(match_id)
+                sole_str = p_code + "cog_h" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                half_concede_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                          "odds_only", "sole", "source", "type", "team"]
+                condition = half_concede_guest_rule[index]
+                half_concede_guest_value = [match_id, league_id, "cog_h", "0", index, p_code, value, condition,
+                                            odds_only, sole, "hg3535", "0", ""]
+                half_concede_guest_data = dict(zip(half_concede_guest_key, half_concede_guest_value))
+                data_list.append(half_concede_guest_data)
+
+            # half_concede_home
+            for index, value in enumerate(half_concede_home):
+                hash_str = p_code + "coh_h" + str(index) + str(half_concede_home_rule[index]) + str(
+                    value) + "hg3535" + str(match_id)
+                sole_str = p_code + "coh_h" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                half_concede_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                         "odds_only", "sole", "source", "type", "team"]
+                condition = half_concede_home_rule[index]
+                half_concede_home_value = [match_id, league_id, "coh_h", "0", index, p_code, value, condition,
+                                           odds_only, sole, "hg3535", "0", ""]
+                half_concede_home_data = dict(zip(half_concede_home_key, half_concede_home_value))
+                data_list.append(half_concede_home_data)
+
+            concede_guest = item["concede_guest"]
+            concede_guest_rule = item["concede_guest_rule"]
+            concede_home = item["concede_home"]
+            concede_home_rule = item["concede_home_rule"]
+            # concede_guest
+            for index, value in enumerate(concede_guest):
+                hash_str = p_code + "cog" + str(index) + str(concede_guest_rule[index]) + str(
+                    value) + "hg3535" + str(match_id)
+                sole_str = p_code + "cog" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                concede_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                     "odds_only", "sole", "source", "type", "team"]
+                condition = concede_guest_rule[index]
+                concede_guest_value = [match_id, league_id, "cog", "0", index, p_code, value, condition,
+                                       odds_only, sole, "hg3535", "0", ""]
+                concede_guest_data = dict(zip(concede_guest_key, concede_guest_value))
+                data_list.append(concede_guest_data)
+
+            # concede_home
+            for index, value in enumerate(concede_home):
+                hash_str = p_code + "coh" + str(index) + str(concede_home_rule[index]) + str(
+                    value) + "hg3535" + str(match_id)
+                sole_str = p_code + "coh" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                concede_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                    "odds_only", "sole", "source", "type", "team"]
+                condition = concede_home_rule[index]
+                concede_home_value = [match_id, league_id, "coh", "0", index, p_code, value, condition, odds_only,
+                                      sole, "hg3535", "0", ""]
+                concede_guest_data = dict(zip(concede_home_key, concede_home_value))
+                data_list.append(concede_guest_data)
+
+            # 独赢-------------------------------------------------------------------------------------------------------
+            p_code = 'C'
+            half_capot_home = item["half_capot_home"]
+            half_capot_guest = item["half_capot_guest"]
+            half_capot_dogfall = item["half_capot_dogfall"]
+            capot_home = item["capot_home"]
+            capot_guest = item["capot_guest"]
+            capot_dogfall = item["capot_dogfall"]
+
+            # half_capot_home
+            hash_str = p_code + "ch_h" + '0' + '1' + str(half_capot_home) + "hg3535" + str(match_id)
+            sole_str = p_code + "ch_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_capot_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                   "odds_only", "sole", "source", "type", "team"]
+            half_capot_home_value = [match_id, league_id, "ch_h", "0", 0, p_code, half_capot_home, '1',
+                                     odds_only, sole, "hg3535", "0", ""]
+            half_capot_homet_data = dict(zip(half_capot_home_key, half_capot_home_value))
+            data_list.append(half_capot_homet_data)
+
+            # half_capot_guest
+            hash_str = p_code + "cg_h" + '0' + '2' + str(half_capot_guest) + "hg3535" + str(match_id)
+            sole_str = p_code + "cg_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_capot_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                    "odds_only", "sole", "source", "type", "team"]
+            half_capot_guest_value = [match_id, league_id, "cg_h", "0", 0, p_code, half_capot_guest, '2',
+                                      odds_only, sole, "hg3535", "0", ""]
+            half_capot_guest_data = dict(zip(half_capot_guest_key, half_capot_guest_value))
+            data_list.append(half_capot_guest_data)
+
+            # half_capot_dogfall
+            hash_str = p_code + "cd_h" + '0' + 'X' + str(half_capot_dogfall) + "hg3535" + str(match_id)
+            sole_str = p_code + "cd_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_capot_dogfall_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                      "odds_only", "sole", "source", "type", "team"]
+            half_capot_dogfall_value = [match_id, league_id, "cd_h", "0", 0, p_code, half_capot_dogfall, 'X',
+                                        odds_only, sole, "hg3535", "0", ""]
+            half_capot_dogfall_data = dict(zip(half_capot_dogfall_key, half_capot_dogfall_value))
+            data_list.append(half_capot_dogfall_data)
+            # capot_dogfall
+            hash_str = p_code + "cd" + '0' + 'X' + str(capot_dogfall) + "hg3535" + str(match_id)
+            sole_str = p_code + "cd" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            capot_dogfall_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                 "odds_only", "sole", "source", "type", "team"]
+            capot_dogfall_value = [match_id, league_id, "cd", "0", 0, p_code, capot_dogfall, 'X', odds_only,
+                                   sole, "hg3535", "0", ""]
+            capot_dogfall_data = dict(zip(capot_dogfall_key, capot_dogfall_value))
+            data_list.append(capot_dogfall_data)
+
+            # capot_home
+            hash_str = p_code + "ch" + '0' + '1' + str(capot_home) + "hg3535" + str(match_id)
+            sole_str = p_code + "ch" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            capot_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                              "odds_only", "sole", "source", "type", "team"]
+            capot_home_value = [match_id, league_id, "ch", "0", 0, p_code, capot_home, '1',
+                                odds_only, sole, "hg3535", "0", ""]
+            capot_homet_data = dict(zip(capot_home_key, capot_home_value))
+            data_list.append(capot_homet_data)
+
+            # capot_guest
+            hash_str = p_code + "cg" + '0' + '2' + str(capot_guest) + "hg3535" + str(match_id)
+            sole_str = p_code + "cg" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            capot_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                               "odds_only", "sole", "source", "type", "team"]
+            capot_guest_value = [match_id, league_id, "cg", "0", 0, p_code, capot_guest, '2',
+                                 odds_only, sole, "hg3535", "0", ""]
+            capot_guest_data = dict(zip(capot_guest_key, capot_guest_value))
+            data_list.append(capot_guest_data)
+
+            # 入球数单双--------------------------------------------------------------------------------------------------
+            p_code = 'TS'
+            odd_even_odd = item["odd_even_odd"]
+            odd_even_even = item["odd_even_even"]
+            half_odd_even_odd = item["half_odd_even_odd"]
+            half_odd_even_even = item["half_odd_even_even"]
+
+            # odd_even_odd
+            hash_str = p_code + "tss" + '0' + '单' + str(odd_even_odd) + "hg3535" + str(match_id)
+            sole_str = p_code + "tss" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            single_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                          "odds_only", "sole", "source", "type", "team"]
+            single_value = [match_id, league_id, "tss", "0", 0, p_code, odd_even_odd, '单',
+                            odds_only, sole, "hg3535", "0", ""]
+            single_data = dict(zip(single_key, single_value))
+            data_list.append(single_data)
+
+            # odd_even_even
+            hash_str = p_code + "tsd" + '0' + '双' + str(odd_even_even) + "hg3535" + str(match_id)
+            sole_str = p_code + "tsd" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            double_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                          "odds_only", "sole", "source", "type", "team"]
+            double_value = [match_id, league_id, "tsd", "0", 0, p_code, odd_even_even, '双',
+                            odds_only, sole, "hg3535", "0", ""]
+            double_data = dict(zip(double_key, double_value))
+            data_list.append(double_data)
+
+            # half_odd_even_even
+            hash_str = p_code + "tsd_h" + '0' + '双' + str(half_odd_even_even) + "hg3535" + str(match_id)
+            sole_str = p_code + "tsd_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_double_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                               "odds_only", "sole", "source", "type", "team"]
+            half_double_value = [match_id, league_id, "tsd_h", "0", 0, p_code, half_odd_even_even, '双',
+                                 odds_only, sole, "hg3535", "0", ""]
+            half_double_data = dict(zip(half_double_key, half_double_value))
+            data_list.append(half_double_data)
+
+            # half_odd_even_odd
+            hash_str = p_code + "tss_h" + '0' + '单' + str(half_odd_even_odd) + "hg3535" + str(match_id)
+            sole_str = p_code + "tss_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_single_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                               "odds_only", "sole", "source", "type", "team"]
+            half_single_value = [match_id, league_id, "tss_h", "0", 0, p_code, half_odd_even_odd, '单', odds_only,
+                                 sole, "hg3535", "0", ""]
+            half_single_data = dict(zip(half_single_key, half_single_value))
+            data_list.append(half_single_data)
+
+            p_code = 'TG'
+            # 总入球数 ---------------------------------------------------------------------------------------------------
+            total_goals = item['total_goal']
+            total_dict = {'tg0': '0-1', 'tg1': '2-3', 'tg2': '4-6', 'tg3': '7或以上', 'tg0_h': '0', "tg1_h": '1',
+                          "tg2_h": '2', "tg3_h": '3或以上'}
+            # 全场入球数 单双
+            for key, value in total_goals.items():
+                hash_str = p_code + key + '0' + total_dict[key] + str(value) + "hg3535" + str(match_id)
+                sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                total_goals_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                   "odds_only", "sole", "source", "type", "team"]
+                total_goals_value = [match_id, league_id, key, "0", 0, p_code, value, total_dict[key], odds_only,
+                                     sole, "hg3535", "0", ""]
+                total_goals_data = dict(zip(total_goals_key, total_goals_value))
+                data_list.append(total_goals_data)
+
+            # 全场半场 ---------------------------------------------------------------------------------------------------
+            half_fulls = item['half_full']
+            # p_code, p_id = get_pcode(corner_ball, 'half_full')
+            p_code = 'HF'
+            full_dict = {"hfhh": "主主", "hfhd": "主和", "hfhg": "主客", "hfdh": "和主",
+                         "hfdd": "和和", "hfdg": "和客", "hfgh": "客主", "hfgd": "客和", "hfgg": "客客"}
+            if half_fulls:
+                for key, value in half_fulls.items():
+                    hash_str = p_code + key + '0' + full_dict[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    half_fulls_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                      "odds_only", "sole", "source", "type", "team"]
+                    half_fulls_value = [match_id, league_id, key, "0", 0, p_code, value, full_dict[key], odds_only,
+                                        sole, "hg3535", "0", ""]
+                    half_fulls_data = dict(zip(half_fulls_key, half_fulls_value))
+                    data_list.append(half_fulls_data)
+
+            # 波胆-------------------------------------------------------------------------------------------------------
+            p_code = 'B'
+            bodan_datas = item['bodan_data']
+            # p_code, p_id = get_pcode(corner_ball, 'bodan')
+            bodan_dict = {"b10": "1-0", "b20": "2-0", "b21": "2-1", "b30": "3-0", "b31": "3-1", "b32": "3-2",
+                          "b40": "4-0", "b41": "4-1", "b42": "4-2", "b43": "4-3", "b01": "0-1", "b02": "0-2",
+                          "b12": "1-2", "b03": "0-3", "b13": "1-3", "b23": "2-3", "b04": "0-4", "b14": "1-4",
+                          "b24": "2-4", "b34": "3-4", "b00": "0-0", "b11": "1-1", "b22": "2-2", "b33": "3-3",
+                          "b44": "4-4", "bo": "其他", "b10_h": "1-0", "b20_h": "2-0", "b21_h": "2-1", "b30_h": "3-0",
+                          "b31_h": "3-1", "b32_h": "3-2", "b01_h": "0-1", "b02_h": "0-2", "b12_h": "1-2", "b03_h": "0-3",
+                          "b13_h": "1-3", "b23_h": "2-3", "b00_h": "0-0", "b11_h": "1-1", "b22_h": "2-2", "b33_h": "3-3",
+                          "bo_h": "其他"}
+            if bodan_datas:
+                for key, value in bodan_datas.items():
+                    hash_str = p_code + key + '0' + bodan_dict[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    bodan_dict_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                      "odds_only", "sole", "source", "type", "team"]
+                    bodan_dict_value = [match_id, league_id, key, "0", 0, p_code, value, bodan_dict[key], odds_only,
+                                        sole, "hg3535", "0", ""]
+                    bodan_dict_data = dict(zip(bodan_dict_key, bodan_dict_value))
+                    data_list.append(bodan_dict_data)
+
+            # 最先进球/最后进球 -------------------------------------------------------------------------------------------
+            first_last_balls = item['first_last_ball']
+            p_code = 'FLB'
+            first_last_dict = {"flbfh": "最先进球", "flbfg": "最先进球", "flblh": "最后进球", "flblg": "最后进球", "flbn": "没有进球"}
+            if first_last_balls:
+                for key, value in first_last_balls.items():
+                    hash_str = p_code + key + '0' + first_last_dict[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    first_last_balls_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                            "condition",
+                                            "odds_only", "sole", "source", "type", "team"]
+                    first_last_balls_value = [match_id, league_id, key, "0", 0, p_code, value, first_last_dict[key],
+                                              odds_only,
+                                              sole, "hg3535", "0", ""]
+                    first_last_balls_data = dict(zip(first_last_balls_key, first_last_balls_value))
+                    data_list.append(first_last_balls_data)
+
+            p_code = 'TB'
+            # 球队得分全场,上半场
+            full_dicts = item['full_data']
+            half_dicts = item['half_data']
+            full_dict_rules = item['full_data_rule']
+            half_dict_rules = item['half_data_rule']
+            if full_dicts:
+                for key, value in full_dicts.items():
+                    hash_str = p_code + key + '0' + full_dict_rules[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    full_dict_rules_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                           "condition", "odds_only", "sole", "source", "type", "team"]
+                    full_dict_rules_value = [match_id, league_id, key, "0", 0, p_code, value, full_dict_rules[key],
+                                             odds_only, sole, "hg3535", "0", ""]
+                    full_dict_rules_data = dict(zip(full_dict_rules_key, full_dict_rules_value))
+                    data_list.append(full_dict_rules_data)
+
+            if half_dicts:
+                for key, value in half_dicts.items():
+                    hash_str = p_code + key + '0' + half_dict_rules[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    half_dicts_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                      "condition", "odds_only", "sole", "source", "type", "team"]
+                    half_dicts_value = [match_id, league_id, key, "0", 0, p_code, value, half_dict_rules[key],
+                                        odds_only, sole, "hg3535", "0", ""]
+                    half_dicts_data = dict(zip(half_dicts_key, half_dicts_value))
+                    data_list.append(half_dicts_data)
+
+            p_code = 'CB'
+            horn_ou_dict = item['horn_ou_dict']
+            horn_ou_dict_rule = item['horn_ou_dict_rule']
+            horn_oe_dict = item['horn_oe_dict']
+            horn_oe_dict_rule = item['horn_oe_dict_rule']
+            if horn_ou_dict:
+                for key, value in horn_ou_dict.items():
+                    hash_str = p_code + key + '0' + horn_ou_dict_rule[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    horn_ou_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                   "condition", "odds_only", "sole", "source", "type", "team"]
+                    horn_ou_value = [match_id, league_id, key, "0", 0, p_code, value, horn_ou_dict_rule[key],
+                                     odds_only, sole, "hg3535", "0", ""]
+                    horn_ou_data = dict(zip(horn_ou_key, horn_ou_value))
+                    data_list.append(horn_ou_data)
+
+            if horn_oe_dict:
+                for key, value in horn_oe_dict.items():
+                    hash_str = p_code + key + '0' + horn_oe_dict_rule[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    horn_oe_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                   "condition", "odds_only", "sole", "source", "type", "team"]
+                    horn_oe_value = [match_id, league_id, key, "0", 0, p_code, value, horn_oe_dict_rule[key],
+                                     odds_only, sole, "hg3535", "0", ""]
+                    horn_oe_data = dict(zip(horn_oe_key, horn_oe_value))
+                    data_list.append(horn_oe_data)
+
+            odds_key = ["game_code", "title", "match_id", "lg_id", "data", "source", "odds_only", "tag", "uuid",
+                        "is_stringscene", "utime", "pt"]
+            odds_value = ["zq", "odds", match_id, league_id, data_list, "hg3535", odds_onlys, number, uuid,
+                          0, utime, pt]
+            odds_dict = dict(zip(odds_key, odds_value))
+            if data_list:
+                res = Helper.async_post(ODDS_URL, odds_dict)
+                if res:
+                    if "成功" in res:
+                        logger.info('足球滚球, 角球详细赔率提交成功, {}'.format(res))
+                        logger.info(odds_dict)
+                    else:
+                        logger.warning('足球滚球, 角球详细赔率提交失败, {}'.format(res))
+                        logger.warning(odds_dict)
+                else:
+                    logger.warning('足球滚球, 角球详细赔率接口异常,提交失败, {}'.format(res))
+                    logger.warning(odds_dict)
+            else:
+                logger.info('足球滚球, 角球详细赔率列表为空')
+            data_list = []
+            zq_rball = {"home_team": team_home, "guest_team": team_guest,
+                        "lg_id": league_id, "home_rate": 0,
+                        "guest_rate": 0, "home_score": horn_scoreh,
+                        "guest_score": horn_scoreg, "all_goal": all_goal, "status": 1,
+                        "first_score": "", "last_score": "", "match_score": match_score, "uuid": uuid,
+                        "match_winer": "", "match_time": time_game,
+                        "match_process": half_way, "tag": number,
+                        "match_id": match_id, "p_code": ""}
+            data_list.append(zq_rball)
+            r_data_dict = {
+                "game_code": "zq",
+                "title": "match_result_r",
+                "source": "hg3535",
+                "data": data_list
+            }
+            if data_list:
+                try:
+                    res = Helper.async_post(MATCH_RESULT, r_data_dict)
+                    if res:
+                        if "成功" in res:
+                            logger.info('足球滚球, 角球结果记录提交成功, {}'.format(res))
+                            logger.info(r_data_dict)
+                        else:
+                            logger.warning('足球滚球, 角球结果记录提交失败, {}'.format(res))
+                            logger.warning(r_data_dict)
+                    else:
+                        logger.warning('足球滚球, 角球结果记录接口异常,提交失败, {}'.format(res))
+                        logger.warning(r_data_dict)
+                except Exception as e:
+                    logger.warning('滚球数据接口异常, 角球结果提交失败, {}'.format(e))
+        reactor.callFromThread(out.callback, item)
 
 
 

+ 531 - 13
hg3535/pipeline/zuqiu.py

@@ -20,15 +20,15 @@ class Zuqiupipeline(object):
         self.db = self.mongo[M_DB]
         # self.lock = threading.RLock()
 
-    @defer.inlineCallbacks
-    def process_item(self, item, spider):
-        out = defer.Deferred()
-        reactor.callInThread(self._do_calculation, item, out)
-        yield out
-        defer.returnValue(item)
-
+    # @defer.inlineCallbacks
     # def process_item(self, item, spider):
-    def _do_calculation(self, item, out):
+    #     out = defer.Deferred()
+    #     reactor.callInThread(self._do_calculation, item, out)
+    #     yield out
+    #     defer.returnValue(item)
+
+    def process_item(self, item, spider):
+    # def _do_calculation(self, item, out):
         # with self.lock:
         logger = logging.getLogger(__name__)
         # 比赛日期
@@ -108,9 +108,9 @@ class Zuqiupipeline(object):
             match_dict = {"game_code": "zq", "title": "match", "source": "hg3535"}
             match_kay = ["home_team", "guest_team", "lg_id", "status", "match_id", "match_date", "match_time",
                          "tag", "source", "is_rollball", "is_morningplate", "is_stringscene", "us_time", "uuid",
-                         "half_match_id", "is_today"]
+                         "half_match_id", "is_today", "is_horn"]
             match_value = [team_home, team_guest, league_id, 0, match_id, match_date, match_time, tag_number,
-                           "hg3535", is_rollball, is_morningplate, is_stringscene, us_time, uuid, 0, is_today]
+                           "hg3535", is_rollball, is_morningplate, is_stringscene, us_time, uuid, 0, is_today, 0]
             match_data = dict(zip(match_kay, match_value))
             match_list.append(match_data)
             match_dict['data'] = match_list
@@ -506,7 +506,7 @@ class Zuqiupipeline(object):
                                           odds_only,sole, "hg3535", "0", ""]
                 full_dict_rules_data = dict(zip(full_dict_rules_key, full_dict_rules_value))
                 data_list.append(full_dict_rules_data)
-        #
+
         if half_dicts:
             for key, value in half_dicts.items():
                 hash_str = p_code + key + '0' + half_dict_rules[key] + str(value) + "hg3535" + str(match_id)
@@ -519,6 +519,38 @@ class Zuqiupipeline(object):
                                          odds_only, sole, "hg3535", "0", ""]
                 half_dicts_data = dict(zip(half_dicts_key, half_dicts_value))
                 data_list.append(half_dicts_data)
+
+        p_code = 'CB'
+        horn_ou_dict = item['horn_ou_dict']
+        horn_ou_dict_rule = item['horn_ou_dict_rule']
+        horn_oe_dict = item['horn_oe_dict']
+        horn_oe_dict_rule = item['horn_oe_dict_rule']
+        if horn_ou_dict:
+            for key, value in horn_ou_dict.items():
+                hash_str = p_code + key + '0' + horn_ou_dict_rule[key] + str(value) + "hg3535" + str(match_id)
+                sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                horn_ou_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                               "condition", "odds_only", "sole", "source", "type", "team"]
+                horn_ou_value = [match_id, league_id, key, "0", 0, p_code, value, horn_ou_dict_rule[key],
+                                 odds_only, sole, "hg3535", "0", ""]
+                horn_ou_data = dict(zip(horn_ou_key, horn_ou_value))
+                data_list.append(horn_ou_data)
+
+        if horn_oe_dict:
+            for key, value in horn_oe_dict.items():
+                hash_str = p_code + key + '0' + horn_oe_dict_rule[key] + str(value) + "hg3535" + str(match_id)
+                sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                horn_oe_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                               "condition", "odds_only", "sole", "source", "type", "team"]
+                horn_oe_value = [match_id, league_id, key, "0", 0, p_code, value, horn_oe_dict_rule[key],
+                                 odds_only, sole, "hg3535", "0", ""]
+                horn_oe_data = dict(zip(horn_oe_key, horn_oe_value))
+                data_list.append(horn_oe_data)
+
         if pt == '3':
             ris_stringscene = 1
         else:
@@ -539,5 +571,491 @@ class Zuqiupipeline(object):
                 logging.warning('足球详细赔率接口异常, {}'.format(res))
         else:
             logger.info('足球详细赔率列表为空')
-        # self.lock.acquire()
-        reactor.callFromThread(out.callback, item)
+
+        # 角球处理分割线---------------------------------------------------------------------------------------------------
+        horn_team = item['horn_team']
+        if horn_team:
+            team_home = horn_team['horn_home']
+            team_guest = horn_team['horn_guest']
+            match_id = horn_team['horn_id']
+            match_list = []
+            if self.db.zq_competition35.find({'match_id': match_id, pt_status: 1}).count() < 1:
+                match_dict = {"game_code": "zq", "title": "match", "source": "hg3535"}
+                match_kay = ["home_team", "guest_team", "lg_id", "status", "match_id", "match_date", "match_time",
+                             "tag", "source", "is_rollball", "is_morningplate", "is_stringscene", "us_time", "uuid",
+                             "half_match_id", "is_today", 'is_horn']
+                match_value = [team_home, team_guest, league_id, 0, match_id, match_date, match_time, tag_number,
+                               "hg3535", is_rollball, is_morningplate, is_stringscene, us_time, uuid, 0, is_today, 1]
+                match_data = dict(zip(match_kay, match_value))
+                match_list.append(match_data)
+                match_dict['data'] = match_list
+                res = Helper.async_post(MATCH_URL, match_dict)
+                if res:
+                    if "成功" in res:
+                        self.db.zq_competition35.insert(match_data)
+                        logger.info('足球角球, 赛事表提交失败, {}'.format(res))
+                        logger.info(match_dict)
+                    else:
+                        logger.warning('足球角球, 赛事表提交失败, {}'.format(res))
+                        logger.warning(match_dict)
+                else:
+                    logger.warning('足球角球, 赛事接口异常提交失败, {}'.format(res))
+                    logger.warning(match_dict)
+            else:
+                logger.info('足球角球, 赛事已存在,不提交')
+
+            p_code = "GS"
+            half_size_guest = item["half_size_guest"]
+            half_size_guest_rule = item["half_size_guest_rule"]
+            half_size_home = item["half_size_home"]
+            half_size_home_rule = item["half_size_home_rule"]
+            data_list = []
+            odds_onlys = []
+            # half_size_guest
+            for index, value in enumerate(half_size_guest):
+                hash_str = p_code + "gss_h" + str(index) + str(half_size_guest_rule[index]) + str(
+                    value) + "hg3535" + str(match_id)
+                sole_str = p_code + "gss_h" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                half_size_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                       "condition",
+                                       "odds_only", "sole", "source", "type", "team"]
+                condition = half_size_guest_rule[index]
+                half_size_guest_value = [match_id, league_id, "gss_h", "0", index, p_code, value, condition,
+                                         odds_only, sole, "hg3535", "0", ""]
+                half_size_guest_data = dict(zip(half_size_guest_key, half_size_guest_value))
+                data_list.append(half_size_guest_data)
+            # half_size_home
+            for index, value in enumerate(half_size_home):
+                hash_str = p_code + "gsb_h" + str(index) + str(half_size_home_rule[index]) + str(
+                    value) + "hg3535" + str(match_id)
+                sole_str = p_code + "gsb_h" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                half_size_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                      "odds_only", "sole", "source", "type", "team"]
+                condition = half_size_home_rule[index]
+                half_size_home_value = [match_id, league_id, "gsb_h", "0", index, p_code, value, condition,
+                                        odds_only, sole, "hg3535", "0", ""]
+                half_size_home_data = dict(zip(half_size_home_key, half_size_home_value))
+                data_list.append(half_size_home_data)
+
+            # 全场场大小
+            size_guest = item["size_guest"]
+            size_guest_rule = item["size_guest_rule"]
+            size_home = item["size_home"]
+            size_home_rule = item["size_home_rule"]
+            # size_home
+            for index, value in enumerate(size_home):
+                hash_str = p_code + "gsb" + str(index) + str(size_home_rule[index]) + str(value) + "hg3535" + str(
+                    match_id)
+                sole_str = p_code + "gsb" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                size_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                 "odds_only", "sole", "source", "type", "team"]
+                condition = size_home_rule[index]
+                size_home_value = [match_id, league_id, "gsb", "0", index, p_code, value, condition, odds_only,
+                                   sole, "hg3535", "0", ""]
+                size_home_data = dict(zip(size_home_key, size_home_value))
+                data_list.append(size_home_data)
+            # size_guest
+            for index, value in enumerate(size_guest):
+                hash_str = p_code + "gss" + str(index) + str(size_guest_rule[index]) + str(value) + "hg3535" + str(
+                    match_id)
+                sole_str = p_code + "gss" + str(index) + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                size_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                  "odds_only", "sole", "source", "type", "team"]
+                condition = size_guest_rule[index]
+                size_guest_value = [match_id, league_id, "gss", "0", index, p_code, value, condition, odds_only,
+                                    sole, "hg3535", "0", ""]
+                size_home_data = dict(zip(size_guest_key, size_guest_value))
+                data_list.append(size_home_data)
+
+            p_code = 'CO'
+            half_concede_home_rule = item["half_concede_home_rule"]
+            half_concede_home = item["half_concede_home"]
+            half_concede_guest_rule = item["half_concede_guest_rule"]
+            half_concede_guest = item["half_concede_guest"]
+            # half_concede_home
+            if half_concede_guest:
+                for index, value in enumerate(half_concede_guest):
+                    hash_str = p_code + "cog_h" + str(index) + str(half_concede_guest_rule[index]) + str(
+                        value) + "hg3535" + str(match_id)
+                    sole_str = p_code + "cog_h" + str(index) + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    half_concede_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                              "condition",
+                                              "odds_only", "sole", "source", "type", "team"]
+                    condition = half_concede_guest_rule[index]
+                    half_concede_guest_value = [match_id, league_id, "cog_h", "0", index, p_code, value, condition,
+                                                odds_only, sole, "hg3535", "0", ""]
+                    half_concede_guest_data = dict(zip(half_concede_guest_key, half_concede_guest_value))
+                    data_list.append(half_concede_guest_data)
+
+            # half_concede_home
+            if half_concede_home:
+                for index, value in enumerate(half_concede_home):
+                    hash_str = p_code + "coh_h" + str(index) + str(half_concede_home_rule[index]) + str(
+                        value) + "hg3535" + str(match_id)
+                    sole_str = p_code + "coh_h" + str(index) + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    half_concede_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                             "condition",
+                                             "odds_only", "sole", "source", "type", "team"]
+                    condition = half_concede_home_rule[index]
+                    half_concede_home_value = [match_id, league_id, "coh_h", "0", index, p_code, value, condition,
+                                               odds_only, sole, "hg3535", "0", ""]
+                    half_concede_home_data = dict(zip(half_concede_home_key, half_concede_home_value))
+                    data_list.append(half_concede_home_data)
+
+            concede_guest = item["concede_guest"]
+            concede_guest_rule = item["concede_guest_rule"]
+            concede_home = item["concede_home"]
+            concede_home_rule = item["concede_home_rule"]
+            # concede_guest
+            if concede_guest:
+                for index, value in enumerate(concede_guest):
+                    hash_str = p_code + "cog" + str(index) + str(concede_guest_rule[index]) + str(
+                        value) + "hg3535" + str(match_id)
+                    sole_str = p_code + "cog" + str(index) + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    concede_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                         "condition",
+                                         "odds_only", "sole", "source", "type", "team"]
+                    condition = concede_guest_rule[index]
+                    concede_guest_value = [match_id, league_id, "cog", "0", index, p_code, value, condition,
+                                           odds_only, sole, "hg3535", "0", ""]
+                    concede_guest_data = dict(zip(concede_guest_key, concede_guest_value))
+                    data_list.append(concede_guest_data)
+            # concede_home
+            if concede_home:
+                for index, value in enumerate(concede_home):
+                    hash_str = p_code + "coh" + str(index) + str(concede_home_rule[index]) + str(
+                        value) + "hg3535" + str(match_id)
+                    sole_str = p_code + "coh" + str(index) + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    concede_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                        "condition",
+                                        "odds_only", "sole", "source", "type", "team"]
+                    condition = concede_home_rule[index]
+                    concede_home_value = [match_id, league_id, "coh", "0", index, p_code, value, condition, odds_only,
+                                          sole, "hg3535", "0", ""]
+                    concede_guest_data = dict(zip(concede_home_key, concede_home_value))
+                    data_list.append(concede_guest_data)
+
+            # 独赢----------------------------------------------------------------------------------------------------------
+            p_code = 'C'
+            half_capot_home = item["half_capot_home"]
+            half_capot_guest = item["half_capot_guest"]
+            half_capot_dogfall = item["half_capot_dogfall"]
+            capot_home = item["capot_home"]
+            capot_guest = item["capot_guest"]
+            capot_dogfall = item["capot_dogfall"]
+
+            # half_capot_home
+            hash_str = p_code + "ch_h" + '0' + '1' + str(half_capot_home) + "hg3535" + str(match_id)
+            sole_str = p_code + "ch_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_capot_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                   "odds_only", "sole", "source", "type", "team"]
+            half_capot_home_value = [match_id, league_id, "ch_h", "0", 0, p_code, half_capot_home, '1',
+                                     odds_only, sole, "hg3535", "0", ""]
+            half_capot_homet_data = dict(zip(half_capot_home_key, half_capot_home_value))
+            data_list.append(half_capot_homet_data)
+
+            # half_capot_guest
+            hash_str = p_code + "cg_h" + '0' + '2' + str(half_capot_guest) + "hg3535" + str(match_id)
+            sole_str = p_code + "cg_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_capot_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                    "odds_only", "sole", "source", "type", "team"]
+            half_capot_guest_value = [match_id, league_id, "cg_h", "0", 0, p_code, half_capot_guest, '2',
+                                      odds_only, sole, "hg3535", "0", ""]
+            half_capot_guest_data = dict(zip(half_capot_guest_key, half_capot_guest_value))
+            data_list.append(half_capot_guest_data)
+
+            # half_capot_dogfall
+            hash_str = p_code + "cd_h" + '0' + 'X' + str(half_capot_dogfall) + "hg3535" + str(match_id)
+            sole_str = p_code + "cd_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_capot_dogfall_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                      "odds_only", "sole", "source", "type", "team"]
+            half_capot_dogfall_value = [match_id, league_id, "cd_h", "0", 0, p_code, half_capot_dogfall, 'X',
+                                        odds_only, sole, "hg3535", "0", ""]
+            half_capot_dogfall_data = dict(zip(half_capot_dogfall_key, half_capot_dogfall_value))
+            data_list.append(half_capot_dogfall_data)
+
+            # capot_dogfall
+            hash_str = p_code + "cd" + '0' + 'X' + str(capot_dogfall) + "hg3535" + str(match_id)
+            sole_str = p_code + "cd" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            capot_dogfall_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                 "odds_only", "sole", "source", "type", "team"]
+            capot_dogfall_value = [match_id, league_id, "cd", "0", 0, p_code, capot_dogfall, 'X', odds_only,
+                                   sole, "hg3535", "0", ""]
+            capot_dogfall_data = dict(zip(capot_dogfall_key, capot_dogfall_value))
+            data_list.append(capot_dogfall_data)
+
+            # capot_home
+            hash_str = p_code + "ch" + '0' + '1' + str(capot_home) + "hg3535" + str(match_id)
+            sole_str = p_code + "ch" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            capot_home_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                              "odds_only", "sole", "source", "type", "team"]
+            capot_home_value = [match_id, league_id, "ch", "0", 0, p_code, capot_home, '1',
+                                odds_only, sole, "hg3535", "0", ""]
+            capot_homet_data = dict(zip(capot_home_key, capot_home_value))
+            data_list.append(capot_homet_data)
+
+            # capot_guest
+            hash_str = p_code + "cg" + '0' + '2' + str(capot_guest) + "hg3535" + str(match_id)
+            sole_str = p_code + "cg" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            capot_guest_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                               "odds_only", "sole", "source", "type", "team"]
+            capot_guest_value = [match_id, league_id, "cg", "0", 0, p_code, capot_guest, '2',
+                                 odds_only, sole, "hg3535", "0", ""]
+            capot_guest_data = dict(zip(capot_guest_key, capot_guest_value))
+            data_list.append(capot_guest_data)
+
+            # 入球数单双-----------------------------------------------------------------------------------------------------
+            # p_code, p_id = get_pcode(corner_ball, 'two_sides')
+            p_code = 'TS'
+            odd_even_odd = item["odd_even_odd"]
+            odd_even_even = item["odd_even_even"]
+            half_odd_even_odd = item["half_odd_even_odd"]
+            half_odd_even_even = item["half_odd_even_even"]
+
+            # odd_even_odd
+            hash_str = p_code + "tss" + '0' + '单' + str(odd_even_odd) + "hg3535" + str(match_id)
+            sole_str = p_code + "tss" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            single_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                          "odds_only", "sole", "source", "type", "team"]
+            single_value = [match_id, league_id, "tss", "0", 0, p_code, odd_even_odd, '单',
+                            odds_only, sole, "hg3535", "0", ""]
+            single_data = dict(zip(single_key, single_value))
+            data_list.append(single_data)
+
+            # odd_even_even
+            hash_str = p_code + "tsd" + '0' + '双' + str(odd_even_even) + "hg3535" + str(match_id)
+            sole_str = p_code + "tsd" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            double_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                          "odds_only", "sole", "source", "type", "team"]
+            double_value = [match_id, league_id, "tsd", "0", 0, p_code, odd_even_even, '双',
+                            odds_only, sole, "hg3535", "0", ""]
+            double_data = dict(zip(double_key, double_value))
+            data_list.append(double_data)
+
+            # half_odd_even_even
+            hash_str = p_code + "tsd_h" + '0' + '双' + str(half_odd_even_even) + "hg3535" + str(match_id)
+            sole_str = p_code + "tsd_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_double_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                               "odds_only", "sole", "source", "type", "team"]
+            half_double_value = [match_id, league_id, "tsd_h", "0", 0, p_code, half_odd_even_even, '双',
+                                 odds_only, sole, "hg3535", "0", ""]
+            half_double_data = dict(zip(half_double_key, half_double_value))
+            data_list.append(half_double_data)
+
+            # half_odd_even_odd
+            hash_str = p_code + "tss_h" + '0' + '单' + str(half_odd_even_odd) + "hg3535" + str(match_id)
+            sole_str = p_code + "tss_h" + '0' + str(match_id) + "hg3535"
+            odds_only = Helper.genearte_MD5(hash_str, pt)
+            sole = Helper.genearte_MD5(sole_str, pt)
+            half_single_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                               "odds_only", "sole", "source", "type", "team"]
+            half_single_value = [match_id, league_id, "tss_h", "0", 0, p_code, half_odd_even_odd, '单', odds_only,
+                                 sole, "hg3535", "0", ""]
+            half_single_data = dict(zip(half_single_key, half_single_value))
+            data_list.append(half_single_data)
+
+            # 总入球数 ---------------------------------------------------------------------------------------------------
+            p_code = 'TG'
+            total_goals = item['total_goal']
+            total_dict = {'tg0': '0-1', 'tg1': '2-3', 'tg2': '4-6', 'tg3': '7或以上', 'tg0_h': '0', "tg1_h": '1',
+                          "tg2_h": '2', "tg3_h": '3或以上'}
+            # 全场入球数 单双
+            # 上半场入球数 单双
+            for key, value in total_goals.items():
+                hash_str = p_code + key + '0' + total_dict[key] + str(value) + "hg3535" + str(match_id)
+                sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                odds_only = Helper.genearte_MD5(hash_str, pt)
+                sole = Helper.genearte_MD5(sole_str, pt)
+                total_goals_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                   "odds_only", "sole", "source", "type", "team"]
+                total_goals_value = [match_id, league_id, key, "0", 0, p_code, value, total_dict[key], odds_only,
+                                     sole, "hg3535", "0", ""]
+                total_goals_data = dict(zip(total_goals_key, total_goals_value))
+                data_list.append(total_goals_data)
+
+            # 全场半场 ---------------------------------------------------------------------------------------------------
+            half_fulls = item['half_full']
+            p_code = 'HF'
+            full_dict = {"hfhh": "主主", "hfhd": "主和", "hfhg": "主客", "hfdh": "和主",
+                         "hfdd": "和和", "hfdg": "和客", "hfgh": "客主", "hfgd": "客和", "hfgg": "客客"}
+            if half_fulls:
+                for key, value in half_fulls.items():
+                    hash_str = p_code + key + '0' + full_dict[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    half_fulls_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                      "odds_only", "sole", "source", "type", "team"]
+                    half_fulls_value = [match_id, league_id, key, "0", 0, p_code, value, full_dict[key], odds_only,
+                                        sole, "hg3535", "0", ""]
+                    half_fulls_data = dict(zip(half_fulls_key, half_fulls_value))
+                    data_list.append(half_fulls_data)
+
+            # 波胆-----------------------------------------------------------------------------------------------------------
+            bodan_datas = item['bodan_data']
+            p_code = 'B'
+            bodan_dict = {"b10": "1-0", "b20": "2-0", "b21": "2-1", "b30": "3-0", "b31": "3-1", "b32": "3-2",
+                          "b40": "4-0", "b41": "4-1", "b42": "4-2", "b43": "4-3", "b01": "0-1", "b02": "0-2",
+                          "b12": "1-2", "b03": "0-3", "b13": "1-3", "b23": "2-3", "b04": "0-4", "b14": "1-4",
+                          "b24": "2-4", "b34": "3-4", "b00": "0-0", "b11": "1-1", "b22": "2-2", "b33": "3-3",
+                          "b44": "4-4", "bo": "其他", "b10_h": "1-0", "b20_h": "2-0", "b21_h": "2-1", "b30_h": "3-0",
+                          "b31_h": "3-1", "b32_h": "3-2", "b01_h": "0-1", "b02_h": "0-2", "b12_h": "1-2",
+                          "b03_h": "0-3",
+                          "b13_h": "1-3", "b23_h": "2-3", "b00_h": "0-0", "b11_h": "1-1", "b22_h": "2-2",
+                          "b33_h": "3-3",
+                          "bo_h": "其他"}
+            if bodan_datas:
+                for key, value in bodan_datas.items():
+                    hash_str = p_code + key + '0' + bodan_dict[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    bodan_dict_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds", "condition",
+                                      "odds_only", "sole", "source", "type", "team"]
+                    bodan_dict_value = [match_id, league_id, key, "0", 0, p_code, value, bodan_dict[key], odds_only,
+                                        sole, "hg3535", "0", ""]
+                    bodan_dict_data = dict(zip(bodan_dict_key, bodan_dict_value))
+                    data_list.append(bodan_dict_data)
+
+            # 最先进球/最后进球 ----------------------------------------------------------------------------------------------
+            first_last_balls = item['first_last_ball']
+            # p_code, p_id = get_pcode(corner_ball, 'first_last_ball')
+            p_code = 'FLB'
+            first_last_dict = {"flbfh": "最先进球", "flbfg": "最先进球", "flblh": "最后进球", "flblg": "最后进球", "flbn": "没有进球"}
+            if first_last_balls:
+                for key, value in first_last_balls.items():
+                    hash_str = p_code + key + '0' + first_last_dict[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    first_last_balls_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                            "condition",
+                                            "odds_only", "sole", "source", "type", "team"]
+                    first_last_balls_value = [match_id, league_id, key, "0", 0, p_code, value, first_last_dict[key],
+                                              odds_only,
+                                              sole, "hg3535", "0", ""]
+                    first_last_balls_data = dict(zip(first_last_balls_key, first_last_balls_value))
+                    data_list.append(first_last_balls_data)
+
+            # 球队得分大小
+            p_code = 'TB'
+            # 全场
+            full_dicts = item['full_data']
+            # 上半场
+            half_dicts = item['half_data']
+            full_dict_rules = item['full_data_rule']
+            half_dict_rules = item['half_data_rule']
+            if full_dicts:
+                for key, value in full_dicts.items():
+                    hash_str = p_code + key + '0' + full_dict_rules[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    full_dict_rules_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                           "condition", "odds_only", "sole", "source", "type", "team"]
+                    full_dict_rules_value = [match_id, league_id, key, "0", 0, p_code, value, full_dict_rules[key],
+                                             odds_only, sole, "hg3535", "0", ""]
+                    full_dict_rules_data = dict(zip(full_dict_rules_key, full_dict_rules_value))
+                    data_list.append(full_dict_rules_data)
+
+            if half_dicts:
+                for key, value in half_dicts.items():
+                    hash_str = p_code + key + '0' + half_dict_rules[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    half_dicts_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                      "condition", "odds_only", "sole", "source", "type", "team"]
+                    half_dicts_value = [match_id, league_id, key, "0", 0, p_code, value, half_dict_rules[key],
+                                        odds_only, sole, "hg3535", "0", ""]
+                    half_dicts_data = dict(zip(half_dicts_key, half_dicts_value))
+                    data_list.append(half_dicts_data)
+
+            p_code = 'CB'
+            horn_ou_dict = item['horn_ou_dict']
+            horn_ou_dict_rule = item['horn_ou_dict_rule']
+            horn_oe_dict = item['horn_oe_dict']
+            horn_oe_dict_rule = item['horn_oe_dict_rule']
+            if horn_ou_dict:
+                for key, value in horn_ou_dict.items():
+                    hash_str = p_code + key + '0' + horn_ou_dict_rule[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    horn_ou_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                   "condition", "odds_only", "sole", "source", "type", "team"]
+                    horn_ou_value = [match_id, league_id, key, "0", 0, p_code, value, horn_ou_dict_rule[key],
+                                     odds_only, sole, "hg3535", "0", ""]
+                    horn_ou_data = dict(zip(horn_ou_key, horn_ou_value))
+                    data_list.append(horn_ou_data)
+
+            if horn_oe_dict:
+                for key, value in horn_oe_dict.items():
+                    hash_str = p_code + key + '0' + horn_oe_dict_rule[key] + str(value) + "hg3535" + str(match_id)
+                    sole_str = p_code + key + '0' + str(match_id) + "hg3535"
+                    odds_only = Helper.genearte_MD5(hash_str, pt)
+                    sole = Helper.genearte_MD5(sole_str, pt)
+                    horn_oe_key = ["match_id", "lg_id", "odds_code", "status", "sort", "p_code", "odds",
+                                   "condition", "odds_only", "sole", "source", "type", "team"]
+                    horn_oe_value = [match_id, league_id, key, "0", 0, p_code, value, horn_oe_dict_rule[key],
+                                     odds_only, sole, "hg3535", "0", ""]
+                    horn_oe_data = dict(zip(horn_oe_key, horn_oe_value))
+                    data_list.append(horn_oe_data)
+
+            if pt == '3':
+                ris_stringscene = 1
+            else:
+                ris_stringscene = 0
+            odds_key = ["game_code", "title", "match_id", "lg_id", "data", "source", "odds_only", "tag", "uuid",
+                        "is_stringscene", "utime", "pt"]
+            odds_value = ["zq", "odds", match_id, league_id, data_list, "hg3535", odds_onlys, tag_number, uuid,
+                          ris_stringscene, utime, pt]
+            odds_dict = dict(zip(odds_key, odds_value))
+            if data_list:
+                res = Helper.async_post(ODDS_URL, odds_dict)
+                if res:
+                    if "成功" in res:
+                        logger.info('足球角球, 详细赔率提交成功, {}'.format(res))
+                        logger.info(odds_dict)
+                    else:
+                        logger.warning('足球角球, 详细赔率提交失败, {}'.format(res))
+                        logger.warning(odds_dict)
+                else:
+                    logging.warning('足球角球, 详细赔率接口异常, {}'.format(res))
+            else:
+                logger.info('足球详细赔率列表为空')
+        # reactor.callFromThread(out.callback, item)

+ 2 - 2
hg3535/settings.py

@@ -146,12 +146,12 @@ M_PASSWORD = 'kaiyou'
 # M_PASSWORD = '123456'
 
 LEAGUE_URL = 'http://stadmin.bocai108.com:19093/setLeague'
-MATCH_URL = 'http://stadmin.bocai108.com:19093/setMatch'
+MATCH_URL = 'http://stadmin.bocai108.com/setMatch'
 ODDS_URL = 'http://stadmin.bocai108.com:19093/setOdds'
 TOKEN_URL = "http://stadmin.bocai108.com/getToken"
 MATCH_RESULT = "http://stadmin.bocai108.com:19093/setMatchResult"
 MATCH_STATUS = "http://stadmin.bocai108.com:19093/upMatch"
-ODDSCH = "http://stadmin.bocai108.com:19093/setOddsCH"
+ODDSCH = "http://stadmin.bocai108.com/setOddsCH"
 
 
 R_HOST = '192.168.2.200'

+ 4 - 3
hg3535/spiders/guanjun.py

@@ -19,17 +19,18 @@ class LqguanjunSpider(scrapy.Spider):
         "ITEM_PIPELINES": {
             'hg3535.pipeline.guanjun.Guanjunpipeline': 300,
         },
-        'LOG_LEVEL': 'DEBUG',
-        'LOG_FILE': "./log/guanjun_{}_{}_{}.log".format(to_day.year, to_day.month, to_day.day)
+        # 'LOG_LEVEL': 'DEBUG',
+        # 'LOG_FILE': "./log/guanjun_{}_{}_{}.log".format(to_day.year, to_day.month, to_day.day)
     }
 
     def start_requests(self):
         for z in range(1, 5):
             for x in range(0, 4):
                 # for y in range()
-                url = 'https://odata.jiushan6688.com/odds6i/d/getodds/zh-cn/sid/{}/pt/1/ubt/or/pn/{}/sb/2/dc/null/pid/0'.format(x, z)
+                url = 'https://odata.jiushan6688.com/odds6i/d/getodds/zh-cn/sid/{}/pt/1/ubt/or/pn/{}/sb/2/dc/null/pid/0'.format(z, x)
                 # url = 'https://odata.jiushan6688.com/odds6i/d/getodds/zh-cn/sid/1/pt/1/ubt/or/pn/1/sb/2/dc/null/pid/0'
                 # redis_key = "guanjun: start_urls"
+                # https://odata.jiushan6688.com/odds6i/d/getodds/zh-cn/sid/1/pt/1/ubt/or/pn/0/sb/2/dc/null/pid/0
                 yield Request(url=url, callback=self.parse, dont_filter=True)
 
     def parse(self, response):

+ 9 - 8
hg3535/spiders/jieshu.py

@@ -36,14 +36,15 @@ class HgjieshuSpider(scrapy.Spider):
         try:
             data = json.loads(response.text)
             status = data['i'][0]
-            if not status:
-                ball = data['i'][31]
-                match_id = data['i'][2]
-                self.rls.srem('hg3535.gunqiu.ids', match_id)
-                item = Hgjieshu()
-                item['ball'] = ball
-                item['match_id'] = match_id
-                yield item
+            # if not status:
+            ball = data['i'][31]
+            match_id = data['i'][2]
+                # self.rls.srem('hg3535.gunqiu.ids', match_id)
+            item = Hgjieshu()
+            item['ball'] = ball
+            item['match_id'] = match_id
+            item['status'] = status
+            yield item
         except Exception as e:
             logger.warning(e)
             return

+ 60 - 12
hg3535/spiders/roll_zuqiu.py

@@ -69,12 +69,17 @@ class ZuqiuSpider(scrapy.Spider):
             half_dict = {}
             full_dict_rule = {}
             half_dict_rule = {}
+            horn_ou_dict = {}
+            horn_ou_dict_rule = {}
+            horn_oe_dict = {}
+            horn_oe_dict_rule = {}
+            horn_team = {}
             for data in datas:
                 try:
-                    new_data = data['pci']['ctid']
+                    ctid = data['pci']['ctid']
                 except:
-                    new_data = ""
-                if new_data == 0:
+                    ctid = ""
+                if ctid == 0:
                     # 比赛id
                     game_id = str(data['k'])
                     # 球队1
@@ -86,15 +91,13 @@ class ZuqiuSpider(scrapy.Spider):
                     # 下半场
                     half_way = data['i'][12]
                     # 角球或者其他
-                    corner_ball = data['pci'].get('ctn', "")
+                    # corner_ball = data['pci'].get('ctn', "")
                     # 日期
                     data_game = data['i'][4]
                     # 开赛时间
                     time_game = data['i'][5]
-                    #这个地方的值不准确 需要再次确认
                     score_home = data['i'][10]  # 队一分数
                     score_guest = data['i'][11] # 队二分数
-                    # half_way = new_result['i'][12] #下半场
 
 # 让球------------------------------------------------------------------------------------------------------------------
                     try:
@@ -105,8 +108,6 @@ class ZuqiuSpider(scrapy.Spider):
                         concede_home = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 is 1]
 
                         concede_guests = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 is 1]
-                        # concede_guest_rule
-                        # concede_guest
                         concede_guest_rule = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 == 0]
                         concede_guest = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 is 1]
                     except:
@@ -418,7 +419,50 @@ class ZuqiuSpider(scrapy.Spider):
                             bodan_data['bo_h'] = 0
                     except:
                         pass
-                if new_data == 12:
+                if ctid == 1:
+                    # 角球数据
+                    horn_team['horn_home'] = data['i'][0]
+                    horn_team['horn_guest'] = data['i'][1]
+                    horn_team['horn_scoreh'] = data['i'][10]
+                    horn_team['horn_scoreg'] = data['i'][11]
+                    horn_team['horn_id'] = str(data['k'])
+                    try:
+                        horn_ou = data['o']['ou']['v']
+                    except:
+                        horn_ou = ''
+                    if horn_ou:
+                        horn_ou_dict['cbgb'] = horn_ou[5]
+                        horn_ou_dict['cbgs'] = horn_ou[7]
+                        horn_ou_dict_rule['cbgb'] = horn_ou[1]
+                        horn_ou_dict_rule['cbgs'] = horn_ou[3]
+                    try:
+                        horn_ou1st = data['o']['ou1st']['v']
+                    except:
+                        horn_ou1st = ''
+                    if horn_ou1st:
+                        horn_ou_dict['cbgb_h'] = horn_ou1st[5]
+                        horn_ou_dict['cbgs_h'] = horn_ou1st[7]
+                        horn_ou_dict_rule['cbgb_h'] = horn_ou1st[1]
+                        horn_ou_dict_rule['cbgs_h'] = horn_ou1st[3]
+                    try:
+                        horn_oe = data['o']['oe']['v']
+                    except:
+                        horn_oe = ''
+                    if horn_oe:
+                        horn_oe_dict['cbtss'] = horn_oe[1]
+                        horn_oe_dict['cbtsd'] = horn_oe[3]
+                        horn_oe_dict_rule['cbtss'] = '单'
+                        horn_oe_dict_rule['cbtsd'] = '双'
+                    try:
+                        horn_oe1st = data['o']['oe1st']['v']
+                    except:
+                        horn_oe1st = ''
+                    if horn_oe1st:
+                        horn_oe_dict['cbtss_h'] = horn_oe1st[1]
+                        horn_oe_dict['cbtsd_h'] = horn_oe1st[3]
+                        horn_oe_dict_rule['cbtss_h'] = '单'
+                        horn_oe_dict_rule['cbtsd_h'] = '双'
+                if ctid == 12:
                     try:
                         home_data = data['o']['ou']['v']
                         # 球队进球 大条件
@@ -446,8 +490,7 @@ class ZuqiuSpider(scrapy.Spider):
                         half_dict['tbhb_h'] = ""
                         half_dict_rule['tbhs_h'] = ""
                         half_dict['tbhs_h'] = ""
-
-                if new_data == 13:
+                if ctid == 13:
                     try:
                         guest_data = data['o']['ou']['v']
                         full_dict_rule['tbgb'] = guest_data[1]
@@ -478,7 +521,6 @@ class ZuqiuSpider(scrapy.Spider):
             item['number'] = number
             item['data_game'] = data_game
             item['time_game'] = time_game
-            item['corner_ball'] = corner_ball
             # 波胆
             item['bodan_data'] = bodan_data
             # 早盘入球数单双
@@ -527,6 +569,12 @@ class ZuqiuSpider(scrapy.Spider):
             item['full_data_rule'] = full_dict_rule
             item['half_data_rule'] = half_dict_rule
             item['half_way'] = half_way
+
+            item['horn_ou_dict'] = horn_ou_dict
+            item['horn_ou_dict_rule'] = horn_ou_dict_rule
+            item['horn_oe_dict'] = horn_oe_dict
+            item['horn_oe_dict_rule'] = horn_oe_dict_rule
+            item['horn_team'] = horn_team
             yield item
 
 

+ 67 - 9
hg3535/spiders/zuqiu.py

@@ -3,6 +3,9 @@ import copy
 import json
 
 # import redis
+import time
+
+import redis
 import scrapy
 from scrapy.http import Request
 from ..items import Zuqiu
@@ -26,6 +29,7 @@ class ZuqiuSpider(scrapy.Spider):
         # 'SCHEDULER_PERSIST': False,
         # 'SCHEDULER_FLUSH_ON_START': False,
     }
+    rls = redis.Redis(host='192.168.2.200', port=6379, db=1, password=123456)
 
     def start_requests(self):
         for y in range(1, 4):
@@ -54,13 +58,15 @@ class ZuqiuSpider(scrapy.Spider):
                         # cls.sadd('hg3535.zq.ids', game_id)
                         # cls.expire('hg3535.zq.ids', 300)
                         if pt == "3":
-                            url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/" + str(game_id) + "/iip/false/ubt/am/isp/true"
+                            local_time = time.time()
+                            self.rls.hset('hg3535.chuanchang.ids', game_id, local_time)
+                            url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/{}/iip/false/ubt/am/isp/true".format(game_id)
                             yield Request(url=url, callback=self.parse_each, dont_filter=True, meta={'pt': pt})
                         if pt == "2":
-                            url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/" + str(game_id) + "/iip/false/ubt/am/isp/false"
+                            url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/{}/iip/false/ubt/am/isp/false".format(game_id)
                             yield Request(url=url, callback=self.parse_each, dont_filter=True, meta={'pt': pt})
                         if pt == "1":
-                            url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/" + str(game_id) + "/iip/false/ubt/am/isp/false"
+                            url = "https://odata.jiushan6688.com/odds6i/d/getamodds/zh-cn/eid/{}/iip/false/ubt/am/isp/false".format(game_id)
                             yield Request(url=url, callback=self.parse_each, dont_filter=True, meta={'pt': pt})
 
     #
@@ -89,12 +95,17 @@ class ZuqiuSpider(scrapy.Spider):
                 half_dict = {}
                 full_dict_rule = {}
                 half_dict_rule = {}
+                horn_ou_dict = {}
+                horn_ou_dict_rule = {}
+                horn_oe_dict = {}
+                horn_oe_dict_rule = {}
+                horn_team = {}
                 for data in datas:
                     try:
-                        new_data = data['pci']['ctid']
+                        ctid = data['pci']['ctid']
                     except:
-                        new_data = ""
-                    if new_data == 0:
+                        ctid = ""
+                    if ctid == 0:
                         # 比赛id
                         game_id = str(data['k'])
                         # 球队1
@@ -380,7 +391,50 @@ class ZuqiuSpider(scrapy.Spider):
                             bodan_data['bo_h'] = round(float(new_half_bodans[-1]) - 1, 2)
                         except:
                             pass
-                    if new_data is 12:
+                    if ctid == 1:
+                        # 角球数据
+                        horn_team['horn_home'] = data['i'][0]
+                        horn_team['horn_guest'] = data['i'][1]
+                        horn_team['horn_scoreh'] = data['i'][10]
+                        horn_team['horn_scoreg'] = data['i'][11]
+                        horn_team['horn_id'] = str(data['k'])
+                        try:
+                            horn_ou = data['o']['ou']['v']
+                        except:
+                            horn_ou = ''
+                        if horn_ou:
+                            horn_ou_dict['cbgb'] = horn_ou[5]
+                            horn_ou_dict['cbgs'] = horn_ou[7]
+                            horn_ou_dict_rule['cbgb'] = horn_ou[1]
+                            horn_ou_dict_rule['cbgs'] = horn_ou[3]
+                        try:
+                            horn_ou1st = data['o']['ou1st']['v']
+                        except:
+                            horn_ou1st = ''
+                        if horn_ou1st:
+                            horn_ou_dict['cbgb_h'] = horn_ou1st[5]
+                            horn_ou_dict['cbgs_h'] = horn_ou1st[7]
+                            horn_ou_dict_rule['cbgb_h'] = horn_ou1st[1]
+                            horn_ou_dict_rule['cbgs_h'] = horn_ou1st[3]
+                        try:
+                            horn_oe = data['o']['oe']['v']
+                        except:
+                            horn_oe = ''
+                        if horn_oe:
+                            horn_oe_dict['cbtss'] = horn_oe[1]
+                            horn_oe_dict['cbtsd'] = horn_oe[3]
+                            horn_oe_dict_rule['cbtss'] = '单'
+                            horn_oe_dict_rule['cbtsd'] = '双'
+                        try:
+                            horn_oe1st = data['o']['oe1st']['v']
+                        except:
+                            horn_oe1st = ''
+                        if horn_oe1st:
+                            horn_oe_dict['cbtss_h'] = horn_oe1st[1]
+                            horn_oe_dict['cbtsd_h'] = horn_oe1st[3]
+                            horn_oe_dict_rule['cbtss_h'] = '单'
+                            horn_oe_dict_rule['cbtsd_h'] = '双'
+                    if ctid == 12:
                         try:
                             home_data = data['o']['ou']['v']
                             # 球队进球 大条件
@@ -420,8 +474,7 @@ class ZuqiuSpider(scrapy.Spider):
                             half_dict['tbhb_h'] = ""
                             half_dict_rule['tbhs_h'] = ""
                             half_dict['tbhs_h'] = ""
-
-                    if new_data is 13:
+                    if ctid == 13:
                         try:
                             guest_data = data['o']['ou']['v']
                             full_dict_rule['tbgb'] = guest_data[1]
@@ -511,5 +564,10 @@ class ZuqiuSpider(scrapy.Spider):
                 item['half_data'] = half_dict
                 item['full_data_rule'] = full_dict_rule
                 item['half_data_rule'] = half_dict_rule
+                item['horn_ou_dict'] = horn_ou_dict
+                item['horn_ou_dict_rule'] = horn_ou_dict_rule
+                item['horn_oe_dict'] = horn_oe_dict
+                item['horn_oe_dict_rule'] = horn_oe_dict_rule
+                item['horn_team'] = horn_team
                 # item['zuqiu'] = zuqiu
                 yield item