ソースを参照

商家端迁移

Ethan 3 日 前
コミット
32fc4219f1
100 ファイル変更6858 行追加2437 行削除
  1. 198 90
      .idea/workspace.xml
  2. 0 9
      .idea/youngee_m_api.iml
  3. 323 28
      app/controller/account_controller.go
  4. 6 6
      app/controller/bill_controller.go
  5. 8 1
      app/controller/common.go
  6. 28 0
      app/controller/cooperation_controller.go
  7. 46 0
      app/controller/finance_controller.go
  8. 337 66
      app/controller/task_controller.go
  9. 320 0
      app/controller/workspace_controller.go
  10. 24 5
      app/dao/enterprise_dao.go
  11. 2 2
      app/dao/enterprise_supplier_cooperate_dao.go
  12. 14 5
      app/dao/info_auto_default_dao.go
  13. 9 0
      app/dao/info_auto_task_dao.go
  14. 11 0
      app/dao/invoice_record_dao.go
  15. 451 42
      app/dao/local_life_dao.go
  16. 26 11
      app/dao/local_life_task_info_dao.go
  17. 8 6
      app/dao/platform_kuaishou_user_info_dao.go
  18. 7 0
      app/dao/product_dao.go
  19. 400 47
      app/dao/project_dao.go
  20. 24 7
      app/dao/project_task_info_dao.go
  21. 12 1
      app/dao/recharge_record_dao.go
  22. 87 0
      app/dao/s_local_life_dao.go
  23. 51 35
      app/dao/s_project_dao.go
  24. 9 9
      app/dao/sec_task_info_dao.go
  25. 170 23
      app/dao/selection_info_dao.go
  26. 8 8
      app/dao/sub_account_dao.go
  27. 13 0
      app/dao/supplier_income_dao.go
  28. 4 4
      app/dao/talent_info_dao.go
  29. 2 2
      app/entity/book_info.go
  30. 36 0
      app/entity/data_info.go
  31. 16 20
      app/entity/info_auto_default.go
  32. 35 15
      app/entity/info_auto_task.go
  33. 37 0
      app/entity/link_info.go
  34. 4 1
      app/entity/local_life_info.go
  35. 9 9
      app/entity/local_life_task_info.go
  36. 0 31
      app/entity/platform_kuaishou_user_info.go
  37. 37 0
      app/entity/platform_user_info.go
  38. 5 2
      app/entity/project.go
  39. 24 22
      app/entity/project_task_info.go
  40. 43 0
      app/entity/s_local_life.go
  41. 5 3
      app/entity/s_project.go
  42. 0 46
      app/entity/sec_task_info.go
  43. 3 1
      app/entity/selection_info.go
  44. 2 0
      app/entity/selection_task_info.go
  45. 36 0
      app/entity/sketch_info.go
  46. 18 0
      app/entity/supplier_income.go
  47. 18 0
      app/entity/talent_delivery_address.go
  48. 158 0
      app/schedule/auto_task_execute.go
  49. 75 43
      app/schedule/auto_task_invalid.go
  50. 737 669
      app/schedule/auto_task_review.go
  51. 194 0
      app/schedule/auto_task_settle.go
  52. 6 5
      app/service/bill_service.go
  53. 70 71
      app/service/content_service.go
  54. 48 3
      app/service/cooperation_service.go
  55. 345 154
      app/service/default_service.go
  56. 1 1
      app/service/enterprise_service.go
  57. 60 0
      app/service/invoice_service.go
  58. 602 246
      app/service/local_life_service.go
  59. 29 0
      app/service/product_service.go
  60. 504 149
      app/service/project_service.go
  61. 56 2
      app/service/recharge_service.go
  62. 39 43
      app/service/review_service/business_license_check.go
  63. 69 70
      app/service/review_service/config.go
  64. 163 164
      app/service/review_service/review_service.go
  65. 370 143
      app/service/selection_info_service.go
  66. 141 24
      app/service/task_info_service.go
  67. 2 0
      app/vo/balance_param.go
  68. 6 0
      app/vo/common_param.go
  69. 10 10
      app/vo/default_search_param.go
  70. 20 0
      app/vo/info_auto_default_param.go
  71. 30 0
      app/vo/info_auto_param.go
  72. 1 1
      app/vo/local_draft_param.go
  73. 12 13
      app/vo/local_search_param.go
  74. 6 6
      app/vo/local_talent_operate_param.go
  75. 3 3
      app/vo/local_update_param.go
  76. 10 0
      app/vo/logistics_selection_talent_param.go
  77. 3 3
      app/vo/logistics_talent_param.go
  78. 11 11
      app/vo/project_create_param.go
  79. 1 1
      app/vo/project_draft_param.go
  80. 12 13
      app/vo/project_search_param.go
  81. 3 3
      app/vo/project_update_param.go
  82. 1 0
      app/vo/re_bill_local_task_preview.go
  83. 1 0
      app/vo/re_bill_project_task_preview.go
  84. 5 4
      app/vo/re_bill_selection_task_preview.go
  85. 27 0
      app/vo/re_info_auto.go
  86. 17 0
      app/vo/re_info_auto_default.go
  87. 14 7
      app/vo/re_local_detail.go
  88. 1 0
      app/vo/re_local_store_explore_preview.go
  89. 1 0
      app/vo/re_local_task_preview.go
  90. 16 0
      app/vo/re_logistics_export.go
  91. 4 0
      app/vo/re_logistics_talent.go
  92. 7 1
      app/vo/re_project_detail.go
  93. 1 0
      app/vo/re_project_task_preview.go
  94. 7 4
      app/vo/re_recharge_info.go
  95. 6 1
      app/vo/re_selection_detail.go
  96. 9 6
      app/vo/re_selection_reward_cash.go
  97. 5 4
      app/vo/re_selection_task_preview.go
  98. 5 2
      app/vo/re_talent_default.go
  99. 6 0
      app/vo/re_task_default_public.go
  100. 2 0
      app/vo/recharge_param.go

+ 198 - 90
.idea/workspace.xml

@@ -1,91 +1,199 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="AutoImportSettings">
-    <option name="autoReloadType" value="ALL" />
-  </component>
-  <component name="ChangeListManager">
-    <list default="true" id="8dde75a1-d1c1-4fc1-81a0-4db9a43a6250" name="更改" comment="">
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-<<<<<<< HEAD
-=======
-      <change beforePath="$PROJECT_DIR$/db/selection.go" beforeDir="false" afterPath="$PROJECT_DIR$/db/selection.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/model/http_model/UpdateSelectionRequest.go" beforeDir="false" afterPath="$PROJECT_DIR$/model/http_model/UpdateSelectionRequest.go" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/service/selection.go" beforeDir="false" afterPath="$PROJECT_DIR$/service/selection.go" afterDir="false" />
->>>>>>> new
-    </list>
-    <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="GOROOT" url="file://$PROJECT_DIR$/../../../develop_tools/Go" />
-  <component name="Git.Settings">
-    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
-  </component>
-  <component name="ProjectId" id="2Tjm1DDLYMIqFnaHsNVswDndQ90" />
-  <component name="ProjectViewState">
-    <option name="hideEmptyMiddlePackages" value="true" />
-    <option name="showLibraryContents" value="true" />
-  </component>
-<<<<<<< HEAD
-  <component name="PropertiesComponent">{
-  &quot;keyToString&quot;: {
-    &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
-    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
-    &quot;RunOnceActivity.go.formatter.settings.were.checked&quot;: &quot;true&quot;,
-    &quot;RunOnceActivity.go.migrated.go.modules.settings&quot;: &quot;true&quot;,
-    &quot;RunOnceActivity.go.modules.go.list.on.any.changes.was.set&quot;: &quot;true&quot;,
-    &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
-    &quot;go.import.settings.migrated&quot;: &quot;true&quot;,
-    &quot;go.sdk.automatically.set&quot;: &quot;true&quot;,
-    &quot;last_opened_file_path&quot;: &quot;C:/Users/ls&quot;,
-    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
-    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;
-  }
-}</component>
-=======
-  <component name="PropertiesComponent"><![CDATA[{
-  "keyToString": {
-    "RunOnceActivity.OpenProjectViewOnStart": "true",
-    "RunOnceActivity.ShowReadmeOnStart": "true",
-    "RunOnceActivity.go.formatter.settings.were.checked": "true",
-    "RunOnceActivity.go.migrated.go.modules.settings": "true",
-    "RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
-    "WebServerToolWindowFactoryState": "false",
-    "go.import.settings.migrated": "true",
-    "go.sdk.automatically.set": "true",
-    "last_opened_file_path": "C:/Users/24678",
-    "node.js.detected.package.eslint": "true",
-    "node.js.selected.package.eslint": "(autodetect)"
-  }
-}]]></component>
-  <component name="RunManager">
-    <configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
-      <module name="youngee_m_api" />
-      <working_directory value="$PROJECT_DIR$" />
-      <go_parameters value="-i" />
-      <kind value="FILE" />
-      <directory value="$PROJECT_DIR$" />
-      <filePath value="$PROJECT_DIR$" />
-      <method v="2" />
-    </configuration>
-    <configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
-      <module name="youngee_m_api" />
-      <working_directory value="$PROJECT_DIR$" />
-      <go_parameters value="-i" />
-      <kind value="DIRECTORY" />
-      <directory value="$PROJECT_DIR$" />
-      <filePath value="$PROJECT_DIR$" />
-      <framework value="gotest" />
-      <method v="2" />
-    </configuration>
-  </component>
->>>>>>> new
-  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
-  <component name="TypeScriptGeneratedFilesManager">
-    <option name="version" value="3" />
-  </component>
-  <component name="VgoProject">
-    <settings-migrated>true</settings-migrated>
-  </component>
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AutoImportSettings">
+    <option name="autoReloadType" value="ALL" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="f4dc82b3-ff8e-4683-8d94-679b27583f09" name="Changes" comment="">
+      <change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/youngee_m_api.iml" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/account_controller.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/account_controller.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/bill_controller.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/bill_controller.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/common.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/common.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/common_controller.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/common_controller.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/cooperation_controller.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/cooperation_controller.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/finance_controller.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/finance_controller.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/task_controller.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/task_controller.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/controller/workspace_controller.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/controller/workspace_controller.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/book_info_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/book_info_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/common_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/common_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/enterprise_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/enterprise_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/enterprise_supplier_cooperate_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/enterprise_supplier_cooperate_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/free_strategy_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/free_strategy_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/info_auto_default_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/info_auto_default_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/info_auto_task_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/info_auto_task_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/info_pricing_strategy_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/info_pricing_strategy_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/invoice_info_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/invoice_info_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/invoice_record_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/invoice_record_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/local_life_brief_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/local_life_brief_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/local_life_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/local_life_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/local_life_material_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/local_life_material_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/local_life_review_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/local_life_review_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/local_life_task_info_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/local_life_task_info_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/platform_kuaishou_user_info_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/platform_kuaishou_user_info_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/product_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/product_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/product_photo_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/product_photo_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/project_brief_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/project_brief_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/project_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/project_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/project_material_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/project_material_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/project_review_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/project_review_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/project_task_info_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/project_task_info_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/recharge_record_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/recharge_record_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/recruit_strategy_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/recruit_strategy_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/region_info_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/region_info_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/reward_strategy_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/reward_strategy_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/s_project_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/s_project_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/sec_brief_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/sec_brief_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/sec_material_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/sec_material_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/sec_task_info_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/sec_task_info_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/selection_info_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/selection_info_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/selection_review_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/selection_review_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/store_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/store_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/sub_account_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/sub_account_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/supplier_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/supplier_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/talent_info_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/talent_info_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/task_logistics_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/task_logistics_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/team_buying_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/team_buying_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/dao/user_dao.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/dao/user_dao.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/book_info.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/book_info.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/info_auto_default.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/info_auto_default.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/info_auto_task.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/info_auto_task.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/local_life_info.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/local_life_info.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/local_life_task_info.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/local_life_task_info.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/platform_kuaishou_user_info.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/project.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/project.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/project_task_info.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/project_task_info.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/s_project.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/s_project.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/sec_task_info.go" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/selection_info.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/selection_info.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/entity/selection_task_info.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/entity/selection_task_info.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/schedule/auto_task_invalid.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/schedule/auto_task_invalid.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/schedule/auto_task_recharge.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/schedule/auto_task_recharge.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/schedule/auto_task_review.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/schedule/auto_task_review.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/bill_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/bill_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/common_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/common_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/content_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/content_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/cooperation_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/cooperation_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/default_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/default_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/enterprise_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/enterprise_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/invoice_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/invoice_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/local_life_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/local_life_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/product_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/product_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/project_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/project_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/recharge_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/recharge_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/review_service/business_license_check.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/review_service/business_license_check.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/review_service/config.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/review_service/config.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/review_service/review_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/review_service/review_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/selection_info_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/selection_info_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/store_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/store_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/task_info_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/task_info_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/teambuying_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/teambuying_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/service/view_data_service.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/service/view_data_service.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/util/resp.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/util/resp.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/util/uuid.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/util/uuid.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/balance_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/balance_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/default_search_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/default_search_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/local_draft_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/local_draft_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/local_search_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/local_search_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/local_talent_operate_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/local_talent_operate_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/local_update_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/local_update_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/logistics_talent_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/logistics_talent_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/project_create_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/project_create_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/project_draft_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/project_draft_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/project_search_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/project_search_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/project_update_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/project_update_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_bill_local_task_preview.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_bill_local_task_preview.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_bill_project_task_preview.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_bill_project_task_preview.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_bill_selection_task_preview.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_bill_selection_task_preview.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_local_detail.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_local_detail.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_local_store_explore_preview.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_local_store_explore_preview.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_local_task_preview.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_local_task_preview.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_logistics_talent.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_logistics_talent.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_project_detail.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_project_detail.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_project_task_preview.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_project_task_preview.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_recharge_info.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_recharge_info.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_selection_detail.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_selection_detail.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_selection_reward_cash.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_selection_reward_cash.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_selection_task_preview.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_selection_task_preview.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_talent_default.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_talent_default.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/re_task_default_public.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/re_task_default_public.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/recharge_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/recharge_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/selection_draft_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/selection_draft_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/selection_info_create_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/selection_info_create_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/selection_info_update_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/selection_info_update_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/selection_search_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/selection_search_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/supplier_search_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/supplier_search_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/vo/talent_cancel_param.go" beforeDir="false" afterPath="$PROJECT_DIR$/app/vo/talent_cancel_param.go" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/route/init.go" beforeDir="false" afterPath="$PROJECT_DIR$/route/init.go" afterDir="false" />
+    </list>
+    <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="GOROOT" url="file://D:/Go1.22.4" />
+  <component name="Git.Settings">
+    <option name="RECENT_BRANCH_BY_REPOSITORY">
+      <map>
+        <entry key="$PROJECT_DIR$" value="develop" />
+      </map>
+    </option>
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+  </component>
+  <component name="ProjectColorInfo"><![CDATA[{
+  "associatedIndex": 5
+}]]></component>
+  <component name="ProjectId" id="2wriPtS6hgOAnwriSVdTirdGPUf" />
+  <component name="ProjectViewState">
+    <option name="hideEmptyMiddlePackages" value="true" />
+    <option name="showLibraryContents" value="true" />
+  </component>
+  <component name="PropertiesComponent"><![CDATA[{
+  "keyToString": {
+    "Go Build.go build youngee_m_api.executor": "Debug",
+    "RunOnceActivity.ShowReadmeOnStart": "true",
+    "RunOnceActivity.go.formatter.settings.were.checked": "true",
+    "RunOnceActivity.go.migrated.go.modules.settings": "true",
+    "RunOnceActivity.go.modules.automatic.dependencies.download": "true",
+    "RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
+    "git-widget-placeholder": "zhou",
+    "go.import.settings.migrated": "true",
+    "go.sdk.automatically.set": "true",
+    "last_opened_file_path": "E:/HoLaBIP/younggee_m_api",
+    "node.js.detected.package.eslint": "true",
+    "node.js.selected.package.eslint": "(autodetect)",
+    "nodejs_package_manager_path": "npm"
+  }
+}]]></component>
+  <component name="RunManager">
+    <configuration name="go build youngee_m_api" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
+      <module name="younggee_m_api" />
+      <working_directory value="$PROJECT_DIR$" />
+      <kind value="PACKAGE" />
+      <package value="youngee_m_api" />
+      <directory value="$PROJECT_DIR$" />
+      <filePath value="$PROJECT_DIR$" />
+      <method v="2" />
+    </configuration>
+  </component>
+  <component name="SharedIndexes">
+    <attachedChunks>
+      <set>
+        <option value="bundled-gosdk-33c477a475b1-e0158606a674-org.jetbrains.plugins.go.sharedIndexes.bundled-GO-241.18034.61" />
+        <option value="bundled-js-predefined-1d06a55b98c1-0b3e54e931b4-JavaScript-GO-241.18034.61" />
+      </set>
+    </attachedChunks>
+  </component>
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="3" />
+  </component>
+  <component name="VgoProject">
+    <settings-migrated>true</settings-migrated>
+  </component>
 </project>

+ 0 - 9
.idea/youngee_m_api.iml

@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="WEB_MODULE" version="4">
-  <component name="Go" enabled="true" />
-  <component name="NewModuleRootManager">
-    <content url="file://$MODULE_DIR$" />
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
-  </component>
-</module>

+ 323 - 28
app/controller/account_controller.go

@@ -1,30 +1,325 @@
 package controller
 
-//
-//import (
-//	"github.com/gin-gonic/gin"
-//	"github.com/sirupsen/logrus"
-//	"youngee_m_api/app/service/review_service"
-//	"youngee_m_api/app/vo"
-//)
-//
-//type AccountController struct{}
-//
-//// 营业执照OCR识别
-//func (t AccountController) OCRIdentify(c *gin.Context) {
-//	param := &vo.IdentifyParam{}
-//	err := c.BindJSON(param)
-//	if err != nil {
-//		logrus.Errorf("Request bind err:%+v\n", err)
-//		returnError(c, 40000, "Parameter Error: "+err.Error())
-//		return
-//	}
-//	reviewService := review_service.GetConfig()
-//	resultMap, err := reviewService.CheckBusinessLicense(param)
-//	if err != nil {
-//		logrus.Errorf("[OCRIdentify] call Show err:%+v\n", err)
-//		returnError(c, 40000, err.Error())
-//		return
-//	}
-//	returnSuccess(c, 20000, resultMap)
-//}
+import (
+	"encoding/json"
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_m_api/app/dao"
+	"youngee_m_api/app/entity"
+	"youngee_m_api/app/service/review_service"
+	"youngee_m_api/app/vo"
+)
+
+type AccountController struct{}
+
+// 营业执照OCR识别
+func (t AccountController) OCRIdentify(c *gin.Context) {
+	param := &vo.IdentifyParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	reviewService := review_service.GetConfig()
+	resultMap, err := reviewService.CheckBusinessLicense(param)
+	if err != nil {
+		type ErrorResponse struct {
+			StatusCode                  int    `json:"status_code"`
+			RequestID                   string `json:"request_id"`
+			ErrorCode                   string `json:"error_code"`
+			ErrorMessage                string `json:"error_message"`
+			EncodedAuthorizationMessage string `json:"encoded_authorization_message"`
+		}
+		var errorResp ErrorResponse
+		// 解析 JSON 字符串
+		err1 := json.Unmarshal([]byte(err.Error()), &errorResp)
+		if err1 != nil {
+			fmt.Printf("Error parsing JSON: %v\n", err)
+			returnError(c, 40000, err.Error())
+			return
+		}
+		logrus.Errorf("[OCRIdentify] call Show err:%+v\n", err)
+		returnError(c, 40000, errorResp.ErrorMessage)
+		return
+	}
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 策略配置-自动执行&违约规则
+func (t AccountController) StrategyAuto(c *gin.Context) {
+	param := &vo.InfoAutoParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	autoTaskInfoLast := dao.InfoAutoTaskDao{}.GetAutoTaskLast(param.EnterpriseId)
+	autoTaskInfoNew := entity.InfoAutoTask{
+		EnterpriseID:                 param.EnterpriseId,
+		ReviewAuto:                   autoTaskInfoLast.ReviewAuto,
+		LinkReviewAuto:               autoTaskInfoLast.LinkReviewAuto,
+		TaskFinishAuto:               autoTaskInfoLast.TaskFinishAuto,
+		Invalid:                      autoTaskInfoLast.Invalid,
+		SelectionInvalid:             autoTaskInfoLast.SelectionInvalid,
+		DraftDefault:                 autoTaskInfoLast.DraftDefault,
+		DraftCooperateProjectDefault: autoTaskInfoLast.DraftCooperateProjectDefault,
+		DraftStoreDefault:            autoTaskInfoLast.DraftStoreDefault,
+		DraftCooperateLocalDefault:   autoTaskInfoLast.DraftCooperateLocalDefault,
+		LinkBreach:                   autoTaskInfoLast.LinkBreach,
+		CaseCloseDefault:             autoTaskInfoLast.CaseCloseDefault,
+
+		ReviewAutoOperator:                   autoTaskInfoLast.ReviewAutoOperator,
+		LinkReviewAutoOperator:               autoTaskInfoLast.LinkReviewAutoOperator,
+		TaskFinishAutoOperator:               autoTaskInfoLast.TaskFinishAutoOperator,
+		InvalidOperator:                      autoTaskInfoLast.InvalidOperator,
+		SelectionInvalidOperator:             autoTaskInfoLast.SelectionInvalidOperator,
+		DraftDefaultOperator:                 autoTaskInfoLast.DraftDefaultOperator,
+		DraftCooperateProjectDefaultOperator: autoTaskInfoLast.DraftCooperateProjectDefaultOperator,
+		DraftStoreDefaultOperator:            autoTaskInfoLast.DraftStoreDefaultOperator,
+		DraftCooperateLocalDefaultOperator:   autoTaskInfoLast.DraftCooperateLocalDefaultOperator,
+		LinkBreachOperator:                   autoTaskInfoLast.LinkBreachOperator,
+		CaseCloseDefaultOperator:             autoTaskInfoLast.CaseCloseDefaultOperator,
+	}
+	if param.ReviewAuto != 0 {
+		autoTaskInfoNew.ReviewAuto = param.ReviewAuto
+		autoTaskInfoNew.ReviewAutoOperator = param.EnterpriseId
+	}
+	if param.LinkReviewAuto != 0 {
+		autoTaskInfoNew.LinkReviewAuto = param.LinkReviewAuto
+		autoTaskInfoNew.LinkReviewAutoOperator = param.EnterpriseId
+	}
+	if param.TaskFinishAuto != 0 {
+		autoTaskInfoNew.TaskFinishAuto = param.TaskFinishAuto
+		autoTaskInfoNew.TaskFinishAutoOperator = param.EnterpriseId
+	}
+	if param.Invalid != 0 {
+		autoTaskInfoNew.Invalid = param.Invalid
+		autoTaskInfoNew.InvalidOperator = param.EnterpriseId
+	}
+	if param.SelectionInvalid != 0 {
+		autoTaskInfoNew.SelectionInvalid = param.SelectionInvalid
+		autoTaskInfoNew.SelectionInvalidOperator = param.EnterpriseId
+	}
+	if param.DraftDefault != 0 {
+		autoTaskInfoNew.DraftDefault = param.DraftDefault
+		autoTaskInfoNew.DraftDefaultOperator = param.EnterpriseId
+	}
+	if param.DraftCooperateProjectDefault != 0 {
+		autoTaskInfoNew.DraftCooperateProjectDefault = param.DraftCooperateProjectDefault
+		autoTaskInfoNew.DraftCooperateProjectDefaultOperator = param.EnterpriseId
+	}
+	if param.DraftStoreDefault != 0 {
+		autoTaskInfoNew.DraftStoreDefault = param.DraftStoreDefault
+		autoTaskInfoNew.DraftStoreDefaultOperator = param.EnterpriseId
+	}
+	if param.DraftCooperateLocalDefault != 0 {
+		autoTaskInfoNew.DraftCooperateLocalDefault = param.DraftCooperateLocalDefault
+		autoTaskInfoNew.DraftCooperateLocalDefaultOperator = param.EnterpriseId
+	}
+	if param.LinkBreach != 0 {
+		autoTaskInfoNew.LinkBreach = param.LinkBreach
+		autoTaskInfoNew.LinkBreachOperator = param.EnterpriseId
+	}
+	if param.CaseCloseDefault != 0 {
+		autoTaskInfoNew.CaseCloseDefault = param.CaseCloseDefault
+		autoTaskInfoNew.CaseCloseDefaultOperator = param.EnterpriseId
+	}
+	err1 := dao.InfoAutoTaskDao{}.Insert(autoTaskInfoNew)
+	if err1 != nil {
+		logrus.Errorf("[StrategyAuto] call Insert err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+
+	returnSuccess(c, 20000, nil)
+}
+
+// 策略配置-违约扣款
+func (t AccountController) StrategyDefaultPayment(c *gin.Context) {
+	param := &vo.InfoAutoDefaultParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	autoDefaultInfoLast := dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(param.EnterpriseId)
+	infoAutoDefaultNew := entity.InfoAutoDefault{
+		EnterpriseID:         param.EnterpriseId,
+		SketchOtherTimeOut:   autoDefaultInfoLast.SketchOtherTimeOut,
+		SketchOtherNotUpload: autoDefaultInfoLast.SketchOtherNotUpload,
+		LinkReplaceTimeOut:   autoDefaultInfoLast.LinkReplaceTimeOut,
+		LinkReplaceNotUpload: autoDefaultInfoLast.LinkReplaceNotUpload,
+		DataReplaceTimeOut:   autoDefaultInfoLast.DataReplaceTimeOut,
+		DataReplaceNotUpload: autoDefaultInfoLast.DataReplaceNotUpload,
+
+		SketchOtherTimeOutOperator:   autoDefaultInfoLast.SketchOtherTimeOutOperator,
+		SketchOtherNotUploadOperator: autoDefaultInfoLast.SketchOtherNotUploadOperator,
+		LinkReplaceTimeOutOperator:   autoDefaultInfoLast.LinkReplaceTimeOutOperator,
+		LinkReplaceNotUploadOperator: autoDefaultInfoLast.LinkReplaceNotUploadOperator,
+		DataReplaceTimeOutOperator:   autoDefaultInfoLast.DataReplaceTimeOutOperator,
+		DataReplaceNotUploadOperator: autoDefaultInfoLast.DataReplaceNotUploadOperator,
+	}
+	if param.SketchOtherTimeOut != 0 {
+		infoAutoDefaultNew.SketchOtherTimeOut = param.SketchOtherTimeOut
+		infoAutoDefaultNew.SketchOtherNotUploadOperator = param.EnterpriseId
+	}
+	if param.SketchOtherNotUpload != 0 {
+		infoAutoDefaultNew.SketchOtherNotUpload = param.SketchOtherNotUpload
+		infoAutoDefaultNew.SketchOtherNotUploadOperator = param.EnterpriseId
+	}
+	if param.LinkReplaceTimeOut != 0 {
+		infoAutoDefaultNew.LinkReplaceTimeOut = param.LinkReplaceTimeOut
+		infoAutoDefaultNew.LinkReplaceTimeOutOperator = param.EnterpriseId
+	}
+	if param.LinkReplaceNotUpload != 0 {
+		infoAutoDefaultNew.LinkReplaceNotUpload = param.LinkReplaceNotUpload
+		infoAutoDefaultNew.LinkReplaceNotUploadOperator = param.EnterpriseId
+	}
+	if param.DataReplaceTimeOut != 0 {
+		infoAutoDefaultNew.DataReplaceTimeOut = param.DataReplaceTimeOut
+		infoAutoDefaultNew.DataReplaceTimeOutOperator = param.EnterpriseId
+	}
+	if param.DataReplaceNotUpload != 0 {
+		infoAutoDefaultNew.DataReplaceNotUpload = param.DataReplaceNotUpload
+		infoAutoDefaultNew.DataReplaceNotUploadOperator = param.EnterpriseId
+	}
+	err1 := dao.InfoAutoDefaultDao{}.Insert(infoAutoDefaultNew)
+	if err1 != nil {
+		logrus.Errorf("[StrategyDefaultPayment] call Insert err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+
+	returnSuccess(c, 20000, nil)
+}
+
+// 策略配置-自动执行&违约规则 详情
+func (t AccountController) StrategyAutoDetail(c *gin.Context) {
+	param := &vo.InfoAutoParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	autoTaskInfo := dao.InfoAutoTaskDao{}.GetAutoTaskLast(param.EnterpriseId)
+	reInfoAuto := vo.ReInfoAuto{
+		ReviewAuto:                           autoTaskInfo.ReviewAuto,
+		LinkReviewAuto:                       autoTaskInfo.LinkReviewAuto,
+		TaskFinishAuto:                       autoTaskInfo.TaskFinishAuto,
+		Invalid:                              autoTaskInfo.Invalid,
+		SelectionInvalid:                     autoTaskInfo.SelectionInvalid,
+		DraftDefault:                         autoTaskInfo.DraftDefault,
+		DraftCooperateProjectDefault:         autoTaskInfo.DraftCooperateProjectDefault,
+		DraftStoreDefault:                    autoTaskInfo.DraftStoreDefault,
+		DraftCooperateLocalDefault:           autoTaskInfo.DraftCooperateLocalDefault,
+		LinkBreach:                           autoTaskInfo.LinkBreach,
+		CaseCloseDefault:                     autoTaskInfo.CaseCloseDefault,
+		ReviewAutoOperator:                   "样叽系统",
+		LinkReviewAutoOperator:               "样叽系统",
+		TaskFinishAutoOperator:               "样叽系统",
+		InvalidOperator:                      "样叽系统",
+		SelectionInvalidOperator:             "样叽系统",
+		DraftDefaultOperator:                 "样叽系统",
+		DraftCooperateProjectDefaultOperator: "样叽系统",
+		DraftStoreDefaultOperator:            "样叽系统",
+		DraftCooperateLocalDefaultOperator:   "样叽系统",
+		LinkBreachOperator:                   "样叽系统",
+		CaseCloseDefaultOperator:             "样叽系统",
+	}
+	var businessName string
+	enterprise, err1 := dao.EnterpriseDao{}.GetEnterprise(autoTaskInfo.EnterpriseID)
+	if err1 != nil && enterprise != nil {
+		businessName = enterprise.BusinessName
+	}
+	if autoTaskInfo.ReviewAutoOperator != "0" {
+		reInfoAuto.ReviewAutoOperator = businessName
+	}
+	if autoTaskInfo.LinkReviewAutoOperator != "0" {
+		reInfoAuto.LinkReviewAutoOperator = businessName
+	}
+	if autoTaskInfo.TaskFinishAutoOperator != "0" {
+		reInfoAuto.TaskFinishAutoOperator = businessName
+	}
+	if autoTaskInfo.InvalidOperator != "0" {
+		reInfoAuto.InvalidOperator = businessName
+	}
+	if autoTaskInfo.SelectionInvalidOperator != "0" {
+		reInfoAuto.SelectionInvalidOperator = businessName
+	}
+	if autoTaskInfo.DraftDefaultOperator != "0" {
+		reInfoAuto.DraftDefaultOperator = businessName
+	}
+	if autoTaskInfo.DraftCooperateProjectDefaultOperator != "0" {
+		reInfoAuto.DraftCooperateProjectDefaultOperator = businessName
+	}
+	if autoTaskInfo.DraftStoreDefaultOperator != "0" {
+		reInfoAuto.DraftStoreDefaultOperator = businessName
+	}
+	if autoTaskInfo.DraftCooperateLocalDefaultOperator != "0" {
+		reInfoAuto.DraftCooperateLocalDefaultOperator = businessName
+	}
+	if autoTaskInfo.LinkBreachOperator != "0" {
+		reInfoAuto.LinkBreachOperator = businessName
+	}
+	if autoTaskInfo.CaseCloseDefaultOperator != "0" {
+		reInfoAuto.CaseCloseDefaultOperator = businessName
+	}
+
+	returnSuccess(c, 20000, reInfoAuto)
+}
+
+// 策略配置-违约扣款 详情
+func (t AccountController) StrategyDefaultPaymentPaymentDetail(c *gin.Context) {
+	param := &vo.InfoAutoDefaultParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	autoDefaultInfo := dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(param.EnterpriseId)
+	reInfoAutoDefault := vo.ReInfoAutoDefault{
+		SketchOtherTimeOut:           autoDefaultInfo.SketchOtherTimeOut,
+		SketchOtherNotUpload:         autoDefaultInfo.SketchOtherNotUpload,
+		LinkReplaceTimeOut:           autoDefaultInfo.LinkReplaceTimeOut,
+		LinkReplaceNotUpload:         autoDefaultInfo.LinkReplaceNotUpload,
+		DataReplaceTimeOut:           autoDefaultInfo.DataReplaceTimeOut,
+		DataReplaceNotUpload:         autoDefaultInfo.DataReplaceNotUpload,
+		SketchOtherTimeOutOperator:   "样叽系统",
+		SketchOtherNotUploadOperator: "样叽系统",
+		LinkReplaceTimeOutOperator:   "样叽系统",
+		LinkReplaceNotUploadOperator: "样叽系统",
+		DataReplaceTimeOutOperator:   "样叽系统",
+		DataReplaceNotUploadOperator: "样叽系统",
+	}
+	var businessName string
+	enterprise, err1 := dao.EnterpriseDao{}.GetEnterprise(autoDefaultInfo.EnterpriseID)
+	if err1 != nil && enterprise != nil {
+		businessName = enterprise.BusinessName
+	}
+	if autoDefaultInfo.SketchOtherTimeOutOperator != "0" {
+		reInfoAutoDefault.SketchOtherTimeOutOperator = businessName
+	}
+	if autoDefaultInfo.SketchOtherNotUploadOperator != "0" {
+		reInfoAutoDefault.SketchOtherNotUploadOperator = businessName
+	}
+	if autoDefaultInfo.LinkReplaceTimeOutOperator != "0" {
+		reInfoAutoDefault.LinkReplaceTimeOutOperator = businessName
+	}
+	if autoDefaultInfo.LinkReplaceNotUploadOperator != "0" {
+		reInfoAutoDefault.LinkReplaceNotUploadOperator = businessName
+	}
+	if autoDefaultInfo.DataReplaceTimeOutOperator != "0" {
+		reInfoAutoDefault.DataReplaceTimeOutOperator = businessName
+	}
+	if autoDefaultInfo.DataReplaceNotUploadOperator != "0" {
+		reInfoAutoDefault.DataReplaceNotUploadOperator = businessName
+	}
+
+	returnSuccess(c, 20000, reInfoAutoDefault)
+}

+ 6 - 6
app/controller/bill_controller.go

@@ -39,11 +39,11 @@ func (f BillController) SelectionPay(c *gin.Context) {
 	err1 := service.BillService{}.PaySelection(param)
 	if err1 != nil {
 		if err1.Error() == "状态异常" {
-			returnError(c, 31000, err1.Error())
+			returnSuccessWithMessage(c, 31000, err1.Error(), nil)
 			return
 		}
 		if err1.Error() == "可用余额不足" {
-			returnError(c, 32000, err1.Error())
+			returnSuccessWithMessage(c, 32000, err1.Error(), nil)
 			return
 		}
 		logrus.Errorf("[SelectionPay] call Show err:%+v\n", err)
@@ -83,11 +83,11 @@ func (f BillController) ProjectPay(c *gin.Context) {
 	err1 := service.BillService{}.PayProject(param)
 	if err1 != nil {
 		if err1.Error() == "状态异常" {
-			returnError(c, 31000, err1.Error())
+			returnSuccessWithMessage(c, 31000, err1.Error(), nil)
 			return
 		}
 		if err1.Error() == "可用余额不足" {
-			returnError(c, 32000, err1.Error())
+			returnSuccessWithMessage(c, 32000, err1.Error(), nil)
 			return
 		}
 		logrus.Errorf("[ProjectPay] call Show err:%+v\n", err)
@@ -127,11 +127,11 @@ func (f BillController) LocalLifePay(c *gin.Context) {
 	err1 := service.BillService{}.PayLocalLife(param)
 	if err1 != nil {
 		if err1.Error() == "状态异常" {
-			returnError(c, 31000, err1.Error())
+			returnSuccessWithMessage(c, 31000, err1.Error(), nil)
 			return
 		}
 		if err1.Error() == "可用余额不足" {
-			returnError(c, 32000, err1.Error())
+			returnSuccessWithMessage(c, 32000, err1.Error(), nil)
 			return
 		}
 		logrus.Errorf("[LocalLifePay] call Show err:%+v\n", err)

+ 8 - 1
app/controller/common.go

@@ -6,7 +6,6 @@ type JsonStruct struct {
 	Code int         `json:"code"`
 	Msg  interface{} `json:"msg"`
 	Data interface{} `json:"data"`
-	//Count int64       `json:"count"`
 }
 
 type JsonErrStruct struct {
@@ -19,6 +18,14 @@ func returnSuccess(c *gin.Context, code int, data interface{}) {
 	c.JSON(200, json)
 }
 
+func returnSuccessWithMessage(c *gin.Context, code int, msg string, data interface{}) {
+	if msg == "" {
+		msg = "ok"
+	}
+	json := &JsonStruct{Code: code, Msg: msg, Data: data}
+	c.JSON(200, json)
+}
+
 func returnError(c *gin.Context, code int, msg string) {
 	json := &JsonErrStruct{}
 	if msg == "" {

+ 28 - 0
app/controller/cooperation_controller.go

@@ -95,6 +95,20 @@ func (o CooperationController) GetSupplierConfirmingList(c *gin.Context) {
 	returnSuccess(c, 20000, result)
 }
 
+// 服务商管理-角标
+func (o CooperationController) GetSupplierCount(c *gin.Context) {
+	param := &vo.SupplierConfirmingParam{}
+	err := c.BindJSON(param)
+	if err != nil || "" == param.EnterpriseId {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	result := service.CooperationService{}.GetSupplierCount(param)
+
+	returnSuccess(c, 20000, result)
+}
+
 // 门店详情
 func (o CooperationController) GetStoreDetail(c *gin.Context) {
 	param := &vo.StoreSearchParam{}
@@ -268,3 +282,17 @@ func (o CooperationController) DeleteProduct(c *gin.Context) {
 	resultMap["productId"] = productId
 	returnSuccess(c, 20000, resultMap)
 }
+
+// 商品列表角标
+func (o CooperationController) CountProduct(c *gin.Context) {
+	param := &vo.GetAllProductParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	resMap := service.ProductService{}.CountProduct(param)
+
+	returnSuccess(c, 20000, resMap)
+}

+ 46 - 0
app/controller/finance_controller.go

@@ -110,6 +110,20 @@ func (f FinanceController) FrozenInfoList(c *gin.Context) {
 	returnSuccess(c, 20000, result)
 }
 
+// 余额管理——冻结记录-角标
+func (f FinanceController) FrozenInfoCount(c *gin.Context) {
+	param := &vo.BalanceParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	result := service.RechargeService{}.FrozenInfoCount(param)
+
+	returnSuccess(c, 20000, result)
+}
+
 // 充值管理——累计充值金额、确认中金额
 func (f FinanceController) ShowRecharge(c *gin.Context) {
 	param := &vo.RechargeParam{}
@@ -146,6 +160,20 @@ func (f FinanceController) RechargeInfoList(c *gin.Context) {
 	returnSuccess(c, 20000, result)
 }
 
+// 充值管理——充值记录-角标
+func (f FinanceController) RechargeInfoCount(c *gin.Context) {
+	param := &vo.RechargeParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	result := service.RechargeService{}.RechargeInfoCount(param)
+
+	returnSuccess(c, 20000, result)
+}
+
 // 设置默认开票抬头
 func (f FinanceController) UpdateInvoiceDefault(c *gin.Context) {
 	param := &vo.InvoiceDefaultParam{}
@@ -239,3 +267,21 @@ func (f FinanceController) GetBillableList(c *gin.Context) {
 	}
 	returnSuccess(c, 20000, result)
 }
+
+// 开票金额数据-已开票、可开票、开票中
+func (f FinanceController) ShowInvoiceBill(c *gin.Context) {
+	param := &vo.InvoiceBillListParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	res, err := service.InvoiceService{}.ShowInvoiceBill(param)
+	if err != nil {
+		logrus.Errorf("[ShowInvoiceBill] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, res)
+}

+ 337 - 66
app/controller/task_controller.go

@@ -3,6 +3,7 @@ package controller
 import (
 	"github.com/gin-gonic/gin"
 	"github.com/sirupsen/logrus"
+	"net/http"
 	"youngee_m_api/app/service"
 	"youngee_m_api/app/vo"
 )
@@ -58,6 +59,14 @@ func (t TaskController) CreateProduct(c *gin.Context) {
 	}
 	productId, err := service.ProductService{}.CreateProduct(data)
 	if err != nil {
+		if err.Error() == "该快手商品已存在!" {
+			returnSuccessWithMessage(c, 30010, err.Error(), nil)
+			return
+		}
+		if err.Error() == "商品主图不能为空!" {
+			returnSuccessWithMessage(c, 30020, err.Error(), nil)
+			return
+		}
 		logrus.Errorf("[CreateProduct] call CreateProduct err:%+v\n", err)
 		returnError(c, 40000, err.Error())
 		return
@@ -69,7 +78,6 @@ func (t TaskController) CreateProduct(c *gin.Context) {
 
 // 关联商品-完成关联创建带货任务
 func (t TaskController) CreateSelection(c *gin.Context) {
-	//data := &vo.SelectionInfoCreateParam{}
 	data := &vo.SelectionInfoCreateParam{}
 	err := c.BindJSON(data)
 	if err != nil {
@@ -123,29 +131,52 @@ func (t TaskController) GetSelectionDetail(c *gin.Context) {
 		returnError(c, 40000, err.Error())
 		return
 	}
+	returnSuccess(c, 20000, res)
+}
 
+// 电商带货复制任务
+func (t TaskController) CopySelection(c *gin.Context) {
+	data := &vo.SelectionSearchParam{}
+	err := c.BindJSON(data)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	res, err := service.SelectionInfoService{}.CopySelection(data)
+	if err != nil {
+		if err.Error() == "任务不存在" {
+			returnSuccessWithMessage(c, 30000, err.Error(), nil)
+			return
+		}
+		logrus.Errorf("[CopySelection] call CopySelection err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["selectionId"] = *res
 	returnSuccess(c, 20000, res)
 }
 
-//// 电商带货提交审核
-//func (t TaskController) SelectionToReview(c *gin.Context) {
-//	data := &vo.SelectionInfoUpdateParam{}
-//	err := c.BindJSON(data)
-//	if err != nil || data.SelectionID == "" {
-//		logrus.Errorf("Request bind err:%+v\n", err)
-//		returnError(c, 40000, "Parameter Error: "+err.Error())
-//		return
-//	}
-//	selectionId, err := service.SelectionInfoService{}.SelectionToReview(data)
-//	if err != nil {
-//		logrus.Errorf("[SelectionToReview] call SelectionToReview err:%+v\n", err)
-//		returnError(c, 40000, err.Error())
-//		return
-//	}
-//	resultMap := make(map[string]string)
-//	resultMap["selectionId"] = *selectionId
-//	returnSuccess(c, 20000, resultMap)
-//}
+// 电商带货提交审核
+func (t TaskController) SelectionToReview(c *gin.Context) {
+	data := &vo.SelectionInfoUpdateParam{}
+	err := c.BindJSON(data)
+	if err != nil || data.SelectionID == "" {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	selectionId, err := service.SelectionInfoService{}.SelectionToReview(data)
+	if err != nil {
+		logrus.Errorf("[SelectionToReview] call SelectionToReview err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["selectionId"] = *selectionId
+	returnSuccess(c, 20000, resultMap)
+}
 
 // 电商带货任务列表
 func (t TaskController) SelectionTaskList(c *gin.Context) {
@@ -162,7 +193,6 @@ func (t TaskController) SelectionTaskList(c *gin.Context) {
 		returnError(c, 40000, err.Error())
 		return
 	}
-
 	returnSuccess(c, 20000, res)
 }
 
@@ -186,6 +216,41 @@ func (t TaskController) SelectionDel(c *gin.Context) {
 	returnSuccess(c, 20000, resultMap)
 }
 
+// 结束带货任务
+func (t TaskController) SelectionClose(c *gin.Context) {
+	param := &vo.SelectionSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	todo, err1 := service.SelectionInfoService{}.CloseSelection(param.SelectionId)
+	if err1 != nil {
+		logrus.Errorf("[CloseSelection] call CloseSelection err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["selectionId"] = param.SelectionId
+	resultMap["todo"] = todo
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 电商带货选达人角标 未处理、同意合作、拒绝合作
+func (t TaskController) SelectionTalentCount(c *gin.Context) {
+	param := &vo.SelectionSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	res := service.SelectionInfoService{}.SelectionTalentCount(param.SelectionId)
+
+	returnSuccess(c, 20000, res)
+}
+
 // 创建种草任务
 func (t TaskController) CreateProject(c *gin.Context) {
 	data := &vo.ProjectCreateParam{}
@@ -195,6 +260,10 @@ func (t TaskController) CreateProject(c *gin.Context) {
 		returnError(c, 40000, "Parameter Error: "+err.Error())
 		return
 	}
+	if data.RecruitStrategys == nil || len(data.RecruitStrategys) == 0 {
+		returnSuccessWithMessage(c, 30030, "招募策略不能为空", nil)
+		return
+	}
 	projectId, err := service.ProjectService{}.CreateProject(data)
 	if err != nil {
 		logrus.Errorf("[CreateProject] call CreateProject err:%+v\n", err)
@@ -215,6 +284,10 @@ func (t TaskController) UpdateProject(c *gin.Context) {
 		returnError(c, 40000, "Parameter Error: "+err.Error())
 		return
 	}
+	if data.RecruitStrategys == nil || len(data.RecruitStrategys) == 0 {
+		returnSuccessWithMessage(c, 30030, "招募策略不能为空", nil)
+		return
+	}
 	projectId, err := service.ProjectService{}.UpdateProject(data)
 	if err != nil {
 		logrus.Errorf("[UpdateProject] call UpdateProject err:%+v\n", err)
@@ -235,6 +308,10 @@ func (t TaskController) UpdateProjectTarget(c *gin.Context) {
 		returnError(c, 40000, "Parameter Error: "+err.Error())
 		return
 	}
+	if data.RecruitStrategys == nil || len(data.RecruitStrategys) == 0 {
+		returnSuccessWithMessage(c, 30030, "招募策略不能为空", nil)
+		return
+	}
 	projectId, err := service.ProjectService{}.UpdateProjectTarget(data)
 	if err != nil {
 		logrus.Errorf("[UpdateProject] call UpdateProject err:%+v\n", err)
@@ -257,7 +334,7 @@ func (t TaskController) GetProjectDetail(c *gin.Context) {
 	}
 	res, err := service.ProjectService{}.GetProjectDetail(data.ProjectId)
 	if err != nil {
-		logrus.Errorf("[GetProjectDetail] call Show err:%+v\n", err)
+		logrus.Errorf("[GetProjectDetail] call GetProjectDetail err:%+v\n", err)
 		returnError(c, 40000, err.Error())
 		return
 	}
@@ -265,25 +342,49 @@ func (t TaskController) GetProjectDetail(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
-//// 种草提交审核
-//func (t TaskController) ProjectToReview(c *gin.Context) {
-//	data := &vo.ProjectUpdateParam{}
-//	err := c.BindJSON(data)
-//	if err != nil || data.ProjectID == "" {
-//		logrus.Errorf("Request bind err:%+v\n", err)
-//		returnError(c, 40000, "Parameter Error: "+err.Error())
-//		return
-//	}
-//	projectId, err := service.ProjectService{}.ProjectToReview(data)
-//	if err != nil {
-//		logrus.Errorf("[ProjectToReview] call ProjectToReview err:%+v\n", err)
-//		returnError(c, 40000, err.Error())
-//		return
-//	}
-//	resultMap := make(map[string]string)
-//	resultMap["projectId"] = *projectId
-//	returnSuccess(c, 20000, resultMap)
-//}
+// 种草复制任务
+func (t TaskController) CopyProject(c *gin.Context) {
+	data := &vo.ProjectSearchParam{}
+	err := c.BindJSON(data)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	projectId, err := service.ProjectService{}.CopyProject(data)
+	if err != nil {
+		if err.Error() == "任务不存在" {
+			returnSuccessWithMessage(c, 30000, err.Error(), nil)
+			return
+		}
+		logrus.Errorf("[CopyProject] call CopyProject err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["projectId"] = *projectId
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 种草提交审核
+func (t TaskController) ProjectToReview(c *gin.Context) {
+	data := &vo.ProjectUpdateParam{}
+	err := c.BindJSON(data)
+	if err != nil || data.ProjectID == "" {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	projectId, err := service.ProjectService{}.ProjectToReview(data)
+	if err != nil {
+		logrus.Errorf("[ProjectToReview] call ProjectToReview err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["projectId"] = *projectId
+	returnSuccess(c, 20000, resultMap)
+}
 
 // 种草任务列表
 func (t TaskController) ProjectTaskList(c *gin.Context) {
@@ -324,6 +425,27 @@ func (t TaskController) ProjectDel(c *gin.Context) {
 	returnSuccess(c, 20000, resultMap)
 }
 
+// 结束种草任务
+func (t TaskController) ProjectClose(c *gin.Context) {
+	param := &vo.ProjectSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	todo, err1 := service.ProjectService{}.CloseProject(param.ProjectId)
+	if err1 != nil {
+		logrus.Errorf("[CloseProject] call CloseProject err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["projectId"] = param.ProjectId
+	resultMap["todo"] = todo
+	returnSuccess(c, 20000, resultMap)
+}
+
 // 草稿箱——电商带货
 func (t TaskController) GetSelectionDraftList(c *gin.Context) {
 	param := &vo.SelectionDraftParam{}
@@ -438,6 +560,20 @@ func (t TaskController) GetPublicDefaultTalentList(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
+// 违约管理——公开任务-违约达人列表角标
+func (t TaskController) GetPublicDefaultTalentCount(c *gin.Context) {
+	param := &vo.DefaultSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	res, _ := service.DefaultService{}.GetPublicDefaultTalentCount(param)
+
+	returnSuccess(c, 20000, res)
+}
+
 // 违约管理——定向任务-违约达人列表
 func (t TaskController) GetTargetDefaultTalentList(c *gin.Context) {
 	param := &vo.DefaultSearchParam{}
@@ -515,6 +651,20 @@ func (o TaskController) GetSupplierInTargetTaskList(c *gin.Context) {
 	returnSuccess(c, 20000, result)
 }
 
+// 服务商合作-服务商列表角标
+func (t TaskController) GetSupplierInTargetCount(c *gin.Context) {
+	param := &vo.SupplierSearchInTargetTaskParam{}
+	err := c.BindJSON(param)
+	if err != nil || "" == param.EnterpriseId {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	res := service.CooperationService{}.GetSupplierInTargetCount(param)
+
+	returnSuccess(c, 20000, res)
+}
+
 // 服务商合作-邀约合作
 func (o TaskController) InviteSupplier(c *gin.Context) {
 	param := &vo.SupplierInviteInTargetTaskParam{}
@@ -642,6 +792,10 @@ func (t TaskController) CreateLocalLife(c *gin.Context) {
 		returnError(c, 40000, "Parameter Error: "+err.Error())
 		return
 	}
+	if data.RecruitStrategys == nil || len(data.RecruitStrategys) == 0 {
+		returnSuccessWithMessage(c, 30030, "招募策略不能为空", nil)
+		return
+	}
 	localId, err := service.LocalLifeService{}.CreateLocalLife(data)
 	if err != nil {
 		logrus.Errorf("[CreateLocalLife] call CreateLocalLife err:%+v\n", err)
@@ -712,27 +866,65 @@ func (t TaskController) GetLocalLifeDetail(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
-//// 本地生活提交审核
-//func (t TaskController) LocalLifeToReview(c *gin.Context) {
-//	data := &vo.LocalUpdateParam{}
-//	err := c.BindJSON(data)
-//	if err != nil || data.LocalID == "" {
-//		logrus.Errorf("Request bind err:%+v\n", err)
-//		returnError(c, 40000, "Parameter Error: "+err.Error())
-//		return
-//	}
-//	localId, err := service.LocalLifeService{}.LocalLifeToReview(data)
-//	if err != nil {
-//		logrus.Errorf("[ProjectToReview] call ProjectToReview err:%+v\n", err)
-//		returnError(c, 40000, err.Error())
-//		return
-//	}
-//	resultMap := make(map[string]string)
-//	resultMap["localId"] = *localId
-//	returnSuccess(c, 20000, resultMap)
-//}
-
-// 达人物流列表
+// 本地生活复制任务
+func (t TaskController) CopyLocalLife(c *gin.Context) {
+	data := &vo.LocalSearchParam{}
+	err := c.BindJSON(data)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	localId, err := service.LocalLifeService{}.CopyLocalLife(data)
+	if err != nil {
+		if err.Error() == "任务不存在" {
+			returnSuccessWithMessage(c, 30000, err.Error(), nil)
+			return
+		}
+		logrus.Errorf("[CreateLocalLife] call CreateLocalLife err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["localId"] = *localId
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 本地生活提交审核
+func (t TaskController) LocalLifeToReview(c *gin.Context) {
+	data := &vo.LocalUpdateParam{}
+	err := c.BindJSON(data)
+	if err != nil || data.LocalID == "" {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	localId, err := service.LocalLifeService{}.LocalLifeToReview(data)
+	if err != nil {
+		logrus.Errorf("[ProjectToReview] call ProjectToReview err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["localId"] = *localId
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 带货待发货、待签收、已签收统计
+func (t TaskController) LogisticsSelectionTalentCount(c *gin.Context) {
+	param := &vo.LogisticsSelectionTalentParam{}
+	err := c.BindJSON(param)
+	if err != nil || "" == param.SelectionId {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	res := service.TaskInfoService{}.LogisticsSelectionTalentCount(param)
+
+	returnSuccess(c, 20000, res)
+}
+
+// 种草达人物流列表
 func (t TaskController) LogisticsTalentList(c *gin.Context) {
 	param := &vo.LogisticsTalentParam{}
 	err := c.BindJSON(param)
@@ -743,7 +935,7 @@ func (t TaskController) LogisticsTalentList(c *gin.Context) {
 	}
 	res, err := service.TaskInfoService{}.LogisticsTalentList(param)
 	if err != nil {
-		logrus.Errorf("[LogisticsTalentList] call Show err:%+v\n", err)
+		logrus.Errorf("[LogisticsTalentList] call LogisticsTalentList err:%+v\n", err)
 		returnError(c, 40000, err.Error())
 		return
 	}
@@ -751,6 +943,50 @@ func (t TaskController) LogisticsTalentList(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
+// 导出种草达人物流数据
+func (t TaskController) LogisticsExport(c *gin.Context) {
+	param := &vo.LogisticsTalentParam{}
+	err := c.BindJSON(param)
+	if err != nil || "" == param.ProjectId {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	f, err := service.TaskInfoService{}.LogisticsExport(param)
+	if err != nil {
+		logrus.Errorf("[LogisticsExport] call LogisticsExport err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	// 设置响应头,提示浏览器下载
+	c.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
+	c.Header("Content-Disposition", "attachment; filename=export_data.xlsx")
+	c.Header("File-Name", "export_data.xlsx")
+	c.Header("Content-Transfer-Encoding", "binary")
+	c.Header("Expires", "0")
+	// 将生成的 Excel 文件写入响应体
+	if err := f.Write(c.Writer); err != nil {
+		c.String(http.StatusInternalServerError, "导出失败: %s", err.Error())
+		returnError(c, 40000, "导出失败")
+	}
+	_ = f.Close()
+	returnSuccess(c, 20000, nil)
+}
+
+// 种草待发货、待签收、已签收统计
+func (t TaskController) LogisticsTalentCount(c *gin.Context) {
+	param := &vo.LogisticsTalentParam{}
+	err := c.BindJSON(param)
+	if err != nil || "" == param.ProjectId {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	res := service.TaskInfoService{}.LogisticsTalentCount(param)
+
+	returnSuccess(c, 20000, res)
+}
+
 // 本地生活列表
 func (t TaskController) LocalLifeTaskList(c *gin.Context) {
 	param := &vo.LocalSearchParam{}
@@ -762,7 +998,7 @@ func (t TaskController) LocalLifeTaskList(c *gin.Context) {
 	}
 	res, err := service.LocalLifeService{}.GetLocalLifeTaskList(param)
 	if err != nil {
-		logrus.Errorf("[LocalLifeTaskList] call Show err:%+v\n", err)
+		logrus.Errorf("[LocalLifeTaskList] call GetLocalLifeTaskList err:%+v\n", err)
 		returnError(c, 40000, err.Error())
 		return
 	}
@@ -781,7 +1017,7 @@ func (t TaskController) LocalLifeDel(c *gin.Context) {
 	}
 	localId, err := service.LocalLifeService{}.DeleteLocalLife(param.LocalId)
 	if err != nil {
-		logrus.Errorf("[LocalLifeDel] call Show err:%+v\n", err)
+		logrus.Errorf("[DeleteLocalLife] call DeleteLocalLife err:%+v\n", err)
 		returnError(c, 40000, err.Error())
 		return
 	}
@@ -790,6 +1026,27 @@ func (t TaskController) LocalLifeDel(c *gin.Context) {
 	returnSuccess(c, 20000, resultMap)
 }
 
+// 结束本地生活任务
+func (t TaskController) LocalLifeClose(c *gin.Context) {
+	param := &vo.LocalSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	todo, err1 := service.LocalLifeService{}.CloseLocalLife(param.LocalId)
+	if err1 != nil {
+		logrus.Errorf("[CloseLocalLife] call CloseLocalLife err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["localId"] = param.LocalId
+	resultMap["todo"] = todo
+	returnSuccess(c, 20000, resultMap)
+}
+
 // 探店本地生活列表
 func (t TaskController) StoreExploreList(c *gin.Context) {
 	param := &vo.LocalSearchParam{}
@@ -801,7 +1058,7 @@ func (t TaskController) StoreExploreList(c *gin.Context) {
 	}
 	res, err := service.LocalLifeService{}.GetStoreExploreList(param)
 	if err != nil {
-		logrus.Errorf("[StoreExploreList] call Show err:%+v\n", err)
+		logrus.Errorf("[StoreExploreList] call StoreExploreList err:%+v\n", err)
 		returnError(c, 40000, err.Error())
 		return
 	}
@@ -826,6 +1083,20 @@ func (t TaskController) StoreExploreInfo(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
+// 探店达人列表角标
+func (t TaskController) StoreExploreInfoCount(c *gin.Context) {
+	param := &vo.StoreExploreParam{}
+	err := c.BindJSON(param)
+	if err != nil || "" == param.LocalLifeId {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	res := service.LocalLifeService{}.StoreExploreInfoCount(param)
+
+	returnSuccess(c, 20000, res)
+}
+
 // 探店终止合作
 func (t TaskController) StoreExploreOver(c *gin.Context) {
 	param := &vo.LocalTalentOperateParam{}

+ 320 - 0
app/controller/workspace_controller.go

@@ -2,13 +2,16 @@ package controller
 
 import (
 	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
 	"youngee_m_api/app/service"
+	"youngee_m_api/app/vo"
 )
 
 type WorkspaceController struct{}
 
 type GetTakegoodsInfoParam struct {
 	EnterpriseId string `json:"enterprise_id"`
+	SubAccountId int64  `json:"sub_account_id"`
 	DateRange    string `json:"days"`
 }
 
@@ -16,6 +19,7 @@ func (w WorkspaceController) GetTakegoodsInfo(c *gin.Context) {
 	search := &GetTakegoodsInfoParam{}
 	err := c.BindJSON(&search)
 	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
 		returnError(c, 40000, "Parameter Error: "+err.Error())
 		return
 	}
@@ -23,3 +27,319 @@ func (w WorkspaceController) GetTakegoodsInfo(c *gin.Context) {
 
 	returnSuccess(c, 20000, result)
 }
+
+// 任务待办-公开任务
+func (t WorkspaceController) GetPublicTask(c *gin.Context) {
+	param := &vo.CommonParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	selectionToDo, err1 := service.SelectionInfoService{}.GetTaskToDo(param.EnterpriseId, param.SubAccountId)
+	if err1 != nil {
+		logrus.Errorf("[SelectionInfoService] call Show err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	projectToDo, err2 := service.ProjectService{}.GetTaskToDo(param.EnterpriseId, param.SubAccountId, 1)
+	if err2 != nil {
+		logrus.Errorf("[ProjectService] call Show err:%+v\n", err2)
+		returnError(c, 40000, err2.Error())
+		return
+	}
+	localLifeToDo, err3 := service.LocalLifeService{}.GetTaskToDo(param.EnterpriseId, param.SubAccountId, 1)
+	if err3 != nil {
+		logrus.Errorf("[LocalLifeService] call Show err:%+v\n", err3)
+		returnError(c, 40000, err3.Error())
+		return
+	}
+	resultMap := make(map[string]*map[string]map[string]int64)
+	resultMap["selectionToDo"] = &selectionToDo
+	resultMap["projectToDo"] = &projectToDo
+	resultMap["localLifeToDo"] = &localLifeToDo
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 任务待办-定向任务
+func (t WorkspaceController) GetTargetTask(c *gin.Context) {
+	param := &vo.CommonParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	selectionToDo, err1 := service.SelectionInfoService{}.GetTaskToDo(param.EnterpriseId, param.SubAccountId)
+	if err1 != nil {
+		logrus.Errorf("[SelectionInfoService] call Show err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	projectToDo, err2 := service.ProjectService{}.GetTaskToDo(param.EnterpriseId, param.SubAccountId, 2)
+	if err2 != nil {
+		logrus.Errorf("[ProjectService] call Show err:%+v\n", err2)
+		returnError(c, 40000, err2.Error())
+		return
+	}
+	localLifeToDo, err3 := service.LocalLifeService{}.GetTaskToDo(param.EnterpriseId, param.SubAccountId, 2)
+	if err3 != nil {
+		logrus.Errorf("[LocalLifeService] call Show err:%+v\n", err3)
+		returnError(c, 40000, err3.Error())
+		return
+	}
+	resultMap := make(map[string]*map[string]map[string]int64)
+	resultMap["selectionToDo"] = &selectionToDo
+	resultMap["projectToDo"] = &projectToDo
+	resultMap["localLifeToDo"] = &localLifeToDo
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 任务待办-寄样物流
+func (t WorkspaceController) GetLogistics(c *gin.Context) {
+	param := &vo.CommonParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	selectionToDo, err1 := service.SelectionInfoService{}.GetLogisticsToDo(param.EnterpriseId, param.SubAccountId)
+	if err1 != nil {
+		logrus.Errorf("[SelectionInfoService] call Show err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	projectToDo, err2 := service.ProjectService{}.GetLogisticsToDo(param.EnterpriseId, param.SubAccountId)
+	if err2 != nil {
+		logrus.Errorf("[ProjectService] call Show err:%+v\n", err2)
+		returnError(c, 40000, err2.Error())
+		return
+	}
+	resultMap := make(map[string]*map[string]map[string]int64)
+	resultMap["selectionToDo"] = &selectionToDo
+	resultMap["projectToDo"] = &projectToDo
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 任务待办-探店邀约
+func (t WorkspaceController) GetExplore(c *gin.Context) {
+	param := &vo.CommonParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	localLifeToDo, err1 := service.LocalLifeService{}.GetExploreToDo(param.EnterpriseId, param.SubAccountId)
+	if err1 != nil {
+		logrus.Errorf("[LocalLifeService] call Show err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	resultMap := make(map[string]*map[string]map[string]int64)
+	resultMap["localLifeToDo"] = &localLifeToDo
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 任务待办-违约管理
+func (t WorkspaceController) GetDefault(c *gin.Context) {
+	param := &vo.CommonParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	resultMap := make(map[string]*map[string]map[string]int64)
+	// 公开
+	projectToDoPublic, err1 := service.ProjectService{}.GetDefaultToDo(param.EnterpriseId, param.SubAccountId, 1)
+	if err1 != nil {
+		logrus.Errorf("[ProjectService] call Show err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	localLifeToDoPublic, err2 := service.LocalLifeService{}.GetDefaultToDo(param.EnterpriseId, param.SubAccountId, 1)
+	if err2 != nil {
+		logrus.Errorf("[LocalLifeService] call Show err:%+v\n", err2)
+		returnError(c, 40000, err2.Error())
+		return
+	}
+	resPublic := make(map[string]map[string]int64)
+
+	redbook1 := make(map[string]int64)
+	redbook1["noSketch"] = projectToDoPublic["redbook"]["noSketch"] + localLifeToDoPublic["redbook"]["noSketch"]
+	redbook1["noWork"] = projectToDoPublic["redbook"]["noWork"] + localLifeToDoPublic["redbook"]["noWork"]
+	redbook1["noData"] = projectToDoPublic["redbook"]["noData"] + localLifeToDoPublic["redbook"]["noData"]
+	redbook1["cooperateOver"] = projectToDoPublic["redbook"]["cooperateOver"] + localLifeToDoPublic["redbook"]["cooperateOver"]
+	resPublic["redbook"] = redbook1
+
+	douyin1 := make(map[string]int64)
+	douyin1["noSketch"] = projectToDoPublic["douyin"]["noSketch"] + localLifeToDoPublic["douyin"]["noSketch"]
+	douyin1["noWork"] = projectToDoPublic["douyin"]["noWork"] + localLifeToDoPublic["douyin"]["noWork"]
+	douyin1["noData"] = projectToDoPublic["douyin"]["noData"] + localLifeToDoPublic["douyin"]["noData"]
+	douyin1["cooperateOver"] = projectToDoPublic["douyin"]["cooperateOver"] + localLifeToDoPublic["douyin"]["cooperateOver"]
+	resPublic["douyin"] = douyin1
+
+	kuaishou1 := make(map[string]int64)
+	kuaishou1["noSketch"] = projectToDoPublic["kuaishou"]["noSketch"] + localLifeToDoPublic["kuaishou"]["noSketch"]
+	kuaishou1["noWork"] = projectToDoPublic["kuaishou"]["noWork"] + localLifeToDoPublic["kuaishou"]["noWork"]
+	kuaishou1["noData"] = projectToDoPublic["kuaishou"]["noData"] + localLifeToDoPublic["kuaishou"]["noData"]
+	kuaishou1["cooperateOver"] = projectToDoPublic["kuaishou"]["cooperateOver"] + localLifeToDoPublic["kuaishou"]["cooperateOver"]
+	resPublic["kuaishou"] = kuaishou1
+
+	weibo1 := make(map[string]int64)
+	weibo1["noSketch"] = projectToDoPublic["weibo"]["noSketch"] + localLifeToDoPublic["weibo"]["noSketch"]
+	weibo1["noWork"] = projectToDoPublic["weibo"]["noWork"] + localLifeToDoPublic["weibo"]["noWork"]
+	weibo1["noData"] = projectToDoPublic["weibo"]["noData"] + localLifeToDoPublic["weibo"]["noData"]
+	weibo1["cooperateOver"] = projectToDoPublic["weibo"]["cooperateOver"] + localLifeToDoPublic["weibo"]["cooperateOver"]
+	resPublic["weibo"] = weibo1
+
+	bilibili1 := make(map[string]int64)
+	bilibili1["noSketch"] = projectToDoPublic["bilibili"]["noSketch"] + localLifeToDoPublic["bilibili"]["noSketch"]
+	bilibili1["noWork"] = projectToDoPublic["bilibili"]["noWork"] + localLifeToDoPublic["bilibili"]["noWork"]
+	bilibili1["noData"] = projectToDoPublic["bilibili"]["noData"] + localLifeToDoPublic["bilibili"]["noData"]
+	bilibili1["cooperateOver"] = projectToDoPublic["bilibili"]["cooperateOver"] + localLifeToDoPublic["bilibili"]["cooperateOver"]
+	resPublic["bilibili"] = bilibili1
+
+	all1 := make(map[string]int64)
+	all1["noSketch"] = resPublic["redbook"]["noSketch"] + resPublic["douyin"]["noSketch"] + resPublic["kuaishou"]["noSketch"] + resPublic["weibo"]["noSketch"] + resPublic["bilibili"]["noSketch"]
+	all1["noWork"] = resPublic["redbook"]["noWork"] + resPublic["douyin"]["noWork"] + resPublic["kuaishou"]["noWork"] + resPublic["weibo"]["noWork"] + resPublic["bilibili"]["noWork"]
+	all1["noData"] = resPublic["redbook"]["noData"] + resPublic["douyin"]["noData"] + resPublic["kuaishou"]["noData"] + resPublic["weibo"]["noData"] + resPublic["bilibili"]["noData"]
+	all1["cooperateOver"] = resPublic["redbook"]["cooperateOver"] + resPublic["douyin"]["cooperateOver"] + resPublic["kuaishou"]["cooperateOver"] + resPublic["weibo"]["cooperateOver"] + resPublic["bilibili"]["cooperateOver"]
+	resPublic["all"] = all1
+
+	resultMap["resPublic"] = &resPublic
+	// 定向
+	projectToDoTarget, err3 := service.ProjectService{}.GetDefaultToDo(param.EnterpriseId, param.SubAccountId, 2)
+	if err3 != nil {
+		logrus.Errorf("[ProjectService] call Show err:%+v\n", err3)
+		returnError(c, 40000, err3.Error())
+		return
+	}
+	localLifeToDoTarget, err4 := service.LocalLifeService{}.GetDefaultToDo(param.EnterpriseId, param.SubAccountId, 2)
+	if err4 != nil {
+		logrus.Errorf("[LocalLifeService] call Show err:%+v\n", err4)
+		returnError(c, 40000, err4.Error())
+		return
+	}
+	resTarget := make(map[string]map[string]int64)
+
+	redbook2 := make(map[string]int64)
+	redbook2["noSketch"] = projectToDoTarget["redbook"]["noSketch"] + localLifeToDoTarget["redbook"]["noSketch"]
+	redbook2["noWork"] = projectToDoTarget["redbook"]["noWork"] + localLifeToDoTarget["redbook"]["noWork"]
+	redbook2["noData"] = projectToDoTarget["redbook"]["noData"] + localLifeToDoTarget["redbook"]["noData"]
+	redbook2["cooperateOver"] = projectToDoTarget["redbook"]["cooperateOver"] + localLifeToDoTarget["redbook"]["cooperateOver"]
+	resTarget["redbook"] = redbook2
+
+	douyin2 := make(map[string]int64)
+	douyin2["noSketch"] = projectToDoTarget["douyin"]["noSketch"] + localLifeToDoTarget["douyin"]["noSketch"]
+	douyin2["noWork"] = projectToDoTarget["douyin"]["noWork"] + localLifeToDoTarget["douyin"]["noWork"]
+	douyin2["noData"] = projectToDoTarget["douyin"]["noData"] + localLifeToDoTarget["douyin"]["noData"]
+	douyin2["cooperateOver"] = projectToDoTarget["douyin"]["cooperateOver"] + localLifeToDoTarget["douyin"]["cooperateOver"]
+	resTarget["douyin"] = douyin2
+
+	kuaishou2 := make(map[string]int64)
+	kuaishou2["noSketch"] = projectToDoTarget["kuaishou"]["noSketch"] + localLifeToDoTarget["kuaishou"]["noSketch"]
+	kuaishou2["noWork"] = projectToDoTarget["kuaishou"]["noWork"] + localLifeToDoTarget["kuaishou"]["noWork"]
+	kuaishou2["noData"] = projectToDoTarget["kuaishou"]["noData"] + localLifeToDoTarget["kuaishou"]["noData"]
+	kuaishou2["cooperateOver"] = projectToDoTarget["kuaishou"]["cooperateOver"] + localLifeToDoTarget["kuaishou"]["cooperateOver"]
+	resTarget["kuaishou"] = kuaishou2
+
+	weibo2 := make(map[string]int64)
+	weibo2["noSketch"] = projectToDoTarget["weibo"]["noSketch"] + localLifeToDoTarget["weibo"]["noSketch"]
+	weibo2["noWork"] = projectToDoTarget["weibo"]["noWork"] + localLifeToDoTarget["weibo"]["noWork"]
+	weibo2["noData"] = projectToDoTarget["weibo"]["noData"] + localLifeToDoTarget["weibo"]["noData"]
+	weibo2["cooperateOver"] = projectToDoTarget["weibo"]["cooperateOver"] + localLifeToDoTarget["weibo"]["cooperateOver"]
+	resTarget["weibo"] = weibo2
+
+	bilibili2 := make(map[string]int64)
+	bilibili2["noSketch"] = projectToDoTarget["bilibili"]["noSketch"] + localLifeToDoTarget["bilibili"]["noSketch"]
+	bilibili2["noWork"] = projectToDoTarget["bilibili"]["noWork"] + localLifeToDoTarget["bilibili"]["noWork"]
+	bilibili2["noData"] = projectToDoTarget["bilibili"]["noData"] + localLifeToDoTarget["bilibili"]["noData"]
+	bilibili2["cooperateOver"] = projectToDoTarget["bilibili"]["cooperateOver"] + localLifeToDoTarget["bilibili"]["cooperateOver"]
+	resTarget["bilibili"] = bilibili2
+
+	all2 := make(map[string]int64)
+	all2["noSketch"] = resTarget["redbook"]["noSketch"] + resTarget["douyin"]["noSketch"] + resTarget["kuaishou"]["noSketch"] + resTarget["weibo"]["noSketch"] + resTarget["bilibili"]["noSketch"]
+	all2["noWork"] = resTarget["redbook"]["noWork"] + resTarget["douyin"]["noWork"] + resTarget["kuaishou"]["noWork"] + resTarget["weibo"]["noWork"] + resTarget["bilibili"]["noWork"]
+	all2["noData"] = resTarget["redbook"]["noData"] + resTarget["douyin"]["noData"] + resTarget["kuaishou"]["noData"] + resTarget["weibo"]["noData"] + resTarget["bilibili"]["noData"]
+	all2["cooperateOver"] = resTarget["redbook"]["cooperateOver"] + resTarget["douyin"]["cooperateOver"] + resTarget["kuaishou"]["cooperateOver"] + resTarget["weibo"]["cooperateOver"] + resTarget["bilibili"]["cooperateOver"]
+	resTarget["all"] = all2
+
+	resultMap["resTarget"] = &resTarget
+
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 合作待办-任务邀约
+func (t WorkspaceController) GetTaskInvite(c *gin.Context) {
+	param := &vo.CommonParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	projectToDo, err1 := service.ProjectService{}.GetTaskInviteToDo(param.EnterpriseId, param.SubAccountId)
+	if err1 != nil {
+		logrus.Errorf("[ProjectService] call Show err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	localLifeToDo, err2 := service.LocalLifeService{}.GetTaskInviteToDo(param.EnterpriseId, param.SubAccountId)
+	if err2 != nil {
+		logrus.Errorf("[ProjectService] call Show err:%+v\n", err2)
+		returnError(c, 40000, err2.Error())
+		return
+	}
+	resultMap := make(map[string]*map[string]map[string]int64)
+	resultMap["projectToDo"] = &projectToDo
+	resultMap["localLifeToDo"] = &localLifeToDo
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 合作待办-入库邀约
+func (t WorkspaceController) GetWarehouseInvite(c *gin.Context) {
+	param := &vo.CommonParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	resultMap := make(map[string]int64)
+	resultMap["inviteConfirming"] = 0
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 财务待办-充值与发票
+func (t WorkspaceController) GetFinance(c *gin.Context) {
+	param := &vo.CommonParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "Parameter Error: "+err.Error())
+		return
+	}
+	// 充值确认中
+	confirmingRecharge, err1 := service.RechargeService{}.GetFinance(param)
+	if err1 != nil {
+		logrus.Errorf("[RechargeService] call Show err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
+		return
+	}
+	// 开票中
+	invoicingAmount, err2 := service.InvoiceService{}.GetFinance(param)
+	if err2 != nil {
+		logrus.Errorf("[InvoiceService] call Show err:%+v\n", err2)
+		returnError(c, 40000, err2.Error())
+		return
+	}
+	res := make(map[string]float64)
+	res["confirmingRecharge"] = confirmingRecharge
+	res["invoicingAmount"] = invoicingAmount
+
+	returnSuccess(c, 20000, res)
+}

+ 24 - 5
app/dao/enterprise_dao.go

@@ -59,19 +59,38 @@ func (d EnterpriseDao) UpdateEnterpriseBalance(enterpriseId string, amount float
 }
 
 // 支付-更新账户余额、冻结金额
-func (d EnterpriseDao) UpdateEnterpriseBalanceAndFrozen(enterpriseId string, amount float64) (*string, error) {
+func (d EnterpriseDao) UpdateEnterpriseBalanceAndFrozen(enterpriseId string, needPay float64) (*string, error) {
 	var enterprise entity.Enterprise
 	var err error
 	err = Db.Debug().Model(&entity.Enterprise{}).Where("enterprise_id = ?", enterpriseId).Find(&enterprise).Error
 	if err != nil {
 		return nil, err
 	}
-	if enterprise.AvailableBalance < amount {
+	if enterprise.AvailableBalance < needPay {
 		return nil, errors.New("可用余额不足")
 	}
-	newBalance := enterprise.Balance - amount
-	newAvailableBalance := enterprise.AvailableBalance - amount
-	newFrozenBalance := enterprise.FrozenBalance + amount
+	newAvailableBalance := enterprise.AvailableBalance - needPay
+	newFrozenBalance := enterprise.FrozenBalance + needPay
+	err = Db.Model(&entity.Enterprise{}).Where("enterprise_id = ?", enterpriseId).Updates(entity.Enterprise{
+		AvailableBalance: newAvailableBalance,
+		FrozenBalance:    newFrozenBalance}).Error
+	if err != nil {
+		return nil, err
+	}
+	return &enterpriseId, nil
+}
+
+// 解冻-更新账户余额、冻结金额
+func (d EnterpriseDao) UpdateEnterpriseBalanceAndFrozen2(enterpriseId string, needPay float64, realPayments float64) (*string, error) {
+	var enterprise entity.Enterprise
+	var err error
+	err = Db.Model(&entity.Enterprise{}).Where("enterprise_id = ?", enterpriseId).Find(&enterprise).Error
+	if err != nil {
+		return nil, err
+	}
+	newBalance := enterprise.Balance - realPayments
+	newAvailableBalance := enterprise.AvailableBalance + (needPay - realPayments)
+	newFrozenBalance := enterprise.FrozenBalance - needPay
 	err = Db.Debug().Model(&entity.Enterprise{}).Where("enterprise_id = ?", enterpriseId).Updates(entity.Enterprise{
 		Balance:          newBalance,
 		AvailableBalance: newAvailableBalance,

+ 2 - 2
app/dao/enterprise_supplier_cooperate_dao.go

@@ -28,7 +28,7 @@ func (d EnterpriseSupplierCooperateDao) GetSupplierByEnterprise(enterpriseId str
 	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
 	var total int64
 	offset := (page - 1) * pageSize
-	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 2", enterpriseId)
+	query := Db.Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 2", enterpriseId)
 	query.Count(&total)
 	query = query.Select("supplier_id, cooperate_num, upload_talent_num, cooperate_talent_num, b_operator, b_operator_type, agree_time")
 	err := query.Order("agree_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error
@@ -56,7 +56,7 @@ func (d EnterpriseSupplierCooperateDao) GetSupplierConfirmingList(enterpriseId s
 	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
 	var total int64
 	offset := (page - 1) * pageSize
-	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 1", enterpriseId)
+	query := Db.Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 1", enterpriseId)
 	query.Count(&total)
 	query = query.Select("supplier_id,  b_operator, b_operator_type, cooperate_status, create_time")
 	err := query.Order("create_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error

+ 14 - 5
app/dao/info_auto_default_dao.go

@@ -10,12 +10,21 @@ type InfoAutoDefaultDao struct{}
 func (d InfoAutoDefaultDao) GetAutoDefaultLast(enterpriseId string) entity.InfoAutoDefault {
 	autoDefaultInfo := entity.InfoAutoDefault{}
 	Db.Model(&entity.InfoAutoDefault{}).Where("enterprise_id = ?", enterpriseId).Last(&autoDefaultInfo)
+	if autoDefaultInfo.AutoDefaultID == 0 {
+		Db.Model(&entity.InfoAutoDefault{}).Where("auto_default_id = ?", 0).Find(&autoDefaultInfo)
+	}
 	return autoDefaultInfo
 }
 
-// 获取指定 auto_default_id 的指定字段值
-func (d InfoAutoDefaultDao) GetValueByIdFieldName(autoDefaultId int64, fieldName string) int64 {
-	var value int64
-	Db.Model(&entity.InfoAutoDefault{}).Select(fieldName).Where("auto_default_id = ?", autoDefaultId).Find(&value)
-	return value
+// 获取指定 auto_default_id 的字段值
+func (d InfoAutoDefaultDao) GetValueById(autoDefaultId int64) (entity.InfoAutoDefault, error) {
+	var infoAutoDefault entity.InfoAutoDefault
+	err := Db.Model(&entity.InfoAutoDefault{}).Where("auto_default_id = ?", autoDefaultId).Find(&infoAutoDefault).Error
+	return infoAutoDefault, err
+}
+
+// 为当前 enterpriseId 插入新的策略配置
+func (d InfoAutoDefaultDao) Insert(infoAutoDefault entity.InfoAutoDefault) error {
+	err := Db.Model(&entity.InfoAutoDefault{}).Create(&infoAutoDefault).Error
+	return err
 }

+ 9 - 0
app/dao/info_auto_task_dao.go

@@ -10,6 +10,9 @@ type InfoAutoTaskDao struct{}
 func (d InfoAutoTaskDao) GetAutoTaskLast(enterpriseId string) entity.InfoAutoTask {
 	autoTaskInfo := entity.InfoAutoTask{}
 	Db.Model(&entity.InfoAutoTask{}).Where("enterprise_id = ?", enterpriseId).Last(&autoTaskInfo)
+	if autoTaskInfo.AutoTaskID == 0 {
+		Db.Model(&entity.InfoAutoTask{}).Where("auto_task_id = ?", 0).Find(&autoTaskInfo)
+	}
 	return autoTaskInfo
 }
 
@@ -19,3 +22,9 @@ func (d InfoAutoTaskDao) GetValueByIdFieldName(autoTaskId int64, fieldName strin
 	Db.Model(&entity.InfoAutoTask{}).Select(fieldName).Where("auto_task_id = ?", autoTaskId).First(&autoTaskInfo)
 	return autoTaskInfo
 }
+
+// 为当前 enterpriseId 插入新的策略配置
+func (d InfoAutoTaskDao) Insert(autoTaskInfo entity.InfoAutoTask) error {
+	err := Db.Debug().Model(&entity.InfoAutoTask{}).Create(&autoTaskInfo).Error
+	return err
+}

+ 11 - 0
app/dao/invoice_record_dao.go

@@ -118,3 +118,14 @@ func (d InvoiceRecordDao) GetBillableProjectList(enterpriseId string, subAccount
 //
 //	return billableProjects, total, nil
 //}
+
+// 获取指定企业id的开票中/已开票金额
+func (d InvoiceRecordDao) GetInvoiceAmount(enterpriseId string, status int64) (float64, error) {
+	var totalAmount float64
+	query := Db.Debug().Model(&entity.InvoiceRecord{})
+	err := query.Where("enterprise_id = ? AND status = ?", enterpriseId, status).Select("COALESCE(SUM(invoice_amount), 0)").Scan(&totalAmount).Error
+	if err != nil {
+		return 0, err
+	}
+	return totalAmount, nil
+}

+ 451 - 42
app/dao/local_life_dao.go

@@ -51,7 +51,7 @@ func (d LocalLifeDao) GetLocalListOfDay(enterpriseId string, date time.Time) ([]
 
 // 创建本地生活任务
 func (d LocalLifeDao) CreateLocalLife(localLife entity.LocalLifeInfo) error {
-	err := Db.Omit("auto_fail_at", "pay_at", "submit_at", "pass_at", "finish_at").Create(&localLife).Error
+	err := Db.Omit("auto_fail_at", "pay_at", "submit_at", "pass_at", "finish_at", "fail_at").Create(&localLife).Error
 	if err != nil {
 		return err
 	}
@@ -82,7 +82,7 @@ func (d LocalLifeDao) GetLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReLocal
 	var localLifes []entity.LocalLifeInfo
 	var total int64
 	query := Db.Model(&entity.LocalLifeInfo{})
-	//// 动态添加查询条件
+	// 动态添加查询条件
 	//if param.SubAccountId == 0 {
 	//	if param.EnterpriseId == "" {
 	//		return reLocalTaskPreviews, 0, errors.New("enterpriseId is empty")
@@ -99,6 +99,8 @@ func (d LocalLifeDao) GetLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReLocal
 	}
 	if param.LocalStatus != 0 {
 		query = query.Where("task_status = ?", param.LocalStatus)
+	} else {
+		query = query.Where("task_status not in ?", []int{1, 3})
 	}
 	if param.LocalForm != 0 {
 		query = query.Where("task_form = ?", param.LocalForm)
@@ -106,14 +108,11 @@ func (d LocalLifeDao) GetLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReLocal
 	if param.ContentType != 0 {
 		query = query.Where("content_type = ?", param.ContentType)
 	}
-	if param.LocalId != "" {
-		query = query.Where("local_id = ?", param.LocalId)
-	}
-	if param.LocalName != "" {
-		query = query.Where("local_name LIKE ?", "%"+param.LocalName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_status, estimated_cost, task_form, content_type, need_review, need_quality, need_calculate, store_id, team_buying_id, tools")
+	query = query.Select("enterprise_id, sub_account_id, local_id, local_name, local_platform, task_status, estimated_cost, need_pay, task_form, content_type, need_review, need_quality, need_calculate, store_id, team_buying_id, tools")
 	offset := (param.Page - 1) * param.PageSize
 	if param.Order == 1 {
 		if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&localLifes).Error; err != nil {
@@ -129,9 +128,9 @@ func (d LocalLifeDao) GetLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReLocal
 			EnterpriseId:  localLife.EnterpriseID,
 			SubAccountId:  localLife.SubAccountID,
 			LocalId:       localLife.LocalID,
+			LocalName:     localLife.LocalName,
 			LocalPlatform: localLife.LocalPlatform,
 			LocalStatus:   localLife.TaskStatus,
-			EstimatedCost: localLife.EstimatedCost,
 			LocalForm:     localLife.TaskForm,
 			ContentType:   localLife.ContentType,
 			NeedReview:    localLife.NeedReview,
@@ -141,6 +140,11 @@ func (d LocalLifeDao) GetLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReLocal
 			TeamBuyingId:  localLife.TeamBuyingId,
 			Tools:         localLife.Tools,
 		}
+		if localLife.TaskStatus < 6 {
+			reLocalTaskPreview.EstimatedCost = localLife.EstimatedCost
+		} else {
+			reLocalTaskPreview.EstimatedCost = localLife.NeedPay
+		}
 		reLocalTaskPreviews = append(reLocalTaskPreviews, reLocalTaskPreview)
 	}
 
@@ -152,7 +156,7 @@ func (d LocalLifeDao) DeleteLocalLife(localId string) (*string, error) {
 	if localId == "" {
 		return &localId, nil
 	}
-	err := Db.Where("local_id = ?", localId).Delete(&entity.LocalLifeInfo{}).Error
+	err := Db.Model(&entity.LocalLifeInfo{}).Where("local_id = ?", localId).Delete(&entity.LocalLifeInfo{}).Error
 	if err != nil {
 		return nil, err
 	}
@@ -180,8 +184,11 @@ func (d LocalLifeDao) GetLocalDraftList(param *vo.LocalDraftParam) ([]vo.ReLocal
 	if param.LocalPlatform != 0 {
 		query = query.Where("local_platform = ?", param.LocalPlatform)
 	}
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
+	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, local_type, created_at, store_id")
+	query = query.Select("enterprise_id, sub_account_id, local_id, local_name, local_platform, local_type, created_at, store_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&localLifeInfos).Error; err != nil {
 		return nil, 0, err
@@ -191,6 +198,7 @@ func (d LocalLifeDao) GetLocalDraftList(param *vo.LocalDraftParam) ([]vo.ReLocal
 			EnterpriseId:  localLifeInfo.EnterpriseID,
 			SubAccountId:  localLifeInfo.SubAccountID,
 			LocalId:       localLifeInfo.LocalID,
+			LocalName:     localLifeInfo.LocalName,
 			LocalPlatform: localLifeInfo.LocalPlatform,
 			LocalType:     localLifeInfo.LocalType,
 			CreatedAt:     localLifeInfo.CreatedAt.Format("2006-01-02 15:04:05"),
@@ -202,16 +210,60 @@ func (d LocalLifeDao) GetLocalDraftList(param *vo.LocalDraftParam) ([]vo.ReLocal
 	return reLocalTaskPreviews, total, nil
 }
 
-// 获取公开种草中全部指定状态值的项目
+// 获取公开本地生活中全部指定状态值的项目
 func (d LocalLifeDao) GetLocalLifeList(value int64, fieldName string) ([]*entity.LocalLifeInfo, error) {
 	var localLifeInfos []*entity.LocalLifeInfo
-	err := Db.Model(entity.LocalLifeInfo{}).Where(fmt.Sprintf("local_type = ? AND %s = ? ", fieldName), 1, value).Find(&localLifeInfos).Error
+	err := Db.Model(entity.LocalLifeInfo{}).Where(fmt.Sprintf("%s = ? ", fieldName), value).Find(&localLifeInfos).Error
 	if err != nil {
 		return nil, err
 	}
 	return localLifeInfos, nil
 }
 
+// 违约管理——违约公开本地生活任务列表
+func (d LocalLifeDao) GetLocalPublicList(param *vo.DefaultSearchParam) ([]vo.ReTaskDefaultPublic, int64, error) {
+	var reTaskDefaultPublics []vo.ReTaskDefaultPublic
+	var localLifeInfos []entity.LocalLifeInfo
+	var total int64
+	query := Db.Model(&entity.LocalLifeInfo{}).Where("local_type = ?", 1)
+	// 动态添加查询条件
+	//if param.SubAccountId == 0 {
+	//	if param.EnterpriseId == "" {
+	//		return reTaskDefaultPublics, 0, errors.New("enterpriseId is empty")
+	//	}
+	//	query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	//} else {
+	//	query = query.Where("sub_account_id = ?", param.SubAccountId)
+	//}
+	if param.Platform != 0 {
+		query = query.Where("local_platform = ?", param.Platform)
+	}
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
+	}
+	query.Count(&total)
+	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_form, content_type, store_id")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&localLifeInfos).Error; err != nil {
+		return nil, 0, err
+	}
+	for _, localLife := range localLifeInfos {
+		reTaskDefaultPublic := vo.ReTaskDefaultPublic{
+			EnterpriseId: localLife.EnterpriseID,
+			SubAccountId: localLife.SubAccountID,
+			TaskId:       localLife.LocalID,
+			Platform:     localLife.LocalPlatform,
+			TaskForm:     localLife.TaskForm,
+			ContentType:  localLife.ContentType,
+			TaskType:     1,
+			StoreId:      localLife.StoreID,
+		}
+		reTaskDefaultPublics = append(reTaskDefaultPublics, reTaskDefaultPublic)
+	}
+
+	return reTaskDefaultPublics, total, nil
+}
+
 // 探店本地生活列表
 func (d LocalLifeDao) GetLocalStoreExplorePreviews(param *vo.LocalSearchParam) ([]vo.ReLocalStoreExplorePreview, int64, error) {
 	var reLocalStoreExplorePreviews []vo.ReLocalStoreExplorePreview
@@ -219,29 +271,26 @@ func (d LocalLifeDao) GetLocalStoreExplorePreviews(param *vo.LocalSearchParam) (
 	var total int64
 	query := Db.Model(&entity.LocalLifeInfo{})
 	// 动态添加查询条件
-	if param.SubAccountId == 0 {
-		if param.EnterpriseId == "" {
-			return reLocalStoreExplorePreviews, 0, errors.New("enterpriseId is empty")
-		}
-		query = query.Where("enterprise_id = ?", param.EnterpriseId)
-	} else {
-		query = query.Where("sub_account_id = ?", param.SubAccountId)
-	}
+	//if param.SubAccountId == 0 {
+	//	if param.EnterpriseId == "" {
+	//		return reLocalStoreExplorePreviews, 0, errors.New("enterpriseId is empty")
+	//	}
+	//	query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	//} else {
+	//	query = query.Where("sub_account_id = ?", param.SubAccountId)
+	//}
 	if param.LocalType != 0 {
 		query = query.Where("local_type = ?", param.LocalType)
 	}
 	if param.LocalPlatform != 0 {
 		query = query.Where("local_platform = ?", param.LocalPlatform)
 	}
-	if param.LocalId != "" {
-		query = query.Where("local_id = ?", param.LocalId)
-	}
-	if param.LocalName != "" {
-		query = query.Where("local_name LIKE ?", "%"+param.LocalName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query = query.Where("task_status = ? AND task_form = ?", 8, 1)
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, local_id, local_type, local_platform, need_reserve, need_confirm, need_explore, explored_num, store_id, team_buying_id")
+	query = query.Select("enterprise_id, sub_account_id, local_id, local_name, local_type, local_platform, need_reserve, need_confirm, need_explore, explored_num, store_id, team_buying_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("pay_at asc").Offset(offset).Limit(param.PageSize).Find(&localLifes).Error; err != nil {
 		return nil, 0, err
@@ -251,6 +300,7 @@ func (d LocalLifeDao) GetLocalStoreExplorePreviews(param *vo.LocalSearchParam) (
 			EnterpriseId:  localLife.EnterpriseID,
 			SubAccountId:  localLife.SubAccountID,
 			LocalId:       localLife.LocalID,
+			LocalName:     localLife.LocalName,
 			LocalPlatform: localLife.LocalPlatform,
 			LocalType:     localLife.LocalType,
 			NeedReserve:   localLife.NeedReserve,
@@ -273,14 +323,14 @@ func (d LocalLifeDao) GetBillLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReB
 	var total int64
 	query := Db.Model(&entity.LocalLifeInfo{})
 	// 动态添加查询条件
-	if param.SubAccountId == 0 {
-		if param.EnterpriseId == "" {
-			return reBillLocalTaskPreviews, 0, errors.New("enterpriseId is empty")
-		}
-		query = query.Where("enterprise_id = ?", param.EnterpriseId)
-	} else {
-		query = query.Where("sub_account_id = ?", param.SubAccountId)
-	}
+	//if param.SubAccountId == 0 {
+	//	if param.EnterpriseId == "" {
+	//		return reBillLocalTaskPreviews, 0, errors.New("enterpriseId is empty")
+	//	}
+	//	query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	//} else {
+	//	query = query.Where("sub_account_id = ?", param.SubAccountId)
+	//}
 	if param.LocalType != 0 {
 		query = query.Where("local_type = ?", param.LocalType)
 	}
@@ -290,14 +340,11 @@ func (d LocalLifeDao) GetBillLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReB
 	if param.LocalStatus != 0 {
 		query = query.Where("task_status = ?", param.LocalStatus)
 	}
-	if param.LocalId != "" {
-		query = query.Where("local_id = ?", param.LocalId)
-	}
-	if param.LocalName != "" {
-		query = query.Where("local_name LIKE ?", "%"+param.LocalName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_status, estimated_cost, task_form, content_type, store_id, team_buying_id, settlement_amount")
+	query = query.Select("enterprise_id, sub_account_id, local_id, local_name, local_platform, task_status, estimated_cost, need_pay, task_form, content_type, store_id, team_buying_id, settlement_amount")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&localLifes).Error; err != nil {
 		return nil, 0, err
@@ -307,17 +354,379 @@ func (d LocalLifeDao) GetBillLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReB
 			EnterpriseId:  localLife.EnterpriseID,
 			SubAccountId:  localLife.SubAccountID,
 			LocalId:       localLife.LocalID,
+			LocalName:     localLife.LocalName,
 			LocalPlatform: localLife.LocalPlatform,
 			LocalStatus:   localLife.TaskStatus,
-			EstimatedCost: localLife.EstimatedCost,
 			LocalForm:     localLife.TaskForm,
 			ContentType:   localLife.ContentType,
 			StoreId:       localLife.StoreID,
 			TeamBuyingId:  localLife.TeamBuyingId,
 			CashAmount:    localLife.SettlementAmount,
 		}
+		if localLife.TaskStatus < 6 {
+			reBillLocalTaskPreview.EstimatedCost = localLife.EstimatedCost
+		} else {
+			reBillLocalTaskPreview.EstimatedCost = localLife.NeedPay
+		}
 		reBillLocalTaskPreviews = append(reBillLocalTaskPreviews, reBillLocalTaskPreview)
 	}
 
 	return reBillLocalTaskPreviews, total, nil
 }
+
+// 本地生活任务待办
+func (d LocalLifeDao) GetLocalLifeToDo(enterpriseId string, subAccountId int64, platform int64, taskType int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var needReview int64 // 待审核
+	var needPay int64
+	var needProcess int64
+	var needCheck int64     // 初稿待审
+	var needQuality int64   // 链接待审
+	var needCalculate int64 // 待结算
+	var localInfos []entity.LocalLifeInfo
+	//query := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+	if subAccountId == 0 {
+		// 待审核、待支付、达人未处理、初稿待审、链接待审、待结算
+		query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		query1.Where("task_status = ?", 2).Count(&needReview)
+		query2 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		query2.Where("task_status = ?", 6).Count(&needPay)
+		query3 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		err := query3.Where("task_status = ?", 8).Select("local_id").Find(&localInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needProcess = 0
+			} else {
+				return resultMap, err
+			}
+		} else if len(localInfos) > 0 {
+			var localIDs []string
+			for _, info := range localInfos {
+				localIDs = append(localIDs, info.LocalID)
+			}
+			if len(localIDs) > 0 {
+				err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_status = ?", localIDs, 1).Count(&needProcess).Error // task_status=1待选
+				if err1 != nil {
+					needProcess = 0
+				}
+			}
+		}
+		query4 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		err1 := query4.Select("need_review, need_quality, need_calculate").Find(&localInfos).Error
+		if err1 != nil {
+			return resultMap, err1
+		} else if len(localInfos) > 0 {
+			for _, info := range localInfos {
+				needCheck += info.NeedReview
+				needQuality += info.NeedQuality
+				needCalculate += info.NeedCalculate
+			}
+		}
+	} else {
+		// 待审核、待支付、达人未处理
+		query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		query1.Where("sub_account_id = ? and task_status = ?", subAccountId, 2).Count(&needReview)
+		query2 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		query2.Where("sub_account_id = ? and task_status = ?", subAccountId, 6).Count(&needPay)
+		query3 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		err := query3.Where("sub_account_id = ? and task_status = ?", subAccountId, 8).Select("local_id").Find(&localInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needProcess = 0
+			} else {
+				return resultMap, err
+			}
+		} else {
+			var localIDs []string
+			for _, info := range localInfos {
+				localIDs = append(localIDs, info.LocalID)
+			}
+			if len(localIDs) > 0 {
+				err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_status = ?", localIDs, 1).Count(&needProcess).Error // task_status=1待选
+				if err1 != nil {
+					needProcess = 0
+				}
+			}
+		}
+		query4 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		err1 := query4.Select("need_review, need_quality, need_calculate").Find(&localInfos).Error
+		if err1 != nil {
+			return resultMap, err1
+		} else if len(localInfos) > 0 {
+			for _, info := range localInfos {
+				needCheck += info.NeedReview
+				needQuality += info.NeedQuality
+				needCalculate += info.NeedCalculate
+			}
+		}
+	}
+	resultMap["needReview"] = needReview
+	resultMap["needPay"] = needPay
+	resultMap["needProcess"] = needProcess
+	resultMap["needCheck"] = needCheck
+	resultMap["needQuality"] = needQuality
+	resultMap["needCalculate"] = needCalculate
+	return resultMap, nil
+}
+
+// 探店邀约任务待办
+func (d LocalLifeDao) GetExploreToDo(enterpriseId string, subAccountId int64, platform int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var needBook int64    // 待预约探店时间
+	var needConfirm int64 // 探店时间待确认
+	var needExplore int64 // 达人待探店
+	var localInfos []entity.LocalLifeInfo
+	//query := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+	if subAccountId == 0 {
+		// 待预约探店时间、探店时间待确认、达人待探店
+		query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and task_form = ?", enterpriseId, platform, 1)
+		err := query1.Where("task_status = ?", 8).Select("local_id").Find(&localInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needBook = 0
+				needConfirm = 0
+				needExplore = 0
+			} else {
+				return resultMap, err
+			}
+		} else if len(localInfos) > 0 {
+			var localIDs []string
+			for _, info := range localInfos {
+				localIDs = append(localIDs, info.LocalID)
+			}
+			if len(localIDs) > 0 {
+				err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 4).Count(&needBook).Error // task_stage=4待预约探店
+				if err1 != nil {
+					needBook = 0
+				}
+				err2 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 5).Count(&needConfirm).Error // task_stage=4预约确认中
+				if err2 != nil {
+					needConfirm = 0
+				}
+				err3 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and book_status = ?", localIDs, 5).Count(&needExplore).Error // book_status=5达人待探店
+				if err3 != nil {
+					needExplore = 0
+				}
+			}
+		}
+	} else {
+		// 待预约探店时间、探店时间待确认、达人待探店
+		query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and task_form = ?", enterpriseId, platform, 1)
+		err := query1.Where("sub_account_id = ? and task_status = ?", subAccountId, 8).Select("local_id").Find(&localInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needBook = 0
+				needConfirm = 0
+				needExplore = 0
+			} else {
+				return resultMap, err
+			}
+		} else if len(localInfos) > 0 {
+			var localIDs []string
+			for _, info := range localInfos {
+				localIDs = append(localIDs, info.LocalID)
+			}
+			if len(localIDs) > 0 {
+				err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 4).Count(&needBook).Error // task_stage=4待预约探店
+				if err1 != nil {
+					needBook = 0
+				}
+				err2 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 5).Count(&needConfirm).Error // task_stage=4预约确认中
+				if err2 != nil {
+					needConfirm = 0
+				}
+				err3 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and book_status = ?", localIDs, 5).Count(&needExplore).Error // book_status=5达人待探店
+				if err3 != nil {
+					needExplore = 0
+				}
+			}
+		}
+	}
+	resultMap["needBook"] = needBook
+	resultMap["needConfirm"] = needConfirm
+	resultMap["needExplore"] = needExplore
+
+	return resultMap, nil
+}
+
+// 违约管理任务待办
+func (d LocalLifeDao) GetDefaultToDo(enterpriseId string, subAccountId int64, platform int64, taskType int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var noSketch int64      // 未传初稿
+	var noWork int64        // 未发作品
+	var noData int64        // 未传数据
+	var cooperateOver int64 // 终止合作
+	var localInfos []entity.LocalLifeInfo
+	//query := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+	if subAccountId == 0 {
+		// 未传初稿、未发作品、未传数据、终止合作
+		query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		err := query1.Where("task_status = ?", 8).Select("local_id").Find(&localInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				noSketch = 0
+				noWork = 0
+				noData = 0
+				cooperateOver = 0
+			} else {
+				return resultMap, err
+			}
+		} else if len(localInfos) > 0 {
+			var localIDs []string
+			for _, info := range localInfos {
+				localIDs = append(localIDs, info.LocalID)
+			}
+			if len(localIDs) > 0 {
+				err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and cur_default_type = ?", localIDs, 4).Count(&noSketch).Error // cur_default_type=4 初稿未上传违约
+				if err1 != nil {
+					noSketch = 0
+				}
+				err2 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and cur_default_type = ?", localIDs, 6).Count(&noWork).Error // cur_default_type=6 链接未上传违约
+				if err2 != nil {
+					noWork = 0
+				}
+				err3 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and cur_default_type = ?", localIDs, 8).Count(&noData).Error // cur_default_type=8 数据未上传违约
+				if err3 != nil {
+					noData = 0
+				}
+				err4 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and cur_default_type = ?", localIDs, 10).Count(&cooperateOver).Error // cur_default_type=10 解约
+				if err4 != nil {
+					cooperateOver = 0
+				}
+			}
+		}
+	} else {
+		// 未传初稿、未发作品、未传数据、终止合作
+		query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+		err := query1.Where("sub_account_id = ? and task_status = ?", subAccountId, 8).Select("local_id").Find(&localInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				noSketch = 0
+				noWork = 0
+				noData = 0
+				cooperateOver = 0
+			} else {
+				return resultMap, err
+			}
+		} else if len(localInfos) > 0 {
+			var localIDs []string
+			for _, info := range localInfos {
+				localIDs = append(localIDs, info.LocalID)
+			}
+			if len(localIDs) > 0 {
+				err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and cur_default_type = ?", localIDs, 4).Count(&noSketch).Error // cur_default_type=4 初稿未上传违约
+				if err1 != nil {
+					noSketch = 0
+				}
+				err2 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and cur_default_type = ?", localIDs, 6).Count(&noWork).Error // cur_default_type=6 链接未上传违约
+				if err2 != nil {
+					noWork = 0
+				}
+				err3 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and cur_default_type = ?", localIDs, 8).Count(&noData).Error // cur_default_type=8 数据未上传违约
+				if err3 != nil {
+					noData = 0
+				}
+				err4 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and cur_default_type = ?", localIDs, 10).Count(&cooperateOver).Error // cur_default_type=10 解约
+				if err4 != nil {
+					cooperateOver = 0
+				}
+			}
+		}
+	}
+	resultMap["noSketch"] = noSketch
+	resultMap["noWork"] = noWork
+	resultMap["noData"] = noData
+	resultMap["cooperateOver"] = cooperateOver
+
+	return resultMap, nil
+}
+
+// 获取指定商家已结案的指定开票状态数据
+func (d LocalLifeDao) GetLocalLifeFinished(enterpriseId string, invoiceStatus int64) (float64, error) {
+	var localLifeAmount float64
+	err := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and task_status = ? and invoice_status = ?", enterpriseId, 10, invoiceStatus).Select("COALESCE(SUM(settlement_amount), 0)").Find(&localLifeAmount).Error
+	if err != nil {
+		return 0, err
+	}
+	return localLifeAmount, err
+}
+
+// 合作待办-任务邀约
+func (d LocalLifeDao) GetTaskInviteToDo(enterpriseId string, subAccountId int64, platform int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var availInvitationNum int64 //
+	var invitingNum int64        //
+	var cooperatingNum int64     //
+	//var localInfos []entity.LocalLifeInfo
+	////query := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
+	//if subAccountId == 0 {
+	//	// 待预约探店时间、探店时间待确认、达人待探店
+	//	query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and task_form = ?", enterpriseId, platform, 1)
+	//	err := query1.Where("task_status = ?", 8).Select("local_id").Find(&localInfos).Error
+	//	if err != nil {
+	//		if errors.Is(err, gorm.ErrRecordNotFound) {
+	//			needBook = 0
+	//			needConfirm = 0
+	//			needExplore = 0
+	//		} else {
+	//			return resultMap, err
+	//		}
+	//	} else if len(localInfos) > 0 {
+	//		var localIDs []string
+	//		for _, info := range localInfos {
+	//			localIDs = append(localIDs, info.LocalID)
+	//		}
+	//		if len(localIDs) > 0 {
+	//			err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 4).Count(&needBook).Error // task_stage=4待预约探店
+	//			if err1 != nil {
+	//				needBook = 0
+	//			}
+	//			err2 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 5).Count(&needConfirm).Error // task_stage=4预约确认中
+	//			if err2 != nil {
+	//				needConfirm = 0
+	//			}
+	//			err3 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and book_status = ?", localIDs, 5).Count(&needExplore).Error // book_status=5达人待探店
+	//			if err3 != nil {
+	//				needExplore = 0
+	//			}
+	//		}
+	//	}
+	//} else {
+	//	// 待预约探店时间、探店时间待确认、达人待探店
+	//	query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and task_form = ?", enterpriseId, platform, 1)
+	//	err := query1.Where("sub_account_id = ? and task_status = ?", subAccountId, 8).Select("local_id").Find(&localInfos).Error
+	//	if err != nil {
+	//		if errors.Is(err, gorm.ErrRecordNotFound) {
+	//			needBook = 0
+	//			needConfirm = 0
+	//			needExplore = 0
+	//		} else {
+	//			return resultMap, err
+	//		}
+	//	} else if len(localInfos) > 0 {
+	//		var localIDs []string
+	//		for _, info := range localInfos {
+	//			localIDs = append(localIDs, info.LocalID)
+	//		}
+	//		if len(localIDs) > 0 {
+	//			err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 4).Count(&needBook).Error // task_stage=4待预约探店
+	//			if err1 != nil {
+	//				needBook = 0
+	//			}
+	//			err2 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 5).Count(&needConfirm).Error // task_stage=4预约确认中
+	//			if err2 != nil {
+	//				needConfirm = 0
+	//			}
+	//			err3 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and book_status = ?", localIDs, 5).Count(&needExplore).Error // book_status=5达人待探店
+	//			if err3 != nil {
+	//				needExplore = 0
+	//			}
+	//		}
+	//	}
+	//}
+	resultMap["availInvitationNum"] = availInvitationNum
+	resultMap["invitingNum"] = invitingNum
+	resultMap["cooperatingNum"] = cooperatingNum
+
+	return resultMap, nil
+}

+ 26 - 11
app/dao/local_life_task_info_dao.go

@@ -22,29 +22,44 @@ func (d LocalLifeTaskInfoDao) CountByTaskStage(localId string, taskStage int64)
 }
 
 // 获取指定任务阶段的本地生活子任务
-func (d LocalLifeTaskInfoDao) GetListByTaskStage(localId string, bookStatus int64, time string, page int, pageSize int) ([]*entity.LocalLifeTaskInfo, int64, error) {
+func (d LocalLifeTaskInfoDao) GetListByTaskStage(localId string, taskStage int64, time string, page int, pageSize int) ([]*entity.LocalLifeTaskInfo, int64, error) {
 	var taskInfos []*entity.LocalLifeTaskInfo
 	var total int64
-	query := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND book_status = ?", localId, bookStatus)
+	query := Db.Debug().Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND task_stage = ?", localId, taskStage)
 	// 计算偏移量
 	offset := (page - 1) * pageSize
 	var err error
-	if bookStatus == 1 {
+	if taskStage == 4 { // 待预约探店
 		query.Count(&total)
 		err = query.Order("select_date asc").Offset(offset).Limit(pageSize).Find(&taskInfos).Error
-	} else if bookStatus == 2 {
+	} else if taskStage == 5 { // 待确认探店
 		if time != "" {
 			query = query.Where("DATE(reserve_time) = ?", time)
 		}
 		query.Count(&total)
 		err = query.Order("reserve_time desc").Offset(offset).Limit(pageSize).Find(&taskInfos).Error
-	} else if bookStatus == 3 {
+	}
+	if err != nil {
+		return nil, 0, err
+	}
+	return taskInfos, total, nil
+}
+
+// 获取指定探店状态的本地生活子任务
+func (d LocalLifeTaskInfoDao) GetListByBookStatus(localId string, bookStatus int64, time string, page int, pageSize int) ([]*entity.LocalLifeTaskInfo, int64, error) {
+	var taskInfos []*entity.LocalLifeTaskInfo
+	var total int64
+	query := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND book_status = ?", localId, bookStatus)
+	// 计算偏移量
+	offset := (page - 1) * pageSize
+	var err error
+	if bookStatus == 5 { // 待探店
 		if time != "" {
 			query = query.Where("DATE(explore_time) = ?", time)
 		}
 		query.Count(&total)
 		err = query.Order("explore_time desc").Offset(offset).Limit(pageSize).Find(&taskInfos).Error
-	} else if bookStatus == 4 {
+	} else if bookStatus == 6 { // 已探店
 		if time != "" {
 			query = query.Where("DATE(finish_explore_time) = ?", time)
 		}
@@ -63,7 +78,7 @@ func (d LocalLifeTaskInfoDao) GetListBySketchDefault(param *vo.DefaultSearchPara
 	var total int64
 	query := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND cur_default_type = ?", param.TaskId, 4)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, sketch_missing_time")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, sketch_missing_time, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("sketch_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err
@@ -77,7 +92,7 @@ func (d LocalLifeTaskInfoDao) GetListByLinkDefault(param *vo.DefaultSearchParam)
 	var total int64
 	query := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND cur_default_type = ?", param.TaskId, 6)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, link_missing_time")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, link_missing_time, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("link_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err
@@ -91,7 +106,7 @@ func (d LocalLifeTaskInfoDao) GetListByDataDefault(param *vo.DefaultSearchParam)
 	var total int64
 	query := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND cur_default_type = ?", param.TaskId, 8)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, data_missing_time")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, data_missing_time, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("data_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err
@@ -105,7 +120,7 @@ func (d LocalLifeTaskInfoDao) GetListByTerminateDefault(param *vo.DefaultSearchP
 	var total int64
 	query := Db.Debug().Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND task_stage = ?", param.TaskId, 17)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, terminate_time, terminate_reason, terminate_operator_type, terminate_operator")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, terminate_time, terminate_reason, terminate_operator_type, terminate_operator, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("terminate_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err
@@ -119,7 +134,7 @@ func (d LocalLifeTaskInfoDao) GetListByCancelDefault(param *vo.DefaultSearchPara
 	var total int64
 	query := Db.Debug().Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND task_stage = ?", param.TaskId, 16)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, cancel_time, cancel_reason, cancel_operator_type, cancel_operator")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, cancel_time, cancel_reason, cancel_operator_type, cancel_operator, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("cancel_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err

+ 8 - 6
app/dao/platform_kuaishou_user_info_dao.go

@@ -1,18 +1,20 @@
 package dao
 
 import (
-	"github.com/sirupsen/logrus"
 	"youngee_m_api/app/entity"
 )
 
 type PlatformKuaishouUserInfoDao struct{}
 
-func (d PlatformKuaishouUserInfoDao) SelectUserInfo(talentId string) (*entity.PlatformKuaishouUserInfo, error) {
-	var userInfo *entity.PlatformKuaishouUserInfo
-	err := Db.Model(entity.PlatformKuaishouUserInfo{}).Select("open_id, nick_name, head_uri").Where("talent_id = ?", talentId).Find(&userInfo).Error
+func (d PlatformKuaishouUserInfoDao) GetUserInfo(openId string) (entity.PlatformKuaishouUserInfo, error) {
+	var userInfo entity.PlatformKuaishouUserInfo
+	err := Db.Model(&entity.PlatformKuaishouUserInfo{}).Select("open_id, platform_id, nick_name, head_uri, city, gender").Where("open_id = ?", openId).Find(&userInfo).Error
 	if err != nil {
-		logrus.Errorf("[SelectUserInfo] error query, err:%+v", err)
-		return nil, err
+		userInfo.OpenID = openId
+		userInfo.NickName = ""
+		userInfo.HeadUri = ""
+		userInfo.City = ""
+		userInfo.Gender = ""
 	}
 	return userInfo, nil
 }

+ 7 - 0
app/dao/product_dao.go

@@ -127,3 +127,10 @@ func (d ProductDAO) GetProductCategorys() ([]entity.InfoProductCategory, error)
 	err := Db.Model(&entity.InfoProductCategory{}).Find(&infoProductCategorys).Order("id").Error
 	return infoProductCategorys, err
 }
+
+// 判断当前商家快手商品是否存在
+func (d ProductDAO) CheckKuaishouProduct(enterpriseId string, kuaishouProductId string) int64 {
+	var count int64
+	Db.Model(&entity.Product{}).Where("enterprise_id = ? and kuaishou_product_id = ?", enterpriseId, kuaishouProductId).Count(&count)
+	return count
+}

+ 400 - 47
app/dao/project_dao.go

@@ -14,7 +14,7 @@ type ProjectDAO struct{}
 // 根据projectId获取project信息
 func (d ProjectDAO) GetProjectById(projectId string) (*entity.Project, error) {
 	var project entity.Project
-	err := Db.Where("project_id = ?", projectId).Find(&project).Error
+	err := Db.Where("project_id = ?", projectId).First(&project).Error
 	if err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return nil, nil
@@ -51,7 +51,7 @@ func (d ProjectDAO) GetProjectListOfDay(enterpriseId string, date time.Time) ([]
 
 // 创建种草任务
 func (d ProjectDAO) CreateProject(project entity.Project) error {
-	err := Db.Omit("auto_fail_at", "auto_script_break_at", "auto_sketch_break_at", "pay_at", "pass_at", "finish_at", "submit_at").Create(&project).Error
+	err := Db.Omit("auto_fail_at", "auto_script_break_at", "auto_sketch_break_at", "pay_at", "pass_at", "finish_at", "submit_at", "fail_at").Create(&project).Error
 	if err != nil {
 		return err
 	}
@@ -82,7 +82,7 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 	var projects []entity.Project
 	var total int64
 	query := Db.Model(&entity.Project{})
-	//// 动态添加查询条件
+	// 动态添加查询条件
 	//if param.SubAccountId == 0 {
 	//	if param.EnterpriseId == "" {
 	//		return reProjectTaskPreviews, 0, errors.New("enterpriseId is empty")
@@ -99,6 +99,8 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 	}
 	if param.ProjectStatus != 0 {
 		query = query.Where("project_status = ?", param.ProjectStatus)
+	} else {
+		query = query.Where("project_status not in ?", []int{1, 3})
 	}
 	if param.ProjectForm != 0 {
 		query = query.Where("project_form = ?", param.ProjectForm)
@@ -106,14 +108,11 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 	if param.ContentType != 0 {
 		query = query.Where("content_type = ?", param.ContentType)
 	}
-	if param.ProjectId != "" {
-		query = query.Where("project_id = ?", param.ProjectId)
-	}
-	if param.ProjectName != "" {
-		query = query.Where("project_name LIKE ?", "%"+param.ProjectName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or project_id = ? or project_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, project_form, content_type, need_review, need_quality, need_calculate, before_delivery_num, delivery_num, after_delivery_num, product_id, tools")
+	query = query.Select("enterprise_id, sub_account_id, project_id, project_name, project_platform, project_status, estimated_cost, need_pay, project_form, content_type, need_review, need_quality, need_calculate, before_delivery_num, delivery_num, after_delivery_num, product_id, tools")
 	offset := (param.Page - 1) * param.PageSize
 	if param.Order == 1 {
 		if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
@@ -125,13 +124,17 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 		}
 	}
 	for _, project := range projects {
+		// 获取种草待筛选达人数
+		projectId := project.ProjectId
+		needFilter := ProjectTaskInfoDao{}.CountByTaskStage(projectId, 1)
+
 		reProjectTaskPreview := vo.ReProjectTaskPreview{
 			EnterpriseId:    project.EnterpriseID,
 			SubAccountId:    project.SubAccountId,
 			ProjectId:       project.ProjectId,
+			ProjectName:     project.ProjectName,
 			ProjectPlatform: project.ProjectPlatform,
 			ProjectStatus:   project.ProjectStatus,
-			EstimatedCost:   project.EstimatedCost,
 			ProjectForm:     project.ProjectForm,
 			ContentType:     project.ContentType,
 			NeedReview:      project.NeedReview,
@@ -142,6 +145,12 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 			NeedDelivery:    project.BeforeDeliveryNum,
 			NeedReceive:     project.DeliveryNum,
 			Received:        project.AfterDeliveryNum,
+			NeedFilter:      needFilter,
+		}
+		if project.ProjectStatus < 6 {
+			reProjectTaskPreview.EstimatedCost = project.EstimatedCost
+		} else {
+			reProjectTaskPreview.EstimatedCost = project.NeedPay
 		}
 		reProjectTaskPreviews = append(reProjectTaskPreviews, reProjectTaskPreview)
 	}
@@ -154,14 +163,14 @@ func (d ProjectDAO) DeleteProject(projectId string) (*string, error) {
 	if projectId == "" {
 		return &projectId, nil
 	}
-	err := Db.Debug().Where("project_id = ?", projectId).Delete(&entity.Project{}).Error
+	err := Db.Model(&entity.Project{}).Where("project_id = ?", projectId).Delete(&entity.Project{}).Error
 	if err != nil {
 		return nil, err
 	}
 	return &projectId, nil
 }
 
-// 获取草稿箱——电商带货任务列表
+// 获取草稿箱——种草任务列表
 func (d ProjectDAO) GetProjectDraftList(param *vo.ProjectDraftParam) ([]vo.ReProjectTaskPreview, int64, error) {
 	var reProjectTaskPreviews []vo.ReProjectTaskPreview
 	var projects []entity.Project
@@ -182,8 +191,11 @@ func (d ProjectDAO) GetProjectDraftList(param *vo.ProjectDraftParam) ([]vo.RePro
 	if param.ProjectPlatform != 0 {
 		query = query.Where("project_platform = ?", param.ProjectPlatform)
 	}
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or project_id = ? or project_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
+	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_type, created_at, product_id")
+	query = query.Select("enterprise_id, sub_account_id, project_id, project_name, project_platform, project_type, created_at, product_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
 		return nil, 0, err
@@ -193,6 +205,7 @@ func (d ProjectDAO) GetProjectDraftList(param *vo.ProjectDraftParam) ([]vo.RePro
 			EnterpriseId:    project.EnterpriseID,
 			SubAccountId:    project.SubAccountId,
 			ProjectId:       project.ProjectId,
+			ProjectName:     project.ProjectName,
 			ProjectPlatform: project.ProjectPlatform,
 			ProjectType:     project.ProjectType,
 			CreatedAt:       project.CreatedAt.Format("2006-01-02 15:04:05"),
@@ -207,7 +220,7 @@ func (d ProjectDAO) GetProjectDraftList(param *vo.ProjectDraftParam) ([]vo.RePro
 // 获取公开种草中全部指定状态值的项目
 func (d ProjectDAO) GetProjectList(value int64, fieldName string) ([]*entity.Project, error) {
 	var projectInfos []*entity.Project
-	err := Db.Model(entity.Project{}).Where(fmt.Sprintf("project_type = ? AND %s = ? ", fieldName), 1, value).Find(&projectInfos).Error
+	err := Db.Model(entity.Project{}).Where(fmt.Sprintf("%s = ? ", fieldName), value).Find(&projectInfos).Error
 	if err != nil {
 		return nil, err
 	}
@@ -221,14 +234,14 @@ func (d ProjectDAO) GetProjectPublicList(param *vo.DefaultSearchParam) ([]vo.ReT
 	var total int64
 	query := Db.Model(&entity.Project{}).Where("project_type = ?", 1)
 	// 动态添加查询条件
-	if param.SubAccountId == 0 {
-		if param.EnterpriseId == "" {
-			return reTaskDefaultPublics, 0, errors.New("enterpriseId is empty")
-		}
-		query = query.Where("enterprise_id = ?", param.EnterpriseId)
-	} else {
-		query = query.Where("sub_account_id = ?", param.SubAccountId)
-	}
+	//if param.SubAccountId == 0 {
+	//	if param.EnterpriseId == "" {
+	//		return reTaskDefaultPublics, 0, errors.New("enterpriseId is empty")
+	//	}
+	//	query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	//} else {
+	//	query = query.Where("sub_account_id = ?", param.SubAccountId)
+	//}
 	if param.Platform != 0 {
 		query = query.Where("project_platform = ?", param.Platform)
 	}
@@ -236,7 +249,7 @@ func (d ProjectDAO) GetProjectPublicList(param *vo.DefaultSearchParam) ([]vo.ReT
 		query = query.Where("project_id = ?", param.TaskId)
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_form, content_type, product_id")
+	query = query.Select("enterprise_id, sub_account_id, project_id, project_name, project_platform, project_form, content_type, product_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
 		return nil, 0, err
@@ -246,6 +259,7 @@ func (d ProjectDAO) GetProjectPublicList(param *vo.DefaultSearchParam) ([]vo.ReT
 			EnterpriseId: project.EnterpriseID,
 			SubAccountId: project.SubAccountId,
 			TaskId:       project.ProjectId,
+			TaskName:     project.ProjectName,
 			Platform:     project.ProjectPlatform,
 			TaskForm:     project.ProjectForm,
 			ContentType:  project.ContentType,
@@ -265,14 +279,14 @@ func (d ProjectDAO) GetProjectTargetList(param *vo.DefaultSearchParam) ([]vo.ReT
 	var total int64
 	query := Db.Model(&entity.Project{}).Where("project_type = ?", 2)
 	// 动态添加查询条件
-	if param.SubAccountId == 0 {
-		if param.EnterpriseId == "" {
-			return reTaskDefaultTargets, 0, errors.New("enterpriseId is empty")
-		}
-		query = query.Where("enterprise_id = ?", param.EnterpriseId)
-	} else {
-		query = query.Where("sub_account_id = ?", param.SubAccountId)
-	}
+	//if param.SubAccountId == 0 {
+	//	if param.EnterpriseId == "" {
+	//		return reTaskDefaultTargets, 0, errors.New("enterpriseId is empty")
+	//	}
+	//	query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	//} else {
+	//	query = query.Where("sub_account_id = ?", param.SubAccountId)
+	//}
 	if param.Platform != 0 {
 		query = query.Where("project_platform = ?", param.Platform)
 	}
@@ -307,7 +321,7 @@ func (d ProjectDAO) GetProjectFrozenList(enterpriseId string) ([]*entity.Project
 	var projects []*entity.Project
 	query := Db.Debug().Model(entity.Project{})
 	query.Select("project_id, product_id, enterprise_id, sub_account_id, project_platform, payment_amount, pay_at") // 冻结金额:payment_amount
-	err := query.Where(fmt.Sprintf("enterprise_id = ? AND (project_status between 7 and 8) "), enterpriseId).Find(&projects).Error
+	err := query.Where(fmt.Sprintf("enterprise_id = ? AND project_type = ? AND (project_status between 7 and 8) "), enterpriseId, 1).Find(&projects).Error
 	if err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return projects, nil
@@ -323,7 +337,7 @@ func (d ProjectDAO) GetProjectFrozenCancelList(enterpriseId string) ([]*entity.P
 	var projects []*entity.Project
 	query := Db.Debug().Model(entity.Project{})
 	query.Select("project_id, product_id, enterprise_id, sub_account_id, project_platform, settlement_amount, pay_at") // 解冻金额:settlement_amount
-	err := query.Where(fmt.Sprintf("enterprise_id = ? AND (project_status between 9 and 10) "), enterpriseId).Find(&projects).Error
+	err := query.Where(fmt.Sprintf("enterprise_id = ? AND project_type = ? AND (project_status between 9 and 10) "), enterpriseId, 1).Find(&projects).Error
 	if err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return projects, nil
@@ -341,14 +355,14 @@ func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.R
 	var total int64
 	query := Db.Model(&entity.Project{})
 	// 动态添加查询条件
-	if param.SubAccountId == 0 {
-		if param.EnterpriseId == "" {
-			return reBillProjectTaskPreviews, 0, errors.New("enterpriseId is empty")
-		}
-		query = query.Where("enterprise_id = ?", param.EnterpriseId)
-	} else {
-		query = query.Where("sub_account_id = ?", param.SubAccountId)
-	}
+	//if param.SubAccountId == 0 {
+	//	if param.EnterpriseId == "" {
+	//		return reBillProjectTaskPreviews, 0, errors.New("enterpriseId is empty")
+	//	}
+	//	query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	//} else {
+	//	query = query.Where("sub_account_id = ?", param.SubAccountId)
+	//}
 	if param.ProjectType != 0 {
 		query = query.Where("project_type = ?", param.ProjectType)
 	}
@@ -358,14 +372,11 @@ func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.R
 	if param.ProjectStatus != 0 {
 		query = query.Where("project_status = ?", param.ProjectStatus)
 	}
-	if param.ProjectId != "" {
-		query = query.Where("project_id = ?", param.ProjectId)
-	}
-	if param.ProjectName != "" {
-		query = query.Where("project_name LIKE ?", "%"+param.ProjectName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or project_id = ? or project_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, project_form, content_type, product_id, settlement_amount")
+	query = query.Select("enterprise_id, sub_account_id, project_id, project_name, project_platform, project_status, estimated_cost, need_pay, project_form, content_type, product_id, settlement_amount")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
 		return nil, 0, err
@@ -375,6 +386,7 @@ func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.R
 			EnterpriseId:    project.EnterpriseID,
 			SubAccountId:    project.SubAccountId,
 			ProjectId:       project.ProjectId,
+			ProjectName:     project.ProjectName,
 			ProjectPlatform: project.ProjectPlatform,
 			ProjectStatus:   project.ProjectStatus,
 			ProjectForm:     project.ProjectForm,
@@ -383,8 +395,349 @@ func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.R
 			EstimatedCost:   project.EstimatedCost,    // 应付金额
 			CashAmount:      project.SettlementAmount, //实际结算金额
 		}
+		if project.ProjectStatus < 6 {
+			reBillProjectTaskPreview.EstimatedCost = project.EstimatedCost
+		} else {
+			reBillProjectTaskPreview.EstimatedCost = project.NeedPay
+		}
 		reBillProjectTaskPreviews = append(reBillProjectTaskPreviews, reBillProjectTaskPreview)
 	}
 
 	return reBillProjectTaskPreviews, total, nil
 }
+
+// 种草任务待办
+func (d ProjectDAO) GetProjectToDo(enterpriseId string, subAccountId int64, platform int64, taskType int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var needReview int64 // 待审核
+	var needPay int64
+	var needProcess int64
+	var needCheck int64     // 初稿待审
+	var needQuality int64   // 链接待审
+	var needCalculate int64 // 待结算
+	var projectInfos []entity.Project
+	//query := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+	if subAccountId == 0 {
+		// 待审核、待支付、达人未处理、初稿待审、链接待审、待结算
+		query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		query1.Where("project_status = ?", 2).Count(&needReview)
+		query2 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		query2.Debug().Where("project_status = ?", 6).Count(&needPay)
+		query3 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		err := query3.Where("project_status = ?", 8).Select("project_id").Find(&projectInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needProcess = 0
+			} else {
+				return resultMap, err
+			}
+		} else if len(projectInfos) > 0 {
+			var projectIDs []string
+			for _, info := range projectInfos {
+				projectIDs = append(projectIDs, info.ProjectId)
+			}
+			if len(projectIDs) > 0 {
+				err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_status = ?", projectIDs, 1).Count(&needProcess).Error // task_status=1待选
+				if err1 != nil {
+					needProcess = 0
+				}
+			}
+		}
+		query4 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		err1 := query4.Select("need_review, need_quality, need_calculate").Find(&projectInfos).Error
+		if err1 != nil {
+			return resultMap, err1
+		} else if len(projectInfos) > 0 {
+			for _, info := range projectInfos {
+				needCheck += info.NeedReview
+				needQuality += info.NeedQuality
+				needCalculate += info.NeedCalculate
+			}
+		}
+	} else {
+		// 待审核、待支付、达人未处理、初稿待审、链接待审、待结算
+		query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		query1.Where("sub_account_id = ? and project_status = ?", subAccountId, 2).Count(&needReview)
+		query2 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		query2.Where("sub_account_id = ? and project_status = ?", subAccountId, 6).Count(&needPay)
+		query3 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		err := query3.Where("sub_account_id = ? and project_status = ?", subAccountId, 8).Select("project_id").Find(&projectInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needProcess = 0
+			} else {
+				return resultMap, err
+			}
+		} else {
+			var projectIDs []string
+			for _, info := range projectInfos {
+				projectIDs = append(projectIDs, info.ProjectId)
+			}
+			if len(projectIDs) > 0 {
+				err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_status = ?", projectIDs, 1).Count(&needProcess).Error // task_status=1待选
+				if err1 != nil {
+					needProcess = 0
+				}
+			}
+		}
+		query4 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		err1 := query4.Select("need_review, need_quality, need_calculate").Find(&projectInfos).Error
+		if err1 != nil {
+			return resultMap, err1
+		} else if len(projectInfos) > 0 {
+			for _, info := range projectInfos {
+				needCheck += info.NeedReview
+				needQuality += info.NeedQuality
+				needCalculate += info.NeedCalculate
+			}
+		}
+	}
+	resultMap["needReview"] = needReview
+	resultMap["needPay"] = needPay
+	resultMap["needProcess"] = needProcess
+	resultMap["needCheck"] = needCheck
+	resultMap["needQuality"] = needQuality
+	resultMap["needCalculate"] = needCalculate
+
+	return resultMap, nil
+}
+
+// 寄样物流任务待办
+func (d ProjectDAO) GetLogisticsToDo(enterpriseId string, subAccountId int64, platform int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var needDelivery int64
+	var needReceive int64
+	var projectInfos []entity.Project
+	//query := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+	if subAccountId == 0 {
+		// 待发货、待签收
+		query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_form = ?", enterpriseId, platform, 1)
+		err := query1.Where("project_status = ?", 8).Select("project_id").Find(&projectInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needDelivery = 0
+				needReceive = 0
+			} else {
+				return resultMap, err
+			}
+		} else if len(projectInfos) > 0 {
+			var projectIDs []string
+			for _, info := range projectInfos {
+				projectIDs = append(projectIDs, info.ProjectId)
+			}
+			if len(projectIDs) > 0 {
+				err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 4).Count(&needDelivery).Error // task_stage=4待发货
+				if err1 != nil {
+					needDelivery = 0
+				}
+				err2 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 5).Count(&needReceive).Error // task_stage=5已发货
+				if err2 != nil {
+					needReceive = 0
+				}
+			}
+		}
+	} else {
+		// 待发货、待签收
+		query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_form = ?", enterpriseId, platform, 1)
+		err := query1.Where("sub_account_id = ? and project_status = ?", subAccountId, 8).Select("project_id").Find(&projectInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needDelivery = 0
+				needReceive = 0
+			} else {
+				return resultMap, err
+			}
+		} else {
+			var projectIDs []string
+			for _, info := range projectInfos {
+				projectIDs = append(projectIDs, info.ProjectId)
+			}
+			if len(projectIDs) > 0 {
+				err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 4).Count(&needDelivery).Error // task_stage=4待发货
+				if err1 != nil {
+					needDelivery = 0
+				}
+				err2 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 5).Count(&needReceive).Error // task_stage=5已发货
+				if err2 != nil {
+					needReceive = 0
+				}
+			}
+		}
+	}
+	resultMap["needDelivery"] = needDelivery
+	resultMap["needReceive"] = needReceive
+
+	return resultMap, nil
+}
+
+// 违约管理任务待办
+func (d ProjectDAO) GetDefaultToDo(enterpriseId string, subAccountId int64, platform int64, taskType int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var noSketch int64      // 未传初稿
+	var noWork int64        // 未发作品
+	var noData int64        // 未传数据
+	var cooperateOver int64 // 终止合作
+	var projectInfos []entity.Project
+	//query := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+	if subAccountId == 0 {
+		// 未传初稿、未发作品、未传数据、终止合作
+		query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		err := query1.Where("project_status >= ?", 8).Select("project_id").Find(&projectInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				noSketch = 0
+				noWork = 0
+				noData = 0
+				cooperateOver = 0
+			} else {
+				return resultMap, err
+			}
+		} else if len(projectInfos) > 0 {
+			var projectIDs []string
+			for _, info := range projectInfos {
+				projectIDs = append(projectIDs, info.ProjectId)
+			}
+			if len(projectIDs) > 0 {
+				err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and cur_default_type = ?", projectIDs, 4).Count(&noSketch).Error // cur_default_type=4 初稿未上传违约
+				if err1 != nil {
+					noSketch = 0
+				}
+				err2 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and cur_default_type = ?", projectIDs, 6).Count(&noWork).Error // cur_default_type=6 链接未上传违约
+				if err2 != nil {
+					noWork = 0
+				}
+				err3 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and cur_default_type = ?", projectIDs, 8).Count(&noData).Error // cur_default_type=8 数据未上传违约
+				if err3 != nil {
+					noData = 0
+				}
+				err4 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and cur_default_type = ?", projectIDs, 10).Count(&cooperateOver).Error // cur_default_type=10 解约
+				if err4 != nil {
+					cooperateOver = 0
+				}
+			}
+		}
+	} else {
+		// 未传初稿、未发作品、未传数据、终止合作
+		query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+		err := query1.Where("sub_account_id = ? and project_status >= ?", subAccountId, 8).Select("project_id").Find(&projectInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				noSketch = 0
+				noWork = 0
+				noData = 0
+				cooperateOver = 0
+			} else {
+				return resultMap, err
+			}
+		} else if len(projectInfos) > 0 {
+			var projectIDs []string
+			for _, info := range projectInfos {
+				projectIDs = append(projectIDs, info.ProjectId)
+			}
+			if len(projectIDs) > 0 {
+				err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and cur_default_type = ?", projectIDs, 4).Count(&noSketch).Error // cur_default_type=4 初稿未上传违约
+				if err1 != nil {
+					noSketch = 0
+				}
+				err2 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and cur_default_type = ?", projectIDs, 6).Count(&noWork).Error // cur_default_type=6 链接未上传违约
+				if err2 != nil {
+					noWork = 0
+				}
+				err3 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and cur_default_type = ?", projectIDs, 8).Count(&noData).Error // cur_default_type=8 数据未上传违约
+				if err3 != nil {
+					noData = 0
+				}
+				err4 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and cur_default_type = ?", projectIDs, 10).Count(&cooperateOver).Error // cur_default_type=10 解约
+				if err4 != nil {
+					cooperateOver = 0
+				}
+			}
+		}
+	}
+	resultMap["noSketch"] = noSketch
+	resultMap["noWork"] = noWork
+	resultMap["noData"] = noData
+	resultMap["cooperateOver"] = cooperateOver
+
+	return resultMap, nil
+}
+
+// 获取指定商家已结案的指定开票状态数据
+func (d ProjectDAO) GetProjectFinished(enterpriseId string, invoiceStatus int64) (float64, error) {
+	var projectAmount float64
+	err := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_status = ? and invoice_status = ?", enterpriseId, 10, invoiceStatus).Select("COALESCE(SUM(settlement_amount), 0)").Find(&projectAmount).Error
+	if err != nil {
+		return 0, err
+	}
+	return projectAmount, err
+}
+
+// 寄样物流任务待办
+func (d ProjectDAO) GetTaskInviteToDo(enterpriseId string, subAccountId int64, platform int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var availInvitationNum int64
+	var invitingNum int64
+	var cooperatingNum int64
+	//var projectInfos []entity.Project
+	////query := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_type = ?", enterpriseId, platform, taskType)
+	//if subAccountId == 0 {
+	//	// 待发货、待签收
+	//	query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_form = ?", enterpriseId, platform, 1)
+	//	err := query1.Where("project_status = ?", 8).Select("project_id").Find(&projectInfos).Error
+	//	if err != nil {
+	//		if errors.Is(err, gorm.ErrRecordNotFound) {
+	//			needDelivery = 0
+	//			needReceive = 0
+	//		} else {
+	//			return resultMap, err
+	//		}
+	//	} else if len(projectInfos) > 0 {
+	//		var projectIDs []string
+	//		for _, info := range projectInfos {
+	//			projectIDs = append(projectIDs, info.ProjectId)
+	//		}
+	//		if len(projectIDs) > 0 {
+	//			err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 4).Count(&needDelivery).Error // task_stage=4待发货
+	//			if err1 != nil {
+	//				needDelivery = 0
+	//			}
+	//			err2 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 5).Count(&needReceive).Error // task_stage=5已发货
+	//			if err2 != nil {
+	//				needReceive = 0
+	//			}
+	//		}
+	//	}
+	//} else {
+	//	// 待发货、待签收
+	//	query1 := Db.Model(&entity.Project{}).Where("enterprise_id = ? and project_platform = ? and project_form = ?", enterpriseId, platform, 1)
+	//	err := query1.Where("sub_account_id = ? and project_status = ?", subAccountId, 8).Select("project_id").Find(&projectInfos).Error
+	//	if err != nil {
+	//		if errors.Is(err, gorm.ErrRecordNotFound) {
+	//			needDelivery = 0
+	//			needReceive = 0
+	//		} else {
+	//			return resultMap, err
+	//		}
+	//	} else {
+	//		var projectIDs []string
+	//		for _, info := range projectInfos {
+	//			projectIDs = append(projectIDs, info.ProjectId)
+	//		}
+	//		if len(projectIDs) > 0 {
+	//			err1 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 4).Count(&needDelivery).Error // task_stage=4待发货
+	//			if err1 != nil {
+	//				needDelivery = 0
+	//			}
+	//			err2 := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id in ? and task_stage = ?", projectIDs, 5).Count(&needReceive).Error // task_stage=5已发货
+	//			if err2 != nil {
+	//				needReceive = 0
+	//			}
+	//		}
+	//	}
+	//}
+	resultMap["availInvitationNum"] = availInvitationNum
+	resultMap["invitingNum"] = invitingNum
+	resultMap["cooperatingNum"] = cooperatingNum
+
+	return resultMap, nil
+}

+ 24 - 7
app/dao/project_task_info_dao.go

@@ -22,10 +22,27 @@ func (d ProjectTaskInfoDao) CountByTaskStage(projectId string, taskStage int64)
 }
 
 // 获取指定任务阶段的种草子任务
-func (d ProjectTaskInfoDao) GetListByTaskStage(projectId string, taskStage int64, time string, page int, pageSize int) ([]*entity.ProjectTaskInfo, int64, error) {
+func (d ProjectTaskInfoDao) GetListByTaskStage(projectId string, taskStage int64, time string, page int, pageSize int, talentNickname string) ([]*entity.ProjectTaskInfo, int64, error) {
 	var taskInfos []*entity.ProjectTaskInfo
 	var total int64
-	query := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND task_stage = ?", projectId, taskStage)
+	query := Db.Model(&entity.ProjectTaskInfo{})
+	if taskStage == 6 {
+		query = query.Where("project_id = ? AND task_stage >= ?", projectId, taskStage)
+	} else {
+		query = query.Where("project_id = ? AND task_stage = ?", projectId, taskStage)
+	}
+	if talentNickname != "" {
+		var talentInfos []entity.PlatformKuaishouUserInfo
+		err1 := Db.Model(&entity.PlatformKuaishouUserInfo{}).Where("nick_name = ?", talentNickname).Find(&talentInfos).Error
+		if err1 != nil {
+			return nil, 0, err1
+		}
+		var openIds []string
+		for _, talentInfo := range talentInfos {
+			openIds = append(openIds, talentInfo.OpenID)
+		}
+		query = query.Where("open_id in ?", openIds)
+	}
 	// 计算偏移量
 	offset := (page - 1) * pageSize
 	var err error
@@ -54,7 +71,7 @@ func (d ProjectTaskInfoDao) GetListBySketchDefault(param *vo.DefaultSearchParam)
 	var total int64
 	query := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND cur_default_type = ?", param.TaskId, 4)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, sketch_missing_time")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, sketch_missing_time, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("sketch_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
 		return nil, 0, err
@@ -68,7 +85,7 @@ func (d ProjectTaskInfoDao) GetListByLinkDefault(param *vo.DefaultSearchParam) (
 	var total int64
 	query := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND cur_default_type = ?", param.TaskId, 6)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, link_missing_time")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, link_missing_time, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("link_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
 		return nil, 0, err
@@ -82,7 +99,7 @@ func (d ProjectTaskInfoDao) GetListByDataDefault(param *vo.DefaultSearchParam) (
 	var total int64
 	query := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND cur_default_type = ?", param.TaskId, 8)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, data_missing_time")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, data_missing_time, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("data_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
 		return nil, 0, err
@@ -96,7 +113,7 @@ func (d ProjectTaskInfoDao) GetListByTerminateDefault(param *vo.DefaultSearchPar
 	var total int64
 	query := Db.Debug().Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND task_stage = ?", param.TaskId, 17)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, terminate_time, terminate_reason, terminate_operator_type, terminate_operator")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, terminate_time, terminate_reason, terminate_operator_type, terminate_operator, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("terminate_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
 		return nil, 0, err
@@ -110,7 +127,7 @@ func (d ProjectTaskInfoDao) GetListByCancelDefault(param *vo.DefaultSearchParam)
 	var total int64
 	query := Db.Debug().Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND task_stage = ?", param.TaskId, 16)
 	query.Count(&total)
-	query = query.Select("task_id, talent_id, settle_amount, draft_fee, cancel_time, cancel_reason, cancel_operator_type, cancel_operator")
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, cancel_time, cancel_reason, cancel_operator_type, cancel_operator, open_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("cancel_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
 		return nil, 0, err

+ 12 - 1
app/dao/recharge_record_dao.go

@@ -20,7 +20,7 @@ func (d RechargeRecordDao) Insert(rechargeRecord *entity.RechargeRecord) error {
 func (d RechargeRecordDao) GetRechargeAmount(enterpriseId string, status int64) (float64, error) {
 	var totalAmount float64
 	query := Db.Debug().Model(&entity.RechargeRecord{})
-	err := query.Where("enterprise_id = ? AND status = ?", enterpriseId, status).Select("SUM(recharge_amount)").Scan(&totalAmount).Error
+	err := query.Where("enterprise_id = ? AND status = ?", enterpriseId, status).Select("COALESCE(SUM(recharge_amount), 0)").Scan(&totalAmount).Error
 	if err != nil {
 		return 0, err
 	}
@@ -50,6 +50,17 @@ func (d RechargeRecordDao) RechargeInfoList(param *vo.RechargeParam) ([]entity.R
 	return rechargeRecords, total, nil
 }
 
+// 获取指定企业id的指定充值状态记录数
+func (d RechargeRecordDao) RechargeStatusCount(enterpriseId string, rechargeState int64) (int64, error) {
+	var total int64
+	query := Db.Debug().Model(&entity.RechargeRecord{}).Where("enterprise_id = ? AND status = ?", enterpriseId, rechargeState)
+	err := query.Count(&total).Error
+	if err != nil {
+		return 0, err
+	}
+	return total, nil
+}
+
 // 更新充值状态
 func (d RechargeRecordDao) UpdateRechargeStatus(rechargeId string, status int64, t time.Time) error {
 	rechargeRecord := entity.RechargeRecord{

+ 87 - 0
app/dao/s_local_life_dao.go

@@ -0,0 +1,87 @@
+package dao
+
+import (
+	"youngee_m_api/app/entity"
+)
+
+type SLocalLifeDao struct{}
+
+// 插入数据
+func (d SLocalLifeDao) Insert(record *entity.SLocalLifeInfo) error {
+	result := Db.Debug().Model(&entity.SLocalLifeInfo{}).Create(&record)
+	return result.Error
+}
+
+// 根据本地生活id、邀约状态返回数据列表
+func (d SLocalLifeDao) GetSLocalLifeByStatus(localId string, status int64, page int, pageSize int) ([]*entity.SLocalLifeInfo, int64, error) {
+	var sLocalLifeInfos []*entity.SLocalLifeInfo
+	var total int64
+	offset := (page - 1) * pageSize
+	query := Db.Debug().Model(&entity.SLocalLifeInfo{}).Where("local_id = ? AND s_local_status = ?", localId, status)
+	query.Count(&total)
+	query = query.Select("supplier_id,  b_operator, b_operator_type")
+	err := query.Order("create_time desc").Offset(offset).Limit(pageSize).Find(&sLocalLifeInfos).Error
+	if err != nil {
+		return nil, 0, err
+	}
+
+	return sLocalLifeInfos, total, nil
+}
+
+// 获取某个 local_id 任务涉及到的服务商
+func (d SLocalLifeDao) GetSLocalLifeByLocalId(localId string) ([]*entity.SLocalLifeInfo, error) {
+	var sLocalLifeInfos []*entity.SLocalLifeInfo
+	err := Db.Debug().Model(&entity.SLocalLifeInfo{}).Where("local_id = ?", localId).Select("s_local_id, local_id, supplier_id, service_charge_settle, supplier_type").Find(&sLocalLifeInfos).Error
+	return sLocalLifeInfos, err
+}
+
+// 更新任务
+func (d SLocalLifeDao) UpdateSLocalLife(sLocalLifeInfo entity.SLocalLifeInfo) error {
+	err := Db.Model(&entity.SLocalLifeInfo{}).Where("s_local_id = ?", sLocalLifeInfo.SLocalID).Updates(sLocalLifeInfo).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+//// 检查给定的服务商是否在该商家库中
+//func (d SupplierDao) EnterpriseDatabaseCheck(enterpriseId string, supplierId int64) (bool, error) {
+//	var count int64
+//	err := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND supplier_id = ? AND cooperate_status != 2", enterpriseId, supplierId).Count(&count).Error
+//	if err != nil {
+//		return false, err
+//	}
+//	return count > 0, nil
+//}
+//
+//// 获取指定商家的服务商库
+//func (d SupplierDao) GetSupplierByEnterprise(enterpriseId string, page int, pageSize int) ([]*entity.EnterpriseSupplierCooperate, int64, error) {
+//	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
+//	var total int64
+//	offset := (page - 1) * pageSize
+//	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 2", enterpriseId)
+//	query.Count(&total)
+//	query = query.Select("supplier_id, cooperate_num, upload_talent_num, cooperate_talent_num, b_operator, b_operator_type, agree_time")
+//	err := query.Order("agree_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error
+//	if err != nil {
+//		return nil, 0, err
+//	}
+//
+//	return enterpriseSupplierCooperates, total, nil
+//}
+//
+//// 获取邀请待确认的服务商
+//func (d SupplierDao) GetSupplierConfirmingList(enterpriseId string, page int, pageSize int) ([]*entity.EnterpriseSupplierCooperate, int64, error) {
+//	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
+//	var total int64
+//	offset := (page - 1) * pageSize
+//	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 1", enterpriseId)
+//	query.Count(&total)
+//	query = query.Select("supplier_id,  b_operator, b_operator_type, cooperate_status, create_time")
+//	err := query.Order("create_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error
+//	if err != nil {
+//		return nil, 0, err
+//	}
+//
+//	return enterpriseSupplierCooperates, total, nil
+//}

+ 51 - 35
app/dao/s_project_dao.go

@@ -28,44 +28,60 @@ func (d SProjectDao) GetSProjectByStatus(projectId string, status int64, page in
 	return sProjectInfos, total, nil
 }
 
-// 检查给定的服务商是否在该商家库中
-func (d SupplierDao) EnterpriseDatabaseCheck(enterpriseId string, supplierId int64) (bool, error) {
-	var count int64
-	err := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND supplier_id = ? AND cooperate_status != 2", enterpriseId, supplierId).Count(&count).Error
-	if err != nil {
-		return false, err
-	}
-	return count > 0, nil
+// 获取某个 project_id 任务涉及到的服务商
+func (d SProjectDao) GetSProjectByProjectId(projectId string) ([]*entity.SProjectInfo, error) {
+	var sProjectInfos []*entity.SProjectInfo
+	err := Db.Debug().Model(&entity.SProjectInfo{}).Where("project_id = ?", projectId).Select("s_project_id, project_id, supplier_id, service_charge_settle, supplier_type").Find(&sProjectInfos).Error
+	return sProjectInfos, err
 }
 
-// 获取指定商家的服务商库
-func (d SupplierDao) GetSupplierByEnterprise(enterpriseId string, page int, pageSize int) ([]*entity.EnterpriseSupplierCooperate, int64, error) {
-	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
-	var total int64
-	offset := (page - 1) * pageSize
-	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 2", enterpriseId)
-	query.Count(&total)
-	query = query.Select("supplier_id, cooperate_num, upload_talent_num, cooperate_talent_num, b_operator, b_operator_type, agree_time")
-	err := query.Order("agree_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error
+// 更新任务
+func (d SProjectDao) UpdateSProject(sProject entity.SProjectInfo) error {
+	err := Db.Model(&entity.SProjectInfo{}).Where("s_project_id = ?", sProject.SProjectID).Updates(sProject).Error
 	if err != nil {
-		return nil, 0, err
+		return err
 	}
-
-	return enterpriseSupplierCooperates, total, nil
+	return nil
 }
 
-// 获取邀请待确认的服务商
-func (d SupplierDao) GetSupplierConfirmingList(enterpriseId string, page int, pageSize int) ([]*entity.EnterpriseSupplierCooperate, int64, error) {
-	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
-	var total int64
-	offset := (page - 1) * pageSize
-	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 1", enterpriseId)
-	query.Count(&total)
-	query = query.Select("supplier_id,  b_operator, b_operator_type, cooperate_status, create_time")
-	err := query.Order("create_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error
-	if err != nil {
-		return nil, 0, err
-	}
-
-	return enterpriseSupplierCooperates, total, nil
-}
+//// 检查给定的服务商是否在该商家库中
+//func (d SupplierDao) EnterpriseDatabaseCheck(enterpriseId string, supplierId int64) (bool, error) {
+//	var count int64
+//	err := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND supplier_id = ? AND cooperate_status != 2", enterpriseId, supplierId).Count(&count).Error
+//	if err != nil {
+//		return false, err
+//	}
+//	return count > 0, nil
+//}
+//
+//// 获取指定商家的服务商库
+//func (d SupplierDao) GetSupplierByEnterprise(enterpriseId string, page int, pageSize int) ([]*entity.EnterpriseSupplierCooperate, int64, error) {
+//	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
+//	var total int64
+//	offset := (page - 1) * pageSize
+//	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 2", enterpriseId)
+//	query.Count(&total)
+//	query = query.Select("supplier_id, cooperate_num, upload_talent_num, cooperate_talent_num, b_operator, b_operator_type, agree_time")
+//	err := query.Order("agree_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error
+//	if err != nil {
+//		return nil, 0, err
+//	}
+//
+//	return enterpriseSupplierCooperates, total, nil
+//}
+//
+//// 获取邀请待确认的服务商
+//func (d SupplierDao) GetSupplierConfirmingList(enterpriseId string, page int, pageSize int) ([]*entity.EnterpriseSupplierCooperate, int64, error) {
+//	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
+//	var total int64
+//	offset := (page - 1) * pageSize
+//	query := Db.Debug().Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 1", enterpriseId)
+//	query.Count(&total)
+//	query = query.Select("supplier_id,  b_operator, b_operator_type, cooperate_status, create_time")
+//	err := query.Order("create_time desc").Offset(offset).Limit(pageSize).Find(&enterpriseSupplierCooperates).Error
+//	if err != nil {
+//		return nil, 0, err
+//	}
+//
+//	return enterpriseSupplierCooperates, total, nil
+//}

+ 9 - 9
app/dao/sec_task_info_dao.go

@@ -4,31 +4,31 @@ import (
 	"youngee_m_api/app/entity"
 )
 
-type SecTaskInfoDao struct{}
+type SelectionTaskInfoDao struct{}
 
-func (s SecTaskInfoDao) CountBySelectionId(selectionId string) (int64, error) {
+func (s SelectionTaskInfoDao) CountBySelectionId(selectionId string) (int64, error) {
 	var count int64
-	err := Db.Model(&entity.SecTaskInfo{}).Where("selection_id = ?", selectionId).Count(&count).Error
+	err := Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id = ?", selectionId).Count(&count).Error
 	return count, err
 }
 
 // 获取带货子任务中指定悬赏阶段的数据
-func (s SecTaskInfoDao) GetRewardDetailByRewardStage(selectionId string, rewardStage int64, order int64, page int, pageSize int) ([]*entity.SecTaskInfo, int64, error) {
-	secTaskInfos := []*entity.SecTaskInfo{}
+func (s SelectionTaskInfoDao) GetRewardDetailByRewardStage(selectionId string, rewardStage int64, order int64, page int, pageSize int) ([]*entity.SelectionTaskInfo, int64, error) {
+	selectionTaskInfos := []*entity.SelectionTaskInfo{}
 	var total int64
-	query := Db.Debug().Model(&entity.SecTaskInfo{}).Where("selection_id = ? AND reward_stage = ?", selectionId, rewardStage)
+	query := Db.Debug().Model(&entity.SelectionTaskInfo{}).Where("selection_id = ? AND reward_stage = ?", selectionId, rewardStage)
 	query.Count(&total)
 	query = query.Select("talent_id, sale_actual, withdraw_date")
 	offset := (page - 1) * pageSize
 	var err error
 	if order == 1 {
-		err = query.Order("withdraw_date asc").Offset(offset).Limit(pageSize).Find(&secTaskInfos).Error
+		err = query.Order("withdraw_date asc").Offset(offset).Limit(pageSize).Find(&selectionTaskInfos).Error
 	} else {
-		err = query.Order("withdraw_date desc").Offset(offset).Limit(pageSize).Find(&secTaskInfos).Error
+		err = query.Order("withdraw_date desc").Offset(offset).Limit(pageSize).Find(&selectionTaskInfos).Error
 	}
 	if err != nil {
 		return nil, 0, err
 	}
 
-	return secTaskInfos, total, nil
+	return selectionTaskInfos, total, nil
 }

+ 170 - 23
app/dao/selection_info_dao.go

@@ -40,7 +40,7 @@ func (d SelectionInfoDAO) GetSelectionInfoListOfDay(enterpriseId string, date ti
 
 // 创建带货任务
 func (d SelectionInfoDAO) CreateSelectionInfo(selectionInfo entity.SelectionInfo) error {
-	err := Db.Omit("submit_at", "pass_at", "pay_at", "finish_at", "auto_fail_at").Create(&selectionInfo).Error
+	err := Db.Omit("submit_at", "pass_at", "pay_at", "finish_at", "auto_fail_at", "fail_at").Create(&selectionInfo).Error
 	if err != nil {
 		return err
 	}
@@ -82,6 +82,8 @@ func (d SelectionInfoDAO) GetSelectionPreviews(param *vo.SelectionSearchParam) (
 	}
 	if param.SelectionStatus != 0 {
 		query = query.Where("selection_status = ?", param.SelectionStatus)
+	} else {
+		query = query.Where("selection_status not in ?", []int{1, 3, 5})
 	}
 	// sample_mode 1、2、3分别表示免费领样(有领样策略)、垫付领样(3.0不用)、不提供样品(无领样策略)
 	if param.FreeFlag == 1 {
@@ -95,14 +97,11 @@ func (d SelectionInfoDAO) GetSelectionPreviews(param *vo.SelectionSearchParam) (
 	} else if param.RewardFlag == 2 {
 		query = query.Where("task_mode = ?", 2)
 	}
-	if param.SelectionId != "" {
-		query = query.Where("selection_id = ?", param.SelectionId)
-	}
-	if param.SelectionName != "" {
-		query = query.Where("selection_name LIKE ?", "%"+param.SelectionName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or selection_id = ? or selection_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, selection_id, platform, selection_status, created_at, task_ddl, sample_num, enroll_num, choose_num, product_id, estimated_cost")
+	query = query.Select("enterprise_id, sub_account_id, selection_id, selection_name, platform, selection_status, created_at, task_ddl, sample_num, enroll_num, choose_num, product_id, estimated_cost")
 	offset := (param.Page - 1) * param.PageSize
 	if param.Order == 1 {
 		if err := query.Order("selection_status desc").Order("task_ddl asc").Offset(offset).Limit(param.PageSize).Find(&selectionInfos).Error; err != nil {
@@ -119,6 +118,7 @@ func (d SelectionInfoDAO) GetSelectionPreviews(param *vo.SelectionSearchParam) (
 			EnterpriseId:      selectionInfo.EnterpriseID,
 			SubAccountId:      selectionInfo.SubAccountId,
 			SelectionId:       selectionInfo.SelectionID,
+			SelectionName:     selectionInfo.SelectionName,
 			SelectionPlatform: selectionInfo.Platform,
 			SelectionStatus:   selectionInfo.SelectionStatus,
 			CreatedAt:         selectionInfo.CreatedAt.Format("2006-01-02 15:04:05"),
@@ -140,7 +140,7 @@ func (d SelectionInfoDAO) DeleteSelection(selectionId string) (*string, error) {
 	if selectionId == "" {
 		return &selectionId, nil
 	}
-	err := Db.Where("selection_id = ?", selectionId).Delete(&entity.SelectionInfo{}).Error
+	err := Db.Model(&entity.SelectionInfo{}).Where("selection_id = ?", selectionId).Delete(&entity.SelectionInfo{}).Error
 	if err != nil {
 		return nil, err
 	}
@@ -165,8 +165,11 @@ func (d SelectionInfoDAO) GetSelectionDraftList(param *vo.SelectionDraftParam) (
 	if param.SelectionPlatform != 0 {
 		query = query.Where("platform = ?", param.SelectionPlatform)
 	}
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or selection_id = ? or selection_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
+	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, selection_id, platform, created_at, product_id")
+	query = query.Select("enterprise_id, sub_account_id, selection_id, selection_name, platform, created_at, product_id")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&selectionInfos).Error; err != nil {
 		return nil, 0, err
@@ -176,6 +179,7 @@ func (d SelectionInfoDAO) GetSelectionDraftList(param *vo.SelectionDraftParam) (
 			EnterpriseId:      selectionInfo.EnterpriseID,
 			SubAccountId:      selectionInfo.SubAccountId,
 			SelectionId:       selectionInfo.SelectionID,
+			SelectionName:     selectionInfo.SelectionName,
 			SelectionPlatform: selectionInfo.Platform,
 			CreatedAt:         selectionInfo.CreatedAt.Format("2006-01-02 15:04:05"),
 			ProductId:         selectionInfo.ProductID,
@@ -235,28 +239,25 @@ func (d SelectionInfoDAO) GetBillSelectionPreviews(param *vo.SelectionSearchPara
 	var total int64
 	query := Db.Model(&entity.SelectionInfo{})
 	// 动态添加查询条件
-	if param.SubAccountId == 0 {
-		if param.EnterpriseId == "" {
-			return reBillSelectionTaskPreviews, 0, errors.New("enterpriseId is empty")
-		}
-		query = query.Where("enterprise_id = ?", param.EnterpriseId)
-	} else {
-		query = query.Where("sub_account_id = ?", param.SubAccountId)
-	}
+	//if param.SubAccountId == 0 {
+	//	if param.EnterpriseId == "" {
+	//		return reBillSelectionTaskPreviews, 0, errors.New("enterpriseId is empty")
+	//	}
+	//	query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	//} else {
+	//	query = query.Where("sub_account_id = ?", param.SubAccountId)
+	//}
 	if param.SelectionPlatform != 0 {
 		query = query.Where("platform = ?", param.SelectionPlatform)
 	}
 	if param.SelectionStatus != 0 {
 		query = query.Where("selection_status = ?", param.SelectionStatus)
 	}
-	if param.SelectionId != "" {
-		query = query.Where("selection_id = ?", param.SelectionId)
-	}
-	if param.SelectionName != "" {
-		query = query.Where("selection_name LIKE ?", "%"+param.SelectionName+"%")
+	if param.Others != "" {
+		query = query.Where("enterprise_id = ? or selection_id = ? or selection_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, selection_id, platform, selection_status, created_at, task_ddl, product_id, settlement_amount")
+	query = query.Select("enterprise_id, sub_account_id, selection_id, selection_name, platform, selection_status, created_at, task_ddl, product_id, settlement_amount")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&selectionInfos).Error; err != nil {
 		return nil, 0, err
@@ -266,6 +267,7 @@ func (d SelectionInfoDAO) GetBillSelectionPreviews(param *vo.SelectionSearchPara
 			EnterpriseId:      selectionInfo.EnterpriseID,
 			SubAccountId:      selectionInfo.SubAccountId,
 			SelectionId:       selectionInfo.SelectionID,
+			SelectionName:     selectionInfo.SelectionName,
 			SelectionPlatform: selectionInfo.Platform,
 			SelectionStatus:   selectionInfo.SelectionStatus,
 			CreatedAt:         selectionInfo.CreatedAt.Format("2006-01-02 15:04:05"),
@@ -278,3 +280,148 @@ func (d SelectionInfoDAO) GetBillSelectionPreviews(param *vo.SelectionSearchPara
 
 	return reBillSelectionTaskPreviews, total, nil
 }
+
+// 电商带货任务待办
+func (d SelectionInfoDAO) GetSelectionToDo(enterpriseId string, subAccountId int64, platform int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var needReview int64
+	var needPay int64
+	var needProcess int64
+	var selectionInfos []entity.SelectionInfo
+	//query := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+	if subAccountId == 0 {
+		// 待审核、待支付、达人未处理
+		query1 := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+		query1.Where("selection_status = ?", 2).Count(&needReview)
+		query2 := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+		query2.Where("selection_status = ?", 4).Count(&needPay)
+		query3 := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+		err := query3.Where("selection_status = ? and sample_mode = ?", 6, 1).Select("selection_id").Find(&selectionInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needProcess = 0
+			} else {
+				return resultMap, err
+			}
+		} else {
+			var selectionIDs []string
+			for _, info := range selectionInfos {
+				selectionIDs = append(selectionIDs, info.SelectionID)
+			}
+			if len(selectionIDs) > 0 {
+				err1 := Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id in ? and task_status = ?", selectionIDs, 1).Count(&needProcess).Error // task_status=1待选
+				if err1 != nil {
+					needProcess = 0
+				}
+			}
+		}
+	} else {
+		// 待审核、待支付、达人未处理
+		query1 := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+		query1.Where("sub_account_id = ? and selection_status = ?", subAccountId, 2).Count(&needReview)
+		query2 := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+		query2.Where("sub_account_id = ? and selection_status = ?", subAccountId, 4).Count(&needPay)
+		query3 := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+		err := query3.Where("sub_account_id = ? and selection_status = ? and sample_mode = ?", subAccountId, 6, 1).Select("selection_id").Find(&selectionInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needProcess = 0
+			} else {
+				return resultMap, err
+			}
+		} else {
+			var selectionIDs []string
+			for _, info := range selectionInfos {
+				selectionIDs = append(selectionIDs, info.SelectionID)
+			}
+			if len(selectionIDs) > 0 {
+				err1 := Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id in ? and task_status = ?", selectionIDs, 1).Count(&needProcess).Error // task_status=1待选
+				if err1 != nil {
+					needProcess = 0
+				}
+			}
+		}
+	}
+	resultMap["needReview"] = needReview
+	resultMap["needPay"] = needPay
+	resultMap["needProcess"] = needProcess
+
+	return resultMap, nil
+}
+
+// 寄样物流任务待办
+func (d SelectionInfoDAO) GetLogisticsToDo(enterpriseId string, subAccountId int64, platform int64) (map[string]int64, error) {
+	resultMap := make(map[string]int64)
+	var needDelivery int64
+	var needReceive int64
+	var selectionInfos []entity.SelectionInfo
+	//query := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+	if subAccountId == 0 {
+		// 待发货、待签收
+		query1 := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+		err := query1.Where("selection_status = ? and sample_mode = ?", 6, 1).Select("selection_id").Find(&selectionInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needDelivery = 0
+				needReceive = 0
+			} else {
+				return resultMap, err
+			}
+		} else {
+			var selectionIDs []string
+			for _, info := range selectionInfos {
+				selectionIDs = append(selectionIDs, info.SelectionID)
+			}
+			if len(selectionIDs) > 0 {
+				err1 := Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id in ? and logistics_status = ?", selectionIDs, 1).Count(&needDelivery).Error // logistics_status=1待发货
+				if err1 != nil {
+					needDelivery = 0
+				}
+				err2 := Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id in ? and logistics_status = ?", selectionIDs, 2).Count(&needReceive).Error // logistics_status=2待签收
+				if err2 != nil {
+					needReceive = 0
+				}
+			}
+		}
+	} else {
+		query1 := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and platform = ?", enterpriseId, platform)
+		err := query1.Where("sub_account_id = ? and selection_status = ? and sample_mode = ?", subAccountId, 6, 1).Select("selection_id").Find(&selectionInfos).Error
+		if err != nil {
+			if errors.Is(err, gorm.ErrRecordNotFound) {
+				needDelivery = 0
+				needReceive = 0
+			} else {
+				return resultMap, err
+			}
+		} else {
+			var selectionIDs []string
+			for _, info := range selectionInfos {
+				selectionIDs = append(selectionIDs, info.SelectionID)
+			}
+			if len(selectionIDs) > 0 {
+				err1 := Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id in ? and logistics_status = ?", selectionIDs, 1).Count(&needDelivery).Error // logistics_status=1待发货
+				if err1 != nil {
+					needDelivery = 0
+				}
+				err2 := Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id in ? and logistics_status = ?", selectionIDs, 2).Count(&needReceive).Error // logistics_status=2待签收
+				if err2 != nil {
+					needReceive = 0
+				}
+			}
+		}
+	}
+	resultMap["needDelivery"] = needDelivery
+	resultMap["needReceive"] = needReceive
+
+	return resultMap, nil
+}
+
+// 获取指定商家已结案的指定开票状态数据
+func (d SelectionInfoDAO) GetSelectionFinished(enterpriseId string, invoiceStatus int64) (float64, error) {
+	var selectionAmount float64
+	err := Db.Model(&entity.SelectionInfo{}).Where("enterprise_id = ? and selection_status = ? and invoice_status = ?", enterpriseId, 8, invoiceStatus).Select("COALESCE(SUM(settlement_amount), 0)").Scan(&selectionAmount).Error
+	if err != nil {
+		return 0, err
+	}
+	return selectionAmount, err
+}

+ 8 - 8
app/dao/sub_account_dao.go

@@ -13,11 +13,11 @@ func (d SubAccountDao) GetSubAccount(subAccountId int64) (*entity.SubAccount, er
 	return &subAccount, nil
 }
 
-//func (d SubAccountDao) GetSubAccountPhone(subAccountId int64) (string, error) {
-//	var phone string
-//	err := Db.Model(&entity.SubAccount{}).Where("sub_account_id = ?", subAccountId).Select("phone").First(&phone).Error
-//	if err != nil {
-//		return "", err
-//	}
-//	return phone, nil
-//}
+func (d SubAccountDao) GetSubAccountPhone(subAccountId int64) (string, error) {
+	var phone string
+	err := Db.Model(&entity.SubAccount{}).Where("sub_account_id = ?", subAccountId).Select("phone").First(&phone).Error
+	if err != nil {
+		return "", err
+	}
+	return phone, nil
+}

+ 13 - 0
app/dao/supplier_income_dao.go

@@ -0,0 +1,13 @@
+package dao
+
+import (
+	"youngee_m_api/app/entity"
+)
+
+type SupplierIncomeDao struct{}
+
+// 创建服务商收入记录
+func (d SupplierIncomeDao) CreateSupplierIncome(supplierIncome entity.SupplierIncome) (int64, error) {
+	err := Db.Create(&supplierIncome).Error
+	return supplierIncome.IncomeID, err
+}

+ 4 - 4
app/dao/talent_info_dao.go

@@ -8,9 +8,9 @@ import (
 
 type TalentInfoDao struct{}
 
-func (d TalentInfoDao) SelectTalentPhone(talentId string) (*string, error) {
-	var talentInfo *entity.YoungeeTalentInfo
-	err := Db.Model(entity.YoungeeTalentInfo{}).Select("talent_phone_number").Where("id = ?", talentId).Find(&talentInfo).Error
+func (d TalentInfoDao) GetTalentPhone(talentId string) (*string, error) {
+	var talentInfo entity.YoungeeTalentInfo
+	err := Db.Model(&entity.YoungeeTalentInfo{}).Select("talent_phone_number").Where("id = ?", talentId).Find(&talentInfo).Error
 	if err != nil {
 		logrus.Errorf("[SelectTalentInfo] error query, err:%+v", err)
 		return nil, err
@@ -18,7 +18,7 @@ func (d TalentInfoDao) SelectTalentPhone(talentId string) (*string, error) {
 	return &talentInfo.TalentPhoneNumber, nil
 }
 
-func (d TalentInfoDao) SelectTalentInfo(talentId string) (*entity.YoungeeTalentInfo, error) {
+func (d TalentInfoDao) GetTalentInfo(talentId string) (*entity.YoungeeTalentInfo, error) {
 	var talentInfo *entity.YoungeeTalentInfo
 	err := Db.Model(&entity.YoungeeTalentInfo{}).Where("id = ?", talentId).Find(&talentInfo).Error
 	if err != nil {

+ 2 - 2
app/entity/book_info.go

@@ -9,8 +9,8 @@ import (
 type BookInfo struct {
 	BookID            int64     `gorm:"column:book_id;primary_key;AUTO_INCREMENT"` // 探店id
 	TaskID            string    `gorm:"column:task_id;NOT NULL"`                   // 任务id
-	Day               time.Time `gorm:"column:day"`                                // 预计到店日期
-	Time              time.Time `gorm:"column:time"`                               // 预计到店时间
+	Day               string    `gorm:"column:day"`                                // 预计到店日期
+	Time              string    `gorm:"column:time"`                               // 预计到店时间
 	ReviseOpinion     string    `gorm:"column:revise_opinion"`                     // 反馈意见
 	IsSubmit          int64     `gorm:"column:is_submit;NOT NULL"`                 // 是否提交
 	IsReview          int64     `gorm:"column:is_review;default:0;NOT NULL"`       // 是否审核

+ 36 - 0
app/entity/data_info.go

@@ -0,0 +1,36 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+import (
+	"time"
+)
+
+type DataInfo struct {
+	DataID            int64     `gorm:"column:data_id;primary_key;AUTO_INCREMENT"` // 脚本id
+	TaskID            string    `gorm:"column:task_id;NOT NULL"`                   // 任务id
+	PlayNumber        int64     `gorm:"column:play_number;NOT NULL"`               // 播放量/阅读量
+	LikeNumber        int64     `gorm:"column:like_number;NOT NULL"`               // 点赞数
+	CommentNumber     int64     `gorm:"column:comment_number;NOT NULL"`            // 评论数
+	CollectNumber     int64     `gorm:"column:collect_number;NOT NULL"`            // 收藏数
+	PhotoUrl          string    `gorm:"column:photo_url;NOT NULL"`                 // 数据截图url
+	ReviseOpinion     string    `gorm:"column:revise_opinion"`                     // 审核意见
+	IsSubmit          int64     `gorm:"column:is_submit;NOT NULL"`                 // 是否提交
+	IsReview          int64     `gorm:"column:is_review;default:0;NOT NULL"`       // 是否审核
+	IsOk              int64     `gorm:"column:is_ok;NOT NULL"`                     // 是否合格
+	CreateAt          time.Time `gorm:"column:create_at;NOT NULL"`                 // 创建时间
+	SubmitAt          time.Time `gorm:"column:submit_at"`                          // 提交时间
+	AgreeAt           time.Time `gorm:"column:agree_at"`                           // 同意时间
+	RejectAt          time.Time `gorm:"column:reject_at"`                          // 驳回时间
+	AutoAgreeAt       time.Time `gorm:"column:auto_agree_at"`                      // 结案自动处理时间
+	AutoDataBreakAt   time.Time `gorm:"column:auto_data_break_at"`                 // 结案违约自动处理时间
+	BOperator         string    `gorm:"column:b_operator"`                         // 操作人id
+	BOperatorType     int64     `gorm:"column:b_operator_type;default:0"`          // 商家操作人类型,1商家用户,2商家子账号,3管理后台
+	ForwardNumber     int64     `gorm:"column:forward_number;default:0;NOT NULL"`
+	DataMissingStatus int64     `gorm:"column:data_missing_status"` // 未传数据违约状态,0无违约,1有违约
+	TalentID          string    `gorm:"column:talent_id;NOT NULL"`
+	TaskType          int64     `gorm:"column:task_type;NOT NULL"` // 任务类型(1种草 2本地生活)
+}
+
+func (m *DataInfo) TableName() string {
+	return "younggee_data_info"
+}

+ 16 - 20
app/entity/info_auto_default.go

@@ -1,26 +1,22 @@
-package entity
-
 // Code generated by sql2gorm. DO NOT EDIT.
+package entity
 
+// 违约扣款配置
 type InfoAutoDefault struct {
-	AutoDefaultID          int64 `gorm:"column:auto_default_id;primary_key;AUTO_INCREMENT"` // 自动处理规则id
-	EnterpriseId           int64 `gorm:"column:enterprise_id"`                              // 企业id
-	SketchReplaceNotUpload int64 `gorm:"column:sketch_replace_not_upload"`                  // 初稿违约 产品置换 未上传初稿
-	SketchReplaceTimeOut   int64 `gorm:"column:sketch_replace_time_out"`                    // 初稿违约 产品置换 超时未上传初稿
-	SketchOtherNotUpload   int64 `gorm:"column:sketch_other_not_upload"`                    // 初稿违约 自报价、固定稿费 未上传初稿
-	SketchOtherTimeOut     int64 `gorm:"column:sketch_other_time_out"`                      // 初稿违约 自报价、固定稿费 超时未上传初稿
-	ScriptReplaceNotUpload int64 `gorm:"column:script_replace_not_upload"`                  // 脚本违约 产品置换 未上传脚本
-	ScriptReplaceTimeOut   int64 `gorm:"column:script_replace_time_out"`                    // 脚本违约 产品置换 超时未上传脚本
-	ScriptOtherNotUpload   int64 `gorm:"column:script_other_not_upload"`                    // 脚本违约 自报价、固定稿费 未上传脚本
-	ScriptOtherTimeOut     int64 `gorm:"column:script_other_time_out"`                      // 脚本违约 自报价、固定稿费 超时未上传脚本
-	LinkReplaceNotUpload   int64 `gorm:"column:link_replace_not_upload"`                    // 链接违约 产品置换 未上传链接
-	LinkReplaceTimeOut     int64 `gorm:"column:link_replace_time_out"`                      // 链接违约 产品置换 超时未上传链接
-	LinkOtherNotUpload     int64 `gorm:"column:link_other_not_upload"`                      // 链接违约 自报价、固定稿费 未上传链接
-	LinkOtherTimeOut       int64 `gorm:"column:link_other_time_out"`                        // 链接违约 自报价、固定稿费 超时未上传链接
-	DataReplaceNotUpload   int64 `gorm:"column:data_replace_not_upload"`                    // 数据违约 产品置换 未上传数据
-	DataReplaceTimeOut     int64 `gorm:"column:data_replace_time_out"`                      // 数据违约 产品置换 超时未上传数据
-	DataOtherNotUpload     int64 `gorm:"column:data_other_not_upload"`                      // 数据违约 自报价、固定稿费 未上传数据
-	DataOtherTimeOut       int64 `gorm:"column:data_other_time_out"`                        // 数据违约 自报价、固定稿费 超时未上传数据
+	AutoDefaultID                int64  `gorm:"column:auto_default_id;primary_key;AUTO_INCREMENT"` // 自动处理规则id
+	EnterpriseID                 string `gorm:"column:enterprise_id;NOT NULL"`                     // 企业id
+	SketchOtherTimeOut           int64  `gorm:"column:sketch_other_time_out;NOT NULL"`             // (初稿违约扣款1)
+	SketchOtherNotUpload         int64  `gorm:"column:sketch_other_not_upload;NOT NULL"`           // (初稿违约扣款2)
+	LinkReplaceTimeOut           int64  `gorm:"column:link_replace_time_out;NOT NULL"`             // (链接质检违约扣款1)
+	LinkReplaceNotUpload         int64  `gorm:"column:link_replace_not_upload;NOT NULL"`           // (链接质检违约扣款2)
+	DataReplaceTimeOut           int64  `gorm:"column:data_replace_time_out;NOT NULL"`             // (数据质检违约扣款1)
+	DataReplaceNotUpload         int64  `gorm:"column:data_replace_not_upload;NOT NULL"`           // (数据质检违约扣款2)
+	SketchOtherTimeOutOperator   string `gorm:"column:sketch_other_time_out_operator;NOT NULL"`    // (初稿违约扣款1)
+	SketchOtherNotUploadOperator string `gorm:"column:sketch_other_not_upload_operator;NOT NULL"`  // (初稿违约扣款2)
+	LinkReplaceTimeOutOperator   string `gorm:"column:link_replace_time_out_operator;NOT NULL"`    // (链接质检违约扣款1)
+	LinkReplaceNotUploadOperator string `gorm:"column:link_replace_not_upload_operator;NOT NULL"`  // (链接质检违约扣款2)
+	DataReplaceTimeOutOperator   string `gorm:"column:data_replace_time_out_operator;NOT NULL"`    // (数据质检违约扣款1)
+	DataReplaceNotUploadOperator string `gorm:"column:data_replace_not_upload_operator;NOT NULL"`  // (数据质检违约扣款2)
 }
 
 func (m *InfoAutoDefault) TableName() string {

+ 35 - 15
app/entity/info_auto_task.go

@@ -1,21 +1,41 @@
+// Code generated by sql2gorm. DO NOT EDIT.
 package entity
 
+// 自动执行、违约规则配置
 type InfoAutoTask struct {
-	AutoTaskID        int64 `gorm:"column:auto_task_id;primary_key;AUTO_INCREMENT"` // 自动处理规则id
-	EnterpriseId      int64 `gorm:"column:enterprise_id"`                           // 企业id
-	SignInOffline     int64 `gorm:"column:sign_in_offline"`                         // 线下探店自动签收时间
-	SignInVirtual     int64 `gorm:"column:sign_in_virtual"`                         // 虚拟产品测评自动签收时间
-	ReviewInMv        int64 `gorm:"column:review_in_mv"`                            // 视频形式的审稿处理
-	ReviewUnlimited   int64 `gorm:"column:review_unlimited"`                        // 不限形式的审稿处理
-	PostReview        int64 `gorm:"column:post_review"`                             // 发布审核自动处理
-	CaseClose         int64 `gorm:"column:case_close"`                              // 结案自动处理
-	Invalid           int64 `gorm:"column:invalid"`                                 // 全流程项目失效自动处理
-	DraftDefaultInPic int64 `gorm:"column:draft_default_in_pic"`                    // 图片初稿违约自动处理
-	DraftDefaultInMv  int64 `gorm:"column:draft_default_in_mv"`                     // 视频初稿违约自动处理
-	ScriptDefault     int64 `gorm:"column:script_default"`                          // 脚本违约自动处理
-	LinkBreach        int64 `gorm:"column:link_breach"`                             // 链接违约自动处理
-	CaseCloseDefault  int64 `gorm:"column:case_close_default"`                      // 结案违约自动处理
-	SelectionInvalid  int64 `gorm:"column:selection_invalid"`                       // 选品项目失效自动处理
+	AutoTaskID                   int64  `gorm:"column:auto_task_id;primary_key;AUTO_INCREMENT"`  // 自动处理规则id
+	EnterpriseID                 string `gorm:"column:enterprise_id;NOT NULL"`                   // 企业id
+	ReviewAuto                   int64  `gorm:"column:review_auto;NOT NULL"`                     // (审稿自动执行)
+	LinkReviewAuto               int64  `gorm:"column:link_review_auto;NOT NULL"`                // (链接质检自动执行)
+	TaskFinishAuto               int64  `gorm:"column:task_finish_auto;NOT NULL"`                // (任务结算自动执行)
+	Invalid                      int64  `gorm:"column:invalid;NOT NULL"`                         // 全流程项目失效自动处理(任务失效自动执行1)
+	SelectionInvalid             int64  `gorm:"column:selection_invalid;NOT NULL"`               // 选品项目失效自动处理(任务失效自动执行2)
+	DraftDefault                 int64  `gorm:"column:draft_default;NOT NULL"`                   // 初稿违约时间(初稿违约1)
+	DraftCooperateProjectDefault int64  `gorm:"column:draft_cooperate_project_default;NOT NULL"` // (初稿违约2)
+	DraftStoreDefault            int64  `gorm:"column:draft_store_default;NOT NULL"`             // (初稿违约3)
+	DraftCooperateLocalDefault   int64  `gorm:"column:draft_cooperate_local_default;NOT NULL"`   // (初稿违约4)
+	LinkBreach                   int64  `gorm:"column:link_breach;NOT NULL"`                     // 链接违约时间(链接质检违约)
+	CaseCloseDefault             int64  `gorm:"column:case_close_default;NOT NULL"`              // 数据违约时间(数据质检违约)
+
+	ReviewAutoOperator                   string `gorm:"column:review_auto_operator;NOT NULL"`                     // (审稿自动执行)
+	LinkReviewAutoOperator               string `gorm:"column:link_review_auto_operator;NOT NULL"`                // (链接质检自动执行)
+	TaskFinishAutoOperator               string `gorm:"column:task_finish_auto_operator;NOT NULL"`                // (任务结算自动执行)
+	InvalidOperator                      string `gorm:"column:invalid_operator;NOT NULL"`                         // 全流程项目失效自动处理(任务失效自动执行1)
+	SelectionInvalidOperator             string `gorm:"column:selection_invalid_operator;NOT NULL"`               // 选品项目失效自动处理(任务失效自动执行2)
+	DraftDefaultOperator                 string `gorm:"column:draft_default_operator;NOT NULL"`                   // 初稿违约时间(初稿违约1)
+	DraftCooperateProjectDefaultOperator string `gorm:"column:draft_cooperate_project_default_operator;NOT NULL"` // (初稿违约2)
+	DraftStoreDefaultOperator            string `gorm:"column:draft_store_default_operator;NOT NULL"`             // (初稿违约3)
+	DraftCooperateLocalDefaultOperator   string `gorm:"column:draft_cooperate_local_default_operator;NOT NULL"`   // (初稿违约4)
+	LinkBreachOperator                   string `gorm:"column:link_breach_operator;NOT NULL"`                     // 链接违约时间(链接质检违约)
+	CaseCloseDefaultOperator             string `gorm:"column:case_close_default_operator;NOT NULL"`              // 数据违约时间(数据质检违约)
+
+	SignInOffline   int64 `gorm:"column:sign_in_offline;NOT NULL"`  // 线下探店自动签收时间
+	SignInVirtual   int64 `gorm:"column:sign_in_virtual;NOT NULL"`  // 虚拟产品测评自动签收时间
+	ReviewInMv      int64 `gorm:"column:review_in_mv;NOT NULL"`     // 视频形式的审稿处理
+	ReviewUnlimited int64 `gorm:"column:review_unlimited;NOT NULL"` // 不限形式的审稿处理
+	PostReview      int64 `gorm:"column:post_review;NOT NULL"`      // 发布审核自动处理
+	CaseClose       int64 `gorm:"column:case_close;NOT NULL"`       // 结案自动处理
+	ScriptDefault   int64 `gorm:"column:script_default;NOT NULL"`   // 脚本违约自动处理
 }
 
 func (m *InfoAutoTask) TableName() string {

+ 37 - 0
app/entity/link_info.go

@@ -0,0 +1,37 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+import (
+	"time"
+)
+
+// 种草任务链接信息
+type LinkInfo struct {
+	LinkID  int64  `gorm:"column:link_id;primary_key;AUTO_INCREMENT"` // 链接id
+	TaskID  string `gorm:"column:task_id;NOT NULL"`                   // 任务id
+	LinkUrl string `gorm:"column:link_url;NOT NULL"`                  // 上传链接url
+
+	PhotoUrl        string    `gorm:"column:photo_url;NOT NULL"`           // 上传截图url
+	ReviseOpinion   string    `gorm:"column:revise_opinion"`               // 审核意见
+	IsSubmit        int64     `gorm:"column:is_submit;NOT NULL"`           // 是否提交
+	IsReview        int64     `gorm:"column:is_review;default:0;NOT NULL"` // 是否审核
+	IsOk            int64     `gorm:"column:is_ok;NOT NULL"`               // 是否合格
+	CreateAt        time.Time `gorm:"column:create_at"`                    // 创建时间
+	SubmitAt        time.Time `gorm:"column:submit_at"`                    // 提交时间
+	AgreeAt         time.Time `gorm:"column:agree_at"`                     // 同意时间
+	RejectAt        time.Time `gorm:"column:reject_at"`                    // 驳回时间
+	AutoAgreeAt     time.Time `gorm:"column:auto_agree_at"`                // 发布审核自动处理时间
+	AutoDataBreakAt time.Time `gorm:"column:auto_data_break_at"`           // 结案违约自动处理时间
+	AutoLinkBreakAt time.Time `gorm:"column:auto_link_break_at"`           // 链接违约自动处理时间
+	BOperator       string    `gorm:"column:b_operator;NOT NULL"`          // 操作人id
+	BOperatorType   int64     `gorm:"column:b_operator_type;default:0"`    // 商家操作人类型,1商家用户,2商家子账号,3管理后台
+	//LinkType          int64       `gorm:"column:link_type;default:0;NOT NULL"` // 1、2分别表示种草和本地生活
+	PlatformID        int64  `gorm:"column:platform_id;NOT NULL"` // 平台id
+	TalentID          string `gorm:"column:talent_id;NOT NULL"`   // 达人id
+	LinkMissingStatus int64  `gorm:"column:link_missing_status"`  // 未发作品违约状态,0无违约,1有违约
+	TaskType          int64  `gorm:"column:task_type;NOT NULL"`   // 任务类型(1种草 2本地生活)
+}
+
+func (m *LinkInfo) TableName() string {
+	return "younggee_link_info"
+}

+ 4 - 1
app/entity/local_life_info.go

@@ -34,6 +34,7 @@ type LocalLifeInfo struct {
 	AutoFailAt          time.Time `gorm:"column:auto_fail_at"`                              // 失效自动处理时间
 	AutoTaskID          int64     `gorm:"column:auto_task_id;default:0;NOT NULL"`           // 定时任务id
 	AutoDefaultID       int64     `gorm:"column:auto_default_id;default:0;NOT NULL"`        // 违约状态id
+	FailAt              time.Time `gorm:"column:fail_at"`                                   // 失效时间
 	FailReason          int64     `gorm:"column:fail_reason"`                               // 失效原因,1、2分别表示逾期未支付、项目存在风险
 	PaymentAmount       float64   `gorm:"column:payment_amount"`                            // 支付金额
 	PayAt               time.Time `gorm:"column:pay_at"`                                    // 支付时间
@@ -41,7 +42,7 @@ type LocalLifeInfo struct {
 	PassAt              time.Time `gorm:"column:pass_at"`                                   // 审核通过时间
 	FinishAt            time.Time `gorm:"column:finish_at"`                                 // 结案时间
 	EstimatedCost       float64   `gorm:"column:estimated_cost"`                            // 预估成本
-	SettlementAmount    float64   `gorm:"column:settlement_amount"`                         // 结算金额
+	SettlementAmount    float64   `gorm:"column:settlement_amount;NOT NULL"`                // 结算金额
 	TotalRecruitNum     int64     `gorm:"column:total_recruit_num"`                         // 此任务各策略招募人数总和
 	Tools               string    `gorm:"column:tools"`                                     // 工具选择,1邀约招募 2结算账单 3样品物流 4审稿工具 5作品审查 6数据巡检(,分隔)
 	NeedReview          int64     `gorm:"column:need_review;default:0;NOT NULL"`            // 待审稿
@@ -52,6 +53,8 @@ type LocalLifeInfo struct {
 	NeedExplore         int64     `gorm:"column:need_explore;NOT NULL"`                     // 待探店
 	ExploredNum         int64     `gorm:"column:explored_num;default:0;NOT NULL"`           // 已探店
 	InvoiceStatus       int64     `gorm:"column:invoice_status;default:0;NOT NULL"`         // 开票状态(1开票中 2已开票)
+	NeedPay             float64   `gorm:"column:need_pay"`                                  // 待支付金额
+	SettleFlag          int64     `gorm:"column:settle_flag"`
 }
 
 func (m *LocalLifeInfo) TableName() string {

+ 9 - 9
app/entity/local_life_task_info.go

@@ -12,13 +12,13 @@ type LocalLifeTaskInfo struct {
 	TalentPlatformInfoSnap string    `gorm:"column:talent_platform_info_snap;NOT NULL"`   // 达人平台信息快照
 	TalentPersonalInfoSnap string    `gorm:"column:talent_personal_info_snap;NOT NULL"`   // 达人个人信息快照
 	TalentPostAddrSnap     string    `gorm:"column:talent_post_addr_snap;NOT NULL"`       // 收货地址快照
-	TaskReward             string    `gorm:"column:task_reward;NOT NULL"`                 // 达人报酬(3.0未用)
-	SettleAmount           string    `gorm:"column:settle_amount;NOT NULL"`               // 达人实际所得(自动填充)(扣除违约扣款)
-	AllPayment             string    `gorm:"column:all_payment;NOT NULL"`                 // 企业支付(3.0未用)
-	RealPayment            string    `gorm:"column:real_payment;NOT NULL"`                // 企业实际支付(加上服务商的服务费)(扣除违约扣款)
+	TaskReward             float64   `gorm:"column:task_reward;NOT NULL"`                 // 达人报酬(3.0未用)
+	SettleAmount           float64   `gorm:"column:settle_amount;NOT NULL"`               // 达人实际所得(自动填充)(扣除违约扣款)
+	AllPayment             float64   `gorm:"column:all_payment;NOT NULL"`                 // 企业支付(3.0未用)
+	RealPayment            float64   `gorm:"column:real_payment;NOT NULL"`                // 企业实际支付(加上服务商的服务费)(扣除违约扣款)
 	ServiceRate            int64     `gorm:"column:service_rate"`                         // 服务费率,千分之
-	ServiceCharge          string    `gorm:"column:service_charge"`                       // 服务费
-	RealServiceCharge      string    `gorm:"column:real_service_charge"`                  // 服务商实际所得服务费(扣除违约)
+	ServiceCharge          float64   `gorm:"column:service_charge"`                       // 服务费
+	RealServiceCharge      float64   `gorm:"column:real_service_charge"`                  // 服务商实际所得服务费(扣除违约)
 	FeeForm                int64     `gorm:"column:fee_form"`                             // 稿费形式,1,2,3分别代表产品置换、一口价、自报价
 	ErrBreakRate           int64     `gorm:"column:err_break_rate;default:0;NOT NULL"`    // 未上传类型违约扣款比例,百分之
 	ScriptBreakRate        int64     `gorm:"column:script_break_rate;default:0;NOT NULL"` // 脚本上传超时违约扣款比例,百分之
@@ -44,12 +44,12 @@ type LocalLifeTaskInfo struct {
 	LeadTeamID             string    `gorm:"column:lead_team_id"`                         // 作为团长的young之团id,对应younggee_talent_team中的team_id字段
 	TeamID                 string    `gorm:"column:team_id"`                              // 作为团员的young之团id,对应younggee_talent_team中的team_id字段
 	SettleStatus           int64     `gorm:"column:settle_status;default:1"`              // 结算状态,1、2分别表示待结算、已结算
-	TeamIncome             string    `gorm:"column:team_income"`                          // young之团团长现金收益
+	TeamIncome             float64   `gorm:"column:team_income"`                          // young之团团长现金收益
 	TeamPoint              int64     `gorm:"column:team_point"`                           // young之团团长积分收益
 	CurBreakAt             time.Time `gorm:"column:cur_break_at"`                         // 当前阶段截止时间
 	SupplierID             int64     `gorm:"column:supplier_id;default:0"`                // 服务商ID
 	SupplierStatus         int64     `gorm:"column:supplier_status;default:0"`            // 服务商任务状态 0表示达人来源非服务商 1待选 2已选 3落选
-	DraftFee               string    `gorm:"column:draft_fee;default:0.00"`               // 达人稿费,达人所见的稿费金额
+	DraftFee               float64   `gorm:"column:draft_fee;default:0.00"`               // 达人稿费,达人所见的稿费金额
 	SignedTime             time.Time `gorm:"column:signed_time"`                          // 签收时间
 	FansNum                int64     `gorm:"column:fans_num"`                             // 粉丝数
 	VoteAvg                int64     `gorm:"column:vote_avg"`                             // 平均点赞数
@@ -60,7 +60,7 @@ type LocalLifeTaskInfo struct {
 	SOperatorType          int64     `gorm:"column:s_operator_type;default:0"`            // 服务商操作人类型,1服务商主账号,2服务商子账号,3管理后台
 	OpenID                 string    `gorm:"column:open_id"`                              // 达人报名的快手唯一标识
 	SProjectID             int64     `gorm:"column:s_project_id"`                         // 服务商种草任务ID
-	SupportFee             string    `gorm:"column:support_fee"`                          // 提报价格(达人自报价经过计算后,)
+	SupportFee             float64   `gorm:"column:support_fee"`                          // 提报价格(达人自报价经过计算后,)
 	SketchMissingTime      time.Time `gorm:"column:sketch_missing_time"`                  // 未传初稿违约时间
 	SketchMissingStatus    int64     `gorm:"column:sketch_missing_status;default:0"`      // 未传初稿违约状态,0无违约,1有违约
 	LinkMissingTime        time.Time `gorm:"column:link_missing_time"`                    // 未发作品违约时间

+ 0 - 31
app/entity/platform_kuaishou_user_info.go

@@ -1,31 +0,0 @@
-// Code generated by sql2gorm. DO NOT EDIT.
-package entity
-
-import (
-	"time"
-)
-
-type PlatformKuaishouUserInfo struct {
-	ID           int64     `gorm:"column:id;primary_key"` // id
-	OpenId       string    `gorm:"column:open_id;NOT NULL"`
-	PlatformId   int64     `gorm:"column:platform_id;NOT NULL"`
-	TalentId     string    `gorm:"column:talent_id;NOT NULL"`
-	Code         string    `gorm:"column:code;NOT NULL"`
-	AccessToken  string    `gorm:"column:access_token;NOT NULL"`
-	RefreshToken string    `gorm:"column:refresh_token;NOT NULL"`
-	NickName     string    `gorm:"column:nick_name;NOT NULL"`
-	HeadUri      string    `gorm:"column:head_uri;NOT NULL"`
-	Fan          string    `gorm:"column:fan;NOT NULL"`
-	Expired      int64     `gorm:"column:expired"`
-	SaleNumTotal int64     `gorm:"column:sale_num_total;NOT NULL"`
-	SaleNum30day int64     `gorm:"column:sale_num_30day;NOT NULL"`
-	CreateTime   time.Time `gorm:"column:create_time;NOT NULL"`
-	UpdateTime   time.Time `gorm:"column:update_time;NOT NULL"`
-	IsDelete     int64     `gorm:"column:is_delete;NOT NULL"`
-	LikeNum      int64     `gorm:"column:like_num;NOT NULL"`
-	VideoNum     int64     `gorm:"column:video_num;NOT NULL"`
-}
-
-func (m *PlatformKuaishouUserInfo) TableName() string {
-	return "platform_kuaishou_user_info"
-}

+ 37 - 0
app/entity/platform_user_info.go

@@ -0,0 +1,37 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+import (
+	"time"
+)
+
+type PlatformKuaishouUserInfo struct {
+	ID                 int64     `gorm:"column:id;primary_key;AUTO_INCREMENT"` // 主键,自增长
+	OpenID             string    `gorm:"column:open_id"`                       // 用户唯一表示
+	PlatformID         int64     `gorm:"column:platform_id"`                   // 1.红book 2。抖音 3。微博 4。快手(电商)5.B站 6.大众点评 7.知乎 8.快手(平台)
+	TalentID           string    `gorm:"column:talent_id"`                     // 达人id
+	Code               string    `gorm:"column:code"`                          // 扫码后获得的临时票据
+	AccessToken        string    `gorm:"column:access_token"`                  // 调用API需要的参数
+	RefreshToken       string    `gorm:"column:refresh_token"`                 // 用于刷新access_token
+	NickName           string    `gorm:"column:nick_name"`                     // 快手昵称
+	HeadUri            string    `gorm:"column:head_uri"`                      // 用户头像
+	Fan                string    `gorm:"column:fan"`                           // 用户粉丝数
+	Expired            int64     `gorm:"column:expired;default:0"`             // access_token是否可用
+	SaleNum30Day       int64     `gorm:"column:sale_num_30day"`                // 30日销量
+	SaleNumTotal       int64     `gorm:"column:sale_num_total"`                // 总销量
+	CreateTime         time.Time `gorm:"column:create_time"`                   // 创建时间
+	UpdateTime         time.Time `gorm:"column:update_time"`                   // 更新时间
+	IsDelete           int64     `gorm:"column:is_delete;default:0"`           // 是否被删除,默认为0,1表示被删除
+	LikeNum            int64     `gorm:"column:like_num;default:0"`            // 点赞数
+	VideoNum           int64     `gorm:"column:video_num;default:0"`           // 作品数
+	SaleNum7Day        string    `gorm:"column:sale_num_7day;default:0"`       // 近7天销量
+	City               string    `gorm:"column:city"`                          // 用户城市所在地
+	Gender             string    `gorm:"column:gender"`                        // 用户性别
+	Skill              string    `gorm:"column:skill"`                         // 擅长领域
+	HomePageCaptureUrl string    `gorm:"column:home_page_capture_url"`         // 用户主页链接截图
+	HomePageUrl        string    `gorm:"column:home_page_url"`                 // 用户主页链接
+}
+
+func (m *PlatformKuaishouUserInfo) TableName() string {
+	return "platform_kuaishou_user_info"
+}

+ 5 - 2
app/entity/project.go

@@ -9,7 +9,7 @@ type Project struct {
 	ID                int64     `gorm:"column:id;primary_key;AUTO_INCREMENT"`  // 种草主键ID
 	ProjectId         string    `gorm:"column:project_id"`                     // 项目id 项目ID生成规则:年(2位)+一年中的第几天(3位)+5位数随机数,雪花算法也可,生成10位订单号
 	ProjectName       string    `gorm:"column:project_name"`                   // 项目名称
-	ProjectStatus     int64     `gorm:"column:project_status"`                 // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	ProjectStatus     int64     `gorm:"column:project_status"`                 // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
 	ProjectType       int64     `gorm:"column:project_type"`                   // 项目类型,1代表全流程项目,2代表专项项目
 	ProjectPlatform   int64     `gorm:"column:project_platform"`               // 项目平台,1-7分别代表红book、抖音、微博、快手、b站、大众点评、知乎
 	ProjectForm       int64     `gorm:"column:project_form"`                   // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
@@ -33,13 +33,14 @@ type Project struct {
 	PayAt             time.Time `gorm:"column:pay_at"`                         // 支付时间
 	AutoScriptBreakAt time.Time `gorm:"column:auto_script_break_at"`           // 脚本违约自动处理时间
 	AutoSketchBreakAt time.Time `gorm:"column:auto_sketch_break_at"`           // 初稿违约自动处理时间
+	FailAt            time.Time `gorm:"column:fail_at"`                        // 失效时间
 	FailReason        int64     `gorm:"column:fail_reason"`                    // 失效原因,1、2分别表示逾期未支付、项目存在风险
 	PassAt            time.Time `gorm:"column:pass_at"`                        // 审核通过时间
 	FinishAt          time.Time `gorm:"column:finish_at"`                      // 结案时间
 	SubmitAt          time.Time `gorm:"column:submit_at"`                      // 结案时间
 	EstimatedCost     float64   `gorm:"column:estimated_cost"`                 // 预估成本
 	IsRead            int64     `gorm:"column:is_read"`                        // 是否已读
-	SettlementAmount  float64   `gorm:"column:settlement_amount"`              // 结算金额
+	SettlementAmount  float64   `gorm:"column:settlement_amount;NOT NULL"`     // 结算金额
 	ProductSnap       string    `gorm:"column:product_snap"`                   // 商品信息快照
 	ProductPhotoSnap  string    `gorm:"column:product_photo_snap"`             // 商品图片快照
 	NeedReview        int64     `gorm:"column:need_review"`                    // 待审稿
@@ -53,6 +54,8 @@ type Project struct {
 	BeforeDeliveryNum int64     `gorm:"column:before_delivery_num"`
 	DeliveryNum       int64     `gorm:"column:delivery_num"`
 	AfterDeliveryNum  int64     `gorm:"column:after_delivery_num"`
+	NeedPay           float64   `gorm:"column:need_pay"` // 待支付金额
+	SettleFlag        int64     `gorm:"column:settle_flag"`
 }
 
 func (m *Project) TableName() string {

+ 24 - 22
app/entity/project_task_info.go

@@ -8,39 +8,39 @@ type ProjectTaskInfo struct {
 	TaskID                 string    `gorm:"column:task_id;primary_key;AUTO_INCREMENT"`   // 任务id
 	ProjectID              string    `gorm:"column:project_id;NOT NULL"`                  // 项目id
 	TalentID               string    `gorm:"column:talent_id;NOT NULL"`                   // 达人id
-	AccountID              int       `gorm:"column:account_id;NOT NULL"`                  // 账号id
+	AccountID              int64     `gorm:"column:account_id;NOT NULL"`                  // 账号id
 	TalentPlatformInfoSnap string    `gorm:"column:talent_platform_info_snap;NOT NULL"`   // 达人平台信息快照
 	TalentPersonalInfoSnap string    `gorm:"column:talent_personal_info_snap;NOT NULL"`   // 达人个人信息快照
 	TalentPostAddrSnap     string    `gorm:"column:talent_post_addr_snap;NOT NULL"`       // 收货地址快照
-	StrategyID             int       `gorm:"column:strategy_id"`                          // 报名选择的招募策略id
+	StrategyID             int64     `gorm:"column:strategy_id"`                          // 报名选择的招募策略id
 	TaskReward             float64   `gorm:"column:task_reward;NOT NULL"`                 // 达人报酬
 	SettleAmount           float64   `gorm:"column:settle_amount;NOT NULL"`               // 达人实际所得(扣除违约扣款)
 	AllPayment             float64   `gorm:"column:all_payment;NOT NULL"`                 // 企业支付
 	RealPayment            float64   `gorm:"column:real_payment;NOT NULL"`                // 企业实际支付(扣除违约扣款)
-	ErrBreakRate           int       `gorm:"column:err_break_rate;default:0;NOT NULL"`    // 未上传类型违约扣款比例,百分之
-	ScriptBreakRate        int       `gorm:"column:script_break_rate;default:0;NOT NULL"` // 脚本上传超时违约扣款比例,百分之
-	SketchBreakRate        int       `gorm:"column:sketch_break_rate;default:0;NOT NULL"` // 初稿上传超时违约扣款比例,百分之
-	LinkBreakRate          int       `gorm:"column:link_break_rate;default:0;NOT NULL"`   // 链接上传超时违约扣款比例,百分之
-	DataBreakRate          int       `gorm:"column:data_break_rate;default:0;NOT NULL"`   // 数据上传超时违约扣款比例,百分之
-	FeeForm                int       `gorm:"column:fee_form;NOT NULL"`                    // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
+	ErrBreakRate           int64     `gorm:"column:err_break_rate;default:0;NOT NULL"`    // 未上传类型违约扣款比例,百分之
+	ScriptBreakRate        int64     `gorm:"column:script_break_rate;default:0;NOT NULL"` // 脚本上传超时违约扣款比例,百分之
+	SketchBreakRate        int64     `gorm:"column:sketch_break_rate;default:0;NOT NULL"` // 初稿上传超时违约扣款比例,百分之
+	LinkBreakRate          int64     `gorm:"column:link_break_rate;default:0;NOT NULL"`   // 链接上传超时违约扣款比例,百分之
+	DataBreakRate          int64     `gorm:"column:data_break_rate;default:0;NOT NULL"`   // 数据上传超时违约扣款比例,百分之
+	FeeForm                int64     `gorm:"column:fee_form;NOT NULL"`                    // 稿费形式,1,2,3分别代表产品置换、固定稿费、自报价
 	ServiceCharge          float64   `gorm:"column:service_charge"`                       // 服务费
-	ServiceRate            int       `gorm:"column:service_rate"`                         // 服务费率,千分之
-	TaskStatus             int       `gorm:"column:task_status;default:1;NOT NULL"`       // 任务状态 1待选 2已选 3落选
-	TaskStage              int       `gorm:"column:task_stage;NOT NULL"`                  // 任务阶段,详情见info_task_stage表
+	ServiceRate            int64     `gorm:"column:service_rate"`                         // 服务费率,千分之
+	TaskStatus             int64     `gorm:"column:task_status;default:1;NOT NULL"`       // 任务状态 1待选 2已选 3落选
+	TaskStage              int64     `gorm:"column:task_stage;NOT NULL"`                  // 任务阶段,详情见info_task_stage表
 	CreateDate             time.Time `gorm:"column:create_date;NOT NULL"`                 // 创建时间
 	SelectDate             time.Time `gorm:"column:select_date"`                          // 反选时间
 	DeliveryDate           time.Time `gorm:"column:delivery_date"`                        // 发货时间
-	CompleteStatus         int       `gorm:"column:complete_status;default:1;NOT NULL"`   // 结束方式 1未结束 2正常结束 3反选失败 4被解约
+	CompleteStatus         int64     `gorm:"column:complete_status;default:1;NOT NULL"`   // 结束方式 1未结束 2正常结束 3反选失败 4被解约
 	CompleteDate           time.Time `gorm:"column:complete_date"`                        // 结束时间
-	LogisticsStatus        int       `gorm:"column:logistics_status;default:1"`           // 发货状态 1 待发货 2已发货 3 已签收
-	ScriptStatus           uint      `gorm:"column:script_status;default:1"`              // 脚本上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
-	SketchStatus           uint      `gorm:"column:sketch_status;default:1"`              // 初稿上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	LogisticsStatus        int64     `gorm:"column:logistics_status;default:1"`           // 发货状态 1 待发货 2已发货 3 已签收
+	ScriptStatus           uint64    `gorm:"column:script_status;default:1"`              // 脚本上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	SketchStatus           uint64    `gorm:"column:sketch_status;default:1"`              // 初稿上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
 	UpdateAt               time.Time `gorm:"column:update_at"`                            // 更新时间
-	LinkStatus             uint      `gorm:"column:link_status;default:1"`                // 链接上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
-	DataStatus             uint      `gorm:"column:data_status;default:1"`                // 数据上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
-	CurDefaultType         int       `gorm:"column:cur_default_type"`                     // 任务当前处于的违约类型 0-8分别表示未违约、脚本超时违约、脚本未上传违约、初稿超时违约、初稿未上传违约、链接超时违约、链接未上传违约、数据超时违约、数据未上传违约
-	WithdrawStatus         int       `gorm:"column:withdraw_status;default:1"`            // 提现状态,1-4分别代表不可提现、可提现、提现中、已提现
-	SettleStatus           int       `gorm:"column:settle_status;default:1"`              // 结算状态,1、2分别表示待结算、已结算
+	LinkStatus             uint64    `gorm:"column:link_status;default:1"`                // 链接上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	DataStatus             uint64    `gorm:"column:data_status;default:1"`                // 数据上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
+	CurDefaultType         int64     `gorm:"column:cur_default_type"`                     // 任务当前处于的违约类型 0-8分别表示未违约、脚本超时违约、脚本未上传违约、初稿超时违约、初稿未上传违约、链接超时违约、链接未上传违约、数据超时违约、数据未上传违约
+	WithdrawStatus         int64     `gorm:"column:withdraw_status;default:1"`            // 提现状态,1-4分别代表不可提现、可提现、提现中、已提现
+	SettleStatus           int64     `gorm:"column:settle_status;default:1"`              // 结算状态,1、2分别表示待结算、已结算
 	DraftFee               float64   `gorm:"column:draft_fee;NOT NULL"`                   // 达人稿费,达人所见的稿费金额
 	SignedTime             time.Time `gorm:"column:signed_time"`                          // 签收时间
 	TerminateTime          time.Time `gorm:"column:terminate_time"`
@@ -50,10 +50,12 @@ type ProjectTaskInfo struct {
 	SketchMissingTime      time.Time `gorm:"column:sketch_missing_time"`
 	LinkMissingTime        time.Time `gorm:"column:link_missing_time"`
 	DataMissingTime        time.Time `gorm:"column:data_missing_time"`
-	TerminateOperatorType  int       `gorm:"column:terminate_operator_type;default:0;NOT NULL"`
+	TerminateOperatorType  int64     `gorm:"column:terminate_operator_type;default:0;NOT NULL"`
 	TerminateOperator      string    `gorm:"column:terminate_operator"`
-	CancelOperatorType     int       `gorm:"column:cancel_operator_type;default:0;NOT NULL"`
+	CancelOperatorType     int64     `gorm:"column:cancel_operator_type;default:0;NOT NULL"`
 	CancelOperator         string    `gorm:"column:cancel_operator"`
+	TalentName             string    `gorm:"column:talent_name"`
+	OpenID                 string    `gorm:"column:open_id"` // 达人报名的唯一标识
 }
 
 func (m *ProjectTaskInfo) TableName() string {

+ 43 - 0
app/entity/s_local_life.go

@@ -0,0 +1,43 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+import (
+	"time"
+)
+
+type SLocalLifeInfo struct {
+	SLocalID            int64     `gorm:"column:s_local_id;primary_key;AUTO_INCREMENT"` // 主键ID
+	LocalID             string    `gorm:"column:local_id"`                              // 被加入商单的原本地生活ID
+	LocalType           int64     `gorm:"column:local_type"`                            // 类型,1代表公开,2代表定向
+	LocalName           string    `gorm:"column:local_name"`                            // 名称
+	LocalPlatform       int64     `gorm:"column:local_platform"`                        // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	StoreID             int64     `gorm:"column:store_id"`                              // 门店ID
+	TeamBuyingID        int64     `gorm:"column:team_buying_id"`                        // 关联团购id
+	TaskForm            int64     `gorm:"column:task_form"`                             // 任务形式,1-2分别代表线下探店,素材分发
+	ContentType         int64     `gorm:"column:content_type"`                          // 内容形式,1代表图文,2代表视频
+	TaskStatus          int64     `gorm:"column:task_status"`                           // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
+	EnterpriseID        string    `gorm:"column:enterprise_id"`                         // 商家ID
+	SupplierID          int64     `gorm:"column:supplier_id"`                           // 服务商ID
+	ApplyNum            int64     `gorm:"column:apply_num"`                             // 报名人数
+	RecruitNum          int64     `gorm:"column:recruit_num"`                           // 已招募人数
+	SettleNum           int64     `gorm:"column:settle_num;default:0"`                  // 已结算人数
+	SubAccountID        int64     `gorm:"column:sub_account_id"`                        // 服务商子账号ID
+	ServiceCharge       float64   `gorm:"column:service_charge"`                        // 服务商预估可赚服务费
+	ServiceChargeActual float64   `gorm:"column:service_charge_actual"`                 // 服务商实际可赚服务费
+	ServiceChargeSettle float64   `gorm:"column:service_charge_settle"`                 // 服务商已结算服务费
+	OperatorType        int64     `gorm:"column:operator_type;default:0"`               // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
+	SLocalStatus        int64     `gorm:"column:s_local_status;default:0"`              // 服务商本地生活任务状态,1待确认,2已确认,3已拒绝
+	StrategyStatus      int64     `gorm:"column:strategy_status;default:2"`             // 定向本地生活任务是否替换招募策略,1是,2否
+	BOperator           string    `gorm:"column:b_operator"`                            // 商家发起入库邀约人
+	BOperatorType       int64     `gorm:"column:b_operator_type"`                       // 商家发起入库邀约人类型:1主账号 2子账号
+	CreateTime          time.Time `gorm:"column:create_time"`                           // 创建时间
+	CreateStrategyID    int64     `gorm:"column:create_strategy_id"`                    // 服务商替换招募策略操作人ID
+	CreateStrategyType  int64     `gorm:"column:create_strategy_type"`                  // 服务商替换招募策略操作人类型:1服务商主账号,2子账号
+	ShareCode           string    `gorm:"column:share_code"`                            // 分享码url
+	FinishTime          time.Time `gorm:"column:finish_time"`                           // 结案时间
+	SupplierType        int64     `gorm:"column:supplier_type"`                         // 服务商类型,1个人,2企业
+}
+
+func (m *SLocalLifeInfo) TableName() string {
+	return "younggee_s_local_life_info"
+}

+ 5 - 3
app/entity/s_project.go

@@ -24,9 +24,9 @@ type SProjectInfo struct {
 	SettleNum           int64     `gorm:"column:settle_num;default:0"`               // 已结算人数
 	QuitNum             int64     `gorm:"column:quit_num;default:0"`                 // 已解约人数
 	SubAccountID        int64     `gorm:"column:sub_account_id;default:0"`           // 服务商子账号ID
-	ServiceCharge       string    `gorm:"column:service_charge;default:0.00"`        // 服务商预估可赚服务费
-	ServiceChargeActual string    `gorm:"column:service_charge_actual;default:0.00"` // 服务商实际可赚服务费
-	ServiceChargeSettle string    `gorm:"column:service_charge_settle"`              // 服务商已结算服务费
+	ServiceCharge       float64   `gorm:"column:service_charge;default:0.00"`        // 服务商预估可赚服务费
+	ServiceChargeActual float64   `gorm:"column:service_charge_actual;default:0.00"` // 服务商实际可赚服务费
+	ServiceChargeSettle float64   `gorm:"column:service_charge_settle"`              // 服务商已结算服务费
 	OperatorType        int64     `gorm:"column:operator_type;default:0"`            // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
 	SProjectStatus      int64     `gorm:"column:s_project_status;default:0"`         // 服务商种草任务状态,1待确认,2已确认,3已拒绝
 	StrategyStatus      int64     `gorm:"column:strategy_status;default:0"`          // 定向种草任务是否替换招募策略
@@ -35,6 +35,8 @@ type SProjectInfo struct {
 	CreateTime          time.Time `gorm:"column:create_time"`                        // 创建时间
 	CreateStrategyID    int64     `gorm:"column:create_strategy_id"`                 // 服务商修改服务费操作人ID
 	CreateStrategyType  int64     `gorm:"column:create_strategy_type"`               // 服务商修改服务费操作人类型:1服务商主账号,2子账号
+	FinishTime          time.Time `gorm:"column:finish_time"`                        // 结案时间
+	SupplierType        int64     `gorm:"column:supplier_type"`                      // 服务商类型,1个人,2企业
 }
 
 func (m *SProjectInfo) TableName() string {

+ 0 - 46
app/entity/sec_task_info.go

@@ -1,46 +0,0 @@
-package entity
-
-// Code generated by sql2gorm. DO NOT EDIT.
-
-import (
-	"time"
-)
-
-type SecTaskInfo struct {
-	ID                     int64     `gorm:"column:id;primary_key"`              // 递增id
-	TaskID                 string    `gorm:"column:task_id"`                     // 选品任务id
-	SelectionID            string    `gorm:"column:selection_id"`                // 选品id
-	TalentID               string    `gorm:"column:talent_id"`                   // 达人id
-	AccountID              int64     `gorm:"column:account_id"`                  // 账号id
-	TalentPlatformInfoSnap string    `gorm:"column:talent_platform_info_snap"`   // 达人平台信息快照
-	TalentPersonalInfoSnap string    `gorm:"column:talent_personal_info_snap"`   // 达人个人信息快照
-	TalentPostAddrSnap     string    `gorm:"column:talent_post_addr_snap"`       // 收货地址快照
-	TaskReward             string    `gorm:"column:task_reward"`                 //  达人赏金
-	TalentPayment          string    `gorm:"column:talent_payment"`              // 达人垫付金额
-	IsPayPayment           int64     `gorm:"column:is_pay_payment"`              // 企业是否返样品钱
-	IsPayReward            int64     `gorm:"column:is_pay_reward"`               // 企业是否结算悬赏
-	TaskMode               int64     `gorm:"column:task_mode"`                   // 任务形式,1、2分别表示纯佣带货、悬赏任务
-	SampleMode             int64     `gorm:"column:sample_mode"`                 // 领样形式,1-3分别表示免费领样、垫付买样、不提供样品
-	TaskStatus             int64     `gorm:"column:task_status;default:1"`       // 任务状态 1待选 2已选 3落选
-	TaskStage              int64     `gorm:"column:task_stage"`                  // 任务阶段,详情见info_sec_task_stage表
-	CreateDate             time.Time `gorm:"column:create_date"`                 // 创建时间
-	SelectDate             time.Time `gorm:"column:select_date"`                 // 反选时间
-	DeliveryDate           time.Time `gorm:"column:delivery_date"`               // 发货时间
-	CompleteDate           time.Time `gorm:"column:complete_date"`               // 结束时间
-	WithdrawDate           time.Time `gorm:"column:withdraw_date"`               // 提现时间
-	CompleteStatus         int64     `gorm:"column:complete_status;default:1"`   // 结束方式 1未结束 2正常结束 3反选失败
-	LogisticsStatus        int64     `gorm:"column:logistics_status;default:1"`  // 发货状态 1 待发货 2已发货 3 已签收
-	AssignmentStatus       uint64    `gorm:"column:assignment_status;default:1"` // 作业上传状态 1-5分别代表待添加、已添加、待修改、已修改、已通过
-	UpdateAt               time.Time `gorm:"column:update_at"`                   // 更新时间
-	WithdrawStatus         int64     `gorm:"column:withdraw_status;default:1"`   // 提现状态,1-4分别代表不可提现、可提现、提现中、已提现
-	LeadTeamID             string    `gorm:"column:lead_team_id"`                // 作为团长的young之团id,对应younggee_talent_team中的team_id字段
-	TeamID                 string    `gorm:"column:team_id"`                     // 作为团员的young之团id,对应younggee_talent_team中的team_id字段
-	TeamIncome             int64     `gorm:"column:team_income"`                 // young之团团长现金收益
-	TeamPoint64            int64     `gorm:"column:team_point64"`                // young之团团长积分收益
-	SaleActual             int64     `gorm:"column:sale_actual"`                 // 实际带货量
-
-}
-
-func (m *SecTaskInfo) TableName() string {
-	return "younggee_sec_task_info"
-}

+ 3 - 1
app/entity/selection_info.go

@@ -28,7 +28,7 @@ type SelectionInfo struct {
 	TaskReward       float64   `gorm:"column:task_reward"`                   // 任务悬赏
 	SampleCondition  string    `gorm:"column:sample_condition"`              // 领样条件
 	RewardCondition  string    `gorm:"column:reward_condition"`              // 返现悬赏条件
-	SettlementAmount float64   `gorm:"column:settlement_amount"`             // 结算金额
+	SettlementAmount float64   `gorm:"column:settlement_amount;NOT NULL"`    // 结算金额
 	Detail           string    `gorm:"column:detail"`                        // 卖点总结
 	ProductSnap      string    `gorm:"column:product_snap"`                  // 商品信息快照
 	ProductPhotoSnap string    `gorm:"column:product_photo_snap"`            // 商品图片快照
@@ -36,6 +36,7 @@ type SelectionInfo struct {
 	UpdatedAt        time.Time `gorm:"column:updated_at"`                    // 修改时间
 	SubmitAt         time.Time `gorm:"column:submit_at"`                     // 提交审核时间
 	PassAt           time.Time `gorm:"column:pass_at"`                       // 审核通过时间
+	FailAt           time.Time `gorm:"column:fail_at"`                       // 失效时间
 	FailReason       int64     `gorm:"column:fail_reason"`                   // 失效原因,1、2分别表示逾期未支付、项目存在风险
 	PayAt            time.Time `gorm:"column:pay_at"`                        // 支付时间
 	FinishAt         time.Time `gorm:"column:finish_at"`                     // 结案时间
@@ -46,6 +47,7 @@ type SelectionInfo struct {
 	EnrollNum        int64     `gorm:"column:enroll_num"`                    // 报名数量
 	ChooseNum        int64     `gorm:"column:choose_num"`                    // 已选数量
 	InvoiceStatus    int64     `gorm:"column:invoice_status"`                // 开票状态(1开票中 2已开票)
+	SettleFlag       int64     `gorm:"column:settle_flag"`
 }
 
 func (m *SelectionInfo) TableName() string {

+ 2 - 0
app/entity/selection_task_info.go

@@ -37,6 +37,8 @@ type SelectionTaskInfo struct {
 	TeamID                 string    `gorm:"column:team_id"`                     // 作为团员的young之团id,对应younggee_talent_team中的team_id字段
 	TeamIncome             int       `gorm:"column:team_income"`                 // young之团团长现金收益
 	TeamPoint              int       `gorm:"column:team_point"`                  // young之团团长积分收益
+	SaleActual             int64     `gorm:"column:sale_actual"`                 // 实际带货量
+	OpenID                 string    `gorm:"column:open_id"`                     // 达人报名的快手唯一标识
 }
 
 func (m *SelectionTaskInfo) TableName() string {

+ 36 - 0
app/entity/sketch_info.go

@@ -0,0 +1,36 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+import (
+	"time"
+)
+
+// 种草任务初稿信息
+type SketchInfo struct {
+	SketchID          int64     `gorm:"column:sketch_id;primary_key;AUTO_INCREMENT"` // 初稿id
+	TaskID            string    `gorm:"column:task_id;NOT NULL"`                     // 任务id
+	Title             string    `gorm:"column:title"`                                // 标题
+	Type              int64     `gorm:"column:type"`                                 // 初稿形式,1为图片,2为视频
+	Content           string    `gorm:"column:content"`                              // 正文
+	ReviseOpinion     string    `gorm:"column:revise_opinion"`                       // 反馈意见
+	IsSubmit          int64     `gorm:"column:is_submit;NOT NULL"`                   // 是否提交
+	IsReview          int64     `gorm:"column:is_review;default:0;NOT NULL"`         // 是否审核
+	IsOk              int64     `gorm:"column:is_ok;NOT NULL"`                       // 是否合格(0,不合格,1合格
+	CreateAt          time.Time `gorm:"column:create_at;NOT NULL"`                   // 创建时间
+	AgreeAt           time.Time `gorm:"column:agree_at"`                             // 同意时间
+	RejectAt          time.Time `gorm:"column:reject_at"`                            // 驳回时间
+	SubmitAt          time.Time `gorm:"column:submit_at"`                            // 提交时间
+	AutoAgreeAt       time.Time `gorm:"column:auto_agree_at"`                        // 初稿自动审核时间
+	AutoLinkBreakAt   time.Time `gorm:"column:auto_link_break_at"`                   // 链接违约自动处理时间
+	AutoSketchBreakAt time.Time `gorm:"column:auto_sketch_break_at"`                 // 初稿违约自动处理时间
+	BOperator         string    `gorm:"column:b_operator"`                           // 商家确定达人操作人ID
+
+	BOperatorType       int64  `gorm:"column:b_operator_type;default:0"` // 商家操作人类型,1商家用户,2商家子账号,3管理后台
+	TalentID            string `gorm:"column:talent_id;NOT NULL"`
+	SketchMissingStatus int64  `gorm:"column:sketch_missing_status"` // 未传初稿违约状态,0无违约,1有违约
+	TaskType            int64  `gorm:"column:task_type;NOT NULL"`    // 任务类型(1种草 2本地生活)
+}
+
+func (m *SketchInfo) TableName() string {
+	return "younggee_sketch_info"
+}

+ 18 - 0
app/entity/supplier_income.go

@@ -0,0 +1,18 @@
+package entity
+
+// Code generated by sql2gorm. DO NOT EDIT.
+
+type SupplierIncome struct {
+	IncomeID            int64   `gorm:"column:income_id;primary_key;AUTO_INCREMENT"` // 服务商收入表ID
+	SupplierID          int64   `gorm:"column:supplier_id"`                          // 服务商ID
+	SupplierType        int64   `gorm:"column:supplier_type"`                        // 服务商用户类型,1为个人PR,2为机构
+	SProjectID          int64   `gorm:"column:s_project_id"`                         // 服务商加入商单后的种草任务ID
+	SLocalLifeID        int64   `gorm:"column:s_local_life_id"`                      // 服务商加入商单后的本地生活ID
+	IncomeType          int64   `gorm:"column:income_type"`                          // 服务商收入类型,1种草,2带货,3本地生活
+	IncomeStatus        int64   `gorm:"column:income_status;default:1"`              // 收入状态:1可回发票,2待传发票,3平台确认中,4平台已确认,5可提现,6提现中,7平台确认中,8已提现(个人服务商>=5;企业服务商>=1)
+	ServiceChargeSettle float64 `gorm:"column:service_charge_settle"`                // 服务费已结算
+}
+
+func (m *SupplierIncome) TableName() string {
+	return "younggee_supplier_income"
+}

+ 18 - 0
app/entity/talent_delivery_address.go

@@ -0,0 +1,18 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+// 达人地址(物流)
+type TalentDeliveryAddress struct {
+	AddressID    int64  `gorm:"column:address_id;primary_key;AUTO_INCREMENT"`
+	TalentID     string `gorm:"column:talent_id"`                      // 达人id(youngee_talent_info表中的id)
+	RegionCode   int    `gorm:"column:region_code"`                    // 区域码,取info_region表中的self_code字段值
+	DetailAddr   string `gorm:"column:detail_addr"`                    // 详细地址
+	PhoneNumber  string `gorm:"column:phone_number"`                   // 联系电话
+	ReceiverName string `gorm:"column:receiver_name"`                  // 收货人名字
+	DefaultTag   int    `gorm:"column:default_tag;default:1;NOT NULL"` // 是否默认收货地址
+	DoorNum      string `gorm:"column:door_num"`                       // 门牌号
+}
+
+func (m *TalentDeliveryAddress) TableName() string {
+	return "youngee_talent_delivery_address"
+}

+ 158 - 0
app/schedule/auto_task_execute.go

@@ -0,0 +1,158 @@
+package schedule
+
+import (
+	"github.com/robfig/cron/v3"
+	"log"
+	"time"
+	"youngee_m_api/app/dao"
+	"youngee_m_api/app/entity"
+)
+
+func AutoTaskExecute() error {
+	// 新建一个定时任务对象
+	crontab := cron.New(cron.WithSeconds()) // 精确到秒
+	spec := "0 */10 * * * ?"                //cron表达式,每10分钟一次
+
+	// 添加定时任务
+	// 定时任务1  初稿未审稿自动执行
+	_, err1 := crontab.AddFunc(spec, AutoSketchExecuteTask)
+	if err1 != nil {
+		return err1
+	}
+	// 定时任务2  链接未质检自动执行
+	_, err2 := crontab.AddFunc(spec, AutoLinkExecuteTask)
+	if err2 != nil {
+		return err2
+	}
+	// 定时任务3  数据未质检自动执行
+	_, err3 := crontab.AddFunc(spec, AutoDataExecuteTask)
+	if err3 != nil {
+		return err3
+	}
+
+	// 启动定时器
+	crontab.Start()
+	// 定时任务是另起协程执行的,这里使用 select 简单阻塞.需要根据实际情况进行控制
+	//select {} //阻塞主线程停止
+	return nil
+}
+
+// 定时任务1  初稿未审稿自动执行
+func AutoSketchExecuteTask() {
+	log.Println("AutoSketchExecuteTask running Start, Time :", time.Now())
+	var sketchInfos []*entity.SketchInfo
+	err := dao.Db.Model(&entity.SketchInfo{}).Where("is_review = ? and is_ok = ?", 0, 0).Select("sketch_id, task_id, auto_agree_at, task_type").Find(&sketchInfos).Error
+	if err != nil {
+		log.Println(err.Error())
+		return
+	}
+	var sketchIds []int64
+	var projectTaskIds []string
+	var localTaskIds []string
+	for _, sketchInfo := range sketchInfos {
+		sketchId := sketchInfo.SketchID
+		if time.Now().After(sketchInfo.AutoAgreeAt) {
+			sketchIds = append(sketchIds, sketchId)
+			if sketchInfo.TaskType == 1 {
+				projectTaskIds = append(projectTaskIds, sketchInfo.TaskID)
+			} else if sketchInfo.TaskType == 2 {
+				localTaskIds = append(localTaskIds, sketchInfo.TaskID)
+			}
+		}
+	}
+	dao.Db.Model(&entity.SketchInfo{}).Where("sketch_id in ?", sketchIds).Updates(&entity.SketchInfo{
+		IsReview:      1,
+		IsOk:          1,
+		AgreeAt:       time.Now(),
+		BOperatorType: 1,
+	})
+	dao.Db.Model(&entity.ProjectTaskInfo{}).Where("task_id in ?", projectTaskIds).Updates(&entity.ProjectTaskInfo{
+		TaskStage:    11,
+		SketchStatus: 5,
+	})
+	dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("task_id in ?", localTaskIds).Updates(&entity.LocalLifeTaskInfo{
+		TaskStage:    11,
+		SketchStatus: 5,
+	})
+	log.Println("AutoSketchExecuteTask running End, Time :", time.Now())
+}
+
+// 定时任务2  链接未质检自动执行
+func AutoLinkExecuteTask() {
+	log.Println("AutoLinkExecuteTask running Start, Time :", time.Now())
+	var LinInfos []*entity.LinkInfo
+	err := dao.Db.Model(&entity.LinkInfo{}).Where("is_review = ? and is_ok = ?", 0, 0).Select("link_id, task_id, auto_agree_at, task_type").Find(&LinInfos).Error
+	if err != nil {
+		log.Println(err.Error())
+		return
+	}
+	var linkIds []int64
+	var projectTaskIds []string
+	var localTaskIds []string
+	for _, LinInfo := range LinInfos {
+		linkId := LinInfo.LinkID
+		if time.Now().After(LinInfo.AutoAgreeAt) {
+			linkIds = append(linkIds, linkId)
+			if LinInfo.TaskType == 1 {
+				projectTaskIds = append(projectTaskIds, LinInfo.TaskID)
+			} else if LinInfo.TaskType == 2 {
+				localTaskIds = append(localTaskIds, LinInfo.TaskID)
+			}
+		}
+	}
+	dao.Db.Model(&entity.LinkInfo{}).Where("link_id in ?", linkIds).Updates(&entity.LinkInfo{
+		IsReview:      1,
+		IsOk:          1,
+		AgreeAt:       time.Now(),
+		BOperatorType: 1,
+	})
+	dao.Db.Model(&entity.ProjectTaskInfo{}).Where("task_id in ?", projectTaskIds).Updates(&entity.ProjectTaskInfo{
+		TaskStage:  13,
+		LinkStatus: 5,
+	})
+	dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("task_id in ?", localTaskIds).Updates(&entity.LocalLifeTaskInfo{
+		TaskStage:  13,
+		LinkStatus: 5,
+	})
+	log.Println("AutoLinkExecuteTask running End, Time :", time.Now())
+}
+
+// 定时任务3  数据未质检自动执行
+func AutoDataExecuteTask() {
+	log.Println("AutoDataExecuteTask running Start, Time :", time.Now())
+	var dataInfos []*entity.DataInfo
+	err := dao.Db.Model(&entity.DataInfo{}).Where("is_review = ? and is_ok = ?", 0, 0).Select("data_id, task_id, auto_agree_at, task_type").Find(&dataInfos).Error
+	if err != nil {
+		log.Println(err.Error())
+		return
+	}
+	var dataIds []int64
+	var projectTaskIds []string
+	var localTaskIds []string
+	for _, dataInfo := range dataInfos {
+		dataId := dataInfo.DataID
+		if time.Now().After(dataInfo.AutoAgreeAt) {
+			dataIds = append(dataIds, dataId)
+			if dataInfo.TaskType == 1 {
+				projectTaskIds = append(projectTaskIds, dataInfo.TaskID)
+			} else if dataInfo.TaskType == 2 {
+				localTaskIds = append(localTaskIds, dataInfo.TaskID)
+			}
+		}
+	}
+	dao.Db.Model(&entity.DataInfo{}).Where("data_id in ?", dataIds).Updates(&entity.DataInfo{
+		IsReview:      1,
+		IsOk:          1,
+		AgreeAt:       time.Now(),
+		BOperatorType: 1,
+	})
+	dao.Db.Model(&entity.ProjectTaskInfo{}).Where("task_id in ?", projectTaskIds).Updates(&entity.ProjectTaskInfo{
+		TaskStage:  15,
+		DataStatus: 5,
+	})
+	dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("task_id in ?", localTaskIds).Updates(&entity.LocalLifeTaskInfo{
+		TaskStage:  15,
+		DataStatus: 5,
+	})
+	log.Println("AutoDataExecuteTask running End, Time :", time.Now())
+}

+ 75 - 43
app/schedule/auto_task_invalid.go

@@ -18,7 +18,7 @@ func AutoTaskInvalid() error {
 
 	// 添加定时任务
 	// 定时任务1  品牌种草失效自动处理
-	_, err1 := crontab.AddFunc(spec, AutoSelectionInvalidTask)
+	_, err1 := crontab.AddFunc(spec, AutoProjectInvalidTask)
 	if err1 != nil {
 		return err1
 	}
@@ -44,30 +44,47 @@ func AutoTaskInvalid() error {
 func AutoProjectInvalidTask() {
 	log.Println("AutoProjectInvalidTask running Start, Time :", time.Now())
 	var projectInfos []*entity.Project
-	projectInfos, _ = dao.ProjectDAO{}.GetProjectList(6, "project_status")
+	_ = dao.Db.Model(entity.Project{}).Where("project_status <= ?", 6).Select("project_id,project_status,recruit_ddl,auto_task_id,auto_fail_at").Find(&projectInfos).Error
 	// 对于所有未支付的品牌种草项目进行处理
 	for _, projectInfo := range projectInfos {
 		projectId := projectInfo.ProjectId
+		if time.Now().After(projectInfo.RecruitDdl) && projectInfo.ProjectStatus < 4 {
+			// 变成失效
+			_ = dao.ProjectDAO{}.UpdateProject(entity.Project{
+				ProjectId:     projectId,
+				ProjectStatus: 9,
+				FailReason:    1,
+				FailAt:        time.Now(),
+			})
+			continue
+		}
+		if projectInfo.ProjectStatus == 4 && time.Now().After(projectInfo.RecruitDdl) {
+			// 变成待支付
+			_ = dao.ProjectDAO{}.UpdateProject(entity.Project{
+				ProjectId:     projectId,
+				ProjectStatus: 6,
+			})
+			continue
+		}
 		autoTaskId := projectInfo.AutoTaskID
 		autoTaskInfo := dao.InfoAutoTaskDao{}.GetValueByIdFieldName(autoTaskId, "invalid")
 		dd, _ := time.ParseDuration(conv.MustString(autoTaskInfo.Invalid, "") + "h")
 		// 失效时间计算:任务截止时间 + 设置的失效自动执行时间
-		timeInvalid := projectInfo.RecruitDdl.Add(dd)
 		if projectInfo.AutoFailAt.IsZero() {
+			timeInvalid := projectInfo.RecruitDdl.Add(dd)
 			dao.Db.Model(&entity.Project{}).Where("project_id = ?", projectId).Updates(&entity.Project{AutoFailAt: timeInvalid})
+			projectInfo.AutoFailAt = timeInvalid
 		}
-		projectNeedMod := entity.Project{}
-		dao.Db.Where("project_id = ?", projectId).First(&projectNeedMod)
-		//fmt.Println(fmt.Sprintf("品牌种草项目 %s 失效自动处理时间为:%s", projectId, projectNeedMod.AutoFailAt))
-		// 如果失效自动处理的时间不为空
-		if !projectNeedMod.AutoFailAt.IsZero() {
-			timeNow := time.Now()
-			// 如果 未失效 && 已经过了失效自动处理的时间
-			if projectNeedMod.ProjectStatus < 9 && projectNeedMod.AutoFailAt.Sub(time.Now()) <= 0 {
-				dao.Db.Model(entity.Project{}).Where("project_id = ?", projectId).Updates(&entity.Project{ProjectStatus: 9, FinishAt: timeInvalid, FailReason: 1})
-				fmt.Println(fmt.Sprintf("已更新品牌种草项目 %s 状态为超时未支付的失效状态", projectId))
-				dao.Db.Model(entity.ProjectTaskInfo{}).Where("project_id = ?", projectId).Updates(entity.ProjectTaskInfo{TaskStage: 3, CompleteStatus: 3, CompleteDate: timeNow})
-			}
+		// 超时未支付则变为失效
+		if time.Now().After(projectInfo.AutoFailAt) && projectInfo.ProjectStatus == 6 {
+			_ = dao.ProjectDAO{}.UpdateProject(entity.Project{
+				ProjectId:     projectId,
+				ProjectStatus: 9,
+				FailReason:    1,
+				FailAt:        time.Now(),
+			})
+			fmt.Println(fmt.Sprintf("已更新品牌种草项目 %s 状态为超时未支付的失效状态", projectId))
+			dao.Db.Model(entity.ProjectTaskInfo{}).Where("project_id = ?", projectId).Updates(entity.ProjectTaskInfo{TaskStage: 3, CompleteStatus: 3, CompleteDate: time.Now()})
 		}
 	}
 	log.Println("AutoProjectInvalidTask running End, Time :", time.Now())
@@ -84,23 +101,21 @@ func AutoSelectionInvalidTask() {
 		autoTaskId := selectionInfo.AutoTaskID
 		autoTaskInfo := dao.InfoAutoTaskDao{}.GetValueByIdFieldName(autoTaskId, "selection_invalid")
 		dd, _ := time.ParseDuration(conv.MustString(autoTaskInfo.SelectionInvalid, "") + "h")
-		// 失效时间计算:任务截止时间 + 设置的失效自动执行时间
-		timeInvalid := selectionInfo.PassAt.Add(dd)
 		if selectionInfo.AutoFailAt.IsZero() {
+			timeInvalid := selectionInfo.PassAt.Add(dd)
 			dao.Db.Model(&entity.SelectionInfo{}).Where("selection_id = ?", selectionId).Updates(&entity.SelectionInfo{AutoFailAt: timeInvalid})
+			selectionInfo.AutoFailAt = timeInvalid
 		}
-		selectionInfoNeedMod := entity.SelectionInfo{}
-		dao.Db.Where("selection_id = ?", selectionId).First(&selectionInfoNeedMod)
-		//fmt.Println(fmt.Sprintf("电商带货项目 %s 失效自动处理时间为:%s", selectionId, selectionInfoNeedMod.AutoFailAt))
-		// 如果失效自动处理的时间不为空
-		if !selectionInfoNeedMod.AutoFailAt.IsZero() {
-			timeNow := time.Now()
-			// 如果 未失效 && 已经过了失效自动处理的时间
-			if selectionInfoNeedMod.SelectionStatus < 5 && selectionInfoNeedMod.AutoFailAt.Sub(time.Now()) <= 0 {
-				dao.Db.Model(entity.SelectionInfo{}).Where("selection_id = ?", selectionId).Updates(&entity.SelectionInfo{SelectionStatus: 7, FinishAt: timeInvalid, FailReason: 1})
-				fmt.Println(fmt.Sprintf("已更新电商带货项目 %s 状态为超时未支付的失效状态", selectionId))
-				dao.Db.Model(entity.SelectionInfo{}).Where("selection_id = ?", selectionId).Updates(entity.SelectionTaskInfo{TaskStage: 3, CompleteStatus: 3, CompleteDate: timeNow})
-			}
+		// 超时未支付则变为失效
+		if time.Now().After(selectionInfo.AutoFailAt) && selectionInfo.SelectionStatus == 4 {
+			_ = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{
+				SelectionID:     selectionId,
+				SelectionStatus: 7,
+				FailReason:      1,
+				FailAt:          time.Now(),
+			})
+			fmt.Println(fmt.Sprintf("已更新电商带货项目 %s 状态为超时未支付的失效状态", selectionId))
+			dao.Db.Model(entity.SelectionInfo{}).Where("selection_id = ?", selectionId).Updates(entity.SelectionTaskInfo{TaskStage: 3, CompleteStatus: 3, CompleteDate: time.Now()})
 		}
 	}
 	log.Println("AutoSelectionInvalidTask running End, Time :", time.Now())
@@ -110,30 +125,47 @@ func AutoSelectionInvalidTask() {
 func AutoLocalLifeInvalidTask() {
 	log.Println("AutoLocalLifeInvalidTask running Start, Time :", time.Now())
 	var localLifeInfos []*entity.LocalLifeInfo
-	localLifeInfos, _ = dao.LocalLifeDao{}.GetLocalLifeList(6, "task_status")
+	_ = dao.Db.Model(entity.LocalLifeInfo{}).Where("task_status <= ?", 6).Select("local_id,task_status,recruit_ddl,auto_task_id,auto_fail_at").Find(&localLifeInfos).Error
 	// 对于所有未支付的本地生活项目进行处理
 	for _, localLifeInfo := range localLifeInfos {
 		localId := localLifeInfo.LocalID
+		if time.Now().After(localLifeInfo.RecruitDdl) && localLifeInfo.TaskStatus < 4 {
+			// 变成失效
+			_ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
+				LocalID:    localId,
+				TaskStatus: 9,
+				FailReason: 1,
+				FailAt:     time.Now(),
+			})
+			continue
+		}
+		if time.Now().After(localLifeInfo.RecruitDdl) && localLifeInfo.TaskStatus == 4 {
+			// 变成待支付
+			_ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
+				LocalID:    localId,
+				TaskStatus: 6,
+			})
+			continue
+		}
 		autoTaskId := localLifeInfo.AutoTaskID
 		autoTaskInfo := dao.InfoAutoTaskDao{}.GetValueByIdFieldName(autoTaskId, "invalid")
 		dd, _ := time.ParseDuration(conv.MustString(autoTaskInfo.Invalid, "") + "h")
 		// 失效时间计算:任务截止时间 + 设置的失效自动执行时间
-		timeInvalid := localLifeInfo.RecruitDdl.Add(dd)
 		if localLifeInfo.AutoFailAt.IsZero() {
+			timeInvalid := localLifeInfo.RecruitDdl.Add(dd)
 			dao.Db.Model(&entity.LocalLifeInfo{}).Where("local_id = ?", localId).Updates(&entity.LocalLifeInfo{AutoFailAt: timeInvalid})
+			localLifeInfo.AutoFailAt = timeInvalid
 		}
-		localLifeNeedMod := entity.LocalLifeInfo{}
-		dao.Db.Where("local_id = ?", localId).First(&localLifeNeedMod)
-		//fmt.Println(fmt.Sprintf("本地生活项目 %s 失效自动处理时间为:%s", localId, localLifeNeedMod.AutoFailAt))
-		// 如果失效自动处理的时间不为空
-		if !localLifeNeedMod.AutoFailAt.IsZero() {
-			timeNow := time.Now()
-			// 如果 未失效 && 已经过了失效自动处理的时间
-			if localLifeNeedMod.TaskStatus < 9 && localLifeNeedMod.AutoFailAt.Sub(time.Now()) <= 0 {
-				dao.Db.Model(entity.LocalLifeInfo{}).Where("local_id = ?", localId).Updates(&entity.LocalLifeInfo{TaskStatus: 9, FinishAt: timeInvalid, FailReason: 1})
-				fmt.Println(fmt.Sprintf("已更新本地生活项目 %s 状态为超时未支付的失效状态", localId))
-				dao.Db.Model(entity.LocalLifeTaskInfo{}).Where("local_id = ?", localId).Updates(entity.LocalLifeTaskInfo{TaskStage: 3, CompleteStatus: 3, CompleteDate: timeNow})
-			}
+		// 超时未支付则变为失效
+		if time.Now().After(localLifeInfo.AutoFailAt) && localLifeInfo.TaskStatus == 6 {
+			_ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
+				LocalID:    localId,
+				TaskStatus: 9,
+				FailReason: 1,
+				FailAt:     time.Now(),
+			})
+			fmt.Println(fmt.Sprintf("已更新本地生活项目 %s 状态为超时未支付的失效状态", localId))
+			dao.Db.Model(entity.LocalLifeTaskInfo{}).Where("local_id = ?", localId).Updates(entity.LocalLifeTaskInfo{TaskStage: 3, CompleteStatus: 3, CompleteDate: time.Now()})
 		}
 	}
 	log.Println("AutoLocalLifeInvalidTask running End, Time :", time.Now())

+ 737 - 669
app/schedule/auto_task_review.go

@@ -1,671 +1,739 @@
 package schedule
 
-//
-//import (
-//	"github.com/robfig/cron/v3"
-//	"log"
-//	"strings"
-//	"time"
-//	"youngee_m_api/app/dao"
-//	"youngee_m_api/app/entity"
-//	"youngee_m_api/app/service/review_service"
-//)
-//
-//func AutoTaskReview() error {
-//	// 新建一个定时任务对象
-//	crontab := cron.New(cron.WithSeconds()) // 精确到秒
-//	spec := "0 */1 * * * ?"                 //cron表达式,每5分钟一次
-//	// "0 0 12 * * ?" 每天中午12点执行
-//
-//	// 添加定时任务
-//	// 定时任务1  品牌种草API自动审核
-//	_, err1 := crontab.AddFunc(spec, AutoProjectReviewTask)
-//	if err1 != nil {
-//		return err1
-//	}
-//	// 定时任务2  电商带货API自动审核
-//	_, err2 := crontab.AddFunc(spec, AutoSelectionReviewTask)
-//	if err2 != nil {
-//		return err2
-//	}
-//	// 定时任务3  本地生活API自动审核
-//	_, err3 := crontab.AddFunc(spec, AutoLocalLifeReviewTask)
-//	if err3 != nil {
-//		return err3
-//	}
-//
-//	// 启动定时器
-//	crontab.Start()
-//	// 定时任务是另起协程执行的,这里使用 select 简单阻塞.需要根据实际情况进行控制
-//	//select {} //阻塞主线程停止
-//	return nil
-//}
-//
-//// 定时任务1  品牌种草API自动审核
-//func AutoProjectReviewTask() {
-//	log.Println("AutoProjectReviewTask running Start, Time :", time.Now())
-//
-//	var reviewProjects []*entity.ReviewProject
-//	reviewProjects, _ = dao.ProjectReviewDao{}.GetProjectReviewByStatus(1)
-//	reviewService := review_service.GetConfig()
-//	for _, reviewProject := range reviewProjects {
-//
-//		if reviewProject.TaskName != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewProject.TaskName)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewProject.TaskDetail != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewProject.TaskDetail)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewProject.ProductName != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewProject.ProductName)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewProject.ProductDetail != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewProject.ProductDetail)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewProject.MainPhoto != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckImage(reviewProject.MainPhoto)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		images := strings.Split(reviewProject.Images, ",")
-//		imageFlag := false
-//		for _, image := range images {
-//			if image != "" {
-//				var suggestion *string
-//				var reviewErr error
-//				i := 3
-//				for {
-//					suggestion, reviewErr = reviewService.CheckImage(image)
-//					if reviewErr == nil || i == 0 {
-//						break
-//					}
-//					i -= 1
-//				}
-//				if reviewErr != nil || "pass" != *suggestion {
-//					imageFlag = true
-//					break
-//				}
-//			}
-//		}
-//		if imageFlag {
-//			// 交给人工审核
-//			_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
-//			continue
-//		}
-//
-//		documentJobIds := strings.Split(reviewProject.DocumentJobIds, ",")
-//		documentFlag := 0 // 0通过 1未通过 2正在运行
-//		for _, documentJobId := range documentJobIds {
-//			if documentJobId != "" {
-//				var status *string
-//				var suggestion *string
-//				var reviewErr error
-//				i := 3
-//				for {
-//					status, suggestion, reviewErr = reviewService.CheckDocumentInfo(documentJobId)
-//					if reviewErr == nil || i == 0 {
-//						break
-//					}
-//					i -= 1
-//				}
-//				if reviewErr == nil && "running" == *status {
-//					documentFlag = 2
-//					break
-//				}
-//				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
-//					documentFlag = 1
-//					break
-//				}
-//			}
-//		}
-//		if documentFlag == 2 {
-//			continue
-//		} else if documentFlag == 1 {
-//			// 交给人工审核
-//			_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
-//			continue
-//		}
-//
-//		videoJobIds := strings.Split(reviewProject.VideoJobIds, ",")
-//		videoFlag := 0 // 0通过 1未通过 2正在运行
-//		for _, videoJobId := range videoJobIds {
-//			if videoJobId != "" {
-//				var status *string
-//				var suggestion *string
-//				var reviewErr error
-//				i := 3
-//				for {
-//					status, suggestion, reviewErr = reviewService.CheckVideoInfo(videoJobId)
-//					if reviewErr == nil || i == 0 {
-//						break
-//					}
-//					i -= 1
-//				}
-//				if reviewErr == nil && "running" == *status {
-//					videoFlag = 2
-//					break
-//				}
-//				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
-//					videoFlag = 1
-//					break
-//				}
-//			}
-//		}
-//		if videoFlag == 2 {
-//			continue
-//		} else if videoFlag == 1 {
-//			// 交给人工审核
-//			_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
-//			continue
-//		}
-//
-//		// 审核通过
-//		_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 2})
-//		_ = dao.ProjectDAO{}.UpdateProject(entity.Project{ProjectId: reviewProject.ProjectID, ProjectStatus: 4})
-//	}
-//
-//	log.Println("AutoProjectReviewTask running End, Time :", time.Now())
-//}
-//
-//// 定时任务2  电商带货API自动审核
-//func AutoSelectionReviewTask() {
-//	log.Println("AutoSelectionInvalidTask running Start, Time :", time.Now())
-//
-//	var reviewSelections []*entity.ReviewSelection
-//	reviewSelections, _ = dao.SelectionReviewDao{}.GetSelectionReviewByStatus(1)
-//	reviewService := review_service.GetConfig()
-//	for _, reviewSelection := range reviewSelections {
-//
-//		if reviewSelection.TaskName != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewSelection.TaskName)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewSelection.ProductName != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewSelection.ProductName)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewSelection.ProductDetail != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewSelection.ProductDetail)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewSelection.MainPhoto != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckImage(reviewSelection.MainPhoto)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		images := strings.Split(reviewSelection.Images, ",")
-//		imageFlag := false
-//		for _, image := range images {
-//			if image != "" {
-//				var suggestion *string
-//				var reviewErr error
-//				i := 3
-//				for {
-//					suggestion, reviewErr = reviewService.CheckImage(image)
-//					if reviewErr == nil || i == 0 {
-//						break
-//					}
-//					i -= 1
-//				}
-//				if reviewErr != nil || "pass" != *suggestion {
-//					imageFlag = true
-//					break
-//				}
-//			}
-//		}
-//		if imageFlag {
-//			// 交给人工审核
-//			_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
-//			continue
-//		}
-//
-//		documentJobIds := strings.Split(reviewSelection.DocumentJobIds, ",")
-//		documentFlag := 0 // 0通过 1未通过 2正在运行
-//		for _, documentJobId := range documentJobIds {
-//			if documentJobId != "" {
-//				var status *string
-//				var suggestion *string
-//				var reviewErr error
-//				i := 3
-//				for {
-//					status, suggestion, reviewErr = reviewService.CheckDocumentInfo(documentJobId)
-//					if reviewErr == nil || i == 0 {
-//						break
-//					}
-//					i -= 1
-//				}
-//				if reviewErr == nil && "running" == *status {
-//					documentFlag = 2
-//					break
-//				}
-//				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
-//					documentFlag = 1
-//					break
-//				}
-//			}
-//		}
-//		if documentFlag == 2 {
-//			continue
-//		} else if documentFlag == 1 {
-//			// 交给人工审核
-//			_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
-//			continue
-//		}
-//
-//		videoJobIds := strings.Split(reviewSelection.VideoJobIds, ",")
-//		videoFlag := 0 // 0通过 1未通过 2正在运行
-//		for _, videoJobId := range videoJobIds {
-//			if videoJobId != "" {
-//				var status *string
-//				var suggestion *string
-//				var reviewErr error
-//				i := 3
-//				for {
-//					status, suggestion, reviewErr = reviewService.CheckVideoInfo(videoJobId)
-//					if reviewErr == nil || i == 0 {
-//						break
-//					}
-//					i -= 1
-//				}
-//				if reviewErr == nil && "running" == *status {
-//					videoFlag = 2
-//					break
-//				}
-//				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
-//					videoFlag = 1
-//					break
-//				}
-//			}
-//		}
-//		if videoFlag == 2 {
-//			continue
-//		} else if videoFlag == 1 {
-//			// 交给人工审核
-//			_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
-//			continue
-//		}
-//
-//		// 审核通过
-//		_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 2})
-//		_ = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: reviewSelection.SelectionID, SelectionStatus: 4})
-//	}
-//
-//	log.Println("AutoSelectionInvalidTask running End, Time :", time.Now())
-//}
-//
-//// 定时任务3  本地生活API自动审核
-//func AutoLocalLifeReviewTask() {
-//	log.Println("AutoLocalLifeInvalidTask running Start, Time :", time.Now())
-//
-//	var reviewLocalLifes []*entity.ReviewLocalLife
-//	reviewLocalLifes, _ = dao.LocalLifeReviewDao{}.GetLocalReviewByStatus(1)
-//	reviewService := review_service.GetConfig()
-//	for _, reviewLocalLife := range reviewLocalLifes {
-//
-//		if reviewLocalLife.TaskName != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.TaskName)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewLocalLife.TaskDetail != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.TaskDetail)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewLocalLife.StoreName != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.StoreName)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//				continue
-//			}
-//		}
-//		if reviewLocalLife.StoreDetail != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.StoreDetail)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//				continue
-//			}
-//		}
-//		if reviewLocalLife.StoreMainPhoto != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckImage(reviewLocalLife.StoreMainPhoto)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		if reviewLocalLife.TeamBuyingName != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.TeamBuyingName)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//				continue
-//			}
-//		}
-//		if reviewLocalLife.TeamBuyingDetail != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.TeamBuyingDetail)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//				continue
-//			}
-//		}
-//		if reviewLocalLife.TeamBuyingMainPhoto != "" {
-//			var suggestion *string
-//			var reviewErr error
-//			i := 3
-//			for {
-//				suggestion, reviewErr = reviewService.CheckImage(reviewLocalLife.TeamBuyingMainPhoto)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil || "pass" != *suggestion {
-//				// 交给人工审核
-//				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//				continue
-//			}
-//		}
-//
-//		images := strings.Split(reviewLocalLife.Images, ",")
-//		imageFlag := false
-//		for _, image := range images {
-//			if image != "" {
-//				var suggestion *string
-//				var reviewErr error
-//				i := 3
-//				for {
-//					suggestion, reviewErr = reviewService.CheckImage(image)
-//					if reviewErr == nil || i == 0 {
-//						break
-//					}
-//					i -= 1
-//				}
-//				if reviewErr != nil || "pass" != *suggestion {
-//					imageFlag = true
-//					break
-//				}
-//			}
-//		}
-//		if imageFlag {
-//			// 交给人工审核
-//			_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//			continue
-//		}
-//
-//		documentJobIds := strings.Split(reviewLocalLife.DocumentJobIds, ",")
-//		documentFlag := 0 // 0通过 1未通过 2正在运行
-//		for _, documentJobId := range documentJobIds {
-//			if documentJobId != "" {
-//				var status *string
-//				var suggestion *string
-//				var reviewErr error
-//				i := 3
-//				for {
-//					status, suggestion, reviewErr = reviewService.CheckDocumentInfo(documentJobId)
-//					if reviewErr == nil || i == 0 {
-//						break
-//					}
-//					i -= 1
-//				}
-//				if reviewErr == nil && "running" == *status {
-//					documentFlag = 2
-//					break
-//				}
-//				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
-//					documentFlag = 1
-//					break
-//				}
-//			}
-//		}
-//		if documentFlag == 2 {
-//			continue
-//		} else if documentFlag == 1 {
-//			// 交给人工审核
-//			_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//			continue
-//		}
-//
-//		videoJobIds := strings.Split(reviewLocalLife.VideoJobIds, ",")
-//		videoFlag := 0 // 0通过 1未通过 2正在运行
-//		for _, videoJobId := range videoJobIds {
-//			if videoJobId != "" {
-//				var status *string
-//				var suggestion *string
-//				var reviewErr error
-//				i := 3
-//				for {
-//					status, suggestion, reviewErr = reviewService.CheckVideoInfo(videoJobId)
-//					if reviewErr == nil || i == 0 {
-//						break
-//					}
-//					i -= 1
-//				}
-//				if reviewErr == nil && "running" == *status {
-//					videoFlag = 2
-//					break
-//				}
-//				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
-//					videoFlag = 1
-//					break
-//				}
-//			}
-//		}
-//		if videoFlag == 2 {
-//			continue
-//		} else if videoFlag == 1 {
-//			// 交给人工审核
-//			_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
-//			continue
-//		}
-//
-//		// 审核通过
-//		_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 2})
-//		_ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{LocalID: reviewLocalLife.LocalID, TaskStatus: 4})
-//	}
-//
-//	log.Println("AutoLocalLifeInvalidTask running End, Time :", time.Now())
-//}
+import (
+	"github.com/caixw/lib.go/conv"
+	"github.com/robfig/cron/v3"
+	"log"
+	"strings"
+	"time"
+	"youngee_m_api/app/dao"
+	"youngee_m_api/app/entity"
+	"youngee_m_api/app/service/review_service"
+)
+
+func AutoTaskReview() error {
+	// 新建一个定时任务对象
+	crontab := cron.New(cron.WithSeconds()) // 精确到秒
+	spec := "0 */1 * * * ?"                 //cron表达式,每1分钟一次
+	// "0 0 12 * * ?" 每天中午12点执行
+
+	// 添加定时任务
+	// 定时任务1  品牌种草API自动审核
+	_, err1 := crontab.AddFunc(spec, AutoProjectReviewTask)
+	if err1 != nil {
+		return err1
+	}
+	// 定时任务2  电商带货API自动审核
+	_, err2 := crontab.AddFunc(spec, AutoSelectionReviewTask)
+	if err2 != nil {
+		return err2
+	}
+	// 定时任务3  本地生活API自动审核
+	_, err3 := crontab.AddFunc(spec, AutoLocalLifeReviewTask)
+	if err3 != nil {
+		return err3
+	}
+
+	// 启动定时器
+	crontab.Start()
+	// 定时任务是另起协程执行的,这里使用 select 简单阻塞.需要根据实际情况进行控制
+	//select {} //阻塞主线程停止
+	return nil
+}
+
+// 定时任务1  品牌种草API自动审核
+func AutoProjectReviewTask() {
+	log.Println("AutoProjectReviewTask running Start, Time :", time.Now())
+
+	var reviewProjects []*entity.ReviewProject
+	reviewProjects, _ = dao.ProjectReviewDao{}.GetProjectReviewByStatus(1)
+	reviewService := review_service.GetConfig()
+	for _, reviewProject := range reviewProjects {
+
+		if reviewProject.TaskName != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewProject.TaskName)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewProject.TaskDetail != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewProject.TaskDetail)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewProject.ProductName != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewProject.ProductName)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewProject.ProductDetail != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewProject.ProductDetail)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewProject.MainPhoto != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckImage(reviewProject.MainPhoto)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
+				continue
+			}
+		}
+
+		images := strings.Split(reviewProject.Images, ",")
+		imageFlag := false
+		for _, image := range images {
+			if image != "" {
+				var suggestion *string
+				var reviewErr error
+				i := 3
+				for {
+					suggestion, reviewErr = reviewService.CheckImage(image)
+					if reviewErr == nil || i == 0 {
+						break
+					}
+					i -= 1
+				}
+				if reviewErr != nil || "pass" != *suggestion {
+					imageFlag = true
+					break
+				}
+			}
+		}
+		if imageFlag {
+			// 交给人工审核
+			_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
+			continue
+		}
+
+		documentJobIds := strings.Split(reviewProject.DocumentJobIds, ",")
+		documentFlag := 0 // 0通过 1未通过 2正在运行
+		for _, documentJobId := range documentJobIds {
+			if documentJobId != "" {
+				var status *string
+				var suggestion *string
+				var reviewErr error
+				i := 3
+				for {
+					status, suggestion, reviewErr = reviewService.CheckDocumentInfo(documentJobId)
+					if reviewErr == nil || i == 0 {
+						break
+					}
+					i -= 1
+				}
+				if reviewErr == nil && "running" == *status {
+					documentFlag = 2
+					break
+				}
+				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
+					documentFlag = 1
+					break
+				}
+			}
+		}
+		if documentFlag == 2 {
+			continue
+		} else if documentFlag == 1 {
+			// 交给人工审核
+			_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
+			continue
+		}
+
+		videoJobIds := strings.Split(reviewProject.VideoJobIds, ",")
+		videoFlag := 0 // 0通过 1未通过 2正在运行
+		for _, videoJobId := range videoJobIds {
+			if videoJobId != "" {
+				var status *string
+				var suggestion *string
+				var reviewErr error
+				i := 3
+				for {
+					status, suggestion, reviewErr = reviewService.CheckVideoInfo(videoJobId)
+					if reviewErr == nil || i == 0 {
+						break
+					}
+					i -= 1
+				}
+				if reviewErr == nil && "running" == *status {
+					videoFlag = 2
+					break
+				}
+				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
+					videoFlag = 1
+					break
+				}
+			}
+		}
+		if videoFlag == 2 {
+			continue
+		} else if videoFlag == 1 {
+			// 交给人工审核
+			_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 3})
+			continue
+		}
+
+		// 审核通过
+		_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 2})
+		// 更新审核通过时间 与 支付截止时间:任务截止时间 + 设置的失效自动执行时间
+		var projectInfo entity.Project
+		err10 := dao.Db.Model(&entity.Project{}).Where("project_id = ?", reviewProject.ProjectID).Select("project_id,recruit_ddl,auto_task_id").Find(&projectInfo).Error
+		if err10 != nil {
+			continue
+		}
+		autoTaskId := projectInfo.AutoTaskID
+		autoTaskInfo := dao.InfoAutoTaskDao{}.GetValueByIdFieldName(autoTaskId, "invalid")
+		dd, _ := time.ParseDuration(conv.MustString(autoTaskInfo.Invalid, "") + "h")
+		timeInvalid := projectInfo.RecruitDdl.Add(dd)
+		var projectType int64
+		var projectStatus int64
+		_ = dao.Db.Model(&entity.Project{}).Where("project_id = ?", reviewProject.ProjectID).Select("project_type").Find(&projectType).Error
+		t := time.Now()
+		if projectType == 2 {
+			projectStatus = 8
+		} else {
+			projectStatus = 4
+		}
+		_ = dao.ProjectDAO{}.UpdateProject(entity.Project{
+			ProjectId:     reviewProject.ProjectID,
+			ProjectStatus: projectStatus,
+			PassAt:        t,
+			AutoFailAt:    timeInvalid,
+		})
+	}
+
+	log.Println("AutoProjectReviewTask running End, Time :", time.Now())
+}
+
+// 定时任务2  电商带货API自动审核
+func AutoSelectionReviewTask() {
+	log.Println("AutoSelectionInvalidTask running Start, Time :", time.Now())
+
+	var reviewSelections []*entity.ReviewSelection
+	reviewSelections, _ = dao.SelectionReviewDao{}.GetSelectionReviewByStatus(1)
+	reviewService := review_service.GetConfig()
+	for _, reviewSelection := range reviewSelections {
+
+		if reviewSelection.TaskName != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewSelection.TaskName)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewSelection.ProductName != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewSelection.ProductName)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewSelection.ProductDetail != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewSelection.ProductDetail)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewSelection.MainPhoto != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckImage(reviewSelection.MainPhoto)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
+				continue
+			}
+		}
+
+		images := strings.Split(reviewSelection.Images, ",")
+		imageFlag := false
+		for _, image := range images {
+			if image != "" {
+				var suggestion *string
+				var reviewErr error
+				i := 3
+				for {
+					suggestion, reviewErr = reviewService.CheckImage(image)
+					if reviewErr == nil || i == 0 {
+						break
+					}
+					i -= 1
+				}
+				if reviewErr != nil || "pass" != *suggestion {
+					imageFlag = true
+					break
+				}
+			}
+		}
+		if imageFlag {
+			// 交给人工审核
+			_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
+			continue
+		}
+
+		documentJobIds := strings.Split(reviewSelection.DocumentJobIds, ",")
+		documentFlag := 0 // 0通过 1未通过 2正在运行
+		for _, documentJobId := range documentJobIds {
+			if documentJobId != "" {
+				var status *string
+				var suggestion *string
+				var reviewErr error
+				i := 3
+				for {
+					status, suggestion, reviewErr = reviewService.CheckDocumentInfo(documentJobId)
+					if reviewErr == nil || i == 0 {
+						break
+					}
+					i -= 1
+				}
+				if reviewErr == nil && "running" == *status {
+					documentFlag = 2
+					break
+				}
+				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
+					documentFlag = 1
+					break
+				}
+			}
+		}
+		if documentFlag == 2 {
+			continue
+		} else if documentFlag == 1 {
+			// 交给人工审核
+			_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
+			continue
+		}
+
+		videoJobIds := strings.Split(reviewSelection.VideoJobIds, ",")
+		videoFlag := 0 // 0通过 1未通过 2正在运行
+		for _, videoJobId := range videoJobIds {
+			if videoJobId != "" {
+				var status *string
+				var suggestion *string
+				var reviewErr error
+				i := 3
+				for {
+					status, suggestion, reviewErr = reviewService.CheckVideoInfo(videoJobId)
+					if reviewErr == nil || i == 0 {
+						break
+					}
+					i -= 1
+				}
+				if reviewErr == nil && "running" == *status {
+					videoFlag = 2
+					break
+				}
+				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
+					videoFlag = 1
+					break
+				}
+			}
+		}
+		if videoFlag == 2 {
+			continue
+		} else if videoFlag == 1 {
+			// 交给人工审核
+			_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 3})
+			continue
+		}
+
+		// 审核通过
+		t := time.Now()
+		_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 2})
+		// 非悬赏任务审核通过直接变为执行中
+		selection, _ := dao.SelectionInfoDAO{}.GetSelectionInfoById(reviewSelection.SelectionID)
+		if selection != nil && selection.TaskMode == 2 {
+			_ = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: reviewSelection.SelectionID, SelectionStatus: 6, PassAt: t})
+		} else {
+			var selectionInfo entity.SelectionInfo
+			err10 := dao.Db.Model(&entity.SelectionInfo{}).Where("selection_id = ?", reviewSelection.SelectionID).Select("selection_id,task_ddl,auto_task_id").Find(&selectionInfo).Error
+			if err10 != nil {
+				continue
+			}
+			autoTaskId := selectionInfo.AutoTaskID
+			autoTaskInfo := dao.InfoAutoTaskDao{}.GetValueByIdFieldName(autoTaskId, "invalid")
+			dd, _ := time.ParseDuration(conv.MustString(autoTaskInfo.Invalid, "") + "h")
+			timeInvalid := selectionInfo.TaskDdl.Add(dd)
+			_ = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{
+				SelectionID:     reviewSelection.SelectionID,
+				SelectionStatus: 4,
+				PassAt:          t,
+				AutoFailAt:      timeInvalid,
+			})
+		}
+	}
+
+	log.Println("AutoSelectionInvalidTask running End, Time :", time.Now())
+}
+
+// 定时任务3  本地生活API自动审核
+func AutoLocalLifeReviewTask() {
+	log.Println("AutoLocalLifeInvalidTask running Start, Time :", time.Now())
+
+	var reviewLocalLifes []*entity.ReviewLocalLife
+	reviewLocalLifes, _ = dao.LocalLifeReviewDao{}.GetLocalReviewByStatus(1)
+	reviewService := review_service.GetConfig()
+	for _, reviewLocalLife := range reviewLocalLifes {
+
+		if reviewLocalLife.TaskName != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.TaskName)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewLocalLife.TaskDetail != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.TaskDetail)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewLocalLife.StoreName != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.StoreName)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+				continue
+			}
+		}
+		if reviewLocalLife.StoreDetail != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.StoreDetail)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+				continue
+			}
+		}
+		if reviewLocalLife.StoreMainPhoto != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckImage(reviewLocalLife.StoreMainPhoto)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+				continue
+			}
+		}
+
+		if reviewLocalLife.TeamBuyingName != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.TeamBuyingName)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+				continue
+			}
+		}
+		if reviewLocalLife.TeamBuyingDetail != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckContent(reviewLocalLife.TeamBuyingDetail)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+				continue
+			}
+		}
+		if reviewLocalLife.TeamBuyingMainPhoto != "" {
+			var suggestion *string
+			var reviewErr error
+			i := 3
+			for {
+				suggestion, reviewErr = reviewService.CheckImage(reviewLocalLife.TeamBuyingMainPhoto)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil || "pass" != *suggestion {
+				// 交给人工审核
+				_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+				continue
+			}
+		}
+
+		images := strings.Split(reviewLocalLife.Images, ",")
+		imageFlag := false
+		for _, image := range images {
+			if image != "" {
+				var suggestion *string
+				var reviewErr error
+				i := 3
+				for {
+					suggestion, reviewErr = reviewService.CheckImage(image)
+					if reviewErr == nil || i == 0 {
+						break
+					}
+					i -= 1
+				}
+				if reviewErr != nil || "pass" != *suggestion {
+					imageFlag = true
+					break
+				}
+			}
+		}
+		if imageFlag {
+			// 交给人工审核
+			_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+			continue
+		}
+
+		documentJobIds := strings.Split(reviewLocalLife.DocumentJobIds, ",")
+		documentFlag := 0 // 0通过 1未通过 2正在运行
+		for _, documentJobId := range documentJobIds {
+			if documentJobId != "" {
+				var status *string
+				var suggestion *string
+				var reviewErr error
+				i := 3
+				for {
+					status, suggestion, reviewErr = reviewService.CheckDocumentInfo(documentJobId)
+					if reviewErr == nil || i == 0 {
+						break
+					}
+					i -= 1
+				}
+				if reviewErr == nil && "running" == *status {
+					documentFlag = 2
+					break
+				}
+				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
+					documentFlag = 1
+					break
+				}
+			}
+		}
+		if documentFlag == 2 {
+			continue
+		} else if documentFlag == 1 {
+			// 交给人工审核
+			_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+			continue
+		}
+
+		videoJobIds := strings.Split(reviewLocalLife.VideoJobIds, ",")
+		videoFlag := 0 // 0通过 1未通过 2正在运行
+		for _, videoJobId := range videoJobIds {
+			if videoJobId != "" {
+				var status *string
+				var suggestion *string
+				var reviewErr error
+				i := 3
+				for {
+					status, suggestion, reviewErr = reviewService.CheckVideoInfo(videoJobId)
+					if reviewErr == nil || i == 0 {
+						break
+					}
+					i -= 1
+				}
+				if reviewErr == nil && "running" == *status {
+					videoFlag = 2
+					break
+				}
+				if reviewErr != nil || "failed" == *status || "pass" != *suggestion {
+					videoFlag = 1
+					break
+				}
+			}
+		}
+		if videoFlag == 2 {
+			continue
+		} else if videoFlag == 1 {
+			// 交给人工审核
+			_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 3})
+			continue
+		}
+
+		// 审核通过
+		_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 2})
+		var localLifeInfo entity.LocalLifeInfo
+		err10 := dao.Db.Model(&entity.LocalLifeInfo{}).Where("local_id = ?", reviewLocalLife.LocalID).Select("local_id,recruit_ddl,auto_task_id").Find(&localLifeInfo).Error
+		if err10 != nil {
+			continue
+		}
+		autoTaskId := localLifeInfo.AutoTaskID
+		autoTaskInfo := dao.InfoAutoTaskDao{}.GetValueByIdFieldName(autoTaskId, "invalid")
+		dd, _ := time.ParseDuration(conv.MustString(autoTaskInfo.Invalid, "") + "h")
+		timeInvalid := localLifeInfo.RecruitDdl.Add(dd)
+		var localType int64
+		var taskStatus int64
+		_ = dao.Db.Model(&entity.LocalLifeInfo{}).Where("local_id = ?", reviewLocalLife.LocalID).Select("local_type").Find(&localType).Error
+		t := time.Now()
+		if localType == 2 {
+			taskStatus = 8
+		} else {
+			taskStatus = 4
+		}
+		_ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
+			LocalID:    reviewLocalLife.LocalID,
+			TaskStatus: taskStatus,
+			PassAt:     t,
+			AutoFailAt: timeInvalid,
+		})
+	}
+
+	log.Println("AutoLocalLifeInvalidTask running End, Time :", time.Now())
+}

+ 194 - 0
app/schedule/auto_task_settle.go

@@ -0,0 +1,194 @@
+package schedule
+
+import (
+	"github.com/robfig/cron/v3"
+	"log"
+	"time"
+	"youngee_m_api/app/dao"
+	"youngee_m_api/app/entity"
+)
+
+func AutoTaskSettle() error {
+	// 新建一个定时任务对象
+	crontab := cron.New(cron.WithSeconds()) // 精确到秒
+	spec := "0 */1 * * * ?"                 //cron表达式,每5分钟一次
+
+	// 添加定时任务
+	// 定时任务1  电商带货结案与解冻处理
+	_, err2 := crontab.AddFunc(spec, AutoSelectionSettleTask)
+	if err2 != nil {
+		return err2
+	}
+	// 定时任务2  品牌种草结案与解冻处理
+	_, err1 := crontab.AddFunc(spec, AutoProjectSettleTask)
+	if err1 != nil {
+		return err1
+	}
+	// 定时任务3  本地生活结案与解冻处理
+	_, err3 := crontab.AddFunc(spec, AutoLocalLifeSettleTask)
+	if err3 != nil {
+		return err3
+	}
+
+	// 启动定时器
+	crontab.Start()
+	// 定时任务是另起协程执行的,这里使用 select 简单阻塞.需要根据实际情况进行控制
+	//select {} //阻塞主线程停止
+	return nil
+}
+
+// 定时任务1  电商带货结案与解冻处理
+func AutoSelectionSettleTask() {
+	log.Println("AutoSelectionSettleTask running Start, Time :", time.Now())
+	var selectionInfos []*entity.SelectionInfo
+	err1 := dao.Db.Model(&entity.SelectionInfo{}).Where("selection_status = ? and settle_flag = ? ", 8, 0).Select("selection_id, enterprise_id, estimated_cost, settlement_amount").Find(&selectionInfos).Error
+	if err1 != nil {
+		return
+	}
+	for _, selectionInfo := range selectionInfos {
+		selectionID := selectionInfo.SelectionID
+		// 解冻资金
+		_, err3 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen2(selectionInfo.EnterpriseID, selectionInfo.EstimatedCost, selectionInfo.SettlementAmount)
+		if err3 != nil {
+			continue
+		}
+		// 更新任务状态
+		err4 := dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: selectionID, SettleFlag: 1})
+		if err4 != nil {
+			return
+		}
+	}
+	log.Println("AutoSelectionSettleTask running End, Time :", time.Now())
+}
+
+// 定时任务2  品牌种草结案与解冻处理
+func AutoProjectSettleTask() {
+	log.Println("AutoProjectSettleTask running Start, Time :", time.Now())
+	var projectInfos []*entity.Project
+	err1 := dao.Db.Model(&entity.Project{}).Where("project_status = ? and settle_flag = ? ", 8, 1).Select("project_id, project_type, enterprise_id, need_pay").Find(&projectInfos).Error
+	if err1 != nil {
+		return
+	}
+	// 对于所有子任务结案但未解冻的品牌种草项目进行处理
+	for _, projectInfo := range projectInfos {
+		projectId := projectInfo.ProjectId
+		// 只有公开任务需要冻结&解冻资金
+		if projectInfo.ProjectType == 1 {
+			// 1. 处理商家账户金额
+			var realPayments float64
+			var projectTaskInfos []*entity.ProjectTaskInfo
+			err2 := dao.Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? and task_stage = ? ", projectId, 15).Select("real_payment").Find(&projectTaskInfos).Error
+			if err2 != nil {
+				continue
+			}
+			for _, projectTaskInfo := range projectTaskInfos {
+				realPayments += projectTaskInfo.RealPayment
+			}
+			// 解冻资金
+			_, err3 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen2(projectInfo.EnterpriseID, projectInfo.NeedPay, realPayments)
+			if err3 != nil {
+				return
+			}
+		}
+		// 更新任务状态为结案
+		err4 := dao.ProjectDAO{}.UpdateProject(entity.Project{ProjectId: projectId, ProjectStatus: 10})
+		if err4 != nil {
+			return
+		}
+		// 2、处理涉及到的服务商账户金额
+		sProjectInfos, err5 := dao.SProjectDao{}.GetSProjectByProjectId(projectId)
+		if err5 != nil {
+			return
+		}
+		for _, sProjectInfo := range sProjectInfos {
+			var incomeStatus int64
+			if sProjectInfo.SupplierType == 1 {
+				incomeStatus = 5
+			} else {
+				incomeStatus = 1
+			}
+			_, err6 := dao.SupplierIncomeDao{}.CreateSupplierIncome(entity.SupplierIncome{
+				SupplierID:          sProjectInfo.SupplierID,
+				SupplierType:        sProjectInfo.SupplierType,
+				SProjectID:          sProjectInfo.SProjectID,
+				IncomeType:          1,
+				IncomeStatus:        incomeStatus,
+				ServiceChargeSettle: sProjectInfo.ServiceChargeSettle,
+			})
+			if err6 != nil {
+				return
+			}
+			err7 := dao.SProjectDao{}.UpdateSProject(entity.SProjectInfo{SProjectID: sProjectInfo.SProjectID, ProjectStatus: 10})
+			if err7 != nil {
+				return
+			}
+		}
+	}
+	log.Println("AutoProjectSettleTask running End, Time :", time.Now())
+}
+
+// 定时任务3  本地生活结案与解冻处理
+func AutoLocalLifeSettleTask() {
+	log.Println("AutoLocalLifeSettleTask running Start, Time :", time.Now())
+	var localLifeInfos []*entity.LocalLifeInfo
+	err1 := dao.Db.Model(&entity.LocalLifeInfo{}).Where("task_status = ? and settle_flag = ? ", 8, 1).Select("local_id, local_type, enterprise_id, need_pay").Find(&localLifeInfos).Error
+	if err1 != nil {
+		return
+	}
+	// 对于所有子任务结案但未解冻的本地生活项目进行处理
+	for _, localLifeInfo := range localLifeInfos {
+		localId := localLifeInfo.LocalID
+		// 只有公开任务需要冻结&解冻资金
+		if localLifeInfo.LocalType == 1 {
+			// 1. 处理商家账户金额
+			var realPayments float64
+			var localTaskInfos []*entity.LocalLifeTaskInfo
+			err2 := dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? and task_stage = ? ", localId, 15).Select("real_payment").Find(&localTaskInfos).Error
+			if err2 != nil {
+				continue
+			}
+			for _, localTaskInfo := range localTaskInfos {
+				realPayments += localTaskInfo.RealPayment
+			}
+			// 解冻资金
+			_, err3 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen2(localLifeInfo.EnterpriseID, localLifeInfo.NeedPay, realPayments)
+			if err3 != nil {
+				continue
+			}
+		}
+		// 更新任务状态为结案
+		err4 := dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{LocalID: localId, TaskStatus: 10})
+		if err4 != nil {
+			return
+		}
+		// 2、处理涉及到的服务商账户金额
+		sLocalLifeInfos, err5 := dao.SLocalLifeDao{}.GetSLocalLifeByLocalId(localId)
+		if err5 != nil {
+			return
+		}
+		for _, sLocalLifeInfo := range sLocalLifeInfos {
+			var incomeStatus int64
+			if sLocalLifeInfo.SupplierType == 1 {
+				incomeStatus = 5
+			} else {
+				incomeStatus = 1
+			}
+			_, err6 := dao.SupplierIncomeDao{}.CreateSupplierIncome(entity.SupplierIncome{
+				SupplierID:          sLocalLifeInfo.SupplierID,
+				SupplierType:        sLocalLifeInfo.SupplierType,
+				SLocalLifeID:        sLocalLifeInfo.SLocalID,
+				IncomeType:          3,
+				IncomeStatus:        incomeStatus,
+				ServiceChargeSettle: sLocalLifeInfo.ServiceChargeSettle,
+			})
+			if err6 != nil {
+				return
+			}
+			err7 := dao.SLocalLifeDao{}.UpdateSLocalLife(entity.SLocalLifeInfo{SLocalID: sLocalLifeInfo.SLocalID, TaskStatus: 10})
+			if err7 != nil {
+				return
+			}
+		}
+	}
+	log.Println("AutoLocalLifeSettleTask running End, Time :", time.Now())
+}

+ 6 - 5
app/service/bill_service.go

@@ -2,6 +2,7 @@ package service
 
 import (
 	"errors"
+	"time"
 	"youngee_m_api/app/dao"
 	"youngee_m_api/app/entity"
 	"youngee_m_api/app/vo"
@@ -24,7 +25,7 @@ func (s BillService) PaySelection(param *vo.PayParam) error {
 	if err2 != nil {
 		return err2
 	}
-	err3 := dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: selectionId, SelectionStatus: 6})
+	err3 := dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: selectionId, SelectionStatus: 6, PayAt: time.Now()})
 	if err3 != nil {
 		return err3
 	}
@@ -43,11 +44,11 @@ func (s BillService) PayProject(param *vo.PayParam) error {
 	if projectStatus != 6 {
 		return errors.New("状态异常")
 	}
-	_, err2 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen(projectInfo.EnterpriseID, projectInfo.PaymentAmount)
+	_, err2 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen(projectInfo.EnterpriseID, projectInfo.NeedPay)
 	if err2 != nil {
 		return err2
 	}
-	err3 := dao.ProjectDAO{}.UpdateProject(entity.Project{ProjectId: projectId, ProjectStatus: 8})
+	err3 := dao.ProjectDAO{}.UpdateProject(entity.Project{ProjectId: projectId, ProjectStatus: 8, PayAt: time.Now()})
 	if err3 != nil {
 		return err3
 	}
@@ -66,11 +67,11 @@ func (s BillService) PayLocalLife(param *vo.PayParam) error {
 	if localStatus != 6 {
 		return errors.New("状态异常")
 	}
-	_, err2 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen(localInfo.EnterpriseID, localInfo.PaymentAmount)
+	_, err2 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen(localInfo.EnterpriseID, localInfo.NeedPay)
 	if err2 != nil {
 		return err2
 	}
-	err3 := dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{LocalID: localId, TaskStatus: 8})
+	err3 := dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{LocalID: localId, TaskStatus: 8, PayAt: time.Now()})
 	if err3 != nil {
 		return err3
 	}

+ 70 - 71
app/service/content_service.go

@@ -1,73 +1,72 @@
 package service
 
-//
-//import (
-//	"fmt"
-//	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
-//	//region "github.com/huaweicloud/huaweicloud-review_service-go-v3/core/region"
-//	moderation "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3"
-//	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/model"
-//	moderationRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/region"
-//	"youngee_m_api/app/vo"
-//)
-//
-//type ContentService struct{}
-//
-//// 内容审核
-//func (s ContentService) CheckContent(contentCheckParam *vo.ContentCheckParam) (*string, error) {
-//	// 认证用的ak和sk硬编码到代码中或者明文存储都有很大的安全风险,建议在配置文件或者环境变量中密文存放,使用时解密,确保安全;
-//	// 本示例以ak和sk保存在环境变量中来实现身份验证为例,运行本示例前请先在本地环境中设置环境变量HUAWEICLOUD_SDK_AK和HUAWEICLOUD_SDK_SK。
-//	ak := "CNN8MCCSJFGHL1MXCJRF"
-//	sk := "91arFGHyO7RrzXnZIFSPcLSC6y4P4MTKtkq3qLIy"
-//	projectId := "CNN8MCCSJFGHL1MXCJRF"
-//	eventType := "article"
-//
-//	auth := basic.NewCredentialsBuilder().
-//		WithAk(ak).
-//		WithSk(sk).
-//		WithProjectId(projectId).
-//		Build()
-//
-//	client := moderation.NewModerationClient(
-//		moderation.ModerationClientBuilder().
-//			WithRegion(moderationRegion.ValueOf("cn-north-4")). //把xxx替换成服务所在的区域,例如北京四:cn-north-4。
-//			WithCredential(auth).
-//			Build())
-//
-//	//request := &model.RunTextModerationRequest{}
-//	//request.EnterpriseProjectId = &projectId
-//	//databody := &model.TextDetectionDataReq{
-//	//	Text: contentCheckParam.Summary,
-//	//}
-//	//request.Body = &model.TextDetectionReq{
-//	//	Data:      databody,
-//	//	EventType: &eventType,
-//	//}
-//	//response, err := client.RunTextModeration(request)
-//	//if err == nil {
-//	//	fmt.Printf("%+v\n", response)
-//	//} else {
-//	//	fmt.Println(err)
-//	//}
-//	request := &model.CheckImageModerationRequest{}
-//	var listCategoriesbody = []string{
-//		"porn", "terrorism",
-//	}
-//	eventType = "head_image"
-//	urlImageDetectionReq := "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1oXRBY.img?w=640&h=360&m=6"
-//	request.Body = &model.ImageDetectionReq{
-//		Url:        &urlImageDetectionReq,
-//		Categories: &listCategoriesbody,
-//		EventType:  &eventType,
-//	}
-//	response, err := client.CheckImageModeration(request)
-//	if err == nil {
-//		fmt.Printf("%+v\n", response)
-//	} else {
-//		fmt.Println(err)
-//	}
-//	result := response.Result
-//	fmt.Print(result)
-//
-//	return nil, nil
-//}
+import (
+	"fmt"
+	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
+	//region "github.com/huaweicloud/huaweicloud-review_service-go-v3/core/region"
+	moderation "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3"
+	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/model"
+	moderationRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/region"
+	"youngee_m_api/app/vo"
+)
+
+type ContentService struct{}
+
+// 内容审核
+func (s ContentService) CheckContent(contentCheckParam *vo.ContentCheckParam) (*string, error) {
+	// 认证用的ak和sk硬编码到代码中或者明文存储都有很大的安全风险,建议在配置文件或者环境变量中密文存放,使用时解密,确保安全;
+	// 本示例以ak和sk保存在环境变量中来实现身份验证为例,运行本示例前请先在本地环境中设置环境变量HUAWEICLOUD_SDK_AK和HUAWEICLOUD_SDK_SK。
+	ak := "CNN8MCCSJFGHL1MXCJRF"
+	sk := "91arFGHyO7RrzXnZIFSPcLSC6y4P4MTKtkq3qLIy"
+	projectId := "CNN8MCCSJFGHL1MXCJRF"
+	eventType := "article"
+
+	auth := basic.NewCredentialsBuilder().
+		WithAk(ak).
+		WithSk(sk).
+		WithProjectId(projectId).
+		Build()
+
+	client := moderation.NewModerationClient(
+		moderation.ModerationClientBuilder().
+			WithRegion(moderationRegion.ValueOf("cn-north-4")). //把xxx替换成服务所在的区域,例如北京四:cn-north-4。
+			WithCredential(auth).
+			Build())
+
+	//request := &model.RunTextModerationRequest{}
+	//request.EnterpriseProjectId = &projectId
+	//databody := &model.TextDetectionDataReq{
+	//	Text: contentCheckParam.Summary,
+	//}
+	//request.Body = &model.TextDetectionReq{
+	//	Data:      databody,
+	//	EventType: &eventType,
+	//}
+	//response, err := client.RunTextModeration(request)
+	//if err == nil {
+	//	fmt.Printf("%+v\n", response)
+	//} else {
+	//	fmt.Println(err)
+	//}
+	request := &model.CheckImageModerationRequest{}
+	var listCategoriesbody = []string{
+		"porn", "terrorism",
+	}
+	eventType = "head_image"
+	urlImageDetectionReq := "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1oXRBY.img?w=640&h=360&m=6"
+	request.Body = &model.ImageDetectionReq{
+		Url:        &urlImageDetectionReq,
+		Categories: &listCategoriesbody,
+		EventType:  &eventType,
+	}
+	response, err := client.CheckImageModeration(request)
+	if err == nil {
+		fmt.Printf("%+v\n", response)
+	} else {
+		fmt.Println(err)
+	}
+	result := response.Result
+	fmt.Print(result)
+
+	return nil, nil
+}

+ 48 - 3
app/service/cooperation_service.go

@@ -192,6 +192,19 @@ func (s CooperationService) GetSupplierConfirmingList(param *vo.SupplierConfirmi
 	return result, nil
 }
 
+// 服务商管理-角标
+func (t CooperationService) GetSupplierCount(param *vo.SupplierConfirmingParam) map[string]int64 {
+	res := make(map[string]int64)
+	var inPoolNum int64     // 在库服务商
+	var confirmingNum int64 // 邀请待确认
+	dao.Db.Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 2", param.EnterpriseId).Count(&inPoolNum)
+	dao.Db.Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = 1", param.EnterpriseId).Count(&confirmingNum)
+	res["inPoolNum"] = inPoolNum
+	res["confirmingNum"] = confirmingNum
+
+	return res
+}
+
 // 服务商合作-服务商列表
 func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearchInTargetTaskParam) (vo.ResultVO, error) {
 	if param.Page <= 0 {
@@ -210,6 +223,7 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
 	}
 	var enterpriseSupplierCooperates []*entity.EnterpriseSupplierCooperate
 	var sProjectInfos []*entity.SProjectInfo
+	var sLocalLifeInfos []*entity.SLocalLifeInfo
 	var enterpriseOperator string
 	if param.Status == 1 { // 可邀约
 		enterpriseSupplierCooperates, total, _ = dao.EnterpriseSupplierCooperateDao{}.GetSupplierByEnterprise(param.EnterpriseId, param.Page, param.PageSize)
@@ -219,7 +233,7 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
 			sProjectInfos, total, _ = dao.SProjectDao{}.GetSProjectByStatus(param.TaskId, 1, param.Page, param.PageSize)
 		} else if param.TaskType == 3 {
 			// 本地生活
-
+			sLocalLifeInfos, total, _ = dao.SLocalLifeDao{}.GetSLocalLifeByStatus(param.TaskId, 1, param.Page, param.PageSize)
 		}
 	} else if param.Status == 3 { // 合作中
 		if param.TaskType == 2 {
@@ -227,7 +241,7 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
 			sProjectInfos, total, _ = dao.SProjectDao{}.GetSProjectByStatus(param.TaskId, 2, param.Page, param.PageSize)
 		} else if param.TaskType == 3 {
 			// 本地生活
-
+			sLocalLifeInfos, total, _ = dao.SLocalLifeDao{}.GetSLocalLifeByStatus(param.TaskId, 2, param.Page, param.PageSize)
 		}
 	}
 	if enterpriseSupplierCooperates == nil {
@@ -242,7 +256,14 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
 			}
 		} else if param.TaskType == 3 {
 			// 本地生活
-
+			for _, sLocalLifeInfo := range sLocalLifeInfos {
+				supplierId := sLocalLifeInfo.SupplierID
+				enterpriseSupplierCooperate, err1 := dao.EnterpriseSupplierCooperateDao{}.GetDataByEnterpriseAndSupplier(param.EnterpriseId, supplierId)
+				if err1 != nil {
+					return result, err1
+				}
+				enterpriseSupplierCooperates = append(enterpriseSupplierCooperates, enterpriseSupplierCooperate)
+			}
 		}
 	}
 	for _, enterpriseSupplierCooperate := range enterpriseSupplierCooperates {
@@ -301,6 +322,30 @@ func (s CooperationService) GetSupplierInTargetTaskList(param *vo.SupplierSearch
 	return result, nil
 }
 
+// 服务商合作-服务商列表角标
+func (t CooperationService) GetSupplierInTargetCount(param *vo.SupplierSearchInTargetTaskParam) map[string]int64 {
+	res := make(map[string]int64)
+	var invitableNum int64   // 可邀约
+	var invitingNum int64    // 邀约中
+	var cooperatingNum int64 // 合作中
+	dao.Db.Model(&entity.EnterpriseSupplierCooperate{}).Where("enterprise_id = ? AND cooperate_status = ?", param.EnterpriseId, 2).Count(&invitableNum)
+	if param.TaskType == 2 {
+		// 品牌种草
+		dao.Db.Model(&entity.SProjectInfo{}).Where("project_id = ? AND s_project_status = ?", param.TaskId, 1).Count(&invitingNum)
+		dao.Db.Model(&entity.SProjectInfo{}).Where("project_id = ? AND s_project_status = ?", param.TaskId, 2).Count(&cooperatingNum)
+	} else if param.TaskType == 3 {
+		// 本地生活
+		dao.Db.Model(&entity.SLocalLifeInfo{}).Where("local_id = ? AND s_local_status = ?", param.TaskId, 1).Count(&invitingNum)
+		dao.Db.Model(&entity.SProjectInfo{}).Where("local_id = ? AND s_local_status = ?", param.TaskId, 2).Count(&cooperatingNum)
+
+	}
+	res["invitableNum"] = invitableNum
+	res["invitingNum"] = invitingNum
+	res["cooperatingNum"] = cooperatingNum
+
+	return res
+}
+
 // 服务商合作-邀约合作
 func (s CooperationService) InviteSupplierInTargetTask(param *vo.SupplierInviteInTargetTaskParam) error {
 	var sProjectInfo entity.SProjectInfo

+ 345 - 154
app/service/default_service.go

@@ -20,57 +20,116 @@ func (s DefaultService) GetPublicDefaultList(param *vo.DefaultSearchParam) (vo.R
 		param.PageSize = 10
 	}
 	var result vo.ResultVO
-	// 以下代码只考虑了种草
-	reTaskDefaultPublics, total, err := (&dao.ProjectDAO{}).GetProjectPublicList(param)
-	if err != nil {
-		return result, err
-	}
-	for i := range reTaskDefaultPublics {
-		// 获取商品详情字段
-		var creatorName string
-		var productName string
-		var productPrice float64
-		var mainImage string
-		if reTaskDefaultPublics[i].SubAccountId == 0 {
-			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reTaskDefaultPublics[i].EnterpriseId)
-			if err == nil && enterprise != nil {
-				creatorName = enterprise.BusinessName
+	// 种草
+	if param.TaskType == 1 {
+		reTaskDefaultPublics, total, err := (&dao.ProjectDAO{}).GetProjectPublicList(param)
+		if err != nil {
+			return result, err
+		}
+		for i := range reTaskDefaultPublics {
+			// 获取商品详情字段
+			var creatorName string
+			var productName string
+			var productPrice float64
+			var mainImage string
+			if reTaskDefaultPublics[i].SubAccountId == 0 {
+				enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reTaskDefaultPublics[i].EnterpriseId)
+				if err == nil && enterprise != nil {
+					creatorName = enterprise.BusinessName
+				}
+			} else {
+				subAccount, err := dao.SubAccountDao{}.GetSubAccount(reTaskDefaultPublics[i].SubAccountId)
+				if err == nil && subAccount != nil {
+					creatorName = subAccount.SubAccountName
+				}
 			}
-		} else {
-			subAccount, err := dao.SubAccountDao{}.GetSubAccount(reTaskDefaultPublics[i].SubAccountId)
-			if err == nil && subAccount != nil {
-				creatorName = subAccount.SubAccountName
+			product, err := dao.ProductDAO{}.GetProductByID(reTaskDefaultPublics[i].ProductId)
+			if err == nil && product != nil {
+				productName = product.ProductName
+				productPrice = product.ProductPrice
 			}
+			mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reTaskDefaultPublics[i].ProductId)
+			reTaskDefaultPublics[i].CreatorName = creatorName
+			reTaskDefaultPublics[i].ProductName = productName
+			reTaskDefaultPublics[i].ProductPrice = productPrice
+			reTaskDefaultPublics[i].MainImage = mainImage
+			// 获取未传数量字段	0-10分别表示未违约、脚本超时违约、脚本未上传违约、初稿超时违约、初稿未上传违约、链接超时违约、链接未上传违约、数据超时违约、数据未上传违约、解约待处理、解约
+			projectId := reTaskDefaultPublics[i].TaskId
+			noSketchNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 4)
+			noLinkNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 6)
+			noDataNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 8)
+			// 终止合作还是解约字段待确认
+			endCooperationNum := dao.ProjectTaskInfoDao{}.CountByTaskStage(projectId, 16)
+			reTaskDefaultPublics[i].NoSketchNum = noSketchNum
+			reTaskDefaultPublics[i].NoLinkNum = noLinkNum
+			reTaskDefaultPublics[i].NoDataNum = noDataNum
+			reTaskDefaultPublics[i].EndCooperationNum = endCooperationNum
 		}
-		product, err := dao.ProductDAO{}.GetProductByID(reTaskDefaultPublics[i].ProductId)
-		if err == nil && product != nil {
-			productName = product.ProductName
-			productPrice = product.ProductPrice
+		result = vo.ResultVO{
+			Page:     param.Page,
+			PageSize: param.PageSize,
+			Total:    total,
+			Data:     reTaskDefaultPublics,
 		}
-		mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reTaskDefaultPublics[i].ProductId)
-		reTaskDefaultPublics[i].CreatorName = creatorName
-		reTaskDefaultPublics[i].ProductName = productName
-		reTaskDefaultPublics[i].ProductPrice = productPrice
-		reTaskDefaultPublics[i].MainImage = mainImage
-		// 获取未传数量字段	0-10分别表示未违约、脚本超时违约、脚本未上传违约、初稿超时违约、初稿未上传违约、链接超时违约、链接未上传违约、数据超时违约、数据未上传违约、解约待处理、解约
-		projectId := reTaskDefaultPublics[i].TaskId
-		noSketchNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 4)
-		noLinkNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 6)
-		noDataNum := dao.ProjectTaskInfoDao{}.CountByDefaultType(projectId, 8)
-		// 终止合作还是解约字段待确认
-		endCooperationNum := dao.ProjectTaskInfoDao{}.CountByTaskStage(projectId, 16)
-		reTaskDefaultPublics[i].NoSketchNum = noSketchNum
-		reTaskDefaultPublics[i].NoLinkNum = noLinkNum
-		reTaskDefaultPublics[i].NoDataNum = noDataNum
-		reTaskDefaultPublics[i].EndCooperationNum = endCooperationNum
-	}
-	result = vo.ResultVO{
-		Page:     param.Page,
-		PageSize: param.PageSize,
-		Total:    total,
-		Data:     reTaskDefaultPublics,
+		return result, nil
+		// 本地生活
+	} else if param.TaskType == 2 {
+		reTaskDefaultPublics, total, err := (&dao.ProjectDAO{}).GetProjectPublicList(param)
+		if err != nil {
+			return result, err
+		}
+		for i := range reTaskDefaultPublics {
+			// 获取商品详情字段
+			var creatorName string
+			var storeName string
+			var storeLocation string
+			//var productPrice float64
+			var mainImage string
+			if reTaskDefaultPublics[i].SubAccountId == 0 {
+				enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reTaskDefaultPublics[i].EnterpriseId)
+				if err == nil && enterprise != nil {
+					creatorName = enterprise.BusinessName
+				}
+			} else {
+				subAccount, err := dao.SubAccountDao{}.GetSubAccount(reTaskDefaultPublics[i].SubAccountId)
+				if err == nil && subAccount != nil {
+					creatorName = subAccount.SubAccountName
+				}
+			}
+			store, err := dao.StoreDao{}.GetStoreByID(reTaskDefaultPublics[i].StoreId)
+			if err == nil && store != nil {
+				storeName = store.StoreName
+				storeLocation = store.StoreLocation
+			}
+			mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(reTaskDefaultPublics[i].StoreId)
+			reTaskDefaultPublics[i].CreatorName = creatorName
+			reTaskDefaultPublics[i].StoreName = storeName
+			reTaskDefaultPublics[i].StoreLocation = storeLocation
+			reTaskDefaultPublics[i].MainImage = mainImage
+			// 获取未传数量字段	0-10分别表示未违约、脚本超时违约、脚本未上传违约、初稿超时违约、初稿未上传违约、链接超时违约、链接未上传违约、数据超时违约、数据未上传违约、解约待处理、解约
+			localId := reTaskDefaultPublics[i].TaskId
+			noSketchNum := dao.LocalLifeTaskInfoDao{}.CountByDefaultType(localId, 4)
+			noLinkNum := dao.LocalLifeTaskInfoDao{}.CountByDefaultType(localId, 6)
+			noDataNum := dao.LocalLifeTaskInfoDao{}.CountByDefaultType(localId, 8)
+			// 终止合作还是解约字段待确认
+			endCooperationNum := dao.LocalLifeTaskInfoDao{}.CountByTaskStage(localId, 16)
+			reTaskDefaultPublics[i].NoSketchNum = noSketchNum
+			reTaskDefaultPublics[i].NoLinkNum = noLinkNum
+			reTaskDefaultPublics[i].NoDataNum = noDataNum
+			reTaskDefaultPublics[i].EndCooperationNum = endCooperationNum
+		}
+		result = vo.ResultVO{
+			Page:     param.Page,
+			PageSize: param.PageSize,
+			Total:    total,
+			Data:     reTaskDefaultPublics,
+		}
+		return result, nil
+
+	} else {
+		return result, nil
 	}
-	return result, nil
+
 }
 
 // 违约管理——违约定向任务列表
@@ -137,101 +196,240 @@ func (s DefaultService) GetPublicDefaultTalentList(param *vo.DefaultSearchParam)
 	}
 	var result vo.ResultVO
 	var reTalentDefaults []*vo.ReTalentDefault
-	// 以下代码只考虑了种草
-	var projectTaskInfos []entity.ProjectTaskInfo
-	var total int64
-	var err error
-	var cutRate int64
-	defaultType := param.DefaultType
-	if defaultType == 1 { // 未传初稿
-		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListBySketchDefault(param)
-		autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
-		cutRate = dao.InfoAutoDefaultDao{}.GetValueByIdFieldName(*autoDefaultId, "sketch_replace_not_upload")
-	} else if defaultType == 2 { // 未发作品
-		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByLinkDefault(param)
-		autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
-		cutRate = dao.InfoAutoDefaultDao{}.GetValueByIdFieldName(*autoDefaultId, "link_replace_not_upload")
-	} else if defaultType == 3 { // 未传数据
-		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByDataDefault(param)
-		autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
-		cutRate = dao.InfoAutoDefaultDao{}.GetValueByIdFieldName(*autoDefaultId, "data_replace_not_upload")
-	} else if defaultType == 4 { // 终止合作
-		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTerminateDefault(param)
-	} else if defaultType == 5 { // 已解约
-		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByCancelDefault(param)
-	}
-	if err != nil {
-		return result, err
-	}
-	for _, projectTaskInfo := range projectTaskInfos {
-		talentId := projectTaskInfo.TalentID
-		talentPhone, _ := dao.TalentInfoDao{}.SelectTalentPhone(talentId)
-		platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.SelectUserInfo(talentId)
-		reTalentDefault := &vo.ReTalentDefault{
-			TalentId:    talentId,
-			TalentPhone: *talentPhone,
-			TaskId:      projectTaskInfo.TaskID,
-			DraftFee:    projectTaskInfo.DraftFee,
-			OpenId:      platformKuaishouUserInfo.OpenId,
-			NickName:    platformKuaishouUserInfo.NickName,
-			HeadUri:     platformKuaishouUserInfo.HeadUri,
-			City:        "-",
+	// 种草
+	if param.TaskType == 1 {
+		var projectTaskInfos []entity.ProjectTaskInfo
+		var total int64
+		var err error
+		var cutRate int64 // 违约扣款比例
+		defaultType := param.DefaultType
+		if defaultType == 1 { // 未传初稿
+			projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListBySketchDefault(param)
+			autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
+			infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId)
+			cutRate = infoAutoDefault.SketchOtherNotUpload
+		} else if defaultType == 2 { // 未发作品
+			projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByLinkDefault(param)
+			autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
+			infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId)
+			cutRate = infoAutoDefault.LinkReplaceNotUpload
+		} else if defaultType == 3 { // 未传数据
+			projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByDataDefault(param)
+			autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
+			infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId)
+			cutRate = infoAutoDefault.DataReplaceNotUpload
+		} else if defaultType == 4 { // 终止合作
+			projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTerminateDefault(param)
+		} else if defaultType == 5 { // 已解约
+			projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByCancelDefault(param)
 		}
-		if defaultType == 1 {
-			reTalentDefault.DefaultTime = projectTaskInfo.SketchMissingTime.Format("2006-01-02 15:04:05")
-			reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
-		} else if defaultType == 2 {
-			reTalentDefault.DefaultTime = projectTaskInfo.LinkMissingTime.Format("2006-01-02 15:04:05")
-			reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
-		} else if defaultType == 3 {
-			reTalentDefault.DefaultTime = projectTaskInfo.DataMissingTime.Format("2006-01-02 15:04:05")
-			reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
-		} else if defaultType == 4 {
-			reTalentDefault.DefaultTime = projectTaskInfo.TerminateTime.Format("2006-01-02 15:04:05")
-			reTalentDefault.Reason = projectTaskInfo.TerminateReason
-			terminateOperatorType := projectTaskInfo.TerminateOperatorType
-			if terminateOperatorType == 1 {
-				enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.TerminateOperator)
-				reTalentDefault.OperatorName = enterprise.BusinessName
-			} else if terminateOperatorType == 2 {
-				operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64)
-				subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
-				reTalentDefault.OperatorName = subAccount.SubAccountName
-			} else if terminateOperatorType == 3 {
-				operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64)
-				userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
-				reTalentDefault.OperatorName = userName
+		if err != nil {
+			return result, err
+		}
+		for _, projectTaskInfo := range projectTaskInfos {
+			talentId := projectTaskInfo.TalentID
+			talentInfo, _ := dao.TalentInfoDao{}.GetTalentInfo(talentId)
+			platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(projectTaskInfo.OpenID)
+			reTalentDefault := &vo.ReTalentDefault{
+				TalentId:    talentId,
+				TalentPhone: talentInfo.TalentPhoneNumber,
+				TaskId:      projectTaskInfo.TaskID,
+				DraftFee:    projectTaskInfo.DraftFee,
+				OpenId:      platformKuaishouUserInfo.OpenID,
+				PlatformId:  platformKuaishouUserInfo.PlatformID,
+				NickName:    platformKuaishouUserInfo.NickName,
+				HeadUri:     platformKuaishouUserInfo.HeadUri,
+				City:        platformKuaishouUserInfo.City,
+				Gender:      platformKuaishouUserInfo.Gender,
 			}
-		} else if defaultType == 5 {
-			reTalentDefault.DefaultTime = projectTaskInfo.CancelTime.Format("2006-01-02 15:04:05")
-			reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
-			reTalentDefault.Reason = projectTaskInfo.CancelReason
-			cancelOperatorType := projectTaskInfo.CancelOperatorType
-			if cancelOperatorType == 1 {
-				enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.CancelOperator)
-				reTalentDefault.OperatorName = enterprise.BusinessName
-			} else if cancelOperatorType == 2 {
-				operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64)
-				subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
-				reTalentDefault.OperatorName = subAccount.SubAccountName
-			} else if cancelOperatorType == 3 {
-				operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64)
-				userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
-				reTalentDefault.OperatorName = userName
+			if defaultType == 1 {
+				reTalentDefault.DefaultTime = projectTaskInfo.SketchMissingTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
+			} else if defaultType == 2 {
+				reTalentDefault.DefaultTime = projectTaskInfo.LinkMissingTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
+			} else if defaultType == 3 {
+				reTalentDefault.DefaultTime = projectTaskInfo.DataMissingTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
+			} else if defaultType == 4 {
+				reTalentDefault.DefaultTime = projectTaskInfo.TerminateTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.Reason = projectTaskInfo.TerminateReason
+				terminateOperatorType := projectTaskInfo.TerminateOperatorType
+				if terminateOperatorType == 1 {
+					enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.TerminateOperator)
+					reTalentDefault.OperatorName = enterprise.BusinessName
+				} else if terminateOperatorType == 2 {
+					operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64)
+					subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
+					reTalentDefault.OperatorName = subAccount.SubAccountName
+				} else if terminateOperatorType == 3 {
+					operatorId, _ := strconv.ParseInt(projectTaskInfo.TerminateOperator, 10, 64)
+					userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
+					reTalentDefault.OperatorName = userName
+				}
+			} else if defaultType == 5 {
+				reTalentDefault.DefaultTime = projectTaskInfo.CancelTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.SettleAmount = projectTaskInfo.SettleAmount
+				reTalentDefault.Reason = projectTaskInfo.CancelReason
+				cancelOperatorType := projectTaskInfo.CancelOperatorType
+				if cancelOperatorType == 1 {
+					enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(projectTaskInfo.CancelOperator)
+					reTalentDefault.OperatorName = enterprise.BusinessName
+				} else if cancelOperatorType == 2 {
+					operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64)
+					subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
+					reTalentDefault.OperatorName = subAccount.SubAccountName
+				} else if cancelOperatorType == 3 {
+					operatorId, _ := strconv.ParseInt(projectTaskInfo.CancelOperator, 10, 64)
+					userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
+					reTalentDefault.OperatorName = userName
+				}
 			}
+			reTalentDefaults = append(reTalentDefaults, reTalentDefault)
 		}
-		reTalentDefaults = append(reTalentDefaults, reTalentDefault)
+		resultMap := make(map[string]interface{})
+		resultMap["cutRate"] = cutRate
+		resultMap["reTalentDefaults"] = reTalentDefaults
+		result = vo.ResultVO{
+			Page:     param.Page,
+			PageSize: param.PageSize,
+			Total:    total,
+			Data:     resultMap,
+		}
+		return result, nil
+	} else if param.TaskType == 2 {
+		// 本地生活
+		var localLifeTaskInfos []entity.LocalLifeTaskInfo
+		var total int64
+		var err error
+		var cutRate int64 // 违约扣款比例
+		defaultType := param.DefaultType
+		if defaultType == 1 { // 未传初稿
+			localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListBySketchDefault(param)
+			autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
+			infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId)
+			cutRate = infoAutoDefault.SketchOtherNotUpload
+		} else if defaultType == 2 { // 未发作品
+			localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByLinkDefault(param)
+			autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
+			infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId)
+			cutRate = infoAutoDefault.LinkReplaceNotUpload
+		} else if defaultType == 3 { // 未传数据
+			localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByDataDefault(param)
+			autoDefaultId, _ := dao.ProjectDAO{}.GetAutoDefaultId(param.TaskId)
+			infoAutoDefault, _ := dao.InfoAutoDefaultDao{}.GetValueById(*autoDefaultId)
+			cutRate = infoAutoDefault.DataReplaceNotUpload
+		} else if defaultType == 4 { // 终止合作
+			localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTerminateDefault(param)
+		} else if defaultType == 5 { // 已解约
+			localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByCancelDefault(param)
+		}
+		if err != nil {
+			return result, err
+		}
+		for _, localLifeTaskInfo := range localLifeTaskInfos {
+			talentId := localLifeTaskInfo.TalentID
+			talentInfo, _ := dao.TalentInfoDao{}.GetTalentInfo(talentId)
+			platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(localLifeTaskInfo.OpenID)
+			reTalentDefault := &vo.ReTalentDefault{
+				TalentId:    talentId,
+				TalentPhone: talentInfo.TalentPhoneNumber,
+				TaskId:      localLifeTaskInfo.TaskID,
+				DraftFee:    localLifeTaskInfo.DraftFee,
+				OpenId:      platformKuaishouUserInfo.OpenID,
+				PlatformId:  platformKuaishouUserInfo.PlatformID,
+				NickName:    platformKuaishouUserInfo.NickName,
+				HeadUri:     platformKuaishouUserInfo.HeadUri,
+				City:        platformKuaishouUserInfo.City,
+				Gender:      platformKuaishouUserInfo.Gender,
+			}
+			if defaultType == 1 {
+				reTalentDefault.DefaultTime = localLifeTaskInfo.SketchMissingTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.SettleAmount = localLifeTaskInfo.SettleAmount
+			} else if defaultType == 2 {
+				reTalentDefault.DefaultTime = localLifeTaskInfo.LinkMissingTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.SettleAmount = localLifeTaskInfo.SettleAmount
+			} else if defaultType == 3 {
+				reTalentDefault.DefaultTime = localLifeTaskInfo.DataMissingTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.SettleAmount = localLifeTaskInfo.SettleAmount
+			} else if defaultType == 4 {
+				reTalentDefault.DefaultTime = localLifeTaskInfo.TerminateTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.Reason = localLifeTaskInfo.TerminateReason
+				terminateOperatorType := localLifeTaskInfo.TerminateOperatorType
+				if terminateOperatorType == 1 {
+					enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(localLifeTaskInfo.TerminateOperator)
+					reTalentDefault.OperatorName = enterprise.BusinessName
+				} else if terminateOperatorType == 2 {
+					operatorId, _ := strconv.ParseInt(localLifeTaskInfo.TerminateOperator, 10, 64)
+					subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
+					reTalentDefault.OperatorName = subAccount.SubAccountName
+				} else if terminateOperatorType == 3 {
+					operatorId, _ := strconv.ParseInt(localLifeTaskInfo.TerminateOperator, 10, 64)
+					userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
+					reTalentDefault.OperatorName = userName
+				}
+			} else if defaultType == 5 {
+				reTalentDefault.DefaultTime = localLifeTaskInfo.CancelTime.Format("2006-01-02 15:04:05")
+				reTalentDefault.SettleAmount = localLifeTaskInfo.SettleAmount
+				reTalentDefault.Reason = localLifeTaskInfo.CancelReason
+				cancelOperatorType := localLifeTaskInfo.CancelOperatorType
+				if cancelOperatorType == 1 {
+					enterprise, _ := dao.EnterpriseDao{}.GetEnterprise(localLifeTaskInfo.CancelOperator)
+					reTalentDefault.OperatorName = enterprise.BusinessName
+				} else if cancelOperatorType == 2 {
+					operatorId, _ := strconv.ParseInt(localLifeTaskInfo.CancelOperator, 10, 64)
+					subAccount, _ := dao.SubAccountDao{}.GetSubAccount(operatorId)
+					reTalentDefault.OperatorName = subAccount.SubAccountName
+				} else if cancelOperatorType == 3 {
+					operatorId, _ := strconv.ParseInt(localLifeTaskInfo.CancelOperator, 10, 64)
+					userName, _ := dao.UserDao{}.GetNameByUserId(operatorId)
+					reTalentDefault.OperatorName = userName
+				}
+			}
+			reTalentDefaults = append(reTalentDefaults, reTalentDefault)
+		}
+		resultMap := make(map[string]interface{})
+		resultMap["cutRate"] = cutRate
+		resultMap["reTalentDefaults"] = reTalentDefaults
+		result = vo.ResultVO{
+			Page:     param.Page,
+			PageSize: param.PageSize,
+			Total:    total,
+			Data:     resultMap,
+		}
+		return result, nil
+
+	} else {
+		return result, nil
 	}
-	resultMap := make(map[string]interface{})
-	resultMap["cutRate"] = cutRate
-	resultMap["reTalentDefaults"] = reTalentDefaults
-	result = vo.ResultVO{
-		Page:     param.Page,
-		PageSize: param.PageSize,
-		Total:    total,
-		Data:     resultMap,
+}
+
+// 违约管理——公开任务-违约达人列表角标
+func (s DefaultService) GetPublicDefaultTalentCount(param *vo.DefaultSearchParam) (map[string]int64, error) {
+	res := make(map[string]int64)
+	var noSketchNum int64
+	var noLinkNum int64
+	var noDataNum int64
+	var endCooperationNum int64
+	if param.TaskType == 1 {
+		noSketchNum = dao.ProjectTaskInfoDao{}.CountByDefaultType(param.TaskId, 4)
+		noLinkNum = dao.ProjectTaskInfoDao{}.CountByDefaultType(param.TaskId, 6)
+		noDataNum = dao.ProjectTaskInfoDao{}.CountByDefaultType(param.TaskId, 8)
+		// 终止合作还是解约字段待确认
+		endCooperationNum = dao.ProjectTaskInfoDao{}.CountByTaskStage(param.TaskId, 16)
+	} else {
+		noSketchNum = dao.LocalLifeTaskInfoDao{}.CountByDefaultType(param.TaskId, 4)
+		noLinkNum = dao.LocalLifeTaskInfoDao{}.CountByDefaultType(param.TaskId, 6)
+		noDataNum = dao.LocalLifeTaskInfoDao{}.CountByDefaultType(param.TaskId, 8)
+		// 终止合作还是解约字段待确认
+		endCooperationNum = dao.LocalLifeTaskInfoDao{}.CountByTaskStage(param.TaskId, 16)
 	}
-	return result, nil
+	res["noSketchNum"] = noSketchNum
+	res["noLinkNum"] = noLinkNum
+	res["noDataNum"] = noDataNum
+	res["endCooperationNum"] = endCooperationNum
+
+	return res, nil
 }
 
 // 违约管理——定向任务-违约达人列表
@@ -259,16 +457,19 @@ func (s DefaultService) GetTargetDefaultTalentList(param *vo.DefaultSearchParam)
 	}
 	for _, projectTaskInfo := range projectTaskInfos {
 		talentId := projectTaskInfo.TalentID
-		talentPhone, _ := dao.TalentInfoDao{}.SelectTalentPhone(talentId)
-		platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.SelectUserInfo(talentId)
+		talentInfo, _ := dao.TalentInfoDao{}.GetTalentInfo(talentId)
+		platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(projectTaskInfo.OpenID)
 		reTalentDefault := &vo.ReTalentDefault{
 			TalentId:    talentId,
-			TalentPhone: *talentPhone,
+			TalentPhone: talentInfo.TalentPhoneNumber,
+			TaskId:      projectTaskInfo.TaskID,
 			DraftFee:    projectTaskInfo.DraftFee,
-			OpenId:      platformKuaishouUserInfo.OpenId,
+			OpenId:      platformKuaishouUserInfo.OpenID,
+			PlatformId:  platformKuaishouUserInfo.PlatformID,
 			NickName:    platformKuaishouUserInfo.NickName,
 			HeadUri:     platformKuaishouUserInfo.HeadUri,
-			City:        "-",
+			City:        platformKuaishouUserInfo.City,
+			Gender:      platformKuaishouUserInfo.Gender,
 		}
 		if defaultType == 4 {
 			reTalentDefault.DefaultTime = projectTaskInfo.TerminateTime.Format("2006-01-02 15:04:05")
@@ -326,13 +527,8 @@ func (s DefaultService) CancelTalent(param *vo.TalentCancelParam) error {
 		"cancel_reason": param.CancelReason,
 		"cancel_time":   time.Now(),
 	}
-	if param.SubAccountId == 0 {
-		updateData["cancel_operator_type"] = 1
-		updateData["cancel_operator"] = param.EnterpriseId
-	} else {
-		updateData["cancel_operator_type"] = 2
-		updateData["cancel_operator"] = strconv.FormatInt(param.SubAccountId, 10)
-	}
+	updateData["cancel_operator_type"] = 3
+	updateData["cancel_operator"] = ""
 	err := dao.ProjectTaskInfoDao{}.UpdateField(param.TaskId, updateData)
 	if err != nil {
 		return err
@@ -352,13 +548,8 @@ func (s DefaultService) CancelTalentList(param *vo.TalentCancelParam) error {
 		"cancel_reason": param.CancelReason,
 		"cancel_time":   time.Now(),
 	}
-	if param.SubAccountId == 0 {
-		updateData["cancel_operator_type"] = 1
-		updateData["cancel_operator"] = param.EnterpriseId
-	} else {
-		updateData["cancel_operator_type"] = 2
-		updateData["cancel_operator"] = strconv.FormatInt(param.SubAccountId, 10)
-	}
+	updateData["cancel_operator_type"] = 3
+	updateData["cancel_operator"] = ""
 	err := dao.ProjectTaskInfoDao{}.UpdateFieldBatch(param.TaskIds, updateData)
 	if err != nil {
 		return err

+ 1 - 1
app/service/enterprise_service.go

@@ -82,7 +82,7 @@ func calcTakegoodsInfo(dates []time.Time, enterpriseId string) vo.ReWorkspaceTak
 				currentCommission += enterprise.EstimatedCost * enterprise.CommissionRate
 				currentOrder += enterprise.SampleNum - enterprise.RemainNum
 				// 出单数量
-				currentPerson, _ = (&dao.SecTaskInfoDao{}).CountBySelectionId(enterprise.SelectionID)
+				currentPerson, _ = (&dao.SelectionTaskInfoDao{}).CountBySelectionId(enterprise.SelectionID)
 				currentCommissionRate = enterprise.SettlementAmount / float64(currentPerson)
 			}
 			// 带货数据

+ 60 - 0
app/service/invoice_service.go

@@ -307,3 +307,63 @@ func (s InvoiceService) GetBillableList(param *vo.InvoiceBillListParam) (vo.Resu
 	}
 	return result, nil
 }
+
+// 开票金额数据-已开票、可开票、开票中
+func (s InvoiceService) ShowInvoiceBill(param *vo.InvoiceBillListParam) (map[string]float64, error) {
+	resMap := make(map[string]float64)
+	// 可开票
+	selectionAmount1, err1 := dao.SelectionInfoDAO{}.GetSelectionFinished(param.EnterpriseId, 0)
+	if err1 != nil {
+		return resMap, err1
+	}
+	projectAmount1, err1 := dao.ProjectDAO{}.GetProjectFinished(param.EnterpriseId, 0)
+	if err1 != nil {
+		return resMap, err1
+	}
+	localLifeAmount1, err1 := dao.LocalLifeDao{}.GetLocalLifeFinished(param.EnterpriseId, 0)
+	if err1 != nil {
+		return resMap, err1
+	}
+	// 开票中
+	selectionAmount2, err2 := dao.SelectionInfoDAO{}.GetSelectionFinished(param.EnterpriseId, 1)
+	if err2 != nil {
+		return resMap, err2
+	}
+	projectAmount2, err2 := dao.ProjectDAO{}.GetProjectFinished(param.EnterpriseId, 1)
+	if err2 != nil {
+		return resMap, err2
+	}
+	localLifeAmount2, err2 := dao.LocalLifeDao{}.GetLocalLifeFinished(param.EnterpriseId, 1)
+	if err2 != nil {
+		return resMap, err2
+	}
+	// 已开票
+	selectionAmount3, err3 := dao.SelectionInfoDAO{}.GetSelectionFinished(param.EnterpriseId, 2)
+	if err3 != nil {
+		return resMap, err3
+	}
+	projectAmount3, err3 := dao.ProjectDAO{}.GetProjectFinished(param.EnterpriseId, 2)
+	if err3 != nil {
+		return resMap, err3
+	}
+	localLifeAmount3, err3 := dao.LocalLifeDao{}.GetLocalLifeFinished(param.EnterpriseId, 2)
+	if err3 != nil {
+		return resMap, err3
+	}
+
+	resMap["invoicableAmount"] = selectionAmount1 + projectAmount1 + localLifeAmount1
+	resMap["invoicingAmount"] = selectionAmount2 + projectAmount2 + localLifeAmount2
+	resMap["invoicedAmount"] = selectionAmount3 + projectAmount3 + localLifeAmount3
+
+	return resMap, nil
+}
+
+// 财务待办——开票中中金额
+func (s InvoiceService) GetFinance(param *vo.CommonParam) (float64, error) {
+	invoicingAmount, err := dao.InvoiceRecordDao{}.GetInvoiceAmount(param.EnterpriseId, 1)
+	if err != nil {
+		return 0, err
+	}
+
+	return invoicingAmount, nil
+}

+ 602 - 246
app/service/local_life_service.go

@@ -4,11 +4,11 @@ import (
 	"errors"
 	"github.com/sirupsen/logrus"
 	"reflect"
-	"strconv"
 	"strings"
 	"time"
 	"youngee_m_api/app/dao"
 	"youngee_m_api/app/entity"
+	"youngee_m_api/app/service/review_service"
 	"youngee_m_api/app/util"
 	"youngee_m_api/app/vo"
 )
@@ -27,7 +27,7 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
 	if product == nil {
 		return nil, errors.New("未找到关联门店")
 	}
-	// c)创建种草任务
+	// c)创建本地生活任务
 	var operatorType int64
 	if localCreateParam.SubAccountId == 0 {
 		operatorType = 1
@@ -71,6 +71,7 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
 		TaskForm:            localCreateParam.TaskForm,
 		ContentType:         localCreateParam.ContentType,
 		TaskDetail:          localCreateParam.TaskDetail,
+		Tools:               localCreateParam.Tools,
 	}
 	if localCreateParam.LocalType == 1 {
 		newLocalLife.ServiceChargeRate = localCreateParam.ServiceChargeRate
@@ -100,11 +101,6 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
 	}
 
 	if localCreateParam.LocalMaterial != nil {
-		// 删除已有示例
-		err = dao.LocalLifeMaterialDao{}.DeleteLocalMaterialByLocalId(localId)
-		if err != nil {
-			return nil, err
-		}
 		// 插入新的示例
 		for _, v := range localCreateParam.LocalMaterial {
 			material := entity.LocalLifeMaterial{
@@ -146,8 +142,8 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
 				totalRecruitNum += strategy.RecruitNumber
 				if strategy.FeeForm == 2 {
 					recruitStrategy.Offer = strategy.Offer
-					recruitStrategy.ServiceCharge = strategy.Offer * localCreateParam.ServiceChargeRate
-					recruitStrategy.TOffer = strategy.Offer * (1 - localCreateParam.ServiceChargeRate)
+					recruitStrategy.ServiceCharge = strategy.Offer * localCreateParam.ServiceChargeRate * 0.01
+					recruitStrategy.TOffer = strategy.Offer * (1 - localCreateParam.ServiceChargeRate*0.01)
 				}
 				recruits = append(recruits, recruitStrategy)
 			}
@@ -157,7 +153,11 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
 			}
 		}
 	}
-	_ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{LocalID: localId, EstimatedCost: estimatedCost})
+	_ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
+		LocalID:         localId,
+		EstimatedCost:   estimatedCost,
+		TotalRecruitNum: totalRecruitNum,
+	})
 
 	return &localId, nil
 }
@@ -207,8 +207,8 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
 				totalRecruitNum += strategy.RecruitNumber
 				if strategy.FeeForm == 2 {
 					recruitStrategy.Offer = strategy.Offer
-					recruitStrategy.ServiceCharge = strategy.Offer * localUpdateParam.ServiceChargeRate
-					recruitStrategy.TOffer = strategy.Offer * (1 - localUpdateParam.ServiceChargeRate)
+					recruitStrategy.ServiceCharge = strategy.Offer * localUpdateParam.ServiceChargeRate * 0.01
+					recruitStrategy.TOffer = strategy.Offer * (1 - localUpdateParam.ServiceChargeRate*0.01)
 				}
 				recruits = append(recruits, recruitStrategy)
 			}
@@ -240,14 +240,15 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
 		PromoteBody:       localUpdateParam.PromoteBody,
 		Donate:            localUpdateParam.Donate,
 		//TaskStatus:        localUpdateParam.LocalStatus,
-		LocalName:     localUpdateParam.LocalName,
-		TalentType:    localUpdateParam.TalentType,
-		RecruitDdl:    recruitDdl,
-		TaskForm:      localUpdateParam.TaskForm,
-		ContentType:   localUpdateParam.ContentType,
-		TaskDetail:    localUpdateParam.TaskDetail,
-		UpdatedAt:     t,
-		EstimatedCost: estimatedCost,
+		LocalName:       localUpdateParam.LocalName,
+		TalentType:      localUpdateParam.TalentType,
+		RecruitDdl:      recruitDdl,
+		TaskForm:        localUpdateParam.TaskForm,
+		ContentType:     localUpdateParam.ContentType,
+		TaskDetail:      localUpdateParam.TaskDetail,
+		UpdatedAt:       t,
+		EstimatedCost:   estimatedCost,
+		TotalRecruitNum: totalRecruitNum,
 	}
 	//if localUpdateParam.LocalStatus == 2 {
 	//	updateLocalLife.SubmitAt = t
@@ -398,15 +399,16 @@ func (s LocalLifeService) UpdateLocalTarget(localUpdateParam *vo.LocalUpdatePara
 		PromoteBody:       localUpdateParam.PromoteBody,
 		Donate:            localUpdateParam.Donate,
 		//TaskStatus:        localUpdateParam.LocalStatus,
-		LocalName:     localUpdateParam.LocalName,
-		TalentType:    localUpdateParam.TalentType,
-		RecruitDdl:    recruitDdl,
-		TaskForm:      localUpdateParam.TaskForm,
-		ContentType:   localUpdateParam.ContentType,
-		TaskDetail:    localUpdateParam.TaskDetail,
-		UpdatedAt:     t,
-		Tools:         localUpdateParam.Tools,
-		EstimatedCost: estimatedCost,
+		LocalName:       localUpdateParam.LocalName,
+		TalentType:      localUpdateParam.TalentType,
+		RecruitDdl:      recruitDdl,
+		TaskForm:        localUpdateParam.TaskForm,
+		ContentType:     localUpdateParam.ContentType,
+		TaskDetail:      localUpdateParam.TaskDetail,
+		UpdatedAt:       t,
+		Tools:           localUpdateParam.Tools,
+		EstimatedCost:   estimatedCost,
+		TotalRecruitNum: totalRecruitNum,
 	}
 	//if localUpdateParam.LocalStatus == 2 {
 	//	updateLocalLife.SubmitAt = t
@@ -491,12 +493,26 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 		logrus.Errorf("[localLifeDB service] call GetLocalById error,err:%+v", err)
 		return nil, err
 	}
+	if localLife == nil {
+		return nil, errors.New("数据不存在")
+	}
 	// 系统信息
+	reLocalDetail.LocalName = localLife.LocalName
 	reLocalDetail.LocalId = localId
 	reLocalDetail.LocalStatus = localLife.TaskStatus
 	reLocalDetail.LocalPlatform = localLife.LocalPlatform
 	reLocalDetail.CreatedAt = localLife.CreatedAt.Format("2006-01-02 15:04:05")
-	reLocalDetail.EstimatedCost = localLife.EstimatedCost // 预估成本
+	reLocalDetail.SubmitAt = localLife.SubmitAt.Format("2006-01-02 15:04:05")
+	reLocalDetail.PassAt = localLife.AutoFailAt.Format("2006-01-02 15:04:05")
+	reLocalDetail.AutoFailAt = localLife.AutoFailAt.Format("2006-01-02 15:04:05")
+	reLocalDetail.StartAt = localLife.PayAt.Format("2006-01-02 15:04:05")
+	reLocalDetail.FinishAt = localLife.FinishAt.Format("2006-01-02 15:04:05")
+	reLocalDetail.FailAt = localLife.FailAt.Format("2006-01-02 15:04:05")
+	if localLife.TaskStatus < 6 {
+		reLocalDetail.EstimatedCost = localLife.EstimatedCost
+	} else {
+		reLocalDetail.EstimatedCost = localLife.NeedPay
+	}
 	reLocalDetail.ServiceChargeRate = localLife.ServiceChargeRate
 	var creatorName, phone string
 	if localLife.OperatorType == 1 && localLife.SubAccountID == 0 {
@@ -517,7 +533,7 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 	// 关联主体
 	var reStore vo.ReStorePreview
 	store, err := dao.StoreDao{}.GetStoreByID(localLife.StoreID)
-	if err == nil {
+	if err == nil && store != nil {
 		photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
 		if e != nil {
 			photoUrl = ""
@@ -536,7 +552,7 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 	reLocalDetail.StoreInfo = &reStore
 	var reTeamBuying vo.ReTeamBuyingPreview
 	teamBuying, err := dao.TeamBuyingDao{}.GetTeamBuyingByID(localLife.TeamBuyingId)
-	if err == nil {
+	if err == nil && teamBuying != nil {
 		photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(teamBuying.TeamBuyingID)
 		if e != nil {
 			photoUrl = ""
@@ -584,12 +600,12 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 	reLocalDetail.TaskForm = localLife.TaskForm
 	reLocalDetail.ContentType = localLife.ContentType
 	reLocalDetail.TaskDetail = localLife.TaskDetail
-	taskBriefInfos, err := dao.ProjectBriefDao{}.GetProjectBriefInfo(localId)
+	taskBriefInfos, err := dao.LocalLifeBriefDao{}.GetLocalBriefInfo(localId)
 	if err != nil {
 		logrus.Errorf("[localLifeDB service] call GetProjectBriefInfo error,err:%+v", err)
 		return nil, err
 	}
-	taskMaterials, err := dao.ProjectMaterialDao{}.GetProjectMaterialInfo(localId)
+	taskMaterials, err := dao.LocalLifeMaterialDao{}.GetLocalMaterialInfo(localId)
 	if err != nil {
 		logrus.Errorf("[localLifeDB service] call GetprojectMaterialInfo error,err:%+v", err)
 		return nil, err
@@ -601,186 +617,321 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 	return &reLocalDetail, nil
 }
 
-//// 本地生活提交审核
-//func (s LocalLifeService) LocalLifeToReview(localUpdateParam *vo.LocalUpdateParam) (*string, error) {
-//	localId := localUpdateParam.LocalID
-//
-//	local, err := dao.LocalLifeDao{}.GetLocalById(localId)
-//	if err != nil {
-//		logrus.Errorf("[projectInfoDB service] call GetProject error,err:%+v", err)
-//		return nil, err
-//	}
-//
-//	localName := local.LocalName    // 任务标题
-//	localDetail := local.TaskDetail // 任务详情
-//	store, err := dao.StoreDao{}.GetStoreByID(local.StoreID)
-//	if err != nil {
-//		return nil, err
-//	}
-//	storeName := store.StoreName     // 门店名称
-//	storeDetail := store.StoreDetail // 门店特点
-//	storeMainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
-//	if err1 != nil {
-//		return nil, err1
-//	}
-//	teamBuying, err2 := dao.TeamBuyingDao{}.GetTeamBuyingByID(local.TeamBuyingId)
-//	if err2 != nil {
-//		return nil, err2
-//	}
-//	teamBuyingName := teamBuying.TeamBuyingName     // 团购标题
-//	teamBuyingDetail := teamBuying.TeamBuyingDetail // 团购详情
-//	teamBuyingMainPhoto, err3 := dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(teamBuying.TeamBuyingID)
-//	if err3 != nil {
-//		return nil, err3
-//	}
-//	var images []string
-//	var videos []string
-//	var videoJobIds []string
-//	var documents []string
-//	var documentJobIds []string
-//	reviewService := review_service.GetConfig()
-//
-//	storePhotos, err4 := dao.ProductPhotoDAO{}.GetProductPhotoByStoreID(local.StoreID)
-//	if err4 != nil {
-//		return nil, err4
-//	}
-//	for _, storePhoto := range storePhotos {
-//		if storePhoto.Symbol == 2 || storePhoto.Symbol == 4 {
-//			images = append(images, storePhoto.PhotoUrl)
-//		} else if storePhoto.Symbol == 3 || storePhoto.Symbol == 5 {
-//			var videoJobId *string
-//			var reviewErr error
-//			i := 10
-//			for {
-//				videoJobId, reviewErr = reviewService.CheckVideo(storePhoto.PhotoUrl)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			videos = append(videos, storePhoto.PhotoUrl)
-//			videoJobIds = append(videoJobIds, *videoJobId)
-//		}
-//	}
-//	teamBuyingPhotos, err5 := dao.ProductPhotoDAO{}.GetProductPhotoByTeamBuyingID(local.TeamBuyingId)
-//	if err5 != nil {
-//		return nil, err5
-//	}
-//	for _, teamBuyingPhoto := range teamBuyingPhotos {
-//		if teamBuyingPhoto.Symbol == 2 || teamBuyingPhoto.Symbol == 4 {
-//			images = append(images, teamBuyingPhoto.PhotoUrl)
-//		} else if teamBuyingPhoto.Symbol == 3 || teamBuyingPhoto.Symbol == 5 {
-//			var videoJobId *string
-//			var reviewErr error
-//			i := 10
-//			for {
-//				videoJobId, reviewErr = reviewService.CheckVideo(teamBuyingPhoto.PhotoUrl)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			videos = append(videos, teamBuyingPhoto.PhotoUrl)
-//			videoJobIds = append(videoJobIds, *videoJobId)
-//		}
-//	}
-//
-//	localBriefInfos, err6 := dao.LocalLifeBriefDao{}.GetLocalBriefInfo(localId)
-//	if err6 != nil {
-//		return nil, err6
-//	}
-//	for _, localBriefInfo := range localBriefInfos {
-//		if localBriefInfo.Type == 1 {
-//			images = append(images, localBriefInfo.FileUrl)
-//		} else if localBriefInfo.Type == 2 {
-//			var documentJobId *string
-//			var reviewErr error
-//			i := 10
-//			fileType := "pdf"
-//			parts := strings.Split(localBriefInfo.FileName, ".")
-//			if len(parts) > 1 {
-//				fileType = parts[len(parts)-1]
-//			}
-//			for {
-//				documentJobId, reviewErr = reviewService.CheckDocument(localBriefInfo.FileUrl, fileType)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			documents = append(documents, localBriefInfo.FileUrl)
-//			documentJobIds = append(documentJobIds, *documentJobId)
-//		}
-//	}
-//	localMaterials, err7 := dao.LocalLifeMaterialDao{}.GetLocalMaterialInfo(localId)
-//	if err7 != nil {
-//		return nil, err7
-//	}
-//	for _, localMaterial := range localMaterials {
-//		if localMaterial.Type == 1 {
-//			images = append(images, localMaterial.FileUrl)
-//		} else if localMaterial.Type == 2 {
-//			var videoJobId *string
-//			var reviewErr error
-//			i := 10
-//			for {
-//				videoJobId, reviewErr = reviewService.CheckVideo(localMaterial.FileUrl)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			videos = append(videos, localMaterial.FileUrl)
-//			videoJobIds = append(videoJobIds, *videoJobId)
-//		}
-//	}
-//
-//	newReviewLocal := &entity.ReviewLocalLife{
-//		LocalID:             localId,
-//		TaskName:            localName,
-//		TaskDetail:          localDetail,
-//		StoreMainPhoto:      storeMainPhoto,
-//		StoreName:           storeName,
-//		StoreDetail:         storeDetail,
-//		TeamBuyingMainPhoto: teamBuyingMainPhoto,
-//		TeamBuyingName:      teamBuyingName,
-//		TeamBuyingDetail:    teamBuyingDetail,
-//		Images:              strings.Join(images, ","),
-//		Videos:              strings.Join(videos, ","),
-//		Documents:           strings.Join(documents, ","),
-//		VideoJobIds:         strings.Join(videoJobIds, ","),
-//		DocumentJobIds:      strings.Join(documentJobIds, ","),
-//		Status:              1,
-//	}
-//	err8 := dao.LocalLifeReviewDao{}.Create(newReviewLocal)
-//	if err8 != nil {
-//		return nil, err8
-//	}
-//
-//	t := time.Now()
-//	updateLocal := entity.LocalLifeInfo{
-//		LocalID:    localId,
-//		TaskStatus: 2,
-//		UpdatedAt:  t,
-//	}
-//	err9 := dao.LocalLifeDao{}.UpdateLocal(updateLocal)
-//	if err9 != nil {
-//		return nil, err9
-//	}
-//	return &localId, nil
-//}
+// 复制本地生活任务
+func (s LocalLifeService) CopyLocalLife(param *vo.LocalSearchParam) (*string, error) {
+	localLifeOrigin, err := dao.LocalLifeDao{}.GetLocalById(param.LocalId)
+	if err != nil {
+		logrus.Errorf("[localLifeDB service] call GetLocalById error,err:%+v", err)
+		return nil, err
+	}
+	if localLifeOrigin == nil {
+		return nil, errors.New("任务不存在")
+	}
+	localIdOrigin := localLifeOrigin.LocalID
+	localIdNew := strings.ReplaceAll(util.GenerateUUID(11), "-", "")
+	t := time.Now()
+	// 获取定时任务配置id
+	infoAutoTask := entity.InfoAutoTask{}
+	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(localLifeOrigin.EnterpriseID)
+	infoAutoDefault := entity.InfoAutoDefault{}
+	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(localLifeOrigin.EnterpriseID)
+
+	// 复制任务
+	localLifeNew := entity.LocalLifeInfo{
+		EnterpriseID:        localLifeOrigin.EnterpriseID,
+		SubAccountID:        localLifeOrigin.SubAccountID,
+		OperatorType:        localLifeOrigin.OperatorType,
+		TaskStatus:          1,
+		LocalID:             localIdNew,
+		LocalType:           localLifeOrigin.LocalType,
+		LocalPlatform:       localLifeOrigin.LocalPlatform,
+		StoreID:             localLifeOrigin.StoreID,
+		StoreRelatedAt:      t,
+		PromoteBody:         localLifeOrigin.PromoteBody,
+		Donate:              localLifeOrigin.Donate,
+		TeamBuyingId:        localLifeOrigin.TeamBuyingId,
+		TeamBuyingRelatedAt: t,
+		CreatedAt:           t,
+		AutoTaskID:          infoAutoTask.AutoTaskID,
+		AutoDefaultID:       infoAutoDefault.AutoDefaultID,
+		LocalName:           localLifeOrigin.LocalName,
+		TalentType:          localLifeOrigin.TalentType,
+		RecruitDdl:          localLifeOrigin.RecruitDdl,
+		TaskForm:            localLifeOrigin.TaskForm,
+		ContentType:         localLifeOrigin.ContentType,
+		TaskDetail:          localLifeOrigin.TaskDetail,
+		Tools:               localLifeOrigin.Tools,
+		ServiceChargeRate:   localLifeOrigin.ServiceChargeRate,
+		EstimatedCost:       localLifeOrigin.EstimatedCost,
+	}
+	err = dao.LocalLifeDao{}.CreateLocalLife(localLifeNew)
+	if err != nil {
+		return nil, err
+	}
+
+	// 更新选品brief和示例(本地生活任务补充信息)
+	localBriefInfos, err := dao.LocalLifeBriefDao{}.GetLocalBriefInfo(localIdOrigin)
+	if err != nil {
+		logrus.Errorf("[projectDB service] call GetLocalBriefInfo error,err:%+v", err)
+		return nil, err
+	}
+	if localBriefInfos != nil {
+		for _, v := range localBriefInfos {
+			brief := entity.LocalLifeBrief{
+				LocalID:   localIdNew,
+				FileUid:   v.FileUid,
+				FileName:  v.FileName,
+				FileUrl:   v.FileUrl,
+				CreatedAt: time.Now(),
+				Type:      v.Type,
+			}
+			err = dao.LocalLifeBriefDao{}.CreateLocalBrief(brief)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+	localMaterials, err := dao.LocalLifeMaterialDao{}.GetLocalMaterialInfo(localIdOrigin)
+	if err != nil {
+		logrus.Errorf("[projectDB service] call GetLocalMaterialInfo error,err:%+v", err)
+		return nil, err
+	}
+	if localMaterials != nil {
+		for _, v := range localMaterials {
+			material := entity.LocalLifeMaterial{
+				LocalID:   localIdNew,
+				FileUid:   v.FileUid,
+				FileName:  v.FileName,
+				FileUrl:   v.FileUrl,
+				CreatedAt: time.Now(),
+				Type:      v.Type,
+			}
+			err = dao.LocalLifeMaterialDao{}.CreateLocalMaterial(material)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
+	// 更新本地生活任务的招募策略
+	recruitStrategys, err := dao.RecruitStrategyDao{}.GetRecruitStrategyByProjectId(localIdOrigin)
+	if err != nil {
+		logrus.Errorf("[localLifeDB service] call GetRecruitStrategy error,err:%+v", err)
+		return nil, err
+	}
+	var totalRecruitNum int64
+	if recruitStrategys != nil {
+		// 2. 接收并创建新的招募策略
+		if len(recruitStrategys) != 0 {
+			var recruits []entity.RecruitStrategy
+			for _, strategy := range recruitStrategys {
+				recruitStrategy := entity.RecruitStrategy{
+					FeeForm:       strategy.FeeForm,
+					StrategyID:    strategy.StrategyID,
+					FollowersLow:  strategy.FollowersLow,
+					FollowersUp:   strategy.FollowersUp,
+					RecruitNumber: strategy.RecruitNumber,
+					ProjectID:     localIdNew,
+					StrategyType:  strategy.StrategyType,
+					ServiceRate:   strategy.ServiceRate,
+					Offer:         strategy.Offer,
+					ServiceCharge: strategy.ServiceCharge,
+					TOffer:        strategy.TOffer,
+				}
+				totalRecruitNum += strategy.RecruitNumber
+				recruits = append(recruits, recruitStrategy)
+			}
+			err = dao.RecruitStrategyDao{}.CreateRecruitStrategy(recruits)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
+	return &localIdNew, nil
+}
+
+// 本地生活提交审核
+func (s LocalLifeService) LocalLifeToReview(localUpdateParam *vo.LocalUpdateParam) (*string, error) {
+	localId := localUpdateParam.LocalID
+
+	local, err := dao.LocalLifeDao{}.GetLocalById(localId)
+	if err != nil {
+		logrus.Errorf("[projectInfoDB service] call GetProject error,err:%+v", err)
+		return nil, err
+	}
+
+	localName := local.LocalName    // 任务标题
+	localDetail := local.TaskDetail // 任务详情
+	store, err := dao.StoreDao{}.GetStoreByID(local.StoreID)
+	if err != nil {
+		return nil, err
+	}
+	storeName := store.StoreName     // 门店名称
+	storeDetail := store.StoreDetail // 门店特点
+	storeMainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
+	if err1 != nil {
+		return nil, err1
+	}
+	teamBuying, err2 := dao.TeamBuyingDao{}.GetTeamBuyingByID(local.TeamBuyingId)
+	if err2 != nil {
+		return nil, err2
+	}
+	teamBuyingName := teamBuying.TeamBuyingName     // 团购标题
+	teamBuyingDetail := teamBuying.TeamBuyingDetail // 团购详情
+	teamBuyingMainPhoto, err3 := dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(teamBuying.TeamBuyingID)
+	if err3 != nil {
+		return nil, err3
+	}
+	var images []string
+	var videos []string
+	var videoJobIds []string
+	var documents []string
+	var documentJobIds []string
+	reviewService := review_service.GetConfig()
+
+	storePhotos, err4 := dao.ProductPhotoDAO{}.GetProductPhotoByStoreID(local.StoreID)
+	if err4 != nil {
+		return nil, err4
+	}
+	for _, storePhoto := range storePhotos {
+		if storePhoto.Symbol == 2 || storePhoto.Symbol == 4 {
+			images = append(images, storePhoto.PhotoUrl)
+		} else if storePhoto.Symbol == 3 || storePhoto.Symbol == 5 {
+			var videoJobId *string
+			var reviewErr error
+			i := 10
+			for {
+				videoJobId, reviewErr = reviewService.CheckVideo(storePhoto.PhotoUrl)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			videos = append(videos, storePhoto.PhotoUrl)
+			videoJobIds = append(videoJobIds, *videoJobId)
+		}
+	}
+	teamBuyingPhotos, err5 := dao.ProductPhotoDAO{}.GetProductPhotoByTeamBuyingID(local.TeamBuyingId)
+	if err5 != nil {
+		return nil, err5
+	}
+	for _, teamBuyingPhoto := range teamBuyingPhotos {
+		if teamBuyingPhoto.Symbol == 2 || teamBuyingPhoto.Symbol == 4 {
+			images = append(images, teamBuyingPhoto.PhotoUrl)
+		} else if teamBuyingPhoto.Symbol == 3 || teamBuyingPhoto.Symbol == 5 {
+			var videoJobId *string
+			var reviewErr error
+			i := 10
+			for {
+				videoJobId, reviewErr = reviewService.CheckVideo(teamBuyingPhoto.PhotoUrl)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			videos = append(videos, teamBuyingPhoto.PhotoUrl)
+			videoJobIds = append(videoJobIds, *videoJobId)
+		}
+	}
+
+	localBriefInfos, err6 := dao.LocalLifeBriefDao{}.GetLocalBriefInfo(localId)
+	if err6 != nil {
+		return nil, err6
+	}
+	for _, localBriefInfo := range localBriefInfos {
+		if localBriefInfo.Type == 1 {
+			images = append(images, localBriefInfo.FileUrl)
+		} else if localBriefInfo.Type == 2 {
+			var documentJobId *string
+			var reviewErr error
+			i := 10
+			fileType := "pdf"
+			parts := strings.Split(localBriefInfo.FileName, ".")
+			if len(parts) > 1 {
+				fileType = parts[len(parts)-1]
+			}
+			for {
+				documentJobId, reviewErr = reviewService.CheckDocument(localBriefInfo.FileUrl, fileType)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			documents = append(documents, localBriefInfo.FileUrl)
+			documentJobIds = append(documentJobIds, *documentJobId)
+		}
+	}
+	localMaterials, err7 := dao.LocalLifeMaterialDao{}.GetLocalMaterialInfo(localId)
+	if err7 != nil {
+		return nil, err7
+	}
+	for _, localMaterial := range localMaterials {
+		if localMaterial.Type == 1 {
+			images = append(images, localMaterial.FileUrl)
+		} else if localMaterial.Type == 2 {
+			var videoJobId *string
+			var reviewErr error
+			i := 10
+			for {
+				videoJobId, reviewErr = reviewService.CheckVideo(localMaterial.FileUrl)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			videos = append(videos, localMaterial.FileUrl)
+			videoJobIds = append(videoJobIds, *videoJobId)
+		}
+	}
+
+	newReviewLocal := &entity.ReviewLocalLife{
+		LocalID:             localId,
+		TaskName:            localName,
+		TaskDetail:          localDetail,
+		StoreMainPhoto:      storeMainPhoto,
+		StoreName:           storeName,
+		StoreDetail:         storeDetail,
+		TeamBuyingMainPhoto: teamBuyingMainPhoto,
+		TeamBuyingName:      teamBuyingName,
+		TeamBuyingDetail:    teamBuyingDetail,
+		Images:              strings.Join(images, ","),
+		Videos:              strings.Join(videos, ","),
+		Documents:           strings.Join(documents, ","),
+		VideoJobIds:         strings.Join(videoJobIds, ","),
+		DocumentJobIds:      strings.Join(documentJobIds, ","),
+		Status:              1,
+	}
+	err8 := dao.LocalLifeReviewDao{}.Create(newReviewLocal)
+	if err8 != nil {
+		return nil, err8
+	}
+
+	t := time.Now()
+	updateLocal := entity.LocalLifeInfo{
+		LocalID:    localId,
+		TaskStatus: 2,
+		SubmitAt:   t,
+		UpdatedAt:  t,
+	}
+	err9 := dao.LocalLifeDao{}.UpdateLocal(updateLocal)
+	if err9 != nil {
+		return nil, err9
+	}
+	return &localId, nil
+}
 
 // 本地生活任务列表
 func (s LocalLifeService) GetLocalLifeTaskList(param *vo.LocalSearchParam) (vo.ResultVO, error) {
@@ -841,6 +992,35 @@ func (s LocalLifeService) DeleteLocalLife(localId string) (*string, error) {
 	return res, nil
 }
 
+// 结束本地生活任务
+func (s LocalLifeService) CloseLocalLife(localId string) (string, error) {
+	// 任务待办:待审核、待支付、达人未处理、初稿待审、链接待审、待结算  (待发货、待签收)  达人待预约探店时间、探店时间待确认、达人待探店  未传初稿、未发作品、未传数据
+	// 合作待办:可邀约、邀约中、合作中
+	localLife, err := dao.LocalLifeDao{}.GetLocalById(localId)
+	if err != nil {
+		return "0", err
+	}
+	if localLife == nil {
+		return "0", errors.New("任务不存在")
+	}
+	var needProcess int64
+	if localLife.TaskStatus == 4 || localLife.TaskStatus == 8 {
+		// 达人未处理 or 物流待办 or 初稿待审、链接待审、待结算
+		_ = dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? and (task_status = ? or task_stage < ?)", localId, 1, 15).Count(&needProcess).Error // task_status=1待选
+	}
+	if localLife.TaskStatus == 2 || localLife.TaskStatus == 4 || needProcess > 0 {
+		// 存在待办不可结束
+		return "1", nil
+	} else {
+		err := dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
+			LocalID:    localId,
+			TaskStatus: 10,
+			UpdatedAt:  time.Now(),
+		})
+		return "0", err
+	}
+}
+
 // 草稿箱——本地生活
 func (s LocalLifeService) GetLocalLifeDraftList(param *vo.LocalDraftParam) (vo.ResultVO, error) {
 	if param.Page == 0 {
@@ -959,34 +1139,27 @@ func (s LocalLifeService) GetStoreExploreInfo(param *vo.StoreExploreParam) (*vo.
 	var err error
 	localLifeId := param.LocalLifeId
 	if param.Status == 1 { // 待预约
-		localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 1, "", param.Page, param.PageSize)
+		localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 4, "", param.Page, param.PageSize)
 	} else if param.Status == 2 { // 待确认
-		localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 2, param.SearchTime, param.Page, param.PageSize)
-	} else if param.Status == 3 { // 待探店
 		localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 5, param.SearchTime, param.Page, param.PageSize)
+	} else if param.Status == 3 { // 待探店
+		localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByBookStatus(localLifeId, 5, param.SearchTime, param.Page, param.PageSize)
 	} else if param.Status == 4 { // 已探店
-		localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 6, param.SearchTime, param.Page, param.PageSize)
+		localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByBookStatus(localLifeId, 6, param.SearchTime, param.Page, param.PageSize)
 	}
 	if err != nil {
 		return nil, err
 	}
 	for _, localLifeTaskInfo := range localLifeTaskInfos {
 		// 获取达人信息
-		talentInfo, err := dao.TalentInfoDao{}.SelectTalentInfo(localLifeTaskInfo.TalentID)
-		if err != nil {
-			return nil, err
-		}
-		//regionName, err := dao.RegionInfoDao{}.SelectRegion(talentInfo.VisitStoreRegion)
-		//if err != nil {
-		//	regionName = ""
-		//}
-		regionName := localLifeTaskInfo.City
+		platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(localLifeTaskInfo.OpenID)
 		talentPreview := &vo.TalentPreview{
 			TalentId:    localLifeTaskInfo.TalentID,
-			TalentPhoto: talentInfo.Avatar,
-			TalentName:  talentInfo.TalentWxNickname,
-			Account:     "",
-			Location:    regionName,
+			TalentPhoto: platformKuaishouUserInfo.HeadUri,
+			TalentName:  platformKuaishouUserInfo.NickName,
+			Account:     platformKuaishouUserInfo.OpenID,
+			Location:    platformKuaishouUserInfo.City,
+			Gender:      platformKuaishouUserInfo.Gender,
 		}
 		reStoreExploreTalent := &vo.ReStoreExploreTalent{
 			ReTalentPreview: talentPreview,
@@ -1014,6 +1187,25 @@ func (s LocalLifeService) GetStoreExploreInfo(param *vo.StoreExploreParam) (*vo.
 	return &result, nil
 }
 
+// 探店达人列表角标
+func (t LocalLifeService) StoreExploreInfoCount(param *vo.StoreExploreParam) map[string]int64 {
+	res := make(map[string]int64)
+	var needBook int64
+	var needConfirm int64
+	var needExplore int64
+	var explored int64
+	dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND task_stage = ?", param.LocalLifeId, 4).Count(&needBook)
+	dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND task_stage = ?", param.LocalLifeId, 5).Count(&needConfirm)
+	dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND book_status = ?", param.LocalLifeId, 5).Count(&needExplore)
+	dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND book_status = ?", param.LocalLifeId, 6).Count(&explored)
+	res["needBook"] = needBook
+	res["needConfirm"] = needConfirm
+	res["needExplore"] = needExplore
+	res["explored"] = explored
+
+	return res
+}
+
 // 终止合作
 func (s LocalLifeService) StoreExploreOver(param *vo.LocalTalentOperateParam) (*string, error) {
 	taskId := param.TaskId
@@ -1025,13 +1217,8 @@ func (s LocalLifeService) StoreExploreOver(param *vo.LocalTalentOperateParam) (*
 		"terminate_reason": param.Reason,
 		"terminate_time":   time.Now(),
 	}
-	if param.SubAccountId == 0 {
-		updateData["terminate_operator_type"] = 1
-		updateData["terminate_operator"] = param.EnterpriseId
-	} else {
-		updateData["terminate_operator_type"] = 2
-		updateData["terminate_operator"] = param.SubAccountId
-	}
+	updateData["terminate_operator_type"] = 3
+	updateData["terminate_operator"] = ""
 	err := dao.LocalLifeTaskInfoDao{}.UpdateField(param.TaskId, updateData)
 	if err != nil {
 		return nil, err
@@ -1070,20 +1257,17 @@ func (s LocalLifeService) StoreExploreOperate(param *vo.LocalTalentOperateParam)
 	} else {
 		return errors.New("status error")
 	}
-	if param.SubAccountId == 0 {
-		bookinfoNew.BOperatorType = 1
-		bookinfoNew.BOperator = param.EnterpriseId
-	} else {
-		bookinfoNew.BOperatorType = 2
-		bookinfoNew.BOperator = strconv.FormatInt(param.SubAccountId, 10)
-	}
+	bookinfoNew.BOperatorType = 3
+	bookinfoNew.BOperator = ""
 	err1 := dao.BookInfoDao{}.UpdateBookStatus(bookIds, bookinfoNew)
 	if err1 != nil {
 		return err1
 	}
 	if param.Status == 1 {
 		err2 := dao.LocalLifeTaskInfoDao{}.UpdateLocalStatus(taskIds, entity.LocalLifeTaskInfo{
-			TaskStage: 7,
+			TaskStage:   7,
+			BookStatus:  5,
+			ExploreTime: time.Now(),
 		})
 		if err2 != nil {
 			return err2
@@ -1092,3 +1276,175 @@ func (s LocalLifeService) StoreExploreOperate(param *vo.LocalTalentOperateParam)
 
 	return nil
 }
+
+// 本地生活任务待办
+func (p LocalLifeService) GetTaskToDo(enterpriseId string, subAccountId int64, taskType int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	redbook, err1 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 1, taskType)
+	if err1 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err1)
+		return res, err1
+	}
+	douyin, err2 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 2, taskType)
+	if err2 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err2)
+		return res, err2
+	}
+	kuaishou, err3 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 4, taskType)
+	if err3 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err3)
+		return res, err3
+	}
+	weibo, err4 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 3, taskType)
+	if err4 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err4)
+		return res, err4
+	}
+	bilibili, err5 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 5, taskType)
+	if err5 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err5)
+		return res, err5
+	}
+	all := make(map[string]int64)
+	all["needReview"] = redbook["needReview"] + douyin["needReview"] + kuaishou["needReview"] + weibo["needReview"] + bilibili["needReview"]
+	all["needPay"] = redbook["needPay"] + douyin["needPay"] + kuaishou["needPay"] + weibo["needPay"] + bilibili["needPay"]
+	all["needProcess"] = redbook["needProcess"] + douyin["needProcess"] + kuaishou["needProcess"] + weibo["needProcess"] + bilibili["needProcess"]
+	all["needCheck"] = redbook["needCheck"] + douyin["needCheck"] + kuaishou["needCheck"] + weibo["needCheck"] + bilibili["needCheck"]
+	all["needQuality"] = redbook["needQuality"] + douyin["needQuality"] + kuaishou["needQuality"] + weibo["needQuality"] + bilibili["needQuality"]
+	all["needCalculate"] = redbook["needCalculate"] + douyin["needCalculate"] + kuaishou["needCalculate"] + weibo["needCalculate"] + bilibili["needCalculate"]
+	res["redbook"] = redbook
+	res["douyin"] = douyin
+	res["kuaishou"] = kuaishou
+	res["weibo"] = weibo
+	res["bilibili"] = bilibili
+	res["all"] = all
+
+	return res, nil
+}
+
+// 探店邀约任务待办
+func (p LocalLifeService) GetExploreToDo(enterpriseId string, subAccountId int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	redbook, err1 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 1)
+	if err1 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err1)
+		return res, err1
+	}
+	douyin, err2 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 2)
+	if err2 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err2)
+		return res, err2
+	}
+	kuaishou, err3 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 4)
+	if err3 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err3)
+		return res, err3
+	}
+	weibo, err4 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 3)
+	if err4 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err4)
+		return res, err4
+	}
+	bilibili, err5 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 5)
+	if err5 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err5)
+		return res, err5
+	}
+	all := make(map[string]int64)
+	all["needBook"] = redbook["needBook"] + douyin["needBook"] + kuaishou["needBook"] + weibo["needBook"] + bilibili["needBook"]
+	all["needConfirm"] = redbook["needConfirm"] + douyin["needConfirm"] + kuaishou["needConfirm"] + weibo["needConfirm"] + bilibili["needConfirm"]
+	all["needExplore"] = redbook["needExplore"] + douyin["needExplore"] + kuaishou["needExplore"] + weibo["needExplore"] + bilibili["needExplore"]
+	res["redbook"] = redbook
+	res["douyin"] = douyin
+	res["kuaishou"] = kuaishou
+	res["weibo"] = weibo
+	res["bilibili"] = bilibili
+	res["all"] = all
+
+	return res, nil
+}
+
+// 违约管理任务待办
+func (p LocalLifeService) GetDefaultToDo(enterpriseId string, subAccountId int64, taskType int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	redbook, err1 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 1, taskType)
+	if err1 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err1)
+		return res, err1
+	}
+	douyin, err2 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 2, taskType)
+	if err2 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err2)
+		return res, err2
+	}
+	kuaishou, err3 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 4, taskType)
+	if err3 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err3)
+		return res, err3
+	}
+	weibo, err4 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 3, taskType)
+	if err4 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err4)
+		return res, err4
+	}
+	bilibili, err5 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 5, taskType)
+	if err5 != nil {
+		logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err5)
+		return res, err5
+	}
+	all := make(map[string]int64)
+	all["noSketch"] = redbook["noSketch"] + douyin["noSketch"] + kuaishou["noSketch"] + weibo["noSketch"] + bilibili["noSketch"]
+	all["noWork"] = redbook["noWork"] + douyin["noWork"] + kuaishou["noWork"] + weibo["noWork"] + bilibili["noWork"]
+	all["noData"] = redbook["noData"] + douyin["noData"] + kuaishou["noData"] + weibo["noData"] + bilibili["noData"]
+	all["cooperateOver"] = redbook["cooperateOver"] + douyin["cooperateOver"] + kuaishou["cooperateOver"] + weibo["cooperateOver"] + bilibili["cooperateOver"]
+	res["redbook"] = redbook
+	res["douyin"] = douyin
+	res["kuaishou"] = kuaishou
+	res["weibo"] = weibo
+	res["bilibili"] = bilibili
+	res["all"] = all
+
+	return res, nil
+}
+
+// 合作待办-任务邀约
+func (p LocalLifeService) GetTaskInviteToDo(enterpriseId string, subAccountId int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	redbook, err1 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 1)
+	if err1 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err1)
+		return res, err1
+	}
+	douyin, err2 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 2)
+	if err2 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err2)
+		return res, err2
+	}
+	kuaishou, err3 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 4)
+	if err3 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err3)
+		return res, err3
+	}
+	weibo, err4 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 3)
+	if err4 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err4)
+		return res, err4
+	}
+	bilibili, err5 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 5)
+	if err5 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err5)
+		return res, err5
+	}
+	all := make(map[string]int64)
+	all["availInvitationNum"] = redbook["availInvitationNum"] + douyin["availInvitationNum"] + kuaishou["availInvitationNum"] + weibo["availInvitationNum"] + bilibili["availInvitationNum"]
+	all["invitingNum"] = redbook["invitingNum"] + douyin["invitingNum"] + kuaishou["invitingNum"] + weibo["invitingNum"] + bilibili["invitingNum"]
+	all["cooperatingNum"] = redbook["cooperatingNum"] + douyin["cooperatingNum"] + kuaishou["cooperatingNum"] + weibo["cooperatingNum"] + bilibili["cooperatingNum"]
+	res["redbook"] = redbook
+	res["douyin"] = douyin
+	res["kuaishou"] = kuaishou
+	res["weibo"] = weibo
+	res["bilibili"] = bilibili
+	res["all"] = all
+
+	return res, nil
+}

+ 29 - 0
app/service/product_service.go

@@ -80,6 +80,15 @@ func (p ProductService) GetTaskProductsByUserId(param vo.GetAllProductParam) (vo
 }
 
 func (p ProductService) CreateProduct(productCreateParam *vo.ProductCreateParam) (int64, error) {
+	if len(productCreateParam.ProductPhotos) == 0 {
+		return 0, errors.New("商品主图不能为空!")
+	}
+	if productCreateParam.ProductType == 1 {
+		count := dao.ProductDAO{}.CheckKuaishouProduct(productCreateParam.EnterpriseId, productCreateParam.ProductId)
+		if count > 0 {
+			return 0, errors.New("该快手商品已存在!")
+		}
+	}
 	product := entity.Product{
 		ProductType:         productCreateParam.ProductType,
 		KuaishouProductId:   productCreateParam.ProductId,
@@ -209,6 +218,26 @@ func (p ProductService) DeleteProduct(param *vo.ProductUpdateParam) (int64, erro
 	return param.ProductId, nil
 }
 
+// 商品列表-角标
+func (t ProductService) CountProduct(param *vo.GetAllProductParam) map[string]int64 {
+	res := make(map[string]int64)
+	var commonProduct int64
+	var kuaishouProduct int64
+	if param.ProductTitle != "" {
+		dao.Db.Model(&entity.Product{}).Where("enterprise_id = ? sub_account_id = ? and product_type = ? AND is_deleted = 0 and product_name LIKE ?", param.EnterpriseId, param.SubAccountId, 0, "%"+param.ProductTitle+"%").Count(&commonProduct)
+		dao.Db.Model(&entity.Product{}).Where("enterprise_id = ? sub_account_id = ? and product_type = ? AND is_deleted = 0 and product_name LIKE ?", param.EnterpriseId, param.SubAccountId, 1, "%"+param.ProductTitle+"%").Count(&kuaishouProduct)
+
+	} else {
+		dao.Db.Model(&entity.Product{}).Where("enterprise_id = ? sub_account_id = ? and product_type = ? AND is_deleted = 0", param.EnterpriseId, param.SubAccountId, 0).Count(&commonProduct)
+		dao.Db.Model(&entity.Product{}).Where("enterprise_id = ? sub_account_id = ? and product_type = ? AND is_deleted = 0", param.EnterpriseId, param.SubAccountId, 1).Count(&kuaishouProduct)
+
+	}
+	res["commonProduct"] = commonProduct
+	res["kuaishouProduct"] = kuaishouProduct
+
+	return res
+}
+
 // 获取商品类目
 func (p ProductService) GetProductCategorys() ([]string, error) {
 	var categorys []string

+ 504 - 149
app/service/project_service.go

@@ -9,6 +9,7 @@ import (
 	"time"
 	"youngee_m_api/app/dao"
 	"youngee_m_api/app/entity"
+	"youngee_m_api/app/service/review_service"
 	"youngee_m_api/app/util"
 	"youngee_m_api/app/vo"
 )
@@ -142,8 +143,8 @@ func (s ProjectService) CreateProject(projectCreateParam *vo.ProjectCreateParam)
 				totalRecruitNum += strategy.RecruitNumber
 				if strategy.FeeForm == 2 {
 					recruitStrategy.Offer = strategy.Offer
-					recruitStrategy.ServiceCharge = strategy.Offer * projectCreateParam.ServiceChargeRate
-					recruitStrategy.TOffer = strategy.Offer * (1 - projectCreateParam.ServiceChargeRate)
+					recruitStrategy.ServiceCharge = strategy.Offer * projectCreateParam.ServiceChargeRate * 0.01
+					recruitStrategy.TOffer = strategy.Offer * (1 - projectCreateParam.ServiceChargeRate*0.01)
 				}
 				recruits = append(recruits, recruitStrategy)
 			}
@@ -154,8 +155,9 @@ func (s ProjectService) CreateProject(projectCreateParam *vo.ProjectCreateParam)
 		}
 	}
 	_ = dao.ProjectDAO{}.UpdateProject(entity.Project{
-		ProjectId:     projectId,
-		EstimatedCost: estimatedCost,
+		ProjectId:       projectId,
+		EstimatedCost:   estimatedCost,
+		TotalRecruitNum: totalRecruitNum,
 	})
 
 	return &projectId, nil
@@ -206,8 +208,8 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 				totalRecruitNum += strategy.RecruitNumber
 				if strategy.FeeForm == 2 {
 					recruitStrategy.Offer = strategy.Offer
-					recruitStrategy.ServiceCharge = strategy.Offer * projectUpdateParam.ServiceChargeRate
-					recruitStrategy.TOffer = strategy.Offer * (1 - projectUpdateParam.ServiceChargeRate)
+					recruitStrategy.ServiceCharge = strategy.Offer * projectUpdateParam.ServiceChargeRate * 0.01
+					recruitStrategy.TOffer = strategy.Offer * (1 - projectUpdateParam.ServiceChargeRate*0.01)
 				}
 				recruits = append(recruits, recruitStrategy)
 			}
@@ -256,6 +258,7 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 		ContentType:       projectUpdateParam.ContentType,
 		ProjectDetail:     projectUpdateParam.ProjectDetail,
 		EstimatedCost:     estimatedCost,
+		TotalRecruitNum:   totalRecruitNum,
 	}
 	//if projectUpdateParam.ProjectStatus == 2 {
 	//	updateProject.SubmitAt = t
@@ -423,6 +426,8 @@ func (s ProjectService) UpdateProjectTarget(projectUpdateParam *vo.ProjectUpdate
 		ContentType:      projectUpdateParam.ContentType,
 		ProjectDetail:    projectUpdateParam.ProjectDetail,
 		Tools:            projectUpdateParam.Tools,
+		EstimatedCost:    estimatedCost,
+		TotalRecruitNum:  totalRecruitNum,
 	}
 	//if projectUpdateParam.ProjectStatus == 2 {
 	//	updateProject.SubmitAt = t
@@ -506,13 +511,26 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 		logrus.Errorf("[projectDB service] call GetProject error,err:%+v", err)
 		return nil, err
 	}
+	if project == nil {
+		return nil, errors.New("数据不存在")
+	}
 	reProjectDetail.ProjectName = project.ProjectName
 	// 系统信息
 	reProjectDetail.ProjectId = projectId
 	reProjectDetail.ProjectStatus = project.ProjectStatus
 	reProjectDetail.ProjectPlatform = project.ProjectPlatform
 	reProjectDetail.CreatedAt = project.CreatedAt.Format("2006-01-02 15:04:05")
-	reProjectDetail.EstimatedCost = project.EstimatedCost
+	reProjectDetail.SubmitAt = project.SubmitAt.Format("2006-01-02 15:04:05")
+	reProjectDetail.PassAt = project.PassAt.Format("2006-01-02 15:04:05")
+	reProjectDetail.AutoFailAt = project.AutoFailAt.Format("2006-01-02 15:04:05")
+	reProjectDetail.StartAt = project.PayAt.Format("2006-01-02 15:04:05")
+	reProjectDetail.FinishAt = project.FinishAt.Format("2006-01-02 15:04:05")
+	reProjectDetail.FailAt = project.FailAt.Format("2006-01-02 15:04:05")
+	if project.ProjectStatus < 6 {
+		reProjectDetail.EstimatedCost = project.EstimatedCost
+	} else {
+		reProjectDetail.EstimatedCost = project.NeedPay
+	}
 	reProjectDetail.ServiceChargeRate = project.ServiceChargeRate
 	var creatorName, phone string
 	if project.SubAccountId == 0 {
@@ -595,148 +613,285 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 	return &reProjectDetail, nil
 }
 
-//// 种草提交审核
-//func (s ProjectService) ProjectToReview(projectUpdateParam *vo.ProjectUpdateParam) (*string, error) {
-//	projectId := projectUpdateParam.ProjectID
-//
-//	project, err := dao.ProjectDAO{}.GetProjectById(projectId)
-//	if err != nil {
-//		logrus.Errorf("[projectInfoDB service] call GetProject error,err:%+v", err)
-//		return nil, err
-//	}
-//
-//	projectName := project.ProjectName     // 任务标题
-//	projectDetail := project.ProjectDetail // 任务详情
-//	product, err := dao.ProductDAO{}.GetProductByID(project.ProductID)
-//	if err != nil {
-//		return nil, err
-//	}
-//	productName := product.ProductName     // 商品标题
-//	productDetail := product.ProductDetail // 卖点总结
-//	mainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByProductID(project.ProductID)
-//	if err1 != nil {
-//		return nil, err1
-//	}
-//	var images []string
-//	var videos []string
-//	var videoJobIds []string
-//	var documents []string
-//	var documentJobIds []string
-//	reviewService := review_service.GetConfig()
-//
-//	productPhotos, err2 := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(project.ProductID)
-//	if err2 != nil {
-//		return nil, err2
-//	}
-//	for _, productPhoto := range productPhotos {
-//		if productPhoto.Symbol == 2 || productPhoto.Symbol == 4 {
-//			images = append(images, productPhoto.PhotoUrl)
-//		} else if productPhoto.Symbol == 3 || productPhoto.Symbol == 5 {
-//			var videoJobId *string
-//			var reviewErr error
-//			i := 10
-//			for {
-//				videoJobId, reviewErr = reviewService.CheckVideo(productPhoto.PhotoUrl)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			videos = append(videos, productPhoto.PhotoUrl)
-//			videoJobIds = append(videoJobIds, *videoJobId)
-//		}
-//	}
-//
-//	projectBriefInfos, err := dao.ProjectBriefDao{}.GetProjectBriefInfo(projectId)
-//	if err != nil {
-//		return nil, err
-//	}
-//	for _, projectBriefInfo := range projectBriefInfos {
-//		if projectBriefInfo.Type == 1 {
-//			images = append(images, projectBriefInfo.FileUrl)
-//		} else if projectBriefInfo.Type == 2 {
-//			var documentJobId *string
-//			var reviewErr error
-//			i := 10
-//			fileType := "pdf"
-//			parts := strings.Split(projectBriefInfo.FileName, ".")
-//			if len(parts) > 1 {
-//				fileType = parts[len(parts)-1]
-//			}
-//			for {
-//				documentJobId, reviewErr = reviewService.CheckDocument(projectBriefInfo.FileUrl, fileType)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			documents = append(documents, projectBriefInfo.FileUrl)
-//			documentJobIds = append(documentJobIds, *documentJobId)
-//		}
-//	}
-//	projectMaterials, err := dao.ProjectMaterialDao{}.GetProjectMaterialInfo(projectId)
-//	if err != nil {
-//		return nil, err
-//	}
-//	for _, projectMaterial := range projectMaterials {
-//		if projectMaterial.Type == 1 {
-//			images = append(images, projectMaterial.FileUrl)
-//		} else if projectMaterial.Type == 2 {
-//			var videoJobId *string
-//			var reviewErr error
-//			i := 10
-//			for {
-//				videoJobId, reviewErr = reviewService.CheckVideo(projectMaterial.FileUrl)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			videos = append(videos, projectMaterial.FileUrl)
-//			videoJobIds = append(videoJobIds, *videoJobId)
-//		}
-//	}
-//
-//	newReviewProject := &entity.ReviewProject{
-//		ProjectID:      projectId,
-//		TaskName:       projectName,
-//		TaskDetail:     projectDetail,
-//		ProductName:    productName,
-//		ProductDetail:  productDetail,
-//		MainPhoto:      mainPhoto,
-//		Images:         strings.Join(images, ","),
-//		Videos:         strings.Join(videos, ","),
-//		Documents:      strings.Join(documents, ","),
-//		VideoJobIds:    strings.Join(videoJobIds, ","),
-//		DocumentJobIds: strings.Join(documentJobIds, ","),
-//		Status:         1,
-//	}
-//	err5 := dao.ProjectReviewDao{}.Create(newReviewProject)
-//	if err5 != nil {
-//		return nil, err5
-//	}
-//
-//	t := time.Now()
-//	updateProject := entity.Project{
-//		ProjectId:     projectId,
-//		ProjectStatus: 2,
-//		UpdatedAt:     t,
-//	}
-//	err6 := dao.ProjectDAO{}.UpdateProject(updateProject)
-//	if err6 != nil {
-//		return nil, err
-//	}
-//	return &projectId, nil
-//}
+// 复制种草任务
+func (s ProjectService) CopyProject(param *vo.ProjectSearchParam) (*string, error) {
+	projectOrigin, err := dao.ProjectDAO{}.GetProjectById(param.ProjectId)
+	if err != nil {
+		logrus.Errorf("[projectDB service] call GetProject error,err:%+v", err)
+		return nil, err
+	}
+	if projectOrigin == nil {
+		return nil, errors.New("任务不存在")
+	}
+	projectIdOrigin := projectOrigin.ProjectId
+	projectIdNew := strings.ReplaceAll(util.GenerateUUID(11), "-", "")
+	t := time.Now()
+	// 获取定时任务配置id
+	infoAutoTask := entity.InfoAutoTask{}
+	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(projectOrigin.EnterpriseID)
+	infoAutoDefault := entity.InfoAutoDefault{}
+	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(projectOrigin.EnterpriseID)
+
+	// 复制任务
+	projectNew := entity.Project{
+		ProjectStatus:     1,
+		ProjectType:       projectOrigin.ProjectType,
+		ProjectId:         projectIdNew,
+		ProductID:         projectOrigin.ProductID,
+		ProductCategory:   projectOrigin.ProductCategory,
+		EnterpriseID:      projectOrigin.EnterpriseID,
+		SubAccountId:      projectOrigin.SubAccountId,
+		ProjectPlatform:   projectOrigin.ProjectPlatform,
+		OperatorType:      projectOrigin.OperatorType,
+		ProductSnap:       projectOrigin.ProductSnap,
+		ProductPhotoSnap:  projectOrigin.ProductPhotoSnap,
+		CreatedAt:         t,
+		AutoTaskID:        infoAutoTask.AutoTaskID,
+		AutoDefaultID:     infoAutoDefault.AutoDefaultID,
+		ProjectName:       projectOrigin.ProjectName,
+		TalentType:        projectOrigin.TalentType,
+		RecruitDdl:        projectOrigin.RecruitDdl,
+		ProjectForm:       projectOrigin.ProjectForm,
+		ContentType:       projectOrigin.ContentType,
+		ProjectDetail:     projectOrigin.ProjectDetail,
+		Tools:             projectOrigin.Tools,
+		ServiceChargeRate: projectOrigin.ServiceChargeRate,
+		EstimatedCost:     projectOrigin.EstimatedCost,
+	}
+	err = dao.ProjectDAO{}.CreateProject(projectNew)
+	if err != nil {
+		return nil, err
+	}
+
+	// 更新选品brief和示例(种草任务补充信息)
+	projectBriefInfos, err := dao.ProjectBriefDao{}.GetProjectBriefInfo(projectIdOrigin)
+	if err != nil {
+		logrus.Errorf("[projectDB service] call GetProjectBriefInfo error,err:%+v", err)
+		return nil, err
+	}
+	if projectBriefInfos != nil {
+		for _, v := range projectBriefInfos {
+			brief := entity.ProjectBrief{
+				ProjectID: projectIdNew,
+				FileUid:   v.FileUid,
+				FileName:  v.FileName,
+				FileUrl:   v.FileUrl,
+				CreatedAt: time.Now(),
+				Type:      v.Type,
+			}
+			err = dao.ProjectBriefDao{}.CreateProjectBrief(brief)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+	projectMaterials, err := dao.ProjectMaterialDao{}.GetProjectMaterialInfo(projectIdOrigin)
+	if err != nil {
+		logrus.Errorf("[projectDB service] call GetprojectMaterialInfo error,err:%+v", err)
+		return nil, err
+	}
+	if projectMaterials != nil {
+		// 插入新的示例
+		for _, v := range projectMaterials {
+			projectMaterial := entity.ProjectMaterial{
+				ProjectID: projectIdNew,
+				FileUid:   v.FileUid,
+				FileName:  v.FileName,
+				FileUrl:   v.FileUrl,
+				CreatedAt: time.Now(),
+				Type:      v.Type,
+			}
+			err = dao.ProjectMaterialDao{}.CreateProjectMaterial(projectMaterial)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+	// 更新种草任务的招募策略
+	recruitStrategys, err := dao.RecruitStrategyDao{}.GetRecruitStrategyByProjectId(projectIdOrigin)
+	if err != nil {
+		logrus.Errorf("[projectDB service] call GetRecruitStrategy error,err:%+v", err)
+		return nil, err
+	}
+	var totalRecruitNum int64
+	var estimatedCost float64
+	if recruitStrategys != nil {
+		// 2. 接收并创建新的招募策略
+		if len(recruitStrategys) != 0 {
+			var recruits []entity.RecruitStrategy
+			for _, strategy := range recruitStrategys {
+				if strategy.FeeForm == 2 {
+					estimatedCost += float64(strategy.RecruitNumber) * strategy.Offer
+				}
+				recruitStrategy := entity.RecruitStrategy{
+					FeeForm:       strategy.FeeForm,
+					StrategyID:    strategy.StrategyID,
+					FollowersLow:  strategy.FollowersLow,
+					FollowersUp:   strategy.FollowersUp,
+					RecruitNumber: strategy.RecruitNumber,
+					ProjectID:     projectIdNew,
+					StrategyType:  strategy.StrategyType,
+					ServiceRate:   strategy.ServiceRate,
+					Offer:         strategy.Offer,
+					ServiceCharge: strategy.ServiceCharge,
+					TOffer:        strategy.TOffer,
+				}
+				totalRecruitNum += strategy.RecruitNumber
+				recruits = append(recruits, recruitStrategy)
+			}
+			err = dao.RecruitStrategyDao{}.CreateRecruitStrategy(recruits)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
+	return &projectIdNew, nil
+}
+
+// 种草提交审核
+func (s ProjectService) ProjectToReview(projectUpdateParam *vo.ProjectUpdateParam) (*string, error) {
+	projectId := projectUpdateParam.ProjectID
+
+	project, err := dao.ProjectDAO{}.GetProjectById(projectId)
+	if err != nil {
+		logrus.Errorf("[projectInfoDB service] call GetProject error,err:%+v", err)
+		return nil, err
+	}
+
+	projectName := project.ProjectName     // 任务标题
+	projectDetail := project.ProjectDetail // 任务详情
+	product, err := dao.ProductDAO{}.GetProductByID(project.ProductID)
+	if err != nil {
+		return nil, err
+	}
+	productName := product.ProductName     // 商品标题
+	productDetail := product.ProductDetail // 卖点总结
+	mainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByProductID(project.ProductID)
+	if err1 != nil {
+		return nil, err1
+	}
+	var images []string
+	var videos []string
+	var videoJobIds []string
+	var documents []string
+	var documentJobIds []string
+	reviewService := review_service.GetConfig()
+
+	productPhotos, err2 := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(project.ProductID)
+	if err2 != nil {
+		return nil, err2
+	}
+	for _, productPhoto := range productPhotos {
+		if productPhoto.Symbol == 2 || productPhoto.Symbol == 4 {
+			images = append(images, productPhoto.PhotoUrl)
+		} else if productPhoto.Symbol == 3 || productPhoto.Symbol == 5 {
+			var videoJobId *string
+			var reviewErr error
+			i := 10
+			for {
+				videoJobId, reviewErr = reviewService.CheckVideo(productPhoto.PhotoUrl)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			videos = append(videos, productPhoto.PhotoUrl)
+			videoJobIds = append(videoJobIds, *videoJobId)
+		}
+	}
+
+	projectBriefInfos, err := dao.ProjectBriefDao{}.GetProjectBriefInfo(projectId)
+	if err != nil {
+		return nil, err
+	}
+	for _, projectBriefInfo := range projectBriefInfos {
+		if projectBriefInfo.Type == 1 {
+			images = append(images, projectBriefInfo.FileUrl)
+		} else if projectBriefInfo.Type == 2 {
+			var documentJobId *string
+			var reviewErr error
+			i := 10
+			fileType := "pdf"
+			parts := strings.Split(projectBriefInfo.FileName, ".")
+			if len(parts) > 1 {
+				fileType = parts[len(parts)-1]
+			}
+			for {
+				documentJobId, reviewErr = reviewService.CheckDocument(projectBriefInfo.FileUrl, fileType)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			documents = append(documents, projectBriefInfo.FileUrl)
+			documentJobIds = append(documentJobIds, *documentJobId)
+		}
+	}
+	projectMaterials, err := dao.ProjectMaterialDao{}.GetProjectMaterialInfo(projectId)
+	if err != nil {
+		return nil, err
+	}
+	for _, projectMaterial := range projectMaterials {
+		if projectMaterial.Type == 1 {
+			images = append(images, projectMaterial.FileUrl)
+		} else if projectMaterial.Type == 2 {
+			var videoJobId *string
+			var reviewErr error
+			i := 10
+			for {
+				videoJobId, reviewErr = reviewService.CheckVideo(projectMaterial.FileUrl)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			videos = append(videos, projectMaterial.FileUrl)
+			videoJobIds = append(videoJobIds, *videoJobId)
+		}
+	}
+
+	newReviewProject := &entity.ReviewProject{
+		ProjectID:      projectId,
+		TaskName:       projectName,
+		TaskDetail:     projectDetail,
+		ProductName:    productName,
+		ProductDetail:  productDetail,
+		MainPhoto:      mainPhoto,
+		Images:         strings.Join(images, ","),
+		Videos:         strings.Join(videos, ","),
+		Documents:      strings.Join(documents, ","),
+		VideoJobIds:    strings.Join(videoJobIds, ","),
+		DocumentJobIds: strings.Join(documentJobIds, ","),
+		Status:         1,
+	}
+	err5 := dao.ProjectReviewDao{}.Create(newReviewProject)
+	if err5 != nil {
+		return nil, err5
+	}
+
+	t := time.Now()
+	updateProject := entity.Project{
+		ProjectId:     projectId,
+		ProjectStatus: 2,
+		SubmitAt:      t,
+		UpdatedAt:     t,
+	}
+	err6 := dao.ProjectDAO{}.UpdateProject(updateProject)
+	if err6 != nil {
+		return nil, err
+	}
+	return &projectId, nil
+}
 
 // 种草任务列表
 func (s ProjectService) GetProjectTaskList(param *vo.ProjectSearchParam) (vo.ResultVO, error) {
@@ -797,6 +952,35 @@ func (s ProjectService) DeleteProject(projectId string) (*string, error) {
 	return res, nil
 }
 
+// 结束种草任务
+func (s ProjectService) CloseProject(projectId string) (string, error) {
+	// 任务待办:待审核、待支付、达人未处理、初稿待审、链接待审、待结算  待发货、待签收  未传初稿、未发作品、未传数据
+	// 合作待办:可邀约、邀约中、合作中
+	project, err := dao.ProjectDAO{}.GetProjectById(projectId)
+	if err != nil {
+		return "0", err
+	}
+	if project == nil {
+		return "0", errors.New("任务不存在")
+	}
+	var needProcess int64
+	if project.ProjectStatus == 4 || project.ProjectStatus == 8 {
+		// 达人未处理 or 物流待办 or 初稿待审、链接待审、待结算
+		_ = dao.Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? and (task_status = ? or task_stage < ?)", projectId, 1, 15).Count(&needProcess).Error // task_status=1待选
+	}
+	if project.ProjectStatus == 2 || project.ProjectStatus == 4 || needProcess > 0 {
+		// 存在待办不可结束
+		return "1", nil
+	} else {
+		err := dao.ProjectDAO{}.UpdateProject(entity.Project{
+			ProjectId:     projectId,
+			ProjectStatus: 10,
+			UpdatedAt:     time.Now(),
+		})
+		return "0", err
+	}
+}
+
 // 草稿箱——品牌种草
 func (s ProjectService) GetProjectDraftList(param *vo.ProjectDraftParam) (vo.ResultVO, error) {
 	if param.Page == 0 {
@@ -862,3 +1046,174 @@ func (p ProjectService) GetTalentCategory() ([]vo.ReTalentCategory, error) {
 	}
 	return reTalentCategories, nil
 }
+
+// 种草任务待办
+func (p ProjectService) GetTaskToDo(enterpriseId string, subAccountId int64, taskType int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	redbook, err1 := dao.ProjectDAO{}.GetProjectToDo(enterpriseId, subAccountId, 1, taskType)
+	if err1 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err1)
+		return res, err1
+	}
+	douyin, err2 := dao.ProjectDAO{}.GetProjectToDo(enterpriseId, subAccountId, 2, taskType)
+	if err2 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err2)
+		return res, err2
+	}
+	kuaishou, err3 := dao.ProjectDAO{}.GetProjectToDo(enterpriseId, subAccountId, 4, taskType)
+	if err3 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err3)
+		return res, err3
+	}
+	weibo, err4 := dao.ProjectDAO{}.GetProjectToDo(enterpriseId, subAccountId, 3, taskType)
+	if err4 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err4)
+		return res, err4
+	}
+	bilibili, err5 := dao.ProjectDAO{}.GetProjectToDo(enterpriseId, subAccountId, 5, taskType)
+	if err5 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err5)
+		return res, err5
+	}
+	all := make(map[string]int64)
+	all["needReview"] = redbook["needReview"] + douyin["needReview"] + kuaishou["needReview"] + weibo["needReview"] + bilibili["needReview"]
+	all["needPay"] = redbook["needPay"] + douyin["needPay"] + kuaishou["needPay"] + weibo["needPay"] + bilibili["needPay"]
+	all["needProcess"] = redbook["needProcess"] + douyin["needProcess"] + kuaishou["needProcess"] + weibo["needProcess"] + bilibili["needProcess"]
+	all["needCheck"] = redbook["needCheck"] + douyin["needCheck"] + kuaishou["needCheck"] + weibo["needCheck"] + bilibili["needCheck"]
+	all["needQuality"] = redbook["needQuality"] + douyin["needQuality"] + kuaishou["needQuality"] + weibo["needQuality"] + bilibili["needQuality"]
+	all["needCalculate"] = redbook["needCalculate"] + douyin["needCalculate"] + kuaishou["needCalculate"] + weibo["needCalculate"] + bilibili["needCalculate"]
+	res["redbook"] = redbook
+	res["douyin"] = douyin
+	res["kuaishou"] = kuaishou
+	res["weibo"] = weibo
+	res["bilibili"] = bilibili
+	res["all"] = all
+
+	return res, nil
+}
+
+// 寄样物流任务待办
+func (p ProjectService) GetLogisticsToDo(enterpriseId string, subAccountId int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	redbook, err1 := dao.ProjectDAO{}.GetLogisticsToDo(enterpriseId, subAccountId, 1)
+	if err1 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err1)
+		return res, err1
+	}
+	douyin, err2 := dao.ProjectDAO{}.GetLogisticsToDo(enterpriseId, subAccountId, 2)
+	if err2 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err2)
+		return res, err2
+	}
+	kuaishou, err3 := dao.ProjectDAO{}.GetLogisticsToDo(enterpriseId, subAccountId, 4)
+	if err3 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err3)
+		return res, err3
+	}
+	weibo, err4 := dao.ProjectDAO{}.GetLogisticsToDo(enterpriseId, subAccountId, 3)
+	if err4 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err4)
+		return res, err4
+	}
+	bilibili, err5 := dao.ProjectDAO{}.GetLogisticsToDo(enterpriseId, subAccountId, 5)
+	if err5 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err5)
+		return res, err5
+	}
+	all := make(map[string]int64)
+	all["needDelivery"] = redbook["needDelivery"] + douyin["needDelivery"] + kuaishou["needDelivery"] + weibo["needDelivery"] + bilibili["needDelivery"]
+	all["needReceive"] = redbook["needReceive"] + douyin["needReceive"] + kuaishou["needReceive"] + weibo["needReceive"] + bilibili["needReceive"]
+	res["redbook"] = redbook
+	res["douyin"] = douyin
+	res["kuaishou"] = kuaishou
+	res["weibo"] = weibo
+	res["bilibili"] = bilibili
+	res["all"] = all
+
+	return res, nil
+}
+
+// 违约管理任务待办
+func (p ProjectService) GetDefaultToDo(enterpriseId string, subAccountId int64, taskType int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	redbook, err1 := dao.ProjectDAO{}.GetDefaultToDo(enterpriseId, subAccountId, 1, taskType)
+	if err1 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err1)
+		return res, err1
+	}
+	douyin, err2 := dao.ProjectDAO{}.GetDefaultToDo(enterpriseId, subAccountId, 2, taskType)
+	if err2 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err2)
+		return res, err2
+	}
+	kuaishou, err3 := dao.ProjectDAO{}.GetDefaultToDo(enterpriseId, subAccountId, 4, taskType)
+	if err3 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err3)
+		return res, err3
+	}
+	weibo, err4 := dao.ProjectDAO{}.GetDefaultToDo(enterpriseId, subAccountId, 3, taskType)
+	if err4 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err4)
+		return res, err4
+	}
+	bilibili, err5 := dao.ProjectDAO{}.GetDefaultToDo(enterpriseId, subAccountId, 5, taskType)
+	if err5 != nil {
+		logrus.Errorf("[GetProjectToDo service] call GetProjectToDo error,err:%+v", err5)
+		return res, err5
+	}
+	all := make(map[string]int64)
+	all["noSketch"] = redbook["noSketch"] + douyin["noSketch"] + kuaishou["noSketch"] + weibo["noSketch"] + bilibili["noSketch"]
+	all["noWork"] = redbook["noWork"] + douyin["noWork"] + kuaishou["noWork"] + weibo["noWork"] + bilibili["noWork"]
+	all["noData"] = redbook["noData"] + douyin["noData"] + kuaishou["noData"] + weibo["noData"] + bilibili["noData"]
+	all["cooperateOver"] = redbook["cooperateOver"] + douyin["cooperateOver"] + kuaishou["cooperateOver"] + weibo["cooperateOver"] + bilibili["cooperateOver"]
+	res["redbook"] = redbook
+	res["douyin"] = douyin
+	res["kuaishou"] = kuaishou
+	res["weibo"] = weibo
+	res["bilibili"] = bilibili
+	res["all"] = all
+
+	return res, nil
+}
+
+// 合作待办-任务邀约
+func (p ProjectService) GetTaskInviteToDo(enterpriseId string, subAccountId int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	redbook, err1 := dao.ProjectDAO{}.GetTaskInviteToDo(enterpriseId, subAccountId, 1)
+	if err1 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err1)
+		return res, err1
+	}
+	douyin, err2 := dao.ProjectDAO{}.GetTaskInviteToDo(enterpriseId, subAccountId, 2)
+	if err2 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err2)
+		return res, err2
+	}
+	kuaishou, err3 := dao.ProjectDAO{}.GetTaskInviteToDo(enterpriseId, subAccountId, 4)
+	if err3 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err3)
+		return res, err3
+	}
+	weibo, err4 := dao.ProjectDAO{}.GetTaskInviteToDo(enterpriseId, subAccountId, 3)
+	if err4 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err4)
+		return res, err4
+	}
+	bilibili, err5 := dao.ProjectDAO{}.GetTaskInviteToDo(enterpriseId, subAccountId, 5)
+	if err5 != nil {
+		logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err5)
+		return res, err5
+	}
+	all := make(map[string]int64)
+	all["availInvitationNum"] = redbook["availInvitationNum"] + douyin["availInvitationNum"] + kuaishou["availInvitationNum"] + weibo["availInvitationNum"] + bilibili["availInvitationNum"]
+	all["invitingNum"] = redbook["invitingNum"] + douyin["invitingNum"] + kuaishou["invitingNum"] + weibo["invitingNum"] + bilibili["invitingNum"]
+	all["cooperatingNum"] = redbook["cooperatingNum"] + douyin["cooperatingNum"] + kuaishou["cooperatingNum"] + weibo["cooperatingNum"] + bilibili["cooperatingNum"]
+	res["redbook"] = redbook
+	res["douyin"] = douyin
+	res["kuaishou"] = kuaishou
+	res["weibo"] = weibo
+	res["bilibili"] = bilibili
+	res["all"] = all
+
+	return res, nil
+}

+ 56 - 2
app/service/recharge_service.go

@@ -302,7 +302,7 @@ func (s RechargeService) FrozenInfoList(param *vo.BalanceParam) (vo.ResultVO, er
 			Platform:      project.ProjectPlatform,
 			CreatorName:   creatorName,
 			TaskType:      "品牌种草",
-			FrozenBalance: project.PaymentAmount,
+			FrozenBalance: project.NeedPay,
 			FrozenTime:    project.PayAt.Format("2006-01-02 15:04:05"),
 			EnterpriseId:  project.EnterpriseID,
 			SubAccountId:  project.SubAccountId,
@@ -339,6 +339,26 @@ func (s RechargeService) FrozenInfoList(param *vo.BalanceParam) (vo.ResultVO, er
 	return result, nil
 }
 
+// 余额管理——冻结记录-角标
+func (t RechargeService) FrozenInfoCount(param *vo.BalanceParam) map[string]int64 {
+	res := make(map[string]int64)
+	var blockNum1 int64
+	var blockNum2 int64
+	var blockReleaseNum1 int64
+	var blockReleaseNum2 int64
+	// 冻结中
+	dao.Db.Model(entity.SelectionInfo{}).Where(fmt.Sprintf("enterprise_id = ? AND (selection_status between 5 and 6) "), param.EnterpriseId).Count(&blockNum1)
+	dao.Db.Model(entity.Project{}).Where(fmt.Sprintf("enterprise_id = ? AND project_type = ? AND (project_status between 7 and 8) "), param.EnterpriseId, 1).Count(&blockNum2)
+	// 冻结解除
+	dao.Db.Model(entity.SelectionInfo{}).Where(fmt.Sprintf("enterprise_id = ? AND (selection_status between 7 and 8) "), param.EnterpriseId).Count(&blockReleaseNum1)
+	dao.Db.Model(entity.Project{}).Where(fmt.Sprintf("enterprise_id = ? AND project_type = ? AND (project_status between 9 and 10) "), param.EnterpriseId, 1).Count(&blockReleaseNum2)
+
+	res["blockNum"] = blockNum1 + blockNum2
+	res["blockReleaseNum"] = blockReleaseNum1 + blockReleaseNum2
+
+	return res
+}
+
 // 充值管理——累计充值金额、确认中金额
 func (s RechargeService) ShowRecharge(param *vo.RechargeParam) (*vo.ReRechargeShow, error) {
 	reRechargeShow := new(vo.ReRechargeShow)
@@ -393,11 +413,45 @@ func (s RechargeService) RechargeInfoList(param *vo.RechargeParam) (vo.ResultVO,
 		}
 		reRechargeInfos = append(reRechargeInfos, reRechargeInfo)
 	}
+	//rechargingNum, _ := dao.RechargeRecordDao{}.RechargeStatusCount(param.EnterpriseId, 1)
+	//rechargedNum, _ := dao.RechargeRecordDao{}.RechargeStatusCount(param.EnterpriseId, 2)
+	//failNum, _ := dao.RechargeRecordDao{}.RechargeStatusCount(param.EnterpriseId, 3)
+	resMap := make(map[string]interface{})
+	//resMap["rechargingNum"] = rechargingNum
+	//resMap["rechargedNum"] = rechargedNum
+	//resMap["failNum"] = failNum
+	resMap["reRechargeInfos"] = reRechargeInfos
 	result = vo.ResultVO{
 		Page:     param.Page,
 		PageSize: param.PageSize,
 		Total:    total,
-		Data:     reRechargeInfos,
+		Data:     resMap,
 	}
 	return result, nil
 }
+
+// 余额管理——冻结记录-角标
+func (t RechargeService) RechargeInfoCount(param *vo.RechargeParam) map[string]int64 {
+	res := make(map[string]int64)
+	var rechargeConfirming int64
+	var recharged int64
+	var rechargeFail int64
+	dao.Db.Model(&entity.RechargeRecord{}).Where("enterprise_id = ? AND status = ?", param.EnterpriseId, 1).Count(&rechargeConfirming)
+	dao.Db.Model(&entity.RechargeRecord{}).Where("enterprise_id = ? AND status = ?", param.EnterpriseId, 2).Count(&recharged)
+	dao.Db.Model(&entity.RechargeRecord{}).Where("enterprise_id = ? AND status = ?", param.EnterpriseId, 3).Count(&rechargeFail)
+	res["rechargeConfirming"] = rechargeConfirming
+	res["recharged"] = recharged
+	res["rechargeFail"] = rechargeFail
+
+	return res
+}
+
+// 财务待办——充值确认中金额
+func (s RechargeService) GetFinance(param *vo.CommonParam) (float64, error) {
+	confirmingRecharge, err := dao.RechargeRecordDao{}.GetRechargeAmount(param.EnterpriseId, 1)
+	if err != nil {
+		return 0, err
+	}
+
+	return confirmingRecharge, nil
+}

+ 39 - 43
app/service/review_service/business_license_check.go

@@ -1,45 +1,41 @@
 package review_service
 
-//
-//import (
-//	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ocr/v1/model"
-//	"youngee_m_api/app/dao"
-//	"youngee_m_api/app/entity"
-//	"youngee_m_api/app/vo"
-//)
-//
-//func (c *Config) CheckBusinessLicense(param *vo.IdentifyParam) (map[string]string, error) {
-//	request := &model.RecognizeBusinessLicenseRequest{}
-//	request.Body = &model.BusinessLicenseRequestBody{
-//		Url: &param.BusinessLicenseUrl,
-//	}
-//	response, err := c.OcrClient.RecognizeBusinessLicense(request)
-//	if err != nil {
-//		//if err.StatusCode == 400 {
-//		//	return "false", err
-//		//}
-//		return nil, err
-//	}
-//	result := response.Result
-//	registrationNumber := result.RegistrationNumber
-//	companyName := result.Name
-//	address := result.Address
-//	bodyType := result.Type // 公司/企业类型/主体类型/类型
-//	err1 := dao.EnterpriseDao{}.UpdateEnterprise(entity.Enterprise{
-//		EnterpriseID: param.EnterpriseId,
-//		BusinessName: *companyName,
-//		TaxNumber:    *registrationNumber,
-//		Address:      *address,
-//		AuthStatus:   1,
-//	})
-//	if err1 != nil {
-//		return nil, err1
-//	}
-//	resultMap := make(map[string]string)
-//	resultMap["registrationNumber"] = *registrationNumber // 企业税号
-//	resultMap["companyName"] = *companyName
-//	resultMap["address"] = *address
-//	resultMap["type"] = *bodyType
-//
-//	return resultMap, nil
-//}
+import (
+	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ocr/v1/model"
+	"youngee_m_api/app/dao"
+	"youngee_m_api/app/entity"
+	"youngee_m_api/app/vo"
+)
+
+func (c *Config) CheckBusinessLicense(param *vo.IdentifyParam) (map[string]string, error) {
+	request := &model.RecognizeBusinessLicenseRequest{}
+	request.Body = &model.BusinessLicenseRequestBody{
+		Url: &param.BusinessLicenseUrl,
+	}
+	response, err := c.OcrClient.RecognizeBusinessLicense(request)
+	if err != nil {
+		return nil, err
+	}
+	result := response.Result
+	registrationNumber := result.RegistrationNumber
+	companyName := result.Name
+	address := result.Address
+	bodyType := result.Type // 公司/企业类型/主体类型/类型
+	err1 := dao.EnterpriseDao{}.UpdateEnterprise(entity.Enterprise{
+		EnterpriseID: param.EnterpriseId,
+		BusinessName: *companyName,
+		TaxNumber:    *registrationNumber,
+		Address:      *address,
+		AuthStatus:   1,
+	})
+	if err1 != nil {
+		return nil, err1
+	}
+	resultMap := make(map[string]string)
+	resultMap["registrationNumber"] = *registrationNumber // 企业税号
+	resultMap["companyName"] = *companyName
+	resultMap["address"] = *address
+	resultMap["type"] = *bodyType
+
+	return resultMap, nil
+}

+ 69 - 70
app/service/review_service/config.go

@@ -1,72 +1,71 @@
 package review_service
 
-//
-//import (
-//	"encoding/json"
-//	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
-//	moderation "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3"
-//	moderationRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/region"
-//	ocr "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ocr/v1"
-//	ocrRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ocr/v1/region"
-//	"io/ioutil"
-//	"log"
-//	"sync"
-//)
-//
-//type Config struct {
-//	Ak        string                       `json:"review_ak"`
-//	Sk        string                       `json:"review_sk"`
-//	ProjectId string                       `json:"project_id"`
-//	Client    *moderation.ModerationClient `json:"client"`
-//	OcrClient *ocr.OcrClient               `json:"ocr_client"`
-//}
-//
-//const configFile = "app/config/review_config.json"
-//
-//var configInstance *Config
-//var once sync.Once
-//
-//// 加载配置文件
-//func loadConfig() *Config {
-//	data, err := ioutil.ReadFile(configFile)
-//	if err != nil {
-//		log.Fatalf("Failed to read config file: %v", err)
-//	}
-//
-//	var config Config
-//	err = json.Unmarshal(data, &config)
-//	if err != nil {
-//		log.Fatalf("Failed to parse config file: %v", err)
-//	}
-//
-//	auth := basic.NewCredentialsBuilder().
-//		WithAk(config.Ak).
-//		WithSk(config.Sk).
-//		//WithProjectId(projectId).
-//		Build()
-//
-//	client := moderation.NewModerationClient(
-//		moderation.ModerationClientBuilder().
-//			WithRegion(moderationRegion.ValueOf("cn-north-4")).
-//			WithCredential(auth).
-//			Build())
-//
-//	ocrClient := ocr.NewOcrClient(
-//		ocr.OcrClientBuilder().
-//			WithRegion(ocrRegion.ValueOf("cn-north-4")).
-//			WithCredential(auth).
-//			Build())
-//
-//	config.Client = client
-//	config.OcrClient = ocrClient
-//
-//	return &config
-//}
-//
-//// 获取配置的单例实例
-//func GetConfig() *Config {
-//	once.Do(func() {
-//		configInstance = loadConfig()
-//	})
-//	return configInstance
-//}
+import (
+	"encoding/json"
+	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
+	moderation "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3"
+	moderationRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/region"
+	ocr "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ocr/v1"
+	ocrRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/ocr/v1/region"
+	"io/ioutil"
+	"log"
+	"sync"
+)
+
+type Config struct {
+	Ak        string                       `json:"review_ak"`
+	Sk        string                       `json:"review_sk"`
+	ProjectId string                       `json:"project_id"`
+	Client    *moderation.ModerationClient `json:"client"`
+	OcrClient *ocr.OcrClient               `json:"ocr_client"`
+}
+
+const configFile = "app/config/review_config.json"
+
+var configInstance *Config
+var once sync.Once
+
+// 加载配置文件
+func loadConfig() *Config {
+	data, err := ioutil.ReadFile(configFile)
+	if err != nil {
+		log.Fatalf("Failed to read config file: %v", err)
+	}
+
+	var config Config
+	err = json.Unmarshal(data, &config)
+	if err != nil {
+		log.Fatalf("Failed to parse config file: %v", err)
+	}
+
+	auth := basic.NewCredentialsBuilder().
+		WithAk(config.Ak).
+		WithSk(config.Sk).
+		//WithProjectId(projectId).
+		Build()
+
+	client := moderation.NewModerationClient(
+		moderation.ModerationClientBuilder().
+			WithRegion(moderationRegion.ValueOf("cn-north-4")).
+			WithCredential(auth).
+			Build())
+
+	ocrClient := ocr.NewOcrClient(
+		ocr.OcrClientBuilder().
+			WithRegion(ocrRegion.ValueOf("cn-north-4")).
+			WithCredential(auth).
+			Build())
+
+	config.Client = client
+	config.OcrClient = ocrClient
+
+	return &config
+}
+
+// 获取配置的单例实例
+func GetConfig() *Config {
+	once.Do(func() {
+		configInstance = loadConfig()
+	})
+	return configInstance
+}

+ 163 - 164
app/service/review_service/review_service.go

@@ -1,166 +1,165 @@
 package review_service
 
-//
-//import (
-//	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/model"
-//)
-//
-///*
-//result.suggestion:
-//
-//	block:包含敏感信息,不通过
-//	review:需要人工复检
-//	pass:不包含敏感信息,通过
-//*/
-//func (c *Config) CheckContent(text string) (*string, error) {
-//	request := &model.RunTextModerationRequest{}
-//	request.EnterpriseProjectId = &c.ProjectId
-//	eventType := "article"
-//	listCategoriesbody := []string{
-//		"terrorism", "porn", "ban", "abuse",
-//	}
-//	databody := model.TextDetectionDataReq{
-//		Text: text,
-//	}
-//	request.Body = &model.TextDetectionReq{
-//		Data:       &databody,
-//		EventType:  &eventType,
-//		Categories: &listCategoriesbody,
-//	}
-//	response, err := c.Client.RunTextModeration(request)
-//	if err != nil {
-//		res := "文本审核服务异常"
-//		return &res, err
-//	}
-//	result := response.Result
-//	suggestion := result.Suggestion
-//
-//	return suggestion, nil
-//}
-//
-///*
-//result.suggestion:
-//
-//	block:包含敏感信息,不通过
-//	review:需要人工复检
-//	pass:不包含敏感信息,通过
-//*/
-//func (c *Config) CheckImage(imageUrl string) (*string, error) {
-//	request := &model.CheckImageModerationRequest{}
-//	listCategoriesbody := []string{
-//		"terrorism", "porn",
-//	}
-//	eventType := "head_image"
-//	request.Body = &model.ImageDetectionReq{
-//		Url:        &imageUrl,
-//		Categories: &listCategoriesbody,
-//		EventType:  &eventType,
-//	}
-//	response, err := c.Client.CheckImageModeration(request)
-//	if err != nil {
-//		res := "图片审核服务异常"
-//		return &res, err
-//	}
-//	result := response.Result
-//	suggestion := result.Suggestion
-//
-//	return suggestion, nil
-//}
-//
-//func (c *Config) CheckVideo(videoUrl string) (*string, error) {
-//	request := &model.RunCreateVideoModerationJobRequest{}
-//	var listAudioCategoriesbody = []model.VideoCreateRequestAudioCategories{
-//		model.GetVideoCreateRequestAudioCategoriesEnum().PORN, model.GetVideoCreateRequestAudioCategoriesEnum().MOAN, model.GetVideoCreateRequestAudioCategoriesEnum().ABUSE,
-//	}
-//	var listImageCategoriesbody = []model.VideoCreateRequestImageCategories{
-//		model.GetVideoCreateRequestImageCategoriesEnum().PORN, model.GetVideoCreateRequestImageCategoriesEnum().TERRORISM,
-//	}
-//	var eventType = model.GetVideoCreateRequestEventTypeEnum().DEFAULT
-//	frameIntervalData := int32(2)
-//	databody := &model.VideoCreateRequestData{
-//		Url:           videoUrl,
-//		FrameInterval: &frameIntervalData, // 截帧频率间隔
-//	}
-//	//callbackVideoCreateRequest := "http://xxx.xx.xxxx"
-//	request.Body = &model.VideoCreateRequest{
-//		AudioCategories: &listAudioCategoriesbody, // 视频中音频需要检测的风险类型
-//		ImageCategories: &listImageCategoriesbody, // 视频中画面需要检测的风险类型
-//		EventType:       &eventType,
-//		Data:            databody,
-//		//Callback:        &callbackVideoCreateRequest,
-//	}
-//	response, err := c.Client.RunCreateVideoModerationJob(request)
-//	if err != nil {
-//		res := "视频审核服务异常"
-//		return &res, err
-//	}
-//	jobId := response.JobId
-//
-//	return jobId, nil
-//}
-//
-///*
-//result.suggestion:
-//
-//	block:包含敏感信息,不通过
-//	review:需要人工复检
-//	pass:不包含敏感信息,通过
-//*/
-//func (c *Config) CheckVideoInfo(jobId string) (status *string, suggestion *string, err error) {
-//	request := &model.RunQueryVideoModerationJobRequest{}
-//	request.JobId = jobId
-//	response, err := c.Client.RunQueryVideoModerationJob(request)
-//	if err != nil {
-//		return nil, nil, err
-//	}
-//	status1 := response.Status.Value()
-//	if "succeeded" == status1 {
-//		suggestion1 := response.Result.Suggestion.Value()
-//		return &status1, &suggestion1, nil
-//	} else {
-//		return &status1, nil, nil
-//	}
-//}
-//
-//func (c *Config) CheckDocument(documentUrl, format string) (*string, error) {
-//	request := &model.RunCreateDocumentModerationJobRequest{}
-//	databody := &model.DocumentCreateRequestData{
-//		Url:    documentUrl,
-//		Format: format,
-//	}
-//	request.Body = &model.DocumentCreateRequest{
-//		EventType: "default",
-//		Data:      databody,
-//	}
-//	response, err := c.Client.RunCreateDocumentModerationJob(request)
-//	if err != nil {
-//		res := "文档审核服务异常"
-//		return &res, err
-//	}
-//	jobId := response.JobId
-//
-//	return jobId, nil
-//}
-//
-///*
-//result.suggestion:
-//
-//	block:包含敏感信息,不通过
-//	review:需要人工复检
-//	pass:不包含敏感信息,通过
-//*/
-//func (c *Config) CheckDocumentInfo(jobId string) (status *string, suggestion *string, err error) {
-//	request := &model.RunQueryDocumentModerationJobRequest{}
-//	request.JobId = jobId
-//	response, err := c.Client.RunQueryDocumentModerationJob(request)
-//	if err != nil {
-//		return nil, nil, err
-//	}
-//	status = response.Status
-//	if "succeeded" == *status {
-//		suggestion = response.Result.Suggestion
-//		return status, suggestion, nil
-//	} else {
-//		return status, nil, nil
-//	}
-//}
+import (
+	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/model"
+)
+
+/*
+result.suggestion:
+
+	block:包含敏感信息,不通过
+	review:需要人工复检
+	pass:不包含敏感信息,通过
+*/
+func (c *Config) CheckContent(text string) (*string, error) {
+	request := &model.RunTextModerationRequest{}
+	request.EnterpriseProjectId = &c.ProjectId
+	eventType := "article"
+	listCategoriesbody := []string{
+		"terrorism", "porn", "ban", "abuse",
+	}
+	databody := model.TextDetectionDataReq{
+		Text: text,
+	}
+	request.Body = &model.TextDetectionReq{
+		Data:       &databody,
+		EventType:  &eventType,
+		Categories: &listCategoriesbody,
+	}
+	response, err := c.Client.RunTextModeration(request)
+	if err != nil {
+		res := "文本审核服务异常"
+		return &res, err
+	}
+	result := response.Result
+	suggestion := result.Suggestion
+
+	return suggestion, nil
+}
+
+/*
+result.suggestion:
+
+	block:包含敏感信息,不通过
+	review:需要人工复检
+	pass:不包含敏感信息,通过
+*/
+func (c *Config) CheckImage(imageUrl string) (*string, error) {
+	request := &model.CheckImageModerationRequest{}
+	listCategoriesbody := []string{
+		"terrorism", "porn",
+	}
+	eventType := "head_image"
+	request.Body = &model.ImageDetectionReq{
+		Url:        &imageUrl,
+		Categories: &listCategoriesbody,
+		EventType:  &eventType,
+	}
+	response, err := c.Client.CheckImageModeration(request)
+	if err != nil {
+		res := "图片审核服务异常"
+		return &res, err
+	}
+	result := response.Result
+	suggestion := result.Suggestion
+
+	return suggestion, nil
+}
+
+func (c *Config) CheckVideo(videoUrl string) (*string, error) {
+	request := &model.RunCreateVideoModerationJobRequest{}
+	var listAudioCategoriesbody = []model.VideoCreateRequestAudioCategories{
+		model.GetVideoCreateRequestAudioCategoriesEnum().PORN, model.GetVideoCreateRequestAudioCategoriesEnum().MOAN, model.GetVideoCreateRequestAudioCategoriesEnum().ABUSE,
+	}
+	var listImageCategoriesbody = []model.VideoCreateRequestImageCategories{
+		model.GetVideoCreateRequestImageCategoriesEnum().PORN, model.GetVideoCreateRequestImageCategoriesEnum().TERRORISM,
+	}
+	var eventType = model.GetVideoCreateRequestEventTypeEnum().DEFAULT
+	frameIntervalData := int32(2)
+	databody := &model.VideoCreateRequestData{
+		Url:           videoUrl,
+		FrameInterval: &frameIntervalData, // 截帧频率间隔
+	}
+	//callbackVideoCreateRequest := "http://xxx.xx.xxxx"
+	request.Body = &model.VideoCreateRequest{
+		AudioCategories: &listAudioCategoriesbody, // 视频中音频需要检测的风险类型
+		ImageCategories: &listImageCategoriesbody, // 视频中画面需要检测的风险类型
+		EventType:       &eventType,
+		Data:            databody,
+		//Callback:        &callbackVideoCreateRequest,
+	}
+	response, err := c.Client.RunCreateVideoModerationJob(request)
+	if err != nil {
+		res := "视频审核服务异常"
+		return &res, err
+	}
+	jobId := response.JobId
+
+	return jobId, nil
+}
+
+/*
+result.suggestion:
+
+	block:包含敏感信息,不通过
+	review:需要人工复检
+	pass:不包含敏感信息,通过
+*/
+func (c *Config) CheckVideoInfo(jobId string) (status *string, suggestion *string, err error) {
+	request := &model.RunQueryVideoModerationJobRequest{}
+	request.JobId = jobId
+	response, err := c.Client.RunQueryVideoModerationJob(request)
+	if err != nil {
+		return nil, nil, err
+	}
+	status1 := response.Status.Value()
+	if "succeeded" == status1 {
+		suggestion1 := response.Result.Suggestion.Value()
+		return &status1, &suggestion1, nil
+	} else {
+		return &status1, nil, nil
+	}
+}
+
+func (c *Config) CheckDocument(documentUrl, format string) (*string, error) {
+	request := &model.RunCreateDocumentModerationJobRequest{}
+	databody := &model.DocumentCreateRequestData{
+		Url:    documentUrl,
+		Format: format,
+	}
+	request.Body = &model.DocumentCreateRequest{
+		EventType: "default",
+		Data:      databody,
+	}
+	response, err := c.Client.RunCreateDocumentModerationJob(request)
+	if err != nil {
+		res := "文档审核服务异常"
+		return &res, err
+	}
+	jobId := response.JobId
+
+	return jobId, nil
+}
+
+/*
+result.suggestion:
+
+	block:包含敏感信息,不通过
+	review:需要人工复检
+	pass:不包含敏感信息,通过
+*/
+func (c *Config) CheckDocumentInfo(jobId string) (status *string, suggestion *string, err error) {
+	request := &model.RunQueryDocumentModerationJobRequest{}
+	request.JobId = jobId
+	response, err := c.Client.RunQueryDocumentModerationJob(request)
+	if err != nil {
+		return nil, nil, err
+	}
+	status = response.Status
+	if "succeeded" == *status {
+		suggestion = response.Result.Suggestion
+		return status, suggestion, nil
+	} else {
+		return status, nil, nil
+	}
+}

+ 370 - 143
app/service/selection_info_service.go

@@ -9,6 +9,7 @@ import (
 	"time"
 	"youngee_m_api/app/dao"
 	"youngee_m_api/app/entity"
+	"youngee_m_api/app/service/review_service"
 	"youngee_m_api/app/util"
 	"youngee_m_api/app/vo"
 )
@@ -264,8 +265,6 @@ func (s SelectionInfoService) UpdateSelectionInfo(selectionUpdateParam *vo.Selec
 		SelectionID: selectionUpdateParam.SelectionID,
 		//SelectionStatus:  selectionUpdateParam.SelectionStatus,
 		SelectionName: selectionUpdateParam.SelectionName,
-		EnterpriseID:  selectionUpdateParam.EnterpriseId,
-		SubAccountId:  selectionUpdateParam.SubAccountId,
 		ProductID:     selectionUpdateParam.ProductId,
 		//ProductUrl:       selectionUpdateParam.ProductUrl,
 		TaskMode:   taskMode,
@@ -430,13 +429,21 @@ func (s SelectionInfoService) GetSelectionDetail(selectionId string) (*vo.ReSele
 		logrus.Errorf("[selectionInfoDB service] call GetSelection error,err:%+v", err)
 		return nil, err
 	}
+	if selection == nil {
+		return nil, errors.New("数据不存在")
+	}
 	reSelectionDetail.SelectionName = selection.SelectionName
 	// 系统信息
-	reSelectionDetail.SelectionId = selectionId
+	reSelectionDetail.SelectionId = selection.SelectionID
 	reSelectionDetail.SelectionStatus = selection.SelectionStatus
 	reSelectionDetail.SelectionPlatform = selection.Platform
 	reSelectionDetail.CreatedAt = selection.CreatedAt.Format("2006-01-02 15:04:05")
 	reSelectionDetail.SubmitAt = selection.SubmitAt.Format("2006-01-02 15:04:05")
+	reSelectionDetail.PassAt = selection.PassAt.Format("2006-01-02 15:04:05")
+	reSelectionDetail.AutoFailAt = selection.AutoFailAt.Format("2006-01-02 15:04:05")
+	reSelectionDetail.StartAt = selection.PayAt.Format("2006-01-02 15:04:05")
+	reSelectionDetail.FinishAt = selection.FinishAt.Format("2006-01-02 15:04:05")
+	reSelectionDetail.FailAt = selection.FailAt.Format("2006-01-02 15:04:05")
 	reSelectionDetail.RewardSum = selection.EstimatedCost
 	var creatorName, phone string
 	//var rewardSum float64
@@ -533,145 +540,286 @@ func (s SelectionInfoService) GetSelectionDetail(selectionId string) (*vo.ReSele
 	return &reSelectionDetail, nil
 }
 
-//// 电商带货提交审核
-//func (s SelectionInfoService) SelectionToReview(param *vo.SelectionInfoUpdateParam) (*string, error) {
-//	selectionId := param.SelectionID
-//	selection, err := dao.SelectionInfoDAO{}.GetSelectionInfoById(selectionId)
-//	if err != nil {
-//		logrus.Errorf("[selectionInfoDB service] call GetSelection error,err:%+v", err)
-//		return nil, err
-//	}
-//
-//	selectionName := selection.SelectionName // 任务标题
-//	product, err := dao.ProductDAO{}.GetProductByID(selection.ProductID)
-//	if err != nil {
-//		return nil, err
-//	}
-//	productName := product.ProductName     // 商品标题
-//	productDetail := product.ProductDetail // 卖点总结
-//	mainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByProductID(selection.ProductID)
-//	if err1 != nil {
-//		return nil, err1
-//	}
-//	var images []string
-//	var videos []string
-//	var videoJobIds []string
-//	var documents []string
-//	var documentJobIds []string
-//	reviewService := review_service.GetConfig()
-//
-//	productPhotos, err2 := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(selection.ProductID)
-//	if err2 != nil {
-//		return nil, err2
-//	}
-//	for _, productPhoto := range productPhotos {
-//		if productPhoto.Symbol == 2 || productPhoto.Symbol == 4 {
-//			images = append(images, productPhoto.PhotoUrl)
-//		} else if productPhoto.Symbol == 3 || productPhoto.Symbol == 5 {
-//			var videoJobId *string
-//			var reviewErr error
-//			i := 10
-//			for {
-//				videoJobId, reviewErr = reviewService.CheckVideo(productPhoto.PhotoUrl)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			videos = append(videos, productPhoto.PhotoUrl)
-//			videoJobIds = append(videoJobIds, *videoJobId)
-//		}
-//	}
-//
-//	selectionBriefInfos, err := dao.SecBriefDao{}.GetSelectionBriefInfo(selectionId)
-//	if err != nil {
-//		return nil, err
-//	}
-//	for _, selectionBriefInfo := range selectionBriefInfos {
-//		if selectionBriefInfo.Type == 1 {
-//			images = append(images, selectionBriefInfo.FileUrl)
-//		} else if selectionBriefInfo.Type == 2 {
-//			var documentJobId *string
-//			var reviewErr error
-//			i := 10
-//			fileType := "pdf"
-//			parts := strings.Split(selectionBriefInfo.FileName, ".")
-//			if len(parts) > 1 {
-//				fileType = parts[len(parts)-1]
-//			}
-//			for {
-//				documentJobId, reviewErr = reviewService.CheckDocument(selectionBriefInfo.FileUrl, fileType)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			documents = append(documents, selectionBriefInfo.FileUrl)
-//			documentJobIds = append(documentJobIds, *documentJobId)
-//		}
-//	}
-//	selectionMaterials, err := dao.SecMaterialDao{}.GetSelectionMaterialInfo(selectionId)
-//	if err != nil {
-//		return nil, err
-//	}
-//	for _, selectionMaterial := range selectionMaterials {
-//		if selectionMaterial.Type == 1 {
-//			images = append(images, selectionMaterial.FileUrl)
-//		} else if selectionMaterial.Type == 2 {
-//			var videoJobId *string
-//			var reviewErr error
-//			i := 10
-//			for {
-//				videoJobId, reviewErr = reviewService.CheckVideo(selectionMaterial.FileUrl)
-//				if reviewErr == nil || i == 0 {
-//					break
-//				}
-//				i -= 1
-//			}
-//			if reviewErr != nil {
-//				return nil, reviewErr
-//			}
-//			videos = append(videos, selectionMaterial.FileUrl)
-//			videoJobIds = append(videoJobIds, *videoJobId)
-//		}
-//	}
-//
-//	newReviewSelection := &entity.ReviewSelection{
-//		SelectionID:    selectionId,
-//		TaskName:       selectionName,
-//		ProductName:    productName,
-//		ProductDetail:  productDetail,
-//		MainPhoto:      mainPhoto,
-//		Images:         strings.Join(images, ","),
-//		Videos:         strings.Join(videos, ","),
-//		Documents:      strings.Join(documents, ","),
-//		VideoJobIds:    strings.Join(videoJobIds, ","),
-//		DocumentJobIds: strings.Join(documentJobIds, ","),
-//		Status:         1,
-//	}
-//	err5 := dao.SelectionReviewDao{}.Create(newReviewSelection)
-//	if err5 != nil {
-//		return nil, err5
-//	}
-//
-//	t := time.Now()
-//	updateSelection := entity.SelectionInfo{
-//		SelectionID:     selectionId,
-//		SelectionStatus: 2,
-//		UpdatedAt:       t,
-//	}
-//	err6 := dao.SelectionInfoDAO{}.UpdateSelectionInfo(updateSelection)
-//	if err6 != nil {
-//		return nil, err
-//	}
-//	return &selectionId, nil
-//}
+// 电商带货复制任务
+func (s SelectionInfoService) CopySelection(param *vo.SelectionSearchParam) (*string, error) {
+	selectionOrigin, err := dao.SelectionInfoDAO{}.GetSelectionInfoById(param.SelectionId)
+	if err != nil {
+		logrus.Errorf("[selectionInfoDB service] call GetSelection error,err:%+v", err)
+		return nil, err
+	}
+	if selectionOrigin == nil {
+		return nil, errors.New("任务不存在")
+	}
+	selectionIdOrigin := selectionOrigin.SelectionID
+	selectionIdNew := strings.ReplaceAll(util.GenerateUUID(11), "-", "")
+	t := time.Now()
+	// 获取定时任务配置
+	infoAutoTask := entity.InfoAutoTask{}
+	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(selectionOrigin.EnterpriseID)
+
+	// 复制选品
+	selectionNew := entity.SelectionInfo{
+		SelectionStatus:  1,
+		SelectionID:      selectionIdNew,
+		ProductID:        selectionOrigin.ProductID,
+		ProductCategory:  selectionOrigin.ProductCategory,
+		EnterpriseID:     selectionOrigin.EnterpriseID,
+		SubAccountId:     selectionOrigin.SubAccountId,
+		Platform:         selectionOrigin.Platform,
+		ProductSnap:      selectionOrigin.ProductSnap,
+		ProductPhotoSnap: selectionOrigin.ProductPhotoSnap,
+		SelectionName:    selectionOrigin.SelectionName,
+		TaskDdl:          selectionOrigin.TaskDdl,
+		SampleNum:        selectionOrigin.SampleNum,
+		RemainNum:        selectionOrigin.SampleNum,
+		SampleMode:       selectionOrigin.SampleMode,
+		TaskMode:         selectionOrigin.TaskMode,
+		CreatedAt:        t,
+		AutoTaskID:       infoAutoTask.AutoTaskID,
+		EstimatedCost:    selectionOrigin.EstimatedCost,
+	}
+	err = dao.SelectionInfoDAO{}.CreateSelectionInfo(selectionNew)
+	if err != nil {
+		return nil, err
+	}
+
+	// 更新选品brief和示例(带货任务补充信息)
+	selectionBriefInfos, err := dao.SecBriefDao{}.GetSelectionBriefInfo(selectionIdOrigin)
+	if err != nil {
+		logrus.Errorf("[selectionInfoDB service] call GetSelectionBriefInfo error,err:%+v", err)
+		return nil, err
+	}
+	if selectionBriefInfos != nil {
+		for _, v := range selectionBriefInfos {
+			brief := entity.SecBrief{
+				SelectionID: selectionIdNew,
+				FileUid:     v.FileUid,
+				FileName:    v.FileName,
+				FileUrl:     v.FileUrl,
+				CreatedAt:   time.Now(),
+				Type:        v.Type,
+			}
+			err = dao.SecBriefDao{}.CreateSecBrief(brief)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+	selectionMaterials, err := dao.SecMaterialDao{}.GetSelectionMaterialInfo(selectionIdOrigin)
+	if err != nil {
+		logrus.Errorf("[selectionInfoDB service] call GetSelectionMaterialInfo error,err:%+v", err)
+		return nil, err
+	}
+	if selectionMaterials != nil {
+		for _, v := range selectionMaterials {
+			secMaterial := entity.SecMaterial{
+				SelectionID: selectionIdNew,
+				FileUid:     v.FileUid,
+				FileName:    v.FileName,
+				FileUrl:     v.FileUrl,
+				CreatedAt:   time.Now(),
+				Type:        v.Type,
+			}
+			err = dao.SecMaterialDao{}.CreateSecMaterial(secMaterial)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
+	// 更新带货任务的免费领样策略
+	freeStrategys, err := dao.FreeStrategyDao{}.GetFreeStrategyBySelectionId(selectionIdOrigin)
+	if err != nil {
+		logrus.Errorf("[selectionInfoDB service] call GetFreeStrategy error,err:%+v", err)
+		return nil, err
+	}
+	if freeStrategys != nil {
+		var frees []entity.FreeStrategy
+		for _, v := range freeStrategys {
+			free := entity.FreeStrategy{
+				SelectionId:    selectionIdNew,
+				StrategyId:     v.StrategyId,
+				FollowersLow:   v.FollowersLow,
+				FollowersUp:    v.FollowersUp,
+				SaleNum:        v.SaleNum,
+				StrategyStatus: v.StrategyStatus,
+				EnrollNum:      0,
+				ChooseNum:      0,
+			}
+			frees = append(frees, free)
+		}
+		err = dao.FreeStrategyDao{}.CreateFreeStrategy(frees)
+		if err != nil {
+			return nil, err
+		}
+	}
+	// 更新带货任务的悬赏策略
+	rewardStrategys, err := dao.RewardStrategyDao{}.GetRewardStrategyBySelectionId(selectionIdOrigin)
+	if err != nil {
+		logrus.Errorf("[selectionInfoDB service] call GetRewardStrategy error,err:%+v", err)
+		return nil, err
+	}
+	if rewardStrategys != nil {
+		var rewards []entity.RewardStrategy
+		for _, v := range rewardStrategys {
+			reward := entity.RewardStrategy{
+				SelectionId:    selectionIdNew,
+				Reward:         v.Reward,
+				SaleActual:     v.SaleActual,
+				PerReward:      v.PerReward,
+				StrategyStatus: 1,
+			}
+			rewards = append(rewards, reward)
+		}
+		err = dao.RewardStrategyDao{}.CreateRewardStrategy(rewards)
+		if err != nil {
+			return nil, err
+		}
+	}
+
+	return &selectionIdNew, nil
+}
+
+// 电商带货提交审核
+func (s SelectionInfoService) SelectionToReview(param *vo.SelectionInfoUpdateParam) (*string, error) {
+	selectionId := param.SelectionID
+	selection, err := dao.SelectionInfoDAO{}.GetSelectionInfoById(selectionId)
+	if err != nil {
+		logrus.Errorf("[selectionInfoDB service] call GetSelection error,err:%+v", err)
+		return nil, err
+	}
+
+	selectionName := selection.SelectionName // 任务标题
+	product, err := dao.ProductDAO{}.GetProductByID(selection.ProductID)
+	if err != nil {
+		return nil, err
+	}
+	productName := product.ProductName     // 商品标题
+	productDetail := product.ProductDetail // 卖点总结
+	mainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByProductID(selection.ProductID)
+	if err1 != nil {
+		return nil, err1
+	}
+	var images []string
+	var videos []string
+	var videoJobIds []string
+	var documents []string
+	var documentJobIds []string
+	reviewService := review_service.GetConfig()
+
+	productPhotos, err2 := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(selection.ProductID)
+	if err2 != nil {
+		return nil, err2
+	}
+	for _, productPhoto := range productPhotos {
+		if productPhoto.Symbol == 2 || productPhoto.Symbol == 4 {
+			images = append(images, productPhoto.PhotoUrl)
+		} else if productPhoto.Symbol == 3 || productPhoto.Symbol == 5 {
+			var videoJobId *string
+			var reviewErr error
+			i := 10
+			for {
+				videoJobId, reviewErr = reviewService.CheckVideo(productPhoto.PhotoUrl)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			videos = append(videos, productPhoto.PhotoUrl)
+			videoJobIds = append(videoJobIds, *videoJobId)
+		}
+	}
+
+	selectionBriefInfos, err := dao.SecBriefDao{}.GetSelectionBriefInfo(selectionId)
+	if err != nil {
+		return nil, err
+	}
+	for _, selectionBriefInfo := range selectionBriefInfos {
+		if selectionBriefInfo.Type == 1 {
+			images = append(images, selectionBriefInfo.FileUrl)
+		} else if selectionBriefInfo.Type == 2 {
+			var documentJobId *string
+			var reviewErr error
+			i := 10
+			fileType := "pdf"
+			parts := strings.Split(selectionBriefInfo.FileName, ".")
+			if len(parts) > 1 {
+				fileType = parts[len(parts)-1]
+			}
+			for {
+				documentJobId, reviewErr = reviewService.CheckDocument(selectionBriefInfo.FileUrl, fileType)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			documents = append(documents, selectionBriefInfo.FileUrl)
+			documentJobIds = append(documentJobIds, *documentJobId)
+		}
+	}
+	selectionMaterials, err := dao.SecMaterialDao{}.GetSelectionMaterialInfo(selectionId)
+	if err != nil {
+		return nil, err
+	}
+	for _, selectionMaterial := range selectionMaterials {
+		if selectionMaterial.Type == 1 {
+			images = append(images, selectionMaterial.FileUrl)
+		} else if selectionMaterial.Type == 2 {
+			var videoJobId *string
+			var reviewErr error
+			i := 10
+			for {
+				videoJobId, reviewErr = reviewService.CheckVideo(selectionMaterial.FileUrl)
+				if reviewErr == nil || i == 0 {
+					break
+				}
+				i -= 1
+			}
+			if reviewErr != nil {
+				return nil, reviewErr
+			}
+			videos = append(videos, selectionMaterial.FileUrl)
+			videoJobIds = append(videoJobIds, *videoJobId)
+		}
+	}
+
+	newReviewSelection := &entity.ReviewSelection{
+		SelectionID:    selectionId,
+		TaskName:       selectionName,
+		ProductName:    productName,
+		ProductDetail:  productDetail,
+		MainPhoto:      mainPhoto,
+		Images:         strings.Join(images, ","),
+		Videos:         strings.Join(videos, ","),
+		Documents:      strings.Join(documents, ","),
+		VideoJobIds:    strings.Join(videoJobIds, ","),
+		DocumentJobIds: strings.Join(documentJobIds, ","),
+		Status:         1,
+	}
+	err5 := dao.SelectionReviewDao{}.Create(newReviewSelection)
+	if err5 != nil {
+		return nil, err5
+	}
+
+	t := time.Now()
+	updateSelection := entity.SelectionInfo{
+		SelectionID:     selectionId,
+		SelectionStatus: 2,
+		SubmitAt:        t,
+		UpdatedAt:       t,
+	}
+	err6 := dao.SelectionInfoDAO{}.UpdateSelectionInfo(updateSelection)
+	if err6 != nil {
+		return nil, err
+	}
+	return &selectionId, nil
+}
 
 // 电商带货任务列表
 func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchParam) (vo.ResultVO, error) {
@@ -739,12 +887,56 @@ func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchPara
 func (s SelectionInfoService) DeleteSelection(selectionId string) (*string, error) {
 	res, err := dao.SelectionInfoDAO{}.DeleteSelection(selectionId)
 	if err != nil {
-		logrus.Errorf("[projectDB service] call DeleteSelection error,err:%+v", err)
+		logrus.Errorf("[selectionDB service] call DeleteSelection error,err:%+v", err)
 		return res, err
 	}
 	return res, nil
 }
 
+// 结束带货任务
+func (s SelectionInfoService) CloseSelection(selectionId string) (string, error) {
+	// 任务待办:待审核、待支付、达人未处理  待发货、待签收  未传初稿、未发作品、未传数据
+	selectionInfo, err := dao.SelectionInfoDAO{}.GetSelectionInfoById(selectionId)
+	if err != nil {
+		return "0", err
+	}
+	if selectionInfo == nil {
+		return "0", errors.New("任务不存在")
+	}
+	var needProcess int64
+	if selectionInfo.SelectionStatus == 6 {
+		// 达人未处理 or 物流待办
+		_ = dao.Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id = ? and (task_status = ? or logistics_status != ?)", selectionId, 1, 3).Count(&needProcess).Error // task_status=1待选
+	}
+	if selectionInfo.SelectionStatus == 2 || selectionInfo.SelectionStatus == 4 || needProcess > 0 {
+		// 存在待办不可结束
+		return "1", nil
+	} else {
+		err = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{
+			SelectionID:     selectionId,
+			SelectionStatus: 8,
+			UpdatedAt:       time.Now(),
+		})
+		return "0", err
+	}
+}
+
+// 电商带货选达人角标 未处理、同意合作、拒绝合作
+func (s SelectionInfoService) SelectionTalentCount(selectionId string) map[string]int64 {
+	res := make(map[string]int64)
+	var unhandledNum int64
+	var agreeNum int64
+	var refuseNum int64
+	dao.Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id = ? AND free_stage in ?", selectionId, []int{1}).Count(&unhandledNum)
+	dao.Db.Model(&entity.ProjectTaskInfo{}).Where("selection_id = ? AND free_stage in ?", selectionId, []int{3, 4, 5}).Count(&agreeNum)
+	dao.Db.Model(&entity.ProjectTaskInfo{}).Where("selection_id = ? AND free_stage in ?", selectionId, []int{2}).Count(&refuseNum)
+	res["unhandledNum"] = unhandledNum
+	res["agreeNum"] = agreeNum
+	res["refuseNum"] = refuseNum
+
+	return res
+}
+
 // 草稿箱——电商带货
 func (s SelectionInfoService) GetSelectionDraftList(param *vo.SelectionDraftParam) (vo.ResultVO, error) {
 	if param.Page == 0 {
@@ -793,3 +985,38 @@ func (s SelectionInfoService) GetSelectionDraftList(param *vo.SelectionDraftPara
 	}
 	return result, nil
 }
+
+// 电商带货任务待办
+func (s SelectionInfoService) GetTaskToDo(enterpriseId string, subAccountId int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	kuaishou, err1 := dao.SelectionInfoDAO{}.GetSelectionToDo(enterpriseId, subAccountId, 4)
+	if err1 != nil {
+		logrus.Errorf("[GetSelectionToDo service] call GetSelectionToDo error,err:%+v", err1)
+		return res, err1
+	}
+	all := make(map[string]int64)
+	all["needReview"] = kuaishou["needReview"]
+	all["needPay"] = kuaishou["needPay"]
+	all["needProcess"] = kuaishou["needProcess"]
+	res["kuaishou"] = kuaishou
+	res["all"] = all
+
+	return res, nil
+}
+
+// 寄样物流任务待办
+func (s SelectionInfoService) GetLogisticsToDo(enterpriseId string, subAccountId int64) (map[string]map[string]int64, error) {
+	res := make(map[string]map[string]int64)
+	kuaishou, err1 := dao.SelectionInfoDAO{}.GetLogisticsToDo(enterpriseId, subAccountId, 4)
+	if err1 != nil {
+		logrus.Errorf("[GetSelectionToDo service] call GetSelectionToDo error,err:%+v", err1)
+		return res, err1
+	}
+	all := make(map[string]int64)
+	all["needDelivery"] = kuaishou["needDelivery"]
+	all["needReceive"] = kuaishou["needReceive"]
+	res["kuaishou"] = kuaishou
+	res["all"] = all
+
+	return res, nil
+}

+ 141 - 24
app/service/task_info_service.go

@@ -1,6 +1,11 @@
 package service
 
 import (
+	"encoding/json"
+	"errors"
+	"fmt"
+	"github.com/xuri/excelize/v2"
+	"strconv"
 	"youngee_m_api/app/dao"
 	"youngee_m_api/app/entity"
 	"youngee_m_api/app/vo"
@@ -8,6 +13,22 @@ import (
 
 type TaskInfoService struct{}
 
+// 带货待发货、待签收、已签收统计
+func (t TaskInfoService) LogisticsSelectionTalentCount(param *vo.LogisticsSelectionTalentParam) map[string]int64 {
+	res := make(map[string]int64)
+	var needDelivery int64
+	var needReceive int64
+	var received int64
+	dao.Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id = ? AND free_stage = ?", param.SelectionId, 3).Count(&needDelivery)
+	dao.Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id = ? AND free_stage = ?", param.SelectionId, 4).Count(&needReceive)
+	dao.Db.Model(&entity.SelectionTaskInfo{}).Where("selection_id = ? AND free_stage = ?", param.SelectionId, 5).Count(&received)
+	res["needDelivery"] = needDelivery
+	res["needReceive"] = needReceive
+	res["received"] = received
+
+	return res
+}
+
 // 达人物流管理
 func (t TaskInfoService) LogisticsTalentList(param *vo.LogisticsTalentParam) (*vo.ResultVO, error) {
 	if param.Page <= 0 {
@@ -28,37 +49,34 @@ func (t TaskInfoService) LogisticsTalentList(param *vo.LogisticsTalentParam) (*v
 	var err error
 	projectId := param.ProjectId
 	if param.Status == 1 { // 待发货
-		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTaskStage(projectId, 4, "", param.Page, param.PageSize)
+		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTaskStage(projectId, 4, "", param.Page, param.PageSize, param.Nickname)
 	} else if param.Status == 2 { // 待签收
-		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTaskStage(projectId, 5, param.DeliveryTime, param.Page, param.PageSize)
+		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTaskStage(projectId, 5, param.DeliveryTime, param.Page, param.PageSize, param.Nickname)
 	} else if param.Status == 3 { // 已签收
-		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTaskStage(projectId, 6, "", param.Page, param.PageSize)
+		projectTaskInfos, total, err = dao.ProjectTaskInfoDao{}.GetListByTaskStage(projectId, 6, "", param.Page, param.PageSize, param.Nickname)
 	}
 	if err != nil {
 		return nil, err
 	}
 	for _, projectTaskInfo := range projectTaskInfos {
 		// 获取达人信息
-		talentInfo, err := dao.TalentInfoDao{}.SelectTalentInfo(projectTaskInfo.TalentID)
-		if err != nil {
-			return nil, err
-		}
-		regionName, err := dao.RegionInfoDao{}.SelectRegion(talentInfo.VisitStoreRegion)
-		if err != nil {
-			regionName = ""
-		}
+		platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(projectTaskInfo.OpenID)
 		taskLogistics, err := dao.TaskLogisticsDao{}.SelectTaskLogistics(projectTaskInfo.TaskID)
 		if err != nil {
 			return nil, err
 		}
 		talentPreview := &vo.TalentPreview{
 			TalentId:    projectTaskInfo.TalentID,
-			TalentPhoto: talentInfo.Avatar,
-			TalentName:  talentInfo.TalentWxNickname,
-			Account:     "",
-			Location:    regionName,
+			TalentPhoto: platformKuaishouUserInfo.HeadUri,
+			TalentName:  platformKuaishouUserInfo.NickName,
+			TaskId:      projectTaskInfo.TaskID,
+			Account:     platformKuaishouUserInfo.OpenID,
+			PlatformId:  platformKuaishouUserInfo.PlatformID,
+			Location:    platformKuaishouUserInfo.City,
+			Gender:      platformKuaishouUserInfo.Gender,
 		}
 		reLogisticsTalent := &vo.ReLogisticsTalent{
+			TaskId:             projectTaskInfo.TaskID,
 			TalentPostAddrSnap: projectTaskInfo.TalentPostAddrSnap,
 			ReTalentPreview:    talentPreview,
 			LogisticsId:        taskLogistics.LogisticsID,
@@ -85,6 +103,102 @@ func (t TaskInfoService) LogisticsTalentList(param *vo.LogisticsTalentParam) (*v
 	return &result, nil
 }
 
+// 导出种草达人物流数据
+func (t TaskInfoService) LogisticsExport(param *vo.LogisticsTalentParam) (*excelize.File, error) {
+	// 准备数据
+	var logisticsExports []*vo.LogisticsExport
+	param.Page = 1
+	param.PageSize = 1<<31 - 1
+	var projectTaskInfos []*entity.ProjectTaskInfo
+	var err error
+	projectId := param.ProjectId
+	if param.Status == 1 { // 待发货
+		projectTaskInfos, _, err = dao.ProjectTaskInfoDao{}.GetListByTaskStage(projectId, 4, "", param.Page, param.PageSize, param.Nickname)
+	} else if param.Status == 2 { // 待签收
+		projectTaskInfos, _, err = dao.ProjectTaskInfoDao{}.GetListByTaskStage(projectId, 5, param.DeliveryTime, param.Page, param.PageSize, param.Nickname)
+	} else if param.Status == 3 { // 已签收
+		projectTaskInfos, _, err = dao.ProjectTaskInfoDao{}.GetListByTaskStage(projectId, 6, "", param.Page, param.PageSize, param.Nickname)
+	}
+	if err != nil {
+		return nil, err
+	}
+	for _, projectTaskInfo := range projectTaskInfos {
+		var talentDeliveryAddress entity.TalentDeliveryAddress
+		err = json.Unmarshal([]byte(projectTaskInfo.TalentPostAddrSnap), &talentDeliveryAddress)
+		if err != nil {
+			fmt.Println("解析 JSON 失败:", err)
+			return nil, err
+		}
+		taskLogistics, err := dao.TaskLogisticsDao{}.SelectTaskLogistics(projectTaskInfo.TaskID)
+		if err != nil {
+			return nil, err
+		}
+		logisticsExport := &vo.LogisticsExport{
+			TalentId:        projectTaskInfo.TalentID,
+			TalentName:      projectTaskInfo.TalentName,
+			ReceiverName:    talentDeliveryAddress.ReceiverName,
+			PhoneNumber:     talentDeliveryAddress.PhoneNumber,
+			Province:        strconv.Itoa(talentDeliveryAddress.RegionCode),
+			City:            strconv.Itoa(talentDeliveryAddress.RegionCode),
+			County:          strconv.Itoa(talentDeliveryAddress.RegionCode),
+			DetailAddr:      talentDeliveryAddress.DetailAddr,
+			CompanyName:     taskLogistics.CompanyName,
+			LogisticsNumber: taskLogistics.LogisticsNumber,
+			Operator:        "",
+		}
+		if param.Status == 2 {
+			logisticsExport.Time = projectTaskInfo.DeliveryDate.Format("2006-01-02 15:04:05")
+		}
+		if param.Status == 3 {
+			logisticsExport.Time = projectTaskInfo.SignedTime.Format("2006-01-02 15:04:05")
+		}
+		logisticsExports = append(logisticsExports, logisticsExport)
+	}
+	// 打开 Excel 模板
+	templatePath := "export_template.xlsx"
+	f, err10 := excelize.OpenFile(templatePath)
+	if err10 != nil {
+		return nil, errors.New(fmt.Sprintf("加载模板失败: %s", err10))
+	}
+	// 写入数据
+	sheet := "Sheet1"
+	startRow := 2
+	for i, logisticsExport := range logisticsExports {
+		row := strconv.Itoa(startRow + i)
+		_ = f.SetCellValue(sheet, "A"+row, logisticsExport.TalentId)
+		_ = f.SetCellValue(sheet, "B"+row, logisticsExport.TalentName)
+		_ = f.SetCellValue(sheet, "C"+row, logisticsExport.ReceiverName)
+		_ = f.SetCellValue(sheet, "D"+row, logisticsExport.PhoneNumber)
+		_ = f.SetCellValue(sheet, "E"+row, logisticsExport.Province)
+		_ = f.SetCellValue(sheet, "F"+row, logisticsExport.City)
+		_ = f.SetCellValue(sheet, "G"+row, logisticsExport.County)
+		_ = f.SetCellValue(sheet, "H"+row, logisticsExport.DetailAddr)
+		_ = f.SetCellValue(sheet, "I"+row, logisticsExport.CompanyName)
+		_ = f.SetCellValue(sheet, "J"+row, logisticsExport.LogisticsNumber)
+		_ = f.SetCellValue(sheet, "K"+row, logisticsExport.Operator)
+		_ = f.SetCellValue(sheet, "L"+row, logisticsExport.Time)
+	}
+
+	return f, nil
+}
+
+// 种草待发货、待签收、已签收统计
+func (t TaskInfoService) LogisticsTalentCount(param *vo.LogisticsTalentParam) map[string]int64 {
+	res := make(map[string]int64)
+	var needDelivery int64
+	var needReceive int64
+	var received int64
+	dao.Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND task_stage = ?", param.ProjectId, 4).Count(&needDelivery)
+	dao.Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND task_stage = ?", param.ProjectId, 5).Count(&needReceive)
+	dao.Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND task_stage >= ?", param.ProjectId, 6).Count(&received)
+	res["needDelivery"] = needDelivery
+	res["needReceive"] = needReceive
+	res["received"] = received
+
+	return res
+}
+
+// 电商带货执行中-悬赏兑现
 func (t TaskInfoService) SelectionRewardCashDetail(param *vo.SelectionRewardCashParam) (*vo.ReSelectionRewardCash, error) {
 	if param.Page == 0 {
 		param.Page = 1
@@ -98,20 +212,23 @@ func (t TaskInfoService) SelectionRewardCashDetail(param *vo.SelectionRewardCash
 	}
 	rewardPoolAmount := selectionInfo.EstimatedCost
 	rewardPoolCashed := selectionInfo.TaskReward
-	secTaskInfos, total, err1 := dao.SecTaskInfoDao{}.GetRewardDetailByRewardStage(param.SelectionId, 2, param.Order, param.Page, param.PageSize)
+	selectionTaskInfos, total, err1 := dao.SelectionTaskInfoDao{}.GetRewardDetailByRewardStage(param.SelectionId, 2, param.Order, param.Page, param.PageSize)
 	if err1 != nil {
 		return nil, err1
 	}
 	var talentRewardMsgs []vo.TalentRewardMsg
-	for _, secTaskInfo := range secTaskInfos {
-		talentInfo, _ := dao.TalentInfoDao{}.SelectTalentInfo(secTaskInfo.TalentID)
+	for _, selectionTaskInfo := range selectionTaskInfos {
+		platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(selectionTaskInfo.OpenID)
 		talentRewardMsg := vo.TalentRewardMsg{
-			PhotoUrl: talentInfo.Avatar,
-			Nickname: talentInfo.TalentNickname,
-			Account:  talentInfo.TalentWxOpenid,
-			Gender:   talentInfo.Sex,
-			OrderNum: secTaskInfo.SaleActual,
-			CashTime: secTaskInfo.WithdrawDate.Format("2006-01-02 15:04:05"),
+			PhotoUrl:   platformKuaishouUserInfo.HeadUri,
+			Nickname:   platformKuaishouUserInfo.NickName,
+			Account:    platformKuaishouUserInfo.OpenID,
+			PlatformId: platformKuaishouUserInfo.PlatformID,
+			City:       platformKuaishouUserInfo.City,
+			Gender:     platformKuaishouUserInfo.Gender,
+			OrderNum:   selectionTaskInfo.SaleActual,
+			CashTime:   selectionTaskInfo.WithdrawDate.Format("2006-01-02 15:04:05"),
+			TaskId:     selectionTaskInfo.TaskID,
 		}
 		talentRewardMsgs = append(talentRewardMsgs, talentRewardMsg)
 	}

+ 2 - 0
app/vo/balance_param.go

@@ -5,4 +5,6 @@ type BalanceParam struct {
 	FrozenState  int64  `json:"frozen_state"`  // 冻结状态(1冻结中 2冻结解除)
 	Page         int    `json:"page"`
 	PageSize     int    `json:"page_size"`
+
+	Others string `json:"others"` // 任务标题/任务ID/创建者
 }

+ 6 - 0
app/vo/common_param.go

@@ -0,0 +1,6 @@
+package vo
+
+type CommonParam struct {
+	EnterpriseId string `json:"enterprise_id"`
+	SubAccountId int64  `json:"sub_account_id"`
+}

+ 10 - 10
app/vo/default_search_param.go

@@ -1,15 +1,15 @@
 package vo
 
 type DefaultSearchParam struct {
-	EnterpriseId string `json:"enterprise_id"`
-	SubAccountId int64  `json:"sub_account_id"`
-	Page         int    `json:"page"`
-	PageSize     int    `json:"page_size"`
-	Platform     int64  `json:"platform"`
-	ProjectType  int64  `json:"project_type"` // 任务类型,0全部 1品牌种草,2本地生活
-	DefaultType  int64  `json:"default_type"` // 违约类型 1未传初稿 2未发作品 3未传数据 4终止合作 5已解约
+	//EnterpriseId string `json:"enterprise_id"`
+	//SubAccountId int64  `json:"sub_account_id"`
+	Page        int    `json:"page"`
+	PageSize    int    `json:"page_size"`
+	Platform    int64  `json:"platform"`
+	TaskType    int64  `json:"task_type"`    // 任务类型,0全部 1品牌种草,2本地生活
+	DefaultType int64  `json:"default_type"` // 违约类型 1未传初稿 2未发作品 3未传数据 4终止合作 5已解约
+	Others      string `json:"others"`       // 任务标题/任务ID/创建者
 
-	TaskId string `json:"task_id"` // 任务ID
-	//ProjectName string `json:"project_name"` // 任务标题
-	//CreatorName string `json:"creator_name"` // 创建者
+	TaskId     string `json:"task_id"`     // 任务ID
+	TalentName string `json:"talent_name"` // 达人昵称
 }

+ 20 - 0
app/vo/info_auto_default_param.go

@@ -0,0 +1,20 @@
+package vo
+
+type InfoAutoDefaultParam struct {
+	EnterpriseId string `json:"enterprise_id"`
+	SubAccountId int64  `json:"sub_account_id"`
+
+	SketchOtherTimeOut   int64 `json:"sketch_other_time_out"`
+	SketchOtherNotUpload int64 `json:"sketch_other_not_upload"`
+	LinkReplaceTimeOut   int64 `json:"link_replace_time_out"`
+	LinkReplaceNotUpload int64 `json:"link_replace_not_upload"`
+	DataReplaceTimeOut   int64 `json:"data_replace_time_out"`
+	DataReplaceNotUpload int64 `json:"data_replace_not_upload"`
+
+	//SketchOtherTimeOutOperator   string `json:"sketch_other_time_out_operator"`
+	//SketchOtherNotUploadOperator string `json:"sketch_other_not_upload_operator"`
+	//LinkReplaceTimeOutOperator   string `json:"link_replace_time_out_operator"`
+	//LinkReplaceNotUploadOperator string `json:"link_replace_not_upload_operator"`
+	//DataReplaceTimeOutOperator   string `json:"data_replace_time_out_operator"`
+	//DataReplaceNotUploadOperator string `json:"data_replace_not_upload_operator"`
+}

+ 30 - 0
app/vo/info_auto_param.go

@@ -0,0 +1,30 @@
+package vo
+
+type InfoAutoParam struct {
+	EnterpriseId string `json:"enterprise_id"`
+	SubAccountId int64  `json:"sub_account_id"`
+
+	ReviewAuto                   int64 `json:"review_auto"`
+	LinkReviewAuto               int64 `json:"link_review_auto"`
+	TaskFinishAuto               int64 `json:"task_finish_auto"`
+	Invalid                      int64 `json:"invalid"`
+	SelectionInvalid             int64 `json:"selection_invalid"`
+	DraftDefault                 int64 `json:"draft_default"`
+	DraftCooperateProjectDefault int64 `json:"draft_cooperate_project_default"`
+	DraftStoreDefault            int64 `json:"draft_store_default"`
+	DraftCooperateLocalDefault   int64 `json:"draft_cooperate_local_default"`
+	LinkBreach                   int64 `json:"link_breach"`
+	CaseCloseDefault             int64 `json:"case_close_default"`
+
+	//ReviewAutoOperator                   string `json:"review_auto_operator"`
+	//LinkReviewAutoOperator               string `json:"link_review_auto_operator"`
+	//TaskFinishAutoOperator               string `json:"task_finish_auto_operator"`
+	//InvalidOperator                      string `json:"invalid_operator"`
+	//SelectionInvalidOperator             string `json:"selection_invalid_operator"`
+	//DraftDefaultOperator                 string `json:"draft_default_operator"`
+	//DraftCooperateProjectDefaultOperator string `json:"draft_cooperate_project_default_operator"`
+	//DraftStoreDefaultOperator            string `json:"draft_store_default_operator"`
+	//DraftCooperateLocalDefaultOperator   string `json:"draft_cooperate_local_default_operator"`
+	//LinkBreachOperator                   string `json:"link_breach_operator"`
+	//CaseCloseDefaultOperator             string `json:"case_close_default_operator"`
+}

+ 1 - 1
app/vo/local_draft_param.go

@@ -8,5 +8,5 @@ type LocalDraftParam struct {
 	LocalPlatform int64  `json:"local_platform"` // 平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 	LocalType     int64  `json:"local_type"`     // 项目类型 1全流程 2专项
 
-	//ProjectId string `json:"project_id"` // 任务ID
+	Others string `json:"others"` // 任务标题/任务ID/创建者
 }

+ 12 - 13
app/vo/local_search_param.go

@@ -1,18 +1,17 @@
 package vo
 
 type LocalSearchParam struct {
-	EnterpriseId  string `json:"enterprise_id"`
-	SubAccountId  int64  `json:"sub_account_id"`
-	Page          int    `json:"page"`
-	PageSize      int    `json:"page_size"`
-	LocalType     int64  `json:"local_type"` // 项目类型,1全流程项目,2专项项目
-	LocalPlatform int64  `json:"local_platform"`
-	LocalStatus   int64  `json:"local_status"` // 任务状态,1-10代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
-	LocalForm     int64  `json:"local_form"`   // 任务形式,1-2分别代表线下探店,素材分发
-	ContentType   int64  `json:"content_type"` // 内容形式, 1图文 2视频
-	Order         int64  `json:"order"`        // 排序 0降序 1升序(默认0)
+	//EnterpriseId  string `json:"enterprise_id"`
+	//SubAccountId  int64  `json:"sub_account_id"`
+	Page          int   `json:"page"`
+	PageSize      int   `json:"page_size"`
+	LocalType     int64 `json:"local_type"` // 项目类型,1全流程项目,2专项项目
+	LocalPlatform int64 `json:"local_platform"`
+	LocalStatus   int64 `json:"local_status"` // 任务状态,1-10代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	LocalForm     int64 `json:"local_form"`   // 任务形式,1-2分别代表线下探店,素材分发
+	ContentType   int64 `json:"content_type"` // 内容形式, 1图文 2视频
+	Order         int64 `json:"order"`        // 排序 0降序 1升序(默认0)
 
-	LocalId   string `json:"local_id"`   // 任务ID
-	LocalName string `json:"local_name"` // 任务标题
-	//CreatorName string `json:"creator_name"` // 创建者
+	LocalId string `json:"local_id"` // 任务ID
+	Others  string `json:"others"`   // 任务标题/任务ID/创建者
 }

+ 6 - 6
app/vo/local_talent_operate_param.go

@@ -1,10 +1,10 @@
 package vo
 
 type LocalTalentOperateParam struct {
-	TaskId       string   `json:"task_id"`
-	TaskIds      []string `json:"task_ids"`
-	Status       int64    `json:"status"` // 1同意 2拒绝
-	Reason       string   `json:"reason"`
-	EnterpriseId string   `json:"enterprise_id"`
-	SubAccountId int64    `json:"sub_account_id"`
+	TaskId  string   `json:"task_id"`
+	TaskIds []string `json:"task_ids"`
+	Status  int64    `json:"status"` // 1同意 2拒绝
+	Reason  string   `json:"reason"`
+	//EnterpriseId string   `json:"enterprise_id"`
+	//SubAccountId int64    `json:"sub_account_id"`
 }

+ 3 - 3
app/vo/local_update_param.go

@@ -1,8 +1,8 @@
 package vo
 
 type LocalUpdateParam struct {
-	EnterpriseId      string  `json:"enterprise_id"`
-	SubAccountId      int64   `json:"sub_account_id"`
+	//EnterpriseId      string  `json:"enterprise_id"`
+	//SubAccountId      int64   `json:"sub_account_id"`
 	LocalID           string  `json:"local_id"`
 	StoreId           int64   `json:"store_id"`
 	TeamBuyingId      int64   `json:"team_buying_id"`
@@ -10,7 +10,7 @@ type LocalUpdateParam struct {
 	PromoteBody       int64   `json:"promote_body"` // 推广主体(1门店 2团购)
 	//LocalType         int64                        `json:"local_type"`        // 项目类型,1代表全流程项目,2代表专项项目
 	Donate int64 `json:"donate"` // 赠送达人套餐(1有赠送 2无赠送)
-	//LocalStatus      int64                        `json:"local_status"`      // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	//LocalStatus      int64                        `json:"local_status"`      // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
 	LocalName        string                       `json:"local_name"`        // 项目名称(任务标题)
 	TalentType       string                       `json:"talent_type"`       // 达人类型(,分隔)
 	RecruitDdl       string                       `json:"recruit_ddl"`       // 招募截止时间

+ 10 - 0
app/vo/logistics_selection_talent_param.go

@@ -0,0 +1,10 @@
+package vo
+
+type LogisticsSelectionTalentParam struct {
+	SelectionId  string `json:"selection_id"`
+	Status       int64  `json:"status"`        // 1待发货 2待签收 3已签收
+	DeliveryTime string `json:"delivery_time"` // 发货时间
+	Nickname     string `json:"nickname"`      // 达人昵称
+	Page         int    `json:"page"`
+	PageSize     int    `json:"page_size"`
+}

+ 3 - 3
app/vo/logistics_talent_param.go

@@ -4,7 +4,7 @@ type LogisticsTalentParam struct {
 	ProjectId    string `json:"project_id"`
 	Status       int64  `json:"status"`        // 1待发货 2待签收 3已签收
 	DeliveryTime string `json:"delivery_time"` // 发货时间
-	//Nickname  string `json:"nickname"` // 达人昵称
-	Page     int `json:"page"`
-	PageSize int `json:"page_size"`
+	Nickname     string `json:"nickname"`      // 达人昵称
+	Page         int    `json:"page"`
+	PageSize     int    `json:"page_size"`
 }

+ 11 - 11
app/vo/project_create_param.go

@@ -1,17 +1,17 @@
 package vo
 
 type ProjectCreateParam struct {
-	EnterpriseId      string                  `json:"enterprise_id"`
-	SubAccountId      int64                   `json:"sub_account_id"`
-	Platform          int64                   `json:"platform"`
-	ProductId         int64                   `json:"product_id"`
-	ServiceChargeRate float64                 `json:"service_charge_rate"`
-	ProjectType       int64                   `json:"project_type"`      // 项目类型,1代表全流程项目,2代表专项项目
-	ProjectStatus     int64                   `json:"project_status"`    // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
-	ProjectName       string                  `json:"task_name"`         // 项目名称(任务标题)
-	TalentType        string                  `json:"talent_type"`       // 达人类型
-	RecruitDdl        string                  `json:"recruit_ddl"`       // 招募截止时间
-	RecruitStrategys  []CreateRecruitStrategy `json:"recruit_strategys"` // 招募策略
+	EnterpriseId      string  `json:"enterprise_id"`
+	SubAccountId      int64   `json:"sub_account_id"`
+	Platform          int64   `json:"platform"`
+	ProductId         int64   `json:"product_id"`
+	ServiceChargeRate float64 `json:"service_charge_rate"`
+	ProjectType       int64   `json:"project_type"` // 项目类型,1代表全流程项目,2代表专项项目
+	//ProjectStatus     int64                   `json:"project_status"`    // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
+	ProjectName      string                  `json:"task_name"`         // 项目名称(任务标题)
+	TalentType       string                  `json:"talent_type"`       // 达人类型
+	RecruitDdl       string                  `json:"recruit_ddl"`       // 招募截止时间
+	RecruitStrategys []CreateRecruitStrategy `json:"recruit_strategys"` // 招募策略
 
 	ProjectForm     int64                  `json:"project_form"`   // 项目形式,1-3分别代表商品寄拍、素材分发、虚拟产品测评
 	ContentType     int64                  `json:"content_type"`   // 内容形式,1代表图文,2代表视频

+ 1 - 1
app/vo/project_draft_param.go

@@ -8,5 +8,5 @@ type ProjectDraftParam struct {
 	ProjectPlatform int64  `json:"project_platform"` // 平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 	ProjectType     int64  `json:"project_type"`     // 项目类型 1全流程 2专项
 
-	//ProjectId string `json:"project_id"` // 任务ID
+	Others string `json:"others"` // 任务标题/任务ID/创建者
 }

+ 12 - 13
app/vo/project_search_param.go

@@ -1,18 +1,17 @@
 package vo
 
 type ProjectSearchParam struct {
-	EnterpriseId    string `json:"enterprise_id"`
-	SubAccountId    int64  `json:"sub_account_id"`
-	Page            int    `json:"page"`
-	PageSize        int    `json:"page_size"`
-	ProjectType     int64  `json:"project_type"` // 项目类型,1全流程项目,2专项项目
-	ProjectPlatform int64  `json:"project_platform"`
-	ProjectStatus   int64  `json:"project_status"` // 任务状态,1-10代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
-	ProjectForm     int64  `json:"project_form"`   // 任务形式,1-5代表商品寄拍、素材分发、虚拟产品测评、线下探店打卡、素材微原创
-	ContentType     int64  `json:"content_type"`   // 内容形式, 1图文 2视频
-	Order           int64  `json:"order"`          // 排序 0降序 1升序(默认0)
+	//EnterpriseId    string `json:"enterprise_id"`
+	//SubAccountId    int64  `json:"sub_account_id"`
+	Page            int   `json:"page"`
+	PageSize        int   `json:"page_size"`
+	ProjectType     int64 `json:"project_type"` // 项目类型,1全流程项目,2专项项目
+	ProjectPlatform int64 `json:"project_platform"`
+	ProjectStatus   int64 `json:"project_status"` // 任务状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
+	ProjectForm     int64 `json:"project_form"`   // 任务形式,1-5代表商品寄拍、素材分发、虚拟产品测评、线下探店打卡、素材微原创
+	ContentType     int64 `json:"content_type"`   // 内容形式, 1图文 2视频
+	Order           int64 `json:"order"`          // 排序 0降序 1升序(默认0)
 
-	ProjectId   string `json:"project_id"`   // 任务ID
-	ProjectName string `json:"project_name"` // 任务标题
-	//CreatorName string `json:"creator_name"` // 创建者
+	ProjectId string `json:"project_id"` // 任务ID
+	Others    string `json:"others"`     // 任务标题/任务ID/创建者
 }

+ 3 - 3
app/vo/project_update_param.go

@@ -1,13 +1,13 @@
 package vo
 
 type ProjectUpdateParam struct {
-	EnterpriseId      string  `json:"enterprise_id"`
-	SubAccountId      int64   `json:"sub_account_id"`
+	//EnterpriseId      string  `json:"enterprise_id"`
+	//SubAccountId      int64   `json:"sub_account_id"`
 	ProjectID         string  `json:"project_id"`
 	ProductId         int64   `json:"product_id"`
 	ServiceChargeRate float64 `json:"service_charge_rate"`
 	ProjectType       int64   `json:"project_type"` // 项目类型,1代表全流程项目,2代表专项项目
-	//ProjectStatus     int64                   `json:"project_status"`    // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	//ProjectStatus     int64                   `json:"project_status"`    // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
 	ProjectName      string                  `json:"task_name"`         // 项目名称(任务标题)
 	TalentType       string                  `json:"talent_type"`       // 达人类型
 	RecruitDdl       string                  `json:"recruit_ddl"`       // 招募截止时间

+ 1 - 0
app/vo/re_bill_local_task_preview.go

@@ -6,6 +6,7 @@ type ReBillLocalTaskPreview struct {
 	StoreLocation string `json:"storeLocation"`
 	StoreId       int64  `json:"storeId"`
 	TeamBuyingId  int64  `json:"teamBuyingId"`
+	LocalName     string `json:"localName"`
 
 	EnterpriseId  string  `json:"enterpriseId"`
 	SubAccountId  int64   `json:"subAccountId"`

+ 1 - 0
app/vo/re_bill_project_task_preview.go

@@ -5,6 +5,7 @@ type ReBillProjectTaskPreview struct {
 	MainImage    string  `json:"mainImage"`
 	ProductName  string  `json:"productName"`
 	ProductPrice float64 `json:"productPrice"`
+	ProjectName  string  `json:"projectName"`
 
 	EnterpriseId    string  `json:"enterpriseId"`
 	SubAccountId    int64   `json:"subAccountId"`

+ 5 - 4
app/vo/re_bill_selection_task_preview.go

@@ -1,10 +1,11 @@
 package vo
 
 type ReBillSelectionTaskPreview struct {
-	ProductId    int64   `json:"productId"`
-	MainImage    string  `json:"mainImage"`
-	ProductName  string  `json:"productName"`
-	ProductPrice float64 `json:"productPrice"`
+	ProductId     int64   `json:"productId"`
+	MainImage     string  `json:"mainImage"`
+	ProductName   string  `json:"productName"`
+	ProductPrice  float64 `json:"productPrice"`
+	SelectionName string  `json:"selectionName"`
 
 	EnterpriseId      string `json:"enterpriseId"`
 	SubAccountId      int64  `json:"subAccountId"`

+ 27 - 0
app/vo/re_info_auto.go

@@ -0,0 +1,27 @@
+package vo
+
+type ReInfoAuto struct {
+	ReviewAuto                   int64 `json:"reviewAuto"`
+	LinkReviewAuto               int64 `json:"linkReviewAuto"`
+	TaskFinishAuto               int64 `json:"taskFinishAuto"`
+	Invalid                      int64 `json:"invalid"`
+	SelectionInvalid             int64 `json:"selectionInvalid"`
+	DraftDefault                 int64 `json:"draftDefault"`
+	DraftCooperateProjectDefault int64 `json:"draftCooperateProjectDefault"`
+	DraftStoreDefault            int64 `json:"draftStoreDefault"`
+	DraftCooperateLocalDefault   int64 `json:"draftCooperateLocalDefault"`
+	LinkBreach                   int64 `json:"linkBreach"`
+	CaseCloseDefault             int64 `json:"caseCloseDefault"`
+
+	ReviewAutoOperator                   string `json:"reviewAutoOperator"`
+	LinkReviewAutoOperator               string `json:"linkReviewAutoOperator"`
+	TaskFinishAutoOperator               string `json:"taskFinishAutoOperator"`
+	InvalidOperator                      string `json:"invalidOperator"`
+	SelectionInvalidOperator             string `json:"selectionInvalidOperator"`
+	DraftDefaultOperator                 string `json:"draftDefaultOperator"`
+	DraftCooperateProjectDefaultOperator string `json:"draftCooperateProjectDefaultOperator"`
+	DraftStoreDefaultOperator            string `json:"draftStoreDefaultOperator"`
+	DraftCooperateLocalDefaultOperator   string `json:"draftCooperateLocalDefaultOperator"`
+	LinkBreachOperator                   string `json:"linkBreachOperator"`
+	CaseCloseDefaultOperator             string `json:"caseCloseDefaultOperator"`
+}

+ 17 - 0
app/vo/re_info_auto_default.go

@@ -0,0 +1,17 @@
+package vo
+
+type ReInfoAutoDefault struct {
+	SketchOtherTimeOut   int64 `json:"sketchOtherTimeOut"`
+	SketchOtherNotUpload int64 `json:"sketchOtherNotUpload"`
+	LinkReplaceTimeOut   int64 `json:"linkReplaceTimeOut"`
+	LinkReplaceNotUpload int64 `json:"linkReplaceNotUpload"`
+	DataReplaceTimeOut   int64 `json:"dataReplaceTimeOut"`
+	DataReplaceNotUpload int64 `json:"dataReplaceNotUpload"`
+
+	SketchOtherTimeOutOperator   string `json:"sketchOtherTimeOutOperator"`
+	SketchOtherNotUploadOperator string `json:"sketchOtherNotUploadOperator"`
+	LinkReplaceTimeOutOperator   string `json:"linkReplaceTimeOutOperator"`
+	LinkReplaceNotUploadOperator string `json:"linkReplaceNotUploadOperator"`
+	DataReplaceTimeOutOperator   string `json:"dataReplaceTimeOutOperator"`
+	DataReplaceNotUploadOperator string `json:"dataReplaceNotUploadOperator"`
+}

+ 14 - 7
app/vo/re_local_detail.go

@@ -5,15 +5,22 @@ import (
 )
 
 type ReLocalDetail struct {
+	LocalName string `json:"localName"` // 任务标题
 	// 系统信息
 	LocalId           string  `json:"localId"`           // 项目id
 	LocalStatus       int64   `json:"localStatus"`       // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
 	LocalPlatform     int64   `json:"localPlatform"`     //  项目平台,1-7分别代表红book、抖音、微博、快手、b站、大众点评、知乎
 	CreatedAt         string  `json:"createdAt"`         // 创建时间
+	SubmitAt          string  `json:"submitAt"`          // 提交审核时间
+	PassAt            string  `json:"passAt"`            // 招募开始时间(审核通过时间)
+	AutoFailAt        string  `json:"payEndAt"`          // 支付截止时间
+	StartAt           string  `json:"startAt"`           // 执行开始时间(支付时间)
+	FinishAt          string  `json:"finishAt"`          // 结案时间
+	FailAt            string  `json:"failAt"`            // 失效时间
 	CreatorName       string  `json:"creatorName"`       // 创建者
 	Phone             string  `json:"phone"`             // 联系方式
 	WX                string  `json:"wx"`                // 微信
-	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估
+	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估  2025.04.03:支付前是预估一口价+"自报价"字符串  支付后是同意的达人的一口价和自报价即need_pay字段
 	ServiceChargeRate float64 `json:"serviceChargeRate"` // 公开服务费率
 	// 支付方式参数待定
 	// 关联主体
@@ -26,12 +33,12 @@ type ReLocalDetail struct {
 	RecruitDdl       string                  `json:"recruitDdl"`
 	RecruitStrategys []*LocalRecruitStrategy `json:"recruitStrategys"` // 招募策略
 	// 执行要求
-	TaskForm      int64                     `json:"taskForm"`
-	ContentType   int64                     `json:"contentType"`
-	TaskDetail    string                    `json:"taskDetail"`
-	TaskBriefs    []*entity.ProjectBrief    `json:"taskBriefs"`    // 选品brief列表
-	TaskMaterials []*entity.ProjectMaterial `json:"taskMaterials"` // 选品示例列表
-	Tools         string                    `json:"tools"`         // 工具选择
+	TaskForm      int64                       `json:"taskForm"`
+	ContentType   int64                       `json:"contentType"`
+	TaskDetail    string                      `json:"taskDetail"`
+	TaskBriefs    []*entity.LocalLifeBrief    `json:"taskBriefs"`    // 选品brief列表
+	TaskMaterials []*entity.LocalLifeMaterial `json:"taskMaterials"` // 选品示例列表
+	Tools         string                      `json:"tools"`         // 工具选择
 }
 
 type LocalRecruitStrategy struct {

+ 1 - 0
app/vo/re_local_store_explore_preview.go

@@ -6,6 +6,7 @@ type ReLocalStoreExplorePreview struct {
 	StoreLocation string `json:"storeLocation"`
 	StoreId       int64  `json:"storeId"`
 	TeamBuyingId  int64  `json:"teamBuyingId"`
+	LocalName     string `json:"localName"`
 
 	EnterpriseId  string `json:"enterpriseId"`
 	SubAccountId  int64  `json:"subAccountId"`

+ 1 - 0
app/vo/re_local_task_preview.go

@@ -6,6 +6,7 @@ type ReLocalTaskPreview struct {
 	StoreLocation string `json:"storeLocation"`
 	StoreId       int64  `json:"storeId"`
 	TeamBuyingId  int64  `json:"teamBuyingId"`
+	LocalName     string `json:"localName"`
 
 	EnterpriseId  string  `json:"enterpriseId"`
 	SubAccountId  int64   `json:"subAccountId"`

+ 16 - 0
app/vo/re_logistics_export.go

@@ -0,0 +1,16 @@
+package vo
+
+type LogisticsExport struct {
+	TalentId        string
+	TalentName      string
+	ReceiverName    string
+	PhoneNumber     string
+	Province        string
+	City            string
+	County          string
+	DetailAddr      string
+	CompanyName     string
+	LogisticsNumber string
+	Operator        string
+	Time            string
+}

+ 4 - 0
app/vo/re_logistics_talent.go

@@ -1,6 +1,7 @@
 package vo
 
 type ReLogisticsTalent struct {
+	TaskId             string         `json:"taskId"`
 	LogisticsId        int64          `json:"logisticsId"`        // 物流id
 	CompanyName        string         `json:"companyName"`        // 快递公司
 	LogisticsNumber    string         `json:"logisticsNumber"`    // 快递单号
@@ -16,5 +17,8 @@ type TalentPreview struct {
 	TalentPhoto string `json:"talentPhoto"`
 	TalentName  string `json:"talentName"`
 	Account     string `json:"account"`
+	PlatformId  int64  `json:"platformId"`
 	Location    string `json:"location"`
+	Gender      string `json:"gender"`
+	TaskId      string `json:"taskId"`
 }

+ 7 - 1
app/vo/re_project_detail.go

@@ -11,10 +11,16 @@ type ReProjectDetail struct {
 	ProjectStatus     int64   `json:"projectStatus"`     // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
 	ProjectPlatform   int64   `json:"projectPlatform"`   //  项目平台,1-7分别代表红book、抖音、微博、快手、b站、大众点评、知乎
 	CreatedAt         string  `json:"createdAt"`         // 创建时间
+	SubmitAt          string  `json:"submitAt"`          // 提交审核时间
+	PassAt            string  `json:"passAt"`            // 招募开始时间(审核通过时间)
+	AutoFailAt        string  `json:"payEndAt"`          // 支付截止时间
+	StartAt           string  `json:"startAt"`           // 执行开始时间(支付时间)
+	FinishAt          string  `json:"finishAt"`          // 结案时间
+	FailAt            string  `json:"failAt"`            // 失效时间
 	CreatorName       string  `json:"creatorName"`       // 创建者
 	Phone             string  `json:"phone"`             // 联系方式
 	WX                string  `json:"wx"`                // 微信
-	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估
+	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估  2025.04.03:支付前是预估一口价+"自报价"字符串  支付后是同意的达人的一口价和自报价即need_pay字段
 	ServiceChargeRate float64 `json:"serviceChargeRate"` // 公开服务费率
 	// 支付方式参数待定
 	// 关联商品

+ 1 - 0
app/vo/re_project_task_preview.go

@@ -5,6 +5,7 @@ type ReProjectTaskPreview struct {
 	MainImage    string  `json:"mainImage"`
 	ProductName  string  `json:"productName"`
 	ProductPrice float64 `json:"productPrice"`
+	ProjectName  string  `json:"projectName"`
 
 	EnterpriseId    string  `json:"enterpriseId"`
 	SubAccountId    int64   `json:"subAccountId"`

+ 7 - 4
app/vo/re_recharge_info.go

@@ -6,8 +6,11 @@ type ReRechargeInfo struct {
 	RechargeAmount     float64 `json:"rechargeAmount"`
 	RechargeMethod     int64   `json:"rechargeMethod"` // 1对公转账 2微信支付
 	TransferVoucherUrl string  `json:"transferVoucherUrl"`
-	CommitAt           string  `json:"commitAt"`   // 充值申请提交时间
-	ConfirmAt          string  `json:"confirmAt"`  // 充值确认时间
-	RefuseAt           string  `json:"refuseAt"`   // 充值失败时间
-	FailReason         string  `json:"failReason"` // 失败原因
+	CommitAt           string  `json:"commitAt"`      // 充值申请提交时间
+	ConfirmAt          string  `json:"confirmAt"`     // 充值确认时间
+	RefuseAt           string  `json:"refuseAt"`      // 充值失败时间
+	FailReason         string  `json:"failReason"`    // 失败原因
+	RechargingNum      int64   `json:"rechargingNum"` // 充值待确认
+	RechargedNum       int64   `json:"rechargedNum"`  // 已充值
+	FailNum            int64   `json:"failNum"`       // 充值失败
 }

+ 6 - 1
app/vo/re_selection_detail.go

@@ -11,11 +11,16 @@ type ReSelectionDetail struct {
 	SelectionStatus   int64   `json:"selectionStatus"`   // 项目状态,1-8分别代表创建中、待审核、审核通过、待支付、已支付、执行中、失效、已结案
 	SelectionPlatform int64   `json:"selectionPlatform"` //  项目平台,1-7分别代表红book、抖音、微博、快手、b站、大众点评、知乎
 	CreatedAt         string  `json:"createdAt"`         // 创建时间
+	SubmitAt          string  `json:"submitAt"`          // 提交审核时间
+	PassAt            string  `json:"passAt"`            // 招募开始时间(审核通过时间)
+	AutoFailAt        string  `json:"payEndAt"`          // 支付截止时间
+	StartAt           string  `json:"startAt"`           // 执行开始时间(支付时间)
+	FinishAt          string  `json:"finishAt"`          // 结案时间
+	FailAt            string  `json:"failAt"`            // 失效时间
 	CreatorName       string  `json:"creatorName"`       // 创建者
 	Phone             string  `json:"phone"`             // 联系方式
 	WX                string  `json:"wx"`                // 微信
 	RewardSum         float64 `json:"rewardSum"`         // 悬赏池总金额
-	SubmitAt          string  `json:"submitAt"`          // 提交审核时间
 	// 支付方式参数待定
 	// 关联商品
 	ProductInfo *ReProductPreview `json:"productInfo"`

+ 9 - 6
app/vo/re_selection_reward_cash.go

@@ -9,10 +9,13 @@ type ReSelectionRewardCash struct {
 }
 
 type TalentRewardMsg struct {
-	PhotoUrl string `json:"photoUrl"`
-	Nickname string `json:"nickname"`
-	Account  string `json:"account"`
-	OrderNum int64  `json:"orderNum"`
-	CashTime string `json:"cashTime"`
-	Gender   int64  `json:"gender"` // 0未知 1男 2女
+	PhotoUrl   string `json:"photoUrl"`
+	Nickname   string `json:"nickname"`
+	Account    string `json:"account"`
+	PlatformId int64  `json:"platformId"`
+	City       string `json:"city"`
+	OrderNum   int64  `json:"orderNum"`
+	CashTime   string `json:"cashTime"`
+	Gender     string `json:"gender"` // U:未知;M,m:男; F女
+	TaskId     string `json:"taskId"`
 }

+ 5 - 4
app/vo/re_selection_task_preview.go

@@ -1,10 +1,11 @@
 package vo
 
 type ReSelectionTaskPreview struct {
-	ProductId    int64   `json:"productId"`
-	MainImage    string  `json:"mainImage"`
-	ProductName  string  `json:"productName"`
-	ProductPrice float64 `json:"productPrice"`
+	ProductId     int64   `json:"productId"`
+	MainImage     string  `json:"mainImage"`
+	ProductName   string  `json:"productName"`
+	ProductPrice  float64 `json:"productPrice"`
+	SelectionName string  `json:"selectionName"`
 
 	EnterpriseId        string  `json:"enterpriseId"`
 	SubAccountId        int64   `json:"subAccountId"`

+ 5 - 2
app/vo/re_talent_default.go

@@ -3,14 +3,17 @@ package vo
 type ReTalentDefault struct {
 	TalentId     string  `json:"talentId"`
 	OpenId       string  `json:"openId"` // 表platform_kuaishou_user_info
+	PlatformId   int64   `json:"platformId"`
 	NickName     string  `json:"nickName"`
 	HeadUri      string  `json:"headUri"`
 	City         string  `json:"city"`
+	Gender       string  `json:"gender"`       // U:未知;M,m:男;F f女
 	TalentPhone  string  `json:"talentPhone"`  // 表youngee_talent_info
 	TaskId       string  `json:"taskId"`       // 任务id
 	DraftFee     float64 `json:"draftFee"`     // 稿费价格
 	SettleAmount float64 `json:"settleAmount"` // 结算金额
 	DefaultTime  string  `json:"defaultTime"`  // 违约时间
-	Reason       string  `json:"reason"`       // 终止理由或解约原因
-	OperatorName string  `json:"operatorName"` // 操作人
+
+	Reason       string `json:"reason"`       // 终止理由或解约原因
+	OperatorName string `json:"operatorName"` // 操作人
 }

+ 6 - 0
app/vo/re_task_default_public.go

@@ -5,6 +5,12 @@ type ReTaskDefaultPublic struct {
 	MainImage    string  `json:"mainImage"`
 	ProductName  string  `json:"productName"`
 	ProductPrice float64 `json:"productPrice"`
+	TaskName     string  `json:"taskName"`
+
+	StoreName     string `json:"storeName"`
+	StoreLocation string `json:"storeLocation"`
+	StoreId       int64  `json:"storeId"`
+	TeamBuyingId  int64  `json:"teamBuyingId"`
 
 	EnterpriseId      string `json:"enterpriseId"`
 	SubAccountId      int64  `json:"subAccountId"`

+ 2 - 0
app/vo/recharge_param.go

@@ -6,4 +6,6 @@ type RechargeParam struct {
 	RechargeState int64  `json:"recharge_state"` // 充值状态(1充值待确认 2已充值 3充值失败)
 	Page          int    `json:"page"`
 	PageSize      int    `json:"page_size"`
+
+	Others string `json:"others"` // 充值流水号或操作人
 }

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません