feng1632009 6 rokov pred
rodič
commit
5707ddbe27
62 zmenil súbory, kde vykonal 11164 pridanie a 0 odobranie
  1. 14 0
      scrapy_yzd/.idea/inspectionProfiles/Project_Default.xml
  2. 7 0
      scrapy_yzd/.idea/inspectionProfiles/profiles_settings.xml
  3. 72 0
      scrapy_yzd/.idea/markdown-navigator.xml
  4. 3 0
      scrapy_yzd/.idea/markdown-navigator/profiles_settings.xml
  5. 4 0
      scrapy_yzd/.idea/misc.xml
  6. 8 0
      scrapy_yzd/.idea/modules.xml
  7. 11 0
      scrapy_yzd/.idea/scrapy_yzd.iml
  8. 6 0
      scrapy_yzd/.idea/vcs.xml
  9. 1334 0
      scrapy_yzd/.idea/workspace.xml
  10. 9 0
      scrapy_yzd/README.md
  11. BIN
      scrapy_yzd/__pycache__/models.cpython-36.pyc
  12. 19 0
      scrapy_yzd/main.py
  13. 1779 0
      scrapy_yzd/model.py
  14. 186 0
      scrapy_yzd/models.py
  15. 11 0
      scrapy_yzd/scrapy.cfg
  16. 0 0
      scrapy_yzd/scrapy_yzd/__init__.py
  17. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/__init__.cpython-35.pyc
  18. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/__init__.cpython-36.pyc
  19. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/items.cpython-35.pyc
  20. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/items.cpython-36.pyc
  21. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/pipelines.cpython-36.pyc
  22. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/settings.cpython-35.pyc
  23. BIN
      scrapy_yzd/scrapy_yzd/__pycache__/settings.cpython-36.pyc
  24. 349 0
      scrapy_yzd/scrapy_yzd/autoproxy.py
  25. 337 0
      scrapy_yzd/scrapy_yzd/items.py
  26. 53 0
      scrapy_yzd/scrapy_yzd/middlewares.py
  27. 3104 0
      scrapy_yzd/scrapy_yzd/pipelines.py
  28. 118 0
      scrapy_yzd/scrapy_yzd/settings.py
  29. 4 0
      scrapy_yzd/scrapy_yzd/spiders/__init__.py
  30. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/__init__.cpython-35.pyc
  31. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/__init__.cpython-36.pyc
  32. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/csdn_self_spider.cpython-35.pyc
  33. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/csdn_self_spider.cpython-36.pyc
  34. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/douban_spider.cpython-35.pyc
  35. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/douban_spider.cpython-36.pyc
  36. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/doubanlist_spider.cpython-35.pyc
  37. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/doubanlist_spider.cpython-36.pyc
  38. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535.cpython-36.pyc
  39. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_bangqiu.cpython-36.pyc
  40. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_supplement.cpython-36.pyc
  41. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535basketball.cpython-36.pyc
  42. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535tennisball.cpython-36.pyc
  43. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/jd_spider.cpython-35.pyc
  44. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/jd_spider.cpython-36.pyc
  45. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/steam_spider.cpython-35.pyc
  46. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/steam_spider.cpython-36.pyc
  47. BIN
      scrapy_yzd/scrapy_yzd/spiders/__pycache__/test.cpython-36.pyc
  48. 14 0
      scrapy_yzd/scrapy_yzd/spiders/csdn_self_spider.py
  49. 25 0
      scrapy_yzd/scrapy_yzd/spiders/douban_spider.py
  50. 59 0
      scrapy_yzd/scrapy_yzd/spiders/doubanlist_spider.py
  51. 776 0
      scrapy_yzd/scrapy_yzd/spiders/hg3535.py
  52. 32 0
      scrapy_yzd/scrapy_yzd/spiders/hg3535_bangqiu.py
  53. 201 0
      scrapy_yzd/scrapy_yzd/spiders/hg3535_supplement.py
  54. 820 0
      scrapy_yzd/scrapy_yzd/spiders/hg3535basketball.py
  55. 368 0
      scrapy_yzd/scrapy_yzd/spiders/hg3535tennisball.py
  56. 66 0
      scrapy_yzd/scrapy_yzd/spiders/jd_spider.py
  57. 100 0
      scrapy_yzd/scrapy_yzd/spiders/steam_spider.py
  58. 8 0
      scrapy_yzd/scrapy_yzd/spiders/test.py
  59. 671 0
      scrapy_yzd/scrapy_yzd/test1.py
  60. 589 0
      scrapy_yzd/scrapy_yzd/test3.py
  61. 0 0
      scrapy_yzd/test.json
  62. 7 0
      scrapy_yzd/test4.py

+ 14 - 0
scrapy_yzd/.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,14 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <option name="myLocal" value="true" />
+    <inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
+      <option name="ignoredErrors">
+        <list>
+          <option value="E221" />
+          <option value="E222" />
+        </list>
+      </option>
+    </inspection_tool>
+  </profile>
+</component>

+ 7 - 0
scrapy_yzd/.idea/inspectionProfiles/profiles_settings.xml

@@ -0,0 +1,7 @@
+<component name="InspectionProjectProfileManager">
+  <settings>
+    <option name="PROJECT_PROFILE" value="Project Default" />
+    <option name="USE_PROJECT_PROFILE" value="true" />
+    <version value="1.0" />
+  </settings>
+</component>

+ 72 - 0
scrapy_yzd/.idea/markdown-navigator.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="MarkdownProjectSettings">
+    <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true" openRemoteLinks="true">
+      <PanelProvider>
+        <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
+      </PanelProvider>
+    </PreviewSettings>
+    <ParserSettings gitHubSyntaxChange="false">
+      <PegdownExtensions>
+        <option name="ABBREVIATIONS" value="false" />
+        <option name="ANCHORLINKS" value="true" />
+        <option name="ASIDE" value="false" />
+        <option name="ATXHEADERSPACE" value="true" />
+        <option name="AUTOLINKS" value="true" />
+        <option name="DEFINITIONS" value="false" />
+        <option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
+        <option name="FENCED_CODE_BLOCKS" value="true" />
+        <option name="FOOTNOTES" value="false" />
+        <option name="HARDWRAPS" value="false" />
+        <option name="HTML_DEEP_PARSER" value="false" />
+        <option name="INSERTED" value="false" />
+        <option name="QUOTES" value="false" />
+        <option name="RELAXEDHRULES" value="true" />
+        <option name="SMARTS" value="false" />
+        <option name="STRIKETHROUGH" value="true" />
+        <option name="SUBSCRIPT" value="false" />
+        <option name="SUPERSCRIPT" value="false" />
+        <option name="SUPPRESS_HTML_BLOCKS" value="false" />
+        <option name="SUPPRESS_INLINE_HTML" value="false" />
+        <option name="TABLES" value="true" />
+        <option name="TASKLISTITEMS" value="true" />
+        <option name="TOC" value="false" />
+        <option name="WIKILINKS" value="true" />
+      </PegdownExtensions>
+      <ParserOptions>
+        <option name="COMMONMARK_LISTS" value="true" />
+        <option name="DUMMY" value="false" />
+        <option name="EMOJI_SHORTCUTS" value="true" />
+        <option name="FLEXMARK_FRONT_MATTER" value="false" />
+        <option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
+        <option name="GFM_TABLE_RENDERING" value="true" />
+        <option name="GITBOOK_URL_ENCODING" value="false" />
+        <option name="GITHUB_EMOJI_URL" value="false" />
+        <option name="GITHUB_LISTS" value="false" />
+        <option name="GITHUB_WIKI_LINKS" value="true" />
+        <option name="JEKYLL_FRONT_MATTER" value="false" />
+        <option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
+      </ParserOptions>
+    </ParserSettings>
+    <HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true" embedImages="false" embedHttpImages="false">
+      <GeneratorProvider>
+        <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
+      </GeneratorProvider>
+      <headerTop />
+      <headerBottom />
+      <bodyTop />
+      <bodyBottom />
+    </HtmlSettings>
+    <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
+      <StylesheetProvider>
+        <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
+      </StylesheetProvider>
+      <ScriptProviders />
+      <cssText />
+    </CssSettings>
+    <HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" linkFormatType="HTTP_ABSOLUTE" />
+    <LinkMapSettings>
+      <textMaps />
+    </LinkMapSettings>
+  </component>
+</project>

+ 3 - 0
scrapy_yzd/.idea/markdown-navigator/profiles_settings.xml

@@ -0,0 +1,3 @@
+<component name="MarkdownNavigator.ProfileManager">
+  <settings default="" pdf-export="" />
+</component>

+ 4 - 0
scrapy_yzd/.idea/misc.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6.2 (~/anaconda3/envs/crawl_price/bin/python)" project-jdk-type="Python SDK" />
+</project>

+ 8 - 0
scrapy_yzd/.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/scrapy_yzd.iml" filepath="$PROJECT_DIR$/.idea/scrapy_yzd.iml" />
+    </modules>
+  </component>
+</project>

+ 11 - 0
scrapy_yzd/.idea/scrapy_yzd.iml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="jdk" jdkName="Python 3.6.2 (~/anaconda3/envs/crawl_price/bin/python)" jdkType="Python SDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+  <component name="TestRunnerService">
+    <option name="PROJECT_TEST_RUNNER" value="Unittests" />
+  </component>
+</module>

+ 6 - 0
scrapy_yzd/.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 1334 - 0
scrapy_yzd/.idea/workspace.xml

@@ -0,0 +1,1334 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ChangeListManager">
+    <list default="true" id="10c8f782-159c-419a-b657-aa18f8ed099d" name="Default" comment="">
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/misc.xml" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/scrapy_yzd.iml" afterPath="$PROJECT_DIR$/.idea/scrapy_yzd.iml" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/scrapy_yzd/items.py" afterPath="$PROJECT_DIR$/scrapy_yzd/items.py" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/scrapy_yzd/middlewares.py" afterPath="$PROJECT_DIR$/scrapy_yzd/middlewares.py" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/scrapy_yzd/pipelines.py" afterPath="$PROJECT_DIR$/scrapy_yzd/pipelines.py" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/scrapy_yzd/settings.py" afterPath="$PROJECT_DIR$/scrapy_yzd/settings.py" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/scrapy_yzd/spiders/doubanlist_spider.py" afterPath="$PROJECT_DIR$/scrapy_yzd/spiders/doubanlist_spider.py" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/scrapy_yzd/spiders/jd_spider.py" afterPath="$PROJECT_DIR$/scrapy_yzd/spiders/jd_spider.py" />
+    </list>
+    <ignored path="scrapy_yzd.iws" />
+    <ignored path=".idea/workspace.xml" />
+    <ignored path=".idea/dataSources.local.xml" />
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
+    <option name="TRACKING_ENABLED" value="true" />
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="CoverageDataManager">
+    <SUITE FILE_PATH="coverage/scrapy_yzd$test.coverage" NAME="test Coverage Results" MODIFIED="1553852725802" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/scrapy_yzd/spiders" />
+    <SUITE FILE_PATH="coverage/scrapy_yzd$test4.coverage" NAME="test4 Coverage Results" MODIFIED="1555379830979" 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/scrapy_yzd$hg3535.coverage" NAME="hg3535 Coverage Results" MODIFIED="1553739427011" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/scrapy_yzd/spiders" />
+    <SUITE FILE_PATH="coverage/scrapy_yzd$main.coverage" NAME="main Coverage Results" MODIFIED="1555402422277" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
+  </component>
+  <component name="CreatePatchCommitExecutor">
+    <option name="PATCH_PATH" value="" />
+  </component>
+  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
+  <component name="FavoritesManager">
+    <favorites_list name="scrapy_yzd" />
+  </component>
+  <component name="FileEditorManager">
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
+      <file leaf-file-name="pipelines.py" pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/scrapy_yzd/pipelines.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="165">
+              <caret line="3097" column="139" selection-start-line="3097" selection-start-column="139" selection-end-line="3097" selection-end-column="139" />
+              <folding>
+                <element signature="e#275#312#0" expanded="true" />
+                <element signature="e#941#2146#0" expanded="false" />
+                <element signature="e#2202#2349#0" expanded="false" />
+                <element signature="e#2753#2814#0" expanded="false" />
+                <element signature="e#3085#25036#0" expanded="false" />
+                <element signature="e#25130#46010#0" expanded="false" />
+                <element signature="e#46092#75627#0" expanded="false" />
+                <element signature="e#74195#74223#0" expanded="false" />
+                <element signature="e#75712#96561#0" expanded="false" />
+                <element signature="e#96643#117472#0" expanded="false" />
+                <element signature="e#117542#138299#0" expanded="false" />
+                <element signature="e#138399#159186#0" expanded="false" />
+                <element signature="e#160964#161396#0" expanded="false" />
+                <element signature="e#161665#161699#0" expanded="false" />
+                <element signature="e#160774#165444#0" expanded="false" />
+                <element signature="e#165784#166216#0" expanded="false" />
+                <element signature="e#166268#166424#0" expanded="false" />
+                <element signature="e#166485#166519#0" expanded="false" />
+                <element signature="e#166568#177067#0" expanded="false" />
+                <element signature="e#177475#177907#0" expanded="false" />
+                <element signature="e#177959#178115#0" expanded="false" />
+                <element signature="e#178176#178210#0" expanded="false" />
+                <element signature="e#178259#186358#0" expanded="false" />
+                <element signature="e#197420#198791#0" expanded="false" />
+                <marker date="1555402422269" expanded="true" signature="56763:56993" ph="insert into st_zq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="57384:57560" ph="insert into st_zq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="58058:58288" ph="insert into st_zq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="58684:58860" ph="insert into st_zq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="163062:163306" ph="insert into st_zq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="163062:163319" ph="insert into st_zq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="163639:163826" ph="insert into st_zq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="164394:164638" ph="insert into st_zq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="164394:164651" ph="insert into st_zq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="164971:165158" ph="insert into st_zq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="168566:168802" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="168566:168816" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="169093:169273" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="169786:170020" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="169786:170034" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="170311:170491" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="171010:171244" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="171010:171258" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="171540:171719" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="172232:172466" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="172232:172479" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="172741:172920" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="173419:173653" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="173419:173666" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="173929:174108" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="174543:174764" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="174543:174778" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="175021:175185" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="175673:175904" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="175673:175917" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="176201:176380" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="176594:176843" ph="insert into st_lq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="176594:176860" ph="insert into st_lq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="180214:180449" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="180214:180462" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="180772:180952" ph="insert into st_wq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="181434:181656" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="181434:181669" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="181933:182098" ph="insert into st_wq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="182535:182770" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="182535:182784" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="183094:183274" ph="insert into st_wq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="183767:184002" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="183767:184015" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="184335:184515" ph="insert into st_wq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="185014:185249" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="185014:185262" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="185574:185754" ph="insert into st_wq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="185984:186203" ph="insert into st_wq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="189264:189495" ph="insert into st_wq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="189794:189970" ph="insert into st_wq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="190468:190699" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="190967:191143" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="191607:191838" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="192110:192286" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="192747:192978" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="193233:193409" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="193861:194092" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="194348:194524" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="194910:195127" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="195363:195524" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="195960:196191" ph="insert into st_lq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="196463:196639" ph="insert into st_lq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="196849:197068" ph="insert into st_lq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="197692:197970" ph="insert into st_bq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="198374:198555" ph="insert into st_bq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="202953:203218" ph="insert into st_bq_odds... " />
+                <marker date="1555402422269" expanded="true" signature="203541:203706" ph="insert into st_bq_odds_record... " />
+                <marker date="1555402422269" expanded="true" signature="203919:204093" ph="insert into st_bq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="203919:204148" ph="insert into st_bq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="203919:204149" ph="insert into st_bq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="203919:204157" ph="insert into st_bq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="204335:204615" ph="insert into st_bq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="204793:205143" ph="insert into st_bq_competition... " />
+                <marker date="1555402422269" expanded="true" signature="205363:205713" ph="insert into st_bq_competition... " />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="main.py" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/main.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="126">
+              <caret line="9" column="0" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="hg3535.py" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="396">
+              <caret line="373" column="0" selection-start-line="373" selection-start-column="0" selection-end-line="373" selection-end-column="0" />
+              <folding>
+                <element signature="e#42#57#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="context.py" pinned="false" current-in-tab="false">
+        <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/python/context.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="134">
+              <caret line="121" column="0" selection-start-line="121" selection-start-column="0" selection-end-line="121" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="threadpool.py" pinned="false" current-in-tab="false">
+        <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/python/threadpool.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="302">
+              <caret line="257" column="0" selection-start-line="257" selection-start-column="0" selection-end-line="257" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="model.py" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/model.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="23">
+              <caret line="1461" column="0" selection-start-line="1461" selection-start-column="0" selection-end-line="1483" selection-end-column="40" />
+              <folding>
+                <element signature="e#0#20#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="hg3535tennisball.py" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535tennisball.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="160">
+              <caret line="247" column="65" selection-start-line="247" selection-start-column="65" selection-end-line="247" selection-end-column="65" />
+              <folding>
+                <element signature="e#24#35#0" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="hg3535basketball.py" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535basketball.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="21">
+              <caret line="38" column="23" selection-start-line="38" selection-start-column="0" selection-end-line="39" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="items.py" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/scrapy_yzd/items.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="230">
+              <caret line="280" column="20" selection-start-line="280" selection-start-column="20" selection-end-line="280" selection-end-column="20" />
+              <folding>
+                <marker date="1555379084582" expanded="true" signature="698:886" ph="INSERT INTO st_zq_odds... " />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
+      <file leaf-file-name="hg3535_bangqiu.py" pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bangqiu.py">
+          <provider selected="true" editor-type-id="text-editor">
+            <state relative-caret-position="4206">
+              <caret line="206" column="0" selection-start-line="206" selection-start-column="0" selection-end-line="206" selection-end-column="0" />
+              <folding />
+            </state>
+          </provider>
+        </entry>
+      </file>
+    </leaf>
+  </component>
+  <component name="FileTemplateManagerImpl">
+    <option name="RECENT_TEMPLATES">
+      <list>
+        <option value="Python Script" />
+      </list>
+    </option>
+  </component>
+  <component name="Git.Settings">
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+  </component>
+  <component name="IdeDocumentHistory">
+    <option name="CHANGED_PATHS">
+      <list>
+        <option value="$PROJECT_DIR$/scrapy_yzd/middlewares.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/autoproxy.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/csdn_self_spider.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/doubanlist_spider.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/jd_spider.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/test1.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/test3.py" />
+        <option value="$PROJECT_DIR$/models1.py" />
+        <option value="$PROJECT_DIR$/models2.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/test.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_supplement.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535basketball.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535.py" />
+        <option value="$PROJECT_DIR$/model.py" />
+        <option value="$PROJECT_DIR$/models.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535tennisball.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/items.py" />
+        <option value="$PROJECT_DIR$/test4.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/settings.py" />
+        <option value="$PROJECT_DIR$/main.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bangqiu.py" />
+        <option value="$PROJECT_DIR$/scrapy_yzd/pipelines.py" />
+      </list>
+    </option>
+  </component>
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
+  <component name="JsGulpfileManager">
+    <detection-done>true</detection-done>
+    <sorting>DEFINITION_ORDER</sorting>
+  </component>
+  <component name="ProjectFrameBounds">
+    <option name="x" value="8" />
+    <option name="y" value="23" />
+    <option name="width" value="1280" />
+    <option name="height" value="777" />
+  </component>
+  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+    <OptionsSetting value="true" id="Add" />
+    <OptionsSetting value="true" id="Remove" />
+    <OptionsSetting value="true" id="Checkout" />
+    <OptionsSetting value="true" id="Update" />
+    <OptionsSetting value="true" id="Status" />
+    <OptionsSetting value="true" id="Edit" />
+    <ConfirmationsSetting value="0" id="Add" />
+    <ConfirmationsSetting value="0" id="Remove" />
+  </component>
+  <component name="ProjectView">
+    <navigator currentView="ProjectPane" proportions="" version="1">
+      <flattenPackages />
+      <showMembers />
+      <showModules />
+      <showLibraryContents />
+      <hideEmptyPackages />
+      <abbreviatePackageNames />
+      <autoscrollToSource />
+      <autoscrollFromSource />
+      <sortByType />
+      <manualOrder />
+      <foldersAlwaysOnTop value="true" />
+    </navigator>
+    <panes>
+      <pane id="ProjectPane">
+        <subPane>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="scrapy_yzd" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+          </PATH>
+        </subPane>
+      </pane>
+      <pane id="Scope" />
+      <pane id="Scratches" />
+    </panes>
+  </component>
+  <component name="PropertiesComponent">
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/../new_hg3535s-2" />
+    <property name="WebServerToolWindowFactoryState" value="false" />
+    <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
+    <property name="settings.editor.splitter.proportion" value="0.2" />
+    <property name="js-jscs-nodeInterpreter" value="$USER_HOME$/.nvm/versions/node/v6.4.0/bin/node" />
+    <property name="SearchEverywhereHistoryKey" value="&#9;FILE&#9;file:///Users/mac/Downloads/scrapy_yzd/main.py" />
+  </component>
+  <component name="RecentsManager">
+    <key name="CopyFile.RECENT_KEYS">
+      <recent name="$PROJECT_DIR$/scrapy_yzd/spiders" />
+    </key>
+  </component>
+  <component name="RunManager" selected="Python.main">
+    <configuration default="false" name="main" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <method />
+    </configuration>
+    <configuration default="false" name="test" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/scrapy_yzd/spiders" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/scrapy_yzd/spiders/test.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <method />
+    </configuration>
+    <configuration default="false" name="hg3535" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/scrapy_yzd/spiders" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/scrapy_yzd/spiders/hg3535.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <method />
+    </configuration>
+    <configuration default="false" name="test4" type="PythonConfigurationType" factoryName="Python" temporary="true">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+      <option name="IS_MODULE_SDK" value="true" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="$PROJECT_DIR$/test4.py" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="DjangoTestsConfigurationType" factoryName="Django tests">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="TARGET" value="" />
+      <option name="SETTINGS_FILE" value="" />
+      <option name="CUSTOM_SETTINGS" value="false" />
+      <option name="USE_OPTIONS" value="false" />
+      <option name="OPTIONS" value="" />
+      <method />
+    </configuration>
+    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
+      <method />
+    </configuration>
+    <configuration default="true" type="PyBehaveRunConfigurationType" factoryName="Behave">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="ADDITIONAL_ARGS" value="" />
+      <method />
+    </configuration>
+    <configuration default="true" type="PyLettuceRunConfigurationType" factoryName="Lettuce">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="ADDITIONAL_ARGS" value="" />
+      <method />
+    </configuration>
+    <configuration default="true" type="PythonConfigurationType" factoryName="Python">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs>
+        <env name="PYTHONUNBUFFERED" value="1" />
+      </envs>
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="PARAMETERS" value="" />
+      <option name="SHOW_COMMAND_LINE" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="Tox" factoryName="Tox">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <module name="scrapy_yzd" />
+      <method />
+    </configuration>
+    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
+      <node-interpreter>project</node-interpreter>
+      <node-options />
+      <gulpfile />
+      <tasks />
+      <arguments />
+      <envs />
+      <method />
+    </configuration>
+    <configuration default="true" type="js.build_tools.npm" factoryName="npm">
+      <command value="run-script" />
+      <scripts />
+      <node-interpreter value="project" />
+      <envs />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="Attests">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="Doctests">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="Nosetests">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <option name="PARAMS" value="" />
+      <option name="USE_PARAM" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="Unittests">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <option name="PUREUNITTEST" value="true" />
+      <option name="PARAMS" value="" />
+      <option name="USE_PARAM" value="false" />
+      <method />
+    </configuration>
+    <configuration default="true" type="tests" factoryName="py.test">
+      <option name="INTERPRETER_OPTIONS" value="" />
+      <option name="PARENT_ENVS" value="true" />
+      <envs />
+      <option name="SDK_HOME" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="IS_MODULE_SDK" value="false" />
+      <option name="ADD_CONTENT_ROOTS" value="true" />
+      <option name="ADD_SOURCE_ROOTS" value="true" />
+      <module name="scrapy_yzd" />
+      <EXTENSION ID="PythonCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" runner="coverage.py" />
+      <option name="SCRIPT_NAME" value="" />
+      <option name="CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="FOLDER_NAME" value="" />
+      <option name="TEST_TYPE" value="TEST_SCRIPT" />
+      <option name="PATTERN" value="" />
+      <option name="USE_PATTERN" value="false" />
+      <option name="testToRun" value="" />
+      <option name="keywords" value="" />
+      <option name="params" value="" />
+      <option name="USE_PARAM" value="false" />
+      <option name="USE_KEYWORD" value="false" />
+      <method />
+    </configuration>
+    <list size="4">
+      <item index="0" class="java.lang.String" itemvalue="Python.main" />
+      <item index="1" class="java.lang.String" itemvalue="Python.test" />
+      <item index="2" class="java.lang.String" itemvalue="Python.hg3535" />
+      <item index="3" class="java.lang.String" itemvalue="Python.test4" />
+    </list>
+    <recent_temporary>
+      <list size="4">
+        <item index="0" class="java.lang.String" itemvalue="Python.main" />
+        <item index="1" class="java.lang.String" itemvalue="Python.test4" />
+        <item index="2" class="java.lang.String" itemvalue="Python.test" />
+        <item index="3" class="java.lang.String" itemvalue="Python.hg3535" />
+      </list>
+    </recent_temporary>
+  </component>
+  <component name="ShelveChangesManager" show_recycled="false">
+    <option name="remove_strategy" value="false" />
+  </component>
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="10c8f782-159c-419a-b657-aa18f8ed099d" name="Default" comment="" />
+      <created>1553129611552</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1553129611552</updated>
+    </task>
+    <servers />
+  </component>
+  <component name="ToolWindowManager">
+    <frame x="8" y="23" width="1280" height="777" extended-state="0" />
+    <editor active="false" />
+    <layout>
+      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.22374798" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
+      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.31970802" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24959612" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Mongo Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
+      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.37226278" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+    </layout>
+    <layout-to-restore>
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
+      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.31970802" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Mongo Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25767368" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24959612" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.41021898" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+    </layout-to-restore>
+  </component>
+  <component name="Vcs.Log.UiProperties">
+    <option name="RECENTLY_FILTERED_USER_GROUPS">
+      <collection />
+    </option>
+    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
+      <collection />
+    </option>
+  </component>
+  <component name="VcsContentAnnotationSettings">
+    <option name="myLimit" value="2678400000" />
+  </component>
+  <component name="XDebuggerManager">
+    <breakpoint-manager>
+      <breakpoints>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/test1.py</url>
+          <line>57</line>
+          <option name="timeStamp" value="100" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535.py</url>
+          <line>626</line>
+          <option name="timeStamp" value="170" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535.py</url>
+          <line>627</line>
+          <option name="timeStamp" value="171" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535.py</url>
+          <line>629</line>
+          <option name="timeStamp" value="172" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535.py</url>
+          <line>631</line>
+          <option name="timeStamp" value="173" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
+          <line>2497</line>
+          <option name="timeStamp" value="197" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
+          <line>2520</line>
+          <option name="timeStamp" value="198" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535tennisball.py</url>
+          <option name="timeStamp" value="202" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
+          <line>803</line>
+          <option name="timeStamp" value="243" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
+          <line>799</line>
+          <option name="timeStamp" value="244" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
+          <line>3057</line>
+          <option name="timeStamp" value="254" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
+          <line>3056</line>
+          <option name="timeStamp" value="255" />
+        </line-breakpoint>
+        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
+          <url>file://$PROJECT_DIR$/scrapy_yzd/pipelines.py</url>
+          <line>3017</line>
+          <option name="timeStamp" value="256" />
+        </line-breakpoint>
+      </breakpoints>
+      <breakpoints-dialog>
+        <breakpoints-dialog />
+      </breakpoints-dialog>
+      <option name="time" value="262" />
+    </breakpoint-manager>
+    <watches-manager>
+      <configuration name="PythonConfigurationType">
+        <watch expression="item.half_full.__len__()" />
+      </configuration>
+    </watches-manager>
+  </component>
+  <component name="editorHistoryManager">
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/cmdline.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="127">
+          <caret line="149" column="0" selection-start-line="149" selection-start-column="0" selection-end-line="149" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/psycopg2/sql.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="340">
+          <caret line="95" column="1" selection-start-line="95" selection-start-column="1" selection-end-line="95" selection-end-column="1" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/psycopg2/pool.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="340">
+          <caret line="127" column="0" selection-start-line="127" selection-start-column="0" selection-end-line="127" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/psycopg2/extensions.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/psycopg2/_range.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/psycopg2/errorcodes.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/psycopg2/psycopg1.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="966">
+          <caret line="51" column="40" selection-start-line="51" selection-start-column="40" selection-end-line="51" selection-end-column="40" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/psycopg2/extras.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="2016">
+          <caret line="128" column="0" selection-start-line="128" selection-start-column="0" selection-end-line="128" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/psycopg2/__init__.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="146">
+          <caret line="128" column="0" selection-start-line="128" selection-start-column="0" selection-end-line="128" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/http/request/__init__.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="345">
+          <caret line="24" column="25" selection-start-line="24" selection-start-column="25" selection-end-line="24" selection-end-column="25" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/spidermiddlewares/depth.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="510">
+          <caret line="57" column="0" selection-start-line="57" selection-start-column="0" selection-end-line="57" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/spiderloader.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="237">
+          <caret line="70" column="0" selection-start-line="70" selection-start-column="0" selection-end-line="70" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy.cfg">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/csdn_self_spider.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="84">
+          <caret line="5" column="16" selection-start-line="5" selection-start-column="12" selection-end-line="5" selection-end-column="16" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/xpinyin/__init__.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/README.md">
+      <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
+        <state split_layout="SPLIT">
+          <first_editor relative-caret-position="105">
+            <caret line="5" column="11" selection-start-line="5" selection-start-column="11" selection-end-line="5" selection-end-column="11" />
+          </first_editor>
+          <second_editor />
+        </state>
+      </provider>
+      <provider editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
+        <state split_layout="SPLIT">
+          <first_editor relative-caret-position="0">
+            <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          </first_editor>
+          <second_editor>
+            <js_state />
+          </second_editor>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/douban_spider.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="252">
+          <caret line="13" column="16" selection-start-line="13" selection-start-column="16" selection-end-line="13" selection-end-column="16" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/__init__.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/autoproxy.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="340">
+          <caret line="235" column="10" selection-start-line="235" selection-start-column="10" selection-end-line="235" selection-end-column="10" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/test.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="340">
+          <caret line="79" column="0" selection-start-line="79" selection-start-column="0" selection-end-line="79" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/steam_spider.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="363">
+          <caret line="92" column="20" selection-start-line="92" selection-start-column="20" selection-end-line="92" selection-end-column="20" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/jd_spider.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="271">
+          <caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/internet/defer.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="125">
+          <caret line="653" column="0" selection-start-line="653" selection-start-column="0" selection-end-line="653" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/peewee.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="146">
+          <caret line="5815" column="0" selection-start-line="5815" selection-start-column="0" selection-end-line="5815" selection-end-column="0" />
+          <folding>
+            <marker date="1554195815375" expanded="true" signature="103325:103424" ph="SELECT name sqlite_master" />
+            <marker date="1554195815375" expanded="true" signature="103554:103639" ph="SELECT name,... " />
+            <marker date="1554195815375" expanded="true" signature="103843:103949" ph="SELECT name,... " />
+            <marker date="1554195815375" expanded="true" signature="109515:109618" ph="SELECT table... pg_tables" />
+            <marker date="1554195815375" expanded="true" signature="109797:109909" ph="SELECT viewn... pg_views" />
+            <marker date="1554195815375" expanded="true" signature="110136:110915" ph="SELECT i.rel... pg_class" />
+            <marker date="1554195815375" expanded="true" signature="111201:111397" ph="SELECT colum... columns" />
+            <marker date="1554195815375" expanded="true" signature="111753:112203" ph="SELECT kc.co... table_constraints" />
+            <marker date="1554195815375" expanded="true" signature="112446:113115" ph="SELECT kcu.c... table_constraints" />
+            <marker date="1554195815375" expanded="true" signature="113388:113553" ph="SELECT COUNT... pg_class" />
+            <marker date="1554195815375" expanded="true" signature="117200:117361" ph="SELECT table... tables" />
+            <marker date="1554195815375" expanded="true" signature="117493:117649" ph="SELECT table... views" />
+            <marker date="1554195815375" expanded="true" signature="118297:118463" ph="SELECT colum... columns" />
+            <marker date="1554195815375" expanded="true" signature="119019:119326" ph="SELECT colum... key_column_usage" />
+            <marker date="1554195815375" expanded="true" signature="168179:168199" ph="DROP TABLE I... " />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/test1.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="334">
+          <caret line="72" column="24" selection-start-line="72" selection-start-column="24" selection-end-line="72" selection-end-column="24" />
+          <folding>
+            <element signature="e#10706#13826#0" expanded="false" />
+            <element signature="e#13917#16941#0" expanded="false" />
+            <element signature="e#17031#20679#0" expanded="false" />
+            <element signature="e#20773#23507#0" expanded="false" />
+            <element signature="e#23596#29168#0" expanded="false" />
+            <element signature="e#29264#32532#0" expanded="false" />
+            <element signature="e#32622#34050#0" expanded="false" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/test.json">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="0">
+          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/test3.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="334">
+          <caret line="578" column="9" selection-start-line="578" selection-start-column="9" selection-end-line="578" selection-end-column="9" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/test4.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="188">
+          <caret line="364" column="4" selection-start-line="364" selection-start-column="4" selection-end-line="364" selection-end-column="4" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/doubanlist_spider.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="105">
+          <caret line="6" column="10" selection-start-line="6" selection-start-column="10" selection-end-line="6" selection-end-column="10" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/internet/base.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="125">
+          <caret line="1275" column="0" selection-start-line="1275" selection-start-column="0" selection-end-line="1275" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/spidermiddlewares/offsite.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="128">
+          <caret line="29" column="0" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/middlewares.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="231">
+          <caret line="14" column="42" selection-start-line="14" selection-start-column="42" selection-end-line="14" selection-end-column="42" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/_threads/_team.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="127">
+          <caret line="189" column="0" selection-start-line="189" selection-start-column="0" selection-end-line="189" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/_threads/_threadworker.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="127">
+          <caret line="45" column="0" selection-start-line="45" selection-start-column="0" selection-end-line="45" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/threading.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="127">
+          <caret line="863" column="0" selection-start-line="863" selection-start-column="0" selection-end-line="863" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_supplement.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="147">
+          <caret line="12" column="24" selection-start-line="12" selection-start-column="24" selection-end-line="12" selection-end-column="35" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/scrapy/spidermiddlewares/urllength.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="510">
+          <caret line="36" column="0" selection-start-line="36" selection-start-column="0" selection-end-line="36" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/models.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="294">
+          <caret line="18" column="15" selection-start-line="18" selection-start-column="15" selection-end-line="18" selection-end-column="15" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/internet/task.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="125">
+          <caret line="516" column="0" selection-start-line="516" selection-start-column="0" selection-end-line="516" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/settings.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="333">
+          <caret line="84" column="1" selection-start-line="84" selection-start-column="1" selection-end-line="84" selection-end-column="1" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/enterprise/adbapi.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="230">
+          <caret line="467" column="0" selection-start-line="467" selection-start-column="0" selection-end-line="467" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/python/context.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="134">
+          <caret line="121" column="0" selection-start-line="121" selection-start-column="0" selection-end-line="121" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$USER_HOME$/anaconda3/envs/crawl_price/lib/python3.6/site-packages/twisted/python/threadpool.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="302">
+          <caret line="257" column="0" selection-start-line="257" selection-start-column="0" selection-end-line="257" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/model.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="23">
+          <caret line="1461" column="0" selection-start-line="1461" selection-start-column="0" selection-end-line="1483" selection-end-column="40" />
+          <folding>
+            <element signature="e#0#20#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535tennisball.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="160">
+          <caret line="247" column="65" selection-start-line="247" selection-start-column="65" selection-end-line="247" selection-end-column="65" />
+          <folding>
+            <element signature="e#24#35#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/main.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="126">
+          <caret line="9" column="0" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="396">
+          <caret line="373" column="0" selection-start-line="373" selection-start-column="0" selection-end-line="373" selection-end-column="0" />
+          <folding>
+            <element signature="e#42#57#0" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535_bangqiu.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="4206">
+          <caret line="206" column="0" selection-start-line="206" selection-start-column="0" selection-end-line="206" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/spiders/hg3535basketball.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="21">
+          <caret line="38" column="23" selection-start-line="38" selection-start-column="0" selection-end-line="39" selection-end-column="0" />
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/items.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="230">
+          <caret line="280" column="20" selection-start-line="280" selection-start-column="20" selection-end-line="280" selection-end-column="20" />
+          <folding>
+            <marker date="1555379084582" expanded="true" signature="698:886" ph="INSERT INTO st_zq_odds... " />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/scrapy_yzd/pipelines.py">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="165">
+          <caret line="3097" column="139" selection-start-line="3097" selection-start-column="139" selection-end-line="3097" selection-end-column="139" />
+          <folding>
+            <element signature="e#275#312#0" expanded="true" />
+            <element signature="e#941#2146#0" expanded="false" />
+            <element signature="e#2202#2349#0" expanded="false" />
+            <element signature="e#2753#2814#0" expanded="false" />
+            <element signature="e#3085#25036#0" expanded="false" />
+            <element signature="e#25130#46010#0" expanded="false" />
+            <element signature="e#46092#75627#0" expanded="false" />
+            <element signature="e#74195#74223#0" expanded="false" />
+            <element signature="e#75712#96561#0" expanded="false" />
+            <element signature="e#96643#117472#0" expanded="false" />
+            <element signature="e#117542#138299#0" expanded="false" />
+            <element signature="e#138399#159186#0" expanded="false" />
+            <element signature="e#160964#161396#0" expanded="false" />
+            <element signature="e#161665#161699#0" expanded="false" />
+            <element signature="e#160774#165444#0" expanded="false" />
+            <element signature="e#165784#166216#0" expanded="false" />
+            <element signature="e#166268#166424#0" expanded="false" />
+            <element signature="e#166485#166519#0" expanded="false" />
+            <element signature="e#166568#177067#0" expanded="false" />
+            <element signature="e#177475#177907#0" expanded="false" />
+            <element signature="e#177959#178115#0" expanded="false" />
+            <element signature="e#178176#178210#0" expanded="false" />
+            <element signature="e#178259#186358#0" expanded="false" />
+            <element signature="e#197420#198791#0" expanded="false" />
+            <marker date="1555402422269" expanded="true" signature="56763:56993" ph="insert into st_zq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="57384:57560" ph="insert into st_zq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="58058:58288" ph="insert into st_zq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="58684:58860" ph="insert into st_zq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="163062:163306" ph="insert into st_zq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="163062:163319" ph="insert into st_zq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="163639:163826" ph="insert into st_zq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="164394:164638" ph="insert into st_zq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="164394:164651" ph="insert into st_zq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="164971:165158" ph="insert into st_zq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="168566:168802" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="168566:168816" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="169093:169273" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="169786:170020" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="169786:170034" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="170311:170491" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="171010:171244" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="171010:171258" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="171540:171719" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="172232:172466" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="172232:172479" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="172741:172920" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="173419:173653" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="173419:173666" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="173929:174108" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="174543:174764" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="174543:174778" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="175021:175185" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="175673:175904" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="175673:175917" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="176201:176380" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="176594:176843" ph="insert into st_lq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="176594:176860" ph="insert into st_lq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="180214:180449" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="180214:180462" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="180772:180952" ph="insert into st_wq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="181434:181656" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="181434:181669" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="181933:182098" ph="insert into st_wq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="182535:182770" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="182535:182784" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="183094:183274" ph="insert into st_wq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="183767:184002" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="183767:184015" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="184335:184515" ph="insert into st_wq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="185014:185249" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="185014:185262" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="185574:185754" ph="insert into st_wq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="185984:186203" ph="insert into st_wq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="189264:189495" ph="insert into st_wq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="189794:189970" ph="insert into st_wq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="190468:190699" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="190967:191143" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="191607:191838" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="192110:192286" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="192747:192978" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="193233:193409" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="193861:194092" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="194348:194524" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="194910:195127" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="195363:195524" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="195960:196191" ph="insert into st_lq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="196463:196639" ph="insert into st_lq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="196849:197068" ph="insert into st_lq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="197692:197970" ph="insert into st_bq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="198374:198555" ph="insert into st_bq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="202953:203218" ph="insert into st_bq_odds... " />
+            <marker date="1555402422269" expanded="true" signature="203541:203706" ph="insert into st_bq_odds_record... " />
+            <marker date="1555402422269" expanded="true" signature="203919:204093" ph="insert into st_bq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="203919:204148" ph="insert into st_bq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="203919:204149" ph="insert into st_bq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="203919:204157" ph="insert into st_bq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="204335:204615" ph="insert into st_bq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="204793:205143" ph="insert into st_bq_competition... " />
+            <marker date="1555402422269" expanded="true" signature="205363:205713" ph="insert into st_bq_competition... " />
+          </folding>
+        </state>
+      </provider>
+    </entry>
+  </component>
+</project>

+ 9 - 0
scrapy_yzd/README.md

@@ -0,0 +1,9 @@
+# scrapy_yzd
+该项目为scrapy框架,整合了自动切换agent,自动切换代理ip的中间件,可以下载后自行编写爬虫。
+支持:
+ - 豆瓣电影
+ - 京东商品信息(名称价格等)
+## agent中间件
+自动切换agent
+## 代理中间件
+采用网友的中间件,自动从3个免费代理网站爬取代理并测试

BIN
scrapy_yzd/__pycache__/models.cpython-36.pyc


+ 19 - 0
scrapy_yzd/main.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+__author__ = 'admin'
+__date__ = '2018/3/7 上午10:06'
+
+from scrapy.cmdline import execute
+
+import sys
+import os
+
+
+# print(os.path.dirname(os.path.abspath(__file__)))
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))
+# execute(["scrapy", "crawl", "hg3535"])
+# execute(["scrapy", "crawl", "hg3535_supplement"])
+# execute(["scrapy", "crawl", "lanqiu"])
+# execute(["scrapy", "crawl", "tennis"])
+execute(["scrapy", "crawl", "bangqiu"])
+# execute(["scrapy", "crawl", "zhihu_sel"])
+# execute(["scrapy", "crawl", "lagou"])

+ 1779 - 0
scrapy_yzd/model.py

@@ -0,0 +1,1779 @@
+from peewee import *
+from playhouse.postgres_ext import *
+
+database = PostgresqlDatabase('kaiyou', **{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
+
+class UnknownField(object):
+    def __init__(self, *_, **__): pass
+
+class BaseModel(Model):
+    class Meta:
+        database = database
+
+class Account(BaseModel):
+    account = CharField()
+    fanshui = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('account_id_seq'::regclass)")], index=True)
+    identity = TextField(index=True)
+    remark = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+    user_type = IntegerField(constraints=[SQL("DEFAULT 1")])
+
+    class Meta:
+        table_name = 'account'
+        indexes = (
+            (('id', 'identity'), True),
+        )
+        primary_key = CompositeKey('id', 'identity')
+
+class AccountBank(BaseModel):
+    account_identity = TextField()
+    account_name = CharField()
+    account_phone = CharField(null=True)
+    band_time = DateTimeField(constraints=[SQL("DEFAULT now()")])
+    bank_address = CharField()
+    bank_code = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    bank_name = CharField()
+    bank_number = CharField()
+    card_no = CharField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('account_bank_id_seq'::regclass)")])
+    identity = TextField(primary_key=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+
+    class Meta:
+        table_name = 'account_bank'
+        indexes = (
+            (('id', 'identity', 'account_identity'), False),
+        )
+
+class AccountDetailed(BaseModel):
+    account_identity = TextField()
+    available_cash = DecimalField(constraints=[SQL("DEFAULT 0.00")])
+    card = CharField(constraints=[SQL("DEFAULT '5'")])
+    cash = DecimalField(constraints=[SQL("DEFAULT 0.00")])
+    email = CharField(null=True)
+    finance_cash = DecimalField(constraints=[SQL("DEFAULT NULL::numeric")], null=True)
+    frozen_cash = DecimalField(constraints=[SQL("DEFAULT 0.00")])
+    grade = IntegerField(constraints=[SQL("DEFAULT 0")])
+    group_code = CharField(constraints=[SQL("DEFAULT '0,1,'::character varying")], null=True)
+    group_name = CharField(constraints=[SQL("DEFAULT '|普通会员|'::character varying")], null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('account_detailed_id_seq'::regclass)")])
+    identity = TextField()
+    img_id = BigIntegerField(null=True)
+    img_url = CharField(null=True)
+    invitation = CharField(null=True)
+    last_ip = CharField()
+    last_time = DateTimeField(constraints=[SQL("DEFAULT now()")])
+    last_url = CharField(null=True)
+    level = IntegerField(constraints=[SQL("DEFAULT 2")], null=True)
+    name = CharField(null=True)
+    now_game = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    og_type = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    open_invitation = CharField(null=True)
+    parent_id = TextField(null=True)
+    parent_path = TextField(null=True)
+    phone = CharField(null=True)
+    placing = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    qq = CharField(null=True)
+    ranking = BigIntegerField(null=True)
+    register_ip = CharField()
+    register_time = DateTimeField(constraints=[SQL("DEFAULT now()")])
+    register_url = CharField(null=True)
+    show = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    spread = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    statuss = BigIntegerField(constraints=[SQL("DEFAULT 1")])
+    token = CharField(null=True)
+    wechat = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+
+    class Meta:
+        table_name = 'account_detailed'
+        primary_key = False
+
+class AccountGroup(BaseModel):
+    create_at = DateTimeField(null=True)
+    group_code = IntegerField()
+    group_name = CharField()
+    id = BigAutoField()
+    identity = CharField()
+    sort = IntegerField(null=True)
+
+    class Meta:
+        table_name = 'account_group'
+
+class AccountNews(BaseModel):
+    account_identity = CharField()
+    content = CharField()
+    details = CharField(null=True)
+    id = BigAutoField()
+    identity = CharField(unique=True)
+    read_status = IntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    remark = CharField(null=True)
+    title = CharField()
+    type = IntegerField(null=True)
+    write_time = DateTimeField(constraints=[SQL("DEFAULT now()")], null=True)
+
+    class Meta:
+        table_name = 'account_news'
+
+class AccountNotice(BaseModel):
+    account_identity = CharField()
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('account_notice_id_seq'::regclass)")])
+    identity = CharField(primary_key=True)
+    money = FloatField()
+    msg_time = IntegerField()
+    read_status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    xy28_identity = CharField(null=True)
+    xy28_no = CharField()
+
+    class Meta:
+        table_name = 'account_notice'
+
+class AccountPassword(BaseModel):
+    account_identity = TextField()
+    account_password = CharField()
+    encryption = CharField()
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('account_password_id_seq'::regclass)")])
+    identity = CharField(primary_key=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+
+    class Meta:
+        table_name = 'account_password'
+        indexes = (
+            (('id', 'identity', 'account_identity'), False),
+        )
+
+class AccountToken(BaseModel):
+    account_identity = TextField(null=True)
+    effective_time = BigIntegerField(null=True)
+    id = BigAutoField()
+    last_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+
+    class Meta:
+        table_name = 'account_token'
+
+class Advert(BaseModel):
+    add_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    id = BigAutoField()
+    status = CharField(constraints=[SQL("DEFAULT '1'")], null=True)
+    title = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    type = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+
+    class Meta:
+        table_name = 'advert'
+
+class AppUpdate(BaseModel):
+    app_code = CharField(unique=True)
+    app_dec = CharField(null=True)
+    app_url = CharField()
+    id = BigAutoField()
+    identity = CharField()
+    upload_time = BigIntegerField()
+
+    class Meta:
+        table_name = 'app_update'
+
+class Article(BaseModel):
+    author = CharField()
+    child_id = IntegerField(null=True)
+    content = CharField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('article_id1_seq'::regclass)")])
+    identity = CharField()
+    img = TextField(null=True)
+    ios_content = CharField(null=True)
+    mobilecontent = TextField(null=True)
+    mobileimg = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    parent_id = IntegerField(constraints=[SQL("DEFAULT '-1'::integer")], null=True)
+    s_title = CharField(null=True)
+    sort = BigIntegerField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+    time = DateTimeField()
+    title = CharField()
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    typebind = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+
+    class Meta:
+        table_name = 'article'
+        indexes = (
+            (('identity', 'id'), True),
+        )
+        primary_key = CompositeKey('id', 'identity')
+
+class BandBank(BaseModel):
+    bank_code = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    bank_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    id = BigAutoField()
+    sort = IntegerField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+
+    class Meta:
+        table_name = 'band_bank'
+
+class Bank(BaseModel):
+    bank_code = CharField()
+    bank_name = CharField()
+    id = BigAutoField()
+    pay_api = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+
+    class Meta:
+        table_name = 'bank'
+
+class Banner(BaseModel):
+    add_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    advert_id = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    banner_link = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    banner_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    banner_url = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('banner_id_seq1'::regclass)")])
+    identity = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    sort = BigIntegerField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+
+    class Meta:
+        table_name = 'banner'
+        primary_key = False
+
+class Btrecord(BaseModel):
+    account = CharField(null=True)
+    content = TextField(null=True)
+    ct_time = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('btrecord_id_seq'::regclass)")])
+    identity = CharField(null=True)
+    type = IntegerField(null=True)
+
+    class Meta:
+        table_name = 'btrecord'
+        primary_key = False
+
+class City(BaseModel):
+    city_index = IntegerField()
+    id = BigAutoField()
+    name = CharField()
+    province_id = IntegerField()
+
+    class Meta:
+        table_name = 'city'
+
+class Column(BaseModel):
+    column_name = CharField()
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('column_id_seq'::regclass)")])
+    identity = CharField()
+    level = IntegerField()
+    pidentity = CharField(null=True)
+    remarks = CharField(null=True)
+
+    class Meta:
+        table_name = 'column'
+        indexes = (
+            (('id', 'identity'), True),
+        )
+        primary_key = CompositeKey('id', 'identity')
+
+class Commission(BaseModel):
+    id = BigAutoField()
+    name = CharField(null=True)
+    rate = CharField(null=True)
+
+    class Meta:
+        table_name = 'commission'
+
+class CountVisit(BaseModel):
+    id = BigAutoField()
+    identity = CharField()
+    no = BigIntegerField()
+    visit_time = DateField(null=True)
+
+    class Meta:
+        table_name = 'count_visit'
+
+class DcAllowip(BaseModel):
+    id = BigAutoField()
+    ip = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    operator = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    remark = CharField(null=True)
+    time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")])
+    type = IntegerField(constraints=[SQL("DEFAULT 2")], null=True)
+
+    class Meta:
+        table_name = 'dc_allowip'
+
+class DcNavs(BaseModel):
+    created_at = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    href = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+    icon = CharField(constraints=[SQL("DEFAULT ''::bpchar")], null=True)
+    id = BigAutoField()
+    name = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")])
+    parent_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    target = IntegerField(constraints=[SQL("DEFAULT (0)::smallint")], null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT (0)::smallint")], null=True)
+    updated_at = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+
+    class Meta:
+        table_name = 'dc_navs'
+
+class DcPrivCode(BaseModel):
+    create_at = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    id = BigAutoField()
+    priv_code = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+    priv_name = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+    remark = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+    update_at = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+
+    class Meta:
+        table_name = 'dc_priv_code'
+
+class DcPrivRole(BaseModel):
+    create_at = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    id = BigAutoField()
+    priv_id = IntegerField(null=True)
+    role_id = IntegerField(null=True)
+    role_name = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+
+    class Meta:
+        table_name = 'dc_priv_role'
+
+class DcRole(BaseModel):
+    admin_id = IntegerField()
+    admin_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    create_at = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    id = BigAutoField()
+    role_id = IntegerField()
+    role_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+
+    class Meta:
+        table_name = 'dc_role'
+
+class DcUserGrade(BaseModel):
+    grade = BigIntegerField(unique=True)
+    id = BigAutoField()
+    is_water = IntegerField(constraints=[SQL("DEFAULT 1")])
+    name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    rule = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    rule_details = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")])
+    water_bate = CharField(constraints=[SQL("DEFAULT '0'")])
+
+    class Meta:
+        table_name = 'dc_user_grade'
+
+class Feedback(BaseModel):
+    account_identity = CharField(null=True)
+    account_name = CharField(null=True)
+    account_qq = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    account_tel = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    account_weixin = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    content = CharField(null=True)
+    id = BigAutoField()
+    reply = TextField(null=True)
+    see_status = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    submit_time = DateTimeField(constraints=[SQL("DEFAULT now()")], null=True)
+    type = CharField(null=True)
+
+    class Meta:
+        table_name = 'feedback'
+
+class Helpfile(BaseModel):
+    content = TextField()
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('helpfile_id_seq'::regclass)")])
+    partent_id = IntegerField(null=True)
+    title = CharField()
+
+    class Meta:
+        table_name = 'helpfile'
+        primary_key = False
+
+class Logfile(BaseModel):
+    account = CharField(null=True)
+    account_identity = TextField(null=True)
+    add_time = DateTimeField(constraints=[SQL("DEFAULT now()")], null=True)
+    area = CharField(null=True)
+    browser = CharField(null=True)
+    device = CharField(null=True)
+    device_model = CharField(null=True)
+    device_number = CharField(null=True)
+    id = BigAutoField()
+    ip = CharField(null=True)
+    type = CharField(null=True)
+    url = CharField(null=True)
+
+    class Meta:
+        table_name = 'logfile'
+
+class Message(BaseModel):
+    add_status = CharField(constraints=[SQL("DEFAULT '1'")], null=True)
+    add_time = DateTimeField(null=True)
+    add_type = CharField(null=True)
+    content = CharField(null=True)
+    formname = CharField(null=True)
+    group_code = CharField(null=True)
+    group_name = CharField(constraints=[SQL("DEFAULT '|'::character varying")], null=True)
+    id = BigAutoField()
+    is_show = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    title = CharField(null=True)
+    toname = CharField(null=True)
+    type = IntegerField(null=True)
+
+    class Meta:
+        table_name = 'message'
+
+class MessageRead(BaseModel):
+    account_identity = CharField(null=True)
+    add_time = DateTimeField(null=True)
+    id = BigAutoField()
+    message_id = IntegerField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+
+    class Meta:
+        table_name = 'message_read'
+
+class Migrations(BaseModel):
+    batch = IntegerField()
+    id = BigAutoField()
+    migration = CharField()
+
+    class Meta:
+        table_name = 'migrations'
+
+class MoneyBack(BaseModel):
+    account_identity = CharField()
+    account_name = CharField()
+    buy_identity = CharField()
+    game_id = CharField()
+    game_name = CharField()
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('money_back_id_seq'::regclass)")])
+    info_identity = CharField()
+    money = DecimalField()
+    order_id = CharField(unique=True)
+    processing_time = DateTimeField(null=True)
+    ratio = CharField()
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+    sysetem_user = CharField(constraints=[SQL("DEFAULT '系统'::character varying")], null=True)
+
+    class Meta:
+        table_name = 'money_back'
+        indexes = (
+            (('id', 'info_identity', 'order_id'), True),
+        )
+        primary_key = CompositeKey('id', 'info_identity', 'order_id')
+
+class MoneyBuy(BaseModel):
+    account_identity = TextField()
+    account_name = CharField()
+    codes = JSONField()
+    game_name = CharField()
+    game_no = CharField()
+    game_status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    get_money = DecimalField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('money_buy_id_seq'::regclass)")])
+    info_identity = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    member_type = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    money = DecimalField()
+    money_time = DateTimeField(index=True, null=True)
+    order_id = CharField()
+    prize = JSONField(null=True)
+    prize_money = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    prize_note = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    remark = CharField(null=True)
+    settle_status = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+    water_status = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+
+    class Meta:
+        table_name = 'money_buy'
+        indexes = (
+            (('id', 'info_identity', 'order_id'), True),
+        )
+        primary_key = CompositeKey('id', 'info_identity', 'order_id')
+
+class MoneyCount(BaseModel):
+    account = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    account_identity = CharField()
+    bet = DecimalField(constraints=[SQL("DEFAULT 0")])
+    cancel = DecimalField(constraints=[SQL("DEFAULT 0")])
+    count_alltime = CharField()
+    count_time = IntegerField()
+    id = BigAutoField()
+    identity = CharField()
+    lottery = DecimalField(constraints=[SQL("DEFAULT 0")])
+    prize = DecimalField(constraints=[SQL("DEFAULT 0")])
+    save = DecimalField(constraints=[SQL("DEFAULT 0")])
+    sort = IntegerField(null=True)
+    take = DecimalField(constraints=[SQL("DEFAULT 0")])
+    type = IntegerField(constraints=[SQL("DEFAULT 1")])
+    ut_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")])
+
+    class Meta:
+        table_name = 'money_count'
+
+class MoneyDetails(BaseModel):
+    account_identity = TextField()
+    account_name = CharField(index=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('money_details_id_seq'::regclass)")])
+    info_identity = CharField()
+    money = DecimalField()
+    money_cash = DecimalField(constraints=[SQL("DEFAULT 0")])
+    money_time = DateTimeField()
+    money_type = IntegerField()
+    out_order_id = CharField(null=True)
+    reason = CharField(null=True)
+    remark = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+    sysetem_user = CharField(constraints=[SQL("DEFAULT '系统'::character varying")], null=True)
+    trade_desc = CharField(null=True)
+    trade_id = CharField()
+    trade_type = IntegerField()
+
+    class Meta:
+        table_name = 'money_details'
+        indexes = (
+            (('info_identity', 'trade_id'), True),
+        )
+        primary_key = CompositeKey('info_identity', 'trade_id')
+
+class MoneyNagent(BaseModel):
+    agent_identity = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    agent_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    apply_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")])
+    complete_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    money = DecimalField(constraints=[SQL("DEFAULT NULL::numeric")])
+    order_id = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    status = IntegerField()
+
+    class Meta:
+        table_name = 'money_nagent'
+
+class MoneyPrize(BaseModel):
+    account_identity = CharField()
+    account_name = CharField()
+    buy_identity = CharField(unique=True)
+    game_name = CharField()
+    get_money = CharField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('money_prize_id_seq'::regclass)")])
+    info_identity = CharField()
+    money = DecimalField()
+    money_time = DateTimeField()
+    order_id = CharField(unique=True)
+    prize_money = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+
+    class Meta:
+        table_name = 'money_prize'
+        indexes = (
+            (('id', 'info_identity', 'order_id'), True),
+        )
+        primary_key = CompositeKey('id', 'info_identity', 'order_id')
+
+class MoneyRecharge(BaseModel):
+    account_identity = TextField()
+    account_name = CharField()
+    apply_time = DateTimeField()
+    complete_time = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('money_recharge_id_seq'::regclass)")])
+    info_identity = CharField()
+    money = DecimalField()
+    money_cash = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    order_id = CharField(unique=True)
+    rate = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    reason = CharField(null=True)
+    recharge_type = CharField(null=True)
+    remark = CharField(null=True)
+    status = IntegerField()
+    sysetem_user = CharField(null=True)
+
+    class Meta:
+        table_name = 'money_recharge'
+        indexes = (
+            (('id', 'info_identity', 'order_id'), True),
+        )
+        primary_key = CompositeKey('id', 'info_identity', 'order_id')
+
+class MoneyRechargeRemark(BaseModel):
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('money_bank_id_seq'::regclass)")])
+    money = DecimalField()
+    name = CharField()
+    order_id = CharField(unique=True)
+    recharge_time = DateTimeField()
+    remark = CharField(null=True)
+    submit_time = IntegerField(null=True)
+    type = CharField(null=True)
+
+    class Meta:
+        table_name = 'money_recharge_remark'
+        indexes = (
+            (('id', 'order_id'), True),
+        )
+        primary_key = CompositeKey('id', 'order_id')
+
+class MoneyRed(BaseModel):
+    create_time = DateTimeField()
+    fail_user = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    id = BigAutoField()
+    input_order = CharField()
+    input_reason = CharField(null=True)
+    input_rule = CharField(null=True)
+    red_type = IntegerField(constraints=[SQL("DEFAULT 1")])
+    success_money = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    suescc_user = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    sum_money = DecimalField(null=True)
+    sum_user = IntegerField(null=True)
+    system_user = CharField()
+
+    class Meta:
+        table_name = 'money_red'
+
+class MoneyReturn(BaseModel):
+    account_identity = CharField()
+    account_name = CharField()
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('money_return_id_seq'::regclass)")])
+    info_identity = CharField()
+    money = DecimalField()
+    order_id = CharField(unique=True)
+    processing_time = DateTimeField(null=True)
+    ratio = DecimalField()
+    reason = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+    sysetem_user = CharField(null=True)
+    total_money = DecimalField()
+
+    class Meta:
+        table_name = 'money_return'
+        indexes = (
+            (('id', 'info_identity', 'order_id'), True),
+        )
+        primary_key = CompositeKey('id', 'info_identity', 'order_id')
+
+class MoneyReward(BaseModel):
+    account_identity = CharField()
+    account_name = CharField()
+    agent_id = CharField()
+    agent_name = CharField()
+    buy_identity = CharField()
+    game_id = CharField()
+    game_name = CharField()
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('money_reward_id_seq'::regclass)")])
+    info_identity = CharField()
+    money = DecimalField()
+    money_time = DateTimeField()
+    order_id = CharField(unique=True)
+    ratio = CharField()
+    status = IntegerField()
+
+    class Meta:
+        table_name = 'money_reward'
+        indexes = (
+            (('id', 'info_identity', 'order_id'), True),
+        )
+        primary_key = CompositeKey('id', 'info_identity', 'order_id')
+
+class MoneyTake(BaseModel):
+    account_identity = TextField()
+    account_name = CharField()
+    apply_date = DateField()
+    apply_time = DateTimeField()
+    bank_address = CharField(null=True)
+    bank_info = CharField(null=True)
+    bank_no = CharField()
+    bank_user = CharField(null=True)
+    give_time = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('money_take_id_seq'::regclass)")])
+    info_identity = CharField()
+    money = DecimalField()
+    money_cash = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    order_id = CharField(unique=True)
+    pass_time = DateTimeField(null=True)
+    reason = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    sysetem_user = CharField(constraints=[SQL("DEFAULT '系统'::character varying")], null=True)
+
+    class Meta:
+        table_name = 'money_take'
+        indexes = (
+            (('id', 'info_identity', 'order_id'), True),
+        )
+        primary_key = CompositeKey('id', 'info_identity', 'order_id')
+
+class Nagent(BaseModel):
+    account_identity = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    add_time = DateTimeField(constraints=[SQL("DEFAULT now()")], null=True)
+    agent_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    game_type_id = IntegerField(null=True)
+    grade = IntegerField(constraints=[SQL("DEFAULT 0")])
+    phone = BigIntegerField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+
+    class Meta:
+        table_name = 'nagent'
+
+class NagentChild(BaseModel):
+    account_identity = TextField()
+    account_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    agent_identity = TextField()
+    agent_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+
+    class Meta:
+        table_name = 'nagent_child'
+
+class NagentDetailed(BaseModel):
+    add_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    agent_identity = TextField()
+    agent_token = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    agent_user = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    bank_number = CharField(constraints=[SQL("DEFAULT '0'")])
+    child_bet = DecimalField(constraints=[SQL("DEFAULT 0")])
+    child_profit = DecimalField(constraints=[SQL("DEFAULT 0")])
+    email = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    encryption = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    grade = IntegerField(constraints=[SQL("DEFAULT 0")])
+    group_water = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    invite = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    money_total = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    ns_groupwater = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    ns_money = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    ns_ztwater = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    parent_id = CharField(null=True)
+    parent_path = CharField(null=True)
+    password = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    phone = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    ratio = CharField(constraints=[SQL("DEFAULT '0'")])
+    register_time = DateTimeField(null=True)
+    settle_money = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+    state = IntegerField(constraints=[SQL("DEFAULT 1")])
+    sum_child = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    type = IntegerField(constraints=[SQL("DEFAULT 2")])
+    zt_water = DecimalField(constraints=[SQL("DEFAULT 0")], null=True)
+
+    class Meta:
+        table_name = 'nagent_detailed'
+
+class NagentGrade(BaseModel):
+    first_amount = BigIntegerField()
+    grade_code = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    grade_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    last_amount = BigIntegerField()
+    profit_ratio = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    sort = BigIntegerField(constraints=[SQL("DEFAULT 1")])
+    water_ratio = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+
+    class Meta:
+        table_name = 'nagent_grade'
+
+class NagentMoney(BaseModel):
+    agent_identity = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    agent_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    end_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")])
+    money = DecimalField()
+    money_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")])
+    order_id = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    ratio = FloatField(null=True)
+    start_time = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")])
+    status = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    total_money = DecimalField(constraints=[SQL("DEFAULT NULL::numeric")], null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+
+    class Meta:
+        table_name = 'nagent_money'
+
+class Odds(BaseModel):
+    code_type = CharField(null=True)
+    id = BigAutoField()
+    lx = CharField(null=True)
+    name = CharField()
+    number = IntegerField(constraints=[SQL("DEFAULT 1")])
+    odds = CharField()
+    winningprobability = CharField(constraints=[SQL("DEFAULT '1'")])
+
+    class Meta:
+        table_name = 'odds'
+
+class Orderurl(BaseModel):
+    account = CharField()
+    account_identity = CharField()
+    add_time = DateTimeField(constraints=[SQL("DEFAULT now()")])
+    bak = TextField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('logfile_id_seq'::regclass)")])
+    ip = CharField(null=True)
+    name = CharField(null=True)
+    orderid = CharField(null=True)
+    type = CharField(null=True)
+    url = CharField(null=True)
+
+    class Meta:
+        table_name = 'orderurl'
+        primary_key = False
+
+class PayPassword(BaseModel):
+    account_identity = TextField()
+    encryption = CharField()
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('pay_password_id_seq'::regclass)")])
+    identity = CharField(primary_key=True)
+    no_money = FloatField(constraints=[SQL("DEFAULT 0")])
+    pay_password = CharField()
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+
+    class Meta:
+        table_name = 'pay_password'
+
+class Payment(BaseModel):
+    cert_priv_path = CharField(null=True)
+    cert_pub_path = CharField(null=True)
+    id = BigAutoField()
+    identity = CharField()
+    min_money = FloatField(constraints=[SQL("DEFAULT 1")], null=True)
+    pay_desc = TextField(null=True)
+    pay_type = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    payment_name = CharField(null=True)
+    quota = FloatField(constraints=[SQL("DEFAULT 99999999")], null=True)
+    ret_odd = FloatField(null=True)
+    seller_info = CharField()
+    show_name = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+
+    class Meta:
+        table_name = 'payment'
+
+class PrizeApiLog(BaseModel):
+    cur_time = DateTimeField(null=True)
+    force_prize = IntegerField(constraints=[SQL("DEFAULT 1")])
+    game_name = CharField()
+    id = BigAutoField()
+    identity = CharField()
+    no = CharField()
+    open_time = DateTimeField()
+    origin_ip = CharField(null=True)
+    prize_code = CharField()
+    request_headinfo = JSONField(null=True)
+    request_token = CharField(null=True)
+    vali_time = BigIntegerField(null=True)
+
+    class Meta:
+        table_name = 'prize_api_log'
+
+class PrizeLimit(BaseModel):
+    game_name = CharField()
+    id = BigAutoField()
+    max_money = DecimalField()
+    min_money = DecimalField()
+
+    class Meta:
+        table_name = 'prize_limit'
+
+class Province(BaseModel):
+    id = BigAutoField()
+    name = CharField()
+
+    class Meta:
+        table_name = 'province'
+
+class Setinfo(BaseModel):
+    extinfo = CharField(null=True)
+    id = BigAutoField()
+    identity = CharField()
+    infocontent = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    infoname = CharField()
+    infotype = BigIntegerField()
+    mobile_url = CharField(null=True)
+    pc_url = CharField(null=True)
+    remarks = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+
+    class Meta:
+        table_name = 'setinfo'
+
+class Settings(BaseModel):
+    enable_code = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    enable_intro = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    enable_invita = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    enable_mail = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    enable_phone = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    enable_qq = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    enable_sms = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    enable_wechat = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    id = BigAutoField()
+    rel_name = IntegerField(null=True)
+    success_tip = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+
+    class Meta:
+        table_name = 'settings'
+
+class SettlementRatio(BaseModel):
+    grade = IntegerField(null=True)
+    id = BigAutoField()
+    ratio = FloatField(null=True)
+
+    class Meta:
+        table_name = 'settlement_ratio'
+
+class StArea(BaseModel):
+    create_time = DateTimeField(null=True)
+    id = IntegerField(constraints=[SQL("DEFAULT nextval('"''st_area_id_seq"'::regclass)")])
+    parentid = BigIntegerField(constraints=[SQL("DEFAULT '0'::bigint")], null=True)
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    title = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+
+    class Meta:
+        table_name = 'st_area'
+        primary_key = False
+
+class StBetOrder(BaseModel):
+    account_identity = TextField()
+    account_name = CharField()
+    bet_amount = FloatField()
+    bet_odds = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")])
+    ctime = DateTimeField()
+    game_code = CharField()
+    game_status = IntegerField()
+    lg_id = IntegerField()
+    match_id = IntegerField()
+    member_type = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    odds_id = IntegerField()
+    order_number = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    remark = CharField(null=True)
+    settle_status = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+    utime = DateTimeField(null=True)
+    win_amount = FloatField(constraints=[SQL("DEFAULT 0")])
+
+    class Meta:
+        table_name = 'st_bet_order'
+
+class StBqCompetition(BaseModel):
+    ctime = DateTimeField(null=True)
+    expire_time = DateTimeField(null=True)
+    guest_team = CharField()
+    home_team = CharField()
+    is_morningplate = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_rollball = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_stringscene = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_today = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    lg_id = IntegerField(null=True)
+    match_date = DateField(null=True)
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], unique=True)
+    match_time = TimeField(null=True)
+    recommend = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    sg_id = IntegerField(null=True)
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    status = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    tag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_bq_competition'
+
+class StBqLeague(BaseModel):
+    area_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    begin_season = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    bf_ifdisplay = IntegerField(column_name='bf_Ifdisplay', null=True)
+    count_round = BigIntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    country_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    curr_round = BigIntegerField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_bq_league_id_seq'::regclass)")])
+    if_have_sub = IntegerField(null=True)
+    if_stop = IntegerField(null=True)
+    kind = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    last_time = DateTimeField(null=True)
+    league_list = BigIntegerField(null=True)
+    league_pic = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    lg_id = BigAutoField()
+    match_mode = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    match_season = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+    name_chinese = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    name_english = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    source = CharField(null=True)
+
+    class Meta:
+        table_name = 'st_bq_league'
+
+class StBqOdds(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField()
+    expire_time = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_bq_odds_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(null=True)
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sole = CharField(constraints=[SQL("DEFAULT ''::character varying")], unique=True)
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField()
+
+    class Meta:
+        table_name = 'st_bq_odds'
+        primary_key = False
+
+class StBqOddsRecord(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_bq_odds_record_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(null=True)
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_bq_odds_record'
+        primary_key = False
+
+class StBqResult(BaseModel):
+    all_goal = IntegerField(constraints=[SQL("DEFAULT 0")])
+    first_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")])
+    guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    guest_team = CharField()
+    home_rate = FloatField(constraints=[SQL("DEFAULT 0")])
+    home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    home_team = CharField()
+    last_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    lg_id = IntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_score = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    match_time = CharField()
+    match_winer = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    source = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    tag = IntegerField(constraints=[SQL("DEFAULT 0")])
+    u_guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    u_home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_bq_result'
+
+class StBqResultRecord(BaseModel):
+    all_inning = BigIntegerField(constraints=[SQL("DEFAULT 9")], null=True)
+    first_score = CharField(null=True)
+    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_score = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_team = CharField()
+    home_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_score = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_team = CharField()
+    last_score = CharField(null=True)
+    lg_id = BigIntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_score = CharField(null=True)
+    match_time = CharField()
+    match_winer = CharField(null=True)
+    source = CharField(null=True)
+    status = IntegerField()
+    tag = IntegerField(null=True)
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_bq_result_record'
+
+class StCountry(BaseModel):
+    country_area = BigIntegerField(null=True)
+    country_ico = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    country_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], unique=True)
+    country_order = IntegerField(null=True)
+    id = BigAutoField()
+    name_chinese = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    name_english = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    recommend_order = IntegerField(null=True)
+    source = CharField(null=True)
+    update_time = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_country'
+
+class StGameType(BaseModel):
+    ctime = IntegerField(constraints=[SQL("DEFAULT 0")])
+    game_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    game_ico_url = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    game_name = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = IntegerField(constraints=[SQL("DEFAULT 0")])
+
+    class Meta:
+        table_name = 'st_game_type'
+
+class StLqCompetition(BaseModel):
+    ctime = DateTimeField(null=True)
+    expire_time = DateTimeField(null=True)
+    guest_team = CharField()
+    home_team = CharField()
+    id = IntegerField(constraints=[SQL("DEFAULT nextval('bk_competition_id_seq'::regclass)")])
+    is_morningplate = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_rollball = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_stringscene = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_today = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    lg_id = IntegerField(null=True)
+    match_date = DateField(null=True)
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True, unique=True)
+    match_time = TimeField(null=True)
+    recommend = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    sg_id = IntegerField(null=True)
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    status = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    tag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_lq_competition'
+        primary_key = False
+
+class StLqGame(BaseModel):
+    odds_code = CharField(null=True)
+    odds_code_cn = CharField(null=True)
+    pid = BigIntegerField()
+
+    class Meta:
+        table_name = 'st_lq_game'
+
+class StLqLeague(BaseModel):
+    area_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    begin_season = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    bf_ifdisplay = IntegerField(column_name='bf_Ifdisplay', constraints=[SQL("DEFAULT 0")], null=True)
+    count_round = BigIntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    country_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    curr_round = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    id = BigAutoField()
+    if_have_sub = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    if_stop = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    kind = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    last_time = DateTimeField(null=True)
+    league_list = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    league_pic = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    lg_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], unique=True)
+    match_mode = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    match_season = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+    name_chinese = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    name_english = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    source = CharField(null=True)
+
+    class Meta:
+        table_name = 'st_lq_league'
+
+class StLqOdds(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField()
+    expire_time = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_lq_odds_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(null=True)
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sole = CharField(constraints=[SQL("DEFAULT ''::character varying")], unique=True)
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField()
+
+    class Meta:
+        table_name = 'st_lq_odds'
+        primary_key = False
+
+class StLqOddsRecord(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_lq_odds_record_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(null=True)
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_lq_odds_record'
+        primary_key = False
+
+class StLqResult(BaseModel):
+    all_goal = IntegerField(constraints=[SQL("DEFAULT 0")])
+    first_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")])
+    guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    guest_team = CharField()
+    home_rate = FloatField(constraints=[SQL("DEFAULT 0")])
+    home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    home_team = CharField()
+    last_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    lg_id = IntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_score = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    match_time = CharField()
+    match_winer = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    source = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    tag = IntegerField(constraints=[SQL("DEFAULT 0")])
+    u_guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    u_home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_lq_result'
+
+class StLqResultRecord(BaseModel):
+    first_score = CharField(null=True)
+    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_team = CharField()
+    home_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_team = CharField()
+    last_score = CharField(null=True)
+    lg_id = BigIntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_score = CharField(null=True)
+    match_time = CharField()
+    match_winer = CharField(null=True)
+    source = CharField(null=True)
+    status = IntegerField()
+    tag = IntegerField(null=True)
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_lq_result_record'
+
+class StOddsCode(BaseModel):
+    game_type = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    id = IntegerField(constraints=[SQL("DEFAULT nextval('st_odds_code_id_seq'::regclass)")])
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    odds_name = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    p_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+
+    class Meta:
+        table_name = 'st_odds_code'
+        primary_key = False
+
+class StTeam(BaseModel):
+    country_id = BigIntegerField()
+    game_type_id = BigIntegerField()
+    set_time = DateTimeField(null=True)
+    source = CharField(null=True)
+    status = IntegerField()
+    team_ico = CharField(null=True)
+    team_id = BigIntegerField()
+    team_name_cn = CharField(null=True)
+    team_name_en = CharField(null=True)
+    update_time = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_team'
+
+class StWqCompetition(BaseModel):
+    ctime = DateTimeField(null=True)
+    expire_time = DateTimeField(null=True)
+    guest_team = CharField()
+    home_team = CharField()
+    is_morningplate = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_rollball = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_stringscene = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_today = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    lg_id = IntegerField(null=True)
+    match_date = DateField()
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], unique=True)
+    match_time = TimeField(null=True)
+    recommend = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    sg_id = IntegerField(null=True)
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    status = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    tag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_wq_competition'
+
+class StWqGame(BaseModel):
+    odds_code = CharField(null=True)
+    odds_code_cn = CharField(null=True)
+    pid = BigIntegerField()
+
+    class Meta:
+        table_name = 'st_wq_game'
+
+class StWqLeague(BaseModel):
+    area_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    begin_season = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    bf_ifdisplay = IntegerField(column_name='bf_Ifdisplay', constraints=[SQL("DEFAULT 0")], null=True)
+    count_round = BigIntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    country_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    curr_round = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_wq_league_id_seq'::regclass)")])
+    if_have_sub = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    if_stop = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    kind = BigIntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    last_time = DateTimeField(null=True)
+    league_list = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    league_pic = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    lg_id = BigAutoField()
+    match_mode = BigIntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    match_season = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+    name_chinese = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    name_english = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    source = CharField(null=True)
+
+    class Meta:
+        table_name = 'st_wq_league'
+
+class StWqOdds(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField(null=True)
+    expire_time = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_wq_odds_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(null=True)
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sole = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True, unique=True)
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_wq_odds'
+        primary_key = False
+
+class StWqOddsRecord(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_wq_odds_record_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(null=True)
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_wq_odds_record'
+        primary_key = False
+
+class StWqResult(BaseModel):
+    all_inning = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    first_inning_score = CharField(null=True)
+    first_score_player = CharField(null=True)
+    guest_player_let_inning = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_player_let_plate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_player_name = CharField()
+    guest_player_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_player_let_inning = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_player_let_plate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_player_name = CharField()
+    home_player_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    last_score_player = CharField(null=True)
+    lg_id = BigIntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_time = CharField()
+    match_winer_player = CharField(null=True)
+    second_inning_score = CharField(null=True)
+    source = CharField(null=True)
+    status = IntegerField()
+    tag = IntegerField(null=True)
+    third_inning_score = CharField(null=True)
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_wq_result'
+
+class StWqResultRecord(BaseModel):
+    all_inning = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    first_inning_score = CharField(null=True)
+    first_score_player = CharField(null=True)
+    guest_player_let_inning = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_player_let_plate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_player_name = CharField()
+    guest_player_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_player_let_inning = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_player_let_plate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_player_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    host_player_name = CharField()
+    last_score_player = CharField(null=True)
+    lg_id = BigIntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_time = CharField()
+    match_winer_player = CharField(null=True)
+    second_inning_score = CharField(null=True)
+    source = CharField(null=True)
+    status = IntegerField()
+    tag = IntegerField(null=True)
+    third_inning_score = CharField(null=True)
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_wq_result_record'
+
+class StZqCompetition(BaseModel):
+    ctime = DateTimeField(null=True)
+    expire_time = DateTimeField(null=True)
+    guest_team = CharField()
+    home_team = CharField()
+    is_morningplate = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_rollball = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_stringscene = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_today = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    match_date = DateField(null=True)
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True, unique=True)
+    match_time = TimeField(null=True)
+    recommend = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    sg_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    status = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    tag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_zq_competition'
+
+class StZqGame(BaseModel):
+    odds_code = CharField()
+    odds_code_cn = CharField()
+    pid = BigIntegerField()
+
+    class Meta:
+        table_name = 'st_zq_game'
+
+class StZqLeague(BaseModel):
+    area_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    begin_season = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    bf_ifdisplay = IntegerField(column_name='bf_Ifdisplay', constraints=[SQL("DEFAULT 0")], null=True)
+    count_round = BigIntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    country_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    curr_round = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    hot = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    id = BigAutoField()
+    if_have_sub = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    if_stop = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    kind = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    last_time = DateTimeField(null=True)
+    league_list = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    league_pic = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    lg_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], unique=True)
+    match_mode = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    match_season = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+    name_chinese = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    name_english = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    source = CharField(null=True)
+
+    class Meta:
+        table_name = 'st_zq_league'
+
+class StZqOdds(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField()
+    expire_time = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_zq_odds_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sole = CharField(constraints=[SQL("DEFAULT ''::character varying")], unique=True)
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField()
+
+    class Meta:
+        table_name = 'st_zq_odds'
+        primary_key = False
+
+class StZqOddsRecord(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_zq_odds_record_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_zq_odds_record'
+        primary_key = False
+
+class StZqResult(BaseModel):
+    all_goal = IntegerField(constraints=[SQL("DEFAULT 0")])
+    first_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")])
+    guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    guest_team = CharField()
+    home_rate = FloatField(constraints=[SQL("DEFAULT 0")])
+    home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    home_team = CharField()
+    last_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    lg_id = IntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_score = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    match_time = CharField()
+    match_winer = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    source = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    tag = IntegerField(constraints=[SQL("DEFAULT 0")])
+    u_guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    u_home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_zq_result'
+
+class StZqResultRecord(BaseModel):
+    all_goal = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    first_score = CharField(null=True)
+    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_team = CharField()
+    home_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_team = CharField()
+    last_score = CharField(null=True)
+    lg_id = BigIntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_score = CharField(null=True)
+    match_time = CharField()
+    match_winer = CharField(null=True)
+    source = CharField(null=True)
+    status = IntegerField()
+    tag = IntegerField(null=True)
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_zq_result_record'
+
+class StZqSubleague(BaseModel):
+    group_num = BigIntegerField(null=True)
+    id = BigAutoField()
+    league_id = BigIntegerField(null=True)
+    match_season = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    name_chinese = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    name_english = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    order = BigIntegerField(null=True)
+
+    class Meta:
+        table_name = 'st_zq_subleague'
+
+class Succedaneum(BaseModel):
+    account_identity = CharField()
+    id = BigAutoField()
+    parent_userid = CharField()
+
+    class Meta:
+        table_name = 'succedaneum'
+
+class SystemBank(BaseModel):
+    bank = CharField()
+    bank_num = CharField()
+    groups = CharField(constraints=[SQL("DEFAULT '0,'::character varying")], null=True)
+    groups_names = CharField(constraints=[SQL("DEFAULT '|'::character varying")], null=True)
+    id = BigAutoField()
+    infoname = CharField()
+    remark = CharField(null=True)
+    sort = IntegerField(null=True)
+    status = IntegerField()
+    time = DateTimeField(null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+
+    class Meta:
+        table_name = 'system_bank'
+
+class SystemColumnRoot(BaseModel):
+    id = BigAutoField()
+    menu_id = IntegerField(null=True)
+    root_id = IntegerField(null=True)
+
+    class Meta:
+        table_name = 'system_column_root'
+
+class SystemLog(BaseModel):
+    identity = CharField(primary_key=True)
+    ip = CharField(null=True)
+    mark = CharField(null=True)
+    operation = CharField(null=True)
+    operation_time = DateTimeField(null=True)
+    random = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    system_identity = IntegerField(null=True)
+
+    class Meta:
+        table_name = 'system_log'
+
+class SystemMenu(BaseModel):
+    display = BigIntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    id = BigAutoField()
+    name = CharField()
+    parentid = IntegerField(null=True)
+    path = CharField()
+    sort = BigIntegerField()
+
+    class Meta:
+        table_name = 'system_menu'
+
+class SystemPower(BaseModel):
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('system_power_id_seq'::regclass)")])
+    identity = CharField(primary_key=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    value = CharField()
+
+    class Meta:
+        table_name = 'system_power'
+        indexes = (
+            (('id', 'identity', 'value'), False),
+        )
+
+class SystemRoot(BaseModel):
+    id = BigAutoField()
+    level = CharField()
+    name = CharField(null=True)
+    settingmoney = DecimalField(null=True)
+
+    class Meta:
+        table_name = 'system_root'
+
+class SystemSetting(BaseModel):
+    id = BigAutoField()
+    identity = CharField()
+    name = CharField()
+    status = IntegerField(null=True)
+    value = CharField()
+
+    class Meta:
+        table_name = 'system_setting'
+
+class SystemUser(BaseModel):
+    add_time = DateTimeField(constraints=[SQL("DEFAULT now()")], null=True)
+    encryption = CharField()
+    encryption_2 = CharField(null=True)
+    id = BigAutoField()
+    img_url = CharField(null=True)
+    loginname = CharField()
+    password = CharField()
+    password_2 = CharField(null=True)
+    remarks = TextField(null=True)
+    root_id = IntegerField()
+    status = IntegerField(constraints=[SQL("DEFAULT 1")])
+    token = CharField(null=True)
+
+    class Meta:
+        table_name = 'system_user'
+
+class UserLogs(BaseModel):
+    create_time = DateTimeField(null=True)
+    header = TextField(null=True)
+    id = BigAutoField()
+    ip = CharField(null=True)
+    user_id = CharField(null=True)
+    user_name = CharField(null=True)
+
+    class Meta:
+        table_name = 'user_logs'
+
+class UserSetting(BaseModel):
+    account_identity = TextField(primary_key=True)
+    cart_info = JSONField(null=True)
+    created_at = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    device_number = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    device_state = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    fav_info = JSONField(null=True)
+    hand_lock = IntegerField(constraints=[SQL("DEFAULT 0")])
+    hand_pass = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    prize_all = BigIntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    prize_ani = IntegerField(constraints=[SQL("DEFAULT 0")])
+    prize_games = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    shake_rand = IntegerField(constraints=[SQL("DEFAULT 0")])
+    sound = IntegerField(constraints=[SQL("DEFAULT 0")])
+    updated_at = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    win_games = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+
+    class Meta:
+        table_name = 'user_setting'
+
+class UserVip(BaseModel):
+    account_identity = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    account_name = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    addtime = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    audittime = DateTimeField(constraints=[SQL("DEFAULT NULL::timestamp without time zone")], null=True)
+    id = BigAutoField()
+    remark = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
+    sysetem_user = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    sysetem_user_id = IntegerField(null=True)
+
+    class Meta:
+        table_name = 'user_vip'
+

+ 186 - 0
scrapy_yzd/models.py

@@ -0,0 +1,186 @@
+import psycopg2
+from peewee import *
+# from psycopg2.psycopg1 import connection
+# from psycopg2.psycopg1 import connection
+from psycopg2.extras import DictCursor
+# from twisted.conch.scripts.conch import conn
+
+# cursor = conn.cursor(cursor_factory=DictCursor)
+# connection.cursor()
+database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
+# database = PostgresqlDatabase('postgres', **{'host': '127.0.0.1', 'port': 5432, 'user': 'postgres', 'password': '9998877'})
+
+class UnknownField(object):
+    def __init__(self, *_, **__): pass
+
+class BaseModel(Model):
+    class Meta:
+        pass
+        database = database
+
+
+class StZqOdds(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField()
+    expire_time = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_zq_odds_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sole = CharField(constraints=[SQL("DEFAULT ''::character varying")], unique=True)
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField()
+
+    class Meta:
+        table_name = 'st_zq_odds'
+        primary_key = False
+
+
+
+#赔率记录表
+class StZqOddsRecord(BaseModel):
+    condition = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    ctime = DateTimeField(null=True)
+    id = BigIntegerField(constraints=[SQL("DEFAULT nextval('st_zq_odds_record_id_seq'::regclass)")])
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")])
+    max = FloatField(constraints=[SQL("DEFAULT 99")])
+    min = FloatField(constraints=[SQL("DEFAULT 0")])
+    odds = FloatField()
+    odds_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    odds_only = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    p_code = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    p_id = BigIntegerField(constraints=[SQL("DEFAULT '-1'::integer")])
+    sort = IntegerField(constraints=[SQL("DEFAULT 0")])
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    team = CharField(constraints=[SQL("DEFAULT ''::character varying")])
+    type = IntegerField(constraints=[SQL("DEFAULT 0")])
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_zq_odds_record'
+        primary_key = False
+
+
+
+
+
+
+
+
+class StZqResult(BaseModel):
+    all_goal = IntegerField(constraints=[SQL("DEFAULT 0")])
+    first_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")])
+    guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    guest_team = CharField()
+    home_rate = FloatField(constraints=[SQL("DEFAULT 0")])
+    home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    home_team = CharField()
+    last_score = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    lg_id = IntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_score = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    match_time = CharField()
+    match_winer = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    source = CharField(null=True)
+    status = IntegerField(constraints=[SQL("DEFAULT 0")])
+    tag = IntegerField(constraints=[SQL("DEFAULT 0")])
+    u_guest_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    u_home_score = IntegerField(constraints=[SQL("DEFAULT 0")])
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_zq_result'
+
+
+
+class StZqResultRecord(BaseModel):
+    all_goal = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    first_score = CharField(null=True)
+    guest_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    guest_team = CharField()
+    home_rate = FloatField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_score = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    home_team = CharField()
+    last_score = CharField(null=True)
+    lg_id = BigIntegerField()
+    match_id = BigIntegerField()
+    match_process = CharField()
+    match_score = CharField(null=True)
+    match_time = CharField()
+    match_winer = CharField(null=True)
+    source = CharField(null=True)
+    status = IntegerField()
+    tag = IntegerField(null=True)
+    update_time = DateTimeField()
+
+    class Meta:
+        table_name = 'st_zq_result_record'
+
+
+
+class StZqCompetition(BaseModel):
+    ctime = DateTimeField(null=True)
+    expire_time = DateTimeField(null=True)
+    guest_team = CharField()
+    home_team = CharField()
+    is_morningplate = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_rollball = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_stringscene = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    is_today = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    lg_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    match_date = DateField(null=True)
+    match_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True, unique=True)
+    match_time = TimeField(null=True)
+    recommend = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    sg_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    source = CharField(constraints=[SQL("DEFAULT ''::character varying")], null=True)
+    status = CharField(constraints=[SQL("DEFAULT '0'")], null=True)
+    tag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    type = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    utime = DateTimeField(null=True)
+
+    class Meta:
+        table_name = 'st_zq_competition'
+
+
+
+#联赛表
+class StZqLeague(BaseModel):
+    area_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    begin_season = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    bf_ifdisplay = IntegerField(column_name='bf_Ifdisplay', constraints=[SQL("DEFAULT 0")], null=True)
+    count_round = BigIntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    country_id = IntegerField(constraints=[SQL("DEFAULT 0")])
+    curr_round = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    hot = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    id = BigAutoField()
+    if_have_sub = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    if_stop = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    kind = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    last_time = DateTimeField(null=True)
+    league_list = BigIntegerField(constraints=[SQL("DEFAULT 0")], null=True)
+    league_pic = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    lg_id = BigIntegerField(constraints=[SQL("DEFAULT 0")], unique=True)
+    match_mode = IntegerField(constraints=[SQL("DEFAULT '1'::bigint")])
+    match_season = CharField(constraints=[SQL("DEFAULT 'NULL::bpchar'")], null=True)
+    name_chinese = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    name_english = CharField(constraints=[SQL("DEFAULT 'NULL::character varying'")], null=True)
+    source = CharField(null=True)
+
+    class Meta:
+        table_name = 'st_zq_league'

+ 11 - 0
scrapy_yzd/scrapy.cfg

@@ -0,0 +1,11 @@
+# Automatically created by: scrapy startproject
+#
+# For more information about the [deploy] section see:
+# https://scrapyd.readthedocs.org/en/latest/deploy.html
+
+[settings]
+default = scrapy_yzd.settings
+
+[deploy]
+#url = http://localhost:6800/
+project = scrapy_yzd

+ 0 - 0
scrapy_yzd/scrapy_yzd/__init__.py


BIN
scrapy_yzd/scrapy_yzd/__pycache__/__init__.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/__init__.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/items.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/items.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/pipelines.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/settings.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/__pycache__/settings.cpython-36.pyc


+ 349 - 0
scrapy_yzd/scrapy_yzd/autoproxy.py

@@ -0,0 +1,349 @@
+#! -*- coding: utf-8 -*-
+import urllib2
+import logging
+import threading
+import math
+import re
+import time
+
+from bs4 import BeautifulSoup
+from twisted.internet import defer
+from twisted.internet.error import TimeoutError, ConnectionRefusedError, \
+    ConnectError, ConnectionLost, TCPTimedOutError, ConnectionDone
+
+logger = logging.getLogger(__name__)
+
+
+class AutoProxyMiddleware(object):
+
+    EXCEPTIONS_TO_CHANGE = (defer.TimeoutError, TimeoutError, ConnectionRefusedError, ConnectError, ConnectionLost, TCPTimedOutError, ConnectionDone)
+
+    _settings = [
+        ('enable', True),
+        ('test_urls', [('http://www.w3school.com.cn', '06004630'), ]),
+        ('test_proxy_timeout', 5),
+        ('download_timeout', 60),
+        ('test_threadnums', 20),
+        ('ban_code', [503, ]),
+        ('ban_re', r''),
+        ('proxy_least', 3),
+        ('init_valid_proxys', 1),
+        ('invalid_limit', 200),
+    ]
+
+    def __init__(self, proxy_set=None):
+        self.proxy_set = proxy_set or {}
+        for k, v in self._settings:
+            setattr(self, k, self.proxy_set.get(k, v))
+
+        # 代理列表和当前的代理指针,couter_proxy用作该代理下载的网页数量
+        self.proxy = []
+        self.proxy_index = 0
+        self.proxyes = {}
+        self.counter_proxy = {}
+
+        self.fetch_new_proxy()
+        self.test_proxyes(self.proxyes, wait=True)
+        logger.info('Use proxy : %s', self.proxy)
+
+    @classmethod
+    def from_crawler(cls, crawler):
+        return cls(crawler.settings.getdict('AUTO_PROXY'))
+
+    def process_request(self, request, spider):
+        if not self._is_enabled_for_request(request):
+            return
+
+        if self.len_valid_proxy() > 0:
+            self.set_proxy(request)
+            # if 'download_timeout' not in request.meta:
+            request.meta['download_timeout'] = self.download_timeout
+        else:
+            # 没有可用代理,直连
+            if 'proxy' in request.meta:
+                del request.meta['proxy']
+
+    def process_response(self, request, response, spider):
+        if not self._is_enabled_for_request(request):
+            return response
+
+        if response.status in self.ban_code:
+            self.invaild_proxy(request.meta['proxy'])
+            logger.debug("Proxy[%s] ban because return httpstatuscode:[%s]. ", request.meta['proxy'], str(response.status))
+            new_request = request.copy()
+            new_request.dont_filter = True
+            return new_request
+
+        if self.ban_re:
+            try:
+                pattern = re.compile(self.ban_re)
+            except TypeError:
+                logger.error('Wrong "ban_re", please check settings')
+                return response
+            match = re.search(pattern, response.body)
+            if match:
+                self.invaild_proxy(request.meta['proxy'])
+                logger.debug("Proxy[%s] ban because pattern match:[%s]. ", request.meta['proxy'], str(match))
+                new_request = request.copy()
+                new_request.dont_filter = True
+                return new_request
+
+        p = request.meta['proxy']
+        self.counter_proxy[p] = self.counter_proxy.setdefault(p, 1) + 1
+        return response
+
+    def process_exception(self, request, exception, spider):
+        if isinstance(exception, self.EXCEPTIONS_TO_CHANGE) \
+                and request.meta.get('proxy', False):
+            self.invaild_proxy(request.meta['proxy'])
+            logger.debug("Proxy[%s] connect exception[%s].", request.meta['proxy'], exception)
+            new_request = request.copy()
+            new_request.dont_filter = True
+            return new_request
+
+    def invaild_proxy(self, proxy):
+        """
+        将代理设为invaild。如果之前该代理已下载超过200页(默认)的资源,则暂时不设置,仅切换代理,并减少其计数。
+        """
+        if self.counter_proxy.get(proxy, 0) > self.invalid_limit:
+            self.counter_proxy[proxy] = self.counter_proxy.get(proxy, 0) - 50
+            if self.counter_proxy[proxy] < 0:
+                self.counter_proxy[proxy] = 0
+            self.change_proxy()
+        else:
+            self.proxyes[proxy] = False
+            # logger.info('Set proxy[%s] invaild.', proxy)
+
+    def change_proxy(self):
+        """
+        切换代理。
+        """
+        while True:
+            self.proxy_index = (self.proxy_index + 1) % len(self.proxy)
+            proxy_valid = self.proxyes[self.proxy[self.proxy_index]]
+            if proxy_valid:
+                break
+            if self.len_valid_proxy() == 0:
+                logger.info('Available proxys is none.Waiting for fetch new proxy.')
+                break
+        logger.info('Change proxy to %s', self.proxy[self.proxy_index])
+        logger.info('Available proxys[%s]: %s', self.len_valid_proxy(), self.valid_proxyes())
+
+        # 可用代理数量小于预设值则扩展代理
+        if self.len_valid_proxy() < self.proxy_least:
+            self.extend_proxy()
+
+    def set_proxy(self, request):
+        """
+        设置代理。
+        """
+        proxy_valid = self.proxyes[self.proxy[self.proxy_index]]
+        if not proxy_valid:
+            self.change_proxy()
+
+        request.meta['proxy'] = self.proxy[self.proxy_index]
+        # logger.info('Set proxy. request.meta: %s', request.meta)
+
+    def len_valid_proxy(self):
+        """
+        计算可用代理的数量
+        """
+        count = 0
+        for p in self.proxy:
+            if self.proxyes[p]:
+                count += 1
+        return count
+
+    def valid_proxyes(self):
+        """
+        可用代理列表
+        """
+        proxyes = []
+        for p in self.proxy:
+            if self.proxyes[p]:
+                proxyes.append(p)
+        return proxyes
+
+    def extend_proxy(self):
+        """
+        扩展代理。测试代理是异步的。
+        """
+        self.fetch_new_proxy()
+        self.test_proxyes(self.proxyes)
+
+    def append_proxy(self, p):
+        """
+        辅助函数,将测试通过的代理添加到列表
+        """
+        if p not in self.proxy:
+            self.proxy.append(p)
+
+    def fetch_new_proxy(self):
+        """
+        获取新的代理,目前从三个网站抓取代理,每个网站开一个线程抓取代理。
+        """
+        logger.info('Starting fetch new proxy.')
+        urls = ['xici', 'ip3336', 'kxdaili']
+        threads = []
+        for url in urls:
+            t = ProxyFetch(self.proxyes, url)
+            threads.append(t)
+            t.start()
+        for t in threads:
+            t.join()
+
+    def test_proxyes(self, proxyes, wait=False):
+        """
+        测试代理可通性。测试网址、特征码以及测试线程数均可设置。
+        """
+        list_proxy = proxyes.items()
+        threads = []
+        n = int(math.ceil(len(list_proxy) / self.test_threadnums))
+        for i in range(self.test_threadnums):
+            # 将待测试的代理平均分给测试线程
+            list_part = list_proxy[i * n: (i + 1) * n]
+            part = {k: v for k, v in list_part}
+            t = ProxyValidate(self, part)
+            threads.append(t)
+            t.start()
+
+        # 初始化该中间件时,等待有可用的代理
+        if wait:
+            while True:
+                for t in threads:
+                    t.join(0.2)
+                    if self._has_valid_proxy():
+                        break
+                if self._has_valid_proxy():
+                        break
+
+    def _has_valid_proxy(self):
+        if self.len_valid_proxy() >= self.init_valid_proxys:
+            return True
+
+    def _is_enabled_for_request(self, request):
+        return self.enable and 'dont_proxy' not in request.meta
+
+
+class ProxyValidate(threading.Thread):
+    """
+    测试代理线程类
+    """
+
+    def __init__(self, autoproxy, part):
+        super(ProxyValidate, self).__init__()
+        self.autoproxy = autoproxy
+        self.part = part
+
+    def run(self):
+        self.test_proxyes(self.part)
+
+    def test_proxyes(self, proxyes):
+        for proxy, valid in proxyes.iteritems():
+            if(self.check_proxy(proxy)):
+                self.autoproxy.proxyes[proxy] = True
+                self.autoproxy.append_proxy(proxy)
+
+    def check_proxy(self, proxy):
+        proxy_handler = urllib2.ProxyHandler({'http': proxy})
+        opener = urllib2.build_opener(proxy_handler, urllib2.HTTPHandler)
+        try:
+            for url, code in self.autoproxy.test_urls:
+                resbody = opener.open(url, timeout=self.autoproxy.test_proxy_timeout).read()
+                if code not in resbody:
+                    return False
+            return True
+        except Exception:
+            return False
+
+
+class ProxyFetch(threading.Thread):
+
+    def __init__(self, proxyes, url):
+        super(ProxyFetch, self).__init__()
+        self.proxyes = proxyes
+        self.url = url
+
+    def run(self):
+        self.proxyes.update(getattr(self, 'fetch_proxy_from_' + self.url)())
+
+    def fetch_proxy_from_xici(self):
+        proxyes = {}
+        url = "http://www.xicidaili.com/nn/"
+        try:
+            for i in range(1, 4):
+                soup = self.get_soup(url + str(i))
+                trs = soup.find("table", attrs={"id": "ip_list"}).find_all("tr")
+                for i, tr in enumerate(trs):
+                    if(0 == i):
+                        continue
+                    tds = tr.find_all('td')
+                    ip = tds[1].text
+                    port = tds[2].text
+                    proxy = ''.join(['http://', ip, ':', port]).encode('utf-8')
+                    proxyes[proxy] = False
+        except Exception as e:
+            logger.error('Failed to fetch_proxy_from_xici. Exception[%s]', e)
+
+        return proxyes
+
+    def fetch_proxy_from_ip3336(self):
+        proxyes = {}
+        url = 'http://www.ip3366.net/free/?stype=1&page='
+        try:
+            for i in range(1, 6):
+                soup = self.get_soup(url + str(i))
+                trs = soup.find("div", attrs={"id": "list"}).table.find_all("tr")
+                for i, tr in enumerate(trs):
+                    if 0 == i:
+                        continue
+                    tds = tr.find_all("td")
+                    ip = tds[0].string.strip().encode('utf-8')
+                    port = tds[1].string.strip().encode('utf-8')
+                    proxy = ''.join(['http://', ip, ':', port])
+                    proxyes[proxy] = False
+        except Exception as e:
+            logger.error('Failed to fetch_proxy_from_ip3336. Exception[%s]', e)
+
+        return proxyes
+
+    def fetch_proxy_from_kxdaili(self):
+        proxyes = {}
+        url = 'http://www.kxdaili.com/dailiip/1/%d.html'
+        try:
+            for i in range(1, 11):
+                soup = self.get_soup(url % i)
+                trs = soup.find("table", attrs={"class": "ui table segment"}).find_all("tr")
+                for i, tr in enumerate(trs):
+                    if 0 == i:
+                        continue
+                    tds = tr.find_all("td")
+                    ip = tds[0].string.strip().encode('utf-8')
+                    port = tds[1].string.strip().encode('utf-8')
+                    proxy = ''.join(['http://', ip, ':', port])
+                    proxyes[proxy] = False
+        except Exception as e:
+            logger.error('Failed to fetch_proxy_from_kxdaili. Exception[%s]', e)
+
+        return proxyes
+
+    def get_soup(self, url):
+        request = urllib2.Request(url)
+        request.add_header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36")
+        while True:
+            try:
+                html_doc = urllib2.urlopen(request, timeout=30).read()
+                break
+            except:
+                logger.info("Fetch proxy from {} fail, will try later.".format(url))
+                time.sleep(120)
+
+
+        soup = BeautifulSoup(html_doc)
+
+        return soup
+
+
+if __name__ == '__main__':
+
+    AutoProxyMiddleware()

+ 337 - 0
scrapy_yzd/scrapy_yzd/items.py

@@ -0,0 +1,337 @@
+# -*- coding: utf-8 -*-
+
+# Define here the models for your scraped items
+#
+# See documentation in:
+# http://doc.scrapy.org/en/latest/topics/items.html
+
+import scrapy
+
+
+class ScrapyYzdItem(scrapy.Item):
+    # define the fields for your item here like:
+    # name = scrapy.Field()
+    pass
+
+class Today_all(scrapy.Field):
+    # 让球大小盘
+    concede_size = scrapy.Field()
+# 独赢
+    capot = scrapy.Field()
+# 入球数-单双
+    odd_even = scrapy.Field()
+# 总入球
+    total_goal = scrapy.Field()
+# 半场/全场
+    half_full = scrapy.Field()
+# 波胆
+    bodan = scrapy.Field()
+# 最先/最后进球
+    first_last_ball = scrapy.Field()
+# 冠军
+    champion = scrapy.Field()
+
+    def get_insert_sql(self):
+        insert_sql = """
+              INSERT INTO st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, team, type, source, sole)
+              VALUES (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s)
+            """
+        params = (00000, 'test1111',00000, '2019-04-02 14:04:48', '2019-04-02 14:04:48',0.1,0.16,0,'test','11',0,'h532','2222222333')
+        return  insert_sql, params
+
+
+
+
+
+
+
+class LanqiuItem(scrapy.Item):
+  # 联赛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()
+    odd_even = scrapy.Field()
+    total_size = scrapy.Field()
+    last_number = scrapy.Field()
+    capot = scrapy.Field()
+    team_score = scrapy.Field()
+
+class Hg3535Item(scrapy.Item):
+    league_id = scrapy.Field() # 联赛id
+    league_name = scrapy.Field() # 联赛名
+    ctn = scrapy.Field() #角球或者其他
+    one_team_name = scrapy.Field() #队一名
+    two_team_name = scrapy.Field() #队二名
+    num = scrapy.Field() # num值
+    date_match = scrapy.Field() # 比赛日期
+    date_time = scrapy.Field() # 比赛时间
+    one_team_score = scrapy.Field() # 队一比分
+    two_team_score = scrapy.Field() # 队二比分
+    half_time =  scrapy.Field() #半场
+    match_id  = scrapy.Field() #比赛id
+    give_ball = scrapy.Field() # ah列表 全场让球
+    full_size = scrapy.Field() # ou列表 全场大小
+    win_situation = scrapy.Field() #1x2列表全场独赢
+    half_handicap = scrapy.Field() # ahlst 上半场让球
+    half_size = scrapy.Field() # oulst 上半场大小
+    half_win = scrapy.Field() # 1x2lst 上半场独赢
+    full_score = scrapy.Field() # oe 全场入球
+    half_goal = scrapy.Field() # oelst 上半场入球
+    total_goal = scrapy.Field() # tg 全场总入球
+    first_half_goal = scrapy.Field() # tglst 上半场总入球
+    half_full_time = scrapy.Field() # hf 半场/全场
+    full_field = scrapy.Field() # cs 全场波胆
+    half_wave = scrapy.Field() # cslst 上半场波胆
+    advanced_ball = scrapy.Field() # ttslast 最先进球
+    final_goal = scrapy.Field()  # tts1st 最后进球
+
+
+
+class DoubanItem(scrapy.Item):
+    movie_name = scrapy.Field()
+    movie_director = scrapy.Field()
+    movie_writer = scrapy.Field()
+    movie_starring = scrapy.Field()
+    movie_category = scrapy.Field()
+    movie_country = scrapy.Field()
+    #movie_language = scrapy.Field()
+    movie_date = scrapy.Field()
+    movie_time = scrapy.Field()
+    movie_star = scrapy.Field()
+    movie_5score = scrapy.Field()
+    movie_4score = scrapy.Field()
+    movie_3score = scrapy.Field()
+    movie_2score = scrapy.Field()
+    movie_1score = scrapy.Field()
+    movie_describe = scrapy.Field()
+    pass
+
+
+class jdItem(scrapy.Item):
+    phone_id = scrapy.Field()
+    phone_name = scrapy.Field()
+    phone_price = scrapy.Field()
+    phone_houdu = scrapy.Field()
+    phone_CPU = scrapy.Field()
+    phone_ROM = scrapy.Field()
+    phone_RAM = scrapy.Field()
+    phone_screen = scrapy.Field()
+    phone_frontcam = scrapy.Field()
+    phone_backcam = scrapy.Field()
+    pass
+
+class SteamItem(scrapy.Item):
+
+    name = scrapy.Field()
+    price = scrapy.Field()
+    release_date = scrapy.Field()
+    metacritic_score = scrapy.Field()
+    user_reviews_count = scrapy.Field()
+    positive_user_reviews_count = scrapy.Field()
+    positive_percent = scrapy.Field()
+    negative_user_reviews_count = scrapy.Field()
+    steam_user_reviews_count = scrapy.Field()
+    non_steam_user_reviews_count = scrapy.Field()
+    english_user_reviews_count = scrapy.Field()
+    non_english_user_reviews_count = scrapy.Field()
+    pass
+
+
+
+class Temaball(scrapy.Field):
+    league_id = scrapy.Field()
+    league_name = scrapy.Field()
+    game_id = scrapy.Field()
+    team_home = scrapy.Field()
+    team_guest = scrapy.Field()
+    number = scrapy.Field()
+    data_game = scrapy.Field()
+    time_game = scrapy.Field()
+    full_data = scrapy.Field()
+    half_data = scrapy.Field()
+    half_full = scrapy.Field()
+    full_data_rule = scrapy.Field()
+    half_data_rule = scrapy.Field()
+
+
+
+#篮球
+class 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 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 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()
+
+
+# 棒球 冠军--------------------------------------------------------------------------------------------------------------
+class Bqguanjun(scrapy.Field):
+    league_name = scrapy.Field()
+    tema_home = scrapy.Field()
+    league_id = scrapy.Field()
+    game_id = scrapy.Field()
+    data_game = scrapy.Field()
+    time_game = scrapy.Field()
+    new_league_name = scrapy.Field()
+    champion_team = scrapy.Field()
+    new_champion = scrapy.Field()
+    pt = scrapy.Field()
+    zhuangtai = scrapy.Field()
+    champion = scrapy.Field()
+
+
+# 棒球 联赛--------------------------------------------------------------------------------------------------------------
+class Bangqiuls(scrapy.Field):
+    area_id = scrapy.Field()
+    area_name = scrapy.Field()
+    st_zq_league = scrapy.Field()
+    name_chinese = scrapy.Field()
+

+ 53 - 0
scrapy_yzd/scrapy_yzd/middlewares.py

@@ -0,0 +1,53 @@
+# -*-coding:utf-8-*-
+import random
+from scrapy.downloadermiddlewares.useragent import UserAgentMiddleware
+
+import base64
+
+
+class ProxyMiddleware(object):  # 该为指定代理,暂未使用
+    # overwrite process request
+    def process_request(self, request, spider):
+        # Set the location of the proxy
+        request.meta['proxy'] = "http://110.157.171.11:9000"
+        print('-------------------------Trying to use proxy----------------------------')
+        # Use the following lines if your proxy requires authentication
+        proxy_user_pass = "USERNAME:PASSWORD"
+        # setup basic authentication for the proxy
+        encoded_user_pass = base64.encodestring(proxy_user_pass)
+        request.headers['Proxy-Authorization'] = 'Basic ' + encoded_user_pass
+
+
+class RotateUserAgentMiddleware(UserAgentMiddleware):  #轮换代理agent
+    def __init__(self, user_agent=''):
+        self.user_agent = user_agent
+
+    def process_request(self, request, spider):
+        ua = random.choice(self.user_agent_list)
+        if ua:
+            #print '-----------------------Using user-agent:', ua, '------------------------'
+            request.headers.setdefault('User-Agent', ua)
+
+            # the default user_agent_list composes chrome,I E,firefox,Mozilla,opera,netscape
+
+    # for more user agent strings,you can find it in http://www.useragentstring.com/pages/useragentstring.php
+    user_agent_list = [ \
+        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1" \
+        "Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11", \
+        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6", \
+        "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6", \
+        "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/19.77.34.5 Safari/537.1", \
+        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5", \
+        "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.36 Safari/536.5", \
+        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3", \
+        "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3", \
+        "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3", \
+        "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1062.0 Safari/536.3", \
+        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1062.0 Safari/536.3", \
+        "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3", \
+        "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3", \
+        "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3", \
+        "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.0 Safari/536.3", \
+        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.24 (KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24", \
+        "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.24 (KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24"
+    ]

+ 3104 - 0
scrapy_yzd/scrapy_yzd/pipelines.py

@@ -0,0 +1,3104 @@
+# -*- coding: utf-8 -*-
+
+# Define your item pipelines here
+#
+# Don't forget to add your pipeline to the ITEM_PIPELINES setting
+# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
+# from psycopg2._psycopg import IntegrityError
+# from peewee import IntegrityError
+from twisted.enterprise import adbapi
+import datetime
+from models import database, StZqOdds,StZqResultRecord,StZqResult,StZqCompetition,StZqLeague,StZqOddsRecord
+import time
+import hashlib
+import json
+
+
+import psycopg2
+
+import psycopg2.extras
+
+conn = psycopg2.connect(host='192.168.2.200', port=10432, user='kaiyou', password='123456', database='kaiyou')
+# database = PostgresqlDatabase('postgres', **{'host': '127.0.0.1', 'port': 5432, 'user': 'postgres', 'password': '9998877'})
+
+# conn = psycopg2.connect(host='127.0.0.1', port=5432, user='postgres', password='9998877', database='postgres')
+
+
+
+def inset_odd(match_id,value,utime,ctime,condition,p_id,wanfa):
+    if StZqOdds.filter(match_id=match_id):
+        for k, v in value.items():
+            st_zq_odd = StZqOdds.filter(match_id=match_id, odds_code=k,p_code=wanfa)
+            if st_zq_odd:
+                if v:
+                    StZqOdds.update(utime=utime, odds=v).where(StZqOdds.match_id == match_id,
+                                                                 StZqOdds.odds_code == k).execute()
+            else:
+                if v:
+                    StZqOdds.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
+                                      condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,odds_code=k)
+    else:
+        for k, v in value.items():
+            if v:
+                StZqOdds.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
+                                  condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,
+                                  odds_code=k)
+    # for k, v in value.items():
+        # if v:
+            # StZqOddsRecord.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
+            #                          condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,
+            #                          odds_code=k)
+
+
+
+def hash_func(match_id, odds_code, sort, p_id):
+    m = hashlib.md5()
+    a = str(match_id) + str(odds_code) + str(sort) + str(p_id)
+    m.update(a.encode('utf-8'))
+    c = m.hexdigest()
+    return c
+
+
+
+def new_time(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 ScrapyYzdPipeline(object):
+    #采用同步的机制写入pg
+    def __init__(self):
+        self.conn = database
+        self.cursor = self.conn.cursor()
+
+    def process_item(self, item, spider):
+        # print(item)
+        a = (dict(item))
+        # a = (dict(item))
+        # print(a)
+        #大小
+        concede_sizes = item.get('concede_size', "")
+        # print(concede_sizes)
+        if concede_sizes:
+            with database.atomic():
+                #key 联赛id
+                for key, value in concede_sizes.items():
+                    # 比赛日期
+                    data_game = value.pop('data_game').split("/")
+                    month = str(data_game[1].strip())
+                    day = str(data_game[0])
+                    # 比赛时间
+                    time_game = str(value.pop('time_game'))
+                    # 比赛时间,时间戳
+                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
+                    # match_date,match_time = new_time(ctime)
+                    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))#过期时间
+
+                    # 比赛id
+                    competition_id = value.pop('game_id')
+                    # 联赛id
+                    league_id = value.pop('league_id')
+                    # 联赛name
+                    league_name = value.pop('league_name')
+                    # 主队
+                    team_home = value.pop('team_home')
+                    # 客队
+                    team_guest = value.pop('team_guest')
+                    # 主队得分
+                    score_home = value.pop('score_home')  # match_score
+                    # 客队得分
+                    score_guest = value.pop('score_guest') # match_score  这两个字段要按数据库定义格式存入对应字段
+                    score_status  =  value.get('status','')#比赛状态
+                    if score_status == "True":
+                        score_status = 1
+                    else:
+                        score_status = 0
+
+                    # 全场让球
+                    # number
+                    number = value.pop('number')
+                    corner_ball = value.pop('corner_ball')#角球
+                    half_way = value.pop('half_way')
+                    concede_home = value.get('concede_home', "")
+                    concede_home_rule = value.get('concede_home_rule', "")
+                    concede_guest = value.get("concede_guest", "")
+                    concede_guest_rule = value.get("concede_guest_rule", "")
+                    # 上半场让球
+                    half_concede_home = value.get("half_concede_home", "")
+                    half_concede_home_rule = value.get("half_concede_home_rule", "")
+                    half_concede_guest = value.get("half_concede_guest", "")
+                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
+                    # 全场大小
+                    size_home = value.get('size_home')
+                    size_home_rule = value.get('size_home')
+                    size_guest = value.get('size_guest')
+                    size_guest_rule = value.get('size_guest_rule', "")
+                    # 上半场大小
+                    half_size_home = value.get('half_size_home', "")
+                    half_size_home_rule = value.get('half_size_home_rule', "")
+                    half_size_guest = value.get('half_size_guset', "")
+                    half_size_guest_rule = value.get('half_size_guest_rule', "")
+                    match_score = "{}:{}".format(score_home,score_guest)
+                    if StZqResult.filter(match_id=key):
+                        StZqResult.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResult.match_id == key).execute()
+
+                    else:
+                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535')
+                    # 如果角球存在
+                    # if corner_ball:
+                    #     wanfa = corner_ball
+                    #     p_id = 9
+                    # else:
+                    #     wanfa = "concede_size"
+                    #     p_id = 1
+
+                    #如果角球存在
+                    if corner_ball == "角球":
+                        p_code = "corner_ball"
+                        p_id = 9
+                    elif corner_ball == "会晋级":
+                        p_code = "promotion"
+                        p_id = 10
+                    elif corner_ball == "罚牌数":
+                        p_code = "Penalty_card"
+                        p_id = 12
+                    else:
+                        p_code = "concede_size"
+                        p_id = 1
+
+
+                    #全场让球条件
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
+
+
+                    if concede_guest:
+                        for index, result in enumerate(concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
+
+
+                    if half_concede_guest:
+                        for index, result in enumerate(half_concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime,lg_id=league_id,odds_only=odds_only,
+                                                      source='hg3535',expire_time=expire_time,
+                                                      max=half_concede_guest[index],
+                                                      condition=half_concede_guest_rule[index],
+                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
+
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
+
+
+
+                    if size_guest:
+                        for index, result in enumerate(size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+
+
+
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole==new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
+
+                    #赔率插入记录表
+
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())  # 赔率更新记录
+                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only1,
+                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
+                                                     condition=concede_guest_rule[index], odds=concede_guest[index],odds_only= odds_only2,
+                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',
+                                                     odds_code="concede_guest",sole=new_hash2)
+
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())  # 赔率更新记录
+                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,odds_only= odds_only1,
+                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime,lg_id=league_id,
+                                                     max=half_concede_guest[index],source='hg3535',odds_only = odds_only2,
+                                                     condition=half_concede_guest_rule[index],
+                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())  # 赔率更新记录
+                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=size_home_rule[index], odds=result, p_id=p_id,odds_only= odds_only1,
+                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,odds_only = odds_only2,
+                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',odds_only=odds_only,
+                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,lg_id=league_id,
+                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],odds_only=odds_only,
+                                                     p_id=p_id, p_code=p_code, sort=index,
+                                                     odds_code="half_size_guest",sole=new_hash)
+
+
+
+
+
+
+
+                    #赛事表
+                    if StZqCompetition.filter(match_id=key):
+                        StZqCompetition.update(utime=utime,status=score_status,tag=number,expire_time=expire_time).where(StZqCompetition.match_id == key).execute()
+                    else:
+                        StZqCompetition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,expire_time=expire_time)
+
+                    #联赛表插入 排除这个看看是否报事务异常这个在事务里的异常会向上抛出中断事务 不插这个表
+
+                    # if StZqLeague.filter(id=key):
+                    #     StZqLeague.update(name_chinese=league_name,area_id=league_id).where(StZqLeague.id == key).execute()
+                    # else:
+                    #     StZqLeague.create(id=league_id,name_chinese=league_name,kind=1,area_id=league_id)
+
+                    # 更新足球赛事赔率表
+                    # if StZqOdds.filter(match_id=key):
+                    #     StZqOdds.update(utime=utime,status=score_status,)
+                    # else:
+                    #     StZqOdds.create(match_id=key,odds_code=)
+
+
+                    #更新记录表 具体更新哪些值目前随便写未知
+                    if StZqResultRecord.filter(match_id=key):
+                        StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResultRecord.match_id == key).execute()
+                    else:
+                        StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,match_id=key,source='hg3535')
+
+
+
+
+
+
+
+                        # for k, v in value.items():
+                        #     if v:
+                        #         for index, result in enumerate(v):
+                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
+                        #             if st_zq_odd:
+                        #                 if result:
+                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
+                        #             else:
+                        #                 if result:
+                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
+                    # else:
+                    #     for k, v in value.items():
+                    #         if v:
+                    #             for index, result in enumerate(v):
+                    #                 if result:
+                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
+
+
+        capot = item.get('capot', "")
+        # print(capot)
+        if capot:
+            with database.atomic():
+                #key 联赛id
+                for key, value in capot.items():
+                    data_game = value.pop('data_game')
+                    month = str(data_game[1].strip())
+                    day = str(data_game[0])
+                    # 比赛时间
+                    time_game = str(value.pop('time_game'))
+                    # 比赛时间,时间戳
+                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
+                    # match_date,match_time = new_time(ctime)
+                    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))#过期时间
+                    # 比赛id
+                    competition_id = value.pop('game_id')
+                    # 联赛id
+                    league_id = value.pop('league_id')
+                    # 联赛name
+                    league_name = value.pop('league_name')
+                    # 主队
+                    team_home = value.pop('team_home')
+                    # 客队
+                    team_guest = value.pop('team_guest')
+                    # 主队得分
+                    score_home = value.pop('score_home')
+                    # 客队得分
+                    score_guest = value.pop('score_guest')
+                    # 全场让球
+                    # number
+                    number = value.pop('number')
+                    corner_ball = value.pop('corner_ball')
+                    half_way = value.pop('half_way')
+                    concede_home = value.get('concede_home', "")
+                    concede_home_rule = value.get('concede_home_rule', "")
+                    concede_guest = value.get("concede_guest", "")
+                    concede_guest_rule = value.get("concede_guest_rule", "")
+                    # 上半场让球
+                    half_concede_home = value.get("half_concede_home", "")
+                    half_concede_home_rule = value.get("half_concede_home_rule", "")
+                    half_concede_guest = value.get("half_concede_guest", "")
+                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
+                    # 全场大小
+                    size_home = value.get('size_home')
+                    size_home_rule = value.get('size_home')
+                    size_guest = value.get('size_guest')
+                    size_guest_rule = value.get('size_guest_rule', "")
+                    # 上半场大小
+                    half_size_home = value.get('half_size_home', "")
+                    half_size_home_rule = value.get('half_size_home_rule', "")
+                    half_size_guest = value.get('half_size_guset', "")
+                    half_size_guest_rule = value.get('half_size_guest_rule', "")
+                    score_status  =  value.get('status','')
+                    if score_status == "True":
+                        score_status = 1
+                    else:
+                        score_status = 0
+
+                    match_score = "{}:{}".format(score_home,score_guest)
+
+
+                    if StZqResult.filter(match_id=key):
+                        StZqResult.update(match_score=match_score,update_time=utime, status=score_status).where(StZqResult.match_id == key).execute()
+                    else:
+                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535')
+
+
+                    #如果角球存在
+                    if corner_ball == "角球":
+                        p_code = "corner_ball"
+                        p_id = 9
+                    elif corner_ball == "会晋级":
+                        p_code = "promotion"
+                        p_id = 10
+                    elif corner_ball == "罚牌数":
+                        p_code = "Penalty_card"
+                        p_id = 12
+                    else:
+                        p_code = "capot"
+                        p_id = 2
+
+
+                    #全场让球条件
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
+
+
+                    if concede_guest:
+                        for index, result in enumerate(concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
+
+
+                    if half_concede_guest:
+                        for index, result in enumerate(half_concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                      max=half_concede_guest[index],expire_time=expire_time,
+                                                      condition=half_concede_guest_rule[index],
+                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
+
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
+
+
+
+                    if size_guest:
+                        for index, result in enumerate(size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+
+
+
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole==new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,odds_only=odds_only,
+                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
+
+                    #赔率插入记录表
+
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())  # 赔率更新记录
+                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only1,
+                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=concede_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,odds_only=odds_only2,
+                                                     odds_code="concede_guest",sole=new_hash2)
+
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())  # 赔率更新记录
+                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only1,
+                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
+                                                     max=half_concede_guest[index],odds_only=odds_only2,
+                                                     condition=half_concede_guest_rule[index],
+                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())  # 赔率更新记录
+                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=size_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only1,
+                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,odds_only=odds_only2,
+                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,odds_only=odds_only,
+                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())  # 赔率更新记录
+                            StZqOddsRecord.create(match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],source='hg3535',odds_only=odds_only,
+                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],lg_id=league_id,
+                                                     p_id=p_id, p_code=p_code, sort=index,
+                                                     odds_code="half_size_guest",sole=new_hash)
+
+
+
+
+                    #赛事表
+                    if StZqCompetition.filter(match_id=key):
+                        StZqCompetition.update(utime=utime,status=score_status,tag=number,expire_time=expire_time).where(StZqCompetition.match_id == key).execute()
+                    else:
+                        StZqCompetition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,expire_time=expire_time)
+
+
+                    #更新记录表 具体更新哪些值目前随便写未知
+                    if StZqResultRecord.filter(match_id=key):
+                        StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResultRecord.match_id == key).execute()
+                    else:
+                        StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,match_id=key,source='hg3535')
+
+
+
+                        # for k, v in value.items():
+                        #     if v:
+                        #         for index, result in enumerate(v):
+                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
+                        #             if st_zq_odd:
+                        #                 if result:
+                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
+                        #             else:
+                        #                 if result:
+                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
+                    # else:
+                    #     for k, v in value.items():
+                    #         if v:
+                    #             for index, result in enumerate(v):
+                    #                 if result:
+                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
+
+        #入球数
+        odd_even = item.get('odd_even', "")
+        if odd_even:
+            with database.atomic():
+                #key 联赛id
+                for key, value in odd_even.items():
+                    # 比赛日期
+                    data_game = value.pop('data_game').split("/")
+                    month = str(data_game[1].strip())
+                    day = str(data_game[0])
+                    # 比赛时间
+                    time_game = str(value.pop('time_game'))
+                    # 比赛时间,时间戳
+                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
+                    # match_date,match_time = new_time(ctime)
+                    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))#过期时间
+                    # 比赛id
+                    competition_id = value.pop('game_id')
+                    # 联赛id
+                    league_id = value.pop('league_id')
+
+                    #全场单
+                    odd_even_odd = value.get("odd_even_odd", "")
+                    #全场双
+                    odd_even_even = value.get("odd_even_even", "")
+
+                    #上半场单
+                    half_odd_even_odd = value.get("half_odd_even_odd","")
+
+                    #上半场双
+                    half_odd_even_even = value.get("half_odd_even_even", "")
+
+
+                    # 联赛name
+                    league_name = value.pop('league_name')
+                    # 主队
+                    team_home = value.pop('team_home')
+                    # 客队
+                    team_guest = value.pop('team_guest')
+                    # 主队得分
+                    score_home = value.pop('score_home')
+                    # 客队得分
+                    score_guest = value.pop('score_guest')
+                    # 全场让球
+                    # number
+                    number = value.pop('number')
+                    corner_ball = value.pop('corner_ball')
+                    half_way = value.pop('half_way')
+                    concede_home = value.get('concede_home', "")
+                    concede_home_rule = value.get('concede_home_rule', "")
+                    concede_guest = value.get("concede_guest", "")
+                    concede_guest_rule = value.get("concede_guest_rule", "")
+                    # 上半场让球
+                    half_concede_home = value.get("half_concede_home", "")
+                    half_concede_home_rule = value.get("half_concede_home_rule", "")
+                    half_concede_guest = value.get("half_concede_guest", "")
+                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
+                    # 全场大小
+                    size_home = value.get('size_home')
+                    size_home_rule = value.get('size_home')
+                    size_guest = value.get('size_guest')
+                    size_guest_rule = value.get('size_guest_rule', "")
+                    # 上半场大小
+                    half_size_home = value.get('half_size_home', "")
+                    half_size_home_rule = value.get('half_size_home_rule', "")
+                    half_size_guest = value.get('half_size_guset', "")
+                    half_size_guest_rule = value.get('half_size_guest_rule', "")
+                    score_status  =  value.pop('status')#比赛状态
+                    if score_status == "True":
+                        score_status = 1
+                    else:
+                        score_status = 0
+
+                    match_score = "{}:{}".format(score_home,score_guest)
+
+                    if StZqResult.filter(match_id=key):
+                        StZqResult.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResult.match_id == key).execute()
+                    else:
+                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535')
+
+                    #如果角球存在
+                    if corner_ball == "角球":
+                        p_code = "corner_ball"
+                        p_id = 9
+                    elif corner_ball == "会晋级":
+                        p_code = "promotion"
+                        p_id = 10
+                    elif corner_ball == "罚牌数":
+                        p_code = "Penalty_card"
+                        p_id = 12
+                    else:
+                        p_code = "odd_even"
+                        p_id = 3
+
+                        #odd even 单   另外的是刷过 改condition 条件为 double
+                    if odd_even_odd:
+                        for index, result in enumerate(odd_even_odd):
+                            new_hash = hash_func(match_id=key, odds_code="one_sides_single", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            #更新赔率记录表
+                            if result == '.':
+                                result = 0
+                            StZqOddsRecord.create(odds_only=odds_only,lg_id=league_id,odds_code="odd_even",match_id=key,ctime=utime,utime=utime,odds=result,p_id=p_id,p_code=p_code,sort=index,source="hg3535",condition="单")
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:  #sort的值?
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime,source='hg3535',expire_time=expire_time,odds_only=odds_only,
+                                                          condition="单", odds=result, p_id=p_id,lg_id=league_id,odds_code="two_sides_single",
+                                                          p_code=p_code, sort=index,sole=new_hash)
+
+
+
+
+
+                        #双
+                    if odd_even_even:
+                        for index,result in enumerate(odd_even_even):
+                            new_hash = hash_func(match_id=key, odds_code="two_sides_double", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            #更新赔率记录表
+                            if result == '.':
+                                result = 0
+                            StZqOddsRecord.create(odds_only=odds_only,lg_id=league_id,odds_code="two_sides_double",match_id=key,ctime=utime,utime=utime,max=result,odds=result,p_id=p_id,p_code=p_code,sort=index,source="hg3535",condition="双")
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',expire_time=expire_time,
+                                                          condition="双", odds=result, p_id=p_id,lg_id=league_id,odds_code="two_sides_double",
+                                                          p_code=p_code, sort=index,sole=new_hash,odds_only=odds_only)
+
+
+                       #上半场单
+                    if half_odd_even_odd:
+                        for index,result in enumerate(half_odd_even_odd):
+                            new_hash = hash_func(match_id=key, odds_code="half_two_sides_single", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            if result == '.':
+                                result = 0
+                            #更新赔率记录表
+                            StZqOddsRecord.create(odds_only=odds_only,lg_id=league_id,odds_code="half_two_sides_single",match_id=key,ctime=utime,utime=utime,max=result,odds=result,p_id=p_id,p_code=p_code,sort=index,source="hg3535",condition="单")
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result, expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key,ctime=utime, utime=utime,max=result,source='hg3535',expire_time=expire_time,
+                                                        condition="单", odds=result, p_id=p_id,lg_id=league_id,odds_code="half_two_sides_single",
+                                                          p_code=p_code, sort=index,sole=new_hash)
+
+
+
+                    #上半场双
+                    if half_odd_even_even:
+                        for index,result in enumerate(half_odd_even_even):
+                            new_hash = hash_func(match_id=key, odds_code="half_two_sides_double", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            #更新赔率记录表
+                            if result == '.':
+                                result = 0
+                            StZqOddsRecord.create(odds_only=odds_only,lg_id=league_id,odds_code="half_two_sides_double",match_id=key,ctime=utime,utime=utime,max=result,odds=result,p_id=p_id,p_code=p_code,sort=index,source="hg3535",condition="双")
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result, expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key,ctime=utime, utime=utime,max=result,source='hg3535',expire_time=expire_time,
+                                                        condition="双", odds=result, p_id=p_id,lg_id=league_id,odds_code="half_two_sides_double",
+                                                          p_code=p_code, sort=index,sole=new_hash)
+
+
+
+
+
+
+
+
+
+
+
+                    # 全场入球数 单双
+                    # if odd_even_odd:
+                    #     # 构建唯一索引
+                    #     new_hash = hash_func(match_id=competition_id, odds_code="two_sides_single", sort=0, p_id=p_id)
+                    #     # 更新主队st_zq_odds表
+                    #     odd_even_odd_sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values ( %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s,%s)on conflict(sole) do update set utime = %s,odds = %s;"
+                    #     cursor.execute(odd_even_odd_sql1, (
+                    #         int(league_id), "two_sides_single", int(competition_id), utime, utime, odd_even_odd, odd_even_odd, p_id,
+                    #         p_code, 0, "hg3535", new_hash, "single", utime, odd_even_odd))
+                    #     # 更新主队st_zq_odds_record表
+                    #     odd_even_odd_sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s);"
+                    #     cursor.execute(odd_even_odd_sql2, (
+                    #         int(league_id), "two_sides_single", int(competition_id), utime, utime, odd_even_odd, odd_even_odd, p_id,
+                    #         p_code, 0, "hg3535", "single"))
+                    #
+                    #     new_hash1 = hash_func(match_id=competition_id, odds_code="two_sides_double", sort=0, p_id=p_id)
+                    #     # 更新主队st_zq_odds表
+                    #     odd_even_even_sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s)on conflict(sole) do update set utime = %s,odds = %s;"
+                    #     cursor.execute(odd_even_odd_sql1, (
+                    #         int(league_id), "two_sides_double", int(competition_id), utime, utime, odd_even_even, odd_even_even, p_id,
+                    #         p_code, 0, "hg3535", new_hash1, "double", utime, odd_even_even))
+                    #     # 更新主队st_zq_odds_record表
+                    #     odd_even_even_sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+                    #     cursor.execute(odd_even_odd_sql2, (
+                    #         int(league_id), "two_sides_double", int(competition_id), utime, utime, odd_even_even, odd_even_even, p_id,
+                    #         p_code, 0, "hg3535", "double"))
+
+
+
+
+                    #全场让球条件
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',expire_time=expire_time,
+                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,lg_id=league_id,
+                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
+
+
+                    if concede_guest:
+                        for index, result in enumerate(concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
+
+
+                    if half_concede_guest:
+                        for index, result in enumerate(half_concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
+                                                      max=half_concede_guest[index],expire_time=expire_time,odds_only=odds_only,
+                                                      condition=half_concede_guest_rule[index],
+                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
+
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
+
+
+
+                    if size_guest:
+                        for index, result in enumerate(size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+
+
+
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(utime=utime, odds=result,expire_time=expire_time,odds_only=odds_only).where(StZqOdds.sole==new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
+
+                    #赔率插入记录表
+
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',
+                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only= odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,
+                                                     odds_code="concede_guest",sole=new_hash2)
+
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,lg_id=league_id,
+                                                     max=half_concede_guest[index],
+                                                     source='hg3535',
+                                                     condition=half_concede_guest_rule[index],
+                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+
+                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],lg_id=league_id,
+                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',
+                                                     odds_code="half_size_guest",sole=new_hash)
+
+
+
+
+
+
+                    #赛事表
+                    if StZqCompetition.filter(match_id=key):
+                        StZqCompetition.update(expire_time= expire_time,utime=utime,status=score_status,tag=number).where(StZqCompetition.match_id == key).execute()
+                    else:
+                        StZqCompetition.create(expire_time= expire_time,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game)
+
+
+                    #更新记录表 具体更新哪些值目前随便写未知
+                    if StZqResultRecord.filter(match_id=key):
+                        StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResultRecord.match_id == key).execute()
+                    else:
+                        StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,match_id=key,source='hg3535')
+
+
+
+
+
+
+                        # for k, v in value.items():
+                        #     if v:
+                        #         for index, result in enumerate(v):
+                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
+                        #             if st_zq_odd:
+                        #                 if result:
+                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
+                        #             else:
+                        #                 if result:
+                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
+                    # else:
+                    #     for k, v in value.items():
+                    #         if v:
+                    #             for index, result in enumerate(v):
+                    #                 if result:
+                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
+
+        total_goal = item.get('total_goal', "")
+        if total_goal:
+            with database.atomic():
+                #key 联赛id
+                for key, value in total_goal.items():
+                    # 比赛日期
+                    data_game = value.pop('data_game').split("/")
+                    month = str(data_game[1].strip())
+                    day = str(data_game[0])
+                    # 比赛时间
+                    time_game = str(value.pop('time_game'))
+                    # 比赛时间,时间戳
+                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
+                    # match_date,match_time = new_time(ctime)
+                    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))#过期时间
+                    # 比赛id
+                    competition_id = value.pop('game_id')
+                    # 联赛id
+                    league_id = value.pop('league_id')
+                    # 联赛name
+                    league_name = value.pop('league_name')
+                    # 主队
+                    team_home = value.pop('team_home')
+                    # 客队
+                    team_guest = value.pop('team_guest')
+                    # 主队得分
+                    score_home = value.pop('score_home')
+                    # 客队得分
+                    score_guest = value.pop('score_guest')
+                    # 全场让球
+                    # number
+                    number = value.pop('number')
+                    corner_ball = value.pop('corner_ball')
+                    half_way = value.pop('half_way')
+                    concede_home = value.get('concede_home', "")
+                    concede_home_rule = value.get('concede_home_rule', "")
+                    concede_guest = value.get("concede_guest", "")
+                    concede_guest_rule = value.get("concede_guest_rule", "")
+                    # 上半场让球
+                    half_concede_home = value.get("half_concede_home", "")
+                    half_concede_home_rule = value.get("half_concede_home_rule", "")
+                    half_concede_guest = value.get("half_concede_guest", "")
+                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
+                    # 全场大小
+                    size_home = value.get('size_home')
+                    size_home_rule = value.get('size_home')
+                    size_guest = value.get('size_guest')
+                    size_guest_rule = value.get('size_guest_rule', "")
+                    # 上半场大小
+                    half_size_home = value.get('half_size_home', "")
+                    half_size_home_rule = value.get('half_size_home_rule', "")
+                    half_size_guest = value.get('half_size_guset', "")
+                    half_size_guest_rule = value.get('half_size_guest_rule', "")
+                    score_status  =  value.get('status',"")#比赛状态
+
+                    if score_status == "True":
+                        score_status = 1
+                    else:
+                        score_status = 0
+
+                    match_score = "{}:{}".format(score_home,score_guest)
+
+                    if StZqResult.filter(match_id=key):
+                        StZqResult.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResult.match_id == key).execute()
+                    else:
+                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535')
+
+
+                    #如果角球存在
+                    if corner_ball == "角球":
+                        p_code = "corner_ball"
+                        p_id = 9
+                    elif corner_ball == "会晋级":
+                        p_code = "promotion"
+                        p_id = 10
+                    elif corner_ball == "罚牌数":
+                        p_code = "Penalty_card"
+                        p_id = 12
+                    else:
+                        p_code = "total_goal"
+                        p_id = 4
+
+
+                    #全场让球条件
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
+
+
+                    if concede_guest:
+                        for index, result in enumerate(concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
+
+
+                    if half_concede_guest:
+                        for index, result in enumerate(half_concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime,lg_id=league_id,expire_time=expire_time,
+                                                      source='hg3535',
+                                                      max=half_concede_guest[index],
+                                                      condition=half_concede_guest_rule[index],
+                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
+
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
+
+
+
+                    if size_guest:
+                        for index, result in enumerate(size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+
+
+
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole==new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
+
+                    #赔率插入记录表
+
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
+                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',
+                                                     odds_code="concede_guest",sole=new_hash2)
+
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
+                                                     max=half_concede_guest[index],
+                                                     condition=half_concede_guest_rule[index],
+                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',
+                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,lg_id=league_id,
+                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],lg_id=league_id,
+                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',
+                                                     odds_code="half_size_guest",sole=new_hash)
+
+
+
+
+                    #赛事表
+                    if StZqCompetition.filter(match_id=key):
+                        StZqCompetition.update(is_rollball=1,utime=utime,status=score_status,tag=number,expire_time=expire_time).where(StZqCompetition.match_id == key).execute()
+                    else:
+                        StZqCompetition.create(is_rollball=1,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game,expire_time=expire_time)
+
+
+                    #更新记录表 具体更新哪些值目前随便写未知
+                    if StZqResultRecord.filter(match_id=key):
+                        StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResultRecord.match_id == key).execute()
+                    else:
+                        StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,match_id=key,source='hg3535')
+
+
+
+
+
+
+                        # for k, v in value.items():
+                        #     if v:
+                        #         for index, result in enumerate(v):
+                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
+                        #             if st_zq_odd:
+                        #                 if result:
+                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
+                        #             else:
+                        #                 if result:
+                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
+                    # else:
+                    #     for k, v in value.items():
+                    #         if v:
+                    #             for index, result in enumerate(v):
+                    #                 if result:
+                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
+
+        half_full = item.get('half_full', "")
+        if half_full:
+            with database.atomic():
+                #key 联赛id
+                for key, value in half_full.items():
+                    # 比赛日期
+                    data_game = value.pop('data_game').split("/")
+                    month = str(data_game[1].strip())
+                    day = str(data_game[0])
+                    # 比赛时间
+                    time_game = str(value.pop('time_game'))
+                    # 比赛时间,时间戳
+                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
+                    # match_date,match_time = new_time(ctime)
+                    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))#过期时间
+                    # 比赛id
+                    competition_id = value.pop('game_id')
+                    # 联赛id
+                    league_id = value.pop('league_id')
+                    # 联赛name
+                    league_name = value.pop('league_name')
+                    # 主队
+                    team_home = value.pop('team_home')
+                    # 客队
+                    team_guest = value.pop('team_guest')
+                    # 主队得分
+                    score_home = value.pop('score_home')
+                    # 客队得分
+                    score_guest = value.pop('score_guest')
+                    # 全场让球
+                    # number
+                    number = value.pop('number')
+                    corner_ball = value.pop('corner_ball')
+                    half_way = value.pop('half_way')
+                    concede_home = value.get('concede_home', "")
+                    concede_home_rule = value.get('concede_home_rule', "")
+                    concede_guest = value.get("concede_guest", "")
+                    concede_guest_rule = value.get("concede_guest_rule", "")
+                    # 上半场让球
+                    half_concede_home = value.get("half_concede_home", "")
+                    half_concede_home_rule = value.get("half_concede_home_rule", "")
+                    half_concede_guest = value.get("half_concede_guest", "")
+                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
+                    # 全场大小
+                    size_home = value.get('size_home')
+                    size_home_rule = value.get('size_home')
+                    size_guest = value.get('size_guest')
+                    size_guest_rule = value.get('size_guest_rule', "")
+                    # 上半场大小
+                    half_size_home = value.get('half_size_home', "")
+                    half_size_home_rule = value.get('half_size_home_rule', "")
+                    half_size_guest = value.get('half_size_guset', "")
+                    half_size_guest_rule = value.get('half_size_guest_rule', "")
+                    score_status  =  value.get('status','')#比赛状态
+                    if score_status == "True":
+                        score_status = 1
+                    else:
+                        score_status = 0
+
+                    match_score = "{}:{}".format(score_home,score_guest)
+
+                    if StZqResult.filter(match_id=key):
+                        StZqResult.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResult.match_id == key).execute()
+                    else:
+                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535')
+
+
+                    #如果角球存在
+                    if corner_ball == "角球":
+                        p_code = "corner_ball"
+                        p_id = 9
+                    elif corner_ball == "会晋级":
+                        p_code = "promotion"
+                        p_id = 10
+                    elif corner_ball == "罚牌数":
+                        p_code = "Penalty_card"
+                        p_id = 12
+                    else:
+                        p_code = "half_full"
+                        p_id = 5
+
+
+                    #全场让球条件
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
+
+
+                    if concede_guest:
+                        for index, result in enumerate(concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
+
+
+                    if half_concede_guest:
+                        for index, result in enumerate(half_concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,expire_time=expire_time,
+                                                      max=half_concede_guest[index],
+                                                      condition=half_concede_guest_rule[index],
+                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
+
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,expire_time=expire_time,
+                                                      condition=size_home_rule[index], odds=result, p_id=p_id,
+                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
+
+
+
+                    if size_guest:
+                        for index, result in enumerate(size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+
+
+
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole==new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
+
+                    #赔率插入记录表
+
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',
+                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
+                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',
+                                                     odds_code="concede_guest",sole=new_hash2)
+
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,lg_id=league_id,
+                                                     max=half_concede_guest[index],source='hg3535',
+                                                     condition=half_concede_guest_rule[index],
+                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],lg_id=league_id,
+                                                     source='hg3535',
+                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,
+                                                     odds_code="half_size_guest",sole=new_hash)
+
+
+
+
+                    #赛事表
+                    if StZqCompetition.filter(match_id=key):
+                        StZqCompetition.update(is_rollball=1,utime=utime,status=score_status,tag=number,expire_time=expire_time).where(StZqCompetition.match_id == key).execute()
+                    else:
+                        StZqCompetition.create(is_rollball=1,expire_time=expire_time,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game)
+
+
+                    #更新记录表 具体更新哪些值目前随便写未知
+                    if StZqResultRecord.filter(match_id=key):
+                        StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResultRecord.match_id == key).execute()
+                    else:
+                        StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,match_id=key,source='hg3535')
+
+
+
+
+
+
+                        # for k, v in value.items():
+                        #     if v:
+                        #         for index, result in enumerate(v):
+                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
+                        #             if st_zq_odd:
+                        #                 if result:
+                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
+                        #             else:
+                        #                 if result:
+                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
+                    # else:
+                    #     for k, v in value.items():
+                    #         if v:
+                    #             for index, result in enumerate(v):
+                    #                 if result:
+                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
+
+        bodan = item.get('bodan', "")
+        if bodan:
+            with database.atomic():
+                #key 联赛id
+                for key, value in bodan.items():
+                    # 比赛日期
+                    data_game = value.pop('data_game').split("/")
+                    month = str(data_game[1].strip())
+                    day = str(data_game[0])
+                    # 比赛时间
+                    time_game = str(value.pop('time_game'))
+                    # 比赛时间,时间戳
+                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
+                    # match_date,match_time = new_time(ctime)
+                    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))#过期时间
+                    # 比赛id
+                    competition_id = value.pop('game_id')
+                    # 联赛id
+                    league_id = value.pop('league_id')
+                    # 联赛name
+                    league_name = value.pop('league_name')
+                    # 主队
+                    team_home = value.pop('team_home')
+                    # 客队
+                    team_guest = value.pop('team_guest')
+                    # 主队得分
+                    score_home = value.pop('score_home')
+                    # 客队得分
+                    score_guest = value.pop('score_guest')
+                    # 全场让球
+                    # number
+                    number = value.pop('number')
+                    corner_ball = value.pop('corner_ball')
+                    half_way = value.pop('half_way')
+                    concede_home = value.get('concede_home', "")
+                    concede_home_rule = value.get('concede_home_rule', "")
+                    concede_guest = value.get("concede_guest", "")
+                    concede_guest_rule = value.get("concede_guest_rule", "")
+                    # 上半场让球
+                    half_concede_home = value.get("half_concede_home", "")
+                    half_concede_home_rule = value.get("half_concede_home_rule", "")
+                    half_concede_guest = value.get("half_concede_guest", "")
+                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
+                    # 全场大小
+                    size_home = value.get('size_home')
+                    size_home_rule = value.get('size_home')
+                    size_guest = value.get('size_guest')
+                    size_guest_rule = value.get('size_guest_rule', "")
+                    # 上半场大小
+                    half_size_home = value.get('half_size_home', "")
+                    half_size_home_rule = value.get('half_size_home_rule', "")
+                    half_size_guest = value.get('half_size_guset', "")
+                    half_size_guest_rule = value.get('half_size_guest_rule', "")
+                    score_status  =  value.get('status','')#比赛状态
+                    if score_status == "True":
+                        score_status = 1
+                    else:
+                        score_status = 0
+
+                    match_score = "{}:{}".format(score_home,score_guest)
+                    if StZqResult.filter(match_id=key):
+                        StZqResult.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResult.match_id == key).execute()
+                    else:
+                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535')
+
+
+                    #如果角球存在
+                    if corner_ball == "角球":
+                        p_code = "corner_ball"
+                        p_id = 9
+                    elif corner_ball == "会晋级":
+                        p_code = "promotion"
+                        p_id = 10
+                    elif corner_ball == "罚牌数":
+                        p_code = "Penalty_card"
+                        p_id = 12
+                    else:
+                        p_code = "bodan"
+                        p_id = 6
+
+
+                    #全场让球条件
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
+
+
+                    if concede_guest:
+                        for index, result in enumerate(concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
+
+
+                    if half_concede_guest:
+                        for index, result in enumerate(half_concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,expire_time=expire_time,
+                                                      max=half_concede_guest[index],
+                                                      condition=half_concede_guest_rule[index],
+                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
+
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
+
+
+
+                    if size_guest:
+                        for index, result in enumerate(size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+
+
+
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only = new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole==new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
+
+                    #赔率插入记录表
+
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
+                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',
+                                                     odds_code="concede_guest",sole=new_hash2)
+
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',
+                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,lg_id=league_id,
+                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
+                                                     max=half_concede_guest[index],
+                                                     condition=half_concede_guest_rule[index],
+                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only1 = new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only2 = new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],source='hg3535',
+                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],lg_id=league_id,
+                                                     p_id=p_id, p_code=p_code, sort=index,
+                                                     odds_code="half_size_guest",sole=new_hash)
+
+
+
+
+
+                    #赛事表
+                    if StZqCompetition.filter(match_id=key):
+                        StZqCompetition.update(is_rollball=1,expire_time=expire_time,utime=utime,status=score_status,tag=number).where(StZqCompetition.match_id == key).execute()
+                    else:
+                        StZqCompetition.create(is_rollball=1,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game)
+
+
+                    #更新记录表 具体更新哪些值目前随便写未知
+                    if StZqResultRecord.filter(match_id=key):
+                        StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResultRecord.match_id == key).execute()
+                    else:
+                        StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,match_id=key,source='hg3535')
+
+
+
+
+
+
+                        # for k, v in value.items():
+                        #     if v:
+                        #         for index, result in enumerate(v):
+                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
+                        #             if st_zq_odd:
+                        #                 if result:
+                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
+                        #             else:
+                        #                 if result:
+                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
+                    # else:
+                    #     for k, v in value.items():
+                    #         if v:
+                    #             for index, result in enumerate(v):
+                    #                 if result:
+                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
+
+        first_last_ball = item.get('first_last_ball', "")
+        if first_last_ball:
+            with database.atomic():
+                #key 联赛id
+                for key, value in first_last_ball.items():
+                    # 比赛日期
+                    data_game = value.pop('data_game').split("/")
+                    month = str(data_game[1].strip())
+                    day = str(data_game[0])
+                    # 比赛时间
+                    time_game = str(value.pop('time_game'))
+                    # 比赛时间,时间戳
+                    ctime = "2019" + "-" + month + "-" + day + "" + time_game + ":00"  #创建时间
+                    # match_date,match_time = new_time(ctime)
+                    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))#过期时间
+                    # 比赛id
+                    competition_id = value.pop('game_id')
+                    # 联赛id
+                    league_id = value.pop('league_id')
+                    # 联赛name
+                    league_name = value.pop('league_name')
+                    # 主队
+                    team_home = value.pop('team_home')
+                    # 客队
+                    team_guest = value.pop('team_guest')
+                    # 主队得分
+                    score_home = value.pop('score_home')
+                    # 客队得分
+                    score_guest = value.pop('score_guest')
+                    # 全场让球
+                    # number
+                    number = value.pop('number')
+                    corner_ball = value.pop('corner_ball')
+                    half_way = value.pop('half_way')
+                    concede_home = value.get('concede_home', "")
+                    concede_home_rule = value.get('concede_home_rule', "")
+                    concede_guest = value.get("concede_guest", "")
+                    concede_guest_rule = value.get("concede_guest_rule", "")
+                    # 上半场让球
+                    half_concede_home = value.get("half_concede_home", "")
+                    half_concede_home_rule = value.get("half_concede_home_rule", "")
+                    half_concede_guest = value.get("half_concede_guest", "")
+                    half_concede_guest_rule = value.get("half_concede_guest_rule", "")
+                    # 全场大小
+                    size_home = value.get('size_home')
+                    size_home_rule = value.get('size_home')
+                    size_guest = value.get('size_guest')
+                    size_guest_rule = value.get('size_guest_rule', "")
+                    # 上半场大小
+                    half_size_home = value.get('half_size_home', "")
+                    half_size_home_rule = value.get('half_size_home_rule', "")
+                    half_size_guest = value.get('half_size_guset', "")
+                    half_size_guest_rule = value.get('half_size_guest_rule', "")
+                    score_status  =  value.get('status','')#比赛状态
+                    if score_status:
+                        score_status = 1
+                    else:
+                        score_status = 0
+
+                    match_score = "{}:{}".format(score_home,score_guest)
+                    if StZqResult.filter(match_id=key):
+                        StZqResult.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResult.match_id == key).execute()
+                    else:
+                        StZqResult.create(match_id=key,match_score=match_score,home_team=team_home, guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,lg_id=league_id,u_home_score=0,u_guest_score=0,source='hg3535')
+
+                    #如果角球存在
+                    if corner_ball == "角球":
+                        p_code = "corner_ball"
+                        p_id = 9
+                    elif corner_ball == "会晋级":
+                        p_code = "promotion"
+                        p_id = 10
+                    elif corner_ball == "罚牌数":
+                        p_code = "Penalty_card"
+                        p_id = 12
+                    else:
+                        p_code = "first_last_ball"
+                        p_id = 7
+
+
+                    #全场让球条件
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash)
+
+
+                    if concede_guest:
+                        for index, result in enumerate(concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=concede_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="concede_guest",sole=new_hash)
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_concede_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_concede_home", sole=new_hash)
+
+
+                    if half_concede_guest:
+                        for index, result in enumerate(half_concede_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
+                                                      max=half_concede_guest[index],expire_time=expire_time,
+                                                      condition=half_concede_guest_rule[index],
+                                                      odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                      sort=index, odds_code="half_concede_guest", sole=new_hash)
+
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_home", sole=new_hash)
+
+
+
+                    if size_guest:
+                        for index, result in enumerate(size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                      condition=size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                      p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole == new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_home_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+
+
+
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            st_zq_odd = StZqOdds.filter(sole=new_hash)
+                            if st_zq_odd:
+                                StZqOdds.update(odds_only=odds_only,utime=utime, odds=result,expire_time=expire_time).where(StZqOdds.sole==new_hash).execute()
+                            else:
+                                StZqOdds.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                  condition=half_size_guest_rule[index], odds=result, p_id=p_id,expire_time=expire_time,
+                                                  p_code=p_code, sort=index, odds_code="half_size_guest",sole=new_hash)
+
+                    #赔率插入记录表
+
+                    if concede_home:
+                        for index, result in enumerate(concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="concede_home", sort=index, p_id=p_id)
+                            odds_only1= new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="concede_guest", sort=index, p_id=p_id)
+                            odds_only2= new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=concede_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=concede_guest[index],lg_id=league_id,
+                                                     condition=concede_guest_rule[index], odds=concede_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,source='hg3535',
+                                                     odds_code="concede_guest",sole=new_hash2)
+
+
+                    if half_concede_home:
+                        for index, result in enumerate(half_concede_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="half_concede_home", sort=index, p_id=p_id)
+                            odds_only1= new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="half_concede_guest", sort=index, p_id=p_id)
+                            odds_only2= new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_concede_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="half_concede_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime,source='hg3535',lg_id=league_id,
+                                                     max=half_concede_guest[index],
+                                                     condition=half_concede_guest_rule[index],
+                                                     odds=half_concede_guest[index], p_id=p_id, p_code=p_code,
+                                                     sort=index, odds_code="half_concede_guest",sole=new_hash2)
+
+
+                    if size_home:
+                        for index, result in enumerate(size_home):
+                            new_hash1 = hash_func(match_id=key, odds_code="size_home", sort=index, p_id=p_id)
+                            odds_only1= new_hash1 + str(time.time())
+                            new_hash2 = hash_func(match_id=key, odds_code="size_guest", sort=index, p_id=p_id)
+                            odds_only2= new_hash2 + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only1,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="size_home",sole=new_hash1)
+                            StZqOddsRecord.create(odds_only=odds_only2,match_id=key, ctime=utime, utime=utime, max=size_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=size_guest_rule[index], odds=size_guest[index], p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="size_guest",sole=new_hash2)
+
+
+                    if half_size_home:
+                        for index, result in enumerate(half_size_home):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_home", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=result,source='hg3535',lg_id=league_id,
+                                                     condition=half_size_home_rule[index], odds=result, p_id=p_id,
+                                                     p_code=p_code, sort=index, odds_code="half_size_home",sole=new_hash)
+                    if half_size_guest:
+                        for index, result in enumerate(half_size_guest):
+                            new_hash = hash_func(match_id=key, odds_code="half_size_guest", sort=index, p_id=p_id)
+                            odds_only= new_hash + str(time.time())
+                            StZqOddsRecord.create(odds_only=odds_only,match_id=key, ctime=utime, utime=utime, max=half_size_guest[index],source='hg3535',lg_id=league_id,
+                                                     condition=half_size_guest_rule[index], odds=half_size_guest[index],
+                                                     p_id=p_id, p_code=p_code, sort=index,
+                                                     odds_code="half_size_guest",sole=new_hash)
+
+
+
+
+
+                    #赛事表
+                    if StZqCompetition.filter(match_id=key):
+                        StZqCompetition.update(is_rollball=1,expire_time=expire_time,utime=utime,status=score_status,tag=number).where(StZqCompetition.match_id == key).execute()
+                    else:
+                        StZqCompetition.create(is_rollball=1,expire_time=expire_time,home_team=team_home,guest_team=team_guest,lg_id=league_id,status=score_status,match_id=key,match_date=r_ctime,match_time='00:00:00',ctime=utime,utime=utime,tag=number,source='hg3535',type=4,ptime=time_game)
+
+                    #更新记录表 具体更新哪些值目前随便写未知
+                    if StZqResultRecord.filter(match_id=key):
+                        StZqResultRecord.update(update_time=utime, status=score_status,match_score=match_score).where(StZqResultRecord.match_id == key).execute()
+                    else:
+                        StZqResultRecord.create(lg_id=league_id,home_team=team_home,guest_team=team_guest,home_score=score_home,guest_score=score_guest,all_goal=number,status=score_status,first_score='',last_score='',match_score=match_score,match_winer='',update_time=utime,match_time=time_game,match_process='',tag=number,match_id=key,source='hg3535')
+
+
+
+
+
+
+                        # for k, v in value.items():
+                        #     if v:
+                        #         for index, result in enumerate(v):
+                        #             st_zq_odd = StZqResult.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
+                        #             if st_zq_odd:
+                        #                 if result:
+                        #                     StZqResult.update(utime=utime, odds=result).where(StZqResult.match_id == key,StZqResult.sort == index,StZqResult.odds_code == k).execute()
+                        #             else:
+                        #                 if result:
+                        #                         StZqResult.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
+                    # else:
+                    #     for k, v in value.items():
+                    #         if v:
+                    #             for index, result in enumerate(v):
+                    #                 if result:
+                    #                     StZqResult.create(match_id=key, cp_id=competition_id, host_name=team_home, guest_name=team_guest,home_rate=score_home, guest_rate=score_guest,all_goal=1,status=1,first_score='1',last_score='1',match_score='1',match_winer='1',update_time=utime,match_time='1',match_process='1',tag=1)
+
+
+
+        # items = dict(item)
+        # print(type(items))
+        # print(items)
+        # StZqOdds.create()
+
+
+
+        return item
+
+    #爬虫关闭关闭数据库连接
+    def close_spider(self, spider):
+        database.close()
+
+
+
+
+# class MysqlTwistedPipline(object):
+#     cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+#
+#     def __init__(self, dbpool):
+#         self.dbpool = dbpool
+#
+#
+#     @classmethod
+#     def from_settings(cls, settings):
+#         dbparms = dict(
+#             host = settings["POST_HOST"],
+#             # db = settings["POST_DATABASE"],
+#             user = settings["POST_USER"],
+#             password = settings["POST_PASSWORD"],
+#             port = settings['POST_PORT'],
+#             # charset='utf8',
+#             # cursorclass = cls.cursor,
+#             # use_unicode = True,
+#         )
+#         dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+#
+#         return cls(dbpool)
+#
+#     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):
+#         #执行具体的插入
+#         #根据不同的item 构建不同的sql语句并插入到mysql中
+#         insert_sql, params = item.get_insert_sql()
+#         cursor.execute(insert_sql, params)
+
+
+
+
+# 球队进球 大小----------------------------------------------------------------------------------------------------------
+class Temaballpipeline(object):
+    cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+
+    def __init__(self, dbpool):
+        self.dbpool = dbpool
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            # db = settings["POST_DATABASE"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+            # charset='utf8',
+            # cursorclass = cls.cursor,
+            # use_unicode = True,
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        return cls(dbpool)
+
+    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):
+        # 比赛日期
+        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())
+        # 比赛id
+        competition_id = item['game_id']
+        # 联赛id
+        league_id = item['league_id']
+        # 联赛name
+        league_name = item['league_name']
+        # 主队
+        team_home = item['team_home']
+        # 客队
+        team_guest = item['team_guest']
+        # number
+        number = item['number']
+        p_code = "temaball"
+        p_id = 11
+        full_dicts = item['full_data']
+        half_dicts = item['half_data']
+        full_dict_rules = item['full_data_rule']
+        half_dict_rules = item['half_data_rule']
+        if full_dicts:
+            for key, value in full_dicts.items():
+                if value:
+                    # 构建唯一索引
+                    new_hash = hash_func(match_id=competition_id, odds_code=key, sort=0, p_id=p_id)
+                    odds_only= new_hash + str(time.time())
+                    # 更新st_zq_odds表
+                    sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition,odds_only) 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(competition_id), utime, utime, value, value, p_id, p_code, 0, "hg3535",
+                    new_hash, full_dict_rules[key], odds_only,utime, value,odds_only))
+                    # 更新st_zq_odds_record
+                    sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code,sort, source,condition,odds_only) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(competition_id), utime, utime, value, value, p_id, p_code, 0, "hg3535",
+                    full_dict_rules[key],odds_only))
+
+        if half_dicts:
+            for key, value in half_dicts.items():
+                if value:
+                    # 构建唯一索引
+                    new_hash = hash_func(match_id=competition_id, odds_code=key, sort=0, p_id=p_id)
+                    odds_only= new_hash + str(time.time())
+                    # 更新st_zq_odds表
+                    sql1 = "insert into st_zq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition,odds_only) 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(competition_id), utime, utime, value, value, p_id, p_code, 0, "hg3535",
+                    new_hash, half_dict_rules[key],odds_only, utime, value,odds_only))
+                    # 更新st_zq_odds_record
+                    sql2 = "insert into st_zq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code,sort, source,condition,odds_only) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s,%s);"
+                    cursor.execute(sql2, (
+                    int(league_id), key, int(competition_id), utime, utime, value, value, p_id, p_code, 0, "hg3535",
+                    half_dict_rules[key],odds_only))
+
+
+    def close_spider(self, spider):
+        database.close()
+
+
+
+
+
+
+
+# 篮球 让球大小----------------------------------------------------------------------------------------------------------
+class Lanqiupipeline(object):
+    cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+
+    def __init__(self, dbpool):
+        self.dbpool = dbpool
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            # db = settings["POST_DATABASE"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+            # charset='utf8',
+            # cursorclass = cls.cursor,
+            # use_unicode = True,
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        return cls(dbpool)
+
+    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
+        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']
+        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= new_hash + str(time.time())
+                        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) 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, y, 1, "concede",x, "hg3535", new_hash, concedes_dict_rule[key][x],odds_only, 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) 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,y, 1, "concede", x, "hg3535", concedes_dict_rule[key][x],odds_only))
+
+        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= new_hash + str(time.time())
+                        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) 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,y, 2, "odd_even",x, "hg3535", new_hash, odd_evens_dict_rule[key][x],odds_only,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) 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,y, 2, "odd_even", x, "hg3535", odd_evens_dict_rule[key][x],odds_only))
+
+        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= new_hash + str(time.time())
+                        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) 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,y, 3, "total_size",x, "hg3535", new_hash, total_sizes_dict_rule[key][x],odds_only, 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) 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, y, 3, "total_size", x, "hg3535", total_sizes_dict_rule[key][x],odds_only))
+
+        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= new_hash + str(time.time())
+                    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) 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), "last_home", int(game_id), utime, utime, value, 4, "last_number",0, "hg3535", new_hash, key,odds_only, 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) values (%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))
+
+        last_guest = last_numbers_dict['last_home']
+        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= new_hash + str(time.time())
+                    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) 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), "last_guest", int(game_id), utime, utime, value, 4, "last_number",0, "hg3535", new_hash, key,odds_only, 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) values (%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))
+
+        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= new_hash + str(time.time())
+                    sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only) values (%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,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) values (%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))
+
+        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= new_hash + str(time.time())
+                        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) values (%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, 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) 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,y, 6, "team_score", x, "hg3535",team_scores_dict_rule[key][x],odds_only))
+        # 插入赛事表
+        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):
+        database.close()
+
+
+
+# 网球 让球&大小盘--------------------------------------------------------------------------------------------------------
+class Wangqiupipeline(object):
+    cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+
+    def __init__(self, dbpool):
+        self.dbpool = dbpool
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            # db = settings["POST_DATABASE"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+            # charset='utf8',
+            # cursorclass = cls.cursor,
+            # use_unicode = True,
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        return cls(dbpool)
+
+    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_time(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= new_hash + str(time.time())
+                    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) 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, 1, "concede", 0, "hg3535", new_hash,
+                    concedes_dict_rule[key],odds_only,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) 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, 1, "concede", 0, "hg3535",
+                    concedes_dict_rule[key],odds_only))
+
+        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= new_hash + str(time.time())
+                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole,odds_only) values (%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, 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) values (%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))
+
+        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= new_hash + str(time.time())
+                    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) 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, 3, "bureau", 0, "hg3535", new_hash,
+                    bureaus_dict_rule[key],odds_only, 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) 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, 3, "bureau", 0, "hg3535",
+                    bureaus_dict_rule[key],odds_only))
+
+        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= new_hash + str(time.time())
+                    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) 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, 4, "total_number", 0, "hg3535", new_hash,
+                    total_number_dict_rule[key],odds_only, 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) 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, "total_number", 0, "hg3535",
+                    total_number_dict_rule[key],odds_only))
+
+        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= new_hash + str(time.time())
+                    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) 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, "odd_even", 0, "hg3535", new_hash,
+                    odd_evens_dict_rule[key],odds_only,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) 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, "odd_even", 0, "hg3535",odd_evens_dict_rule[key],odds_only))
+
+        # 插入赛事表
+        Competition_sql = "insert into st_wq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,type,source) values (%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", number))
+
+    def close_spider(self, spider):
+        database.close()
+
+
+#网球
+class Wangqiupipeline1(object):
+    cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+
+    def __init__(self, dbpool):
+        self.dbpool = dbpool
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            # db = settings["POST_DATABASE"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+            # charset='utf8',
+            # cursorclass = cls.cursor,
+            # use_unicode = True,
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        return cls(dbpool)
+
+    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']
+        concedes_dict = item['concedes_dict']
+        concedes_dict_rule = item['concedes_dict_rule']
+        odd_evens_dict = item['odd_evens_dict']
+        odd_evens_dict_rule = item['odd_evens_dict_rule']
+        total_sizes_dict = item['total_number_dict']
+        total_sizes_dict_rule = item['total_number_dict_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:
+                    new_hash = hash_func(match_id=game_id, odds_code=key, sort=0, p_id=1)
+                    sql1 = "insert into st_wq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
+                    cursor.execute(sql1, (
+                    int(league_id), key, int(game_id), utime, utime, value, value, 1, "concede", 0, "hg3535", new_hash,
+                    concedes_dict_rule[key], utime, value))
+                    # 更新主队st_zq_odds_record表
+                    sql2 = "insert into st_wq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) 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, value, 1, "concede", 0, "hg3535",
+                    concedes_dict_rule[key]))
+
+        # 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)
+        #                 sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
+        #                 cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, y, y, 2, "odd_even",x, "hg3535", new_hash, odd_evens_dict_rule[key][x], utime, y))
+        #                 # 更新主队st_zq_odds_record表
+        #                 sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) 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, y, y, 2, "odd_even", x, "hg3535", odd_evens_dict_rule[key][x]))
+
+        # 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)
+        #                 sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
+        #                 cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, y, y, 3, "total_size",x, "hg3535", new_hash, total_sizes_dict_rule[key][x], utime, y))
+        #                 # 更新主队st_zq_odds_record表
+        #                 sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) 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, y, y, 3, "total_size", x, "hg3535", total_sizes_dict_rule[key][x]))
+
+        # 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)
+        #             sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
+        #             cursor.execute(sql1, (int(league_id), "last_home", int(game_id), utime, utime, value, value, 4, "last_number",0, "hg3535", new_hash, key, utime, value))
+        #             # 更新主队st_zq_odds_record表
+        #             sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) values (%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, value, 4, "last_number", 0, "hg3535", key))
+
+        # last_guest = last_numbers_dict['last_home']
+        # 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)
+        #             sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
+        #             cursor.execute(sql1, (int(league_id), "last_guest", int(game_id), utime, utime, value, value, 4, "last_number",0, "hg3535", new_hash, key, utime, value))
+        #             # 更新主队st_zq_odds_record表
+        #             sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) values (%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, value, 4, "last_number", 0, "hg3535", key))
+
+        # 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)
+        #             sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
+        #             cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, value, value, 5, "capot",0, "hg3535", new_hash, utime, value))
+        #             # 更新主队st_zq_odds_record表
+        #             sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s);"
+        #             cursor.execute(sql2, (int(league_id), key, int(game_id), utime, utime, value, value, 5, "capot", 0, "hg3535"))
+
+        # 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)
+        #                 sql1 = "insert into st_lq_odds(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, sole,condition) values (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s) on conflict(sole) do update set utime = %s,odds = %s;"
+        #                 cursor.execute(sql1, (int(league_id), key, int(game_id), utime, utime, y, y, 6, "team_score", x, "hg3535", new_hash,team_scores_dict_rule[key][x], utime, y))
+        #                 # 更新主队st_zq_odds_record表
+        #                 sql2 = "insert into st_lq_odds_record(lg_id, odds_code, match_id, ctime, utime, max, odds, p_id, p_code, sort, source, condition) 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, y, y, 6, "team_score", x, "hg3535",team_scores_dict_rule[key][x]))
+        # 插入赛事表
+        Competition_sql = "insert into st_lq_competition(home_team, guest_team, lg_id, match_id, match_date, match_time,ctime, utime, tag,type,source) values (%s, %s, %s, %s, %s, %s, %s, %s,%s, %s, %s) on conflict(match_id) do update set tag = %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",number))
+
+
+
+# 棒球 插入赔率----------------------------------------------------------------------------------------------------------
+def bqone_intodb(data1, data2, data3, cursor):
+    if data1:
+        for key, value in data1.items():
+            if value:
+                new_hash = hash_func(match_id=data2['game_id'], odds_code=key, sort=data2['sort'], p_id=data2['p_id'])
+                odds_only = new_hash + str(time.time())
+                sql1 = "insert into st_bq_odds(lg_id, odds_code, match_id, ctime, utime, odds, p_id, p_code, sort, source, sole, condition, expire_time,odds_only) 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,expire_time=%s,odds_only=%s;"
+                cursor.execute(sql1, (
+                int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value, data2['p_id'], data2["p_code"], data2['sort'], data2["source"], new_hash,
+                data3[key], data2['expire_time'],odds_only,data2['utime'], value, data2['expire_time'],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) values (%s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s);"
+                cursor.execute(sql2, (
+                int(data2['league_id']), key, int(data2['game_id']), data2['utime'], data2['utime'], value, data2['p_id'], data2["p_code"], data2['sort'], data2["source"], data3[key],odds_only))
+
+def out_time(ctime, i):
+    ctime1 = datetime.datetime.strptime(ctime, "%Y-%m-%d %H:%M:%S")
+    n_ctime = (ctime1 + datetime.timedelta(hours=i)).strftime("%Y-%m-%d %H:%M:%S")
+    return n_ctime
+
+
+
+class Banqiupipeline(object):
+    cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
+
+    def __init__(self, dbpool):
+        self.dbpool = dbpool
+
+    @classmethod
+    def from_settings(cls, settings):
+        dbparms = dict(
+            host=settings["POST_HOST"],
+            # db = settings["POST_DATABASE"],
+            user=settings["POST_USER"],
+            password=settings["POST_PASSWORD"],
+            port=settings['POST_PORT'],
+            # charset='utf8',
+            # cursorclass = cls.cursor,
+            # use_unicode = True,
+        )
+        dbpool = adbapi.ConnectionPool("psycopg2", **dbparms)
+        return cls(dbpool)
+
+    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".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': "bq_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': "bq_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': "bq_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 = new_hash + str(time.time())
+                    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) 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,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, 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) values (%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))
+        # 插入赛事表
+            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))
+            # 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))

+ 118 - 0
scrapy_yzd/scrapy_yzd/settings.py

@@ -0,0 +1,118 @@
+# -*- coding: utf-8 -*-
+
+# Scrapy settings for scrapy_yzd project
+#
+# For simplicity, this file contains only settings considered important or
+# commonly used. You can find more settings consulting the documentation:
+#
+#     http://doc.scrapy.org/en/latest/topics/settings.html
+#     http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
+#     http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
+
+BOT_NAME = 'scrapy_yzd'
+
+SPIDER_MODULES = ['scrapy_yzd.spiders']
+NEWSPIDER_MODULE = 'scrapy_yzd.spiders'
+
+LOG_LEVEL = 'INFO'
+# Crawl responsibly by identifying yourself (and your website) on the user-agent
+USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
+
+# Obey robots.txt rules
+ROBOTSTXT_OBEY = False
+
+# Configure maximum concurrent requests performed by Scrapy (default: 16)
+#CONCURRENT_REQUESTS = 32
+
+# Configure a delay for requests for the same website (default: 0)
+# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
+# See also autothrottle settings and docs
+DOWNLOAD_DELAY = 2
+# The download delay setting will honor only one of:
+#CONCURRENT_REQUESTS_PER_DOMAIN = 16
+#CONCURRENT_REQUESTS_PER_IP = 16
+
+# Disable cookies (enabled by default)
+COOKIES_ENABLED = False
+
+# Disable Telnet Console (enabled by default)
+#TELNETCONSOLE_ENABLED = False
+
+# Override the default request headers:
+#DEFAULT_REQUEST_HEADERS = {
+#   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+#   'Accept-Language': 'en',
+#}
+
+# Enable or disable spider middlewares
+# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
+#SPIDER_MIDDLEWARES = {
+#    'scrapy_yzd.middlewares.MyCustomSpiderMiddleware': 543,
+#}
+
+# Enable or disable downloader middlewares
+# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
+DOWNLOADER_MIDDLEWARES = {
+    # 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware': None,  # 把本来的代理中间件废掉
+    # 'scrapy_yzd.middlewares.RotateUserAgentMiddleware': 400,  # 切换agent
+    # 'scrapy_yzd.autoproxy.AutoProxyMiddleware': 543  # 代理池
+}
+
+AUTO_PROXY = {  # 代理池中间件设置,详见Github
+    #'test_urls':[('http://www.jd.com', '4006561155')],
+    'ban_code': [500, 502, 503, 400, 504],
+    'init_valid_proxys': 2,
+}
+
+# Enable or disable extensions
+# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
+#EXTENSIONS = {
+#    'scrapy.extensions.telnet.TelnetConsole': None,
+#}
+
+# Configure item pipelines
+# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
+ITEM_PIPELINES = {
+    # Lanqiupipeline
+    # 'scrapy_yzd.pipelines.Lanqiupipeline':1,
+    # 'scrapy_yzd.pipelines.Wangqiupipeline':1,
+   # 'scrapy_yzd.pipelines.SomePipeline': 300,
+   #  'scrapy_yzd.pipelines.ScrapyYzdPipeline':1,
+   #  'scrapy_yzd.pipelines.Temaballpipeline':1
+   #  'scrapy_yzd.pipelines.MysqlTwistedPipline':1
+    'scrapy_yzd.pipelines.Banqiupipeline':1
+
+}
+
+# Enable and configure the AutoThrottle extension (disabled by default)
+# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
+#AUTOTHROTTLE_ENABLED = True
+# The initial download delay
+#AUTOTHROTTLE_START_DELAY = 5
+# The maximum download delay to be set in case of high latencies
+#AUTOTHROTTLE_MAX_DELAY = 60
+# The average number of requests Scrapy should be sending in parallel to
+# each remote server
+#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
+# Enable showing throttling stats for every response received:
+#AUTOTHROTTLE_DEBUG = False
+
+# Enable and configure HTTP caching (disabled by default)
+# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
+#HTTPCACHE_ENABLED = True
+#HTTPCACHE_EXPIRATION_SECS = 0
+#HTTPCACHE_DIR = 'httpcache'
+#HTTPCACHE_IGNORE_HTTP_CODES = []
+#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
+
+
+# database = PostgresqlDatabase('kaiyou',**{'host': '192.168.2.200', 'port': 10432, 'user': 'kaiyou', 'password': '123456'})
+
+# database = PostgresqlDatabase('postgres', **{'host': '127.0.0.1', 'port': 5432, 'user': 'postgres', 'password': '9998877'})
+
+
+POST_HOST = '192.168.2.200'
+POST_DATABASE = 'kaiyou'
+POST_USER = 'kaiyou'
+POST_PORT = '10432'
+POST_PASSWORD = '123456'

+ 4 - 0
scrapy_yzd/scrapy_yzd/spiders/__init__.py

@@ -0,0 +1,4 @@
+# This package will contain the spiders of your Scrapy project
+#
+# Please refer to the documentation for information on how to create and manage
+# your spiders.

BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/__init__.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/__init__.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/csdn_self_spider.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/csdn_self_spider.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/douban_spider.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/douban_spider.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/doubanlist_spider.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/doubanlist_spider.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_bangqiu.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535_supplement.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535basketball.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/hg3535tennisball.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/jd_spider.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/jd_spider.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/steam_spider.cpython-35.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/steam_spider.cpython-36.pyc


BIN
scrapy_yzd/scrapy_yzd/spiders/__pycache__/test.cpython-36.pyc


+ 14 - 0
scrapy_yzd/scrapy_yzd/spiders/csdn_self_spider.py

@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from scrapy_yzd.items import DoubanItem
+
+class csdn_selfSpider(scrapy.Spider):
+    name = "csdn"
+    allowed_domains = ["blog.csdn.net"]
+    start_urls = [
+        "http://blog.csdn.net/qqxx6661/article/details/52083332",
+        "http://blog.csdn.net/qqxx6661/article/details/52132575"
+    ]
+
+    def parse(self, response):
+        pass

+ 25 - 0
scrapy_yzd/scrapy_yzd/spiders/douban_spider.py

@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from scrapy_yzd.items import DoubanItem
+
+class doubanSpider(scrapy.Spider):
+    name = "douban"
+    allowed_domains = ["movie.douban.com"]
+    start_urls = [
+        "https://movie.douban.com/subject/26683290/"
+    ]
+
+    def parse(self, response):
+            item = DoubanItem()
+            item['movie_name'] = response.xpath('//span[@property="v:itemreviewed"]/text()').extract()
+            item['movie_director'] = response.xpath('//a[@rel="v:directedBy"]/text()').extract()
+            item['movie_starring'] = response.xpath('//a[@rel="v:starring"]/text()').extract()
+            item['movie_category'] = response.xpath('//span[@property="v:genre"]/text()').extract()
+            item['movie_time'] = response.xpath('//span[@property="v:runtime"]/text()').extract()
+            item['movie_star'] = response.xpath('//strong[@property="v:average"]/text()').extract()
+            item['movie_5score'] = response.xpath('//span[@class="rating_per"][1]/text()').extract()
+            item['movie_4score'] = response.xpath('//span[@class="rating_per"][2]/text()').extract()
+            item['movie_3score'] = response.xpath('//span[@class="rating_per"][3]/text()').extract()
+            item['movie_2score'] = response.xpath('//span[@class="rating_per"][4]/text()').extract()
+            item['movie_1score'] = response.xpath('//span[@class="rating_per"][5]/text()').extract()
+            yield item

+ 59 - 0
scrapy_yzd/scrapy_yzd/spiders/doubanlist_spider.py

@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+
+import scrapy
+from scrapy_yzd.items import DoubanItem
+
+
+class doubanlistSpider(scrapy.Spider):
+    name = "doubanlist"
+    allowed_domains = ["movie.douban.com"]
+    start_urls = [
+        "https://movie.douban.com/tag/%E5%8A%A8%E7%94%BB"
+    ]
+
+
+    def parse(self, response):
+        for href in response.xpath('//a[@class="nbg"]/@href'):
+            url = href.extract()
+            yield scrapy.Request(url, callback=self.parse_each_movie)
+        next_page = response.xpath('//span[@class="next"]/a/@href').extract()
+        if next_page:
+            print('--------------Finding next page: [%s] --------------------------'), next_page
+            yield scrapy.Request(next_page[0], callback=self.parse)
+        else:
+            print('--------------There is no more page!--------------------------')
+
+
+    def parse_each_movie(self, response):
+        item = DoubanItem()
+        item['movie_name'] = response.xpath('//span[@property="v:itemreviewed"]/text()').extract()
+        item['movie_director'] = response.xpath('//a[@rel="v:directedBy"]/text()').extract()
+        item['movie_writer'] = response.xpath('//span[@class="attrs"][2]/a/text()').extract()
+        item['movie_starring'] = response.xpath('//a[@rel="v:starring"]/text()').extract()
+        item['movie_category'] = response.xpath('//span[@property="v:genre"]/text()').extract()
+        #item['movie_language'] = response.xpath('//*[@id="info"]').re(r'</span> (.*)<br>\n')[2]
+        item['movie_date'] = response.xpath('//span[@property="v:initialReleaseDate"]/text()').extract()
+        item['movie_time'] = response.xpath('//span[@property="v:runtime"]/text()').extract()
+        item['movie_star'] = response.xpath('//strong[@property="v:average"]/text()').extract()
+        item['movie_5score'] = response.xpath('//span[@class="rating_per"][1]/text()').extract()
+        item['movie_4score'] = response.xpath('//span[@class="rating_per"][2]/text()').extract()
+        item['movie_3score'] = response.xpath('//span[@class="rating_per"][3]/text()').extract()
+        item['movie_2score'] = response.xpath('//span[@class="rating_per"][4]/text()').extract()
+        item['movie_1score'] = response.xpath('//span[@class="rating_per"][5]/text()').extract()
+        item['movie_describe'] = response.xpath('//*[@id="link-report"]/span/text()').re(r'\S+')
+
+        check_item = response.xpath('//*[@id="info"]').re(r'</span> (.*)<br>\n')[1]
+        result = self.check_contain_chinese(check_item)
+        if result:
+            item['movie_country'] = response.xpath('//*[@id="info"]').re(r'</span> (.*)<br>\n')[1]
+        else:
+            item['movie_country'] = response.xpath('//*[@id="info"]').re(r'</span> (.*)<br>\n')[2]
+
+        yield item
+
+    def check_contain_chinese(self, check_str):
+        for ch in check_str.decode('utf-8'):
+            if u'\u4e00' <= ch <= u'\u9fff':
+                return True
+        return False
+

+ 776 - 0
scrapy_yzd/scrapy_yzd/spiders/hg3535.py

@@ -0,0 +1,776 @@
+# -*- coding: utf-8 -*-
+# import jmespath
+import jsonpath
+import scrapy
+import json
+from scrapy.http import  Request
+
+from scrapy_yzd.items import Hg3535Item, Today_all,Temaball
+
+
+def reverli(li=[]):
+    if not li:
+        li = []
+    for i in li:
+        if isinstance(i,int):
+            res1 = "".join('%s' %i)
+            return res1
+    res = "".join(li)
+    return res
+
+odd_nums = [ i for i in range(1,101) if i %2 ==1]
+
+
+
+def dict_get(dict1, objkey, default):
+    tmp = dict1
+    for k, v in tmp.items():
+        # print(k,v)
+        if k == objkey:
+            return v
+        elif isinstance(v, dict):
+            ret = dict_get(v, objkey, default)
+            if ret is not default:
+                return ret
+        else:
+            if isinstance(v, list):
+                for i in v:
+                    ret = dict_get(i, objkey, default)
+                    if ret is not default:
+                        return ret
+    return default
+
+class Hg3535Spider(scrapy.Spider):
+    name = 'hg3535'
+    allowed_domains = ['hg3535z.com']
+    start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 足球滚球列url
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 网球url
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0']
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] #篮球
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=1&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 今日足球
+    def parse(self, response):
+        datas = json.loads(response.text)
+        item = Today_all()
+        ids = []
+        #页面没数据异常处理
+        try:
+            results = datas['i-ot'][0]['egs']
+        except KeyError:
+            results = []
+        #4个字典
+        concedelist = {}
+        oddevenlist = {}
+        capotlist = {}
+        totalgoallist = {}
+        halffulllist = {}
+        bodanlist = {}
+        firstlastballlist = {}
+        #第一
+        for result in results:
+            league_id = result['c']['k'] #联赛id
+            league_name = result['c']['n'] #联赛名
+            new_results = result['es'] # 取出列表嵌套字典
+            #二
+            for new_result in new_results:
+                # ids = []
+                game_id = str(new_result['i'][16]) #比赛id
+                # ids.append(game_id)
+                # if ids:
+                #     ids1 = set(ids)#去重
+                #     for i in ids1:
+                #         urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
+                #         print(urls)
+                #         yield Request(url=urls, callback=self.parse_other)
+            #     if ids:
+            #         ids1 = set(ids)#去重
+            #         for i in ids1:
+            #             urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
+            #             print(urls)
+            #             yield Request(url=urls, callback=self.parse_each)
+                team_home = new_result['i'][0]  # 球队一
+                team_guest = new_result['i'][1] # 球队二
+                number = new_result['i'][2] # 数量
+                data_game = new_result['i'][4] #  日期
+                time_game  = new_result['i'][5] # 开赛时间
+                score_home = new_result['i'][10]  # 队一分数
+                score_guest = new_result['i'][11] # 队二分数
+                half_way = new_result['i'][12] #下半场
+                corner_ball = new_result['pci'].get('ctn',"") #角球
+                status = new_result['i'][3] # 状态值
+
+                # 全场让球 concede
+                concede_size = {}
+                concedes = new_result['o'].get('ah', "")
+                if concedes:
+                    new_concedes = [concedes[i] for i in range(len(concedes)) if i % 2 == 1]
+                    concede_homes = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 == 0]
+                    concede_home_rule = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 0]
+                    # concede_home_rule
+                    concede_size["concede_home_rule"] = concede_home_rule
+                    # concede_home
+                    concede_home = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 1]
+                    concede_size["concede_home"] = concede_home
+                    concede_guests = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 == 1]
+                    # concede_guest_rule
+                    concede_guest_rule = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 == 0]
+                    concede_size["concede_guest_rule"] = concede_guest_rule
+                    # concede_guest
+                    concede_guest = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 == 1]
+                    concede_size["concede_guest"] = concede_guest
+                else:
+                    concede_size["concede_guest"] = ""
+                    concede_size["concede_guest_rule"] = ""
+                    concede_size["concede_home"] = ""
+                    concede_size["concede_home_rule"] = ""
+
+                # 上半场让球half_concede  滚球不存在
+                half_concedes = new_result['o'].get('ah1st', "")
+                if half_concedes:
+                    new_half_concedes = [half_concedes[i] for i in range(len(half_concedes)) if i % 2 == 1]
+                    new_half_concede_homes = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 == 0]
+                        # half_concede_home_rule
+                    half_concede_home_rule = [new_half_concede_homes[i] for i in range(len(new_half_concede_homes)) if i % 2 == 0]
+                    concede_size["half_concede_home_rule"] = half_concede_home_rule
+                    # concede_home
+                    half_concede_home = [new_half_concede_homes[i] for i in range(len(new_half_concede_homes)) if i % 2 == 1]
+                    concede_size["half_concede_home"] = half_concede_home
+                    half_concede_guests = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 == 1]
+                    # concede_guest_rule
+                    half_concede_guest_rule = [half_concede_guests[i] for i in range(len(half_concede_guests)) if i % 2 == 0]
+                    concede_size["half_concede_guest_rule"] = half_concede_guest_rule
+                    # concede_guest
+                    half_concede_guest = [half_concede_guests[i] for i in range(len(half_concede_guests)) if i % 2 == 1]
+                    concede_size["half_concede_guest"] = half_concede_guest
+                else:
+                    concede_size["half_concede_home_rule"] = ""
+                    concede_size["half_concede_home"] = ""
+                    concede_size["half_concede_guest_rule"] = ""
+                    concede_size["half_concede_guest"] = ""
+
+                # 全场大小size
+                sizes = new_result['o'].get('ou', "")
+                if sizes:
+                    new_sizes = [sizes[i] for i in range(len(sizes)) if i % 2 == 1]
+                    size_homes = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 == 0]
+                    # size_home_rule
+                    size_home_rule = [size_homes[i] for i in range(len(size_homes)) if i % 2 == 0]
+                    concede_size["size_home_rule"] = size_home_rule
+                    # size_home
+                    size_home = [size_homes[i] for i in range(len(size_homes)) if i % 2 == 1]
+                    concede_size["size_home"] = size_home
+                    size_guests = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 == 1]
+                    # size_guest_rule
+                    size_guest_rule = [size_guests[i] for i in range(len(size_guests)) if i % 2 == 0]
+                    concede_size["size_guest_rule"] = size_guest_rule
+                    # csize_guest
+                    size_guest = [size_guests[i] for i in range(len(size_guests)) if i % 2 == 1]
+                    concede_size["size_guest"] = size_guest
+                else:
+                    concede_size["size_guest"] = ""
+                    concede_size["size_guest_rule"] = ""
+                    concede_size["size_home"] = ""
+                    concede_size["size_home_rule"] = ""
+
+
+
+                # 上半场大小 half_size
+                half_sizes = new_result['o'].get('ou1st',"")
+                if half_sizes:
+                    new_half_sizes = [half_sizes[i] for i in range(len(half_sizes)) if i % 2 == 1]
+                    half_size_homes = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 == 0]
+                    # size_home_rule
+                    half_size_home_rule = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 == 0]
+                    concede_size["half_size_home_rule"] = half_size_home_rule
+                    # half_size_home
+                    half_size_home = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 == 1]
+                    concede_size["half_size_home"] =half_size_home
+                    half_size_guests = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 == 1]
+                    # half_size_guest_rule
+                    half_size_guest_rule = [half_size_guests[i] for i in range(len(half_size_guests)) if i % 2 == 0]
+                    concede_size["half_size_guest_rule"] = half_size_guest_rule
+                    # half_size_guest
+                    half_size_guest = [half_size_guests[i] for i in range(len(half_size_guests)) if i % 2 == 1]
+                    concede_size["half_size_guest"] = half_size_guest
+                else:
+                    concede_size["half_size_guest"] = ""
+                    concede_size["half_size_guest_rule"] = ""
+                concede_size["half_size_home"] = ""
+                concede_size["half_size_home_rule"] = ""
+                concede_size['league_id'] = league_id
+                concede_size['league_name'] = league_name
+                concede_size['game_id'] = game_id
+                concede_size['team_home'] = team_home
+                concede_size['team_guest'] = team_guest
+                concede_size['number'] = number
+                concede_size['data_game'] = data_game
+                concede_size['time_game'] = time_game
+                concede_size['corner_ball'] = corner_ball
+                concede_size['score_home'] = score_home
+                concede_size['score_guest'] = score_guest
+                concede_size['half_way'] = half_way
+                concede_size['status'] = status
+                concedelist[game_id] = concede_size
+                # 让球大小盘
+                item["concede_size"] = concedelist
+
+                 #全场独赢
+                capot = {}
+                # 全场独赢capot
+                capots = new_result['o'].get('1x2', "")
+                if capots:
+                    new_capots = [capots[i] for i in range(len(capots)) if i % 2 == 1]
+                    capot["capot_home"] = new_capots[0]
+                    capot["capot_guest"] = new_capots[1]
+                    capot["capot_dogfall"] = new_capots[2]
+                else:
+                    capot["capot_home"] = ""
+                    capot["capot_guest"] = ""
+                    capot["capot_dogfall"] = ""
+
+                #上半场独赢capot
+                half_capots = new_result['o'].get('1x21st', "")
+                if half_capots:
+                    new_half_capots = [half_capots[i] for i in range(len(half_capots)) if i % 2 == 1]
+                    capot["half_capot_home"] = new_half_capots[0]
+                    capot["half_capot_guest"] = new_half_capots[1]
+                    capot["half_capot_dogfall"] = new_half_capots[2]
+                else:
+                    capot["half_capot_home"] = ""
+                    capot["half_capot_guest"] = ""
+                    capot["half_capot_dogfall"] = ""
+                capot['league_id'] = league_id
+                capot['league_name'] = league_name
+                capot['game_id'] = game_id
+                capot['team_home'] = team_home
+                capot['team_guest'] = team_guest
+                capot['number'] = number
+                capot['data_game'] = data_game
+                capot['time_game'] = time_game
+                capot['corner_ball'] = corner_ball
+                capot['score_home'] = score_home
+                capot['score_guest'] = score_guest
+                capot['half_way'] = half_way
+                capot['status'] = status
+                capotlist[game_id] = capot
+                # 独赢
+                item["capot"] = capotlist
+
+
+
+                # 全场入球:单/双
+                odd_even = {}
+                # 全场入球:单/双 odd_even
+                odd_evens = new_result['o'].get('oe',"")
+                if odd_evens:
+                    new_odd_evens = [odd_evens[i] for i in range(len(odd_evens)) if i % 2 == 1]
+                    odd_even["odd_even_odd"] = new_odd_evens[0] #全场单
+                    odd_even["odd_even_even"] = new_odd_evens[1] #全场双
+                else:
+                    odd_even["odd_even_odd"] = ""
+                    odd_even["odd_even_even"] = ""
+                # 半场入球:单/双 half_odd_even
+                half_odd_evens = new_result['o'].get('oe1st',"")
+                if half_odd_evens:
+                    new_half_odd_evens = [half_odd_evens[i] for i in range(len(half_odd_evens)) if i % 2 == 1]
+                    odd_even["half_odd_even_odd"] = new_half_odd_evens[0] #上半场单
+                    odd_even["half_odd_even_even"] = new_half_odd_evens[1] # 上半场双
+                else:
+                    odd_even["half_odd_even_odd"] = ""  #上半场单
+                    odd_even["half_odd_even_even"] = "" #上半场双
+                odd_even['league_id'] = league_id
+                odd_even['league_name'] = league_name
+                odd_even['game_id'] = game_id
+                odd_even['team_home'] = team_home
+                odd_even['team_guest'] = team_guest
+                odd_even['number'] = number
+                odd_even['data_game'] = data_game
+                odd_even['time_game'] = time_game
+                odd_even['corner_ball'] = corner_ball
+                odd_even['score_home'] = score_home
+                odd_even['score_guest'] = score_guest
+                odd_even['half_way'] = half_way
+                odd_even['status'] = status
+                oddevenlist[game_id] = odd_even
+                # 入球数-单双
+                item["odd_even"] = oddevenlist
+
+
+                # 全场总进球 total_goal
+                total_goal = {}
+                total_goals = new_result['o'].get('tg', "")
+                if total_goals:
+                    new_total_goals = [total_goals[i] for i in range(len(total_goals)) if i % 2 == 1]
+                    total_goal["total_goal_zero"] = new_total_goals[0]
+                    total_goal["total_goal_two"] = new_total_goals[1]
+                    total_goal["total_goal_four"] = new_total_goals[2]
+                    total_goal["total_goal_seven"] = new_total_goals[3]
+                else:
+                    total_goal["total_goal_zero"] = ""
+                    total_goal["total_goal_two"] = ""
+                    total_goal["total_goal_four"] = ""
+                    total_goal["total_goal_seven"] = ""
+
+                # 总进球上半场 half_total_goal
+                half_total_goals = new_result['o'].get('tg1st', "")
+                if half_total_goals:
+                    new_half_total_goals = [half_total_goals[i] for i in range(len(half_total_goals)) if i % 2 == 1]
+                    total_goal["half_total_goal_zero"] = new_half_total_goals[0]
+                    total_goal["half_total_goal_one"] = new_half_total_goals[1]
+                    total_goal["half_total_goal_two"] = new_half_total_goals[2]
+                    total_goal["half_total_goal_three"] = new_half_total_goals[3]
+                else:
+                    total_goal["half_total_goal_zero"] = ""
+                    total_goal["half_total_goal_one"] = ""
+                    total_goal["half_total_goal_two"] = ""
+                    total_goal["half_total_goal_three"] = ""
+                total_goal['league_id'] = league_id
+                total_goal['league_name'] = league_name
+                total_goal['game_id'] = game_id
+                total_goal['team_home'] = team_home
+                total_goal['team_guest'] = team_guest
+                total_goal['number'] = number
+                total_goal['data_game'] = data_game
+                total_goal['time_game'] = time_game
+                total_goal['corner_ball'] = corner_ball
+                total_goal['score_home'] = score_home
+                total_goal['score_guest'] = score_guest
+                total_goal['status'] = status
+                total_goal['half_way'] = half_way
+                totalgoallist[game_id] = total_goal
+                #总入球
+                item["total_goal"] = totalgoallist
+
+
+
+
+                # 早盘 半场/全场
+                half_full = {}
+                new_lists = ["half_full_home_home", "half_full_home_dogfall", "half_full_home_guest", "half_full_dogfall_home", "half_full_dogfall_dogfall", "half_full_dogfall_guest", "half_full_guest_home","half_full_guest_dogfall", "half_full_guest_guest"]
+                half_fulls = new_result['o'].get('hf', "")
+                if half_fulls:
+                    new_half_fulls = [half_fulls[i] for i in range(len(half_fulls)) if i % 2 == 1]
+                    for index, value in enumerate(new_lists):
+                        half_full[value] = new_half_fulls[index]
+                else:
+                    for index, value in enumerate(new_lists):
+                        half_full[value] = ""
+                half_full['league_id'] = league_id
+                half_full['league_name'] = league_name
+                half_full['game_id'] = game_id
+                half_full['team_home'] = team_home
+                half_full['team_guest'] = team_guest
+                half_full['number'] = number
+                half_full['data_game'] = data_game
+                half_full['time_game'] = time_game
+                half_full['corner_ball'] = corner_ball
+                half_full['score_home'] = score_home
+                half_full['score_guest'] = score_guest
+                half_full['half_way'] = half_way
+                half_full['status'] = status
+                halffulllist[game_id] = half_full
+                #半场/全场
+                item["half_full"] = halffulllist
+
+
+
+                # 波胆
+                bodan = {}
+                bodan_data = {}
+                half_bodan_data = {}
+                bodans = new_result['o'].get('cs', "")
+                if bodans:
+                    one_list = ["bodan_home_one_zero","bodan_home_two_zero","bodan_home_two_one","bodan_home_three_zero","bodan_home_three_one","bodan_home_three_two","bodan_home_four_zero","bodan_home_four_one","bodan_home_four_two","bodan_home_four_three"]
+                    two_list = ["bodan_guest_one_zero","bodan_guest_two_zero","bodan_guest_two_one","bodan_guest_three_zero","bodan_guest_three_one","bodan_guest_three_two","bodan_guest_four_zero","bodan_guest_four_one","bodan_guest_four_two","bodan_guest_four_three"]
+                    three_list = ["bodan_dogfall_zero_zero","bodan_dogfall_one_one","bodan_dogfall_two_two","bodan_dogfall_three_three","bodan_dogfall_four_four"]
+                    new_bodans = [bodans[i] for i in range(len(bodans)) if i % 2 == 1]
+                    new_bodan = new_bodans[0:20]
+                    # 主队bodan_home
+                    bodan_home = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 == 0]
+                    for index, t in enumerate(one_list):
+                        bodan_data[t] = bodan_home[index]
+                    # 客队bodan_guest
+                    bodan_guest = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 == 1]
+                    for y, z in enumerate(two_list):
+                        bodan_data[z] = bodan_guest[y]
+                    bodan_dogfall = new_bodans[-7:-2]
+                    for a, b in enumerate(three_list):
+                        bodan_data[b] = bodan_dogfall[a]
+                    # 其他bodan_other
+                    bodan_data['bodan_other'] = new_bodans[-1]
+                    bodan['bodan'] = bodan_data
+                else:
+                    bodan["bodan"] = ""
+                half_bodans = new_result['o'].get('cs1st', "")
+                if half_bodans:
+                        new_half_bodans = [half_bodans[i] for i in range(len(half_bodans)) if i % 2 == 1]
+                        new_one = ["bodan_home_one_zero","bodan_home_two_zero","bodan_home_two_one","bodan_home_three_zero","bodan_home_three_one","bodan_home_three_two"]
+                        new_two = ["bodan_guest_one_zero","bodan_guest_two_zero","bodan_guest_two_one","bodan_guest_three_zero","bodan_guest_three_one","bodan_guest_three_two"]
+                        new_three = ["bodan_dogfall_zero_zero","bodan_dogfall_one_one","bodan_dogfall_two_two","bodan_dogfall_three_three"]
+                        halfbodan = new_half_bodans[0:12]
+                        half_bodan_home = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 == 0]
+                        # 队1
+                        for index, t in enumerate(new_one):
+                            half_bodan_data[t] = half_bodan_home[index]
+                        # 队2
+                        half_bodan_guest = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 == 1]
+                        for y, z in enumerate(new_two):
+                            half_bodan_data[z] = half_bodan_guest[y]
+                        # 和/平
+                        half_bodan_dogfall = new_half_bodans[-6:-2]
+                        for a, b in enumerate(new_three):
+                            half_bodan_data[b] = half_bodan_dogfall[a]
+                        # 其他
+                        half_bodan_data['bodan_other'] = new_half_bodans[-1]
+                        bodan["half_bodan"] = half_bodan_data
+                else:
+                    bodan['half_bodan'] = ""
+                bodan['league_id'] = league_id
+                bodan['league_name'] = league_name
+                bodan['game_id'] = game_id
+                bodan['team_home'] = team_home
+                bodan['team_guest'] = team_guest
+                bodan['number'] = number
+                bodan['data_game'] = data_game
+                bodan['time_game'] = time_game
+                bodan['corner_ball'] = corner_ball
+                bodan['status'] = status
+                bodan['score_home'] = score_home
+                bodan['score_guest'] = score_guest
+                bodan['half_way'] = half_way
+                bodanlist[game_id] = bodan
+                item["bodan"] = bodanlist
+
+
+
+
+
+                # 早盘 最先/最后进球
+                first_last_ball = {}
+                # 早盘 最先/最后进球 最先进球
+                first_balls = new_result['o'].get('ttslast', "")
+                if first_balls:
+                    first_ball = [first_balls[i] for i in range(len(first_balls)) if i % 2 == 1]
+                    first_last_ball['first_ball_home'] = first_ball[0]
+                    first_last_ball['first_ball_guest'] = first_ball[1]
+                else:
+                    first_last_ball['first_ball_home'] = ""
+                    first_last_ball['first_ball_guest'] = ""
+                # 早盘 最先/最后进球 最后进球
+                last_balls = new_result['o'].get('tts1st', "")
+                if last_balls:
+                    last_ball = [last_balls[i] for i in range(len(last_balls)) if i % 2 == 1]
+                    first_last_ball['last_ball_home'] = last_ball[0]
+                    first_last_ball['last_ball_guest'] = last_ball[1]
+                    first_last_ball['not_ball'] = last_ball[2]
+                else:
+                    first_last_ball['last_ball_home'] = ""
+                    first_last_ball['last_ball_guest'] = ""
+                    first_last_ball['not_ball'] = ""
+                first_last_ball['league_id'] = league_id
+                first_last_ball['league_name'] = league_name
+                first_last_ball['game_id'] = game_id
+                first_last_ball['team_home'] = team_home
+                first_last_ball['team_guest'] = team_guest
+                first_last_ball['number'] = number
+                first_last_ball['data_game'] = data_game
+                first_last_ball['time_game'] = time_game
+                first_last_ball['corner_ball'] = corner_ball
+                first_last_ball['score_home'] = score_home
+                first_last_ball['score_guest'] = score_guest
+                first_last_ball['half_way'] = half_way
+                first_last_ball['status'] = status
+                firstlastballlist[game_id] = first_last_ball
+                # 最先/最后进球
+                item["first_last_ball"] = firstlastballlist
+        yield item
+
+
+
+
+
+
+        # print(type(datas))
+
+
+
+        # item = Hg3535Item()
+        # ids = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[16]') # ids新列表
+        # if ids:
+        #     ids1 = set(ids)#去重
+        #     for i in ids1:
+        #         urls = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
+        #         print(urls)
+        #         yield Request(url=urls, callback=self.parse_each)
+        # s_k = reverli(jsonpath.jsonpath(res,'$..i-ot[0].s.k')) # s字典下面的k 数字
+        # s_n= reverli(jsonpath.jsonpath(res,'$..i-ot[0].s.n')) # s字典下面的n
+
+        # pci_ctn = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[::]..ctn'))
+        # c_ks= jsonpath.jsonpath(res,'$..i-ot[0]..egs..c..k')#递归查找c字典下面k的值返回列表
+        # c_kns = jsonpath.jsonpath(res,'$..i-ot[0]..egs..c..n')#递归查找c字典下面的n返回列表
+
+        # es_i_0s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[0]') #递归查找队1名
+        # es_i_1s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[1]')  # 递归查找队2名
+        # es_i_2s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[2]') # 递归查找num
+        # es_i_4s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[4]') # 递归查找比赛日期
+        # es_i_5s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[5]') # 比赛时间
+        # es_i_10s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[10]') #队一比分
+        # es_i_11s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[11]') # 队二比分
+        # es_i_12s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[12]') # 半场
+        # es_i_16s = jsonpath.jsonpath(res, '$..i-ot[0]..egs..es..i[16]') #比赛id
+        # o_ah1s = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ah[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')# o ah 列表
+        # o_ou1s = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ou[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o ou 列表
+        # o_1x2s = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..1x2[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1X2 列表  并不是一定存在
+        # o_ahlsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ah1st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o ah1st 列表  并不是一定存在
+        # o_ou1sts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ou1st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o oulst 列表  并不是一定存在
+        # o_1x21sts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..1x21st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+        # o_oes = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..oe[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+        # o_oelsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..oelst[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+        # o_tgs = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..tg[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+        # o_tglsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..tglst[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+        # o_hfs = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..hf[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+        # o_css = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..cs[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+        # o_cslsts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..cslst[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+        # o_ttslasts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..ttslast[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+        # o_tts1sts = jsonpath.jsonpath(res,'$..i-ot[0]..egs..es..o..tts1st[1,3,5,7,9,11,13,15,17,19,21, 23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109]')#  o 1x2lst 列表  并不是一定存在
+
+        # item['league_id'] = s_k
+        # item['league_name'] = s_n
+        # item['ctn'] = pci_ctn
+        # item['one_team_name'] = es_i_0s
+        # item['two_team_name'] = es_i_1s
+        # item['num'] = es_i_2s
+        # item['date_match'] = es_i_4s
+        # item['date_time'] = es_i_5s
+        # item['one_team_score'] = es_i_10s
+        # item['two_team_score'] = es_i_11s
+        # item['half_time'] = es_i_12s
+        # item['match_id'] = es_i_16s
+        # item['give_ball'] = o_ah1s
+        # item['full_size'] = o_ou1s
+        # item['win_situation'] = o_1x2s
+        # item['half_handicap'] = o_ahlsts
+        # item['half_size'] = o_ou1sts
+        # item['half_win'] = o_1x21sts
+        # item['full_score'] = o_oes
+        # item['half_goal'] = o_oelsts
+        # item['total_goal'] = o_tgs
+        # item['first_half_goal'] = o_tglsts
+        # item['half_full_time'] = o_hfs
+        # item['full_field'] = o_css
+        # item['half_wave'] = o_cslsts
+        # item['advanced_ball'] = o_ttslasts
+        # item['final_goal'] = o_tts1sts
+        #
+        # yield item
+
+
+
+
+
+
+
+
+
+
+
+        # s_k = ("".join('%s' %id for id in s_k))#列表内数字转成字符串1
+        # pci_ctn = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[::]..ctn'))
+        # es_i1_0 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[0]'))#i1 代表es下的第一个i i2第二个
+        # es_i1_1 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[1]'))
+        # es_i1_2 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[2]'))
+        # es_i1_4 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[4]'))
+        # es_i1_5 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[5]'))
+        # es_i1_10 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[10]'))
+        # es_i1_11 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[11]'))
+        # es_i1_12 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[12]'))
+        # es_i1_16 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0].i[16]'))
+        # es_i2_0 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[0]'))#i1 代表es下的第一个i i2第二个
+        # es_i2_1 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[1]'))#i1 代表es下的第一个i i2第二个
+        # es_i2_2 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[2]'))#i1 代表es下的第一个i i2第二个
+        # es_i2_4 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[4]'))#i1 代表es下的第一个i i2第二个
+        # es_i2_5 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[5]'))#i1 代表es下的第一个i i2第二个
+        # es_i2_10 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[10]'))#i1 代表es下的第一个i i2第二个
+        # es_i2_11 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[11]'))#i1 代表es下的第一个i i2第二个
+        # es_i2_12 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[12]'))#i1 代表es下的第一个i i2第二个
+        # es_i2_16 = reverli(jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[1].i[16]'))#i1 代表es下的第一个i i2第二个
+        # o_ah1 = jsonpath.jsonpath(res,'$..i-ot[0].egs[0].es[0]..o..ah[1,3,5,7,9,11,13,15,17,19,21]')#o字典下 ah 取奇数是个列表
+        #
+        # print(s_k)
+
+        # pass
+        # item = DoubanItem()
+        # item['movie_name'] = response.xpath('//span[@property="v:itemreviewed"]/text()').extract()
+        # item['movie_director'] = response.xpath('//a[@rel="v:directedBy"]/text()').extract()
+        # item['movie_starring'] = response.xpath('//a[@rel="v:starring"]/text()').extract()
+        # item['movie_category'] = response.xpath('//span[@property="v:genre"]/text()').extract()
+        # item['movie_time'] = response.xpath('//span[@property="v:runtime"]/text()').extract()
+        # item['movie_star'] = response.xpath('//strong[@property="v:average"]/text()').extract()
+        # item['movie_5score'] = response.xpath('//span[@class="rating_per"][1]/text()').extract()
+        # item['movie_4score'] = response.xpath('//span[@class="rating_per"][2]/text()').extract()
+        # item['movie_3score'] = response.xpath('//span[@class="rating_per"][3]/text()').extract()
+        # item['movie_2score'] = response.xpath('//span[@class="rating_per"][4]/text()').extract()
+        # item['movie_1score'] = response.xpath('//span[@class="rating_per"][5]/text()').extract()
+        # yield item
+
+    # def parse_each(self,response):
+    #     res =  json.loads(response.text)
+    #     eg_c_k = jsonpath.jsonpath(res, '$..eg.c.k')
+    #     eg_c_n = jsonpath.jsonpath(res, '$..eg.c.n')
+
+
+
+        # pass
+
+
+
+
+    # def parse_other(self, response):
+    #     print(response)
+    #     # 球队进球数 大小
+    #     try:
+    #         datas = json.loads(response.text)['eg']['es']
+    #         league_id = json.loads(response.text)['eg']['c']['k']
+    #         # 联赛名
+    #         league_name = json.loads(response.text)['eg']['c']['n']
+    #     except:
+    #         datas = ""
+    #         league_id = ""
+    #         # 联赛名
+    #         league_name = ""
+    #     if datas:
+    #         item = Temaball()
+    #         full_dict = {}
+    #         half_dict = {}
+    #         full_dict_rule = {}
+    #         half_dict_rule = {}
+    #         data_list = []
+    #         for data in datas:
+    #             try:
+    #                 new_data = data['pci']['ctid']
+    #             except:
+    #                 new_data = ""
+    #             pass
+    #             if new_data == 0:
+    #                 # 比赛id
+    #                 game_id = str(data['k'])
+    #                 data_list.append(game_id)
+    #                 # 球队1
+    #                 team_home = data['i'][0]
+    #                 data_list.append(team_home)
+    #                 # 球队2
+    #                 team_guest = data['i'][1]
+    #                 data_list.append(team_guest)
+    #                 # 数量(97>)
+    #                 number = data['i'][2]
+    #                 data_list.append(number)
+    #                 # 状态
+    #                 # zhuangtai = data['i'][3]
+    #
+    #                 # 日期
+    #                 data_game = data['i'][4]
+    #                 data_list.append(data_game)
+    #                 # 开赛时间
+    #                 time_game = data['i'][5]
+    #                 data_list.append(time_game)
+    #             if new_data == 12:
+    #                 try:
+    #                     home_data = data['o']['ou']['v']
+    #
+    #                     # 球队进球 大条件
+    #                     home_size_big_rule = home_data[1]
+    #                     full_dict_rule['home_size_big'] = home_size_big_rule
+    #
+    #                     # 球队进球大赔率
+    #                     home_size_big = home_data[5]
+    #                     full_dict['home_size_big'] = home_size_big
+    #
+    #                     # 球队进球小条件
+    #                     home_size_small_rule = home_data[3]
+    #                     full_dict_rule['home_size_small'] = home_size_small_rule
+    #
+    #                     # 球队进球小赔率
+    #                     home_size_small = home_data[7]
+    #                     full_dict['home_size_small'] = home_size_small
+    #                 except:
+    #                     full_dict['home_size_small'] = ""
+    #                     full_dict_rule['home_size_small'] = ""
+    #
+    #                     full_dict['home_size_big'] = ""
+    #                     full_dict_rule['home_size_big'] = ""
+    #                 try:
+    #                     half_home_data = data['o']['ou1st']['v']
+    #
+    #                     half_home_size_big_rule = half_home_data[1]
+    #                     half_dict_rule['half_home_size_big'] = half_home_size_big_rule
+    #
+    #                     half_home_size_big = half_home_data[5]
+    #                     half_dict['half_home_size_big'] = half_home_size_big
+    #
+    #                     half_home_size_small_rule = half_home_data[3]
+    #                     half_dict_rule['half_home_size_small'] = half_home_size_small_rule
+    #
+    #                     half_home_size_small = half_home_data[7]
+    #                     half_dict['half_home_size_small'] = half_home_size_small
+    #
+    #                 except:
+    #                     half_dict_rule['half_home_size_big'] = ""
+    #                     half_dict['half_home_size_big'] = ""
+    #
+    #                     half_dict_rule['half_home_size_small'] = ""
+    #                     half_dict['half_home_size_small'] = ""
+    #
+    #             if new_data == 13:
+    #                 try:
+    #                     guest_data = data['o']['ou']['v']
+    #
+    #                     guest_size_big_rule = guest_data[1]
+    #                     full_dict_rule['guest_size_big'] = guest_size_big_rule
+    #
+    #                     guest_size_big = guest_data[5]
+    #                     full_dict['guest_size_big'] = guest_size_big
+    #
+    #                     guest_size_small_rule = guest_data[3]
+    #                     full_dict_rule['guest_size_small'] = guest_size_small_rule
+    #
+    #                     guest_size_small = guest_data[7]
+    #                     full_dict['guest_size_small'] = guest_size_small
+    #                 except:
+    #                     full_dict_rule['guest_size_big'] = ""
+    #                     full_dict['guest_size_big'] = ""
+    #
+    #                     full_dict_rule['guest_size_small'] = ""
+    #                     full_dict['guest_size_small'] = ''
+    #                 try:
+    #                     half_guest_data = data['o']['ou1st']['v']
+    #
+    #                     half_guest_size_big_rule = half_guest_data[1]
+    #                     half_dict_rule['half_guest_size_big'] = half_guest_size_big_rule
+    #
+    #                     half_guest_size_big = half_guest_data[5]
+    #                     half_dict['half_guest_size_big'] = half_guest_size_big
+    #
+    #                     half_guest_size_small_rule = half_guest_data[3]
+    #                     half_dict_rule['half_guest_size_small'] = half_guest_size_small_rule
+    #
+    #                     half_guest_size_small = half_guest_data[7]
+    #                     half_dict['half_guest_size_small'] = half_guest_size_small
+    #                 except:
+    #                     half_dict_rule['half_guest_size_big'] = ""
+    #                     half_dict['half_guest_size_big'] = ""
+    #
+    #                     half_dict_rule['half_guest_size_small'] = ""
+    #                     half_dict['half_guest_size_small'] = ""
+    #         #
+    #         item['league_id'] = league_id
+    #         item['league_name'] = league_name
+    #         item['game_id'] = data_list[0]
+    #         item['team_home'] = data_list[1]
+    #         item['team_guest'] = data_list[2]
+    #         item['number'] = data_list[3]
+    #         item['data_game'] = data_list[4]
+    #         item['time_game'] = data_list[5]
+    #         item['full_data'] = full_dict
+    #         item['half_data'] = half_dict
+    #         item['full_data_rule'] = full_dict_rule
+    #         item['half_data_rule'] = half_dict_rule
+    #         yield item

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 32 - 0
scrapy_yzd/scrapy_yzd/spiders/hg3535_bangqiu.py


+ 201 - 0
scrapy_yzd/scrapy_yzd/spiders/hg3535_supplement.py

@@ -0,0 +1,201 @@
+# -*- coding: utf-8 -*-
+# import jmespath
+import jsonpath
+import scrapy
+import json
+from scrapy.http import  Request
+
+from scrapy_yzd.items import Hg3535Item, Today_all,Temaball
+
+
+class Hg3535Spider(scrapy.Spider):
+    name = 'hg3535_supplement'
+    allowed_domains = ['hg3535z.com']
+    start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 足球滚球列url
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=3&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] # 滚球菜单 网球url
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0']
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=2&pt=4&ubt=am&pn=0&sb=2&dc=null&pid=0'] #篮球
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=1&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 = 'http://hg3535z.com/odds2/d/getamodds?eid={}&iip=true&ubt=am&isp=false'.format(i)
+                print(urls)
+                yield Request(url=urls, callback=self.parse_other)
+
+        # ids = []
+        #页面没数据异常处理
+        # try:
+        #     results = datas['i-ot'][0]['egs']
+        # except KeyError:
+        #     results = []
+        # 第一
+        # for result in results:
+        #     league_id = result['c']['k'] #联赛id
+        #     league_name = result['c']['n'] #联赛名
+            # new_results = result['es'] # 取出列表嵌套字典
+            # 二
+            # for new_result in new_results:
+            #     ids = []
+                # game_id = str(new_result['i'][16]) #比赛id
+                # ids.append(game_id)
+                # if ids:
+                #     ids1 = set(ids)#去重
+
+
+
+    def parse_other(self, response):
+        print(response)
+        # 球队进球数 大小
+        try:
+            datas = json.loads(response.text)['eg']['es']
+            league_id = json.loads(response.text)['eg']['c']['k']
+            # 联赛名
+            league_name = json.loads(response.text)['eg']['c']['n']
+        except:
+            datas = ""
+            league_id = ""
+            # 联赛名
+            league_name = ""
+        if datas:
+            item = Temaball()
+            full_dict = {}
+            half_dict = {}
+            full_dict_rule = {}
+            half_dict_rule = {}
+            data_list = []
+            for data in datas:
+                try:
+                    new_data = data['pci']['ctid']
+                except:
+                    new_data = ""
+                pass
+                if new_data == 0:
+                    # 比赛id
+                    game_id = str(data['k'])
+                    data_list.append(game_id)
+                    # 球队1
+                    team_home = data['i'][0]
+                    data_list.append(team_home)
+                    # 球队2
+                    team_guest = data['i'][1]
+                    data_list.append(team_guest)
+                    # 数量(97>)
+                    number = data['i'][2]
+                    data_list.append(number)
+                    # 状态
+                    # zhuangtai = data['i'][3]
+
+                    # 日期
+                    data_game = data['i'][4]
+                    data_list.append(data_game)
+                    # 开赛时间
+                    time_game = data['i'][5]
+                    data_list.append(time_game)
+                if new_data == 12:
+                    try:
+                        home_data = data['o']['ou']['v']
+
+                        # 球队进球 大条件
+                        home_size_big_rule = home_data[1]
+                        full_dict_rule['home_size_big'] = home_size_big_rule
+
+                        # 球队进球大赔率
+                        home_size_big = home_data[5]
+                        full_dict['home_size_big'] = home_size_big
+
+                        # 球队进球小条件
+                        home_size_small_rule = home_data[3]
+                        full_dict_rule['home_size_small'] = home_size_small_rule
+
+                        # 球队进球小赔率
+                        home_size_small = home_data[7]
+                        full_dict['home_size_small'] = home_size_small
+                    except:
+                        full_dict['home_size_small'] = ""
+                        full_dict_rule['home_size_small'] = ""
+
+                        full_dict['home_size_big'] = ""
+                        full_dict_rule['home_size_big'] = ""
+                    try:
+                        half_home_data = data['o']['ou1st']['v']
+
+                        half_home_size_big_rule = half_home_data[1]
+                        half_dict_rule['half_home_size_big'] = half_home_size_big_rule
+
+                        half_home_size_big = half_home_data[5]
+                        half_dict['half_home_size_big'] = half_home_size_big
+
+                        half_home_size_small_rule = half_home_data[3]
+                        half_dict_rule['half_home_size_small'] = half_home_size_small_rule
+
+                        half_home_size_small = half_home_data[7]
+                        half_dict['half_home_size_small'] = half_home_size_small
+
+                    except:
+                        half_dict_rule['half_home_size_big'] = ""
+                        half_dict['half_home_size_big'] = ""
+
+                        half_dict_rule['half_home_size_small'] = ""
+                        half_dict['half_home_size_small'] = ""
+
+                if new_data == 13:
+                    try:
+                        guest_data = data['o']['ou']['v']
+
+                        guest_size_big_rule = guest_data[1]
+                        full_dict_rule['guest_size_big'] = guest_size_big_rule
+
+                        guest_size_big = guest_data[5]
+                        full_dict['guest_size_big'] = guest_size_big
+
+                        guest_size_small_rule = guest_data[3]
+                        full_dict_rule['guest_size_small'] = guest_size_small_rule
+
+                        guest_size_small = guest_data[7]
+                        full_dict['guest_size_small'] = guest_size_small
+                    except:
+                        full_dict_rule['guest_size_big'] = ""
+                        full_dict['guest_size_big'] = ""
+
+                        full_dict_rule['guest_size_small'] = ""
+                        full_dict['guest_size_small'] = ''
+                    try:
+                        half_guest_data = data['o']['ou1st']['v']
+
+                        half_guest_size_big_rule = half_guest_data[1]
+                        half_dict_rule['half_guest_size_big'] = half_guest_size_big_rule
+
+                        half_guest_size_big = half_guest_data[5]
+                        half_dict['half_guest_size_big'] = half_guest_size_big
+
+                        half_guest_size_small_rule = half_guest_data[3]
+                        half_dict_rule['half_guest_size_small'] = half_guest_size_small_rule
+
+                        half_guest_size_small = half_guest_data[7]
+                        half_dict['half_guest_size_small'] = half_guest_size_small
+                    except:
+                        half_dict_rule['half_guest_size_big'] = ""
+                        half_dict['half_guest_size_big'] = ""
+
+                        half_dict_rule['half_guest_size_small'] = ""
+                        half_dict['half_guest_size_small'] = ""
+            #
+            item['league_id'] = league_id
+            item['league_name'] = league_name
+            item['game_id'] = data_list[0]
+            item['team_home'] = data_list[1]
+            item['team_guest'] = data_list[2]
+            item['number'] = data_list[3]
+            item['data_game'] = data_list[4]
+            item['time_game'] = data_list[5]
+            item['full_data'] = full_dict
+            item['half_data'] = half_dict
+            item['full_data_rule'] = full_dict_rule
+            item['half_data_rule'] = half_dict_rule
+            yield item

+ 820 - 0
scrapy_yzd/scrapy_yzd/spiders/hg3535basketball.py

@@ -0,0 +1,820 @@
+# -*- coding: utf-8 -*-
+import json
+
+import jsonpath
+import scrapy
+from scrapy.http import Request
+
+from scrapy_yzd.items import 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 = "lanqiu"
+    allowed_domains = ['hg3535z.com']
+    start_urls = ['http://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.Lanqiupipeline": 320,
+    #     }
+    # }
+    # 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 = 'http://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 = 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']["ou1st"]["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']["ou1st"]["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']["ou1st"]["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["odd_even_odd"] = odd_even_odd
+                odd_evens_dict_rule['odd_even_odd'] = '单'
+                odd_evens_dict["odd_even_even"] = odd_even_even
+                odd_evens_dict_rule['odd_even_even'] = '双'
+            except:
+                odd_even_odd = ""
+                odd_even_even = ""
+                odd_evens_dict["odd_even_odd"] = odd_even_odd
+                odd_evens_dict_rule['odd_even_odd'] = '单'
+                odd_evens_dict["odd_even_even"] = odd_even_even
+                odd_evens_dict_rule['odd_even_even'] = '双'
+            # 上半场全场 总分单双
+
+            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_odd_even_odd"] = half_odd_even_odd
+                odd_evens_dict_rule['half_odd_even_odd'] = '单'
+                odd_evens_dict["half_odd_even_even"] = half_odd_even_even
+                odd_evens_dict_rule['half_odd_even_even'] = '双'
+            except:
+                half_odd_even_odd = ""
+                half_odd_even_even = ""
+                odd_evens_dict["half_odd_even_odd"] = half_odd_even_odd
+                odd_evens_dict_rule['half_odd_even_odd'] = '单'
+                odd_evens_dict["half_odd_even_even"] = half_odd_even_even
+                odd_evens_dict_rule['half_odd_even_even'] = '双'
+
+            # 总分:单/双-第一节
+            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_odd_even_odd"] = one_odd_even_odd
+                odd_evens_dict_rule['one_odd_even_odd'] = '单'
+                odd_evens_dict["one_odd_even_even"] = one_odd_even_even
+                odd_evens_dict_rule['one_odd_even_even'] = '双'
+            except:
+                one_odd_even_odd = ""
+                one_odd_even_even = ""
+                odd_evens_dict["one_odd_even_odd"] = one_odd_even_odd
+                odd_evens_dict_rule['one_odd_even_odd'] = '单'
+                odd_evens_dict["one_odd_even_even"] = one_odd_even_even
+                odd_evens_dict_rule['one_odd_even_even'] = '双'
+
+
+            # 总分:单/双-第二节
+            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_odd_even_odd"] = two_odd_even_odd
+                odd_evens_dict_rule['two_odd_even_odd'] = '单'
+                odd_evens_dict["two_odd_even_even"] = two_odd_even_even
+                odd_evens_dict_rule['two_odd_even_even'] = '双'
+            except:
+                two_odd_even_odd = ""
+                two_odd_even_even = ""
+                odd_evens_dict["two_odd_even_odd"] = two_odd_even_odd
+                odd_evens_dict_rule['two_odd_even_odd'] = '单'
+                odd_evens_dict["two_odd_even_even"] = two_odd_even_even
+                odd_evens_dict_rule['two_odd_even_even'] = '单'
+
+            # 总分:单/双-第三节
+            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_odd_even_odd"] = three_odd_even_odd
+                odd_evens_dict_rule['three_odd_even_odd'] = '单'
+                odd_evens_dict["three_odd_even_even"] = three_odd_even_even
+                odd_evens_dict_rule['three_odd_even_even'] = '双'
+
+
+            except:
+                three_odd_even_odd = ""
+                three_odd_even_even = ""
+                odd_evens_dict["three_odd_even_odd"] = three_odd_even_odd
+                odd_evens_dict_rule['three_odd_even_odd'] = '单'
+                odd_evens_dict["three_odd_even_even"] = three_odd_even_even
+                odd_evens_dict_rule['three_odd_even_even'] = '双'
+
+
+
+            # 总分:单/双-第四节
+            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_odd_even_odd"] = four_odd_even_odd
+                odd_evens_dict_rule['four_odd_even_odd'] = '单'
+                odd_evens_dict["four_odd_even_even"] = four_odd_even_even
+                odd_evens_dict_rule['four_odd_even_even'] = '双'
+            except:
+                four_odd_even_odd = ""
+                four_odd_even_even = ""
+                odd_evens_dict["four_odd_even_odd"] = four_odd_even_odd
+                odd_evens_dict_rule['four_odd_even_odd'] = '单'
+                odd_evens_dict["four_odd_even_even"] = four_odd_even_even
+                odd_evens_dict_rule['four_odd_even_even'] = '双'
+
+# ----------------------------------------球队得分最后一位数分割线---------------------------------------------------------
+            # 球队得分最后一位数 主队
+            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_home"] = 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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 368 - 0
scrapy_yzd/scrapy_yzd/spiders/hg3535tennisball.py

@@ -0,0 +1,368 @@
+# -*- coding: utf-8 -*-
+import json
+
+import jsonpath
+import scrapy
+from scrapy.http import Request
+
+# from ..items import Lanqiu
+from scrapy_yzd.items import 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 = "tennis"
+    allowed_domains = ['hg3535z.com']
+    start_urls = ['http://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.Lanqiupipeline": 320,
+    #     }
+    # }
+    # 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 = 'http://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 = 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]
+            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"]
+                concedes_dict_rule['concede_home'] = concedes[1]
+                concedes_dict['concede_home'] = concedes[5]
+                concedes_dict_rule['concede_guest'] = concedes[3]
+                concedes_dict['concede_guest'] = concedes[7]
+            except:
+                concedes_dict_rule['concede_home'] = ""
+                concedes_dict['concede_home'] = ""
+                concedes_dict_rule['concede_guest'] = ""
+                concedes_dict['concede_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['bureau_home'] = bureaus[1]
+                bureaus_dict['bureau_home'] = bureaus[5]
+                bureaus_dict_rule['bureau_guest'] = bureaus[3]
+                bureaus_dict['bureau_guest'] = bureaus[7]
+            except:
+                bureaus_dict_rule['bureau_home'] = ""
+                bureaus_dict['bureau_home'] = ""
+                bureaus_dict_rule['bureau_guest'] = ""
+                bureaus_dict['bureau_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]
+                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"] = one_total_sizes_big_rule
+                total_number_dict["one_total_sizes_big"] = one_total_sizes_big
+                total_number_dict_rule["one_total_sizes_small"] = one_total_sizes_small_rule
+                total_number_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_number_dict_rule["one_total_sizes_big"] = one_total_sizes_big_rule
+                total_number_dict["one_total_sizes_big"] = one_total_sizes_big
+                total_number_dict_rule["one_total_sizes_small"] = one_total_sizes_small_rule
+                total_number_dict["one_total_sizes_small"] = 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"] = two_total_sizes_big
+                total_number_dict_rule["two_total_sizes_small"] = two_total_sizes_small_rule
+                total_number_dict["two_total_sizes_small"] = 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"] = three_total_sizes_big_rule
+                total_number_dict["three_total_sizes_big"] = three_total_sizes_big
+                total_number_dict_rule["three_total_sizes_small"] = three_total_sizes_small_rule
+                total_number_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_number_dict_rule["three_total_sizes_big"] = three_total_sizes_big_rule
+                total_number_dict["three_total_sizes_big"] = three_total_sizes_big
+                total_number_dict_rule["three_total_sizes_small"] = 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['odd_even_odd'] = odd_evens[1]
+                odd_evens_dict_rule['odd_even_odd'] = "单"
+                odd_evens_dict['odd_even_even'] = odd_evens[3]
+                odd_evens_dict_rule['odd_even_even'] = "双"
+
+            except:
+                odd_evens_dict['odd_even_odd'] = ""
+                odd_evens_dict['odd_even_even'] = ""
+                odd_evens_dict_rule['odd_even_odd'] = ""
+                odd_evens_dict_rule['odd_even_even'] = ""
+
+            # 联赛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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 66 - 0
scrapy_yzd/scrapy_yzd/spiders/jd_spider.py

@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from scrapy_yzd.items import jdItem
+import json
+import time
+
+
+class jdSpider(scrapy.Spider):
+    name = "jd"
+    allowed_domains = ["jd.com",
+                       "3.cn"]
+    start_urls = [
+        "http://list.jd.com/list.html?cat=9987,653,655&page=1&delivery=1&sort=sort_rank_asc&trans=1&JL=4_10_0#J_main"
+    ]
+
+    def parse(self, response):
+        a = 0
+        for href in response.xpath('//div/@data-sku'):
+            url = "https://item.jd.com/" + href.extract() + ".html"
+            print(url)
+            yield scrapy.Request(url, callback=self.parse_each_phone)
+            a += 1
+        print("This page's phone number:" + str(a))
+
+        time.sleep(20)
+        next_page = response.xpath('//a[@class="pn-next"]/@href').extract()
+        if next_page:
+            next_page = "https://list.jd.com" + next_page[0]
+            print('--------------Finding next page--------------------------'), next_page
+            yield scrapy.Request(next_page, callback=self.parse)
+        else:
+            print('--------------There is no more page!--------------------------')
+
+    def parse_price(self, response):
+        item = response.meta['item']
+        price_str = response.body
+        price_str = price_str[2:-4]
+        js = json.loads(str(price_str))
+        print(js['p'])
+        item['phone_price'] = js['p']
+        yield item
+        # return item
+
+    def parse_each_phone(self, response):
+        item = jdItem()
+        each_id = response.xpath('//ul[@class="parameter2 p-parameter-list"]/li[2]/@title').extract()
+        item['phone_id'] = each_id
+        item['phone_name'] = response.xpath('normalize-space(//div[@class="sku-name"]/text())').extract() #到了美国有空格了,不知道为何,已修复
+        item['phone_houdu'] = response.xpath('//*[@id="detail"]/div[2]/div[2]/div[1]/div[2]/dl/dd[4]/text()').extract()
+        item['phone_CPU'] = response.xpath('//*[@id="detail"]/div[2]/div[2]/div[1]/div[4]/dl/dd[1]/text()').extract()
+        item['phone_ROM'] = response.xpath('//*[@id="detail"]/div[2]/div[2]/div[1]/div[6]/dl/dd[1]/text()').extract()
+        item['phone_RAM'] = response.xpath('//*[@id="detail"]/div[2]/div[2]/div[1]/div[6]/dl/dd[2]/text()').extract()
+        item['phone_screen'] = response.xpath('//*[@id="detail"]/div[2]/div[2]/div[1]/div[7]/dl/dd[2]/text()').extract()
+        item['phone_frontcam'] = response.xpath('//*[@id="detail"]/div[2]/div[2]/div[1]/div[8]/dl/dd[1]/text()').extract()
+        item['phone_backcam'] = response.xpath('//*[@id="detail"]/div[2]/div[2]/div[1]/div[9]/dl/dd[2]/text()').extract()
+        each_id = str(each_id[0])
+        url = "https://p.3.cn/prices/mgets?callback=&skuIds=J_" + each_id
+        yield scrapy.Request(url, meta={'item': item}, callback=self.parse_price)
+        # yield item # 导致重复商品且无价格,原因未知
+
+
+
+
+
+
+

+ 100 - 0
scrapy_yzd/scrapy_yzd/spiders/steam_spider.py

@@ -0,0 +1,100 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from scrapy_yzd.items import SteamItem
+
+class steamSpider(scrapy.Spider):
+    name = "steam"
+    allowed_domains = ["store.steampowered.com"]
+
+    def parse(self, response):
+        for page in range(1, 1347):
+            url_page = 'http://store.steampowered.com/search/?sort_by=Price_ASC&page=' + str(page)
+            yield scrapy.Request(url_page,
+                                 callback=self.parse_each_page)
+
+    def parse_each_page(self, response):
+        for url_game in response.xpath('//*[@id="search_result_container"]/div[2]/a/@href').extract():
+            yield scrapy.Request(url_game,
+                                 callback=self.parse_each_game,
+                                 cookies={'mature_content': '1'})
+
+    def parse_each_game(self, response):
+        item = SteamItem()
+
+        app_name = response.xpath('//*[@class="apphub_AppName"]/text()').extract_first()
+        if app_name == '' or app_name:
+            self.log('no get data meta:%s' % response.meta)
+            return
+        item['name'] = app_name
+
+        price = response.xpath('//div[@class="game_purchase_price price"]/text()').extract_first()
+        try:
+            p = price.split('¥')
+            price = int(p[1])
+        except:
+            price = -1
+        item['price'] = price
+
+        release_date = response.xpath('//*[@class="release_date"]/span/text()').extract_first()
+        item['release_date'] = release_date
+
+        metacritic_score = response.xpath('//div[@class="score high"]/text()').extract_first()
+        try:
+            metacritic_score = int(metacritic_score)
+        except:
+            metacritic_score = -1
+        item['metacritic_score'] = metacritic_score
+
+        # 所有用户回复数量
+        user_reviews_count = response.xpath('//label[@for="review_type_all"]/span/text()').extract_first()
+        user_reviews_count = self.count_to_int(user_reviews_count)
+        item['user_reviews_count'] = user_reviews_count
+
+        # 好评的用户数量
+        positive_user_reviews_count = response.xpath('//label[@for="review_type_positive"]/span/text()').extract_first()
+        positive_user_reviews_count = self.count_to_int(positive_user_reviews_count)
+        item['positive_user_reviews_count'] = positive_user_reviews_count
+
+        # 好评的百分比
+        if user_reviews_count != -1 and positive_user_reviews_count != -1:
+            positive_percent = positive_user_reviews_count * 1.0 / user_reviews_count * 100
+        else:
+            positive_percent = 0
+        item['positive_percent'] = positive_percent
+
+        # 差评的用户数量
+        negative_user_reviews_count = response.xpath('//label[@for="review_type_negative"]/span/text()').extract_first()
+        negative_user_reviews_count = self.count_to_int(negative_user_reviews_count)
+        item['negative_user_reviews_count'] = negative_user_reviews_count
+
+        # 在 steam 购买的用户的评论数
+        steam_user_reviews_count = response.xpath('//label[@for="purchase_type_steam"]/span/text()').extract_first()
+        steam_user_reviews_count = self.count_to_int(steam_user_reviews_count)
+        item['steam_user_reviews_count'] = steam_user_reviews_count
+
+        # 在其他平台购买的用户的评论数
+        non_steam_user_reviews_count = response.xpath('//label[@for="purchase_type_non_steam"]/span/text()').extract_first()
+        non_steam_user_reviews_count = self.count_to_int(non_steam_user_reviews_count)
+        item['non_steam_user_reviews_count'] = non_steam_user_reviews_count
+
+        # 英语评论的数量
+        english_user_reviews_count = response.xpath('//label[@for="review_language_mine"]/span/text()').extract_first()
+        english_user_reviews_count = self.count_to_int(english_user_reviews_count)
+        item['english_user_reviews_count'] = english_user_reviews_count
+
+        # 非英语的评论数量
+        non_english_user_reviews_count = user_reviews_count - english_user_reviews_count
+        item['non_english_user_reviews_count'] = non_english_user_reviews_count
+
+        yield item
+
+    def count_to_int(self, data):  # 评价数逗号括号去除
+        try:
+            ret = data
+            ret = ret.replace('(', '')
+            ret = ret.replace(')', '')
+            ret = ret.replace(',', '')
+
+            return int(ret)
+        except:
+            return -1

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 8 - 0
scrapy_yzd/scrapy_yzd/spiders/test.py


+ 671 - 0
scrapy_yzd/scrapy_yzd/test1.py

@@ -0,0 +1,671 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+__author__ = 'ethereal'
+__mtime__ = '2019/3/29'
+
+
+
+# -*- coding: utf-8 -*-
+import json
+
+import scrapy
+
+from ..items import Today_all
+
+
+class TodayAllSpider(scrapy.Spider):
+    name = 'today_all'
+    allowed_domains = ['hg3535z.com']
+    custom_settings = {
+        "ITEM_PIPELINES":{
+            'hg3535.pipelines.Chuanpipeline': 300,
+        }
+    }
+    # 早盘 让球大小盘
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=2&ubt=am&pn=0&sb=2&dc=null&pid=0']
+    # 早盘独赢
+    start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=2&ubt=ftht1x2&pn=0&sb=2&dc=null&pid=0']
+    # 早盘入球数 单双
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=2&ubt=oe&pn=0&sb=2&dc=null&pid=0']
+    # 早盘 总入球
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=2&ubt=tg&pn=0&sb=2&dc=null&pid=0']
+    # 早盘 半场/全场
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=2&ubt=htft&pn=0&sb=2&dc=null&pid=0']
+    # 早盘 波胆
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=2&ubt=cs&pn=0&sb=2&dc=null&pid=0']
+    # 早盘 最先/最后进球
+    # start_urls = ["http://hg3535z.com/odds2/d/getodds?sid=1&pt=2&ubt=fglg&pn=0&sb=2&dc=null&pid=0"]
+    # 早盘 冠军
+    # start_urls = ['http://hg3535z.com/odds2/d/getodds?sid=1&pt=2&ubt=or&pn=0&sb=2&dc=null&pid=0']
+    # def start_requests(self):
+    #     newall_lists = ['am', 'ftht1x2', 'oe', 'tg', 'htft', 'cs', 'fglg', 'or']
+    #     for i in range(10):
+    #         for newall_list in newall_lists:
+    #             newall_list = str(newall_list)
+    #             url = 'http://hg3535z.com/odds2/d/getodds?sid=1&pt=2&ubt='+newall_list+'&pn='+str(i)+'&sb=2&dc=null&pid=0'
+    #             yield scrapy.Request(url=url, callback=self.parse, dont_filter=True)
+
+    def parse(self, response):
+        datas = json.loads(response.text)
+        # 早盘让球大小盘  concede_size
+        item = Today_all()
+        # 早盘让球大小球
+        if datas.get('n-ot', "").get('tn', "") == 'fb-np-all-sd':
+            results = datas['n-ot']['egs']
+            datalist = {}
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                for new_result in new_results:
+                    # 比赛id
+                    game_id = str(new_result['i'][16])
+                    # 球队1
+                    team_home = new_result['i'][0]
+                    # 球队2
+                    team_guest = new_result['i'][1]
+                    # 数量(97>)
+                    number = new_result['i'][2]
+                    # 日期
+                    data_game = new_result['i'][4]
+                    # 开赛时间
+                    time_game = new_result['i'][5]
+                    # 队1分数
+                    score_home = new_result['i'][10]
+                    # 队2分数
+                    score_guest = new_result['i'][11]
+                    # 下半场
+                    half_way = new_result['i'][12]
+                    # 角球或者其他
+                    corner_ball = new_result['pci'].get('ctn', "")
+                    # 全场让球 concede
+                    concede_size = {}
+                    concedes = new_result['o'].get('ah', "")
+                    if concedes:
+                        new_concedes = [concedes[i] for i in range(len(concedes)) if i % 2 == 1]
+                        concede_homes = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 == 0]
+                        concede_home_rule = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 0]
+                        # concede_home_rule
+                        concede_size["concede_home_rule"] = concede_home_rule
+                        # concede_home
+                        concede_home = [concede_homes[i] for i in range(len(concede_homes)) if i % 2 == 1]
+                        concede_size["concede_home"] = concede_home
+                        concede_guests = [new_concedes[i] for i in range(len(new_concedes)) if i % 2 == 1]
+                        # concede_guest_rule
+                        concede_guest_rule = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 == 0]
+                        concede_size["concede_guest_rule"] = concede_guest_rule
+                        # concede_guest
+                        concede_guest = [concede_guests[i] for i in range(len(concede_guests)) if i % 2 == 1]
+                        concede_size["concede_guest"] = concede_guest
+                    else:
+                        concede_size["concede_guest"] = ""
+                        concede_size["concede_guest_rule"] = ""
+                        concede_size["concede_home"] = ""
+                        concede_size["concede_home_rule"] = ""
+
+                        # 上半场让球half_concede
+                    half_concedes = new_result['o'].get('ah1st', "")
+                    if half_concedes:
+                        new_half_concedes = [half_concedes[i] for i in range(len(half_concedes)) if i % 2 == 1]
+                        new_half_concede_homes = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 == 0]
+                        # half_concede_home_rule
+                        half_concede_home_rule = [new_half_concede_homes[i] for i in range(len(new_half_concede_homes)) if i % 2 == 0]
+                        concede_size["half_concede_home_rule"] = half_concede_home_rule
+                        # concede_home
+                        half_concede_home = [new_half_concede_homes[i] for i in range(len(new_half_concede_homes)) if i % 2 == 1]
+                        concede_size["half_concede_home"] = half_concede_home
+                        half_concede_guests = [new_half_concedes[i] for i in range(len(new_half_concedes)) if i % 2 == 1]
+                        # concede_guest_rule
+                        half_concede_guest_rule = [half_concede_guests[i] for i in range(len(half_concede_guests)) if i % 2 == 0]
+                        concede_size["half_concede_guest_rule"] = half_concede_guest_rule
+                        # concede_guest
+                        half_concede_guest = [half_concede_guests[i] for i in range(len(half_concede_guests)) if i % 2 == 1]
+                        concede_size["half_concede_guest"] = half_concede_guest
+                    else:
+                        concede_size["half_concede_home_rule"] = ""
+                        concede_size["half_concede_home"] = ""
+                        concede_size["half_concede_guest_rule"] = ""
+                        concede_size["half_concede_guest"] = ""
+
+                    # 全场大小size
+                    sizes = new_result['o'].get('ou', "")
+                    if sizes:
+                        new_sizes = [sizes[i] for i in range(len(sizes)) if i % 2 == 1]
+                        size_homes = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 == 0]
+                        # size_home_rule
+                        size_home_rule = [size_homes[i] for i in range(len(size_homes)) if i % 2 == 0]
+                        concede_size["size_home_rule"] = size_home_rule
+                        # size_home
+                        size_home = [size_homes[i] for i in range(len(size_homes)) if i % 2 == 1]
+                        concede_size["size_home"] = size_home
+                        size_guests = [new_sizes[i] for i in range(len(new_sizes)) if i % 2 == 1]
+                        # size_guest_rule
+                        size_guest_rule = [size_guests[i] for i in range(len(size_guests)) if i % 2 == 0]
+                        concede_size["size_guest_rule"] = size_guest_rule
+                        # csize_guest
+                        size_guest = [size_guests[i] for i in range(len(size_guests)) if i % 2 == 1]
+                        concede_size["size_guest"] = size_guest
+                    else:
+                        concede_size["size_guest"] = ""
+                        concede_size["size_guest_rule"] = ""
+                        concede_size["size_home"] = ""
+                        concede_size["size_home_rule"] = ""
+                    # 上半场大小 half_size
+                    half_sizes = new_result['o'].get('ou1st',"")
+                    if half_sizes:
+                        new_half_sizes = [half_sizes[i] for i in range(len(half_sizes)) if i % 2 == 1]
+                        half_size_homes = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 == 0]
+                        # size_home_rule
+                        half_size_home_rule = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 == 0]
+                        concede_size["half_size_home_rule"] = half_size_home_rule
+                        # half_size_home
+                        half_size_home = [half_size_homes[i] for i in range(len(half_size_homes)) if i % 2 == 1]
+                        concede_size["half_size_home"] =half_size_home
+                        half_size_guests = [new_half_sizes[i] for i in range(len(new_half_sizes)) if i % 2 == 1]
+                        # half_size_guest_rule
+                        half_size_guest_rule = [half_size_guests[i] for i in range(len(half_size_guests)) if i % 2 == 0]
+                        concede_size["half_size_guest_rule"] = half_size_guest_rule
+                        # half_size_guest
+                        half_size_guest = [half_size_guests[i] for i in range(len(half_size_guests)) if i % 2 == 1]
+                        concede_size["half_size_guest"] = half_size_guest
+                    else:
+                        concede_size["half_size_guest"] = ""
+                        concede_size["half_size_guest_rule"] = ""
+                        concede_size["half_size_home"] = ""
+                        concede_size["half_size_home_rule"] = ""
+                    concede_size['league_id'] = league_id
+                    concede_size['league_name'] = league_name
+                    concede_size['game_id'] = game_id
+                    concede_size['team_home'] = team_home
+                    concede_size['team_guest'] = team_guest
+                    concede_size['number'] = number
+                    concede_size['data_game'] = data_game
+                    concede_size['time_game'] = time_game
+                    concede_size['corner_ball'] = corner_ball
+                    concede_size['score_home'] = score_home
+                    concede_size['score_guest'] = score_guest
+                    concede_size['half_way'] = half_way
+                    datalist[game_id] = concede_size
+            # 让球大小盘
+            item["concede_size"] = datalist
+
+        # 早盘独赢
+        if datas.get('n-ot', "").get('tn', "") == 'fb-np-fh-1x2':
+            results = datas['n-ot']['egs']
+            datalist = {}
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                for new_result in new_results:
+                    # 比赛id
+                    game_id = str(new_result['i'][16])
+                    # 球队1
+                    team_home = new_result['i'][0]
+                    # 球队2
+                    team_guest = new_result['i'][1]
+                    # 数量(97>)
+                    number = new_result['i'][2]
+                    # 日期
+                    data_game = new_result['i'][4]
+                    # 开赛时间
+                    time_game = new_result['i'][5]
+                    # 队1分数
+                    score_home = new_result['i'][10]
+                    # 队2分数
+                    score_guest = new_result['i'][11]
+                    # 下半场
+                    half_way = new_result['i'][12]
+                    # 角球或者其他
+                    corner_ball = new_result['pci'].get('ctn',"")
+
+                    # 全场独赢
+                    capot = {}
+                    # 全场独赢capot
+                    capots = new_result['o'].get('1x2', "")
+                    if capots:
+                        new_capots = [capots[i] for i in range(len(capots)) if i % 2 == 1]
+                        capot["capot_home"] = new_capots[0]
+                        capot["capot_guest"] = new_capots[1]
+                        capot["capot_dogfall"] = new_capots[2]
+                    else:
+                        capot["capot_home"] = ""
+                        capot["capot_guest"] = ""
+                        capot["capot_dogfall"] = ""
+
+                    # 上半场独赢capot
+                    half_capots = new_result['o'].get('1x21st', "")
+                    if half_capots:
+                        new_half_capots = [half_capots[i] for i in range(len(half_capots)) if i % 2 == 1]
+                        capot["half_capot_home"] = new_half_capots[0]
+                        capot["half_capot_guest"] = new_half_capots[1]
+                        capot["half_capot_dogfall"] = new_half_capots[2]
+                    else:
+                        capot["half_capot_home"] = ""
+                        capot["half_capot_guest"] = ""
+                        capot["half_capot_dogfall"] = ""
+                    capot['league_id'] = league_id
+                    capot['league_name'] = league_name
+                    capot['game_id'] = game_id
+                    capot['team_home'] = team_home
+                    capot['team_guest'] = team_guest
+                    capot['number'] = number
+                    capot['data_game'] = data_game
+                    capot['time_game'] = time_game
+                    capot['corner_ball'] = corner_ball
+                    capot['score_home'] = score_home
+                    capot['score_guest'] = score_guest
+                    capot['half_way'] = half_way
+                    datalist[game_id] = capot
+            # 独赢
+            item["capot"] = datalist
+
+        # 早盘入球数单双
+        if datas.get('n-ot', "").get('tn', "") == 'fb-oe':
+            results = datas['n-ot']['egs']
+            datalist = {}
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                for new_result in new_results:
+                    # 比赛id
+                    game_id = str(new_result['i'][16])
+                    # 球队1
+                    team_home = new_result['i'][0]
+                    # 球队2
+                    team_guest = new_result['i'][1]
+                    # 数量(97>)
+                    number = new_result['i'][2]
+                    # 日期
+                    data_game = new_result['i'][4]
+                    # 开赛时间
+                    time_game = new_result['i'][5]
+                    # 队1分数
+                    score_home = new_result['i'][10]
+                    # 队2分数
+                    score_guest = new_result['i'][11]
+                    # 下半场
+                    half_way = new_result['i'][12]
+                    # 角球或者其他
+                    corner_ball = new_result['pci'].get('ctn',"")
+                    # 全场入球:单/双
+                    odd_even = {}
+                    # 全场入球:单/双 odd_even
+                    odd_evens = new_result['o'].get('oe',"")
+                    if odd_evens:
+                        new_odd_evens = [odd_evens[i] for i in range(len(odd_evens)) if i % 2 == 1]
+                        odd_even["odd_even_odd"] = new_odd_evens[0]
+                        odd_even["odd_even_even"] = new_odd_evens[1]
+                    else:
+                        odd_even["odd_even_odd"] = ""
+                        odd_even["odd_even_even"] = ""
+                    # 半场入球:单/双 half_odd_even
+                    half_odd_evens = new_result['o'].get('oe1st',"")
+                    if half_odd_evens:
+                        new_half_odd_evens = [half_odd_evens[i] for i in range(len(half_odd_evens)) if i % 2 == 1]
+                        odd_even["half_odd_even_odd"] = new_half_odd_evens[0]
+                        odd_even["half_odd_even_even"] = new_half_odd_evens[1]
+                    else:
+                        odd_even["half_odd_even_odd"] = ""
+                        odd_even["half_odd_even_even"] = ""
+                    odd_even['league_id'] = league_id
+                    odd_even['league_name'] = league_name
+                    odd_even['game_id'] = game_id
+                    odd_even['team_home'] = team_home
+                    odd_even['team_guest'] = team_guest
+                    odd_even['number'] = number
+                    odd_even['data_game'] = data_game
+                    odd_even['time_game'] = time_game
+                    odd_even['corner_ball'] = corner_ball
+                    odd_even['score_home'] = score_home
+                    odd_even['score_guest'] = score_guest
+                    odd_even['half_way'] = half_way
+                    datalist[game_id] = odd_even
+            # 入球数-单双
+            item["odd_even"] = datalist
+
+        # 早盘 总入球
+        if datas.get('n-ot', "").get('tn', "") == 'fb-tg':
+            results = datas['n-ot']['egs']
+            datalist = {}
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                for new_result in new_results:
+                    # 比赛id
+                    game_id = str(new_result['i'][16])
+                    # 球队1
+                    team_home = new_result['i'][0]
+                    # 球队2
+                    team_guest = new_result['i'][1]
+                    # 数量(97>)
+                    number = new_result['i'][2]
+                    # 日期
+                    data_game = new_result['i'][4]
+                    # 开赛时间
+                    time_game = new_result['i'][5]
+                    # 队1分数
+                    score_home = new_result['i'][10]
+                    # 队2分数
+                    score_guest = new_result['i'][11]
+                    # 下半场
+                    half_way = new_result['i'][12]
+                    total_goal = {}
+                    # 角球或者其他
+                    corner_ball = new_result['pci'].get('ctn', "")
+                    # 全场总进球 total_goal
+                    total_goals = new_result['o'].get('tg', "")
+                    if total_goals:
+                        new_total_goals = [total_goals[i] for i in range(len(total_goals)) if i % 2 == 1]
+                        total_goal["total_goal_zero"] = new_total_goals[0]
+                        total_goal["total_goal_two"] = new_total_goals[1]
+                        total_goal["total_goal_four"] = new_total_goals[2]
+                        total_goal["total_goal_seven"] = new_total_goals[3]
+                    else:
+                        total_goal["total_goal_zero"] = ""
+                        total_goal["total_goal_two"] = ""
+                        total_goal["total_goal_four"] = ""
+                        total_goal["total_goal_seven"] = ""
+
+                    # 总进球上半场 half_total_goal
+                    half_total_goals = new_result['o'].get('tg', "")
+                    if half_total_goals:
+                        new_half_total_goals = [half_total_goals[i] for i in range(len(half_total_goals)) if i % 2 == 1]
+                        total_goal["half_total_goal_zero"] = new_half_total_goals[0]
+                        total_goal["half_total_goal_one"] = new_half_total_goals[1]
+                        total_goal["half_total_goal_two"] = new_half_total_goals[2]
+                        total_goal["half_total_goal_three"] = new_half_total_goals[3]
+                    else:
+                        total_goal["half_total_goal_zero"] = ""
+                        total_goal["half_total_goal_one"] = ""
+                        total_goal["half_total_goal_two"] = ""
+                        total_goal["half_total_goal_three"] = ""
+                    total_goal['league_id'] = league_id
+                    total_goal['league_name'] = league_name
+                    total_goal['game_id'] = game_id
+                    total_goal['team_home'] = team_home
+                    total_goal['team_guest'] = team_guest
+                    total_goal['number'] = number
+                    total_goal['data_game'] = data_game
+                    total_goal['time_game'] = time_game
+                    total_goal['corner_ball'] = corner_ball
+                    total_goal['score_home'] = score_home
+                    total_goal['score_guest'] = score_guest
+                    total_goal['half_way'] = half_way
+                    datalist[game_id] = total_goal
+            # 总入球
+            item["total_goal"] = datalist
+
+        # 早盘 半场/全场
+        if datas.get('n-ot', "").get('tn', "") == 'fb-htft':
+            results = datas['n-ot']['egs']
+            datalist = {}
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                for new_result in new_results:
+                    # 比赛id
+                    game_id = str(new_result['i'][16])
+                    # 球队1
+                    team_home = new_result['i'][0]
+                    # 球队2
+                    team_guest = new_result['i'][1]
+                    # 数量(97>)
+                    number = new_result['i'][2]
+                    # 日期
+                    data_game = new_result['i'][4]
+                    # 开赛时间
+                    time_game = new_result['i'][5]
+                    # 队1分数
+                    score_home = new_result['i'][10]
+                    # 队2分数
+                    score_guest = new_result['i'][11]
+                    # 下半场
+                    half_way = new_result['i'][12]
+                    # 角球或者其他
+                    corner_ball = new_result['pci'].get('ctn', "")
+                    # 早盘 半场/全场
+                    half_full = {}
+                    new_lists = ["half_full_home_home", "half_full_home_dogfall", "half_full_home_guest", "half_full_dogfall_home", "half_full_dogfall_dogfall", "half_full_dogfall_guest", "half_full_guest_home","half_full_guest_dogfall", "half_full_guest_guest"]
+                    # 早盘 半场/全场
+                    half_fulls = new_result['o'].get('hf', "")
+                    if half_fulls:
+                        new_half_fulls = [half_fulls[i] for i in range(len(half_fulls)) if i % 2 == 1]
+                        for index, value in enumerate(new_lists):
+                            half_full[value] = new_half_fulls[index]
+                    else:
+                        for index, value in enumerate(new_lists):
+                            half_full[value] = ""
+                    half_full['league_id'] = league_id
+                    half_full['league_name'] = league_name
+                    half_full['game_id'] = game_id
+                    half_full['team_home'] = team_home
+                    half_full['team_guest'] = team_guest
+                    half_full['number'] = number
+                    half_full['data_game'] = data_game
+                    half_full['time_game'] = time_game
+                    half_full['corner_ball'] = corner_ball
+                    half_full['score_home'] = score_home
+                    half_full['score_guest'] = score_guest
+                    half_full['half_way'] = half_way
+                    datalist[game_id] = half_full
+            # 半场/全场
+            item["half_full"] = datalist
+
+        # 早盘 波胆
+        if datas.get('n-ot', "").get('tn', "") == 'fb-cs':
+            results = datas['n-ot']['egs']
+            datalist = {}
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                for new_result in new_results:
+                    # 比赛id
+                    game_id = str(new_result['i'][16])
+                    # 球队1
+                    team_home = new_result['i'][0]
+                    # 球队2
+                    team_guest = new_result['i'][1]
+                    # 数量(97>)
+                    number = new_result['i'][2]
+                    # 日期
+                    data_game = new_result['i'][4]
+                    # 开赛时间
+                    time_game = new_result['i'][5]
+                    # 队1分数
+                    score_home = new_result['i'][10]
+                    # 队2分数
+                    score_guest = new_result['i'][11]
+                    # 下半场
+                    half_way = new_result['i'][12]
+                    # 角球或者其他
+                    corner_ball = new_result['pci'].get('ctn', "")
+                    bodan = {}
+                    bodan_data = {}
+                    half_bodan_data = {}
+                    # 波胆
+                    bodans = new_result['o'].get('cs', "")
+                    if bodans:
+                        one_list = ["bodan_home_one_zero","bodan_home_two_zero","bodan_home_two_one","bodan_home_three_zero","bodan_home_three_one","bodan_home_three_two","bodan_home_four_zero","bodan_home_four_one","bodan_home_four_two","bodan_home_four_three"]
+                        two_list = ["bodan_guest_one_zero","bodan_guest_two_zero","bodan_guest_two_one","bodan_guest_three_zero","bodan_guest_three_one","bodan_guest_three_two","bodan_guest_four_zero","bodan_guest_four_one","bodan_guest_four_two","bodan_guest_four_three"]
+                        three_list = ["bodan_dogfall_zero_zero","bodan_dogfall_one_one","bodan_dogfall_two_two","bodan_dogfall_three_three","bodan_dogfall_four_four"]
+                        new_bodans = [bodans[i] for i in range(len(bodans)) if i % 2 == 1]
+                        new_bodan = new_bodans[0:20]
+                        # 主队bodan_home
+                        bodan_home = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 == 0]
+                        for index, t in enumerate(one_list):
+                            bodan_data[t] = bodan_home[index]
+                        # 客队bodan_guest
+                        bodan_guest = [new_bodan[i] for i in range(len(new_bodan)) if i % 2 == 1]
+                        for y, z in enumerate(two_list):
+                            bodan_data[z] = bodan_guest[y]
+                        bodan_dogfall = new_bodans[-7:-2]
+                        for a, b in enumerate(three_list):
+                            bodan_data[b] = bodan_dogfall[a]
+                        # 其他bodan_other
+                        bodan_data['bodan_other'] = new_bodans[-1]
+                        bodan['bodan'] = bodan_data
+                    else:
+                        bodan["bodan"] = ""
+                    half_bodans = new_result['o'].get('cs1st', "")
+                    if half_bodans:
+                        new_half_bodans = [half_bodans[i] for i in range(len(half_bodans)) if i % 2 == 1]
+                        new_one = ["bodan_home_one_zero","bodan_home_two_zero","bodan_home_two_one","bodan_home_three_zero","bodan_home_three_one","bodan_home_three_two"]
+                        new_two = ["bodan_guest_one_zero","bodan_guest_two_zero","bodan_guest_two_one","bodan_guest_three_zero","bodan_guest_three_one","bodan_guest_three_two"]
+                        new_three = ["bodan_dogfall_zero_zero","bodan_dogfall_one_one","bodan_dogfall_two_two","bodan_dogfall_three_three"]
+                        halfbodan = new_half_bodans[0:12]
+                        half_bodan_home = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 == 0]
+                        # 队1
+                        for index, t in enumerate(new_one):
+                            half_bodan_data[t] = half_bodan_home[index]
+                        # 队2
+                        half_bodan_guest = [halfbodan[i] for i in range(len(halfbodan)) if i % 2 == 1]
+                        for y, z in enumerate(new_two):
+                            half_bodan_data[z] = half_bodan_guest[y]
+                        # 和/平
+                        half_bodan_dogfall = new_half_bodans[-6:-2]
+                        for a, b in enumerate(new_three):
+                            half_bodan_data[b] = half_bodan_dogfall[a]
+                        # 其他
+                        half_bodan_data['bodan_other'] = new_half_bodans[-1]
+                        bodan["half_bodan"] = half_bodan_data
+                    else:
+                        bodan['half_bodan'] = ""
+                    bodan['league_id'] = league_id
+                    bodan['league_name'] = league_name
+                    bodan['game_id'] = game_id
+                    bodan['team_home'] = team_home
+                    bodan['team_guest'] = team_guest
+                    bodan['number'] = number
+                    bodan['data_game'] = data_game
+                    bodan['time_game'] = time_game
+                    bodan['corner_ball'] = corner_ball
+                    bodan['score_home'] = score_home
+                    bodan['score_guest'] = score_guest
+                    bodan['half_way'] = half_way
+                    datalist[game_id] = bodan
+            # 波胆
+            item["bodan"] = datalist
+
+        # 早盘 最先/最后进球
+        if datas.get('n-ot', "").get('tn', "") == 'fb-fglg':
+            datalist = {}
+            results = datas['n-ot']['egs']
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                for new_result in new_results:
+                    # 比赛id
+                    game_id = str(new_result['i'][16])
+                    # 球队1
+                    team_home = new_result['i'][0]
+                    # 球队2
+                    team_guest = new_result['i'][1]
+                    # 数量(97>)
+                    number = new_result['i'][2]
+                    # 日期
+                    data_game = new_result['i'][4]
+                    # 开赛时间
+                    time_game = new_result['i'][5]
+                    # 队1分数
+                    score_home = new_result['i'][10]
+                    # 队2分数
+                    score_guest = new_result['i'][11]
+                    # 下半场
+                    half_way = new_result['i'][12]
+                    # 角球或者其他
+                    corner_ball = new_result['pci'].get('ctn', "")
+                    # 早盘 最先/最后进球
+                    first_last_ball = {}
+                    # 早盘 最先/最后进球 最先进球
+                    first_balls = new_result['o'].get('ttslast', "")
+                    if first_balls:
+                        first_ball = [first_balls[i] for i in range(len(first_balls)) if i % 2 == 1]
+                        first_last_ball['first_ball_home'] = first_ball[0]
+                        first_last_ball['first_ball_guest'] = first_ball[1]
+                    else:
+                        first_last_ball['first_ball_home'] = ""
+                        first_last_ball['first_ball_guest'] = ""
+                    # 早盘 最先/最后进球 最后进球
+                    last_balls = new_result['o'].get('tts1st', "")
+                    if last_balls:
+                        last_ball = [last_balls[i] for i in range(len(last_balls)) if i % 2 == 1]
+                        first_last_ball['last_ball_home'] = last_ball[0]
+                        first_last_ball['last_ball_guest'] = last_ball[1]
+                        first_last_ball['not_ball'] = last_ball[2]
+                    else:
+                        first_last_ball['last_ball_home'] = ""
+                        first_last_ball['last_ball_guest'] = ""
+                        first_last_ball['not_ball'] = ""
+                    first_last_ball['league_id'] = league_id
+                    first_last_ball['league_name'] = league_name
+                    first_last_ball['game_id'] = game_id
+                    first_last_ball['team_home'] = team_home
+                    first_last_ball['team_guest'] = team_guest
+                    first_last_ball['number'] = number
+                    first_last_ball['data_game'] = data_game
+                    first_last_ball['time_game'] = time_game
+                    first_last_ball['corner_ball'] = corner_ball
+                    first_last_ball['score_home'] = score_home
+                    first_last_ball['score_guest'] = score_guest
+                    first_last_ball['half_way'] = half_way
+                    datalist[game_id] = first_last_ball
+            # 最先/最后进球
+            item["first_last_ball"] = datalist
+
+        # 早盘 冠军
+        if datas.get('n-ot', "").get('tn', "") == 'all-or':
+            datalist = {}
+            results = datas['n-ot']['egs']
+            for result in results:
+                # 联赛id
+                league_id = result['c']['k']
+                # 联赛名
+                league_name = result['c']['n']
+                new_results = result['es']
+                champion = {}
+                for new_result in new_results:
+                    data_game = new_result['i'][4]
+                    time_game = new_result['i'][5]
+                    new_league_name = new_result['egn'].replace('\t', '')
+                    new_champion = new_result['n-o'][0]['mn']
+                    for i in new_result['n-o'][0]['o']:
+                        game_id = str(new_result['i'][16])
+                        tema_home = i[0]
+                        champion_team = i[2]
+                        champion['league_name'] = league_name
+                        champion['tema_home'] = tema_home
+                        champion['league_id'] = league_id
+                        champion['game_id'] = game_id
+                        champion['data_game'] = data_game
+                        champion['time_game'] = time_game
+                        champion['new_league_name'] = new_league_name
+                        champion['champion_team'] = champion_team
+                        champion['new_champion'] = new_champion
+                        datalist[game_id] = champion
+            item['champion'] = datalist
+        yield item
+
+
+
+
+

+ 589 - 0
scrapy_yzd/scrapy_yzd/test3.py

@@ -0,0 +1,589 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+__author__ = 'ethereal'
+__mtime__ = '2019/3/29'
+
+
+# -*- coding: utf-8 -*-
+
+# Define your item pipelines here
+#
+# Don't forget to add your pipeline to the ITEM_PIPELINES setting
+# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
+
+import time
+from .models import st_zq_odds_record, st_zq_odds, database, st_zq_competition, st_zq_league, st_area
+
+
+def inset_odd(match_id,value,utime,ctime,condition,p_id,wanfa):
+    if st_zq_odds.filter(match_id=match_id):
+        for k, v in value.items():
+            st_zq_odd = st_zq_odds.filter(match_id=match_id, odds_code=k,p_code=wanfa)
+            if st_zq_odd:
+                if v:
+                    st_zq_odds.update(utime=utime, odds=v).where(st_zq_odds.match_id == match_id,
+                                                                 st_zq_odds.odds_code == k).execute()
+            else:
+                if v:
+                    st_zq_odds.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
+                                      condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,odds_code=k)
+    else:
+        for k, v in value.items():
+            if v:
+                st_zq_odds.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
+                                  condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,
+                                  odds_code=k)
+    for k, v in value.items():
+        if v:
+            st_zq_odds_record.create(match_id=match_id, ctime=ctime, utime=utime, max=v,
+                                     condition=condition[k], odds=v, p_id=p_id, p_code=wanfa,
+                                     odds_code=k)
+
+
+class Chuanpipeline(object):
+    def process_item(self, item, spider):
+        if spider.name == "today_all":
+            # 让球大小盘
+            concede_sizes = item.get('concede_size', "")
+            if concede_sizes:
+                with database.atomic():
+                    for key, value in concede_sizes.items():
+                        # 比赛日期
+                        data_game = value.pop('data_game').split("/")
+                        month = str(data_game[1].strip())
+                        day = str(data_game[0])
+                        # 比赛时间
+                        time_game = str(value.pop('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())
+                        # 比赛id
+                        competition_id = value.pop('game_id')
+                        # 联赛id
+                        league_id = value.pop('league_id')
+                        # 联赛name
+                        league_name = value.pop('league_name')
+                        # 主队
+                        team_home = value.pop('team_home')
+                        # 客队
+                        team_guest = value.pop('team_guest')
+                        # 主队得分
+                        score_home = value.pop('score_home')
+                        # 客队得分
+                        score_guest = value.pop('score_guest')
+                        # 全场让球
+                        # number
+                        number = value.pop('number')
+                        corner_ball = value.pop('corner_ball')
+                        half_way = value.pop('half_way')
+                        concede_home = value.get('concede_home', "")
+                        concede_home_rule = value.get('concede_home_rule', "")
+                        concede_guest = value.get("concede_guest", "")
+                        concede_guest_rule = value.get("concede_guest_rule", "")
+                        # 上半场让球
+                        half_concede_home = value.get("half_concede_home", "")
+                        half_concede_home_rule = value.get("half_concede_home_rule", "")
+                        half_concede_guest = value.get("half_concede_guest", "")
+                        half_concede_guest_rule = value.get("half_concede_guest_rule", "")
+                        # 全场大小
+                        size_home = value.get('size_home')
+                        size_home_rule = value.get('size_home')
+                        size_guest = value.get('size_guest')
+                        size_guest_rule = value.get('size_guest_rule', "")
+                        # 上半场大小
+                        half_size_home = value.get('half_size_home', "")
+                        half_size_home_rule = value.get('half_size_home_rule', "")
+                        half_size_guest = value.get('half_size_guset', "")
+                        half_size_guest_rule = value.get('half_size_guest_rule', "")
+                        if st_zq_odds.filter(match_id=key):
+                            for k, v in value.items():
+                                if v:
+                                    for index, result in enumerate(v):
+                                        st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code=k,p_code="concede_size")
+                                        if st_zq_odd:
+                                            if result:
+                                                st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,st_zq_odds.sort == index,st_zq_odds.odds_code == k).execute()
+                                        else:
+                                            if result:
+                                                    st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,condition=concede_home_rule[index], odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
+                        else:
+                            for k, v in value.items():
+                                if v:
+                                    for index, result in enumerate(v):
+                                        if result:
+                                            st_zq_odds.create(match_id=key, ctime=utime, utime=utime, max=result,condition=index, odds=result, p_id=1,p_code="concede_size", sort=index, odds_code=k)
+                        #     # 全场让球
+                        #     if concede_home:
+                        #         for index, result in enumerate(concede_home):
+                        #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="concede_home")
+                        #             if st_zq_odd:
+                        #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
+                        #                                                                   st_zq_odds.sort == index,
+                        #                                                                   st_zq_odds.odds_code == "concede_home").execute()
+                        #             else:
+                        #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                   condition=concede_home_rule[index], odds=result, p_id=1,
+                        #                                   p_code="concede_size", sort=index, odds_code="concede_home")
+                        #     if concede_guest:
+                        #         for index, result in enumerate(concede_guest):
+                        #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="concede_guest")
+                        #             if st_zq_odd:
+                        #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
+                        #                                                                   st_zq_odds.sort == index,
+                        #                                                                   st_zq_odds.odds_code == "concede_guest").execute()
+                        #             else:
+                        #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                   condition=concede_guest_rule[index], odds=result, p_id=1,
+                        #                                   p_code="concede_size", sort=index, odds_code="concede_guest")
+                        #     if half_concede_home:
+                        #         for index, result in enumerate(half_concede_home):
+                        #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="half_concede_home")
+                        #             if st_zq_odd:
+                        #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
+                        #                                                                   st_zq_odds.sort == index,
+                        #                                                                   st_zq_odds.odds_code == "half_concede_home").execute()
+                        #             else:
+                        #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                   condition=half_concede_home_rule[index], odds=result, p_id=1,
+                        #                                   p_code="concede_size", sort=index, odds_code="half_concede_home")
+                        #     if half_concede_guest:
+                        #         for index, result in enumerate(half_concede_guest):
+                        #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="half_concede_home")
+                        #             if st_zq_odd:
+                        #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
+                        #                                                                   st_zq_odds.sort == index,
+                        #                                                                   st_zq_odds.odds_code == "half_concede_guest").execute()
+                        #             else:
+                        #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime,
+                        #                                   max=half_concede_guest[index],
+                        #                                   condition=half_concede_guest_rule[index],
+                        #                                   odds=half_concede_guest[index], p_id=1, p_code="concede_size",
+                        #                                   sort=index, odds_code="half_concede_guest")
+                        #     if size_home:
+                        #         for index, result in enumerate(size_home):
+                        #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="size_home")
+                        #             if st_zq_odd:
+                        #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
+                        #                                                                   st_zq_odds.sort == index,
+                        #                                                                   st_zq_odds.odds_code == "size_home").execute()
+                        #             else:
+                        #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                   condition=size_home_rule[index], odds=result, p_id=1,
+                        #                                   p_code="concede_size", sort=index, odds_code="size_home")
+                        #     if size_guest:
+                        #         for index, result in enumerate(size_home):
+                        #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="size_guest")
+                        #             if st_zq_odd:
+                        #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
+                        #                                                                   st_zq_odds.sort == index,
+                        #                                                                   st_zq_odds.odds_code == "size_guest").execute()
+                        #             else:
+                        #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                   condition=size_guest_rule[index], odds=result, p_id=1,
+                        #                                   p_code="concede_size", sort=index, odds_code="size_guest")
+                        #     if half_size_home:
+                        #         for index, result in enumerate(half_size_home):
+                        #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="half_size_home")
+                        #             if st_zq_odd:
+                        #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
+                        #                                                                   st_zq_odds.sort == index,
+                        #                                                                   st_zq_odds.odds_code == "half_size_home").execute()
+                        #             else:
+                        #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                   condition=half_size_home_rule[index], odds=result, p_id=1,
+                        #                                   p_code="concede_size", sort=index, odds_code="half_size_home")
+                        #     if half_size_guest:
+                        #         for index, result in enumerate(half_size_guest):
+                        #             st_zq_odd = st_zq_odds.filter(match_id=key, sort=index, odds_code="half_size_guest")
+                        #             if st_zq_odd:
+                        #                 st_zq_odds.update(utime=utime, odds=result).where(st_zq_odds.match_id == key,
+                        #                                                                   st_zq_odds.sort == index,
+                        #                                                                   st_zq_odds.odds_code == "half_size_guest").execute()
+                        #             else:
+                        #                 st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                   condition=half_size_guest_rule[index], odds=result, p_id=1,
+                        #                                   p_code="concede_size", sort=index, odds_code="half_size_guest")
+                        # else:
+                        #     if concede_home:
+                        #         for index, result in enumerate(concede_home):
+                        #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                               condition=concede_home_rule[index], odds=result, p_id=1,
+                        #                               p_code="concede_size", sort=index, odds_code="concede_home")
+                        #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=concede_guest[index],
+                        #                               condition=concede_guest_rule[index], odds=concede_guest[index],
+                        #                               p_id=1, p_code="concede_size", sort=index, odds_code="concede_guest")
+                        #     if half_concede_home:
+                        #         for index, result in enumerate(half_concede_home):
+                        #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                               condition=half_concede_home_rule[index], odds=result, p_id=1,
+                        #                               p_code="concede_size", sort=index, odds_code="half_concede_home")
+                        #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=half_concede_guest[index],
+                        #                               condition=half_concede_guest_rule[index],
+                        #                               odds=half_concede_guest[index], p_id=1, p_code="concede_size",
+                        #                               sort=index, odds_code="half_concede_guest")
+                        #     if size_home:
+                        #         for index, result in enumerate(size_home):
+                        #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                               condition=size_home_rule[index], odds=result, p_id=1,
+                        #                               p_code="concede_size", sort=index, odds_code="size_home")
+                        #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=size_guest[index],
+                        #                               condition=size_guest_rule[index], odds=size_guest[index], p_id=1,
+                        #                               p_code="concede_size", sort=index, odds_code="size_guest")
+                        #     if half_size_home:
+                        #         for index, result in enumerate(half_size_home):
+                        #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                               condition=half_size_home_rule[index], odds=result, p_id=1,
+                        #                               p_code="concede_size", sort=index, odds_code="half_size_home")
+                        #     if half_size_guest:
+                        #         for index, result in enumerate(half_size_guest):
+                        #             st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=half_size_guest[index],
+                        #                               condition=half_size_guest_rule[index], odds=half_size_guest[index],
+                        #                               p_id=1, p_code="concede_size", sort=index,
+                        #                               odds_code="half_size_guest")
+                        # if concede_home:
+                        #     for index, result in enumerate(concede_home):
+                        #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                  condition=concede_home_rule[index], odds=result, p_id=1,
+                        #                                  p_code="concede_size", sort=index, odds_code="concede_home")
+                        #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=concede_guest[index],
+                        #                                  condition=concede_guest_rule[index], odds=concede_guest[index],
+                        #                                  p_id=1, p_code="concede_size", sort=index,
+                        #                                  odds_code="concede_guest")
+                        # if half_concede_home:
+                        #     for index, result in enumerate(half_concede_home):
+                        #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                  condition=half_concede_home_rule[index], odds=result, p_id=1,
+                        #                                  p_code="concede_size", sort=index, odds_code="half_concede_home")
+                        #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime,
+                        #                                  max=half_concede_guest[index],
+                        #                                  condition=half_concede_guest_rule[index],
+                        #                                  odds=half_concede_guest[index], p_id=1, p_code="concede_size",
+                        #                                  sort=index, odds_code="half_concede_guest")
+                        # if size_home:
+                        #     for index, result in enumerate(size_home):
+                        #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                  condition=size_home_rule[index], odds=result, p_id=1,
+                        #                                  p_code="concede_size", sort=index, odds_code="size_home")
+                        #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=size_guest[index],
+                        #                                  condition=size_guest_rule[index], odds=size_guest[index], p_id=1,
+                        #                                  p_code="concede_size", sort=index, odds_code="size_guest")
+                        # if half_size_home:
+                        #     for index, result in enumerate(half_size_home):
+                        #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=result,
+                        #                                  condition=half_size_home_rule[index], odds=result, p_id=1,
+                        #                                  p_code="concede_size", sort=index, odds_code="half_size_home")
+                        # if half_size_guest:
+                        #     for index, result in enumerate(half_size_guest):
+                        #         st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=half_size_guest[index],
+                        #                                  condition=half_size_guest_rule[index], odds=half_size_guest[index],
+                        #                                  p_id=1, p_code="concede_size", sort=index,
+                        #                                  odds_code="half_size_guest")
+                        # if st_zq_competition.filter(match_id=key):
+                        #     pass
+                        # else:
+                        #     st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
+
+            # 独赢
+            capots = item.get('capot', "")
+            if capots:
+                with database.atomic():
+                    for key, value in capots.items():
+                        # 比赛日期
+                        data_game = value.pop('data_game').split("/")
+                        month = str(data_game[1].strip())
+                        day = str(data_game[0])
+                        # 比赛时间
+                        time_game = str(value.pop('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())
+                        # 比赛id
+                        competition_id = value.pop('game_id')
+                        # 联赛id
+                        league_id = value.pop('league_id')
+                        # 联赛name
+                        league_name = value.pop('league_name')
+                        # 主队
+                        team_home = value.pop('team_home')
+                        # 客队
+                        team_guest = value.pop('team_guest')
+                        # 主队得分
+                        score_home = value.pop('score_home')
+                        # 客队得分
+                        score_guest = value.pop('score_guest')
+                        # number
+                        number = value.pop('number')
+                        corner_ball = value.pop('corner_ball')
+                        half_way = value.pop('half_way')
+                        capot_dict = {"capot_home":"1","capot_guest": "2","capot_dogfall":"x","half_capot_home":"1","half_capot_guest": "2","half_capot_dogfall":"x"}
+                        if corner_ball:
+                            wanfa = corner_ball
+                            p_id = 9
+                        else:
+                            wanfa = "capot"
+                            p_id = 2
+                        inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=capot_dict, p_id=p_id, wanfa=wanfa)
+                        if st_zq_competition.filter(match_id=key):
+                            pass
+                        else:
+                            st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
+
+
+            # 入球数-单双
+            odd_evens = item.get("odd_even", "")
+            if odd_evens:
+                with database.atomic():
+                    for key, value in odd_evens.items():
+                        data_game = value.pop('data_game').split("/")
+                        month = str(data_game[1].strip())
+                        day = str(data_game[0])
+                        time_game = str(value.pop('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())
+                        competition_id = value.pop('game_id')
+                        league_id = value.pop('league_id')
+                        league_name = value.pop('league_name')
+                        team_home = value.pop('team_home')
+                        team_guest = value.pop('team_guest')
+                        score_home = value.pop('score_home')
+                        score_guest = value.pop('score_guest')
+                        number = value.pop('number')
+                        corner_ball = value.pop('corner_ball')
+                        half_way = value.pop('half_way')
+                        odd_even_dict = {"odd_even_odd":"单","odd_even_even": "双","half_odd_even_odd": "单","half_odd_even_even":"双"}
+                        inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=odd_even_dict, p_id=3, wanfa="odd_even")
+                        if st_zq_competition.filter(match_id=key):
+                            pass
+                        else:
+                            st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
+
+            # 总入球
+            total_goals = item.get('total_goal', "")
+            if total_goals:
+                with database.atomic():
+                    for key, value in total_goals.items():
+                        data_game = value.pop('data_game').split("/")
+                        month = str(data_game[1].strip())
+                        day = str(data_game[0])
+                        time_game = str(value.pop('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())
+                        competition_id = value.pop('game_id')
+                        league_id = value.pop('league_id')
+                        league_name = value.pop('league_name')
+                        team_home = value.pop('team_home')
+                        team_guest = value.pop('team_guest')
+                        score_home = value.pop('score_home')
+                        score_guest = value.pop('score_guest')
+                        number = value.pop('number')
+                        corner_ball = value.pop('corner_ball')
+                        half_way = value.pop('half_way')
+                        total_dict = {'total_goal_zero': '0-1', 'total_goal_two': '2-3', 'total_goal_four': '4-6',
+                                      'total_goal_seven': '7或以上', 'half_total_goal_zero': '0', "half_total_goal_one": '1',
+                                      "half_total_goal_two": '2', "half_total_goal_three": '3或以上'}
+                        inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=total_dict, p_id=4, wanfa="total_goal")
+                        if st_zq_competition.filter(match_id=key):
+                            pass
+                        else:
+                            st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
+
+            # 半场/全场
+            half_fulls = item.get("half_full", "")
+            if half_fulls:
+                with database.atomic():
+                    for key, value in half_fulls.items():
+                        data_game = value.pop('data_game').split("/")
+                        month = str(data_game[1].strip())
+                        day = str(data_game[0])
+                        time_game = str(value.pop('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())
+                        competition_id = value.pop('game_id')
+                        league_id = value.pop('league_id')
+                        league_name = value.pop('league_name')
+                        team_home = value.pop('team_home')
+                        team_guest = value.pop('team_guest')
+                        score_home = value.pop('score_home')
+                        score_guest = value.pop('score_guest')
+                        number = value.pop('number')
+                        corner_ball = value.pop('corner_ball')
+                        half_way = value.pop('half_way')
+                        full_dict = {"half_full_home_home": "主主", "half_full_home_dogfall": "主和",
+                                     "half_full_home_guest": "主客", "half_full_dogfall_home": "和主",
+                                     "half_full_dogfall_dogfall": "和和", "half_full_dogfall_guest": "和客",
+                                     "half_full_guest_home": "客主", "half_full_guest_dogfall": "客和",
+                                     "half_full_guest_guest": "客客"}
+                        inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=full_dict, p_id=5,wanfa="half_full")
+                        if st_zq_competition.filter(match_id=key):
+                            pass
+                        else:
+                            st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
+
+
+            # 波胆
+            bodans = item.get("bodan", "")
+            if bodans:
+                with database.atomic():
+                    for key, value in bodans.items():
+                        data_game = value.pop('data_game').split("/")
+                        month = str(data_game[1].strip())
+                        day = str(data_game[0])
+                        time_game = str(value.pop('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())
+                        competition_id = value.pop('game_id')
+                        league_id = value.pop('league_id')
+                        league_name = value.pop('league_name')
+                        team_home = value.pop('team_home')
+                        team_guest = value.pop('team_guest')
+                        score_home = value.pop('score_home')
+                        score_guest = value.pop('score_guest')
+                        number = value.pop('number')
+                        corner_ball = value.pop('corner_ball')
+                        half_way = value.pop('half_way')
+                        new_bodan = value['bodan']
+                        bodan_dict = {"bodan_home_one_zero": "1-0", "bodan_home_two_zero": "2-0",
+                                      "bodan_home_two_one": "2-1", "bodan_home_three_zero": "3-0",
+                                      "bodan_home_three_one": "3-1", "bodan_home_three_two": "3-2",
+                                      "bodan_home_four_zero": "4-0", "bodan_home_four_one": "4-1",
+                                      "bodan_home_four_two": "4-2", "bodan_home_four_three": "4-3",
+                                      "bodan_guest_one_zero": "1-0", "bodan_guest_two_zero": "2-0",
+                                      "bodan_guest_two_one": "2-0", "bodan_guest_three_zero": "3-0",
+                                      "bodan_guest_three_one": "3-1", "bodan_guest_three_two": "3-2",
+                                      "bodan_guest_four_zero": "4-0", "bodan_guest_four_one": "4-1",
+                                      "bodan_guest_four_two": "4-2", "bodan_guest_four_three": "4-3",
+                                      "bodan_dogfall_zero_zero": "0-0", "bodan_dogfall_one_one": "1-1",
+                                      "bodan_dogfall_two_two": "2-2", "bodan_dogfall_three_three": "3-3",
+                                      "bodan_dogfall_four_four": "4-4", "bodan_other": "其他"}
+                        # 插入全场波胆
+                        if new_bodan:
+                            inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=bodan_dict, p_id=6,
+                                      wanfa="bodan")
+
+                        half_bodan = value['half_bodan']
+                        half_bodan_dict = {"bodan_home_one_zero": "1-0", "bodan_home_two_zero": "2-0",
+                                           "bodan_home_two_one": "2-1", "bodan_home_three_zero": "3-0",
+                                           "bodan_home_three_one": "3-1", "bodan_home_three_two": "3-2",
+                                           "bodan_guest_one_zero": "1-0", "bodan_guest_two_zero": "2-0",
+                                           "bodan_guest_two_one": "2-0", "bodan_guest_three_zero": "3-0",
+                                           "bodan_guest_three_one": "3-1", "bodan_guest_three_two": "3-2",
+                                           "bodan_dogfall_zero_zero": "0-0", "bodan_dogfall_one_one": "1-1",
+                                           "bodan_dogfall_two_two": "2-2", "bodan_dogfall_three_three": "3-3",
+                                           "bodan_other": "其他"}
+                        if half_bodan:
+                            if st_zq_odds.filter(match_id=key):
+                                for k, v in half_bodan.items():
+                                    st_zq_odd = st_zq_odds.filter(match_id=key, odds_code="half_"+k,p_code="bodan")
+                                    if st_zq_odd:
+                                        if v:
+                                            st_zq_odds.update(utime=utime, odds=v).where(st_zq_odds.match_id == key,
+                                                                                         st_zq_odds.odds_code == k).execute()
+                                    else:
+                                        st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=v,
+                                                          condition=half_bodan_dict[k], odds=v, p_id=6, p_code="bodan",
+                                                          odds_code="half_"+k)
+                            else:
+                                for k, v in half_bodan.items():
+                                    if v:
+                                        st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=v,
+                                                          condition=half_bodan_dict[k], odds=v, p_id=6, p_code="bodan",
+                                                          odds_code="half_"+k)
+                            for k, v in half_bodan.items():
+                                if v:
+                                    st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=v,
+                                                             condition=half_bodan_dict[k], odds=v, p_id=6, p_code="bodan",odds_code="half_"+k)
+                        if st_zq_competition.filter(match_id=key):
+                            pass
+                        else:
+                            st_zq_competition.create(home_team=team_home,guest_team=team_guest,lg_id=league_id,match_id=competition_id, match_date=r_ctime, match_time=time_game,ctime=utime,utime=utime,tag=number)
+
+            #最先/最后进球
+            first_last_balls = item.get("first_last_ball","")
+            if first_last_balls:
+                with database.atomic():
+                    for key, value in first_last_balls.items():
+                        data_game = value.pop('data_game').split("/")
+                        month = str(data_game[1].strip())
+                        day = str(data_game[0])
+                        time_game = str(value.pop('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())
+                        competition_id = value.pop('game_id')
+                        league_id = value.pop('league_id')
+                        league_name = value.pop('league_name')
+                        team_home = value.pop('team_home')
+                        team_guest = value.pop('team_guest')
+                        score_home = value.pop('score_home')
+                        score_guest = value.pop('score_guest')
+                        number = value.pop('number')
+                        corner_ball = value.pop('corner_ball')
+                        half_way = value.pop('half_way')
+                        first_last_dict = {"first_last_ball":"最先进球","first_ball_home":"最后进球","first_ball_guest":"最先进球","last_ball_home":"最后进球","last_ball_guest": "最后进球","not_ball":"没有进球"}
+                        inset_odd(match_id=key, value=value, utime=utime, ctime=utime, condition=first_last_dict, p_id=7,wanfa="first_last_ball")
+
+                        if st_zq_competition.filter(match_id=key):
+                            pass
+                        else:
+                            st_zq_competition.create(home_team=team_home, guest_team=team_guest, lg_id=league_id,
+                                                     match_id=competition_id, match_date=r_ctime, match_time=time_game, ctime=utime,
+                                                     utime=utime, tag=number)
+
+            # 冠军
+            champions = item.get("champion","")
+            if champions:
+                with database.atomic():
+                    for key, value in champions.items():
+                        data_game = value['data_game'].replace('年',"-").replace('月',"-").replace('日',"")
+                        time_game = value['time_game']
+                        ctime = data_game + " " + time_game
+                        utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+                        league_name =value['league_name']
+                        tema_home = value['tema_home']
+                        league_id = value['league_id']
+                        game_id = value['game_id']
+                        new_league_name = value['new_league_name']
+                        champion_team = value['champion_team']
+                        new_champion = value['new_champion']
+                        if st_zq_odds.filter(match_id=key):
+                            st_zq_odd = st_zq_odds.filter(match_id=key, odds_code=tema_home)
+                            if st_zq_odd:
+                                if new_champion:
+                                    st_zq_odds.update(utime=utime, odds=champion_team).where(st_zq_odds.match_id == key,
+                                                                                 st_zq_odds.odds_code == k).execute()
+                            else:
+                                st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=champion_team,
+                                                  condition=new_champion, odds=champion_team, p_id=8, p_code="champion",odds_code=tema_home)
+                        else:
+                            if new_champion:
+                                st_zq_odds.create(match_id=key, ctime=ctime, utime=utime, max=champion_team,condition=new_champion, odds=champion_team, p_id=8, p_code="champion",odds_code=tema_home)
+                        if new_champion:
+                            st_zq_odds_record.create(match_id=key, ctime=ctime, utime=utime, max=champion_team,condition=new_champion, odds=champion_team, p_id=8, p_code="champion",odds_code=tema_home)
+
+
+class Lianpipeline(object):
+    def process_item(self, item, spider):
+        # print(item)
+        # if spider.name == "liansai":
+            area_id = item["area_id"]
+            area_name = item["area_name"]
+            st_league = item["st_zq_league"]
+            name_chinese = item["name_chinese"]
+            st_zq_leagues = st_zq_league.filter(id=st_league)
+            utime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
+            if st_zq_leagues:
+                pass
+            else:
+                st_zq_league.create(name_chinese=name_chinese,id=st_league,country_id=area_id,if_stop=0,league_list=0,bf_Ifdisplay=0,if_have_sub=0,curr_round=0)
+            area_ids = st_area.filter(id=area_id)
+            if area_ids:
+                pass
+            else:
+                st_area.create(id=area_id, title=area_name, create_time=utime)
+

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 0
scrapy_yzd/test.json


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 7 - 0
scrapy_yzd/test4.py


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov