Your Name 6 年之前
父節點
當前提交
bbf6a52441

+ 92 - 137
hg3535/.idea/workspace.xml

@@ -3,16 +3,12 @@
   <component name="ChangeListManager">
     <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$/log/roll_zuqiu.log" beforeDir="false" afterPath="$PROJECT_DIR$/log/roll_zuqiu.log" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/pipelines.py" beforeDir="false" afterPath="$PROJECT_DIR$/pipelines.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/settings.py" beforeDir="false" afterPath="$PROJECT_DIR$/settings.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/spiders/bangqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/bangqiu.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/hg3535_zq_status.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/hg3535_zq_status.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/spiders/hg3535_zuqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/hg3535_zuqiu.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/spiders/lanqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/lanqiu.py" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/spiders/liansai.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/liansai.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/spiders/wangqiu.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/wangqiu.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/spiders/wqbodan.py" beforeDir="false" afterPath="$PROJECT_DIR$/spiders/wqbodan.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" />
@@ -22,7 +18,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="1557825522523" 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="1557892365871" 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$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$" />
     <SUITE FILE_PATH="coverage/hg3535$today_all.coverage" NAME="today_all Coverage Results" MODIFIED="1553172114927" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/spiders" />
@@ -50,31 +46,22 @@
   <component name="FileEditorManager">
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/spiders/lanqiu.py">
+        <entry file="file://$PROJECT_DIR$/pipelines.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="288">
-              <caret line="49" column="32" selection-start-line="49" selection-start-column="32" selection-end-line="49" selection-end-column="32" />
+            <state relative-caret-position="2358">
+              <caret line="1363" column="46" selection-start-line="1363" selection-start-column="46" selection-end-line="1363" selection-end-column="46" />
               <folding>
-                <element signature="e#24#35#0" expanded="true" />
+                <element signature="e#0#15#0" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
-      <file pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/settings.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="326">
-              <caret line="138" column="25" lean-forward="true" selection-start-line="138" selection-start-column="25" selection-end-line="138" selection-end-column="25" />
-            </state>
-          </provider>
-        </entry>
-      </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/spiders/guanjun.py">
+        <entry file="file://$PROJECT_DIR$/spiders/zuqiu.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="216">
-              <caret line="18" column="32" selection-start-line="18" selection-start-column="32" selection-end-line="18" selection-end-column="32" />
+            <state relative-caret-position="7254">
+              <caret line="409" column="41" selection-start-line="409" selection-start-column="39" selection-end-line="409" selection-end-column="44" />
               <folding>
                 <element signature="e#24#35#0" expanded="true" />
               </folding>
@@ -83,55 +70,43 @@
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/spiders/zuqiu.py">
+        <entry file="file://$PROJECT_DIR$/main.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="288">
-              <caret line="21" column="32" selection-start-line="21" selection-start-column="32" selection-end-line="21" selection-end-column="32" />
+            <state relative-caret-position="90">
+              <caret line="7" column="39" selection-start-line="7" selection-start-column="39" selection-end-line="7" selection-end-column="39" />
               <folding>
-                <element signature="e#24#35#0" expanded="true" />
+                <element signature="e#0#10#0" expanded="true" />
               </folding>
             </state>
           </provider>
         </entry>
       </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/spiders/hg3535_zq_status.py">
+      <file pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/settings.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="278">
-              <caret line="177" column="32" selection-start-line="177" selection-start-column="32" selection-end-line="177" selection-end-column="32" />
-              <folding>
-                <element signature="e#24#35#0" expanded="true" />
-              </folding>
+            <state>
+              <caret line="122" column="22" selection-start-line="122" selection-start-column="22" selection-end-line="122" selection-end-column="22" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/spiders/wangqiu.py">
+        <entry file="file://$PROJECT_DIR$/spiders/liansai.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="216">
-              <caret line="20" column="32" selection-start-line="20" selection-start-column="32" selection-end-line="20" selection-end-column="32" />
+            <state relative-caret-position="198">
+              <caret line="17" selection-start-line="17" selection-end-line="18" selection-end-column="49" />
               <folding>
-                <element signature="e#48#59#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/wqbodan.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="216">
-              <caret line="19" column="32" selection-start-line="19" selection-start-column="32" selection-end-line="19" selection-end-column="32" />
-            </state>
-          </provider>
-        </entry>
-      </file>
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/spiders/hg3535_zq_status_up.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="-2457">
-              <caret line="26" column="35" lean-forward="true" selection-start-line="26" selection-start-column="35" selection-end-line="26" selection-end-column="35" />
+            <state relative-caret-position="847">
+              <caret line="227" column="27" selection-start-line="227" selection-start-column="27" selection-end-line="227" selection-end-column="27" />
               <folding>
                 <element signature="e#25#40#0" expanded="true" />
               </folding>
@@ -140,22 +115,10 @@
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/spiders/liansai.py">
-          <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="126">
-              <caret line="18" column="32" selection-start-line="18" selection-start-column="32" selection-end-line="18" selection-end-column="32" />
-              <folding>
-                <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/hg3535_zuqiu.py">
+        <entry file="file://$PROJECT_DIR$/spiders/hg3535_zq_status.py">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="173">
-              <caret line="19" column="32" selection-start-line="19" selection-start-column="32" selection-end-line="19" selection-end-column="32" />
+            <state relative-caret-position="2880">
+              <caret line="177" column="32" selection-start-line="177" selection-start-column="32" selection-end-line="177" selection-end-column="32" />
               <folding>
                 <element signature="e#24#35#0" expanded="true" />
               </folding>
@@ -243,7 +206,6 @@
         <option value="$PROJECT_DIR$/log/zuqiu_log.log" />
         <option value="$PROJECT_DIR$/middlewares.py" />
         <option value="$PROJECT_DIR$/spiders/hg3535_zq_status_up.py" />
-        <option value="$PROJECT_DIR$/main.py" />
         <option value="$PROJECT_DIR$/log/ball_status.log" />
         <option value="$PROJECT_DIR$/log/bangqiu.log" />
         <option value="$PROJECT_DIR$/log/guanjun.log" />
@@ -253,23 +215,23 @@
         <option value="$PROJECT_DIR$/log/wangqiu.log" />
         <option value="$PROJECT_DIR$/log/wqbodan.log" />
         <option value="$PROJECT_DIR$/log/zuqiu.log" />
-        <option value="$PROJECT_DIR$/pipelines.py" />
-        <option value="$PROJECT_DIR$/settings.py" />
         <option value="$PROJECT_DIR$/spiders/bangqiu.py" />
         <option value="$PROJECT_DIR$/spiders/guanjun.py" />
         <option value="$PROJECT_DIR$/spiders/hg3535_zq_status.py" />
         <option value="$PROJECT_DIR$/spiders/hg3535_zuqiu.py" />
         <option value="$PROJECT_DIR$/spiders/lanqiu.py" />
-        <option value="$PROJECT_DIR$/spiders/liansai.py" />
         <option value="$PROJECT_DIR$/spiders/wangqiu.py" />
         <option value="$PROJECT_DIR$/spiders/wqbodan.py" />
         <option value="$PROJECT_DIR$/spiders/zuqiu.py" />
+        <option value="$PROJECT_DIR$/spiders/liansai.py" />
+        <option value="$PROJECT_DIR$/main.py" />
+        <option value="$PROJECT_DIR$/settings.py" />
+        <option value="$PROJECT_DIR$/pipelines.py" />
       </list>
     </option>
   </component>
   <component name="ProjectFrameBounds" extendedState="6">
-    <option name="x" value="124" />
-    <option name="y" value="71" />
+    <option name="x" value="196" />
     <option name="width" value="1583" />
     <option name="height" value="1064" />
   </component>
@@ -531,7 +493,11 @@
       <workItem from="1557452403593" duration="19346000" />
       <workItem from="1557709837370" duration="7351000" />
       <workItem from="1557732817014" duration="849000" />
-      <workItem from="1557796929696" duration="16357000" />
+      <workItem from="1557796929696" duration="16710000" />
+      <workItem from="1557882171427" duration="10493000" />
+      <workItem from="1557912853175" duration="15000" />
+      <workItem from="1557975839431" duration="2154000" />
+      <workItem from="1558073764460" duration="791000" />
     </task>
     <task id="LOCAL-00001" summary="修改后,版本二">
       <created>1555727493584</created>
@@ -670,7 +636,7 @@
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="1395098000" />
+    <option name="totallyTimeSpent" value="1408904000" />
   </component>
   <component name="TodoView">
     <todo-panel id="selected-file">
@@ -683,9 +649,8 @@
   </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.14498934" />
+      <window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.71173847" visible="true" weight="0.15138593" />
       <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" />
@@ -700,7 +665,7 @@
       <window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.5053305" side_tool="true" weight="0.40128756" />
       <window_info anchor="bottom" x="22" y="376" width="1876" height="298" id="Terminal" order="10" sideWeight="0.4946695" weight="0.29291844" />
       <window_info anchor="bottom" id="Python Console" order="11" sideWeight="0.49946696" weight="0.41309014" />
-      <window_info anchor="bottom" id="Run" order="12" sideWeight="0.4946695" visible="true" weight="0.30686694" />
+      <window_info anchor="bottom" id="Run" order="12" sideWeight="0.4946695" weight="0.28004292" />
       <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" />
@@ -949,19 +914,9 @@
     <entry file="file://$PROJECT_DIR$/../../aa.xml">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
-    <entry file="file://$PROJECT_DIR$/log.log">
-      <provider selected="true" editor-type-id="text-editor" />
-    </entry>
-    <entry file="file://$PROJECT_DIR$/log/zuqiu_log.log">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-41964">
-          <caret line="65" column="50" lean-forward="true" selection-start-line="65" selection-start-column="50" selection-end-line="65" selection-end-column="50" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/log/lanqiu_log.log">
-      <provider selected="true" editor-type-id="text-editor" />
-    </entry>
+    <entry file="file://$PROJECT_DIR$/log.log" />
+    <entry file="file://$PROJECT_DIR$/log/zuqiu_log.log" />
+    <entry file="file://$PROJECT_DIR$/log/lanqiu_log.log" />
     <entry file="file://$PROJECT_DIR$/middlewares.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="509">
@@ -972,16 +927,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/main.py">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="252">
-          <caret line="14" column="47" lean-forward="true" selection-start-line="14" selection-start-column="47" selection-end-line="14" selection-end-column="47" />
-          <folding>
-            <element signature="e#0#10#0" expanded="true" />
-          </folding>
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/log/zuqiu.log">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
@@ -1026,107 +971,117 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/pipelines.py">
+    <entry file="file://$PROJECT_DIR$/spiders/guanjun.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="30197">
-          <caret line="1702" column="75" selection-start-line="1702" selection-start-column="75" selection-end-line="1702" selection-end-column="75" />
+        <state relative-caret-position="216">
+          <caret line="18" column="32" selection-start-line="18" selection-start-column="32" selection-end-line="18" selection-end-column="32" />
           <folding>
-            <element signature="e#0#15#0" expanded="true" />
+            <element signature="e#24#35#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/guanjun.py">
+    <entry file="file://$PROJECT_DIR$/spiders/wqbodan.py">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="216">
-          <caret line="18" column="32" selection-start-line="18" selection-start-column="32" selection-end-line="18" selection-end-column="32" />
+          <caret line="19" column="32" selection-start-line="19" selection-start-column="32" selection-end-line="19" selection-end-column="32" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/spiders/hg3535_zuqiu.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="216">
+          <caret line="19" column="32" selection-start-line="19" selection-start-column="32" selection-end-line="19" selection-end-column="32" />
           <folding>
             <element signature="e#24#35#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/hg3535_zq_status.py">
+    <entry file="file://$PROJECT_DIR$/spiders/wangqiu.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="278">
-          <caret line="177" column="32" selection-start-line="177" selection-start-column="32" selection-end-line="177" selection-end-column="32" />
+        <state relative-caret-position="216">
+          <caret line="20" column="32" selection-start-line="20" selection-start-column="32" selection-end-line="20" selection-end-column="32" />
           <folding>
-            <element signature="e#24#35#0" expanded="true" />
+            <element signature="e#48#59#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/hg3535_zq_status_up.py">
+    <entry file="file://$PROJECT_DIR$/spiders/lanqiu.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="-2457">
-          <caret line="26" column="35" lean-forward="true" selection-start-line="26" selection-start-column="35" selection-end-line="26" selection-end-column="35" />
+        <state relative-caret-position="288">
+          <caret line="49" column="32" selection-start-line="49" selection-start-column="32" selection-end-line="49" selection-end-column="32" />
           <folding>
-            <element signature="e#25#40#0" expanded="true" />
+            <element signature="e#24#35#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/hg3535_zuqiu.py">
+    <entry file="file://$PROJECT_DIR$/spiders/zuqiu.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="173">
-          <caret line="19" column="32" selection-start-line="19" selection-start-column="32" selection-end-line="19" selection-end-column="32" />
+        <state relative-caret-position="7254">
+          <caret line="409" column="41" selection-start-line="409" selection-start-column="39" selection-end-line="409" selection-end-column="44" />
           <folding>
             <element signature="e#24#35#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/lanqiu.py">
+    <entry file="file://$PROJECT_DIR$/main.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="288">
-          <caret line="49" column="32" selection-start-line="49" selection-start-column="32" selection-end-line="49" selection-end-column="32" />
+        <state relative-caret-position="90">
+          <caret line="7" column="39" selection-start-line="7" selection-start-column="39" selection-end-line="7" selection-end-column="39" />
           <folding>
-            <element signature="e#24#35#0" expanded="true" />
+            <element signature="e#0#10#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/liansai.py">
+    <entry file="file://$PROJECT_DIR$/spiders/hg3535_zq_status.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="126">
-          <caret line="18" column="32" selection-start-line="18" selection-start-column="32" selection-end-line="18" selection-end-column="32" />
+        <state relative-caret-position="2880">
+          <caret line="177" column="32" selection-start-line="177" selection-start-column="32" selection-end-line="177" selection-end-column="32" />
           <folding>
             <element signature="e#24#35#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/wangqiu.py">
+    <entry file="file://$PROJECT_DIR$/spiders/hg3535_zq_status_up.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="216">
-          <caret line="20" column="32" selection-start-line="20" selection-start-column="32" selection-end-line="20" selection-end-column="32" />
+        <state relative-caret-position="847">
+          <caret line="227" column="27" selection-start-line="227" selection-start-column="27" selection-end-line="227" selection-end-column="27" />
           <folding>
-            <element signature="e#48#59#0" expanded="true" />
+            <element signature="e#25#40#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/wqbodan.py">
+    <entry file="file://$PROJECT_DIR$/spiders/liansai.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="216">
-          <caret line="19" column="32" selection-start-line="19" selection-start-column="32" selection-end-line="19" selection-end-column="32" />
+        <state relative-caret-position="198">
+          <caret line="17" selection-start-line="17" selection-end-line="18" selection-end-column="49" />
+          <folding>
+            <element signature="e#24#35#0" expanded="true" />
+          </folding>
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/spiders/zuqiu.py">
+    <entry file="file://$PROJECT_DIR$/pipelines.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="288">
-          <caret line="21" column="32" selection-start-line="21" selection-start-column="32" selection-end-line="21" selection-end-column="32" />
+        <state relative-caret-position="2358">
+          <caret line="1363" column="46" selection-start-line="1363" selection-start-column="46" selection-end-line="1363" selection-end-column="46" />
           <folding>
-            <element signature="e#24#35#0" expanded="true" />
+            <element signature="e#0#15#0" expanded="true" />
           </folding>
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/settings.py">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="326">
-          <caret line="138" column="25" lean-forward="true" selection-start-line="138" selection-start-column="25" selection-end-line="138" selection-end-column="25" />
+        <state>
+          <caret line="122" column="22" selection-start-line="122" selection-start-column="22" selection-end-line="122" selection-end-column="22" />
         </state>
       </provider>
     </entry>

二進制
hg3535/__pycache__/items.cpython-36.pyc


二進制
hg3535/__pycache__/pipelines.cpython-36.pyc


二進制
hg3535/__pycache__/settings.cpython-36.pyc


+ 123 - 1
hg3535/items.py

@@ -324,4 +324,126 @@ class Zuqiustatus(scrapy.Field):
     status = scrapy.Field()
     update_time = scrapy.Field()
     ball_type = scrapy.Field()
-    zuqiu_toal = scrapy.Field()
+    zuqiu_toal = scrapy.Field()
+
+
+	
+class Roll_Lanqiu(scrapy.Field):
+    # 联赛id
+    league_id = scrapy.Field()
+    # 联赛名
+    league_name = scrapy.Field()
+    result = scrapy.Field()
+    # 比赛id
+    game_id = scrapy.Field()
+    # 球队1
+    team_home = scrapy.Field()
+    # 球队2
+    team_guest = scrapy.Field()
+    # 数量(97>)
+    number = scrapy.Field()
+    # 比赛状态
+    zhuangtai = scrapy.Field()
+    # 日期
+    data_game = scrapy.Field()
+    # 开赛时间
+    time_game = scrapy.Field()
+    # 队1分数
+    score_home = scrapy.Field()
+    # 队2分数
+    score_guest = scrapy.Field()
+    # 第几节
+    jijie = scrapy.Field()
+    # 球队得分
+    qiudui = scrapy.Field()
+
+    concede = scrapy.Field()
+    concede_rule = scrapy.Field()
+    odd_even = scrapy.Field()
+    odd_even_rule = scrapy.Field()
+    total_size = scrapy.Field()
+    total_size_rule = scrapy.Field()
+    last_number = scrapy.Field()
+    capot = scrapy.Field()
+    team_score = scrapy.Field()
+    team_score_rule = scrapy.Field()
+
+
+class Roll_Wangqiu(scrapy.Field):
+    # 联赛id
+    league_id = scrapy.Field()
+    # 联赛名
+    league_name = scrapy.Field()
+    result = scrapy.Field()
+    # 比赛id
+    game_id = scrapy.Field()
+    # 球队1
+    team_home = scrapy.Field()
+    # 球队2
+    team_guest = scrapy.Field()
+    # 数量(97>)
+    number = scrapy.Field()
+    # 比赛状态
+    zhuangtai = scrapy.Field()
+    # 日期
+    data_game = scrapy.Field()
+    # 开赛时间
+    time_game = scrapy.Field()
+    # 队1分数
+    score_home = scrapy.Field()
+    # 队2分数
+    score_guest = scrapy.Field()
+    # 第几节
+    jijie = scrapy.Field()
+    # 球队得分
+    qiudui = scrapy.Field()
+    pt = scrapy.Field()
+
+    concedes_dict = scrapy.Field()
+    concedes_dict_rule = scrapy.Field()
+    kemps_dict = scrapy.Field()
+    bureaus_dict = scrapy.Field()
+    bureaus_dict_rule = scrapy.Field()
+    total_number_dict = scrapy.Field()
+    total_number_dict_rule = scrapy.Field()
+    odd_evens_dict = scrapy.Field()
+    odd_evens_dict_rule = scrapy.Field()
+
+
+class Roll_Bangqiu(scrapy.Field):
+    # 联赛id
+    league_id = scrapy.Field()
+    # 联赛名
+    league_name = scrapy.Field()
+    result = scrapy.Field()
+    # 比赛id
+    game_id = scrapy.Field()
+    # 球队1
+    team_home = scrapy.Field()
+    # 球队2
+    team_guest = scrapy.Field()
+    # 数量(97>)
+    number = scrapy.Field()
+    # 比赛状态
+    zhuangtai = scrapy.Field()
+    # 日期
+    data_game = scrapy.Field()
+    # 开赛时间
+    time_game = scrapy.Field()
+    # 队1分数
+    score_home = scrapy.Field()
+    # 队2分数
+    score_guest = scrapy.Field()
+    # 第几节
+    jijie = scrapy.Field()
+    # 球队得分
+    qiudui = scrapy.Field()
+    pt = scrapy.Field()
+    concedes_dict = scrapy.Field()
+    concedes_dict_rule = scrapy.Field()
+    capots_dict = scrapy.Field()
+    total_size_dict = scrapy.Field()
+    total_size_dict_rule = scrapy.Field()
+    odd_evens_dict = scrapy.Field()
+    odd_evens_dict_rule = scrapy.Field()
+    match_score_dict = scrapy.Field()

+ 51 - 0
hg3535/log/roll_zuqiu.log

@@ -0,0 +1,51 @@
+2019-05-15 10:47:59 [scrapy.extensions.telnet] INFO: Telnet Password: b5a5340f2451a2d2
+2019-05-15 10:47:59 [scrapy.middleware] INFO: Enabled extensions:
+['scrapy.extensions.corestats.CoreStats',
+ 'scrapy.extensions.telnet.TelnetConsole',
+ 'scrapy.extensions.logstats.LogStats']
+2019-05-15 10:48:00 [scrapy.middleware] INFO: Enabled downloader middlewares:
+['hg3535.middlewares.Hg3535timeoutDownloaderMiddleware',
+ 'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware',
+ 'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware',
+ 'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware',
+ 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware',
+ 'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware',
+ 'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware',
+ 'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware',
+ 'scrapy.downloadermiddlewares.stats.DownloaderStats']
+2019-05-15 10:48:00 [scrapy.middleware] INFO: Enabled spider middlewares:
+['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware',
+ 'scrapy.spidermiddlewares.offsite.OffsiteMiddleware',
+ 'scrapy.spidermiddlewares.referer.RefererMiddleware',
+ 'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware',
+ 'scrapy.spidermiddlewares.depth.DepthMiddleware']
+2019-05-15 10:48:00 [scrapy.middleware] INFO: Enabled item pipelines:
+['hg3535.pipelines.Roll_Zuqiupipeline']
+2019-05-15 10:48:00 [scrapy.core.engine] INFO: Spider opened
+2019-05-15 10:48:00 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
+2019-05-15 10:48:00 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023
+2019-05-15 10:48:00 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://hg3535z.com/odds2/d/getodds?sid=1&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0> (referer: None)
+2019-05-15 10:48:00 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://hg3535z.com/odds2/d/getamodds?eid=3177877&iip=true&ubt=am&isp=false> (referer: https://hg3535z.com/odds2/d/getodds?sid=1&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0)
+2019-05-15 10:48:00 [scrapy.core.scraper] DEBUG: Scraped from <200 https://hg3535z.com/odds2/d/getamodds?eid=3177877&iip=true&ubt=am&isp=false>

+None
+2019-05-15 10:48:00 [scrapy.core.engine] INFO: Closing spider (finished)
+2019-05-15 10:48:02 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
+{'downloader/request_bytes': 714,
+ 'downloader/request_count': 2,
+ 'downloader/request_method_count/GET': 2,
+ 'downloader/response_bytes': 3778,
+ 'downloader/response_count': 2,
+ 'downloader/response_status_count/200': 2,
+ 'finish_reason': 'finished',
+ 'finish_time': datetime.datetime(2019, 5, 15, 2, 48, 2, 723055),
+ 'item_scraped_count': 1,
+ 'log_count/DEBUG': 3,
+ 'log_count/INFO': 9,
+ 'request_depth_max': 1,
+ 'response_received_count': 2,
+ 'scheduler/dequeued': 2,
+ 'scheduler/dequeued/memory': 2,
+ 'scheduler/enqueued': 2,
+ 'scheduler/enqueued/memory': 2,
+ 'start_time': datetime.datetime(2019, 5, 15, 2, 48, 0, 120772)}
+2019-05-15 10:48:02 [scrapy.core.engine] INFO: Spider closed (finished)

+ 4 - 1
hg3535/main.py

@@ -11,6 +11,9 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
 # execute(["scrapy", "crawl", "wangqiu"])
 # execute(["scrapy", "crawl", "wqbodan"])
 # execute(["scrapy", "crawl", "bangqiu"])
-execute(["scrapy", "crawl", "roll_zuqiu"]) #滚球
+# execute(["scrapy", "crawl", "roll_zuqiu"]) #滚球足球 回来要解开这个注释 其他全部解封
+# execute(["scrapy", "crawl", "roll_lanqiu"]) #滚球篮球
+# execute(["scrapy", "crawl", "roll_wangqiu"]) #滚球网球
+execute(["scrapy", "crawl", "roll_bangqiu"]) #滚球棒球
 # execute(["scrapy", "crawl", "ball_status"]) #滚球id本地存
 # execute(["scrapy", "crawl", "ball_status_update"]) #滚球id结束时间更新状态

+ 596 - 0
hg3535/pipelines.py

@@ -1,4 +1,5 @@
 import datetime
+import json
 import time
 import hashlib
 import redis
@@ -1735,3 +1736,598 @@ class BallStatuspipeline(object):
         # self.conn.close()
         self.dbpool.close()
 
+
+class Roll_Lanqiupipeline(object):
+    def open_spider(self, spider):
+        self.dbpool = adbapi.ConnectionPool("psycopg2",host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        self.pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"], password=settings["R_PASSWORD"])
+        self.redis_db = redis.StrictRedis(connection_pool=self.pool)
+
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        # 联赛id
+        league_id = item['league_id']
+        # 联赛名
+        league_name = item['league_name']
+        # result = item['result']
+        # 比赛id
+        game_id = item['game_id']
+        # 球队1 #home_team
+        team_home = item['team_home']
+        # 球队2 # guest_team
+        team_guest = item['team_guest']
+        # 数量(97>)
+        number = item['number']
+        # 比赛状态
+        zhuangtai = item['zhuangtai']
+        # 日期
+        # data_game = item['data_game']
+        data_game = item['data_game'].split("/")
+        month = str(data_game[1].strip())
+        day = str(data_game[0])
+        # 比赛时间
+        time_game = str(item['time_game'])
+        # 比赛时间,时间戳
+        ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"
+        r_ctime = "2019" + "-" + month + "-" + day
+        expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))#过期时间
+        # 现在时间,时间戳
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        # 队1分数
+        score_home = item['score_home']
+        # 队2分数
+        score_guest = item['score_guest']
+        # 第几节
+        jijie = item['jijie']
+        # 球队得分
+        qiudui = item['qiudui']
+        pt = item['pt']
+        match_score = "{}:{}".format(score_home,score_guest)
+        concedes_dict = item['concede']
+        concedes_dict_rule = item['concede_rule']
+        odd_evens_dict = item['odd_even']
+        odd_evens_dict_rule = item['odd_even_rule']
+        total_sizes_dict = item['total_size']
+        total_sizes_dict_rule = item['total_size_rule']
+        last_numbers_dict = item['last_number']
+        capots_dict = item['capot']
+        team_scores_dict = item['team_score']
+        team_scores_dict_rule = item['team_score_rule']
+        if concedes_dict:
+            for key, value in concedes_dict.items():
+                if value:
+                    for x, y in enumerate(value):
+                        new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=1)
+                        odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=1,odd=y)
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only =%s;"
+                        cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, y, 1, "concede",x, "hg3535", new_hash, concedes_dict_rule[key][x],odds_only,1,utime, y,odds_only))
+                        # res = cursor.fetchone()
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                        cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime,y, 1, "concede", x, "hg3535", concedes_dict_rule[key][x],odds_only,1))
+                        #插入结果表
+                        sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                        cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
+                        #插入记录表
+                    sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                    cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
+
+
+
+        if odd_evens_dict:
+            for key, value in odd_evens_dict.items():
+                if value:
+                    for x, y in enumerate(value):
+                        new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=2)
+                        odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=2,odd=y)
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only =%s;"
+                        cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime,y, 2, "two_sides",x, "hg3535", new_hash, odd_evens_dict_rule[key][x],odds_only,1,utime, y,odds_only))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s);"
+                        cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime,y, 2, "two_sides", x, "hg3535", odd_evens_dict_rule[key][x],odds_only,1))
+                        sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                        cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
+                        #插入记录表
+                    sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                    cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
+
+
+
+        if total_sizes_dict:
+            for key, value in total_sizes_dict.items():
+                if value:
+                    for x, y in enumerate(value):
+                        new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=3)
+                        odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=3,odd=y)
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only =%s;"
+                        cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime,y, 3, "total_size",x, "hg3535", new_hash, total_sizes_dict_rule[key][x],odds_only,1,utime, y,odds_only))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                        cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime, y, 3, "total_size", x, "hg3535", total_sizes_dict_rule[key][x],odds_only,1))
+                        sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                        cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
+                        #插入记录表
+                    sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                    cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
+
+
+        last_home = last_numbers_dict['last_home']
+        if last_home:
+            for key, value in last_home.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code="last_home" + key, sort=0, p_id=4)
+                    odds_only = r_func(match_id=game_id, odds_code="last_home", sort=0, p_id=4,odd=value)
+                    sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                    cursor.execute(sql1, (int(league_id), "last_home", int(game_id), utime, utime, value, 4, "last_number",0, "hg3535", new_hash, key,odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (int(league_id), "last_home", int(game_id), utime, utime,value, 4, "last_number", 0, "hg3535", key,odds_only,1))
+                    sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
+                    #插入记录表
+                sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
+
+        last_guest = last_numbers_dict['last_guest']
+        if last_guest:
+            for key, value in last_guest.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code="last_guest" + key, sort=0, p_id=4)
+                    odds_only = r_func(match_id=game_id, odds_code="last_guest", sort=0, p_id=4,odd=value)
+                    sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                    cursor.execute(sql1, (int(league_id), "last_guest", int(game_id), utime, utime, value, 4, "last_number",0, "hg3535", new_hash, key,odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (int(league_id), "last_guest", int(game_id), utime, utime,value, 4, "last_number", 0, "hg3535", key,odds_only,1))
+                    sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
+                        #插入记录表
+                sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
+
+        if capots_dict:
+            for key, value in capots_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=5)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=5,odd=value)
+                    sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,is_rollball) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only =%s;"
+                    cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, value, 5, "capot",0, "hg3535", new_hash, odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_rollball) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime, value, 5, "capot", 0, "hg3535",odds_only,1))
+                    sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
+                    #插入记录表
+                sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
+
+        if team_scores_dict:
+            for key, value in team_scores_dict.items():
+                if value:
+                    for x, y in enumerate(value):
+                        new_hash = hash_func(match_id=game_id, odds_code=key, sort=x, p_id=6)
+                        odds_only = r_func(match_id=game_id, odds_code=key, sort=x, p_id=6,odd=y)
+                        sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                        cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, y, 6, "team_score", x, "hg3535", new_hash,team_scores_dict_rule[key][x], odds_only,1,utime, y,odds_only))
+                        # 更新主队st_zq_odds_record表
+                        sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                        cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime,y, 6, "team_score", x, "hg3535",team_scores_dict_rule[key][x],odds_only,1))
+                        sql3 = "insert into st_lq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                        cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),0,0,'hg3535',utime,match_score,time_game,jijie,score_home,score_guest))
+                        #插入记录表
+                    sql4 = "insert into st_lq_result_record(lg_id, home_team, guest_team, home_score, guest_score, first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                    cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '',match_score,'',utime,time_game,jijie,number,int(game_id),'hg3535',0))
+        # 插入赛事表
+        Competition_sql = "insert into st_lq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,type,source,expire_time,is_rollball) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s,%s,%s) on conflict(match_id) do update set tag = %s,expire_time = %s;"
+        print(Competition_sql)
+        cursor.execute(Competition_sql, (team_home, team_guest, league_id, game_id, r_ctime, time_game, utime, utime, number, pt, "hg3535",expire_time,1,number,expire_time))
+
+
+    def close_spider(self, spider):
+        self.dbpool.close()
+
+
+def new_times(ctime):
+    time1 = time.mktime(time.strptime(ctime, '%Y-%m-%d %H:%M:%S')) + 43200
+    time2 = time.localtime(time1)
+    time3 = time.strftime('%Y-%m-%d %H:%M:%S', time2)
+    data_time = str(time3).split(" ")
+    match_date = data_time[0]
+    match_time = data_time[1]
+    return match_date,match_time
+
+
+
+class Roll_Wangqiupipeline(object):
+    def open_spider(self, spider):
+        self.dbpool = adbapi.ConnectionPool("psycopg2",host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        self.pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"], password=settings["R_PASSWORD"])
+        self.redis_db = redis.StrictRedis(connection_pool=self.pool)
+
+
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        # 联赛id
+        league_id = item['league_id']
+        # 联赛名
+        league_name = item['league_name']
+        # result = item['result']
+        # 比赛id
+        game_id = item['game_id']
+        # 球队1
+        team_home = item['team_home']
+        # 球队2
+        team_guest = item['team_guest']
+        # 数量(97>)
+        number = item['number']
+        # 比赛状态
+        zhuangtai = item['zhuangtai']
+        # 日期
+        # data_game = item['data_game']
+        data_game = item['data_game'].split("/")
+        month = str(data_game[1].strip())
+        day = str(data_game[0])
+        # 比赛时间
+        time_game = str(item['time_game'])
+        # 比赛时间,时间戳
+        ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"
+        r_ctime = "2019" + "-" + month + "-" + day
+        # 现在时间,时间戳
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        # 队1分数
+        score_home = item['score_home']
+        # 队2分数
+        score_guest = item['score_guest']
+        # 第几节
+        jijie = item['jijie']
+        # 球队得分
+        qiudui = item['qiudui']
+        pt = item['pt']
+        #取不到 暂时注掉
+        match_date, match_time = new_times(ctime)
+        # 让盘
+        concedes_dict = item['concedes_dict']
+        concedes_dict_rule = item['concedes_dict_rule']
+        # 冠军 独赢
+        kemps_dict = item['kemps_dict']
+        # 让局
+        bureaus_dict = item['bureaus_dict']
+        bureaus_dict_rule = item['bureaus_dict_rule']
+        # 总局数大小
+        total_number_dict = item['total_number_dict']
+        total_number_dict_rule = item['total_number_dict_rule']
+        # 总局数单双
+        odd_evens_dict = item['odd_evens_dict']
+        odd_evens_dict_rule = item['odd_evens_dict_rule']
+        if concedes_dict:
+            for key, value in concedes_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=1,odd=value)
+                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                    cursor.execute(sql1, (
+                    int(league_id), key, int(game_id), utime, utime,value, 1, "dishes_home", 0, "hg3535", new_hash,
+                    concedes_dict_rule[key],odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(game_id), utime, utime, value, 1, "dishes_home", 0, "hg3535",
+                    concedes_dict_rule[key],odds_only,1))
+                    #插入结果表
+                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
+                    # 插入记录表
+                sql4 = "insert into st_wq_result_record(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);"
+                cursor.execute(sql4, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00'))
+
+
+        if kemps_dict:
+            for key, value in kemps_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
+                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                    cursor.execute(sql1, (
+                    int(league_id), key, int(game_id), utime, utime, value, 2, "kemp", 0, "hg3535", new_hash,odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(game_id), utime, utime,value, 2, "kemp", 0, "hg3535",odds_only,1))
+
+                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
+
+        if bureaus_dict:
+            for key, value in bureaus_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=3)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=3,odd=value)
+                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only =%s;"
+                    cursor.execute(sql1, (
+                    int(league_id), key, int(game_id), utime, utime, value, 3, "concede", 0, "hg3535", new_hash,
+                    bureaus_dict_rule[key],odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(game_id), utime, utime,value, 3, "concede", 0, "hg3535",
+                    bureaus_dict_rule[key],odds_only,1))
+                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
+
+        if total_number_dict:
+            for key, value in total_number_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=4)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=4,odd=value)
+                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                    cursor.execute(sql1, (
+                    int(league_id), key, int(game_id), utime, utime,value, 4, "total_number", 0, "hg3535", new_hash,
+                    total_number_dict_rule[key],odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(game_id), utime, utime, value, 4, "total_number", 0, "hg3535",
+                    total_number_dict_rule[key],odds_only,1))
+                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
+
+        if odd_evens_dict:
+            for key, value in odd_evens_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=5)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=5,odd=value)
+                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                    cursor.execute(sql1, (
+                    int(league_id), key, int(game_id), utime, utime,value, 5, "two_sides", 0, "hg3535", new_hash,
+                    odd_evens_dict_rule[key],odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(game_id), utime, utime, value, 5, "two_sides", 0, "hg3535",odd_evens_dict_rule[key],odds_only,1))
+                    sql3 = "insert into st_wq_result(lg_id, home_player_name, guest_player_name, home_player_let_plate, guest_player_let_plate, all_inning,home_player_score,guest_player_score,status,first_score_player,last_score_player,first_inning_score,second_inning_score,third_inning_score,match_winer_player,update_time,match_process,tag,match_id,source,match_time) values (%s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_process =%s,home_player_score =%s,guest_player_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,int(score_home), int(score_guest), 0, score_home,score_guest,1,'','','','','','',utime,jijie,number,game_id,'hg3535','00:00',utime,jijie,score_home,score_guest))
+
+        # 插入赛事表
+        Competition_sql = "insert into st_wq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,type,source,is_rollball) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s,%s) on conflict(match_id) do update set tag = %s;"
+        cursor.execute(Competition_sql, (team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, pt, "hg3535",1,number))
+
+    def close_spider(self, spider):
+        self.dbpool.close()
+
+
+
+class Roll_Banqiupipeline(object):
+
+    def open_spider(self, spider):
+        self.dbpool = adbapi.ConnectionPool("psycopg2",host=settings["POST_HOST"], port=settings['POST_PORT'], user=settings["POST_USER"], password=settings["POST_PASSWORD"], database=settings["POST_DATABASE"])
+        self.pool = redis.ConnectionPool(host=settings["R_HOST"], port=settings["R_POST"], password=settings["R_PASSWORD"])
+        self.redis_db = redis.StrictRedis(connection_pool=self.pool)
+
+
+    def process_item(self, item, spider):
+        # 使用twisted将mysql插入变成异步执行
+        query = self.dbpool.runInteraction(self.do_insert, item)
+        query.addErrback(self.handle_error, item, spider)  # 处理异常
+
+    def handle_error(self, failure, item, spider):
+        # 处理异步插入的异常
+        print(failure)
+
+    def do_insert(self, cursor, item):
+        # 联赛id
+        league_id = item['league_id']
+        # 联赛名
+        league_name = item['league_name']
+        # result = item['result']
+        # 比赛id
+        game_id = item['game_id']
+        # 球队1
+        team_home = item['team_home']
+        # 球队2
+        team_guest = item['team_guest']
+        # 数量(97>)
+        number = item['number']
+        #新增 match_score_dict
+        match_score_dict = item['match_score_dict']
+
+
+
+        # 比赛状态
+        zhuangtai = item['zhuangtai']
+        # 日期
+        # data_game = item['data_game']
+        data_game = item['data_game'].split("/")
+        month = str(data_game[1].strip())
+        day = str(data_game[0])
+        # 比赛时间
+        # time_game = str(item['time_game'])
+        # 比赛时间,时间戳
+        # ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00".strip()
+        r_ctime = "2019" + "-" + month + "-" + day
+        # 现在时间,时间戳
+        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+        expire_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time() + 60))
+        # 队1分数
+        score_home = item['score_home']
+        # 队2分数
+        score_guest = item['score_guest']
+        # 第几节
+        jijie = item['jijie']
+        # 球队得分
+        qiudui = item['qiudui']
+        pt = item['pt']
+        #滚球这个位置获取不到这些字段
+        # match_date, match_time = new_time(ctime)
+        # 让球
+        concedes_dict = item['concedes_dict']
+        concedes_dict_rule = item['concedes_dict_rule']
+        # 独赢
+        capots_dict = item['capots_dict']
+        # 总得分大小
+        total_size_dict = item['total_size_dict']
+        total_size_dict_rule = item['total_size_dict_rule']
+        # 总得分单双
+        odd_evens_dict = item['odd_evens_dict']
+        odd_evens_dict_rule = item['odd_evens_dict_rule']
+
+        # 让球
+        concede = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 1, 'p_code': "concede",
+                   'source': "hg3535", 'expire_time': expire_time, 'sort': 0}
+        # bqone_intodb(data1=concedes_dict, data2=concede, data3=concedes_dict_rule, cursor=cursor)
+        # 总得分:大/小
+        total_size = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 2, 'p_code': "total_size",
+                   'source': "hg3535", 'expire_time': expire_time, 'sort': 0}
+        # bqone_intodb(data1=total_size_dict, data2=total_size, data3=total_size_dict_rule, cursor=cursor)
+
+        odd_even = {'league_id': league_id, 'game_id': game_id, 'utime': utime, 'p_id': 3, 'p_code': "two_sides",
+                   'source': "hg3535", 'expire_time': expire_time, 'sort': 0}
+        # bqone_intodb(data1=odd_evens_dict, data2=odd_even, data3=odd_evens_dict_rule, cursor=cursor)
+        # 赛事失效时间
+        # n_time = out_time(ctime, 3.5)
+        # 插入独赢
+        if capots_dict:
+            for key, value in capots_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
+                    sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,expire_time,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s,expire_time=%s;"
+                    cursor.execute(sql1, (
+                        int(league_id), key, int(game_id), utime, utime, value, 4, "capot", 0, "hg3535", new_hash,
+                        odds_only, expire_time,1,utime, value, odds_only,expire_time))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s);"
+                    cursor.execute(sql2, (
+                        int(league_id), key, int(game_id), utime, utime, value, 4, "capot", 0, "hg3535", odds_only,1))
+                    res = json.dumps(match_score_dict)
+                    sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','',qiudui,'',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,qiudui,r_ctime,jijie,score_home,score_guest))
+        # 插入赛事表
+            Competition_sql = "insert into st_bq_competition(home_team,guest_team,lg_id,status,match_id,ctime,utime,tag,source,type,is_rollball) values(%s, %s, %s, %s, %s, %s, %s,%s, %s,%s,%s) on conflict(match_id) do update set tag=%s,is_rollball=%s,utime=%s;"
+            cursor.execute(Competition_sql, (team_home, team_guest, league_id, 1,game_id,utime, utime, number,"hg3535",1,1,number,1,utime))
+
+
+
+
+
+
+
+        # if concedes_dict:
+        #     for key, value in concedes_dict.items():
+        #         if value:
+        #             new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2,pt=4)
+        #             odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,pt=4,odd=value)
+        #             sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only,expire_time,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s,expire_time=%s;"
+        #             cursor.execute(sql1, (
+        #                 int(league_id), key, int(game_id), utime, utime, value, 4, "bq_capot", 0, "hg3535", new_hash,
+        #                 odds_only, expire_time,1,utime, value, odds_only,expire_time))
+        #             # 更新主队st_zq_odds_record表
+        #             sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime,odds, p_id, p_code, sort, source,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s);"
+        #             cursor.execute(sql2, (
+        #                 int(league_id), key, int(game_id), utime, utime, value, 4, "bq_capot", 0, "hg3535", odds_only,1))
+        #
+        #             sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source) values (%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+        #             cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','',qiudui,'',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',utime,qiudui,r_ctime,jijie,score_home,score_guest))
+        # # 插入赛事表
+        #     Competition_sql = "insert into st_bq_competition(home_team,guest_team,lg_id,status,match_id,ctime,utime,tag,source,type,is_rollball,is_today) values(%s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s,%s) on conflict(match_id) do update set tag=%s,is_today=%s,utime=%s;"
+        #     cursor.execute(Competition_sql, (team_home, team_guest, league_id, 1,game_id,utime, utime, number,"hg3535",1,1,1,number,1,utime))
+
+
+        #让球
+        if concedes_dict:
+            for key, value in concedes_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=1,odd=value)
+                    sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                    cursor.execute(sql1, (
+                    int(league_id), key, int(game_id), utime, utime,value, 1, "concede", 0, "hg3535", new_hash,
+                    concedes_dict_rule[key],odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(game_id), utime, utime, value, 1, "concede", 0, "hg3535",
+                    concedes_dict_rule[key],odds_only,1))
+                    #插入结果表
+                    res = json.dumps(match_score_dict)
+                    # r = pymysql.escape_string(res)
+                    sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score_t = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','','','',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,res,r_ctime,jijie,score_home,score_guest))
+                    # 插入记录表
+                sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_score, guest_score,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '','','',utime,r_ctime,jijie,number,int(game_id),'hg3535',0))
+
+        if total_size_dict:
+            for key, value in total_size_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=2)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=2,odd=value)
+                    sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                    cursor.execute(sql1, (
+                    int(league_id), key, int(game_id), utime, utime,value, 2, "total_size", 0, "hg3535", new_hash,
+                    total_size_dict_rule[key],odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(game_id), utime, utime, value, 2, "total_size", 0, "hg3535",
+                    total_size_dict_rule[key],odds_only,1))
+                    #插入结果表
+                    res = json.dumps(match_score_dict)
+                    # r = pymysql.escape_string(res)
+                    sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score_t = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','','','',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,res,r_ctime,jijie,score_home,score_guest))
+                    # 插入记录表
+                sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_score, guest_score,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '','','',utime,r_ctime,jijie,number,int(game_id),'hg3535',0))
+
+        if odd_evens_dict:
+            for key, value in odd_evens_dict.items():
+                if value:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=3)
+                    odds_only = r_func(match_id=game_id, odds_code=key, sort=0, p_id=3,odd=value)
+                    sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s) on conflict(sole) do update set utime = %s,odds = %s,odds_only=%s;"
+                    cursor.execute(sql1, (
+                    int(league_id), key, int(game_id), utime, utime,value, 3, "two_sides", 0, "hg3535", new_hash,
+                    odd_evens_dict_rule[key],odds_only,1,utime, value,odds_only))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_bq_odds_record(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, condition,odds_only,is_rollball) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(game_id), utime, utime, value, 3, "two_sides", 0, "hg3535",
+                    odd_evens_dict_rule[key],odds_only,1))
+                    #插入结果表
+                    res = json.dumps(match_score_dict)
+                    # r = pymysql.escape_string(res)
+                    sql3 = "insert into st_bq_result(lg_id, home_team, guest_team, home_score, guest_score, all_goal, status,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,u_home_score,u_guest_score,source,match_score_t) values (%s,%s,%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s,%s,%s) on conflict(match_id) do update set update_time = %s,match_score_t = %s,match_time =%s,match_process =%s,home_score =%s,guest_score =%s;"
+                    cursor.execute(sql3, (int(league_id), team_home, team_guest,score_home, score_guest, number, 1,'','','','',utime,r_ctime,jijie,number,int(game_id),0,0,'hg3535',res,utime,res,r_ctime,jijie,score_home,score_guest))
+                    # 插入记录表
+                sql4 = "insert into st_bq_result_record(lg_id, home_team, guest_team, home_score, guest_score,first_score, last_score,match_score,match_winer,update_time,match_time,match_process,tag,match_id,source,status) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s,%s,%s,%s);"
+                cursor.execute(sql4, (int(league_id), team_home, team_guest,score_home, score_guest, '', '','','',utime,r_ctime,jijie,number,int(game_id),'hg3535',0))
+
+            # Competition_sql = "insert into st_bq_competition(home_team, guest_team, lg_id,'2', match_id,ctime, utime, tag,type,source,is_today,is_rollball) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_today=%s,is_morningplate=%s,is_stringscene=%s;"
+            # cursor.execute(Competition_sql, (team_home, team_guest, league_id, game_id,utime, utime, number, pt,"hg3535",1,1,number,1,0,0))
+            # Competition_sql = "insert into st_bq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,type,source,expire_time,is_today,is_morningplate,is_stringscene) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s, %s, %s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_today=%s,is_morningplate=%s,is_stringscene=%s;"
+            # cursor.execute(Competition_sql, (team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, pt,"hg3535",n_time,0,1,0,number, n_time,0,1,0))
+            # Competition_sql = "insert into st_bq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,type,source,expire_time,is_today,is_morningplate,is_stringscene) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s, %s, %s) on conflict(match_id) do update set tag = %s,expire_time=%s,is_today=%s,is_morningplate=%s,is_stringscene=%s;"
+            # cursor.execute(Competition_sql, (team_home, team_guest, league_id, game_id, match_date, match_time, utime, utime, number, pt,"hg3535",n_time,0,0,1,number, n_time,0,0,1))
+
+
+    def close_spider(self, spider):
+        # self.conn.close()
+        self.dbpool.close()

+ 8 - 1
hg3535/settings.py

@@ -148,6 +148,7 @@ LOG_LEVEL = 'WARNING'
 # POST_PORT = '5433'
 # POST_PASSWORD = '123456'
 
+#以后解开这个位置的注释
 POST_HOST = '172.17.0.4'
 POST_DATABASE = 'kaiyou'
 POST_USER = 'kaiyou'
@@ -155,6 +156,12 @@ POST_PORT = '5432'
 POST_PASSWORD = 'yjkj8888'
 
 
+# POST_HOST = '192.168.2.200'
+# POST_DATABASE = 'kaiyou'
+# POST_USER = 'kaiyou'
+# POST_PORT = '10432'
+# POST_PASSWORD = '123456'
+
 R_HOST = 'localhost'
 R_POST = '6379'
 # R_PASSWORD = '123456'
@@ -163,4 +170,4 @@ R_POST = '6379'
 # POST_DATABASE = 'kaiyou'
 # POST_USER = 'kaiyou'
 # POST_PORT = '10432'
-# POST_PASSWORD = '123456'
+# POST_PASSWORD = '123456'

二進制
hg3535/spiders/__pycache__/bangqiu.cpython-36.pyc


二進制
hg3535/spiders/__pycache__/guanjun.cpython-36.pyc


二進制
hg3535/spiders/__pycache__/hg3535_zq_status.cpython-36.pyc


二進制
hg3535/spiders/__pycache__/hg3535_zuqiu.cpython-36.pyc


二進制
hg3535/spiders/__pycache__/lanqiu.cpython-36.pyc


二進制
hg3535/spiders/__pycache__/liansai.cpython-36.pyc


二進制
hg3535/spiders/__pycache__/wangqiu.cpython-36.pyc


二進制
hg3535/spiders/__pycache__/wqbodan.cpython-36.pyc


二進制
hg3535/spiders/__pycache__/zuqiu.cpython-36.pyc


文件差異過大導致無法顯示
+ 34 - 0
hg3535/spiders/hg3535_bangqiu.py


+ 820 - 0
hg3535/spiders/hg3535_lanqiu.py

@@ -0,0 +1,820 @@
+# -*- coding: utf-8 -*-
+import json
+
+import jsonpath
+import scrapy
+from scrapy.http import Request
+
+from ..items import Roll_Lanqiu
+
+
+def rangqiu_daxiao(inner):
+    concede = [inner[i] for i in range(len(inner)) if i % 2 == 1]
+    # 主队让球条件赔率
+    concedehome = [concede[i] for i in range(len(concede)) if i % 2 == 0]
+    # 客队让球条件赔率
+    concedeguest = [concede[i] for i in range(len(concede)) if i % 2 == 1]
+    # 主队让球条件
+    concede_home_rule = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 0]
+    # 主队让球赔率
+    concede_home = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 1]
+    # 客队让球条件
+    concede_guest_rule = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 0]
+    # 客队让球赔率
+    concede_guest = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 1]
+    return concede_home_rule, concede_home, concede_guest_rule, concede_guest
+
+def danshaung_fun(inner):
+    odd_even = [inner[i] for i in range(len(inner)) if i % 2 == 1]
+    # 全场 总分单
+    odd_even_odd = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 0]
+    # 全场 总分双
+    odd_even_even = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 1]
+    return odd_even_odd, odd_even_even
+
+
+class LanqiuSpider(scrapy.Spider):
+    name = "roll_lanqiu"
+    allowed_domains = ['hg3535z.com']
+    start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 篮球滚球列url
+    custom_settings = {
+        "ITEM_PIPELINES": {
+            "hg3535.pipelines.Roll_Lanqiupipeline": 200,
+        }
+    }
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
+    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
+    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
+
+    def parse(self, response):
+        datas = json.loads(response.text)
+        # item = Today_all()
+        ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
+        print(ids)
+        if ids:
+            ids = set(ids)
+            for i in ids:
+                urls = 'https://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
+                print(urls)
+                yield Request(url=urls, callback=self.parse_other)
+
+
+    def parse_other(self,response):
+        new_datas = json.loads(response.text).get('eg', "")
+        try:
+            pt = response.meta['pt']
+        except:
+            pt = 0
+        item = Roll_Lanqiu()
+        if new_datas:
+            # 联赛id
+            league_id = new_datas.get("c", "").get("k", "")
+            # 联赛名
+            league_name = new_datas.get("c", "").get("n", "")
+            new_data = new_datas.get("es", "")
+            result = new_data[0]
+            # 比赛id
+            game_id = str(result['k'])
+            # 球队1
+            team_home = result['i'][0]
+            # 球队2
+            team_guest = result['i'][1]
+            # 数量(97>)
+            number = result['i'][2]
+            # 比赛状态
+            zhuangtai = result['i'][3]
+            # 日期
+            data_game = result['i'][4]
+            # 开赛时间  滚球实际只有一个进行时间
+            # time_game = result['i'][5]
+            time_game = result['sb']['ct']
+            # 队1分数
+            score_home1 = result['i'][10]
+            # 队2分数
+            score_guest1 = result['i'][11]
+            # 第几节
+            jijie = result['i'][12]
+            # 球队得分
+            qiudui = result['pci'].get('ctn', "")
+# ----------------------------------------让球分割线---------------------------------------------------------------------------
+            concedes_dict = {}
+            concedes_dict_rule = {}
+            try:
+                concedes = result['o']["ah"]["v"]
+                # print(concedes)
+                # 主队让球条件,主队让球赔率,客队让球条件,客队让球赔率
+                concede_home_rule,concede_home,concede_guest_rule,concede_guest=rangqiu_daxiao(inner=concedes)
+                concedes_dict_rule['concede_home'] = concede_home_rule
+                concedes_dict['concede_home'] = concede_home
+                concedes_dict_rule['concede_guest'] = concede_guest_rule
+                concedes_dict['concede_guest'] = concede_guest
+            except:
+                concede_guest = ""
+                concede_guest_rule = ""
+                concede_home = ""
+                concede_home_rule = ""
+                concedes_dict_rule['concede_home'] = concede_home_rule
+                concedes_dict['concede_home'] = concede_home
+                concedes_dict_rule['concede_guest'] = concede_guest_rule
+                concedes_dict['concede_guest'] = concede_guest
+            # print(concedes_dict)
+            try:
+                half_concedes = result['o']["ah1st"]["v"]
+                # 上半场 主队让球条件
+                half_concede_home_rule, half_concede_home, half_concede_guest_rule, half_concede_guest=rangqiu_daxiao(inner=half_concedes)
+                concedes_dict_rule['half_concede_home'] = half_concede_home_rule
+                concedes_dict['half_concede_home'] = half_concede_home
+                concedes_dict_rule['half_concede_guest'] = half_concede_guest_rule
+                concedes_dict['half_concede_guest'] = half_concede_guest
+
+            except:
+                half_concede_home_rule = ""
+                half_concede_home = ""
+                half_concede_guest_rule = ""
+                half_concede_guest = ""
+                concedes_dict_rule['half_concede_home'] = half_concede_home_rule
+                concedes_dict['half_concede_home'] = half_concede_home
+                concedes_dict_rule['half_concede_guest'] = half_concede_guest_rule
+                concedes_dict['half_concede_guest'] = half_concede_guest
+
+            # 第一节让球
+            try:
+                one_concedes = result['o']["ahq1"]["v"]
+                one_concede_home_rule,one_concede_home,one_concede_guest_rule,one_concede_guest = rangqiu_daxiao(inner=one_concedes)
+                concedes_dict_rule['one_concede_home'] = half_concede_home_rule
+                concedes_dict['one_concede_home'] = half_concede_home
+                concedes_dict_rule['one_concede_guest'] = half_concede_guest_rule
+                concedes_dict['one_concede_guest'] = one_concede_guest
+
+            except:
+                one_concede_guest = ""
+                one_concede_guest_rule = ""
+                one_concede_home = ""
+                one_concede_home_rule = ""
+                concedes_dict['one_concede_home_rule'] = one_concede_home_rule
+                concedes_dict['one_concede_home'] = one_concede_home
+                concedes_dict['one_concede_guest_rule'] = one_concede_guest_rule
+                concedes_dict['one_concede_guest'] = one_concede_guest
+            # 第二节让球
+            try:
+                two_concedes = result['o']["ahq2"]["v"]
+                two_concede_home_rule,two_concede_home,two_concede_guest_rule,two_concede_guest = rangqiu_daxiao(inner=two_concedes)
+                concedes_dict_rule['two_concede_home'] = two_concede_home_rule
+                concedes_dict['two_concede_home'] = two_concede_home
+                concedes_dict_rule['two_concede_guest'] = two_concede_guest_rule
+                concedes_dict['two_concede_guest'] = two_concede_guest
+            except:
+                two_concede_guest = ""
+                two_concede_guest_rule = ""
+                two_concede_home = ""
+                two_concede_home_rule = ""
+                concedes_dict_rule['two_concede_home'] = two_concede_home_rule
+                concedes_dict['two_concede_home'] = two_concede_home
+                concedes_dict_rule['two_concede_guest'] = two_concede_guest_rule
+                concedes_dict['two_concede_guest'] = two_concede_guest
+            # 第三节让球
+            try:
+                three_concedes = result['o']["ahq3"]["v"]
+                three_concede_home_rule,three_concede_home,three_concede_guest_rule,three_concede_guest = rangqiu_daxiao(inner=three_concedes)
+                concedes_dict_rule['three_concede_home'] = three_concede_home_rule
+                concedes_dict['three_concede_home'] = three_concede_home
+                concedes_dict_rule['three_concede_guest'] = three_concede_guest_rule
+                concedes_dict['three_concede_guest'] = three_concede_guest
+
+            except:
+                three_concede_guest = ""
+                three_concede_guest_rule = ""
+                three_concede_home = ""
+                three_concede_home_rule = ""
+                concedes_dict_rule['three_concede_home'] = three_concede_home_rule
+                concedes_dict['three_concede_home'] = three_concede_home
+                concedes_dict_rule['three_concede_guest'] = three_concede_guest_rule
+                concedes_dict['three_concede_guest'] = three_concede_guest
+            # 第四节让球
+            try:
+                four_concedes = result['o']["ahq4"]["v"]
+                four_concede_home_rule,four_concede_home,four_concede_guest_rule,four_concede_guest = rangqiu_daxiao(inner=four_concedes)
+                concedes_dict_rule['four_concede_home'] = four_concede_home_rule
+                concedes_dict['four_concede_home'] = four_concede_home
+                concedes_dict_rule['four_concede_guest'] = four_concede_guest_rule
+                concedes_dict['four_concede_guest'] = four_concede_guest
+
+            except:
+                four_concede_guest = ""
+                four_concede_guest_rule = ""
+                four_concede_home = ""
+                four_concede_home_rule = ""
+                concedes_dict_rule['four_concede_home'] = four_concede_home_rule
+                concedes_dict['four_concede_home'] = four_concede_home
+                concedes_dict_rule['four_concede_guest'] = four_concede_guest_rule
+                concedes_dict['four_concede_guest'] = four_concede_guest
+# ----------------------------------------总分大小分割线 - ---------------------------------------------------------------
+            # 全场总分大小
+            total_sizes_dict = {}
+            total_sizes_dict_rule = {}
+            try:
+                total_sizes = result['o']["ou"]["v"]
+                total_sizes_big_rule,total_sizes_big,total_sizes_small_rule,total_sizes_small = rangqiu_daxiao(inner=total_sizes)
+                total_sizes_dict_rule["total_sizes_big"] = total_sizes_big_rule
+                total_sizes_dict["total_sizes_big"] = total_sizes_big
+                total_sizes_dict_rule["total_sizes_small"] = total_sizes_small_rule
+                total_sizes_dict["total_sizes_small"] = total_sizes_small
+            except:
+                total_sizes_big_rule = ""
+                total_sizes_big = ""
+                total_sizes_small_rule = ""
+                total_sizes_small = ""
+                total_sizes_dict_rule["total_sizes_big"] = total_sizes_big_rule
+                total_sizes_dict["total_sizes_big"] = total_sizes_big
+                total_sizes_dict_rule["total_sizes_small"] = total_sizes_small_rule
+                total_sizes_dict["total_sizes_small"] = total_sizes_small
+            # 上半场总分大小
+            try:
+                half_total_sizes = result['o']["ou1st"]["v"]
+                half_total_sizes_big_rule,half_total_sizes_big,half_total_sizes_small_rule,half_total_sizes_small = rangqiu_daxiao(inner=half_total_sizes)
+                total_sizes_dict_rule["half_total_sizes_big"] = half_total_sizes_big_rule
+                total_sizes_dict["half_total_sizes_big"] = half_total_sizes_big
+                total_sizes_dict_rule["half_total_sizes_small"] = half_total_sizes_small_rule
+                total_sizes_dict["half_total_sizes_small"] = half_total_sizes_small
+            except:
+                half_total_sizes_big_rule = ""
+                half_total_sizes_big = ""
+                half_total_sizes_small_rule = ""
+                half_total_sizes_small = ""
+                total_sizes_dict_rule["half_total_sizes_big"] = half_total_sizes_big_rule
+                total_sizes_dict["half_total_sizes_big"] = half_total_sizes_big
+                total_sizes_dict_rule["half_total_sizes_small"] = half_total_sizes_small_rule
+                total_sizes_dict["half_total_sizes_small"] = half_total_sizes_small
+            # 第一节总分大小
+            try:
+                one_total_sizes = result['o']["ou1st"]["v"]
+                one_total_sizes_big_rule,one_total_sizes_big,one_total_sizes_small_rule,one_total_sizes_small = rangqiu_daxiao(inner=one_total_sizes)
+                total_sizes_dict_rule["one_total_sizes_big"] = one_total_sizes_big_rule
+                total_sizes_dict["one_total_sizes_big"] = one_total_sizes_big
+                total_sizes_dict_rule["one_total_sizes_small"] = one_total_sizes_small_rule
+                total_sizes_dict["one_total_sizes_small"] = one_total_sizes_small
+            except:
+                one_total_sizes_big_rule = ""
+                one_total_sizes_big = ""
+                one_total_sizes_small_rule = ""
+                one_total_sizes_small = ""
+                total_sizes_dict_rule["one_total_sizes_big"] = one_total_sizes_big_rule
+                total_sizes_dict["one_total_sizes_big"] = one_total_sizes_big
+                total_sizes_dict_rule["one_total_sizes_small"] = one_total_sizes_small_rule
+                total_sizes_dict["one_total_sizes_small"] = one_total_sizes_small
+            # 第二节场总分大小
+            try:
+                two_total_sizes = result['o']["ou2st"]["v"]
+                two_total_sizes_big_rule,two_total_sizes_big,two_total_sizes_small_rule,two_total_sizes_small = rangqiu_daxiao(inner=two_total_sizes)
+                total_sizes_dict_rule["two_total_sizes_big"] = two_total_sizes_big_rule
+                total_sizes_dict["two_total_sizes_big"] = two_total_sizes_big
+                total_sizes_dict_rule["two_total_sizes_small"] = two_total_sizes_small_rule
+                total_sizes_dict["two_total_sizes_small"] = two_total_sizes_small
+            except:
+                two_total_sizes_big_rule = ""
+                two_total_sizes_big = ""
+                two_total_sizes_small_rule = ""
+                two_total_sizes_small = ""
+                total_sizes_dict_rule["two_total_sizes_big"] = two_total_sizes_big_rule
+                total_sizes_dict["two_total_sizes_big"] = two_total_sizes_big
+                total_sizes_dict_rule["two_total_sizes_small"] = two_total_sizes_small_rule
+                total_sizes_dict["two_total_sizes_small"] = two_total_sizes_small
+            # 第三节总分大小
+            try:
+                three_total_sizes = result['o']["ou3st"]["v"]
+                three_total_sizes_big_rule,three_total_sizes_big,three_total_sizes_small_rule,three_total_sizes_small = rangqiu_daxiao(inner=three_total_sizes)
+                total_sizes_dict_rule["three_total_sizes_big"] = three_total_sizes_big_rule
+                total_sizes_dict["three_total_sizes_big"] = three_total_sizes_big
+                total_sizes_dict_rule["three_total_sizes_small"] = three_total_sizes_small_rule
+                total_sizes_dict["three_total_sizes_small"] = three_total_sizes_small
+            except:
+                three_total_sizes_big_rule = ""
+                three_total_sizes_big = ""
+                three_total_sizes_small_rule = ""
+                three_total_sizes_small = ""
+                total_sizes_dict_rule["three_total_sizes_big"] = three_total_sizes_big_rule
+                total_sizes_dict["three_total_sizes_big"] = three_total_sizes_big
+                total_sizes_dict_rule["three_total_sizes_small"] = three_total_sizes_small_rule
+                total_sizes_dict["three_total_sizes_small"] = three_total_sizes_small
+            # 第四节总分大小
+            try:
+                four_total_sizes = result['o']["ou4st"]["v"]
+                four_total_sizes_big_rule,four_total_sizes_big,four_total_sizes_small_rule,four_total_sizes_small = rangqiu_daxiao(inner=four_total_sizes)
+                total_sizes_dict_rule["four_total_sizes_big"] = four_total_sizes_big_rule
+                total_sizes_dict["four_total_sizes_big"] = four_total_sizes_big
+                total_sizes_dict_rule["four_total_sizes_small"] = four_total_sizes_small_rule
+                total_sizes_dict["four_total_sizes_small"] = four_total_sizes_small
+            except:
+                four_total_sizes_big_rule = ""
+                four_total_sizes_big = ""
+                four_total_sizes_small_rule = ""
+                four_total_sizes_small = ""
+                total_sizes_dict_rule["four_total_sizes_big"] = four_total_sizes_big_rule
+                total_sizes_dict["four_total_sizes_big"] = four_total_sizes_big
+                total_sizes_dict_rule["four_total_sizes_small"] = four_total_sizes_small_rule
+                total_sizes_dict["four_total_sizes_small"] = four_total_sizes_small
+
+# ----------------------------------------总分单双分割线------------------------------------------------------------------
+            # 全场 总分单双
+            odd_evens_dict = {}
+            odd_evens_dict_rule = {}
+            try:
+                odd_evens = result['o']["oe"]["v"]
+                # # 全场 总分单, 全场 总分双
+                odd_even_odd, odd_even_even = danshaung_fun(inner=odd_evens)
+                odd_evens_dict["two_sides_single"] = odd_even_odd
+                odd_evens_dict_rule['two_sides_single'] = '单'
+                odd_evens_dict["two_sides_double"] = odd_even_even
+                odd_evens_dict_rule['two_sides_double'] = '双'
+            except:
+                odd_even_odd = ""
+                odd_even_even = ""
+                odd_evens_dict["two_sides_single"] = odd_even_odd
+                odd_evens_dict_rule['two_sides_single'] = '单'
+                odd_evens_dict["two_sides_double"] = odd_even_even
+                odd_evens_dict_rule['two_sides_double'] = '双'
+            # 上半场全场 总分单双
+
+            try:
+                half_odd_evens = result['o']["oe1st"]["v"]
+                # 上半场 总分单, 上半场 总分双
+                half_odd_even_odd,half_odd_even_even = danshaung_fun(inner=half_odd_evens)
+                odd_evens_dict["half_two_sides_single"] = half_odd_even_odd
+                odd_evens_dict_rule['half_two_sides_single'] = '单'
+                odd_evens_dict["half_two_sides_double"] = half_odd_even_even
+                odd_evens_dict_rule['half_two_sides_double'] = '双'
+            except:
+                half_odd_even_odd = ""
+                half_odd_even_even = ""
+                odd_evens_dict["half_two_sides_single"] = half_odd_even_odd
+                odd_evens_dict_rule['half_two_sides_single'] = '单'
+                odd_evens_dict["half_two_sides_double"] = half_odd_even_even
+                odd_evens_dict_rule['half_two_sides_double'] = '双'
+
+            # 总分:单/双-第一节
+            try:
+                one_odd_evens = result['o']["oeq1"]["v"]
+                one_odd_even_odd,one_odd_even_even = danshaung_fun(inner=one_odd_evens)
+                odd_evens_dict["one_two_sides_single"] = one_odd_even_odd
+                odd_evens_dict_rule['one_two_sides_single'] = '单'
+                odd_evens_dict["one_two_sides_double"] = one_odd_even_even
+                odd_evens_dict_rule['one_two_sides_double'] = '双'
+            except:
+                one_odd_even_odd = ""
+                one_odd_even_even = ""
+                odd_evens_dict["one_two_sides_single"] = one_odd_even_odd
+                odd_evens_dict_rule['one_two_sides_single'] = '单'
+                odd_evens_dict["one_two_sides_double"] = one_odd_even_even
+                odd_evens_dict_rule['one_two_sides_double'] = '双'
+
+
+            # 总分:单/双-第二节
+            try:
+                two_odd_evens = result['o']["oeq2"]["v"]
+                two_odd_even_odd,two_odd_even_even = danshaung_fun(inner=two_odd_evens)
+                odd_evens_dict["two_two_sides_single"] = two_odd_even_odd
+                odd_evens_dict_rule['two_two_sides_single'] = '单'
+                odd_evens_dict["two_two_sides_double"] = two_odd_even_even
+                odd_evens_dict_rule['two_two_sides_double'] = '双'
+            except:
+                two_odd_even_odd = ""
+                two_odd_even_even = ""
+                odd_evens_dict["two_two_sides_single"] = two_odd_even_odd
+                odd_evens_dict_rule['two_two_sides_single'] = '单'
+                odd_evens_dict["two_two_sides_double"] = two_odd_even_even
+                odd_evens_dict_rule['two_two_sides_double'] = '双'
+
+            # 总分:单/双-第三节
+            try:
+                three_odd_evens = result['o']["oeq3"]["v"]
+                three_odd_even_odd,three_odd_even_even = danshaung_fun(inner=three_odd_evens)
+                odd_evens_dict["three_two_sides_single"] = three_odd_even_odd
+                odd_evens_dict_rule['three_two_sides_single'] = '单'
+                odd_evens_dict["three_two_sides_double"] = three_odd_even_even
+                odd_evens_dict_rule['three_two_sides_double'] = '双'
+
+
+            except:
+                three_odd_even_odd = ""
+                three_odd_even_even = ""
+                odd_evens_dict["three_two_sides_single"] = three_odd_even_odd
+                odd_evens_dict_rule['three_two_sides_single'] = '单'
+                odd_evens_dict["three_two_sides_double"] = three_odd_even_even
+                odd_evens_dict_rule['three_two_sides_double'] = '双'
+
+
+
+            # 总分:单/双-第四节
+            try:
+                four_odd_evens = result['o']["oeq4"]["v"]
+                four_odd_even_odd,four_odd_even_even = danshaung_fun(inner=four_odd_evens)
+                odd_evens_dict["four_two_sides_single"] = four_odd_even_odd
+                odd_evens_dict_rule['four_two_sides_single'] = '单'
+                odd_evens_dict["four_two_sides_double"] = four_odd_even_even
+                odd_evens_dict_rule['four_two_sides_double'] = '双'
+            except:
+                four_odd_even_odd = ""
+                four_odd_even_even = ""
+                odd_evens_dict["four_two_sides_single"] = four_odd_even_odd
+                odd_evens_dict_rule['four_two_sides_single'] = '单'
+                odd_evens_dict["four_two_sides_double"] = four_odd_even_even
+                odd_evens_dict_rule['four_two_sides_double'] = '双'
+
+# ----------------------------------------球队得分最后一位数分割线---------------------------------------------------------
+            # 球队得分最后一位数 主队
+            last_numbers_dict = {}
+            try:
+                last_numbers = result["p-o"][0]['o']
+                last_home = {}
+                for last_number in last_numbers:
+                    last_home[last_number[0]] = last_number[2]
+            except:
+                last_home = {}
+            last_numbers_dict["last_home"] = last_home
+            # 球队得分最后一位数 客队
+            try:
+                new_last_numbers = result["p-o"][1]['o']
+                last_guest = {}
+                for new_last_number in new_last_numbers:
+                    last_guest[new_last_number[0]] = new_last_number[2]
+            except:
+                last_guest = {}
+            last_numbers_dict["last_guest"] = last_guest
+# ------------------------------------------------------独赢分割线---------------------------------------------------------
+            capots_dict = {}
+            # 独赢
+            try:
+                capots = result['o']["ml"]["v"]
+                capot_list = [capots[i] for i in range(len(capots)) if i % 2 == 1]
+                capot_home = capot_list[0]
+                capot_guest = capot_list[1]
+                capots_dict["capot_home"] = capot_home
+                capots_dict["capot_guest"] = capot_guest
+            except:
+                capot_home = ""
+                capot_guest = ""
+                capots_dict["capot_home"] = capot_home
+                capots_dict["capot_guest"] = capot_guest
+
+            # 上半场独赢
+            try:
+                half_capots = result['o']["ml1st"]["v"]
+                half_capot_list = [half_capots[i] for i in range(len(half_capots)) if i % 2 == 1]
+                half_capot_home = half_capot_list[0]
+                half_capot_guest = half_capot_list[1]
+                capots_dict["half_capot_home"] = half_capot_home
+                capots_dict["half_capot_guest"] = half_capot_guest
+            except:
+                half_capot_home = ""
+                half_capot_guest = ""
+                capots_dict["half_capot_home"] = half_capot_home
+                capots_dict["half_capot_guest"] = half_capot_guest
+
+            # 第一节独赢
+            try:
+                one_capots = result['o']["mlq1"]["v"]
+                one_capot_list = [one_capots[i] for i in range(len(one_capots)) if i % 2 == 1]
+                one_capot_home = one_capot_list[0]
+                one_capot_guest = one_capot_list[1]
+                capots_dict["one_capot_home"] = one_capot_home
+                capots_dict["one_capot_guest"] = one_capot_guest
+            except:
+                one_capot_home = ""
+                one_capot_guest = ""
+                capots_dict["one_capot_home"] = one_capot_home
+                capots_dict["one_capot_guest"] = one_capot_guest
+
+            # 第二节独赢
+            try:
+                two_capots = result['o']["mlq2"]["v"]
+                two_capot_list = [two_capots[i] for i in range(len(two_capots)) if i % 2 == 1]
+                two_capot_home = two_capot_list[0]
+                two_capot_guest = two_capot_list[1]
+                capots_dict["two_capot_home"] = two_capot_home
+                capots_dict["two_capot_guest"] = two_capot_guest
+            except:
+                two_capot_home = ""
+                two_capot_guest = ""
+                capots_dict["two_capot_home"] = two_capot_home
+                capots_dict["two_capot_guest"] = two_capot_guest
+
+            # 第三节独赢
+            try:
+                three_capots = result['o']["mlq3"]["v"]
+                three_capot_list = [three_capots[i] for i in range(len(three_capots)) if i % 2 == 1]
+                three_capot_home = three_capot_list[0]
+                three_capot_guest = three_capot_list[1]
+                capots_dict["three_capot_home"] = three_capot_home
+                capots_dict["three_capot_guest"] = three_capot_guest
+            except:
+                three_capot_home = ""
+                three_capot_guest = ""
+                capots_dict["three_capot_home"] = three_capot_home
+                capots_dict["three_capot_guest"] = three_capot_guest
+
+            # 第四节独赢
+            try:
+                four_capots = result['o']["mlq2"]["v"]
+                four_capot_list = [four_capots[i] for i in range(len(four_capots)) if i % 2 == 1]
+                four_capot_home = four_capot_list[0]
+                four_capot_guest = four_capot_list[1]
+                capots_dict["four_capot_home"] = four_capot_home
+                capots_dict["four_capot_guest"] = four_capot_guest
+            except:
+                four_capot_home = ""
+                four_capot_guest = ""
+                capots_dict["four_capot_home"] = four_capot_home
+                capots_dict["four_capot_guest"] = four_capot_guest
+
+# ---------------------------------------------------华丽分割线列表es[1]--------------------------------------------------
+            # 球队得分 全场主队 home
+            team_scores_dict = {}
+            team_scores_dict_rule = {}
+            try:
+                score_home = new_data[1]
+            except:
+                score_home = ""
+            if score_home:
+                try:
+                    score_homes = score_home["o"]["ou"]['v']
+                    score_home_big_rule,score_home_big,score_home_small_rule,score_home_small = rangqiu_daxiao(inner=score_homes)
+                    team_scores_dict_rule["score_home_big"] = score_home_big_rule
+                    team_scores_dict["score_home_big"] = score_home_big
+                    team_scores_dict_rule["score_home_small"] = score_home_small_rule
+                    team_scores_dict["score_home_small"] = score_home_small
+                except:
+                    score_home_small = ""
+                    score_home_small_rule = ""
+                    score_home_big_rule = ""
+                    score_home_big = ""
+                    team_scores_dict_rule["score_home_big"] = score_home_big_rule
+                    team_scores_dict["score_home_big"] = score_home_big
+                    team_scores_dict_rule["score_home_small"] = score_home_small_rule
+                    team_scores_dict["score_home_small"] = score_home_small
+                # 球队得分 上半场主队 home
+                try:
+                    half_score_homes = score_home['o']['ou1st']['v']
+                    # 球队得分 上半场主队 大条件
+                    half_score_home_big_rule,half_score_home_big,half_score_home_small_rule,half_score_home_small = rangqiu_daxiao(inner=half_score_homes)
+                    team_scores_dict_rule["half_score_home_big"] = half_score_home_big_rule
+                    team_scores_dict["half_score_home_big"] = half_score_home_big
+                    team_scores_dict_rule["half_score_home_small"] = half_score_home_small_rule
+                    team_scores_dict["half_score_home_small"] = half_score_home_small
+                except:
+                    half_score_home_small = ""
+                    half_score_home_small_rule = ""
+                    half_score_home_big = ""
+                    half_score_home_big_rule = ""
+                    team_scores_dict_rule["half_score_home_big"] = half_score_home_big_rule
+                    team_scores_dict["half_score_home_big"] = half_score_home_big
+                    team_scores_dict_rule["half_score_home_small"] = half_score_home_small_rule
+                    team_scores_dict["half_score_home_small"] = half_score_home_small
+
+                # 球队得分:主队-大 / 小-第一节
+                try:
+                    one_score_homes = score_home['o']["ouq1"]["v"]
+                    one_score_home_big_rule,one_score_home_big,one_score_home_small_rule,one_score_home_small = rangqiu_daxiao(inner=one_score_homes)
+                    team_scores_dict_rule["one_score_home_big"] = one_score_home_big_rule
+                    team_scores_dict["one_score_home_big"] = one_score_home_big
+                    team_scores_dict_rule["one_score_home_small"] = one_score_home_small_rule
+                    team_scores_dict["one_score_home_small"] = one_score_home_small
+                except:
+                    one_score_home_small = ""
+                    one_score_home_small_rule = ""
+                    one_score_home_big = ""
+                    one_score_home_big_rule = ""
+                    team_scores_dict_rule["one_score_home_big"] = one_score_home_big_rule
+                    team_scores_dict["one_score_home_big"] = one_score_home_big
+                    team_scores_dict_rule["one_score_home_small"] = one_score_home_small_rule
+                    team_scores_dict["one_score_home_small"] = one_score_home_small
+
+                # 球队得分:主队-大 / 小-第二节
+                try:
+                    two_score_homes = score_home['o']["ouq2"]["v"]
+                    two_score_home_big_rule,two_score_home_big,two_score_home_small_rule,two_score_home_small = rangqiu_daxiao(inner=two_score_homes)
+                    team_scores_dict_rule["two_score_home_big"] = two_score_home_big_rule
+                    team_scores_dict["two_score_home_big"] = two_score_home_big
+                    team_scores_dict_rule["two_score_home_small"] = two_score_home_small_rule
+                    team_scores_dict["two_score_home_small"] = two_score_home_small
+                except:
+                    two_score_home_small = ""
+                    two_score_home_small_rule = ""
+                    two_score_home_big = ""
+                    two_score_home_big_rule = ""
+                    team_scores_dict_rule["two_score_home_big"] = two_score_home_big_rule
+                    team_scores_dict["two_score_home_big"] = two_score_home_big
+                    team_scores_dict_rule["two_score_home_small"] = two_score_home_small_rule
+                    team_scores_dict["two_score_home_small"] = two_score_home_small
+
+                # 球队得分:主队-大 / 小-第三节
+                try:
+                    three_score_homes = score_home['o']["ouq3"]["v"]
+                    three_score_home_big_rule,three_score_home_big,three_score_home_small_rule,three_score_home_small = rangqiu_daxiao(inner=three_score_homes)
+                    team_scores_dict_rule["three_score_home_big"] = three_score_home_big_rule
+                    team_scores_dict["three_score_home_big"] = three_score_home_big
+                    team_scores_dict_rule["three_score_home_small"] = three_score_home_small_rule
+                    team_scores_dict["three_score_home_small"] = three_score_home_small
+                except:
+                    three_score_home_small = ""
+                    three_score_home_small_rule = ""
+                    three_score_home_big = ""
+                    three_score_home_big_rule = ""
+                    team_scores_dict_rule["three_score_home_big"] = three_score_home_big_rule
+                    team_scores_dict["three_score_home_big"] = three_score_home_big
+                    team_scores_dict_rule["three_score_home_small"] = three_score_home_small_rule
+                    team_scores_dict["three_score_home_small"] = three_score_home_small
+
+                # 球队得分:主队-大 / 小-第四节
+                try:
+                    four_score_homes = score_home['o']["ouq4"]["v"]
+                    four_score_home_big_rule,four_score_home_big,four_score_home_small_rule,four_score_home_small = rangqiu_daxiao(inner=four_score_homes)
+                    team_scores_dict_rule["four_score_home_big"] = four_score_home_big_rule
+                    team_scores_dict["four_score_home_big"] = four_score_home_big
+                    team_scores_dict_rule["four_score_home_small"] = four_score_home_small_rule
+                    team_scores_dict["four_score_home_small"] = four_score_home_small
+                except:
+                    four_score_home_small = ""
+                    four_score_home_small_rule = ""
+                    four_score_home_big = ""
+                    four_score_home_big_rule = ""
+                    team_scores_dict_rule["four_score_home_big"] = four_score_home_big_rule
+                    team_scores_dict["four_score_home_big"] = four_score_home_big
+                    team_scores_dict_rule["four_score_home_small"] = four_score_home_small_rule
+                    team_scores_dict["four_score_home_small"] = four_score_home_small
+
+
+# ---------------------------------------------------华丽分割线列表es[2]--------------------------------------------------
+            # 球队得分 客队 guest
+            try:
+                score_guest = new_data[2]
+            except:
+                score_guest = ""
+            if score_guest:
+                try:
+                    # 球队得分: 大 / 小
+                    score_guests = score_guest["o"]["ou"]['v']
+                    score_guest_big_rule,score_guest_big,score_guest_small_rule,score_guest_small = rangqiu_daxiao(inner=score_guests)
+                    team_scores_dict_rule["score_guest_big"] = score_guest_big_rule
+                    team_scores_dict["score_guest_big"] = score_guest_big
+                    team_scores_dict_rule["score_guest_small"] = score_guest_small_rule
+                    team_scores_dict["score_guest_small"] = score_guest_small
+                except:
+                    score_guest_small = ""
+                    score_guest_small_rule = ""
+                    score_guest_big = ""
+                    score_guest_big_rule = ""
+                    team_scores_dict_rule["score_guest_big"] = score_guest_big_rule
+                    team_scores_dict["score_guest_big"] = score_guest_big
+                    team_scores_dict_rule["score_guest_small"] = score_guest_small_rule
+                    team_scores_dict["score_guest_small"] = score_guest_small
+
+                # 球队得分 上半场客队 guest
+                try:
+                    half_score_guests = score_guest["o"]['ou1st']['v']
+                    half_score_guest_big_rule,half_score_guest_big,half_score_guest_small_rule,half_score_guest_small = rangqiu_daxiao(inner=half_score_guests)
+                    team_scores_dict_rule["half_score_guest_big"] = half_score_guest_big_rule
+                    team_scores_dict["half_score_guest_big"] = half_score_guest_big
+                    team_scores_dict_rule["half_score_guest_small"] = half_score_guest_small_rule
+                    team_scores_dict["half_score_guest_small"] = half_score_guest_small
+                except:
+                    half_score_guest_small = ""
+                    half_score_guest_small_rule = ""
+                    half_score_guest_big = ""
+                    half_score_guest_big_rule = ""
+                    team_scores_dict_rule["half_score_guest_big"] = half_score_guest_big_rule
+                    team_scores_dict["half_score_guest_big"] = half_score_guest_big
+                    team_scores_dict_rule["half_score_guest_small"] = half_score_guest_small_rule
+                    team_scores_dict["half_score_guest_small"] = half_score_guest_small
+                # 球队得分第一节
+                try:
+                    one_score_guests = score_guest["o"]['ouq1']['v']
+                    one_score_guest_big_rule, one_score_guest_big, one_score_guest_small_rule, one_score_guest_small = rangqiu_daxiao(
+                        inner=one_score_guests)
+                    team_scores_dict_rule["one_score_guest_big"] = one_score_guest_big_rule
+                    team_scores_dict["one_score_guest_big"] = one_score_guest_big
+                    team_scores_dict_rule["one_score_guest_small"] = one_score_guest_small_rule
+                    team_scores_dict["one_score_guest_small"] = one_score_guest_small
+                except:
+                    one_score_guest_small = ""
+                    one_score_guest_small_rule = ""
+                    one_score_guest_big = ""
+                    one_score_guest_big_rule = ""
+                    team_scores_dict_rule["one_score_guest_big"] = one_score_guest_big_rule
+                    team_scores_dict["one_score_guest_big"] = one_score_guest_big
+                    team_scores_dict_rule["one_score_guest_small"] = one_score_guest_small_rule
+                    team_scores_dict["one_score_guest_small"] = one_score_guest_small
+
+                # 球队得分第二节
+                try:
+                    two_score_guests = score_guest["o"]['ouq2']['v']
+                    two_score_guest_big_rule, two_score_guest_big, two_score_guest_small_rule, two_score_guest_small = rangqiu_daxiao(
+                        inner=two_score_guests)
+                    team_scores_dict_rule["two_score_guest_big"] = two_score_guest_big_rule
+                    team_scores_dict["two_score_guest_big"] = two_score_guest_big
+                    team_scores_dict_rule["two_score_guest_small"] = two_score_guest_small_rule
+                    team_scores_dict["two_score_guest_small"] = two_score_guest_small
+                except:
+                    two_score_guest_small = ""
+                    two_score_guest_small_rule = ""
+                    two_score_guest_big = ""
+                    two_score_guest_big_rule = ""
+                    team_scores_dict_rule["two_score_guest_big"] = two_score_guest_big_rule
+                    team_scores_dict["two_score_guest_big"] = two_score_guest_big
+                    team_scores_dict_rule["two_score_guest_small"] = two_score_guest_small_rule
+                    team_scores_dict["two_score_guest_small"] = two_score_guest_small
+                # 球队得分第三节
+                try:
+                    three_score_guests = score_guest["o"]['ouq3']['v']
+                    three_score_guest_big_rule, three_score_guest_big, three_score_guest_small_rule, three_score_guest_small = rangqiu_daxiao(
+                        inner=three_score_guests)
+                    team_scores_dict_rule["three_score_guest_big"] = three_score_guest_big_rule
+                    team_scores_dict["three_score_guest_big"] = three_score_guest_big
+                    team_scores_dict_rule["three_score_guest_small"] = three_score_guest_small_rule
+                    team_scores_dict["three_score_guest_small"] = three_score_guest_small
+                except:
+                    three_score_guest_small = ""
+                    three_score_guest_small_rule = ""
+                    three_score_guest_big = ""
+                    three_score_guest_big_rule = ""
+                    team_scores_dict_rule["three_score_guest_big"] = three_score_guest_big_rule
+                    team_scores_dict["three_score_guest_big"] = three_score_guest_big
+                    team_scores_dict_rule["three_score_guest_small"] = three_score_guest_small_rule
+                    team_scores_dict["three_score_guest_small"] = three_score_guest_small
+                # 球队得分第四节
+                try:
+                    four_score_guests = score_guest["o"]['ouq4']['v']
+                    four_score_guest_big_rule, four_score_guest_big, four_score_guest_small_rule, four_score_guest_small = rangqiu_daxiao(
+                        inner=four_score_guests)
+                    team_scores_dict_rule["four_score_guest_big"] = four_score_guest_big_rule
+                    team_scores_dict["four_score_guest_big"] = four_score_guest_big
+                    team_scores_dict_rule["four_score_guest_small"] = four_score_guest_small_rule
+                    team_scores_dict["four_score_guest_small"] = four_score_guest_small
+                except:
+                    four_score_guest_small = ""
+                    four_score_guest_small_rule = ""
+                    four_score_guest_big = ""
+                    four_score_guest_big_rule = ""
+                    team_scores_dict_rule["four_score_guest_big"] = four_score_guest_big_rule
+                    team_scores_dict["four_score_guest_big"] = four_score_guest_big
+                    team_scores_dict_rule["four_score_guest_small"] = four_score_guest_small_rule
+                    team_scores_dict["four_score_guest_small"] = four_score_guest_small
+
+            # 联赛id
+            item['league_id'] = league_id
+            # 联赛名
+            item['league_name'] = league_name
+            # item['result'] = result
+            # 比赛id
+            item['game_id'] = game_id
+            # 球队1
+            item['team_home'] = team_home
+            # 球队2
+            item['team_guest'] = team_guest
+            # 数量(97>)
+            item['number'] = number
+            # 比赛状态
+            item['zhuangtai'] = zhuangtai
+            # 日期
+            item['data_game'] = data_game
+            # 开赛时间
+            item['time_game'] = time_game
+            # 队1分数
+            item['score_home'] = score_home1
+            # 队2分数
+            item['score_guest'] = score_guest1
+            # 第几节
+            item['jijie'] = jijie
+            item['pt'] = pt
+            # 球队得分
+            item['qiudui'] = qiudui
+            item['concede'] = concedes_dict
+            item['concede_rule'] = concedes_dict_rule
+            item['odd_even'] = odd_evens_dict
+            item['odd_even_rule'] = odd_evens_dict_rule
+            item['total_size'] = total_sizes_dict
+            item['total_size_rule'] = total_sizes_dict_rule
+            item['last_number'] = last_numbers_dict
+            item['capot'] = capots_dict
+            item['team_score'] = team_scores_dict
+            item['team_score_rule'] = team_scores_dict_rule
+            yield item
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 373 - 0
hg3535/spiders/hg3535_wangqiu.py

@@ -0,0 +1,373 @@
+# -*- coding: utf-8 -*-
+import json
+
+import jsonpath
+import scrapy
+from scrapy.http import Request
+
+# from ..items import Lanqiu
+from ..items import Roll_Wangqiu
+
+
+def rangqiu_daxiao(inner):
+    concede = [inner[i] for i in range(len(inner)) if i % 2 == 1]
+    # 主队让球条件赔率
+    concedehome = [concede[i] for i in range(len(concede)) if i % 2 == 0]
+    # 客队让球条件赔率
+    concedeguest = [concede[i] for i in range(len(concede)) if i % 2 == 1]
+    # 主队让球条件
+    concede_home_rule = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 0]
+    # 主队让球赔率
+    concede_home = [concedehome[i] for i in range(len(concedehome)) if i % 2 == 1]
+    # 客队让球条件
+    concede_guest_rule = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 0]
+    # 客队让球赔率
+    concede_guest = [concedeguest[i] for i in range(len(concedeguest)) if i % 2 == 1]
+    return concede_home_rule, concede_home, concede_guest_rule, concede_guest
+
+def danshaung_fun(inner):
+    odd_even = [inner[i] for i in range(len(inner)) if i % 2 == 1]
+    # 全场 总分单
+    odd_even_odd = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 0]
+    # 全场 总分双
+    odd_even_even = [odd_even[i] for i in range(len(odd_even)) if i % 2 == 1]
+    return odd_even_odd, odd_even_even
+
+
+class WangqiuSpider(scrapy.Spider):
+    name = "roll_wangqiu"
+    allowed_domains = ['hg3535z.com']
+    start_urls = ['https://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 网球滚球列url
+    custom_settings = {
+        "ITEM_PIPELINES": {
+            "hg3535.pipelines.Roll_Wangqiupipeline": 350,
+        }
+    }
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=3&ubt=am&pn=0&sb=2&dc=null&pid=0']
+    # http: // hg3535z.com / odds2 / d / getamodds?eid = 3098030 & iip = false & ubt = am & isp = false
+    # http://hg3535z.com/odds2/d/getodds?sid=2&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0
+
+    def parse(self, response):
+        datas = json.loads(response.text)
+        # item = Today_all()
+        ids = jsonpath.jsonpath(datas, '$..i-ot[0]..egs..es..i[16]') # ids新列表
+        print(ids)
+        if ids:
+            ids = set(ids)
+            for i in ids:
+                urls = 'https://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
+                print(urls)
+                yield Request(url=urls, callback=self.parse_other)
+
+
+    def parse_other(self,response):
+        new_datas = json.loads(response.text).get('eg', "")
+        try:
+            pt = response.meta['pt']
+        except:
+            pt = 0
+        item = Roll_Wangqiu()
+        if new_datas:
+            # 联赛id
+            league_id = new_datas.get("c", "").get("k", "")
+            # 联赛名
+            league_name = new_datas.get("c", "").get("n", "")
+            new_data = new_datas.get("es", "")
+            result = new_data[0]
+            # 比赛id
+            game_id = str(result['k'])
+            # 球队1
+            team_home = result['i'][0]
+            # 球队2
+            team_guest = result['i'][1]
+            # 数量(97>)
+            number = result['i'][2]
+            # 比赛状态
+            zhuangtai = result['i'][3]
+            # 日期
+            data_game = result['i'][4]
+            # 开赛时间  滚球实际只有一个进行时间
+            # time_game = result['i'][5]
+            try:
+                time_game = result['sb']['ct']
+            except:
+                time_game = '01:00'
+            # time_game = '00:00:00'
+            # time_game = result.get('sb',"").get('ct',"")
+            # 队1分数
+            score_home1 = result['i'][10]
+            # 队2分数
+            score_guest1 = result['i'][11]
+            # 第几节
+            jijie = result['i'][12]
+            # 球队得分
+            qiudui = result['pci'].get('ctn', "")
+# ----------------------------------------让球分割线---------------------------------------------------------------------------
+            concedes_dict = {}
+            concedes_dict_rule = {}
+            try:
+                # 滚球让盘
+                concedes = result['o']["ah"]["v"]
+                concedes_dict_rule['dishes_home'] = concedes[1]
+                concedes_dict['dishes_home'] = concedes[5]
+                concedes_dict_rule['dishes_guest'] = concedes[3]
+                concedes_dict['dishes_guest'] = concedes[7]
+            except:
+                concedes_dict_rule['dishes_home'] = ""
+                concedes_dict['dishes_home'] = ""
+                concedes_dict_rule['dishes_guest'] = ""
+                concedes_dict['dishes_guest'] = ""
+            # print(concedes_dict)
+
+# ----------------------------------------第一节让球分割线---------------------------------------------------------------------------
+
+            #第一节让球
+            try:
+                # 第一节让球
+                one_concedes = result['o']["ahs1"]["v"]
+                one_concede_home_rule,one_concede_home,one_concede_guest_rule,one_concede_guest= rangqiu_daxiao(inner=one_concedes)
+                concedes_dict_rule['one_concede_home'] = ''.join(one_concede_home_rule)
+                concedes_dict['one_concede_home'] = ''.join(one_concede_home)
+                concedes_dict_rule['one_concede_guest'] = ''.join(one_concede_guest_rule)
+                concedes_dict['one_concede_guest'] = ''.join(one_concede_guest)
+            except:
+                one_concede_guest = ""
+                one_concede_guest_rule = ""
+                one_concede_home = ""
+                one_concede_home_rule = ""
+                concedes_dict['one_concede_home_rule'] = one_concede_home_rule
+                concedes_dict['one_concede_home'] = one_concede_home
+                concedes_dict['one_concede_guest_rule'] = one_concede_guest_rule
+                concedes_dict['one_concede_guest'] = one_concede_guest
+
+# ----------------------------------------第二节让球分割线---------------------------------------------------------------------------
+
+            #第二节让球
+            # 第二节让球
+            try:
+                two_concedes = result['o']["ahs2"]["v"]
+                two_concede_home_rule,two_concede_home,two_concede_guest_rule,two_concede_guest = rangqiu_daxiao(inner=two_concedes)
+                concedes_dict_rule['two_concede_home'] = ''.join(two_concede_home_rule)
+                concedes_dict['two_concede_home'] = ''.join(two_concede_home)
+                concedes_dict_rule['two_concede_guest'] = ''.join(two_concede_guest_rule)
+                concedes_dict['two_concede_guest'] = ''.join(two_concede_guest)
+            except:
+                two_concede_guest = ""
+                two_concede_guest_rule = ""
+                two_concede_home = ""
+                two_concede_home_rule = ""
+                concedes_dict_rule['two_concede_home'] = two_concede_home_rule
+                concedes_dict['two_concede_home'] = two_concede_home
+                concedes_dict_rule['two_concede_guest'] = two_concede_guest_rule
+                concedes_dict['two_concede_guest'] = two_concede_guest
+
+
+
+
+
+
+
+# ---------------------------------------------------冠军  滚球是独赢----------------------------------------------------------------
+            kemps_dict = {}
+            try:
+                kemps = result['o']["ml"]["v"]
+                kemps_dict['kemp_home'] = kemps[1]
+                kemps_dict['kemp_guest'] = kemps[3]
+
+            except:
+                kemps_dict['kemp_home'] = ""
+                kemps_dict['kemp_guest'] = ""
+            # 第一盘 冠军  第一盘独赢 滚球是独赢
+            try:
+                kemps = result['o']["mls1"]["v"]
+                kemps_dict['one_kemp_home'] = kemps[1]
+                kemps_dict['one_kemp_guest'] = kemps[3]
+
+            except:
+                kemps_dict['one_kemp_home'] = ""
+                kemps_dict['one_kemp_guest'] = ""
+
+            try: # 第二盘 独赢
+                kemps = result['o']["mls2"]["v"]
+                kemps_dict['two_kemp_home'] = kemps[1]
+                kemps_dict['two_kemp_guest'] = kemps[3]
+            except:
+                kemps_dict['two_kemp_home'] = ""
+                kemps_dict["two_kemp_guest"] = ""
+
+
+# ---------------------------------------------------让局---------------------------------------------------------------
+
+            bureaus_dict = {}
+            bureaus_dict_rule = {}
+            try:
+                bureaus = result['o']["ahfts"]["v"]
+                bureaus_dict_rule['concede_home'] = bureaus[1]# 添加前缀
+                bureaus_dict['concede_home'] = bureaus[5]#
+                bureaus_dict_rule['concede_guest'] = bureaus[3]#
+                bureaus_dict['concede_guest'] = bureaus[7]##
+            except:
+                bureaus_dict_rule['concede_home'] = ""
+                bureaus_dict['concede_home'] = ""
+                bureaus_dict_rule['concede_guest'] = ""
+                bureaus_dict['concede_guest'] = ""
+
+# -----------------------------------------------------总局数 第一盘:大/小------------------------------------------------------
+            total_number_dict = {}
+            total_number_dict_rule = {}
+            try:  #总局数 滚球大小
+                total_numbers = result['o']["oufts"]["v"]
+                total_number_dict_rule['total_number_big'] = total_numbers[1] #添加前缀wp
+                total_number_dict['total_number_big'] = total_numbers[5]
+                total_number_dict_rule['total_number_small'] = total_numbers[3]
+                total_number_dict['total_number_small'] = total_numbers[7]
+            except:
+                total_number_dict_rule['total_number_big'] = ""
+                total_number_dict['total_number_big'] = ""
+                total_number_dict_rule['total_number_small'] = ""
+                total_number_dict['total_number_small'] = ""
+
+            # 第一节盘
+            try:
+                one_total_sizes = result['o']["ous1"]["v"]
+                one_total_sizes_big_rule,one_total_sizes_big,one_total_sizes_small_rule,one_total_sizes_small = rangqiu_daxiao(inner=one_total_sizes)
+                total_number_dict_rule["one_total_sizes_big"] = ''.join(one_total_sizes_big_rule)
+                total_number_dict["one_total_sizes_big"] = ''.join(one_total_sizes_big)
+                total_number_dict_rule["one_total_sizes_small"] = ''.join(one_total_sizes_small_rule)
+                total_number_dict["one_total_sizes_small"] = ''.join(one_total_sizes_small)
+            except:
+                one_total_sizes_big_rule = ""
+                one_total_sizes_big = ""
+                one_total_sizes_small_rule = ""
+                one_total_sizes_small = ""
+                total_number_dict_rule["one_total_sizes_big"] = ''.join(one_total_sizes_big_rule)
+                total_number_dict["one_total_sizes_big"] = ''.join(one_total_sizes_big)
+                total_number_dict_rule["one_total_sizes_small"] = ''.join(one_total_sizes_small_rule)
+                total_number_dict["one_total_sizes_small"] = ''.join(one_total_sizes_small)
+
+            # 第二节盘
+            try:
+                two_total_sizes = result['o']["ous2"]["v"]
+                two_total_sizes_big_rule,two_total_sizes_big,two_total_sizes_small_rule,two_total_sizes_small = rangqiu_daxiao(inner=two_total_sizes)
+                total_number_dict_rule["two_total_sizes_big"] = two_total_sizes_big_rule
+                total_number_dict["two_total_sizes_big"] = "".join(two_total_sizes_big)
+                total_number_dict_rule["two_total_sizes_small"] = "".join(two_total_sizes_small_rule)
+                total_number_dict["two_total_sizes_small"] = "".join(two_total_sizes_small)
+            except:
+                two_total_sizes_big_rule = ""
+                two_total_sizes_big = ""
+                two_total_sizes_small_rule = ""
+                two_total_sizes_small = ""
+                total_number_dict_rule["two_total_sizes_big"] = two_total_sizes_big_rule
+                total_number_dict["two_total_sizes_big"] = ''.join(two_total_sizes_big)
+                total_number_dict_rule["two_total_sizes_small"] = ''.join(two_total_sizes_small_rule)
+                total_number_dict["two_total_sizes_small"] = ''.join(two_total_sizes_small)
+
+
+            # 第三节盘
+            try:
+                three_total_sizes = result['o']["ous3"]["v"]
+                three_total_sizes_big_rule,three_total_sizes_big,three_total_sizes_small_rule,three_total_sizes_small = rangqiu_daxiao(inner=three_total_sizes)
+                total_number_dict_rule["three_total_sizes_big"] = ''.join(three_total_sizes_big_rule)
+                total_number_dict["three_total_sizes_big"] = three_total_sizes_big
+                total_number_dict_rule["three_total_sizes_small"] = ''.join(three_total_sizes_small_rule)
+                total_number_dict["three_total_sizes_small"] = ''.join(three_total_sizes_small)
+            except:
+                three_total_sizes_big_rule = ""
+                three_total_sizes_big = ""
+                three_total_sizes_small_rule = ""
+                three_total_sizes_small = ""
+                total_number_dict_rule["three_total_sizes_big"] = ''.join(three_total_sizes_big_rule)
+                total_number_dict["three_total_sizes_big"] = three_total_sizes_big
+                total_number_dict_rule["three_total_sizes_small"] = ''.join(three_total_sizes_small_rule)
+                total_number_dict["three_total_sizes_small"] = three_total_sizes_small
+
+
+
+# ------------------------------------------------------总局数:单/双-----------------------------------------------------
+            odd_evens_dict = {}
+            odd_evens_dict_rule = {}
+            try:
+                odd_evens = result['o']["oefts"]["v"]
+                # 上半场 主队让球条件
+                odd_evens_dict['two_sides_single'] = odd_evens[1] # 之前是odd_even_odd
+                odd_evens_dict_rule['two_sides_single'] = "单"
+                odd_evens_dict['two_sides_double'] = odd_evens[3]
+                odd_evens_dict_rule['two_sides_double'] = "双"
+
+            except:
+                odd_evens_dict['two_sides_single'] = ""
+                odd_evens_dict['two_sides_single'] = ""
+                odd_evens_dict_rule['two_sides_double'] = ""
+                odd_evens_dict_rule['two_sides_double'] = ""
+
+            # 联赛id
+            item['league_id'] = league_id
+            # 联赛名
+            item['league_name'] = league_name
+            # 比赛id
+            item['game_id'] = game_id
+            # 球队1
+            item['team_home'] = team_home
+            # 球队2
+            item['team_guest'] = team_guest
+            # 数量(97>)
+            item['number'] = number
+            # 比赛状态
+            item['zhuangtai'] = zhuangtai
+            # 日期
+            item['data_game'] = data_game
+            # 开赛时间
+            item['time_game'] = time_game
+            # 队1分数
+            item['score_home'] = score_home1
+            # 队2分数
+            item['score_guest'] = score_guest1
+            # 第几节
+            item['jijie'] = jijie
+            item['pt'] = pt
+            # 球队得分
+            item['qiudui'] = qiudui
+            # 让盘
+            item['concedes_dict'] = concedes_dict
+            item['concedes_dict_rule'] = concedes_dict_rule
+            # 冠军
+            item['kemps_dict'] = kemps_dict
+            # 让局
+            item['bureaus_dict'] = bureaus_dict
+            item['bureaus_dict_rule'] = bureaus_dict_rule
+            # 总局数大小
+            item['total_number_dict'] = total_number_dict
+            item['total_number_dict_rule'] = total_number_dict_rule
+            # 总局数单双
+            item['odd_evens_dict'] = odd_evens_dict
+            item['odd_evens_dict_rule'] = odd_evens_dict_rule
+            yield item
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

部分文件因文件數量過多而無法顯示