62 Commits d926bbaf31 ... 607d4d0305

Author SHA1 Message Date
  Xingyu Xian 607d4d0305 merge 3 weeks ago
  Xingyu Xian f5cda4f95e selection_task_list_detail_bug 3 weeks ago
  Xingyu Xian 75a2e30b67 selection_task_list_detail 3 weeks ago
  Ethan c294f55961 Merge branch 'refs/heads/develop-zhou' into develop 3 weeks ago
  Ethan d011509e4e 种草物流 3 weeks ago
  Xingyu Xian 43b588c494 selection_add_sub_account 3 weeks ago
  Xingyu Xian 9a4c9fdbb0 selection_logistic_condition 3 weeks ago
  Ethan fb7f382cef Merge branch 'refs/heads/develop-zhou' into develop 3 weeks ago
  Ethan 5a23004468 fix_selectionReview 3 weeks ago
  lin-jim-leon adbb6ffc90 Merge remote-tracking branch 'origin/develop' into develop 4 weeks ago
  lin-jim-leon 51ee706ff4 [20250325]合作达人名单+bug修改+查名单 4 weeks ago
  Xingyu Xian 32840fa8b6 Merge remote-tracking branch 'origin/develop' into develop 4 weeks ago
  Xingyu Xian 7ac7a15a17 selection_condition 4 weeks ago
  Ethan 93ad8d4d0d 列表角标all~真心累 1 month ago
  Ethan 2180476b56 Merge branch 'refs/heads/develop' into develop-zhou 1 month ago
  Ethan 63bf1ce5e6 列表角标~累瘫了 1 month ago
  lin-jim-leon b2da9d8296 Merge remote-tracking branch 'origin/develop' into develop 1 month ago
  lin-jim-leon 9d2b5aa04a [20250323]合作达人名单+查缺补漏 1 month ago
  Xingyu Xian 87053fda24 sub_account_condition_name 1 month ago
  Xingyu Xian b885f2bfc7 sub_account_condition 1 month ago
  Ethan 02499562d5 fix_search 1 month ago
  Ethan 4614085707 策略配置 1 month ago
  Ethan ac5b8300af 合作待办 1 month ago
  Ethan 0d26a08e94 财务待办 1 month ago
  Ethan ddcc7e98d2 开票金额数据 1 month ago
  Ethan 03d1b0bdec fix_充值记录字段 1 month ago
  Ethan 75935f5c8a 违约管理 1 month ago
  Ethan c7fab1eb81 探店邀约 1 month ago
  Ethan 8921a1bc0d 寄样物流待办 1 month ago
  Ethan e9517c0b2e 公开&定向任务待办 1 month ago
  Ethan 7458957d6a fix_搜索框 1 month ago
  Ethan 60a8873cfc fix_任务状态过滤 1 month ago
  Ethan 7969fbcb82 fix_结束任务 1 month ago
  Ethan a47cbf6837 fix_复制任务 1 month ago
  Ethan f793c1aa17 Merge branch 'refs/heads/develop' into develop-zhou 1 month ago
  Ethan c87b8256fb fix_种草待筛选 1 month ago
  lin-jim-leon 96250cc0f3 [20250214]结案时非服务商选结案数+1 2 months ago
  Xingyu Xian 12f9ecbb88 SubAccountCenter 3 months ago
  Xingyu Xian cf53d454e8 jobCenterBug 3 months ago
  Xingyu Xian 6c9a0dfcaa subAccountBugs 3 months ago
  Ethan a2066c258e fix_门店&团购管理 3 months ago
  Ethan 7a910afe95 fix_商品商库 3 months ago
  Ethan bc645fd4ea fix_门店类目 3 months ago
  Ethan a9c7d1f6bb fix_服务商邀请 3 months ago
  Ethan e7e65f60cf 服务商-邀约合作 3 months ago
  Ethan 6eb6a634c1 platform_icon 3 months ago
  Ethan 47a0f6fee3 fix_本地生活子任务 3 months ago
  Ethan 17fcade3fb fix_种草&快照 4 months ago
  Xingyu Xian 92e7659d4c taskDateBug 4 months ago
  Xingyu Xian 2532a9ae14 taskListQuery 4 months ago
  Ethan b1dbeb0761 Merge branch 'refs/heads/develop-zhou' into develop 4 months ago
  Ethan d970d0caa6 fix_wx 4 months ago
  Xingyu Xian 3ad3840ad7 getUserInfoBug 4 months ago
  Xingyu Xian 77ecf3ea67 nothing 4 months ago
  Xingyu Xian b71e240c0c Merge branch 'refs/heads/XxY' into develop 4 months ago
  Ethan 7982b66af5 Merge branch 'refs/heads/develop-zhou' into develop 4 months ago
  Ethan 55cc025429 fix_create_product 4 months ago
  Xingyu Xian 3daaddd0ec selectionCalculate 4 months ago
  Xingyu Xian 58d9d854aa Merge branch 'XxY' into develop 4 months ago
  Ethan 19b027c74c Merge branch 'refs/heads/develop' into develop-zhou 4 months ago
  Ethan 38e3f5a0d1 fix_ddl&fields 4 months ago
  Ethan 1ed968ab1a fix_rewardPoolSum 4 months ago
100 changed files with 6538 additions and 673 deletions
  1. 279 0
      app/controller/account_controller.go
  2. 31 0
      app/controller/common_controller.go
  3. 36 2
      app/controller/cooperation_controller.go
  4. 46 0
      app/controller/finance_controller.go
  5. 231 8
      app/controller/task_controller.go
  6. 320 0
      app/controller/workspace_controller.go
  7. 12 0
      app/dao/common_dao.go
  8. 2 2
      app/dao/enterprise_supplier_cooperate_dao.go
  9. 14 5
      app/dao/info_auto_default_dao.go
  10. 9 0
      app/dao/info_auto_task_dao.go
  11. 11 0
      app/dao/invoice_record_dao.go
  12. 414 17
      app/dao/local_life_dao.go
  13. 29 29
      app/dao/local_life_task_info_dao.go
  14. 7 0
      app/dao/product_dao.go
  15. 356 14
      app/dao/project_dao.go
  16. 13 1
      app/dao/project_task_info_dao.go
  17. 12 1
      app/dao/recharge_record_dao.go
  18. 71 0
      app/dao/s_local_dao.go
  19. 41 41
      app/dao/s_project_dao.go
  20. 155 11
      app/dao/selection_info_dao.go
  21. 7 0
      app/dao/talent_info_dao.go
  22. 1 2
      app/entity/book_info.go
  23. 12 0
      app/entity/coop_platform.go
  24. 16 20
      app/entity/info_auto_default.go
  25. 35 15
      app/entity/info_auto_task.go
  26. 11 0
      app/entity/info_product_category.go
  27. 1 1
      app/entity/local_life_info.go
  28. 9 9
      app/entity/local_life_task_info.go
  29. 1 0
      app/entity/platform_kuaishou_user_info.go
  30. 4 1
      app/entity/project.go
  31. 22 22
      app/entity/project_task_info.go
  32. 41 0
      app/entity/s_local.go
  33. 33 17
      app/entity/s_project.go
  34. 1 1
      app/entity/selection_info.go
  35. 12 0
      app/entity/talent_category.go
  36. 13 4
      app/schedule/auto_task_review.go
  37. 4 3
      app/service/bill_service.go
  38. 17 0
      app/service/common_service.go
  39. 68 6
      app/service/cooperation_service.go
  40. 331 135
      app/service/default_service.go
  41. 60 0
      app/service/invoice_service.go
  42. 348 13
      app/service/local_life_service.go
  43. 47 0
      app/service/product_service.go
  44. 390 32
      app/service/project_service.go
  45. 55 1
      app/service/recharge_service.go
  46. 236 23
      app/service/selection_info_service.go
  47. 15 0
      app/service/store_service.go
  48. 36 3
      app/service/task_info_service.go
  49. 13 0
      app/service/teambuying_service.go
  50. 2 0
      app/vo/balance_param.go
  51. 6 0
      app/vo/common_param.go
  52. 4 4
      app/vo/default_search_param.go
  53. 20 0
      app/vo/info_auto_default_param.go
  54. 30 0
      app/vo/info_auto_param.go
  55. 1 1
      app/vo/local_draft_param.go
  56. 2 3
      app/vo/local_search_param.go
  57. 10 0
      app/vo/logistics_selection_talent_param.go
  58. 3 3
      app/vo/logistics_talent_param.go
  59. 1 0
      app/vo/product_create_param.go
  60. 1 1
      app/vo/project_draft_param.go
  61. 2 3
      app/vo/project_search_param.go
  62. 27 0
      app/vo/re_info_auto.go
  63. 17 0
      app/vo/re_info_auto_default.go
  64. 2 0
      app/vo/re_local_detail.go
  65. 1 0
      app/vo/re_logistics_talent.go
  66. 1 0
      app/vo/re_product_preview.go
  67. 2 0
      app/vo/re_project_detail.go
  68. 3 0
      app/vo/re_project_task_preview.go
  69. 7 4
      app/vo/re_recharge_info.go
  70. 1 0
      app/vo/re_selection_detail.go
  71. 1 0
      app/vo/re_store_info.go
  72. 1 0
      app/vo/re_store_preview.go
  73. 6 0
      app/vo/re_talent_category.go
  74. 4 2
      app/vo/re_talent_default.go
  75. 5 0
      app/vo/re_task_default_public.go
  76. 1 0
      app/vo/re_teambuying_preview.go
  77. 2 0
      app/vo/recharge_param.go
  78. 1 1
      app/vo/selection_draft_param.go
  79. 2 3
      app/vo/selection_search_param.go
  80. 3 0
      app/vo/supplier_search_param.go
  81. 80 10
      db/data.go
  82. 7 6
      db/job.go
  83. 96 12
      db/link.go
  84. 564 55
      db/locallife_task.go
  85. 46 0
      db/platform_kuaishou_user.go
  86. 619 80
      db/project_task.go
  87. 107 25
      db/sectask.go
  88. 6 0
      db/selection.go
  89. 97 14
      db/sketch.go
  90. 16 0
      db/sub_account.go
  91. 384 0
      db/talent.go
  92. 3 3
      db/task.go
  93. 55 0
      handler/delete_sub_account.go
  94. 58 0
      handler/find_all_job.go
  95. 58 0
      handler/find_all_sub_account.go
  96. 60 0
      handler/gatlocaltalentstatuscountnum.go
  97. 5 4
      handler/get_user_info.go
  98. 60 0
      handler/getgoodstalent.go
  99. 60 0
      handler/getlocallife.go
  100. 60 0
      handler/getlocalrecruittime.go

+ 279 - 0
app/controller/account_controller.go

@@ -3,6 +3,8 @@ package controller
 import (
 	"github.com/gin-gonic/gin"
 	"github.com/sirupsen/logrus"
+	"youngee_b_api/app/dao"
+	"youngee_b_api/app/entity"
 	"youngee_b_api/app/service/review_service"
 	"youngee_b_api/app/vo"
 )
@@ -27,3 +29,280 @@ func (t AccountController) OCRIdentify(c *gin.Context) {
 	}
 	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)
+}

+ 31 - 0
app/controller/common_controller.go

@@ -0,0 +1,31 @@
+package controller
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/app/service"
+)
+
+type CommonController struct{}
+
+// 获取合作平台列表
+func (t CommonController) CooperationPlatform(c *gin.Context) {
+	result, err := service.CommonService{}.CooperationPlatform()
+	if err != nil {
+		logrus.Errorf("[CooperationPlatform] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, result)
+}
+
+// 获取商品类目
+func (t CommonController) ProductCategory(c *gin.Context) {
+	result, err := service.ProductService{}.GetProductCategorys()
+	if err != nil {
+		logrus.Errorf("[ProductCategory] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, result)
+}

+ 36 - 2
app/controller/cooperation_controller.go

@@ -3,6 +3,7 @@ package controller
 import (
 	"github.com/gin-gonic/gin"
 	"github.com/sirupsen/logrus"
+	"strings"
 	"youngee_b_api/app/service"
 	"youngee_b_api/app/vo"
 )
@@ -46,8 +47,13 @@ func (o CooperationController) InviteSupplier(c *gin.Context) {
 	}
 	err1 := service.CooperationService{}.InviteSupplier(param)
 	if err1 != nil {
-		logrus.Errorf("[InviteSupplier] call Show err:%+v\n", err)
-		returnError(c, 40000, err.Error())
+		if strings.Contains(err1.Error(), "Duplicate entry") {
+			logrus.Errorf("[InviteSupplier] call Show err:%+v\n", err)
+			returnError(c, 40000, "请勿邀请已入库服务商")
+		} else {
+			logrus.Errorf("[InviteSupplier] call Show err:%+v\n", err)
+			returnError(c, 40000, err1.Error())
+		}
 		return
 	}
 	returnSuccess(c, 20000, nil)
@@ -89,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{}
@@ -262,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)
+}

+ 231 - 8
app/controller/task_controller.go

@@ -69,7 +69,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,7 +122,30 @@ 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() == "任务不存在" {
+			returnError(c, 30000, err.Error())
+			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)
 }
 
@@ -162,7 +184,6 @@ func (t TaskController) SelectionTaskList(c *gin.Context) {
 		returnError(c, 40000, err.Error())
 		return
 	}
-
 	returnSuccess(c, 20000, res)
 }
 
@@ -186,6 +207,40 @@ 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
+	}
+	selectionId, err := service.SelectionInfoService{}.CloseSelection(param.SelectionId)
+	if err != nil {
+		logrus.Errorf("[CloseSelection] call CloseSelection 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) 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{}
@@ -257,7 +312,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,6 +320,30 @@ func (t TaskController) GetProjectDetail(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
+// 种草复制任务
+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() == "任务不存在" {
+			returnError(c, 30000, err.Error())
+			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{}
@@ -324,6 +403,26 @@ 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
+	}
+	projectId, err := service.ProjectService{}.CloseProject(param.ProjectId)
+	if err != nil {
+		logrus.Errorf("[CloseProject] call CloseProject 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) GetSelectionDraftList(c *gin.Context) {
 	param := &vo.SelectionDraftParam{}
@@ -438,6 +537,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 +628,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{}
@@ -541,7 +668,17 @@ func (t TaskController) GetStoreCategory(c *gin.Context) {
 		returnError(c, 40000, err.Error())
 		return
 	}
+	returnSuccess(c, 20000, res)
+}
 
+// 达人内容类型
+func (t TaskController) GetTalentCategory(c *gin.Context) {
+	res, err := service.ProjectService{}.GetTalentCategory()
+	if err != nil {
+		logrus.Errorf("[GetTalentCategory] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
 	returnSuccess(c, 20000, res)
 }
 
@@ -702,6 +839,30 @@ func (t TaskController) GetLocalLifeDetail(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
+// 本地生活复制任务
+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() == "任务不存在" {
+			returnError(c, 30000, err.Error())
+			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{}
@@ -722,7 +883,21 @@ func (t TaskController) LocalLifeToReview(c *gin.Context) {
 	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)
@@ -733,7 +908,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
 	}
@@ -741,6 +916,20 @@ func (t TaskController) LogisticsTalentList(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
+// 种草待发货、待签收、已签收统计
+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{}
@@ -752,7 +941,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
 	}
@@ -771,7 +960,27 @@ 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
+	}
+	resultMap := make(map[string]string)
+	resultMap["localId"] = *localId
+	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
+	}
+	localId, err := service.LocalLifeService{}.CloseLocalLife(param.LocalId)
+	if err != nil {
+		logrus.Errorf("[CloseLocalLife] call CloseLocalLife err:%+v\n", err)
 		returnError(c, 40000, err.Error())
 		return
 	}
@@ -791,7 +1000,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
 	}
@@ -816,6 +1025,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_b_api/app/service"
+	"youngee_b_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)
+}

+ 12 - 0
app/dao/common_dao.go

@@ -0,0 +1,12 @@
+package dao
+
+import "youngee_b_api/app/entity"
+
+type CommonDao struct{}
+
+// 获取所有合作平台icon
+func (d CommonDao) GetCoopPlatform() ([]entity.CoopPlatform, error) {
+	var coopPlatforms []entity.CoopPlatform
+	err := Db.Model(&entity.CoopPlatform{}).Find(&coopPlatforms).Order("id").Error
+	return coopPlatforms, err
+}

+ 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
+}

+ 414 - 17
app/dao/local_life_dao.go

@@ -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,11 +108,8 @@ 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")
@@ -152,7 +151,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,6 +179,9 @@ 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")
 	offset := (param.Page - 1) * param.PageSize
@@ -202,7 +204,7 @@ 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
@@ -212,6 +214,50 @@ func (d LocalLifeDao) GetLocalLifeList(value int64, fieldName string) ([]*entity
 	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
@@ -233,11 +279,8 @@ func (d LocalLifeDao) GetLocalStoreExplorePreviews(param *vo.LocalSearchParam) (
 	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)
@@ -290,11 +333,8 @@ 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")
@@ -321,3 +361,360 @@ func (d LocalLifeDao) GetBillLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReB
 
 	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
+}

+ 29 - 29
app/dao/local_life_task_info_dao.go

@@ -10,14 +10,14 @@ type LocalLifeTaskInfoDao struct{}
 // 获取指定违约类型的本地生活子任务数量
 func (d LocalLifeTaskInfoDao) CountByDefaultType(localId string, defaultType int64) int64 {
 	var total int64
-	Db.Model(&entity.LocalLifeInfo{}).Where("local_id = ? AND cur_default_type = ?", localId, defaultType).Count(&total)
+	Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND cur_default_type = ?", localId, defaultType).Count(&total)
 	return total
 }
 
 // 获取指定任务阶段的本地生活子任务数量
 func (d LocalLifeTaskInfoDao) CountByTaskStage(localId string, taskStage int64) int64 {
 	var total int64
-	Db.Model(&entity.LocalLifeInfo{}).Where("local_id = ? AND task_stage = ?", localId, taskStage).Count(&total)
+	Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND task_stage = ?", localId, taskStage).Count(&total)
 	return total
 }
 
@@ -58,78 +58,78 @@ func (d LocalLifeTaskInfoDao) GetListByTaskStage(localId string, bookStatus int6
 }
 
 // 获取未传初稿的本地生活子任务数据
-func (d LocalLifeTaskInfoDao) GetListBySketchDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeInfo, int64, error) {
-	projectTaskInfos := []entity.LocalLifeInfo{}
+func (d LocalLifeTaskInfoDao) GetListBySketchDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeTaskInfo, int64, error) {
+	localTaskInfos := []entity.LocalLifeTaskInfo{}
 	var total int64
-	query := Db.Model(&entity.LocalLifeInfo{}).Where("local_id = ? AND cur_default_type = ?", param.TaskId, 4)
+	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")
 	offset := (param.Page - 1) * param.PageSize
-	if err := query.Order("sketch_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+	if err := query.Order("sketch_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err
 	}
-	return projectTaskInfos, total, nil
+	return localTaskInfos, total, nil
 }
 
 // 获取未发作品的本地生活子任务数据
-func (d LocalLifeTaskInfoDao) GetListByLinkDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeInfo, int64, error) {
-	projectTaskInfos := []entity.LocalLifeInfo{}
+func (d LocalLifeTaskInfoDao) GetListByLinkDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeTaskInfo, int64, error) {
+	localTaskInfos := []entity.LocalLifeTaskInfo{}
 	var total int64
-	query := Db.Model(&entity.LocalLifeInfo{}).Where("local_id = ? AND cur_default_type = ?", param.TaskId, 6)
+	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")
 	offset := (param.Page - 1) * param.PageSize
-	if err := query.Order("link_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+	if err := query.Order("link_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err
 	}
-	return projectTaskInfos, total, nil
+	return localTaskInfos, total, nil
 }
 
 // 获取未传数据的本地生活子任务数据
-func (d LocalLifeTaskInfoDao) GetListByDataDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeInfo, int64, error) {
-	projectTaskInfos := []entity.LocalLifeInfo{}
+func (d LocalLifeTaskInfoDao) GetListByDataDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeTaskInfo, int64, error) {
+	localTaskInfos := []entity.LocalLifeTaskInfo{}
 	var total int64
-	query := Db.Model(&entity.LocalLifeInfo{}).Where("local_id = ? AND cur_default_type = ?", param.TaskId, 8)
+	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")
 	offset := (param.Page - 1) * param.PageSize
-	if err := query.Order("data_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+	if err := query.Order("data_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err
 	}
-	return projectTaskInfos, total, nil
+	return localTaskInfos, total, nil
 }
 
 // 获取终止合作的本地生活子任务数据
-func (d LocalLifeTaskInfoDao) GetListByTerminateDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeInfo, int64, error) {
-	projectTaskInfos := []entity.LocalLifeInfo{}
+func (d LocalLifeTaskInfoDao) GetListByTerminateDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeTaskInfo, int64, error) {
+	localTaskInfos := []entity.LocalLifeTaskInfo{}
 	var total int64
-	query := Db.Debug().Model(&entity.LocalLifeInfo{}).Where("local_id = ? AND task_stage = ?", param.TaskId, 17)
+	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")
 	offset := (param.Page - 1) * param.PageSize
-	if err := query.Order("terminate_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+	if err := query.Order("terminate_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err
 	}
-	return projectTaskInfos, total, nil
+	return localTaskInfos, total, nil
 }
 
 // 获取已解约的本地生活子任务数据
-func (d LocalLifeTaskInfoDao) GetListByCancelDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeInfo, int64, error) {
-	projectTaskInfos := []entity.LocalLifeInfo{}
+func (d LocalLifeTaskInfoDao) GetListByCancelDefault(param *vo.DefaultSearchParam) ([]entity.LocalLifeTaskInfo, int64, error) {
+	localTaskInfos := []entity.LocalLifeTaskInfo{}
 	var total int64
-	query := Db.Debug().Model(&entity.LocalLifeInfo{}).Where("local_id = ? AND task_stage = ?", param.TaskId, 16)
+	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")
 	offset := (param.Page - 1) * param.PageSize
-	if err := query.Order("cancel_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+	if err := query.Order("cancel_time desc").Offset(offset).Limit(param.PageSize).Find(&localTaskInfos).Error; err != nil {
 		return nil, 0, err
 	}
-	return projectTaskInfos, total, nil
+	return localTaskInfos, total, nil
 }
 
 // 更新字段
 func (d LocalLifeTaskInfoDao) UpdateField(taskId string, updateData map[string]interface{}) error {
-	err := Db.Model(&entity.LocalLifeInfo{}).Where("task_id = ?", taskId).Updates(updateData).Error
+	err := Db.Model(&entity.LocalLifeTaskInfo{}).Where("task_id = ?", taskId).Updates(updateData).Error
 	if err != nil {
 		return err
 	}
@@ -138,7 +138,7 @@ func (d LocalLifeTaskInfoDao) UpdateField(taskId string, updateData map[string]i
 
 // 批量更新字段
 func (d LocalLifeTaskInfoDao) UpdateFieldBatch(taskIds []string, updateData map[string]interface{}) error {
-	err := Db.Model(&entity.LocalLifeInfo{}).Where("task_id IN ?", taskIds).Updates(updateData).Error
+	err := Db.Model(&entity.LocalLifeTaskInfo{}).Where("task_id IN ?", taskIds).Updates(updateData).Error
 	if err != nil {
 		return err
 	}

+ 7 - 0
app/dao/product_dao.go

@@ -120,3 +120,10 @@ func (d ProductDAO) GetProductByProjectId(projectId string) (*entity.Product, er
 	}
 	return &productInfo, nil
 }
+
+// 获取商品类目
+func (d ProductDAO) GetProductCategorys() ([]entity.InfoProductCategory, error) {
+	var infoProductCategorys []entity.InfoProductCategory
+	err := Db.Model(&entity.InfoProductCategory{}).Find(&infoProductCategorys).Order("id").Error
+	return infoProductCategorys, err
+}

+ 356 - 14
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
@@ -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, product_id, tools")
+	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")
 	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,6 +124,9 @@ 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,
@@ -139,6 +141,10 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 			NeedCalculate:   project.NeedCalculate,
 			ProductId:       project.ProductID,
 			Tools:           project.Tools,
+			NeedDelivery:    project.BeforeDeliveryNum,
+			NeedReceive:     project.DeliveryNum,
+			Received:        project.AfterDeliveryNum,
+			NeedFilter:      needFilter,
 		}
 		reProjectTaskPreviews = append(reProjectTaskPreviews, reProjectTaskPreview)
 	}
@@ -151,14 +157,14 @@ func (d ProjectDAO) DeleteProject(projectId string) (*string, error) {
 	if projectId == "" {
 		return &projectId, nil
 	}
-	err := Db.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
@@ -179,6 +185,9 @@ 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")
 	offset := (param.Page - 1) * param.PageSize
@@ -355,11 +364,8 @@ 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")
@@ -385,3 +391,339 @@ func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.R
 
 	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
+}

+ 13 - 1
app/dao/project_task_info_dao.go

@@ -22,10 +22,22 @@ 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)
+	if talentNickname != "" {
+		var talentInfos []entity.YoungeeTalentInfo
+		err1 := Db.Model(&entity.YoungeeTalentInfo{}).Where("talent_wx_nickname = ?", talentNickname).Find(&talentInfos).Error
+		if err1 != nil {
+			return nil, 0, err1
+		}
+		var talentIds []string
+		for _, talentInfo := range talentInfos {
+			talentIds = append(talentIds, talentInfo.ID)
+		}
+		query = query.Where("talent_id in ?", talentIds)
+	}
 	// 计算偏移量
 	offset := (page - 1) * pageSize
 	var err error

+ 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{

+ 71 - 0
app/dao/s_local_dao.go

@@ -0,0 +1,71 @@
+package dao
+
+import (
+	"youngee_b_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
+}
+
+//// 检查给定的服务商是否在该商家库中
+//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
+//}

+ 41 - 41
app/dao/s_project_dao.go

@@ -28,44 +28,44 @@ 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
-}
-
-// 获取指定商家的服务商库
-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
-}
+//// 检查给定的服务商是否在该商家库中
+//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
+//}

+ 155 - 11
app/dao/selection_info_dao.go

@@ -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,11 +97,8 @@ 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")
@@ -140,7 +139,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,6 +164,9 @@ 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")
 	offset := (param.Page - 1) * param.PageSize
@@ -249,11 +251,8 @@ func (d SelectionInfoDAO) GetBillSelectionPreviews(param *vo.SelectionSearchPara
 	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")
@@ -278,3 +277,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.SecTaskInfo{}).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.SecTaskInfo{}).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.SecTaskInfo{}).Where("selection_id in ? and logistics_status = ?", selectionIDs, 1).Count(&needDelivery).Error // logistics_status=1待发货
+				if err1 != nil {
+					needDelivery = 0
+				}
+				err2 := Db.Model(&entity.SecTaskInfo{}).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.SecTaskInfo{}).Where("selection_id in ? and logistics_status = ?", selectionIDs, 1).Count(&needDelivery).Error // logistics_status=1待发货
+				if err1 != nil {
+					needDelivery = 0
+				}
+				err2 := Db.Model(&entity.SecTaskInfo{}).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
+}

+ 7 - 0
app/dao/talent_info_dao.go

@@ -30,3 +30,10 @@ func (d TalentInfoDao) SelectTalentInfo(talentId string) (*entity.YoungeeTalentI
 	}
 	return talentInfo, nil
 }
+
+// 获取达人内容类型
+func (d TalentInfoDao) GetTalentCategory() ([]entity.TalentCategory, error) {
+	var talentCategory []entity.TalentCategory
+	err := Db.Model(&entity.TalentCategory{}).Find(&talentCategory).Error
+	return talentCategory, err
+}

+ 1 - 2
app/entity/book_info.go

@@ -23,8 +23,7 @@ type BookInfo struct {
 	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 int `gorm:"column:b_operator_type;default:0"` // 商家操作人类型,1商家用户,2商家子账号,3管理后台
+	BOperatorType     int       `gorm:"column:b_operator_type;default:0"`          // 商家操作人类型,1商家用户,2商家子账号,3管理后台
 }
 
 func (m *BookInfo) TableName() string {

+ 12 - 0
app/entity/coop_platform.go

@@ -0,0 +1,12 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+// 合作平台表
+type CoopPlatform struct {
+	ID           int64  `gorm:"column:id;primary_key;AUTO_INCREMENT"` // id
+	PlatformIcon string `gorm:"column:platform_icon;NOT NULL"`        // 平台icon
+}
+
+func (m *CoopPlatform) TableName() string {
+	return "younggee_coop_platform"
+}

+ 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 {

+ 11 - 0
app/entity/info_product_category.go

@@ -0,0 +1,11 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+type InfoProductCategory struct {
+	ID              int64  `gorm:"column:id;primary_key;AUTO_INCREMENT"` // 商品类型id
+	ProductCategory string `gorm:"column:product_category;NOT NULL"`     // 商品类型
+}
+
+func (m *InfoProductCategory) TableName() string {
+	return "info_product_category"
+}

+ 1 - 1
app/entity/local_life_info.go

@@ -41,7 +41,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"`            // 待审稿

+ 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"`                    // 未发作品违约时间

+ 1 - 0
app/entity/platform_kuaishou_user_info.go

@@ -24,6 +24,7 @@ type PlatformKuaishouUserInfo struct {
 	IsDelete     int64     `gorm:"column:is_delete;NOT NULL"`
 	LikeNum      int64     `gorm:"column:like_num;NOT NULL"`
 	VideoNum     int64     `gorm:"column:video_num;NOT NULL"`
+	City         string    `gorm:"column:city"`
 }
 
 func (m *PlatformKuaishouUserInfo) TableName() string {

+ 4 - 1
app/entity/project.go

@@ -39,7 +39,7 @@ type Project struct {
 	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"`                    // 待审稿
@@ -50,6 +50,9 @@ type Project struct {
 	TotalRecruitNum   int64     `gorm:"column:total_recruit_num"`              // 各策略招募人数总和
 	Tools             string    `gorm:"column:tools"`                          // 工具选择,1邀约招募 2结算账单 3样品物流 4审稿工具 5作品审查 6数据巡检(,分隔)
 	InvoiceStatus     int64     `gorm:"column:invoice_status"`                 // 开票状态(1开票中 2已开票)
+	BeforeDeliveryNum int64     `gorm:"column:before_delivery_num"`
+	DeliveryNum       int64     `gorm:"column:delivery_num"`
+	AfterDeliveryNum  int64     `gorm:"column:after_delivery_num"`
 }
 
 func (m *Project) TableName() string {

+ 22 - 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,9 +50,9 @@ 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"`
 }
 

+ 41 - 0
app/entity/s_local.go

@@ -0,0 +1,41 @@
+// 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       string    `gorm:"column:service_charge"`                        // 服务商预估可赚服务费
+	ServiceChargeActual string    `gorm:"column:service_charge_actual"`                 // 服务商实际可赚服务费
+	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"`                           // 结案时间
+}
+
+func (m *SLocalLifeInfo) TableName() string {
+	return "younggee_s_local_life_info"
+}

+ 33 - 17
app/entity/s_project.go

@@ -1,25 +1,41 @@
+// Code generated by sql2gorm. DO NOT EDIT.
 package entity
 
-import "time"
+import (
+	"time"
+)
 
 // 服务商加入商单的种草任务
 type SProjectInfo struct {
-	SProjectId          int64     `gorm:"column:s_project_id;primary_key;AUTO_INCREMENT"` // 服务商加入商单后的种草任务ID
-	ProjectId           string    `gorm:"column:project_id;"`                             // 被服务商加入商单的原种草任务ID
-	ShareCode           string    `gorm:"column:share_code"`                              // 分享码URL
-	SupplierId          int64     `gorm:"column:supplier_id"`                             // 所属服务商ID
-	ApplyNum            int64     `gorm:"column:apply_num;default:0;NOT NULL"`            // 报名人数
-	RecruitNum          int64     `gorm:"column:recruit_num;default:0;NOT NULL"`          // 已招募人数
-	SettleNum           int64     `gorm:"column:settle_num;default:0;NOT NULL"`           // 已结算人数
-	SubAccountId        int64     `gorm:"column:sub_account_id"`                          // 所属子账号ID
-	ServiceCharge       float64   `gorm:"column:service_charge"`                          // 服务商预估可赚服务费
-	ServiceChargeActual float64   `gorm:"column:service_charge_actual"`                   // 服务商实际可赚服务费
-	OperatorType        int64     `gorm:"column:operator_type"`                           // 添加商单操作人类型,1为服务商主账号,2为服务商子账号
-	SProjectStatus      int64     `gorm:"column:s_project_status"`                        // 服务商种草任务状态,1待确认,2已确认,3已拒绝
-	StrategyStatus      int64     `gorm:"column:strategy_status"`                         // 定向种草任务是否替换招募策略
-	BOperator           string    `gorm:"column:b_operator"`                              // 商家发起入库邀约人
-	BOperatorType       int64     `gorm:"column:b_operator_type"`                         // 商家发起入库邀约人类型:1主账号,2子账号
-	CreateTime          time.Time `gorm:"column:create_time;default:0;NOT NULL"`
+	SProjectID          int64     `gorm:"column:s_project_id;primary_key;AUTO_INCREMENT"` // 服务商种草任务ID
+	ProjectID           string    `gorm:"column:project_id"`                              // 被服务商加入商单的原种草任务ID
+	ProductID           int64     `gorm:"column:product_id"`                              // 商品ID
+	ProjectName         string    `gorm:"column:project_name"`
+	ProjectStatus       int64     `gorm:"column:project_status"`
+	ProjectType         int64     `gorm:"column:project_type"`
+	ProjectPlatform     int64     `gorm:"column:project_platform"`
+	ProjectForm         int64     `gorm:"column:project_form"`
+	ContentType         int64     `gorm:"column:content_type"`
+	ShareCode           string    `gorm:"column:share_code"` // 分享码URL
+	EnterpriseID        string    `gorm:"column:enterprise_id"`
+	SupplierID          int64     `gorm:"column:supplier_id"`                        // 服务商ID
+	ApplyNum            int64     `gorm:"column:apply_num;default:0"`                // 报名人数
+	RecruitNum          int64     `gorm:"column:recruit_num;default:0"`              // 已招募人数
+	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"`              // 服务商已结算服务费
+	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"`          // 定向种草任务是否替换招募策略
+	BOperator           string    `gorm:"column:b_operator"`                         // 商家发起入库邀约人
+	BOperatorType       int64     `gorm:"column:b_operator_type;default:0"`          // 商家发起入库邀约人类型: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子账号
+	FinishTime          time.Time `gorm:"column:finish_time"`                        // 结案时间
 }
 
 func (m *SProjectInfo) TableName() string {

+ 1 - 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"`            // 商品图片快照

+ 12 - 0
app/entity/talent_category.go

@@ -0,0 +1,12 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+// 门店类目表
+type TalentCategory struct {
+	ID       int64  `gorm:"column:id;primary_key;AUTO_INCREMENT"` // id
+	Category string `gorm:"column:category;NOT NULL"`             // 类型
+}
+
+func (m *TalentCategory) TableName() string {
+	return "younggee_talent_category"
+}

+ 13 - 4
app/schedule/auto_task_review.go

@@ -13,7 +13,7 @@ import (
 func AutoTaskReview() error {
 	// 新建一个定时任务对象
 	crontab := cron.New(cron.WithSeconds()) // 精确到秒
-	spec := "0 */5 * * * ?"                 //cron表达式,每5分钟一次
+	spec := "0 */1 * * * ?"                 //cron表达式,每5分钟一次
 	// "0 0 12 * * ?" 每天中午12点执行
 
 	// 添加定时任务
@@ -232,8 +232,9 @@ func AutoProjectReviewTask() {
 		}
 
 		// 审核通过
+		t := time.Now()
 		_ = dao.ProjectReviewDao{}.UpdateProjectReview(&entity.ReviewProject{ID: reviewProject.ID, Status: 2})
-		_ = dao.ProjectDAO{}.UpdateProject(entity.Project{ProjectId: reviewProject.ProjectID, ProjectStatus: 4})
+		_ = dao.ProjectDAO{}.UpdateProject(entity.Project{ProjectId: reviewProject.ProjectID, ProjectStatus: 4, PassAt: t})
 	}
 
 	log.Println("AutoProjectReviewTask running End, Time :", time.Now())
@@ -413,8 +414,15 @@ func AutoSelectionReviewTask() {
 		}
 
 		// 审核通过
+		t := time.Now()
 		_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 2})
-		_ = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: reviewSelection.SelectionID, SelectionStatus: 4})
+		// 非悬赏任务审核通过直接变为执行中
+		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 {
+			_ = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: reviewSelection.SelectionID, SelectionStatus: 4, PassAt: t})
+		}
 	}
 
 	log.Println("AutoSelectionInvalidTask running End, Time :", time.Now())
@@ -662,8 +670,9 @@ func AutoLocalLifeReviewTask() {
 		}
 
 		// 审核通过
+		t := time.Now()
 		_ = dao.LocalLifeReviewDao{}.UpdateLocalReview(&entity.ReviewLocalLife{ID: reviewLocalLife.ID, Status: 2})
-		_ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{LocalID: reviewLocalLife.LocalID, TaskStatus: 4})
+		_ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{LocalID: reviewLocalLife.LocalID, TaskStatus: 4, PassAt: t})
 	}
 
 	log.Println("AutoLocalLifeInvalidTask running End, Time :", time.Now())

+ 4 - 3
app/service/bill_service.go

@@ -2,6 +2,7 @@ package service
 
 import (
 	"errors"
+	"time"
 	"youngee_b_api/app/dao"
 	"youngee_b_api/app/entity"
 	"youngee_b_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
 	}
@@ -47,7 +48,7 @@ func (s BillService) PayProject(param *vo.PayParam) error {
 	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
 	}
@@ -70,7 +71,7 @@ func (s BillService) PayLocalLife(param *vo.PayParam) error {
 	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
 	}

+ 17 - 0
app/service/common_service.go

@@ -0,0 +1,17 @@
+package service
+
+import "youngee_b_api/app/dao"
+
+type CommonService struct{}
+
+func (s CommonService) CooperationPlatform() ([]string, error) {
+	var icons []string
+	coopPlatforms, err := dao.CommonDao{}.GetCoopPlatform()
+	if err != nil {
+		return nil, err
+	}
+	for _, coopPlatform := range coopPlatforms {
+		icons = append(icons, coopPlatform.PlatformIcon)
+	}
+	return icons, nil
+}

+ 68 - 6
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,13 +241,13 @@ 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 {
 		if param.TaskType == 2 { // 种草
 			for _, sProjectInfo := range sProjectInfos {
-				supplierId := sProjectInfo.SupplierId
+				supplierId := sProjectInfo.SupplierID
 				enterpriseSupplierCooperate, err1 := dao.EnterpriseSupplierCooperateDao{}.GetDataByEnterpriseAndSupplier(param.EnterpriseId, supplierId)
 				if err1 != nil {
 					return result, err1
@@ -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,12 +322,36 @@ 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
 	if param.TaskType == 2 {
-		sProjectInfo.ProjectId = param.TaskId
-		sProjectInfo.SupplierId = param.SupplierId
+		sProjectInfo.ProjectID = param.TaskId
+		sProjectInfo.SupplierID = param.SupplierId
 		sProjectInfo.SProjectStatus = 1
 		sProjectInfo.CreateTime = time.Now()
 		if param.SubAccountId == 0 {
@@ -316,6 +361,23 @@ func (s CooperationService) InviteSupplierInTargetTask(param *vo.SupplierInviteI
 			sProjectInfo.BOperator = strconv.Itoa(int(param.SubAccountId))
 			sProjectInfo.BOperatorType = 2
 		}
+		// 查找该 projectId 对应的信息
+		project, err1 := dao.ProjectDAO{}.GetProjectById(param.TaskId)
+		if err1 != nil {
+			return err1
+		}
+		if project != nil {
+			sProjectInfo.ProductID = project.ProductID
+			sProjectInfo.ProjectName = project.ProjectName
+			sProjectInfo.ProjectStatus = project.ProjectStatus
+			sProjectInfo.ProjectType = project.ProjectType
+			sProjectInfo.ProjectPlatform = project.ProjectPlatform
+			sProjectInfo.ProjectForm = project.ProjectForm
+			sProjectInfo.ContentType = project.ContentType
+			sProjectInfo.EnterpriseID = param.EnterpriseId
+			//sProjectInfo.ApplyNum = project.ApplyNum
+			//sProjectInfo.RecruitNum = project.RecruitNum
+		}
 	} else if param.TaskType == 3 {
 		// 本地生活
 	}

+ 331 - 135
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,238 @@ 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{}.SelectTalentInfo(talentId)
+			platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.SelectUserInfo(talentId)
+			reTalentDefault := &vo.ReTalentDefault{
+				TalentId:    talentId,
+				TalentPhone: talentInfo.TalentPhoneNumber,
+				TaskId:      projectTaskInfo.TaskID,
+				DraftFee:    projectTaskInfo.DraftFee,
+				OpenId:      platformKuaishouUserInfo.OpenId,
+				NickName:    platformKuaishouUserInfo.NickName,
+				HeadUri:     platformKuaishouUserInfo.HeadUri,
+				City:        platformKuaishouUserInfo.City,
+				Gender:      talentInfo.Sex,
 			}
-		} 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{}.SelectTalentInfo(talentId)
+			platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.SelectUserInfo(talentId)
+			reTalentDefault := &vo.ReTalentDefault{
+				TalentId:    talentId,
+				TalentPhone: talentInfo.TalentPhoneNumber,
+				TaskId:      localLifeTaskInfo.TaskID,
+				DraftFee:    localLifeTaskInfo.DraftFee,
+				OpenId:      platformKuaishouUserInfo.OpenId,
+				NickName:    platformKuaishouUserInfo.NickName,
+				HeadUri:     platformKuaishouUserInfo.HeadUri,
+				City:        platformKuaishouUserInfo.City,
+				Gender:      talentInfo.Sex,
+			}
+			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
 }
 
 // 违约管理——定向任务-违约达人列表

+ 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
+}

+ 348 - 13
app/service/local_life_service.go

@@ -28,7 +28,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
@@ -47,7 +47,7 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
 	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(localCreateParam.EnterpriseId)
 	t := time.Now()
 	if recruitDdl.Before(t) {
-		return nil, errors.New("截止时间异常,请重试")
+		return nil, errors.New("请修改截止时间")
 	}
 	newLocalLife := entity.LocalLifeInfo{
 		EnterpriseID:        localCreateParam.EnterpriseId,
@@ -101,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{
@@ -147,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)
 			}
@@ -174,6 +169,11 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
 	if localLife == nil {
 		return nil, errors.New("本地生活项目不存在")
 	}
+	recruitDdl := time.Time{} //赋零值
+	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", localUpdateParam.RecruitDdl, time.Local)
+	if recruitDdl.Before(localLife.CreatedAt) {
+		return nil, errors.New("请修改截止时间")
+	}
 	// 更新公开种草任务的招募策略
 	var totalRecruitNum int64
 	var estimatedCost float64
@@ -203,8 +203,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)
 			}
@@ -224,8 +224,6 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
 	//productInfoToJson, _ := json.Marshal(product)
 	//productPhotosToJson, _ := json.Marshal(productPhotos)
 	// d) 任务截止时间
-	recruitDdl := time.Time{} //赋零值
-	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", localUpdateParam.RecruitDdl, time.Local)
 	//// f) 更新选品状态
 	//if localUpdateParam.LocalStatus != 2 && localUpdateParam.LocalStatus != 8 {
 	//	localUpdateParam.LocalStatus = 1
@@ -490,6 +488,7 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 		return nil, err
 	}
 	// 系统信息
+	reLocalDetail.LocalName = localLife.LocalName
 	reLocalDetail.LocalId = localId
 	reLocalDetail.LocalStatus = localLife.TaskStatus
 	reLocalDetail.LocalPlatform = localLife.LocalPlatform
@@ -599,6 +598,139 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 	return &reLocalDetail, 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(param.EnterpriseId)
+	infoAutoDefault := entity.InfoAutoDefault{}
+	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(param.EnterpriseId)
+
+	// 复制任务
+	localLifeNew := entity.LocalLifeInfo{
+		EnterpriseID:        param.EnterpriseId,
+		SubAccountID:        param.SubAccountId,
+		OperatorType:        localLifeOrigin.OperatorType,
+		TaskStatus:          localLifeOrigin.TaskStatus,
+		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,
+		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
@@ -771,6 +903,7 @@ func (s LocalLifeService) LocalLifeToReview(localUpdateParam *vo.LocalUpdatePara
 	updateLocal := entity.LocalLifeInfo{
 		LocalID:    localId,
 		TaskStatus: 2,
+		SubmitAt:   t,
 		UpdatedAt:  t,
 	}
 	err9 := dao.LocalLifeDao{}.UpdateLocal(updateLocal)
@@ -839,6 +972,16 @@ func (s LocalLifeService) DeleteLocalLife(localId string) (*string, error) {
 	return res, nil
 }
 
+// 结束本地生活任务
+func (s LocalLifeService) CloseLocalLife(localId string) (*string, error) {
+	err := dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
+		LocalID:    localId,
+		TaskStatus: 10,
+		UpdatedAt:  time.Now(),
+	})
+	return &localId, err
+}
+
 // 草稿箱——本地生活
 func (s LocalLifeService) GetLocalLifeDraftList(param *vo.LocalDraftParam) (vo.ResultVO, error) {
 	if param.Page == 0 {
@@ -985,6 +1128,7 @@ func (s LocalLifeService) GetStoreExploreInfo(param *vo.StoreExploreParam) (*vo.
 			TalentName:  talentInfo.TalentWxNickname,
 			Account:     "",
 			Location:    regionName,
+			Gender:      talentInfo.Sex,
 		}
 		reStoreExploreTalent := &vo.ReStoreExploreTalent{
 			ReTalentPreview: talentPreview,
@@ -1012,6 +1156,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 book_status = ?", param.LocalLifeId, 1).Count(&needBook)
+	dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND book_status = ?", param.LocalLifeId, 2).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
@@ -1090,3 +1253,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
+}

+ 47 - 0
app/service/product_service.go

@@ -41,10 +41,22 @@ func (p ProductService) GetTaskProductsByUserId(param vo.GetAllProductParam) (vo
 	}
 	var reProducts []vo.ReProductPreview
 	for _, product := range products {
+		var createrName string
 		photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByProductID(product.ProductID)
 		if e != nil {
 			photoUrl = ""
 		}
+		if product.SubAccountID == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(product.EnterpriseID)
+			if err == nil && enterprise != nil {
+				createrName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(product.SubAccountID)
+			if err == nil && subAccount != nil {
+				createrName = subAccount.SubAccountName
+			}
+		}
 		reProduct := vo.ReProductPreview{
 			ProductID:       product.ProductID,
 			ProductName:     product.ProductName,
@@ -54,6 +66,7 @@ func (p ProductService) GetTaskProductsByUserId(param vo.GetAllProductParam) (vo
 			ProductDetail:   product.ProductDetail,
 			CreatedAt:       product.CreatedAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:        photoUrl,
+			CreateName:      createrName,
 		}
 		reProducts = append(reProducts, reProduct)
 	}
@@ -68,6 +81,7 @@ func (p ProductService) GetTaskProductsByUserId(param vo.GetAllProductParam) (vo
 
 func (p ProductService) CreateProduct(productCreateParam *vo.ProductCreateParam) (int64, error) {
 	product := entity.Product{
+		ProductType:         productCreateParam.ProductType,
 		KuaishouProductId:   productCreateParam.ProductId,
 		ProductName:         productCreateParam.ProductName,
 		ProductCategory:     productCreateParam.ProductCategory,
@@ -194,3 +208,36 @@ 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
+	productCategorys, err := dao.ProductDAO{}.GetProductCategorys()
+	if err != nil {
+		return nil, err
+	}
+	for _, productCategory := range productCategorys {
+		categorys = append(categorys, productCategory.ProductCategory)
+	}
+	return categorys, nil
+}

+ 390 - 32
app/service/project_service.go

@@ -28,9 +28,9 @@ func (s ProjectService) CreateProject(projectCreateParam *vo.ProjectCreateParam)
 	if product == nil {
 		return nil, errors.New("未找到关联商品")
 	}
-	productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(projectCreateParam.ProductId)
+	productMainPhoto, _ := dao.ProductPhotoDAO{}.GetMainProductPhotoInfoByProductID(projectCreateParam.ProductId)
 	productInfoToJson, _ := json.Marshal(product)
-	productPhotosToJson, _ := json.Marshal(productPhotos)
+	productPhotosToJson, _ := json.Marshal(productMainPhoto)
 	// d) 任务截止时间
 	recruitDdl, err1 := time.ParseInLocation("2006-01-02 15:04:05", projectCreateParam.RecruitDdl, time.Local)
 	if err1 != nil {
@@ -51,7 +51,7 @@ func (s ProjectService) CreateProject(projectCreateParam *vo.ProjectCreateParam)
 	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(projectCreateParam.EnterpriseId)
 	t := time.Now()
 	if recruitDdl.Before(t) {
-		return nil, errors.New("截止时间异常,请重试")
+		return nil, errors.New("请修改截止时间")
 	}
 	newProject := entity.Project{
 		ProjectStatus:    1,
@@ -143,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)
 			}
@@ -173,6 +173,11 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 	if project == nil {
 		return nil, errors.New("种草项目不存在")
 	}
+	recruitDdl := time.Time{} //赋零值
+	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", projectUpdateParam.RecruitDdl, time.Local)
+	if recruitDdl.Before(project.CreatedAt) {
+		return nil, errors.New("请修改截止时间")
+	}
 	// 更新公开种草任务的招募策略
 	var totalRecruitNum int64
 	var estimatedCost float64
@@ -202,8 +207,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)
 			}
@@ -215,16 +220,24 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 	}
 	// 2. 数据准备
 	// a) 查找关联商品信息
-	product, err := dao.ProductDAO{}.GetProductByID(project.ProductID)
-	if err != nil {
-		return nil, err
+	var productInfoToString string
+	var productPhotosToString string
+	if projectUpdateParam.ProductId != 0 {
+		product, err := dao.ProductDAO{}.GetProductByID(projectUpdateParam.ProductId)
+		if err != nil {
+			return nil, err
+		}
+		if product == nil {
+			return nil, errors.New("未找到关联商品")
+		}
+		productMainPhoto, _ := dao.ProductPhotoDAO{}.GetMainProductPhotoInfoByProductID(projectUpdateParam.ProductId)
+		productInfoToJson, _ := json.Marshal(product)
+		productInfoToString = string(productInfoToJson)
+		productPhotosToJson, _ := json.Marshal(productMainPhoto)
+		productPhotosToString = string(productPhotosToJson)
 	}
-	productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(project.ProductID)
-	productInfoToJson, _ := json.Marshal(product)
-	productPhotosToJson, _ := json.Marshal(productPhotos)
+
 	// d) 任务截止时间
-	recruitDdl := time.Time{} //赋零值
-	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", projectUpdateParam.RecruitDdl, time.Local)
 	//// f) 更新选品状态
 	//if projectUpdateParam.ProjectStatus != 2 && projectUpdateParam.ProjectStatus != 8 {
 	//	projectUpdateParam.ProjectStatus = 1
@@ -237,8 +250,8 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 		ProductID:         projectUpdateParam.ProductId,
 		TalentType:        projectUpdateParam.TalentType,
 		RecruitDdl:        recruitDdl,
-		ProductSnap:       string(productInfoToJson),
-		ProductPhotoSnap:  string(productPhotosToJson),
+		ProductSnap:       productInfoToString,
+		ProductPhotoSnap:  productPhotosToString,
 		UpdatedAt:         t,
 		ProjectForm:       projectUpdateParam.ProjectForm,
 		ContentType:       projectUpdateParam.ContentType,
@@ -372,13 +385,23 @@ func (s ProjectService) UpdateProjectTarget(projectUpdateParam *vo.ProjectUpdate
 	}
 	// 2. 数据准备
 	// a) 查找关联商品信息
-	product, err := dao.ProductDAO{}.GetProductByID(project.ProductID)
-	if err != nil {
-		return nil, err
+	var productInfoToString string
+	var productPhotosToString string
+	if projectUpdateParam.ProductId != 0 {
+		product, err := dao.ProductDAO{}.GetProductByID(projectUpdateParam.ProductId)
+		if err != nil {
+			return nil, err
+		}
+		if product == nil {
+			return nil, errors.New("未找到关联商品")
+		}
+		productMainPhoto, _ := dao.ProductPhotoDAO{}.GetMainProductPhotoInfoByProductID(projectUpdateParam.ProductId)
+		productInfoToJson, _ := json.Marshal(product)
+		productInfoToString = string(productInfoToJson)
+		productPhotosToJson, _ := json.Marshal(productMainPhoto)
+		productPhotosToString = string(productPhotosToJson)
 	}
-	productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(project.ProductID)
-	productInfoToJson, _ := json.Marshal(product)
-	productPhotosToJson, _ := json.Marshal(productPhotos)
+
 	// d) 任务截止时间
 	recruitDdl := time.Time{} //赋零值
 	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", projectUpdateParam.RecruitDdl, time.Local)
@@ -393,8 +416,8 @@ func (s ProjectService) UpdateProjectTarget(projectUpdateParam *vo.ProjectUpdate
 		ProductID:        projectUpdateParam.ProductId,
 		TalentType:       projectUpdateParam.TalentType,
 		RecruitDdl:       recruitDdl,
-		ProductSnap:      string(productInfoToJson),
-		ProductPhotoSnap: string(productPhotosToJson),
+		ProductSnap:      productInfoToString,
+		ProductPhotoSnap: productPhotosToString,
 		CreatedAt:        project.CreatedAt,
 		UpdatedAt:        t,
 		ProjectForm:      projectUpdateParam.ProjectForm,
@@ -484,6 +507,7 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 		logrus.Errorf("[projectDB service] call GetProject error,err:%+v", err)
 		return nil, err
 	}
+	reProjectDetail.ProjectName = project.ProjectName
 	// 系统信息
 	reProjectDetail.ProjectId = projectId
 	reProjectDetail.ProjectStatus = project.ProjectStatus
@@ -509,12 +533,11 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 	reProjectDetail.Phone = phone
 	// 关联商品
 	var reProduct vo.ReProductPreview
-	product, err := dao.ProductDAO{}.GetProductByID(project.ProductID)
-	if err == nil {
-		photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByProductID(product.ProductID)
-		if e != nil {
-			photoUrl = ""
-		}
+	var product entity.Product
+	var productMainPhoto entity.ProductPhoto
+	err1 := json.Unmarshal([]byte(project.ProductSnap), &product)
+	err2 := json.Unmarshal([]byte(project.ProductPhotoSnap), &productMainPhoto)
+	if err1 == nil && err2 == nil {
 		reProduct = vo.ReProductPreview{
 			ProductID:       product.ProductID,
 			ProductName:     product.ProductName,
@@ -523,7 +546,7 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 			ProductPrice:    product.ProductPrice,
 			ProductDetail:   product.ProductDetail,
 			CreatedAt:       product.CreatedAt.Format("2006-01-02 15:04:05"),
-			PhotoUrl:        photoUrl,
+			PhotoUrl:        productMainPhoto.PhotoUrl,
 		}
 	}
 	reProjectDetail.ProductInfo = &reProduct
@@ -573,6 +596,142 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 	return &reProjectDetail, 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(param.EnterpriseId)
+	infoAutoDefault := entity.InfoAutoDefault{}
+	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(param.EnterpriseId)
+
+	// 复制任务
+	projectNew := entity.Project{
+		ProjectStatus:     projectOrigin.ProjectStatus,
+		ProjectType:       projectOrigin.ProjectType,
+		ProjectId:         projectIdNew,
+		ProductID:         projectOrigin.ProductID,
+		ProductCategory:   projectOrigin.ProductCategory,
+		EnterpriseID:      param.EnterpriseId,
+		SubAccountId:      param.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
@@ -707,6 +866,7 @@ func (s ProjectService) ProjectToReview(projectUpdateParam *vo.ProjectUpdatePara
 	updateProject := entity.Project{
 		ProjectId:     projectId,
 		ProjectStatus: 2,
+		SubmitAt:      t,
 		UpdatedAt:     t,
 	}
 	err6 := dao.ProjectDAO{}.UpdateProject(updateProject)
@@ -775,6 +935,16 @@ func (s ProjectService) DeleteProject(projectId string) (*string, error) {
 	return res, nil
 }
 
+// 结束种草任务
+func (s ProjectService) CloseProject(projectId string) (*string, error) {
+	err := dao.ProjectDAO{}.UpdateProject(entity.Project{
+		ProjectId:     projectId,
+		ProjectStatus: 10,
+		UpdatedAt:     time.Now(),
+	})
+	return &projectId, err
+}
+
 // 草稿箱——品牌种草
 func (s ProjectService) GetProjectDraftList(param *vo.ProjectDraftParam) (vo.ResultVO, error) {
 	if param.Page == 0 {
@@ -823,3 +993,191 @@ func (s ProjectService) GetProjectDraftList(param *vo.ProjectDraftParam) (vo.Res
 	}
 	return result, nil
 }
+
+// 达人内容类型
+func (p ProjectService) GetTalentCategory() ([]vo.ReTalentCategory, error) {
+	var reTalentCategories []vo.ReTalentCategory
+	talentCategory, err := dao.TalentInfoDao{}.GetTalentCategory()
+	if err != nil {
+		return nil, err
+	}
+	for _, category := range talentCategory {
+		reTalentCategory := vo.ReTalentCategory{
+			ID:       category.ID,
+			Category: category.Category,
+		}
+		reTalentCategories = append(reTalentCategories, reTalentCategory)
+	}
+	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
+}

+ 55 - 1
app/service/recharge_service.go

@@ -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_status between 7 and 8) "), param.EnterpriseId).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_status between 9 and 10) "), param.EnterpriseId).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
+}

+ 236 - 23
app/service/selection_info_service.go

@@ -79,7 +79,7 @@ func (s SelectionInfoService) CreateSelectionInfo(selectionCreateParam *vo.Selec
 	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(selectionCreateParam.EnterpriseId)
 	t := time.Now()
 	if taskDdl.Before(t) {
-		return nil, errors.New("截止时间异常,请重试")
+		return nil, errors.New("请修改截止时间")
 	}
 	var sampleMode, taskMode int64
 	var poolRewardSum float64
@@ -218,19 +218,29 @@ func (s SelectionInfoService) UpdateSelectionInfo(selectionUpdateParam *vo.Selec
 	}
 	// 2. 数据准备
 	// a) 查找关联商品信息
-	product, err := dao.ProductDAO{}.GetProductByID(selectionInfo.ProductID)
-	if err != nil {
-		return nil, err
-	}
-	if product == nil {
-		return nil, errors.New("未找到关联商品")
+	var productInfoToString string
+	var productPhotosToString string
+	if selectionUpdateParam.ProductId != 0 {
+		product, err := dao.ProductDAO{}.GetProductByID(selectionUpdateParam.ProductId)
+		if err != nil {
+			return nil, err
+		}
+		if product == nil {
+			return nil, errors.New("未找到关联商品")
+		}
+		productMainPhoto, _ := dao.ProductPhotoDAO{}.GetMainProductPhotoInfoByProductID(selectionUpdateParam.ProductId)
+		productInfoToJson, _ := json.Marshal(product)
+		productInfoToString = string(productInfoToJson)
+		productPhotosToJson, _ := json.Marshal(productMainPhoto)
+		productPhotosToString = string(productPhotosToJson)
 	}
-	productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(selectionInfo.ProductID)
-	productInfoToJson, _ := json.Marshal(product)
-	productPhotosToJson, _ := json.Marshal(productPhotos)
+
 	// d) 任务截止时间
 	taskDdl := time.Time{} //赋零值
 	taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", selectionUpdateParam.TaskDdl, time.Local)
+	if taskDdl.Before(selectionInfo.CreatedAt) {
+		return nil, errors.New("请修改截止时间")
+	}
 	//// f) 更新选品状态
 	//if selectionUpdateParam.SelectionStatus != 2 && selectionUpdateParam.SelectionStatus != 7 {
 	//	selectionUpdateParam.SelectionStatus = 1
@@ -271,8 +281,8 @@ func (s SelectionInfoService) UpdateSelectionInfo(selectionUpdateParam *vo.Selec
 		//RewardCondition:  selectionUpdateParam.RewardCondition,
 		TaskDdl: taskDdl,
 		//Detail:           selectionUpdateParam.Detail,
-		ProductSnap:      string(productInfoToJson),
-		ProductPhotoSnap: string(productPhotosToJson),
+		ProductSnap:      productInfoToString,
+		ProductPhotoSnap: productPhotosToString,
 		CreatedAt:        selectionInfo.CreatedAt,
 		UpdatedAt:        t,
 	}
@@ -423,13 +433,14 @@ func (s SelectionInfoService) GetSelectionDetail(selectionId string) (*vo.ReSele
 	}
 	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.RewardSum = selection.EstimatedCost
 	var creatorName, phone string
-	var rewardSum float64
+	//var rewardSum float64
 	if selection.SubAccountId == 0 {
 		enterprise, err := dao.EnterpriseDao{}.GetEnterprise(selection.EnterpriseID)
 		if err == nil && enterprise != nil {
@@ -502,10 +513,10 @@ func (s SelectionInfoService) GetSelectionDetail(selectionId string) (*vo.ReSele
 	}
 	reSelectionDetail.FreeStrategys = freeStrategyPreviews
 	reSelectionDetail.RewardStrategys = rewardStrategyPreviews
-	for _, rewardStrategy := range rewardStrategys {
-		rewardSum += rewardStrategy.Reward
-	}
-	reSelectionDetail.RewardSum = rewardSum
+	//for _, rewardStrategy := range rewardStrategys {
+	//	rewardSum += rewardStrategy.Reward
+	//}
+	//reSelectionDetail.RewardSum = rewardSum
 	// 补充信息
 	selectionBriefInfos, err := dao.SecBriefDao{}.GetSelectionBriefInfo(selectionId)
 	if err != nil {
@@ -523,6 +534,146 @@ func (s SelectionInfoService) GetSelectionDetail(selectionId string) (*vo.ReSele
 	return &reSelectionDetail, 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(param.EnterpriseId)
+
+	// 复制选品
+	selectionNew := entity.SelectionInfo{
+		SelectionStatus:  selectionOrigin.SelectionStatus,
+		SelectionID:      selectionIdNew,
+		ProductID:        selectionOrigin.ProductID,
+		ProductCategory:  selectionOrigin.ProductCategory,
+		EnterpriseID:     param.EnterpriseId,
+		SubAccountId:     param.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
@@ -654,6 +805,7 @@ func (s SelectionInfoService) SelectionToReview(param *vo.SelectionInfoUpdatePar
 	updateSelection := entity.SelectionInfo{
 		SelectionID:     selectionId,
 		SelectionStatus: 2,
+		SubmitAt:        t,
 		UpdatedAt:       t,
 	}
 	err6 := dao.SelectionInfoDAO{}.UpdateSelectionInfo(updateSelection)
@@ -677,7 +829,7 @@ func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchPara
 		return result, err
 	}
 	for i := range reSelectionTaskPreviews {
-		var creatorName string
+		var createrName string
 		var productName string
 		var productPrice float64
 		var mainImage string
@@ -685,12 +837,12 @@ func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchPara
 		if reSelectionTaskPreviews[i].SubAccountId == 0 {
 			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reSelectionTaskPreviews[i].EnterpriseId)
 			if err == nil && enterprise != nil {
-				creatorName = enterprise.BusinessName
+				createrName = enterprise.BusinessName
 			}
 		} else {
 			subAccount, err := dao.SubAccountDao{}.GetSubAccount(reSelectionTaskPreviews[i].SubAccountId)
 			if err == nil && subAccount != nil {
-				creatorName = subAccount.SubAccountName
+				createrName = subAccount.SubAccountName
 			}
 		}
 		product, err := dao.ProductDAO{}.GetProductByID(reSelectionTaskPreviews[i].ProductId)
@@ -711,7 +863,7 @@ func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchPara
 		//	reward += rewardStrategy.Reward
 		//}
 		//reSelectionTaskPreviews[i].Reward = reward
-		reSelectionTaskPreviews[i].CreatorName = creatorName
+		reSelectionTaskPreviews[i].CreatorName = createrName
 		reSelectionTaskPreviews[i].ProductName = productName
 		reSelectionTaskPreviews[i].ProductPrice = productPrice
 		reSelectionTaskPreviews[i].MainImage = mainImage
@@ -729,12 +881,38 @@ 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) {
+	err := dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{
+		SelectionID:     selectionId,
+		SelectionStatus: 8,
+		UpdatedAt:       time.Now(),
+	})
+	return &selectionId, 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 {
@@ -783,3 +961,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
+}

+ 15 - 0
app/service/store_service.go

@@ -10,6 +10,7 @@ import (
 
 type StoreService struct{}
 
+// 获取某商家下的所有门店
 func (p StoreService) GetStoresByEnterpriseId(param vo.GetAllStoreParam) (vo.ResultVO, error) {
 	if param.Page == 0 {
 		param.Page = 1
@@ -31,8 +32,20 @@ func (p StoreService) GetStoresByEnterpriseId(param vo.GetAllStoreParam) (vo.Res
 		return result, err
 	}
 	var reStores []vo.ReStorePreview
+	var creatorName string
 	for _, store := range stores {
 		photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
+		if store.SubAccountID == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(store.EnterpriseID)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(store.SubAccountID)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
 		if e != nil {
 			photoUrl = ""
 		}
@@ -46,6 +59,7 @@ func (p StoreService) GetStoresByEnterpriseId(param vo.GetAllStoreParam) (vo.Res
 			StoreDetail:   store.StoreDetail,
 			CreatedAt:     store.CreatedAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:      photoUrl,
+			CreateName:    creatorName,
 		}
 		reStores = append(reStores, reStore)
 	}
@@ -126,6 +140,7 @@ func (s StoreService) GetStoreDetail(param *vo.StoreSearchParam) (*vo.ReStoreInf
 	}
 	reStoreInfo = &vo.ReStoreInfo{
 		StoreID:       store.StoreID,
+		StoreLink:     store.StoreLink,
 		StoreName:     store.StoreName,
 		StoreCategory: store.StoreCategory,
 		StoreType:     store.StoreType,

+ 36 - 3
app/service/task_info_service.go

@@ -8,6 +8,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,11 +44,11 @@ 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
@@ -57,6 +73,7 @@ func (t TaskInfoService) LogisticsTalentList(param *vo.LogisticsTalentParam) (*v
 			TalentName:  talentInfo.TalentWxNickname,
 			Account:     "",
 			Location:    regionName,
+			Gender:      talentInfo.Sex,
 		}
 		reLogisticsTalent := &vo.ReLogisticsTalent{
 			TalentPostAddrSnap: projectTaskInfo.TalentPostAddrSnap,
@@ -85,6 +102,22 @@ func (t TaskInfoService) LogisticsTalentList(param *vo.LogisticsTalentParam) (*v
 	return &result, 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

+ 13 - 0
app/service/teambuying_service.go

@@ -28,10 +28,22 @@ func (p TeamBuyingService) GetTeamBuyingsByStoreId(param vo.GetAllTeamBuyingPara
 	}
 	var reTeamBuyings []vo.ReTeamBuyingPreview
 	for _, teamBuying := range teamBuyings {
+		var createrName string
 		photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(teamBuying.TeamBuyingID)
 		if e != nil {
 			photoUrl = ""
 		}
+		if teamBuying.SubAccountID == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(teamBuying.EnterpriseID)
+			if err == nil && enterprise != nil {
+				createrName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(teamBuying.SubAccountID)
+			if err == nil && subAccount != nil {
+				createrName = subAccount.SubAccountName
+			}
+		}
 		reTeamBuying := vo.ReTeamBuyingPreview{
 			TeamBuyingID:       teamBuying.TeamBuyingID,
 			TeamBuyingName:     teamBuying.TeamBuyingName,
@@ -40,6 +52,7 @@ func (p TeamBuyingService) GetTeamBuyingsByStoreId(param vo.GetAllTeamBuyingPara
 			TeamBuyingDetail:   teamBuying.TeamBuyingDetail,
 			CreatedAt:          teamBuying.CreatedAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:           photoUrl,
+			CreateName:         createrName,
 		}
 		reTeamBuyings = append(reTeamBuyings, reTeamBuying)
 	}

+ 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"`
+}

+ 4 - 4
app/vo/default_search_param.go

@@ -6,10 +6,10 @@ type DefaultSearchParam struct {
 	Page         int    `json:"page"`
 	PageSize     int    `json:"page_size"`
 	Platform     int64  `json:"platform"`
-	ProjectType  int64  `json:"project_type"` // 任务类型,0全部 1品牌种草,2本地生活
+	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/创建者
 }

+ 2 - 3
app/vo/local_search_param.go

@@ -12,7 +12,6 @@ type LocalSearchParam struct {
 	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/创建者
 }

+ 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"`
 }

+ 1 - 0
app/vo/product_create_param.go

@@ -9,6 +9,7 @@ type ProductPhoto struct {
 type ProductCreateParam struct {
 	EnterpriseId        string         `json:"enterprise_id"`        // 要绑定的企业id
 	SubAccountId        int64          `json:"sub_account_id"`       // 子账号id
+	ProductType         int64          `json:"product_type"`         // 商品类型(0一般商品 1快手商品)
 	ProductName         string         `json:"product_name"`         // 商品标题
 	ProductId           string         `json:"product_id"`           // 快手商品ID
 	ProductCategory     string         `json:"product_category"`     // 商品类目

+ 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/创建者
 }

+ 2 - 3
app/vo/project_search_param.go

@@ -12,7 +12,6 @@ type ProjectSearchParam struct {
 	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/创建者
 }

+ 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"`
+}

+ 2 - 0
app/vo/re_local_detail.go

@@ -5,6 +5,7 @@ import (
 )
 
 type ReLocalDetail struct {
+	LocalName string `json:"localName"` // 任务标题
 	// 系统信息
 	LocalId           string  `json:"localId"`           // 项目id
 	LocalStatus       int64   `json:"localStatus"`       // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
@@ -12,6 +13,7 @@ type ReLocalDetail struct {
 	CreatedAt         string  `json:"createdAt"`         // 创建时间
 	CreatorName       string  `json:"creatorName"`       // 创建者
 	Phone             string  `json:"phone"`             // 联系方式
+	WX                string  `json:"wx"`                // 微信
 	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估
 	ServiceChargeRate float64 `json:"serviceChargeRate"` // 公开服务费率
 	// 支付方式参数待定

+ 1 - 0
app/vo/re_logistics_talent.go

@@ -17,4 +17,5 @@ type TalentPreview struct {
 	TalentName  string `json:"talentName"`
 	Account     string `json:"account"`
 	Location    string `json:"location"`
+	Gender      int64  `json:"gender"`
 }

+ 1 - 0
app/vo/re_product_preview.go

@@ -9,4 +9,5 @@ type ReProductPreview struct {
 	ProductDetail   string  `json:"productDetail"`
 	CreatedAt       string  `json:"createdAt"`
 	PhotoUrl        string  `json:"photoUrl"`
+	CreateName      string  `json:"createName"`
 }

+ 2 - 0
app/vo/re_project_detail.go

@@ -5,6 +5,7 @@ import (
 )
 
 type ReProjectDetail struct {
+	ProjectName string `json:"projectName"` // 任务标题
 	// 系统信息
 	ProjectId         string  `json:"projectId"`         // 项目id 生成规则:年(2位)+一年中的第几天(3位)+5位数随机数,雪花算法也可,生成10位订单号
 	ProjectStatus     int64   `json:"projectStatus"`     // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案
@@ -12,6 +13,7 @@ type ReProjectDetail struct {
 	CreatedAt         string  `json:"createdAt"`         // 创建时间
 	CreatorName       string  `json:"creatorName"`       // 创建者
 	Phone             string  `json:"phone"`             // 联系方式
+	WX                string  `json:"wx"`                // 微信
 	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估
 	ServiceChargeRate float64 `json:"serviceChargeRate"` // 公开服务费率
 	// 支付方式参数待定

+ 3 - 0
app/vo/re_project_task_preview.go

@@ -18,6 +18,9 @@ type ReProjectTaskPreview struct {
 	NeedReview      int64   `json:"needReview"`    // 待审稿
 	NeedQuality     int64   `json:"needQuality"`   // 待质检
 	NeedCalculate   int64   `json:"needCalculate"` // 待结算
+	NeedDelivery    int64   `json:"needDelivery"`  // 待发货
+	NeedReceive     int64   `json:"needReceive"`   // 待签收
+	Received        int64   `json:"received"`      // 已签收
 	CreatorName     string  `json:"creatorName"`
 	ProjectType     int64   `json:"projectType"`
 	CreatedAt       string  `json:"createdAt"`

+ 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"`       // 充值失败
 }

+ 1 - 0
app/vo/re_selection_detail.go

@@ -13,6 +13,7 @@ type ReSelectionDetail struct {
 	CreatedAt         string  `json:"createdAt"`         // 创建时间
 	CreatorName       string  `json:"creatorName"`       // 创建者
 	Phone             string  `json:"phone"`             // 联系方式
+	WX                string  `json:"wx"`                // 微信
 	RewardSum         float64 `json:"rewardSum"`         // 悬赏池总金额
 	SubmitAt          string  `json:"submitAt"`          // 提交审核时间
 	// 支付方式参数待定

+ 1 - 0
app/vo/re_store_info.go

@@ -2,6 +2,7 @@ package vo
 
 type ReStoreInfo struct {
 	StoreID       int64   `json:"storeId"`
+	StoreLink     string  `json:"storeLink"` // 分销链接
 	StoreName     string  `json:"storeName"`
 	StoreCategory string  `json:"storeCategory"` // 门店类目
 	StoreType     int64   `json:"storeType"`     // 门店类型 1单门店,2连锁门店

+ 1 - 0
app/vo/re_store_preview.go

@@ -7,6 +7,7 @@ type ReStorePreview struct {
 	StoreType     int64  `json:"storeType"`     // 门店类型 1单门店,2连锁门店
 	StoreCategory string `json:"storeCategory"` // 门店类目
 	TeamNum       int64  `json:"teamNum"`       // 包含团购套餐
+	CreateName    string `json:"createName"`    // 创建者
 	StoreDetail   string `json:"storeDetail"`
 	CreatedAt     string `json:"createdAt"`
 	PhotoUrl      string `json:"photoUrl"`

+ 6 - 0
app/vo/re_talent_category.go

@@ -0,0 +1,6 @@
+package vo
+
+type ReTalentCategory struct {
+	ID       int64  `json:"id"`
+	Category string `json:"category"`
+}

+ 4 - 2
app/vo/re_talent_default.go

@@ -6,11 +6,13 @@ type ReTalentDefault struct {
 	NickName     string  `json:"nickName"`
 	HeadUri      string  `json:"headUri"`
 	City         string  `json:"city"`
+	Gender       int64   `json:"gender"`       // 0未知 1男 2女
 	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"` // 操作人
 }

+ 5 - 0
app/vo/re_task_default_public.go

@@ -6,6 +6,11 @@ type ReTaskDefaultPublic struct {
 	ProductName  string  `json:"productName"`
 	ProductPrice float64 `json:"productPrice"`
 
+	StoreName     string `json:"storeName"`
+	StoreLocation string `json:"storeLocation"`
+	StoreId       int64  `json:"storeId"`
+	TeamBuyingId  int64  `json:"teamBuyingId"`
+
 	EnterpriseId      string `json:"enterpriseId"`
 	SubAccountId      int64  `json:"subAccountId"`
 	TaskId            string `json:"taskId"`

+ 1 - 0
app/vo/re_teambuying_preview.go

@@ -8,4 +8,5 @@ type ReTeamBuyingPreview struct {
 	TeamBuyingDetail   string  `json:"teamBuyingDetail"`
 	CreatedAt          string  `json:"createdAt"`
 	PhotoUrl           string  `json:"photoUrl"`
+	CreateName         string  `json:"createName"`
 }

+ 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"` // 充值流水号或操作人
 }

+ 1 - 1
app/vo/selection_draft_param.go

@@ -7,5 +7,5 @@ type SelectionDraftParam struct {
 	PageSize          int    `json:"page_size"`
 	SelectionPlatform int64  `json:"selection_platform"` // 平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 
-	//SelectionId string `json:"selection_id"` // 任务ID
+	Others string `json:"others"` // 任务标题/任务ID/创建者
 }

+ 2 - 3
app/vo/selection_search_param.go

@@ -11,7 +11,6 @@ type SelectionSearchParam struct {
 	RewardFlag        int64  `json:"reward_flag"`        // 悬赏策略 0全部 1有 2无
 	Order             int64  `json:"order"`              // 排序 0降序 1升序(默认0)
 
-	SelectionId   string `json:"selection_id"`   // 任务ID
-	SelectionName string `json:"selection_name"` // 任务标题
-	//CreatorName   string `json:"creator_name"`   // 创建者
+	SelectionId string `json:"selection_id"` // 任务ID
+	Others      string `json:"others"`       // 任务标题/任务ID/创建者
 }

+ 3 - 0
app/vo/supplier_search_param.go

@@ -16,12 +16,14 @@ type SupplierSearchInPoolParam struct {
 	EnterpriseId string `json:"enterprise_id"`
 	Page         int    `json:"page"`
 	PageSize     int    `json:"page_size"`
+	Others       string `json:"others"` // 服务商昵称/服务商ID/邀请人
 }
 
 type SupplierConfirmingParam struct {
 	EnterpriseId string `json:"enterprise_id"`
 	Page         int    `json:"page"`
 	PageSize     int    `json:"page_size"`
+	Others       string `json:"others"` // 服务商昵称/服务商ID/操作人
 }
 
 type SupplierSearchInTargetTaskParam struct {
@@ -32,6 +34,7 @@ type SupplierSearchInTargetTaskParam struct {
 	Status       int64  `json:"status"` // 1可邀约 2邀约中 3合作中
 	Page         int    `json:"page"`
 	PageSize     int    `json:"page_size"`
+	SupplierName string `json:"supplier_name"` // 服务商昵称
 }
 
 type SupplierInviteInTargetTaskParam struct {

+ 80 - 10
db/data.go

@@ -152,9 +152,23 @@ func GetTaskDataList(ctx context.Context, projectID string, pageSize, pageNum in
 }
 
 // DataOpinion 提交意见
-func DataOpinion(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string) error {
+func DataOpinion(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Data db] Update YounggeeDataInfo error,err:%+v", err)
 		return err
@@ -186,9 +200,23 @@ func DataOpinion(ctx context.Context, TaskID string, ReviseOpinion string, opera
 }
 
 // DataOpinion 提交意见
-func LocalDataOpinion(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string) error {
+func LocalDataOpinion(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Data db] Update YounggeeDataInfo error,err:%+v", err)
 		return err
@@ -220,9 +248,23 @@ func LocalDataOpinion(ctx context.Context, TaskID string, ReviseOpinion string,
 }
 
 // AcceptData 同意数据-结案
-func AcceptData(ctx context.Context, TaskIDs []string, operatorid string, operatetype int) error {
+func AcceptData(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Data db] Update YounggeeDataInfo error,err:%+v", err)
 		return err
@@ -231,9 +273,23 @@ func AcceptData(ctx context.Context, TaskIDs []string, operatorid string, operat
 }
 
 // RejectData 拒绝数据-结案
-func RejectData(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string) error {
+func RejectData(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"reject_at": time.Now(), "is_review": 1, "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"reject_at": time.Now(), "is_review": 1, "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Data db] Update YounggeeDataInfo error,err:%+v", err)
 		return err
@@ -265,9 +321,23 @@ func RejectData(ctx context.Context, TaskIDs []string, operatorid string, operat
 }
 
 // RejectData 拒绝数据-结案
-func LocalRejectData(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string) error {
+func LocalRejectData(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"reject_at": time.Now(), "is_review": 1, "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeDataInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"reject_at": time.Now(), "is_review": 1, "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Data db] Update YounggeeDataInfo error,err:%+v", err)
 		return err

+ 7 - 6
db/job.go

@@ -38,15 +38,17 @@ func DeleteJob(ctx context.Context, job gorm_model.YounggeeJob) error {
 }
 
 // FindJobByEnterpriseId 按商家ID查找岗位信息
-func FindJobByEnterpriseId(ctx context.Context, job gorm_model.YounggeeJob) ([]*gorm_model.YounggeeJob, error) {
+func FindJobByEnterpriseId(ctx context.Context, enterpriseId string) ([]*gorm_model.YounggeeJob, int64, error) {
 	db := GetReadDB(ctx)
 	var Jobs []*gorm_model.YounggeeJob
-	whereCondition := gorm_model.YounggeeJob{EnterpriseId: job.EnterpriseId}
-	err := db.Model(gorm_model.YounggeeJob{}).Where(whereCondition).Find(&Jobs).Error
+	var total int64
+	whereCondition := gorm_model.YounggeeJob{EnterpriseId: enterpriseId}
+	err := db.Model(gorm_model.YounggeeJob{}).Where(whereCondition).Find(&Jobs).Count(&total).Error
 	if err != nil {
-		return nil, err
+		return nil, 0, err
 	}
-	return Jobs, nil
+	// fmt.Println(Jobs)
+	return Jobs, total, nil
 }
 
 // FindJobByJobId 按照岗位Id查找岗位信息
@@ -72,5 +74,4 @@ func GetRewardStrategyBySelectionId(ctx context.Context, SelectionId string) ([]
 	}
 	return RewardStrategys, nil
 }
-
 */

+ 96 - 12
db/link.go

@@ -128,9 +128,23 @@ func GetTaskLinkList(ctx context.Context, projectID string, pageSize, pageNum in
 }
 
 // LinkOpinion 提交意见
-func LinkOpinion(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string) error {
+func LinkOpinion(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Link db] Update YounggeeLinkInfo error,err:%+v", err)
 		return err
@@ -162,9 +176,23 @@ func LinkOpinion(ctx context.Context, TaskID string, ReviseOpinion string, opera
 }
 
 // LinkOpinion 提交意见
-func LocalLinkOpinion(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string) error {
+func LocalLinkOpinion(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Link db] Update YounggeeLinkInfo error,err:%+v", err)
 		return err
@@ -196,9 +224,23 @@ func LocalLinkOpinion(ctx context.Context, TaskID string, ReviseOpinion string,
 }
 
 // AcceptLink 同意链接
-func AcceptLink(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, isspecial int) error {
+func AcceptLink(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, isspecial int, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Link db] Update YounggeeLinkInfo error,err:%+v", err)
 		return err
@@ -253,9 +295,23 @@ func AcceptLink(ctx context.Context, TaskIDs []string, operatorid string, operat
 }
 
 // AcceptLink 同意链接
-func LocalAcceptLink(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, isspecial int) error {
+func LocalAcceptLink(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, isspecial int, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Link db] Update YounggeeLinkInfo error,err:%+v", err)
 		return err
@@ -311,9 +367,23 @@ func LocalAcceptLink(ctx context.Context, TaskIDs []string, operatorid string, o
 }
 
 // RejectLink 不同意链接
-func RejectLink(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string) error {
+func RejectLink(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 0, "is_review": 1, "reject_at": time.Now(), "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 0, "is_review": 1, "reject_at": time.Now(), "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Link db] Update YounggeeLinkInfo error,err:%+v", err)
 		return err
@@ -345,9 +415,23 @@ func RejectLink(ctx context.Context, TaskIDs []string, operatorid string, operat
 }
 
 // RejectLink 不同意链接
-func LocalRejectLink(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string) error {
+func LocalRejectLink(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 0, "is_review": 1, "reject_at": time.Now(), "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id in ?  and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 0, "is_review": 1, "reject_at": time.Now(), "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Link db] Update YounggeeLinkInfo error,err:%+v", err)
 		return err

+ 564 - 55
db/locallife_task.go

@@ -14,11 +14,75 @@ import (
 	"youngee_b_api/model/http_model"
 )
 
+func GetLocalRecruittime(ctx context.Context, request http_model.GetLocalRecruitTimeRequest) (*http_model.GetLocalRecruitTimeResponse, error) {
+	db := GetReadDB(ctx)
+	var localinfo gorm_model.YounggeeLocalLifeInfo
+	err := db.Model(&gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", request.ProjectId).Find(&localinfo).Error
+	var result http_model.GetLocalRecruitTimeResponse
+	if err != nil {
+		return &result, err
+	}
+	result.RecruitTime = localinfo.RecruitDdl.Format("2006-01-02 15:04:05")
+	return &result, nil
+}
+
+func GetLocalTalentstatusCount(db *gorm.DB, request http_model.GetLocalTalentstatusNumRequest, status int) (int64, error) {
+	query := db.Model(&gorm_model.YoungeeLocalTaskInfo{}).Where("project_id = ? AND task_status = ?", request.ProjectId, status)
+
+	// 计算总数
+	var total int64
+	if err := query.Count(&total).Error; err != nil {
+		return 0, err
+	}
+	return total, nil
+}
+
+func GetLocalTalentstatusNumCount(ctx context.Context, request http_model.GetLocalTalentstatusNumRequest) (*http_model.GetLocalTalentstatusNumResponse, error) {
+	db := GetReadDB(ctx)
+	var unoperatenum, agreetalentnum, refusetalentnum int64
+	unoperatenum, _ = GetLocalTalentstatusCount(db, request, 1)
+	agreetalentnum, _ = GetLocalTalentstatusCount(db, request, 2)
+	refusetalentnum, _ = GetLocalTalentstatusCount(db, request, 3)
+	count := &http_model.GetLocalTalentstatusNumResponse{
+		UnoperateTalentnum: unoperatenum,
+		AgreeTalentnum:     agreetalentnum,
+		RefuseTalentnum:    refusetalentnum,
+	}
+	return count, nil
+}
+
+func GetLocalTalentstatusNum(db *gorm.DB, request http_model.GetLocalTalentstatusCountRequest, status int) (int64, error) {
+	query := db.Model(&gorm_model.YoungeeLocalTaskInfo{}).Where("project_id = ? AND task_stage = ?", request.ProjectId, status)
+	var total int64
+	if err := query.Count(&total).Error; err != nil {
+		return 0, err
+	}
+	return total, nil
+}
+
+func GetLocalTalentstatusCountNum(ctx context.Context, request http_model.GetLocalTalentstatusCountRequest) (*http_model.GetLocalTalentstatusCountResponse, error) {
+	db := GetReadDB(ctx)
+	var unoperatenum, agreetalentnum, refusetalentnum int64
+	unoperatenum, _ = GetLocalTalentstatusNum(db, request, request.TaskStage)
+	agreetalentnum, _ = GetLocalTalentstatusNum(db, request, request.TaskStage+1)
+	refusetalentnum, _ = GetLocalTalentstatusNum(db, request, request.TaskStage+2)
+	count := &http_model.GetLocalTalentstatusCountResponse{
+		UnoperateTalentnum: unoperatenum,
+		AgreeTalentnum:     agreetalentnum,
+		RefuseTalentnum:    refusetalentnum,
+	}
+	return count, nil
+}
+
 func GetLocallifetaskList(ctx context.Context, request http_model.GetLocalTaskListRequest) (*http_model.GetLocalTaskListData, error) {
 	db := GetReadDB(ctx)
 	var projecrtaskinfo []gorm_model.YoungeeLocalTaskInfo
 	query := db.Model(&gorm_model.YoungeeLocalTaskInfo{}).Where("local_id = ? AND task_status = ?", request.ProjectId, request.CoopType)
-	fmt.Println(query)
+	var localinfo gorm_model.YounggeeLocalLifeInfo
+	err := db.Model(&gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", request.ProjectId).First(&localinfo).Error
+	if err != nil {
+		return &http_model.GetLocalTaskListData{}, err
+	}
 	// 构建查询条件
 	if request.FeeFrom != nil {
 		query = query.Where("fee_form = ?", request.FeeFrom)
@@ -31,9 +95,12 @@ func GetLocallifetaskList(ctx context.Context, request http_model.GetLocalTaskLi
 			query = query.Where("supplier_id !=0 AND supplier_status = 2")
 		}
 	}
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
 	if request.TalentFromList != "" {
-		citylist := strings.Split(request.TalentFromList, ",")
-		query = query.Where("city in ?", citylist)
+		provinceList := strings.Split(request.TalentFromList, ",")                // 解析传入的省份列表
+		query = query.Where("SUBSTRING_INDEX(city, ' ', 1) IN (?)", provinceList) // 提取城市字段中的省份并进行匹配
 	}
 	// 计算总数
 	var total int64
@@ -51,7 +118,42 @@ func GetLocallifetaskList(ctx context.Context, request http_model.GetLocalTaskLi
 		pageNum = 1
 	}
 	offset := (pageNum - 1) * pageSize
-
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	// 执行分页查询
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
@@ -67,28 +169,108 @@ func GetLocallifetaskList(ctx context.Context, request http_model.GetLocalTaskLi
 		case 3:
 			Time = task.CompleteDate
 		}
+		var listtime, stageintro string
+		switch task.TaskStage {
+		case 4:
+			{
+				listtime = task.SelectDate.Format("2006-01-02 15:04:05")
+				stageintro = "执行开始时间"
+			}
+		case 5:
+			{
+				listtime = task.ReserveTime.Format("2006-01-02 15:04:05")
+				stageintro = "达人探店时间预约申请时间"
+			}
+		case 6:
+			{
+				listtime = task.ExploreTime.Format("2006-01-02 15:04:05")
+				stageintro = "达人探店时间预约申请时间"
+			}
+		case 9:
+			{
+				listtime = task.CurBreakAt.Format("2006-01-02 15:04:05")
+				stageintro = "初稿上传截止时间"
+			}
+		case 10:
+			{
+				var sketchinfo gorm_model.YounggeeSketchInfo
+				err := db.Model(&gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0", task.TaskId).First(&sketchinfo).Error
+				if err != nil {
+					return nil, err
+				}
+				listtime = sketchinfo.SubmitAt.Format("2006-01-02 15:04:05")
+				stageintro = "达人上传初稿时间" //
+			}
+		case 11:
+			{
+				listtime = task.CurBreakAt.Format("2006-01-02 15:04:05")
+				stageintro = " 链接上传截止时间"
+			}
+		case 12:
+			{
+				var linkinfo gorm_model.YounggeeLinkInfo
+				err := db.Model(&gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0", task.TaskId).First(&linkinfo).Error
+				if err != nil {
+					return nil, err
+				}
+				listtime = linkinfo.SubmitAt.Format("2006-01-02 15:04:05")
+				stageintro = "达人上传链接时间"
+			}
+		case 13:
+			{
+				listtime = task.CurBreakAt.Format("2006-01-02 15:04:05")
+				stageintro = "数据待传截止时间"
+			}
+		case 14:
+			{
+				var datainfo gorm_model.YounggeeDataInfo
+				err := db.Model(&gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0", task.TaskId).First(&datainfo).Error
+				if err != nil {
+					return nil, err
+				}
+				listtime = datainfo.SubmitAt.Format("2006-01-02 15:04:05")
+				stageintro = "品牌最晚结算时间"
+			}
+		case 15:
+			{
+				listtime = task.CompleteDate.Format("2006-01-02 15:04:05")
+				stageintro = "品牌结算时间"
+			}
+		case 16:
+			{
+				listtime = task.CancelTime.Format("2006-01-02 15:04:05")
+				stageintro = "解约时间"
+			}
+		}
 		boperator := getBOperator(db, task.BOperator, task.BOperatorType)
-		nickname, headurl := getTalentinfo(db, task.TalentId)
+		nickname, headurl, gender, fans, voteavg := getTalentinfo(db, task.TalentId)
 		Iscoop := getIscoop(db, task.TalentId, request.EnterPriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, localinfo.LocalType)
 		response := &http_model.LocaLTaskInfo{
 			TaskId:             task.TaskId,
 			ProjectId:          task.LocalId,
 			TalentId:           task.TalentId,
-			FansNum:            task.FansNum,
+			FansNum:            fans,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			Boperator:          boperator,
-			CreateAt:           Time,
+			CreateAt:           Time.Format("2006-01-02 15:04:05"),
 			NickName:           nickname,
 			HeadUrl:            headurl,
 			ISCoop:             Iscoop,
+			Gender:             gender,
 			Sprojectid:         task.SLocalLifeId,
 			City:               task.City,
+			StageIntro:         stageintro,
+			ListTime:           listtime,
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
 	}
@@ -102,10 +284,9 @@ func GetLocallifetaskList(ctx context.Context, request http_model.GetLocalTaskLi
 func PassLocalTaskCoop(ctx context.Context, req http_model.PasslocalTaskCoopRequest) (bool, error) {
 	db := GetReadDB(ctx)
 	var count int64
-	fmt.Println("task_ids: ", req.TaskIds)
+
 	err := db.Model(gorm_model.YoungeeLocalTaskInfo{}).Where("task_id IN ? AND task_stage = 1", req.TaskIds).Count(&count).Error
 
-	fmt.Println("count: ", count)
 	if err != nil {
 		return false, err
 	}
@@ -200,13 +381,13 @@ func PassLocalTaskCoop(ctx context.Context, req http_model.PasslocalTaskCoopRequ
 				}
 				//服务商s_project已招募人数+1改成s_locallife
 				var sprojectinfo gorm_model.YounggeeSProjectInfo
-				err = db.Model(gorm_model.YounggeeSProjectInfo{}).Where(" s_project_id =?", req.SProjectId).Find(&sprojectinfo).Error
+				err = db.Model(gorm_model.YounggeeSProjectInfo{}).Where(" s_project_id =?", taskInfo.SLocalLifeId).Find(&sprojectinfo).Error
 				if err != nil {
 					return err
 				}
 				sprojectinfo.RecruitNum += 1
 				fmt.Println("......", projectinfo.RecruitNum)
-				err = tx.Model(gorm_model.YounggeeSProjectInfo{}).Where(" s_project_id =?", req.SProjectId).Updates(sprojectinfo).Error
+				err = tx.Model(gorm_model.YounggeeSProjectInfo{}).Where(" s_project_id =?", taskInfo.SLocalLifeId).Updates(sprojectinfo).Error
 				if err != nil {
 					return err
 				} //
@@ -440,8 +621,16 @@ func GetLocallifeData(ctx context.Context, req http_model.LocallifeDataRequest)
 
 func GetLocalPreSketchList(ctx context.Context, request http_model.LocalPreSketchListRequest) (*http_model.GetLocalSketchTaskListData, error) {
 	db := GetReadDB(ctx)
+	var localinfo gorm_model.YounggeeLocalLifeInfo
+	err := db.Model(&gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", request.ProjectId).First(&localinfo).Error
+	if err != nil {
+		return &http_model.GetLocalSketchTaskListData{}, err
+	}
 	var projecrtaskinfo []gorm_model.YoungeeLocalTaskInfo
 	query := db.Model(&gorm_model.YoungeeLocalTaskInfo{}).Where("local_id = ? AND task_stage = ?", request.ProjectId, request.ScriptStatus)
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -459,34 +648,77 @@ func GetLocalPreSketchList(ctx context.Context, request http_model.LocalPreSketc
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
+
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.LocalTasksketchInfo, 0, len(projecrtaskinfo))
 
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentId)
+		nickname, headurl, gender, fans, voteavg := getTalentinfo(db, task.TalentId)
 		Iscoop := getIscoop(db, task.TalentId, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, localinfo.LocalType)
 		taskinfo := &http_model.LocaLTaskInfo{
 			TaskId:             task.TaskId,
 			ProjectId:          task.LocalId,
 			TalentId:           task.TalentId,
-			FansNum:            task.FansNum,
+			FansNum:            fans,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
 			HeadUrl:            headurl,
+			Gender:             gender,
+			CollectNum:         0,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		response := &http_model.LocalTasksketchInfo{
 			Task: taskinfo,
-			DDl:  task.CurBreakAt,
+			DDl:  task.CurBreakAt.Format("2006-01-02 15:04:05"),
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
 
@@ -499,8 +731,18 @@ func GetLocalPreSketchList(ctx context.Context, request http_model.LocalPreSketc
 
 func GetLocalSketchList(ctx context.Context, request http_model.LocalTasksketchlistRequest) (*http_model.GetsketchlocaltaskListData, error) {
 	db := GetReadDB(ctx)
+	var localinfo gorm_model.YounggeeLocalLifeInfo
+	err := db.Model(&gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", request.ProjectId).First(&localinfo).Error
+	if err != nil {
+		return &http_model.GetsketchlocaltaskListData{}, err
+	}
 	var projecrtaskinfo []gorm_model.YoungeeLocalTaskInfo
 	query := db.Model(&gorm_model.YoungeeLocalTaskInfo{}).Where("local_id = ? AND task_stage = ?", request.ProjectId, request.ScriptStatus)
+
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
+
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -518,39 +760,88 @@ func GetLocalSketchList(ctx context.Context, request http_model.LocalTasksketchl
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.LocalTasksketchinfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentId)
+		nickname, headurl, gender, fans, voteavg := getTalentinfo(db, task.TalentId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, localinfo.LocalType)
 		taskinfo := &http_model.LocaLTaskInfo{
 			TaskId:             task.TaskId,
 			ProjectId:          task.LocalId,
 			TalentId:           task.TalentId,
-			FansNum:            task.FansNum,
+			FansNum:            fans,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
+			SType:              s_type,
+			SName:              s_name,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
 			NickName:           nickname,
+			Gender:             gender,
 			HeadUrl:            headurl,
 			City:               task.City,
 		}
 		var sketchinfo gorm_model.YounggeeSketchInfo
-		err := db.Model(&gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0", task.TaskId).First(&sketchinfo).Error
-		if err != nil {
-			return nil, err
+		switch request.ScriptStatus {
+		case 10:
+			err := db.Model(&gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0 ", task.TaskId).First(&sketchinfo).Error
+			if err != nil {
+				return nil, err
+			}
+		case 11:
+			err := db.Model(&gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_ok = 1", task.TaskId).First(&sketchinfo).Error
+			if err != nil {
+				return nil, err
+			}
 		}
 		boperator := getBOperator(db, task.BOperator, task.BOperatorType)
 		response := &http_model.LocalTasksketchinfo{
 			Task:     taskinfo,
 			SketchId: sketchinfo.SketchID,
-			SubmitAt: sketchinfo.SubmitAt,
-			AgreeAt:  sketchinfo.AgreeAt,
+			SubmitAt: sketchinfo.SubmitAt.Format("2006-01-02 15:04:05"),
+			AgreeAt:  sketchinfo.AgreeAt.Format("2006-01-02 15:04:05"),
 			Operator: boperator,
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
@@ -564,8 +855,18 @@ func GetLocalSketchList(ctx context.Context, request http_model.LocalTasksketchl
 
 func GetLocalPreLinkList(ctx context.Context, request http_model.LocalPreLinkListRequest) (*http_model.GetLocalPreLinkListData, error) {
 	db := GetReadDB(ctx)
+	var localinfo gorm_model.YounggeeLocalLifeInfo
+	err := db.Model(&gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", request.ProjectId).First(&localinfo).Error
+	if err != nil {
+		return &http_model.GetLocalPreLinkListData{}, err
+	}
 	var projecrtaskinfo []gorm_model.YoungeeLocalTaskInfo
 	query := db.Model(&gorm_model.YoungeeLocalTaskInfo{}).Where("local_id = ? AND task_stage = ?", request.ProjectId, request.LinkStatus)
+
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
+
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -583,33 +884,74 @@ func GetLocalPreLinkList(ctx context.Context, request http_model.LocalPreLinkLis
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.LocalTasklinkinfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentId)
+		nickname, headurl, gender, fans, voteavg := getTalentinfo(db, task.TalentId)
 		Iscoop := getIscoop(db, task.TalentId, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, localinfo.LocalType)
 		taskinfo := &http_model.LocaLTaskInfo{
 			TaskId:             task.TaskId,
 			ProjectId:          task.LocalId,
 			TalentId:           task.TalentId,
-			FansNum:            task.FansNum,
+			FansNum:            fans,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
 			HeadUrl:            headurl,
+			Gender:             gender,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		response := &http_model.LocalTasklinkinfo{
 			Task: taskinfo,
-			DDl:  task.CurBreakAt,
+			DDl:  task.CurBreakAt.Format("2006-01-02 15:04:05"),
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
 
@@ -622,8 +964,18 @@ func GetLocalPreLinkList(ctx context.Context, request http_model.LocalPreLinkLis
 
 func GetLocalLinkList(ctx context.Context, request http_model.LocalTaskLinklistRequest) (*http_model.GetLocalTaskLinkListData, error) {
 	db := GetReadDB(ctx)
+	var localinfo gorm_model.YounggeeLocalLifeInfo
+	err := db.Model(&gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", request.ProjectId).First(&localinfo).Error
+	if err != nil {
+		return &http_model.GetLocalTaskLinkListData{}, err
+	}
 	var projecrtaskinfo []gorm_model.YoungeeLocalTaskInfo
 	query := db.Model(&gorm_model.YoungeeLocalTaskInfo{}).Where("local_id = ? AND task_stage = ?", request.ProjectId, request.LinkStatus)
+
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
+
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -641,41 +993,90 @@ func GetLocalLinkList(ctx context.Context, request http_model.LocalTaskLinklistR
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.LocalTaskLinkinfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentId)
+		nickname, headurl, gender, fans, voteavg := getTalentinfo(db, task.TalentId)
 		Iscoop := getIscoop(db, task.TalentId, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, localinfo.LocalType)
 		taskinfo := &http_model.LocaLTaskInfo{
 			TaskId:             task.TaskId,
 			ProjectId:          task.LocalId,
 			TalentId:           task.TalentId,
-			FansNum:            task.FansNum,
+			FansNum:            fans,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
 			HeadUrl:            headurl,
+			Gender:             gender,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		var linkinfo gorm_model.YounggeeLinkInfo
-		err := db.Model(&gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0", task.TaskId).First(&linkinfo).Error
-		if err != nil {
-			return nil, err
+		switch request.LinkStatus {
+		case "12":
+			err := db.Model(&gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0 ", task.TaskId).First(&linkinfo).Error
+			if err != nil {
+				return nil, err
+			}
+		case "13":
+			err := db.Model(&gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_ok = 1", task.TaskId).First(&linkinfo).Error
+			if err != nil {
+				return nil, err
+			}
 		}
 		boperator := getBOperator(db, task.BOperator, task.BOperatorType)
 		response := &http_model.LocalTaskLinkinfo{
 			Task:     taskinfo,
 			LinkId:   linkinfo.LinkID,
-			SubmitAt: linkinfo.SubmitAt,
-			AgreeAt:  linkinfo.AgreeAt,
+			SubmitAt: linkinfo.SubmitAt.Format("2006-01-02 15:04:05"),
+			AgreeAt:  linkinfo.AgreeAt.Format("2006-01-02 15:04:05"),
 			LinkUrl:  linkinfo.LinkUrl,
 			PhotoUrl: linkinfo.PhotoUrl,
 			Operator: boperator,
@@ -691,8 +1092,16 @@ func GetLocalLinkList(ctx context.Context, request http_model.LocalTaskLinklistR
 
 func GetLocalPreDataList(ctx context.Context, request http_model.LocalPreDataListRequest) (*http_model.GetLocalPreDataListData, error) {
 	db := GetReadDB(ctx)
+	var localinfo gorm_model.YounggeeLocalLifeInfo
+	err := db.Model(&gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", request.ProjectId).First(&localinfo).Error
+	if err != nil {
+		return &http_model.GetLocalPreDataListData{}, err
+	}
 	var projecrtaskinfo []gorm_model.YoungeeLocalTaskInfo
 	query := db.Model(&gorm_model.YoungeeLocalTaskInfo{}).Where("local_id = ? AND task_stage = ?", request.ProjectId, request.DataStatus)
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -710,33 +1119,74 @@ func GetLocalPreDataList(ctx context.Context, request http_model.LocalPreDataLis
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.LocalTaskdatainfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentId)
+		nickname, headurl, gender, fans, voteavg := getTalentinfo(db, task.TalentId)
 		Iscoop := getIscoop(db, task.TalentId, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, localinfo.LocalType)
 		taskinfo := &http_model.LocaLTaskInfo{
 			TaskId:             task.TaskId,
 			ProjectId:          task.LocalId,
 			TalentId:           task.TalentId,
-			FansNum:            task.FansNum,
+			FansNum:            fans,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
 			HeadUrl:            headurl,
+			Gender:             gender,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		response := &http_model.LocalTaskdatainfo{
 			Task: taskinfo,
-			DDl:  task.CurBreakAt,
+			DDl:  task.CurBreakAt.Format("2006-01-02 15:04:05"),
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
 
@@ -749,8 +1199,18 @@ func GetLocalPreDataList(ctx context.Context, request http_model.LocalPreDataLis
 
 func GetLocalDataList(ctx context.Context, request http_model.LocalTaskDatalistRequest) (*http_model.GetLocalTaskDatalistData, error) {
 	db := GetReadDB(ctx)
+	var localinfo gorm_model.YounggeeLocalLifeInfo
+	err := db.Model(&gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", request.ProjectId).First(&localinfo).Error
+	if err != nil {
+		return &http_model.GetLocalTaskDatalistData{}, err
+	}
 	var projecrtaskinfo []gorm_model.YoungeeLocalTaskInfo
 	query := db.Model(&gorm_model.YoungeeLocalTaskInfo{}).Where("local_id = ? AND task_stage = ?", request.ProjectId, request.DataStatus)
+
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
+
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -768,41 +1228,90 @@ func GetLocalDataList(ctx context.Context, request http_model.LocalTaskDatalistR
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.LocalTaskDatainfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentId)
+		nickname, headurl, gender, fans, voteavg := getTalentinfo(db, task.TalentId)
 		Iscoop := getIscoop(db, task.TalentId, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, localinfo.LocalType)
 		taskinfo := &http_model.LocaLTaskInfo{
 			TaskId:             task.TaskId,
 			ProjectId:          task.LocalId,
 			TalentId:           task.TalentId,
-			FansNum:            task.FansNum,
+			FansNum:            fans,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
 			HeadUrl:            headurl,
+			Gender:             gender,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		var datainfo gorm_model.YounggeeDataInfo
-		err := db.Model(&gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0", task.TaskId).First(&datainfo).Error
-		if err != nil {
-			return nil, err
+		switch request.DataStatus {
+		case "12":
+			err := db.Model(&gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0 ", task.TaskId).First(&datainfo).Error
+			if err != nil {
+				return nil, err
+			}
+		case "13":
+			err := db.Model(&gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_ok = 1", task.TaskId).First(&datainfo).Error
+			if err != nil {
+				return nil, err
+			}
 		}
 		boperator := getBOperator(db, task.BOperator, task.BOperatorType)
 		response := &http_model.LocalTaskDatainfo{
 			Task:          taskinfo,
 			DataId:        datainfo.DataID,
-			SubmitAt:      datainfo.SubmitAt,
-			AgreeAt:       datainfo.AgreeAt,
+			SubmitAt:      datainfo.SubmitAt.Format("2006-01-02 15:04:05"),
+			AgreeAt:       datainfo.AgreeAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:      datainfo.PhotoUrl,
 			PlayNumber:    datainfo.PlayNumber,
 			LikeNumber:    datainfo.LikeNumber,

+ 46 - 0
db/platform_kuaishou_user.go

@@ -2,7 +2,9 @@ package db
 
 import (
 	"context"
+	"strings"
 	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/model/http_model"
 )
 
 func FindUserInfoByTalentId(ctx context.Context, talentId string) (*gorm_model.PlatformKuaishouUserInfo, error) {
@@ -14,3 +16,47 @@ func FindUserInfoByTalentId(ctx context.Context, talentId string) (*gorm_model.P
 	}
 	return &userInfo, nil
 }
+
+// FindUserInfoByOpenId 根据openID去查找快手授权信息
+func FindUserInfoByOpenId(ctx context.Context, openId string) (*gorm_model.PlatformKuaishouUserInfo, error) {
+	db := GetReadDB(ctx)
+	var userInfo gorm_model.PlatformKuaishouUserInfo
+	err := db.Model(gorm_model.PlatformKuaishouUserInfo{}).Where("open_id = ? and platform_id = ?", openId, 4).Find(&userInfo).Error
+	if err != nil {
+		return nil, err
+	}
+	return &userInfo, nil
+}
+
+func GetProvince(ctx context.Context, request http_model.GetProviceRequest) (*http_model.GetProviceResponse, error) {
+	db := GetReadDB(ctx)
+	var userInfo []gorm_model.PlatformKuaishouUserInfo
+	// 从数据库中获取所有 city 字段的数据
+	err := db.Model(&gorm_model.PlatformKuaishouUserInfo{}).Pluck("city", &userInfo).Error
+	if err != nil {
+		return nil, err
+	}
+
+	// 使用 map 来去重省份
+	provinceMap := make(map[string]struct{})
+	for _, user := range userInfo {
+		if user.City != "" {
+			// 按照空格分割 city 字段,取第一个部分作为省份
+			cityParts := strings.Split(user.City, " ")
+			if len(cityParts) > 0 {
+				provinceMap[cityParts[0]] = struct{}{} // 使用空结构体来去重
+			}
+		}
+	}
+
+	// 将 map 中的省份名称放入切片
+	var provinces []string
+	for province := range provinceMap {
+		provinces = append(provinces, province)
+	}
+
+	// 返回省份列表
+	return &http_model.GetProviceResponse{
+		Provices: provinces,
+	}, nil
+}

+ 619 - 80
db/project_task.go

@@ -13,11 +13,75 @@ import (
 	"youngee_b_api/model/http_model"
 )
 
+func GetRecruittime(ctx context.Context, request http_model.GetRecruitTimeRequest) (*http_model.GetRecruitTimeResponse, error) {
+	db := GetReadDB(ctx)
+	var info gorm_model.ProjectInfo
+	err := db.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", request.ProjectId).Find(&info).Error
+	var result http_model.GetRecruitTimeResponse
+	if err != nil {
+		return &result, err
+	}
+	result.RecruitTime = info.RecruitDdl.Format("2006-01-02 15:04:05")
+	return &result, nil
+}
+
+func GetTalentstatusCount(db *gorm.DB, request http_model.GetTalentstatusNumRequest, status int) (int64, error) {
+	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_status = ?", request.ProjectId, status)
+
+	// 计算总数
+	var total int64
+	if err := query.Count(&total).Error; err != nil {
+		return 0, err
+	}
+	return total, nil
+}
+
+func GetTalentstatusNum(db *gorm.DB, request http_model.GetTalentstatusCountRequest, status int) (int64, error) {
+	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_stage = ?", request.ProjectId, status)
+	var total int64
+	if err := query.Count(&total).Error; err != nil {
+		return 0, err
+	}
+	return total, nil
+}
+
+func GetTalentstatusCountNum(ctx context.Context, request http_model.GetTalentstatusCountRequest) (*http_model.GetTalentstatusCountResponse, error) {
+	db := GetReadDB(ctx)
+	var unoperatenum, agreetalentnum, refusetalentnum int64
+	unoperatenum, _ = GetTalentstatusNum(db, request, request.TaskStage)
+	agreetalentnum, _ = GetTalentstatusNum(db, request, request.TaskStage+1)
+	refusetalentnum, _ = GetTalentstatusNum(db, request, request.TaskStage+2)
+	count := &http_model.GetTalentstatusCountResponse{
+		UnoperateTalentnum: unoperatenum,
+		AgreeTalentnum:     agreetalentnum,
+		RefuseTalentnum:    refusetalentnum,
+	}
+	return count, nil
+}
+
+func GetTalentstatusNumCount(ctx context.Context, request http_model.GetTalentstatusNumRequest) (*http_model.GetTalentStatusNumResponse, error) {
+	db := GetReadDB(ctx)
+	var unoperatenum, agreetalentnum, refusetalentnum int64
+	unoperatenum, _ = GetTalentstatusCount(db, request, 1)
+	agreetalentnum, _ = GetTalentstatusCount(db, request, 2)
+	refusetalentnum, _ = GetTalentstatusCount(db, request, 3)
+	count := &http_model.GetTalentStatusNumResponse{
+		UnoperateTalentnum: unoperatenum,
+		AgreeTalentnum:     agreetalentnum,
+		RefuseTalentnum:    refusetalentnum,
+	}
+	return count, nil
+}
+
 func GetProjecttaskList(ctx context.Context, request http_model.GetTaskListRequest) (*http_model.GetTaskListData, error) {
 	db := GetReadDB(ctx)
 	var projecrtaskinfo []gorm_model.YoungeeTaskInfo
 	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_status = ?", request.ProjectId, request.CoopType)
-
+	var projectinfo gorm_model.ProjectInfo
+	err := db.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", request.ProjectId).First(&projectinfo).Error
+	if err != nil {
+		return &http_model.GetTaskListData{}, err
+	}
 	// 构建查询条件
 	if request.FeeFrom != nil {
 		query = query.Where("fee_form = ?", request.FeeFrom)
@@ -30,7 +94,9 @@ func GetProjecttaskList(ctx context.Context, request http_model.GetTaskListReque
 			query = query.Where("supplier_id !=0 AND supplier_status = 2")
 		}
 	}
-
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -48,6 +114,42 @@ func GetProjecttaskList(ctx context.Context, request http_model.GetTaskListReque
 	}
 	offset := (pageNum - 1) * pageSize
 
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	// 执行分页查询
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
@@ -64,29 +166,107 @@ func GetProjecttaskList(ctx context.Context, request http_model.GetTaskListReque
 		case 3:
 			Time = task.CompleteDate
 		}
+		var listtime, stageintro string
+		switch task.TaskStage {
+		case 4:
+			{
+				listtime = task.SelectDate.Format("2006-01-02 15:04:05")
+				stageintro = "执行开始时间"
+			}
+		case 5:
+			{
+				listtime = task.DeliveryDate.Format("2006-01-02 15:04:05")
+				stageintro = "商家寄样时间"
+			}
+		case 9:
+			{
+				listtime = task.CurBreakAt.Format("2006-01-02 15:04:05")
+				stageintro = "初稿上传截止时间"
+			}
+		case 10:
+			{
+				var sketchinfo gorm_model.YounggeeSketchInfo
+				err := db.Model(&gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0", task.TaskID).First(&sketchinfo).Error
+				if err != nil {
+					return nil, err
+				}
+				listtime = sketchinfo.SubmitAt.Format("2006-01-02 15:04:05")
+				stageintro = "达人上传初稿时间" //
+			}
+		case 11:
+			{
+				listtime = task.CurBreakAt.Format("2006-01-02 15:04:05")
+				stageintro = " 链接上传截止时间"
+			}
+		case 12:
+			{
+				var linkinfo gorm_model.YounggeeLinkInfo
+				err := db.Model(&gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0", task.TaskID).First(&linkinfo).Error
+				if err != nil {
+					return nil, err
+				}
+				listtime = linkinfo.SubmitAt.Format("2006-01-02 15:04:05")
+				stageintro = "达人上传链接时间"
+			}
+		case 13:
+			{
+				listtime = task.CurBreakAt.Format("2006-01-02 15:04:05")
+				stageintro = "数据待传截止时间"
+			}
+		case 14:
+			{
+				var datainfo gorm_model.YounggeeDataInfo
+				err := db.Model(&gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0", task.TaskID).First(&datainfo).Error
+				if err != nil {
+					return nil, err
+				}
+				var auto_task_finish gorm_model.InfoAutoTask
+				db.Model(&gorm_model.InfoAutoTask{}).Where("enterprise_id = ?", request.EnterPriseId).First(&auto_task_finish)
+				// 将小时数转换为 Duration 后相加
+				resultTime := datainfo.SubmitAt.Add(time.Duration(auto_task_finish.TaskFinishAuto) * time.Hour)
+				listtime = resultTime.Format("2006-01-02 15:04:05")
+				stageintro = "品牌最晚结算时间"
+			}
+		case 15:
+			{
+				listtime = task.CompleteDate.Format("2006-01-02 15:04:05")
+				stageintro = "品牌结算时间"
+			}
+		case 16:
+			{
+				listtime = task.CancelTime.Format("2006-01-02 15:04:05")
+				stageintro = "解约时间"
+			}
+		}
 		boperator := getBOperator(db, task.BOperator, task.BOperatorType)
-		nickname, headurl := getTalentinfo(db, task.TalentID)
+		nickname, headurl, gender, fansnum, voteavg := getTalentinfo(db, task.OpenId)
 		Iscoop := getIscoop(db, task.TalentID, request.EnterPriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, projectinfo.ProjectType)
 		response := &http_model.TaskInfo{
 			TaskId:             task.TaskID,
 			ProjectId:          task.ProjectID,
 			TalentId:           task.TalentID,
-			FansNum:            task.FansNum,
+			FansNum:            fansnum,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0, //暂时获取不到
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
-			SType:              stype(db, task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			Boperator:          boperator,
-			CreateAt:           Time,
+			CreateAt:           Time.Format("2006-01-02 15:04:05"),
 			NickName:           nickname,
+			Gender:             gender,
 			HeadUrl:            headurl,
 			ISCoop:             Iscoop,
 			Sprojectid:         task.SprojectId,
 			City:               task.City,
+			ListTime:           listtime,
+			StageIntro:         stageintro,
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
 	}
@@ -121,12 +301,13 @@ func getBOperator(db *gorm.DB, bOperatorID string, bOperatorType int) string {
 	return ""
 }
 
-func getTalentinfo(db *gorm.DB, talentID string) (string, string) {
+func getTalentinfo(db *gorm.DB, OpenId string) (string, string, string, int, int) {
 	var talentinfo gorm_model.PlatformKuaishouUserInfo
-	if err := db.Where(gorm_model.PlatformKuaishouUserInfo{TalentId: talentID}).First(&talentinfo).Error; err != nil {
-		return "", ""
+	if err := db.Where(gorm_model.PlatformKuaishouUserInfo{OpenId: OpenId}).First(&talentinfo).Error; err != nil {
+		return "", "", "", 0, 0
 	}
-	return talentinfo.NickName, talentinfo.HeadUri
+	fan, _ := conv.Int(talentinfo.Fan)
+	return talentinfo.NickName, talentinfo.HeadUri, talentinfo.Gender, fan, talentinfo.LikeNum
 }
 
 func getIscoop(db *gorm.DB, talentid string, enterpriseid string) int {
@@ -144,24 +325,34 @@ func determineFrom(supplierID, supplierStatus int) int {
 	return 1
 }
 
-func stype(db *gorm.DB, supplierID, supplierStatus int) int {
-	if supplierID != 0 && supplierStatus == 2 {
-		var supplierinfo gorm_model.Supplier
-		err := db.Model(gorm_model.Supplier{}).Where("supplier_id = ?", supplierID).First(&supplierinfo).Error
-		if err != nil {
-			return 0
+func stype(db *gorm.DB, supplierID, supplierStatus int, projecttype int64) (int, string) {
+	if projecttype == 1 {
+		if supplierID != 0 && supplierStatus == 2 {
+			var supplierinfo gorm_model.Supplier
+			err := db.Model(gorm_model.Supplier{}).Where("supplier_id = ?", supplierID).First(&supplierinfo).Error
+			if err != nil {
+				return 0, "公海"
+			}
+			return supplierinfo.SupplierType, supplierinfo.SupplierName
 		}
-		return supplierinfo.SupplierType
+		return 0, "公海"
+	} else {
+		if supplierID != 0 && supplierStatus == 2 {
+			var supplierinfo gorm_model.Supplier
+			err := db.Model(gorm_model.Supplier{}).Where("supplier_id = ?", supplierID).First(&supplierinfo).Error
+			if err != nil {
+				return 0, "私域"
+			}
+			return supplierinfo.SupplierType, supplierinfo.SupplierName
+		}
+		return 0, "私域"
 	}
-	return 0
 }
-func PassProTaskCoop(ctx context.Context, projectId string, taskIds []string, operatorid string, operatetype int, Isspecial int, req http_model.PassproTaskCoopRequest) (bool, error) {
+func PassProTaskCoop(ctx context.Context, projectId string, taskIds []string, operatorid string, operatetype int, Isspecial int, Enterpriseid string, req http_model.PassproTaskCoopRequest) (bool, error) {
 	db := GetReadDB(ctx)
 	var count int64
-	fmt.Println("task_ids: ", taskIds)
 	err := db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ? AND task_stage = 1", taskIds).Count(&count).Error
 
-	fmt.Println("count: ", count)
 	if err != nil {
 		return false, err
 	}
@@ -218,6 +409,21 @@ func PassProTaskCoop(ctx context.Context, projectId string, taskIds []string, op
 		}
 	}
 
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
+
 	//4.根据达人来源改变状态、阶段、数目
 	var tasks []gorm_model.YoungeeTaskInfo
 	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ? AND task_stage = 1", taskIds).Find(&tasks).Error
@@ -232,8 +438,8 @@ func PassProTaskCoop(ctx context.Context, projectId string, taskIds []string, op
 					TaskStage:     taskstages,
 					TaskStatus:    2,
 					UpdateAt:      time.Now(),
-					BOperator:     operatorid,
-					BOperatorType: operatetype,
+					BOperator:     opid,
+					BOperatorType: optype,
 					SelectDate:    time.Now(),
 				}
 				err = tx.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ? AND task_stage = 1", taskInfo.TaskID).Updates(updateData).Error
@@ -255,13 +461,13 @@ func PassProTaskCoop(ctx context.Context, projectId string, taskIds []string, op
 				}
 				//服务商s_project已招募人数+1
 				var sprojectinfo gorm_model.YounggeeSProjectInfo
-				err = db.Model(gorm_model.YounggeeSProjectInfo{}).Where(" s_project_id =?", req.SProjectId).Find(&sprojectinfo).Error
+				err = db.Model(gorm_model.YounggeeSProjectInfo{}).Where(" s_project_id =?", taskInfo.SprojectId).Find(&sprojectinfo).Error
 				if err != nil {
 					return err
 				}
 				sprojectinfo.RecruitNum += 1
 				fmt.Println("......", projectinfo.RecruitNum)
-				err = tx.Model(gorm_model.YounggeeSProjectInfo{}).Where(" s_project_id =?", req.SProjectId).Updates(sprojectinfo).Error
+				err = tx.Model(gorm_model.YounggeeSProjectInfo{}).Where(" s_project_id =?", taskInfo.SprojectId).Updates(sprojectinfo).Error
 				if err != nil {
 					return err
 				}
@@ -289,8 +495,8 @@ func PassProTaskCoop(ctx context.Context, projectId string, taskIds []string, op
 					TaskStage:     taskstages,
 					TaskStatus:    2,
 					UpdateAt:      time.Now(),
-					BOperator:     operatorid,
-					BOperatorType: operatetype,
+					BOperator:     opid,
+					BOperatorType: optype,
 					SelectDate:    time.Now(),
 				}
 				err = tx.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ? AND task_stage = 1", taskInfo.TaskID).Updates(updateData).Error
@@ -328,7 +534,7 @@ func PassProTaskCoop(ctx context.Context, projectId string, taskIds []string, op
 	return true, nil
 }
 
-func RefuseproTaskCoop(ctx context.Context, taskIds []string, operatorid string, operatetype int) (bool, error) {
+func RefuseproTaskCoop(ctx context.Context, taskIds []string, operatorid string, operatetype int, Enterpriseid string) (bool, error) {
 	db := GetWriteDB(ctx)
 	// 1. 校验
 	var count int64
@@ -340,6 +546,21 @@ func RefuseproTaskCoop(ctx context.Context, taskIds []string, operatorid string,
 		return false, errors.New("任务id有误")
 	}
 
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
+
 	// 2. 查询任务对应达人id(用于生成达人消息)
 	var talentIds []string
 	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ?", taskIds).Select("talent_id").Find(&talentIds).Error
@@ -357,8 +578,8 @@ func RefuseproTaskCoop(ctx context.Context, taskIds []string, operatorid string,
 				TaskStage:     3,
 				TaskStatus:    3,
 				UpdateAt:      time.Now(),
-				BOperator:     operatorid,
-				BOperatorType: operatetype,
+				BOperator:     opid,
+				BOperatorType: optype,
 				CompleteDate:  time.Now(),
 			}
 			err = tx.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ? AND task_stage = 1", taskInfo.TaskID).Updates(updateData).Error
@@ -380,6 +601,15 @@ func GetPreSketchList(ctx context.Context, request http_model.PreSketchListReque
 	db := GetReadDB(ctx)
 	var projecrtaskinfo []gorm_model.YoungeeTaskInfo
 	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_stage = ?", request.ProjectId, request.ScriptStatus)
+	var projectinfo gorm_model.ProjectInfo
+	err := db.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", request.ProjectId).First(&projectinfo).Error
+	if err != nil {
+		return &http_model.GetSketchTaskListData{}, err
+	}
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
+
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -397,35 +627,75 @@ func GetPreSketchList(ctx context.Context, request http_model.PreSketchListReque
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.TasksketchInfo, 0, len(projecrtaskinfo))
 
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentID)
+		nickname, headurl, gender, fansnum, voteavg := getTalentinfo(db, task.OpenId)
 		Iscoop := getIscoop(db, task.TalentID, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, projectinfo.ProjectType)
 		taskinfo := &http_model.TaskInfo{
 			TaskId:             task.TaskID,
 			ProjectId:          task.ProjectID,
 			TalentId:           task.TalentID,
-			FansNum:            task.FansNum,
+			FansNum:            fansnum,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
-			SType:              stype(db, task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
+			Gender:             gender,
 			HeadUrl:            headurl,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		response := &http_model.TasksketchInfo{
 			Task: taskinfo,
-			DDl:  task.CurBreakAt,
+			DDl:  task.CurBreakAt.Format("2006-01-02 15:04:05"),
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
 
@@ -440,6 +710,15 @@ func GetSketchList(ctx context.Context, request http_model.TasksketchlistRequest
 	db := GetReadDB(ctx)
 	var projecrtaskinfo []gorm_model.YoungeeTaskInfo
 	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_stage = ?", request.ProjectId, request.ScriptStatus)
+	var projectinfo gorm_model.ProjectInfo
+	err := db.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", request.ProjectId).First(&projectinfo).Error
+	if err != nil {
+		return &http_model.GetsketchtaskListData{}, err
+	}
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
+
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -457,40 +736,90 @@ func GetSketchList(ctx context.Context, request http_model.TasksketchlistRequest
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.Tasksketchinfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentID)
+		nickname, headurl, gender, fansnum, voteavg := getTalentinfo(db, task.OpenId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, projectinfo.ProjectType)
 		taskinfo := &http_model.TaskInfo{
 			TaskId:             task.TaskID,
 			ProjectId:          task.ProjectID,
 			TalentId:           task.TalentID,
-			FansNum:            task.FansNum,
+			FansNum:            fansnum,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
-			SType:              stype(db, task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
+			Gender:             gender,
 			HeadUrl:            headurl,
 			City:               task.City,
 		}
+
 		var sketchinfo gorm_model.YounggeeSketchInfo
-		err := db.Model(&gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0", task.TaskID).First(&sketchinfo).Error
-		if err != nil {
-			return nil, err
+		switch request.ScriptStatus {
+		case 10:
+			err := db.Model(&gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0 ", task.TaskID).First(&sketchinfo).Error
+			if err != nil {
+				return nil, err
+			}
+		case 11:
+			err := db.Model(&gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_ok = 1", task.TaskID).First(&sketchinfo).Error
+			if err != nil {
+				return nil, err
+			}
 		}
+
 		boperator := getBOperator(db, task.BOperator, task.BOperatorType)
 		response := &http_model.Tasksketchinfo{
 			Task:     taskinfo,
 			SketchId: sketchinfo.SketchID,
-			SubmitAt: sketchinfo.SubmitAt,
-			AgreeAt:  sketchinfo.AgreeAt,
+			SubmitAt: sketchinfo.SubmitAt.Format("2006-01-02 15:04:05"),
+			AgreeAt:  sketchinfo.AgreeAt.Format("2006-01-02 15:04:05"),
 			Operator: boperator,
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
@@ -506,6 +835,15 @@ func GetPreLinkList(ctx context.Context, request http_model.PreLinkListRequest)
 	db := GetReadDB(ctx)
 	var projecrtaskinfo []gorm_model.YoungeeTaskInfo
 	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_stage = ?", request.ProjectId, request.LinkStatus)
+	var projectinfo gorm_model.ProjectInfo
+	err := db.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", request.ProjectId).First(&projectinfo).Error
+	if err != nil {
+		return &http_model.GetprelinkListData{}, err
+	}
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
+
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -523,34 +861,74 @@ func GetPreLinkList(ctx context.Context, request http_model.PreLinkListRequest)
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.Tasklinkinfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentID)
+		nickname, headurl, gender, fansnum, voteavg := getTalentinfo(db, task.OpenId)
 		Iscoop := getIscoop(db, task.TalentID, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, projectinfo.ProjectType)
 		taskinfo := &http_model.TaskInfo{
 			TaskId:             task.TaskID,
 			ProjectId:          task.ProjectID,
 			TalentId:           task.TalentID,
-			FansNum:            task.FansNum,
+			FansNum:            fansnum,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
-			SType:              stype(db, task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
+			Gender:             gender,
 			HeadUrl:            headurl,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		response := &http_model.Tasklinkinfo{
 			Task: taskinfo,
-			DDl:  task.CurBreakAt,
+			DDl:  task.CurBreakAt.Format("2006-01-02 15:04:05"),
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
 
@@ -565,6 +943,15 @@ func GetLinkList(ctx context.Context, request http_model.TaskLinklistRequest) (*
 	db := GetReadDB(ctx)
 	var projecrtaskinfo []gorm_model.YoungeeTaskInfo
 	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_stage = ?", request.ProjectId, request.LinkStatus)
+	var projectinfo gorm_model.ProjectInfo
+	err := db.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", request.ProjectId).First(&projectinfo).Error
+	if err != nil {
+		return &http_model.GettasklinkListData{}, err
+	}
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
+
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -582,42 +969,90 @@ func GetLinkList(ctx context.Context, request http_model.TaskLinklistRequest) (*
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.TaskLinkinfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentID)
+		nickname, headurl, gender, fansnum, voteavg := getTalentinfo(db, task.OpenId)
 		Iscoop := getIscoop(db, task.TalentID, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, projectinfo.ProjectType)
 		taskinfo := &http_model.TaskInfo{
 			TaskId:             task.TaskID,
 			ProjectId:          task.ProjectID,
 			TalentId:           task.TalentID,
-			FansNum:            task.FansNum,
+			FansNum:            fansnum,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
-			SType:              stype(db, task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
+			Gender:             gender,
 			HeadUrl:            headurl,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		var linkinfo gorm_model.YounggeeLinkInfo
-		err := db.Model(&gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0", task.TaskID).First(&linkinfo).Error
-		if err != nil {
-			return nil, err
+		switch request.LinkStatus {
+		case "12":
+			err := db.Model(&gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_review = 0 ", task.TaskID).First(&linkinfo).Error
+			if err != nil {
+				return nil, err
+			}
+		case "13":
+			err := db.Model(&gorm_model.YounggeeLinkInfo{}).Where("task_id = ? and is_ok = 1", task.TaskID).First(&linkinfo).Error
+			if err != nil {
+				return nil, err
+			}
 		}
 		boperator := getBOperator(db, task.BOperator, task.BOperatorType)
 		response := &http_model.TaskLinkinfo{
 			Task:     taskinfo,
 			LinkId:   linkinfo.LinkID,
-			SubmitAt: linkinfo.SubmitAt,
-			AgreeAt:  linkinfo.AgreeAt,
+			SubmitAt: linkinfo.SubmitAt.Format("2006-01-02 15:04:05"),
+			AgreeAt:  linkinfo.AgreeAt.Format("2006-01-02 15:04:05"),
 			LinkUrl:  linkinfo.LinkUrl,
 			PhotoUrl: linkinfo.PhotoUrl,
 			Operator: boperator,
@@ -635,6 +1070,14 @@ func GetPreDataList(ctx context.Context, request http_model.PreDataListRequest)
 	db := GetReadDB(ctx)
 	var projecrtaskinfo []gorm_model.YoungeeTaskInfo
 	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_stage = ?", request.ProjectId, request.DataStatus)
+	var projectinfo gorm_model.ProjectInfo
+	err := db.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", request.ProjectId).First(&projectinfo).Error
+	if err != nil {
+		return &http_model.GetPreDataListData{}, err
+	}
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -652,34 +1095,74 @@ func GetPreDataList(ctx context.Context, request http_model.PreDataListRequest)
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.Taskdatainfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentID)
+		nickname, headurl, gender, fansnum, voteavg := getTalentinfo(db, task.OpenId)
 		Iscoop := getIscoop(db, task.TalentID, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, projectinfo.ProjectType)
 		taskinfo := &http_model.TaskInfo{
 			TaskId:             task.TaskID,
 			ProjectId:          task.ProjectID,
 			TalentId:           task.TalentID,
-			FansNum:            task.FansNum,
+			FansNum:            fansnum,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
-			SType:              stype(db, task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
+			Gender:             gender,
 			HeadUrl:            headurl,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		response := &http_model.Taskdatainfo{
 			Task: taskinfo,
-			DDl:  task.CurBreakAt,
+			DDl:  task.CurBreakAt.Format("2006-01-02 15:04:05"),
 		}
 		taskInfoPointers = append(taskInfoPointers, response)
 
@@ -692,8 +1175,16 @@ func GetPreDataList(ctx context.Context, request http_model.PreDataListRequest)
 
 func GetDataList(ctx context.Context, request http_model.TaskDatalistRequest) (*http_model.GetTaskDatalistData, error) {
 	db := GetReadDB(ctx)
+	var projectinfo gorm_model.ProjectInfo
+	err := db.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", request.ProjectId).First(&projectinfo).Error
+	if err != nil {
+		return &http_model.GetTaskDatalistData{}, err
+	}
 	var projecrtaskinfo []gorm_model.YoungeeTaskInfo
 	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_stage = ?", request.ProjectId, request.DataStatus)
+	if request.Others != "" {
+		query = query.Where("talent_name LIKE ? OR s_operate_name LIKE ?", "%"+request.Others+"%", "%"+request.Others+"%")
+	}
 	// 计算总数
 	var total int64
 	if err := query.Count(&total).Error; err != nil {
@@ -711,42 +1202,90 @@ func GetDataList(ctx context.Context, request http_model.TaskDatalistRequest) (*
 	}
 	offset := (pageNum - 1) * pageSize
 	// 执行分页查询
+	// 处理多字段排序逻辑
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			field := request.SortField[i]
+			order := request.SortOrder[i]
+			switch field {
+			case "fansnum":
+				if order == "asc" {
+					query = query.Order("fans_num asc")
+				} else {
+					query = query.Order("fans_num desc")
+				}
+			case "voteavg":
+				if order == "asc" {
+					query = query.Order("vote_avg asc")
+				} else {
+					query = query.Order("vote_avg desc")
+				}
+			case "commentavg":
+				if order == "asc" {
+					query = query.Order("commit_avg asc")
+				} else {
+					query = query.Order("commit_avg desc")
+				}
+			case "collectnum":
+				if order == "asc" {
+					query = query.Order("view_num asc")
+				} else {
+					query = query.Order("view_num desc")
+				}
+			}
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("task_status asc").Order("task_stage asc")
+	}
 	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
 		return nil, err
 	}
 	taskInfoPointers := make([]*http_model.TaskDatainfo, 0, len(projecrtaskinfo))
 	for _, task := range projecrtaskinfo {
-		nickname, headurl := getTalentinfo(db, task.TalentID)
+		nickname, headurl, gender, fansnum, voteavg := getTalentinfo(db, task.OpenId)
 		Iscoop := getIscoop(db, task.TalentID, request.EnterpriseId)
+		s_type, s_name := stype(db, task.SupplierId, task.SupplierStatus, projectinfo.ProjectType)
 		taskinfo := &http_model.TaskInfo{
 			TaskId:             task.TaskID,
 			ProjectId:          task.ProjectID,
 			TalentId:           task.TalentID,
-			FansNum:            task.FansNum,
+			FansNum:            fansnum,
 			DraftFee:           task.DraftFee,
-			Voteavg:            task.VoteAvg,
+			Voteavg:            voteavg,
 			FeeFrom:            task.FeeForm,
 			TaskStage:          task.TaskStage,
-			Commentavg:         task.CommitAvg,
+			Commentavg:         0,
+			CollectNum:         0,
 			CurrentDefaultType: task.CurDefaultType,
 			From:               determineFrom(task.SupplierId, task.SupplierStatus),
-			SType:              stype(db, task.SupplierId, task.SupplierStatus),
+			SType:              s_type,
+			SName:              s_name,
 			NickName:           nickname,
+			Gender:             gender,
 			HeadUrl:            headurl,
 			ISCoop:             Iscoop,
 			City:               task.City,
 		}
 		var datainfo gorm_model.YounggeeDataInfo
-		err := db.Model(&gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0", task.TaskID).First(&datainfo).Error
-		if err != nil {
-			return nil, err
+		switch request.DataStatus {
+		case "12":
+			err := db.Model(&gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_review = 0 ", task.TaskID).First(&datainfo).Error
+			if err != nil {
+				return nil, err
+			}
+		case "13":
+			err := db.Model(&gorm_model.YounggeeDataInfo{}).Where("task_id = ? and is_ok = 1", task.TaskID).First(&datainfo).Error
+			if err != nil {
+				return nil, err
+			}
 		}
 		boperator := getBOperator(db, task.BOperator, task.BOperatorType)
 		response := &http_model.TaskDatainfo{
 			Task:          taskinfo,
 			DataId:        datainfo.DataID,
-			SubmitAt:      datainfo.SubmitAt,
-			AgreeAt:       datainfo.AgreeAt,
+			SubmitAt:      datainfo.SubmitAt.Format("2006-01-02 15:04:05"),
+			AgreeAt:       datainfo.AgreeAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:      datainfo.PhotoUrl,
 			PlayNumber:    datainfo.PlayNumber,
 			LikeNumber:    datainfo.LikeNumber,

+ 107 - 25
db/sectask.go

@@ -30,7 +30,7 @@ func GetSecTaskById(ctx context.Context, secTaskId string) (*gorm_model.Younggee
 	return &secTaskInfo, nil
 }
 
-func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, searchValue string, pageSize, pageNum int64) ([]*http_model.SecTaskInfo, int64, error) {
+func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, searchValue string, saleNumMin int, saleNumMax int, pageSize, pageNum int64, orderBy []string, orderDesc []int) ([]*http_model.SecTaskInfo, int64, error) {
 	db := GetReadDB(ctx)
 	// var taskStages []int
 	var freeStages []int
@@ -44,6 +44,10 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 		// 申请成功
 		freeStages = []int{3, 4, 5}
 		break
+	case 5:
+		// 申请失败
+		freeStages = []int{2}
+		break
 	case 6:
 		// 待发货
 		freeStages = []int{3}
@@ -68,7 +72,7 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 		freeStages = []int{0, 1, 2, 3, 4, 5}
 		rewardStages = []int{0, 1}
 	}
-	fmt.Println("task_stages: ", freeStages, rewardStages)
+	// fmt.Println("task_stages: ", freeStages, rewardStages)
 	if len(freeStages) == 0 {
 		// 根据悬赏阶段筛选
 		db = db.Model(gorm_model.YounggeeSecTaskInfo{}).Where("selection_id = ? and reward_stage in ?", selectionId, rewardStages)
@@ -76,6 +80,33 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 		// 根据免费领样阶段筛选
 		db = db.Model(gorm_model.YounggeeSecTaskInfo{}).Where("selection_id = ? and free_stage in ?", selectionId, freeStages)
 	}
+
+	// 动态排序逻辑
+	if len(orderBy) > 0 && len(orderDesc) > 0 && len(orderBy) == len(orderDesc) {
+		for i := 0; i < len(orderBy); i++ {
+			orderField := orderBy[i]
+			isDesc := orderDesc[i] == 1 // 1=降序,其他值=升序
+
+			switch orderField {
+			case "sale_num":
+				if isDesc {
+					db = db.Order("sale_num desc")
+				} else {
+					db = db.Order("sale_num asc")
+				}
+			case "fans_count":
+				if isDesc {
+					db = db.Order("fans_num desc")
+				} else {
+					db = db.Order("fans_num asc")
+				}
+			}
+		}
+	} else {
+		// 默认排序
+		db = db.Order("sec_task_id desc")
+	}
+
 	// 查询总数
 	var total int64
 	var secTaskInfoList []*gorm_model.YounggeeSecTaskInfo
@@ -83,10 +114,11 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 		logrus.WithContext(ctx).Errorf("[GetSelectionList] error query mysql total, err:%+v", err)
 		return nil, 0, err
 	}
+
 	// 查询该页数据
 	limit := pageSize
 	offset := pageSize * (pageNum - 1) // assert pageNum start with 0
-	err := db.Order("create_date desc").Limit(int(limit)).Offset(int(offset)).Find(&secTaskInfoList).Error
+	err := db.Limit(int(limit)).Offset(int(offset)).Find(&secTaskInfoList).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[GetSelectionList] error query mysql total, err:%+v", err)
 		return nil, 0, err
@@ -112,11 +144,37 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 		v.PlatformNickname = kuaishouUserInfo.NickName
 		v.KuaiShouUserGender = kuaishouUserInfo.Gender
 		v.KuaiShouUserLocation = kuaishouUserInfo.City
+		v.FansCount = kuaishouUserInfo.Fan
 	}
 
+	// 写入带货任务信息
+	for _, v := range newSecTaskInfoList {
+		selectionInfo, selectionInfoErr := GetSelectionById(ctx, v.SelectionId)
+		if selectionInfoErr != nil {
+			return nil, 0, selectionInfoErr
+		}
+		v.EnterpriseId = selectionInfo.EnterpriseID
+		v.SubAccountId = selectionInfo.SubAccountId
+	}
+
+	// 按照saleMin和saleMax区间过滤
+	var saleCondition []*http_model.SecTaskInfo
+	if saleNumMin != 0 && saleNumMax != 0 {
+		for _, v := range newSecTaskInfoList {
+			if v.SaleNum <= saleNumMax && v.SaleNum > saleNumMin {
+				saleCondition = append(saleCondition, v)
+			} else {
+				total--
+			}
+		}
+	} else {
+		saleCondition = newSecTaskInfoList
+	}
+
+	// 按照SearchValue过滤
 	var resSecTaskInfoList []*http_model.SecTaskInfo
 	if searchValue != "" {
-		for _, v := range newSecTaskInfoList {
+		for _, v := range saleCondition {
 			if strings.Contains(v.SecTaskId, searchValue) {
 				resSecTaskInfoList = append(resSecTaskInfoList, v)
 			} else if strings.Contains(v.PlatformNickname, searchValue) {
@@ -126,20 +184,29 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 			}
 		}
 	} else {
-		resSecTaskInfoList = newSecTaskInfoList
+		resSecTaskInfoList = saleCondition
 	}
-	fmt.Println("resSecTaskInfoList: ", &resSecTaskInfoList)
+
 	return resSecTaskInfoList, total, nil
 }
 
-func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string) (bool, error) {
+func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string, enterpriseId string, subAccountId int) (bool, error) {
 	db := GetWriteDB(ctx)
 	// 1. 校验
 	var count int64
-	fmt.Println("task_ids: ", taskIds)
+	//fmt.Println("task_ids: ", taskIds)
 	err := db.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND free_stage = 1", taskIds).Count(&count).Error
 
-	fmt.Println("count: ", count)
+	var chooseTalentUserId string
+	var chooseTalentUserType int
+	if subAccountId == 0 {
+		chooseTalentUserType = 1
+		chooseTalentUserId = enterpriseId
+	} else {
+		chooseTalentUserType = 2
+		chooseTalentUserId = conv.MustString(subAccountId)
+	}
+	//fmt.Println("count: ", count)
 	if err != nil {
 		return false, err
 	}
@@ -170,11 +237,13 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string)
 		// 若选品不提供样品,则直接跳转执行阶段,否则进入发货阶段
 		if selection.SampleMode == 3 {
 			updateData := gorm_model.YounggeeSecTaskInfo{
-				TaskStatus:       2,
-				TaskStage:        8,
-				SelectDate:       time.Now(),
-				LogisticsStatus:  3,
-				AssignmentStatus: 1,
+				ChooseTalentUserId:   chooseTalentUserId,
+				ChooseTalentUserType: chooseTalentUserType,
+				TaskStatus:           2,
+				TaskStage:            8,
+				SelectDate:           time.Now(),
+				LogisticsStatus:      3,
+				AssignmentStatus:     1,
 			}
 			err = tx.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND task_stage = 3", taskIds).Updates(updateData).Error
 			if err != nil {
@@ -184,11 +253,13 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string)
 		} else {
 			// 免费领样
 			updateData := gorm_model.YounggeeSecTaskInfo{
-				TaskStatus:      2,
-				TaskStage:       6,
-				SelectDate:      time.Now(),
-				LogisticsStatus: 1,
-				FreeStage:       3,
+				ChooseTalentUserId:   chooseTalentUserId,
+				ChooseTalentUserType: chooseTalentUserType,
+				TaskStatus:           2,
+				TaskStage:            6,
+				SelectDate:           time.Now(),
+				LogisticsStatus:      1,
+				FreeStage:            3,
 			}
 			err = tx.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND free_stage = 1", taskIds).Updates(updateData).Error
 			if err != nil {
@@ -232,8 +303,17 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string)
 	return true, nil
 }
 
-func RefuseSecTaskCoop(ctx context.Context, taskIds []string) (bool, error) {
+func RefuseSecTaskCoop(ctx context.Context, taskIds []string, enterpriseId string, subAccountId int) (bool, error) {
 	db := GetWriteDB(ctx)
+	var chooseTalentUserId string
+	var chooseTalentUserType int
+	if subAccountId == 0 {
+		chooseTalentUserType = 1
+		chooseTalentUserId = enterpriseId
+	} else {
+		chooseTalentUserType = 2
+		chooseTalentUserId = conv.MustString(subAccountId)
+	}
 	// 1. 校验
 	var count int64
 	err := db.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND free_stage = 1", taskIds).Count(&count).Error
@@ -254,11 +334,13 @@ func RefuseSecTaskCoop(ctx context.Context, taskIds []string) (bool, error) {
 	err = db.Transaction(func(tx *gorm.DB) error {
 		// 2. 修改任务状态和任务阶段
 		updateData := gorm_model.YounggeeSecTaskInfo{
-			TaskStatus:     3,
-			TaskStage:      5,
-			CompleteDate:   time.Now(),
-			CompleteStatus: 3,
-			FreeStage:      2,
+			ChooseTalentUserId:   chooseTalentUserId,
+			ChooseTalentUserType: chooseTalentUserType,
+			TaskStatus:           3,
+			TaskStage:            5,
+			CompleteDate:         time.Now(),
+			CompleteStatus:       3,
+			FreeStage:            2,
 		}
 		err = tx.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND free_stage = 1", taskIds).Updates(updateData).Error
 		if err != nil {

+ 6 - 0
db/selection.go

@@ -337,5 +337,11 @@ func UpdateSelectionNum(ctx context.Context, selectionID string) error {
 	if err != nil {
 		return err
 	}
+
+	err = db.Model(gorm_model.YounggeeSelectionInfo{}).Where("selection_id = ?", selectionID).Updates(
+		map[string]interface{}{"after_delivery_num": gorm.Expr("after_delivery_num - ?", 1)}).Error
+	if err != nil {
+		return err
+	}
 	return nil
 }

+ 97 - 14
db/sketch.go

@@ -131,10 +131,23 @@ func GetTaskSketchList(ctx context.Context, projectID string, pageSize, pageNum
 }
 
 // SketchOption 提交意见
-func SketchOption(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string) error {
+func SketchOption(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
 	db := GetReadDB(ctx)
-	fmt.Printf("初稿意见 %d %+v", TaskID, ReviseOpinion)
-	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Sketch db] call RevisieOption error,err:%+v", err)
 		return err
@@ -167,10 +180,23 @@ func SketchOption(ctx context.Context, TaskID string, ReviseOpinion string, oper
 }
 
 // SketchOption 提交意见
-func LocalSketchOption(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string) error {
+func LocalSketchOption(ctx context.Context, TaskID string, ReviseOpinion string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
 	db := GetReadDB(ctx)
-	fmt.Printf("初稿意见 %d %+v", TaskID, ReviseOpinion)
-	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? and is_review = 0", TaskID).Updates(map[string]interface{}{"revise_opinion": ReviseOpinion, "reject_at": time.Now(), "is_review": 1, "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Sketch db] call RevisieOption error,err:%+v", err)
 		return err
@@ -203,9 +229,23 @@ func LocalSketchOption(ctx context.Context, TaskID string, ReviseOpinion string,
 }
 
 // AcceptSketch 同意初稿
-func AcceptSketch(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, isspecial int) error {
+func AcceptSketch(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, isspecial int, Enterpriseid string) error {
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id in ? and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id in ? and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Sketch db] Update YounggeeSketchInfo error,err:%+v", err)
 		return err
@@ -242,6 +282,7 @@ func AcceptSketch(ctx context.Context, TaskIDs []string, operatorid string, oper
 			}
 		}
 	}
+
 	var link_default gorm_model.InfoAutoTask
 	err = db.Model(gorm_model.InfoAutoTask{}).Where("auto_task_id = ?", project.AutoTaskID).Find(&link_default).Error
 	if err != nil {
@@ -263,9 +304,23 @@ func AcceptSketch(ctx context.Context, TaskIDs []string, operatorid string, oper
 }
 
 // AcceptSketch 同意初稿
-func LocalAcceptSketch(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, isspecial int) error {
+func LocalAcceptSketch(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, isspecial int, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id in ? and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id in ? and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 1, "is_review": 1, "agree_at": time.Now(), "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Sketch db] Update YounggeeSketchInfo error,err:%+v", err)
 		return err
@@ -323,9 +378,23 @@ func LocalAcceptSketch(ctx context.Context, TaskIDs []string, operatorid string,
 }
 
 // RejectSketch 不同意初稿
-func RejectSketch(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string) error {
+func RejectSketch(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id in ? and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 0, "is_review": 1, "reject_at": time.Now(), "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id in ? and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 0, "is_review": 1, "reject_at": time.Now(), "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Sketch db] Update YounggeeSketchInfo error,err:%+v", err)
 		return err
@@ -359,9 +428,23 @@ func RejectSketch(ctx context.Context, TaskIDs []string, operatorid string, oper
 }
 
 // RejectSketch 不同意初稿
-func LocalRejectSketch(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string) error {
+func LocalRejectSketch(ctx context.Context, TaskIDs []string, operatorid string, operatetype int, projectid string, Enterpriseid string) error {
+	var opid string
+	var optype int
+	switch operatetype {
+	case 3:
+		{
+			opid = Enterpriseid
+			optype = 1
+		}
+	case 4:
+		{
+			opid = operatorid
+			optype = 2
+		}
+	}
 	db := GetReadDB(ctx)
-	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id in ? and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 0, "is_review": 1, "reject_at": time.Now(), "b_operator": operatorid, "b_operator_type": operatetype}).Error
+	err := db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id in ? and is_review = 0", TaskIDs).Updates(map[string]interface{}{"is_ok": 0, "is_review": 1, "reject_at": time.Now(), "b_operator": opid, "b_operator_type": optype}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Sketch db] Update YounggeeSketchInfo error,err:%+v", err)
 		return err

+ 16 - 0
db/sub_account.go

@@ -54,3 +54,19 @@ func FindSubAccountByPhone(ctx context.Context, phone string) (*gorm_model.Young
 	}
 	return subAccount, nil
 }
+
+// FindSubAccountByEnterpriseId 根据商家ID查找包含的所有子账号信息
+func FindSubAccountByEnterpriseId(ctx context.Context, enterpriseId string, jobId int, accountStatus int) ([]*gorm_model.YounggeeSubAccount, int64, error) {
+	db := GetReadDB(ctx)
+	var total int64
+	var subAccount []*gorm_model.YounggeeSubAccount
+	whereCondition := gorm_model.YounggeeSubAccount{EnterpriseId: enterpriseId, SubAccountType: 1, JobId: jobId, AccountStatus: accountStatus}
+	err := db.Model(gorm_model.YounggeeSubAccount{}).Where(whereCondition).Find(&subAccount).Count(&total).Error
+	if err != nil {
+		return nil, 0, err
+	}
+	if total == 0 {
+		return nil, 0, err
+	}
+	return subAccount, total, nil
+}

+ 384 - 0
db/talent.go

@@ -0,0 +1,384 @@
+package db
+
+import (
+	"context"
+	"github.com/issue9/conv"
+	"gorm.io/gorm"
+	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/model/http_model"
+)
+
+func GetGoodstalentList(ctx context.Context, request http_model.GetGoodsTalentRequest) (*http_model.GetGoodsTalentListData, error) {
+	db := GetReadDB(ctx)
+
+	// 存储达人信息
+	var etcoopinfo []gorm_model.EnterpriseTalentCooperate
+	query := db.Model(&gorm_model.EnterpriseTalentCooperate{}).Where("enterprise_id = ? AND cooperate_type = ?", request.EnterpriseId, 1)
+
+	// 根据平台筛选
+	if request.Platform != nil {
+		query.Where("platform = ?", request.Platform)
+	}
+
+	// 根据达人名称筛选
+	if request.TalentName != "" {
+		query = query.Where("talent_name LIKE ?", "%"+request.TalentName+"%")
+	}
+
+	if request.Productcategory != nil {
+		query = query.Where("FIND_IN_SET(?, product_category) > 0", request.Productcategory)
+	}
+	// 获取相关的销量信息,可以通过join连接platform_kuaishou_user_info表
+	query = query.Joins("JOIN platform_kuaishou_user_info pkui ON pkui.id = enterprise_talent_cooperate.platform_user_id")
+
+	// 根据30天销量区间筛选
+	if request.SalesRange != nil {
+		if *request.SalesRange == "0-30" {
+			query = query.Where("pkui.sale_num_30day BETWEEN ? AND ?", 0, 30)
+		} else if *request.SalesRange == "30-100" {
+			query = query.Where("pkui.sale_num_30day BETWEEN ? AND ?", 30, 100)
+		} else if *request.SalesRange == "100+" {
+			query = query.Where("pkui.sale_num_30day > ?", 100)
+		}
+	}
+
+	// 根据排序字段和排序顺序进行排序
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			sortField := request.SortField[i]
+			sortOrder := request.SortOrder[i]
+			switch sortField {
+			case "fan":
+				if sortOrder == "asc" {
+					query = query.Order("fan asc")
+				} else {
+					query = query.Order("fan desc")
+				}
+
+			case "sale_num_30day":
+				if sortOrder == "asc" {
+					query = query.Order("sale_num_30day asc")
+				} else {
+					query = query.Order("sale_num_30day desc")
+				}
+
+			case "sale_num_total":
+				if sortOrder == "asc" {
+					query = query.Order("sale_num_total asc")
+				} else {
+					query = query.Order("sale_num_total desc")
+				}
+
+			case "cooperate_num":
+				if sortOrder == "asc" {
+					query = query.Order("cooperate_num asc")
+				} else {
+					query = query.Order("cooperate_num desc")
+				}
+			}
+
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("create_at asc")
+	}
+
+	// 分页查询
+	offset := (request.PageNum - 1) * request.PageSize
+	query = query.Limit(request.PageSize).Offset(offset)
+
+	// 执行查询
+	if err := query.Find(&etcoopinfo).Error; err != nil {
+		return nil, err
+	}
+
+	// 生成返回的数据
+	result := &http_model.GetGoodsTalentListData{
+		Total:      conv.MustString(len(etcoopinfo), ""),
+		TalentList: make([]*http_model.GoodsTalentInfo, 0),
+	}
+
+	for _, item := range etcoopinfo {
+
+		var salesInfo gorm_model.PlatformKuaishouUserInfo
+		if err := db.Where("id = ?", item.PlatformUserID).First(&salesInfo).Error; err != nil {
+			return nil, err
+		}
+		fans, _ := conv.Int(salesInfo.Fan)
+		result.TalentList = append(result.TalentList, &http_model.GoodsTalentInfo{
+			TalentId:    item.TalentId,
+			Nickname:    item.TalentName,
+			City:        salesInfo.City,
+			HeadUrl:     salesInfo.HeadUri,
+			FansNum:     fans,
+			ThirtySales: salesInfo.SaleNum30Day,
+			AccSales:    salesInfo.SaleNumTotal,
+			ActualSales: GetActualSales(db, salesInfo.OpenId), //open_id sec_task sale_actual
+			AccCoopTime: item.CooperateNum,
+			FirCoopFrom: "公海",
+		})
+	}
+
+	return result, nil
+}
+
+func GetActualSales(db *gorm.DB, openid string) int {
+	var sectaskinfo []gorm_model.YounggeeSecTaskInfo
+	if err := db.Where("open_id = ?", openid).Find(&sectaskinfo).Error; err != nil {
+		return 0
+	}
+
+	var total int
+	for _, item := range sectaskinfo {
+		total += item.SaleActual
+	}
+	return total
+}
+
+func GetProjecttalentList(ctx context.Context, request http_model.GetProjectTalentRequest) (*http_model.GetProjectTalentListData, error) {
+	db := GetReadDB(ctx)
+	// 存储达人信息
+	var etcoopinfo []gorm_model.EnterpriseTalentCooperate
+	query := db.Model(&gorm_model.EnterpriseTalentCooperate{}).Where("enterprise_id = ? AND cooperate_type = ?", request.EnterpriseId, 2)
+
+	// 根据平台筛选
+	if request.Platform != nil {
+		query.Where("platform = ?", request.Platform)
+	}
+
+	// 根据达人名称筛选
+	if request.TalentName != "" {
+		query = query.Where("talent_name LIKE ?", "%"+request.TalentName+"%")
+	}
+
+	// 获取相关的销量信息,可以通过join连接platform_kuaishou_user_info表
+	query = query.Joins("JOIN platform_kuaishou_user_info pkui ON pkui.id = enterprise_talent_cooperate.platform_user_id")
+
+	// 根据排序字段和排序顺序进行排序
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			sortField := request.SortField[i]
+			sortOrder := request.SortOrder[i]
+			switch sortField {
+			case "fan":
+				if sortOrder == "asc" {
+					query = query.Order("fan asc")
+				} else {
+					query = query.Order("fan desc")
+				}
+
+			case "like_num":
+				if sortOrder == "asc" {
+					query = query.Order("like_num asc")
+				} else {
+					query = query.Order("like_num desc")
+				}
+
+			case "sale_num_total":
+				if sortOrder == "asc" {
+					query = query.Order("sale_num_total asc")
+				} else {
+					query = query.Order("sale_num_total desc")
+				}
+
+			case "cooperate_num":
+				if sortOrder == "asc" {
+					query = query.Order("cooperate_num asc")
+				} else {
+					query = query.Order("cooperate_num desc")
+				}
+			}
+
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("create_at asc")
+	}
+
+	// 分页查询
+	offset := (request.PageNum - 1) * request.PageSize
+	query = query.Limit(request.PageSize).Offset(offset)
+
+	// 执行查询
+	if err := query.Find(&etcoopinfo).Error; err != nil {
+		return nil, err
+	}
+
+	// 生成返回的数据
+	result := &http_model.GetProjectTalentListData{
+		Total:      conv.MustString(len(etcoopinfo), ""),
+		TalentList: make([]*http_model.ProjectTalentInfo, 0),
+	}
+
+	for _, item := range etcoopinfo {
+
+		var salesInfo gorm_model.PlatformKuaishouUserInfo
+		if err := db.Where("id = ?", item.PlatformUserID).First(&salesInfo).Error; err != nil {
+			return nil, err
+		}
+		fans, _ := conv.Int(salesInfo.Fan)
+		var taskinfo gorm_model.YoungeeTaskInfo
+		if err := db.Where(gorm_model.YoungeeTaskInfo{TaskID: item.ProjectTaskID}).First(&taskinfo).Error; err != nil {
+			return nil, err
+		}
+		var projectinfo gorm_model.ProjectInfo
+		err := db.Model(&gorm_model.ProjectInfo{}).Where("project_id = ?", taskinfo.ProjectID).First(&projectinfo).Error
+		if err != nil {
+			return nil, err
+		}
+		s_type, s_name := stype(db, taskinfo.SupplierId, taskinfo.SupplierStatus, projectinfo.ProjectType)
+		result.TalentList = append(result.TalentList, &http_model.ProjectTalentInfo{
+			TalentId:     item.TalentId,
+			Nickname:     item.TalentName,
+			City:         salesInfo.City,
+			HeadUrl:      salesInfo.HeadUri,
+			FansNum:      fans,
+			AccInteract:  0,
+			AccPlay:      0,
+			AvgCollected: 0,
+			AvgComments:  0,
+			AvgLikes:     0,
+			AccCoopTime:  item.CooperateNum,
+			FirCoopFrom:  s_name,
+			Stype:        s_type,
+		})
+	}
+
+	return result, nil
+}
+
+func GetLocallifetalentList(ctx context.Context, request http_model.GetLocallifeTalentRequest) (*http_model.GetLocallifeTalentListData, error) {
+	db := GetReadDB(ctx)
+	// 存储达人信息
+	var etcoopinfo []gorm_model.EnterpriseTalentCooperate
+	query := db.Model(&gorm_model.EnterpriseTalentCooperate{}).Where("enterprise_id = ? AND cooperate_type = ?", request.EnterpriseId, 2)
+
+	// 根据平台筛选
+	if request.Platform != nil {
+		query.Where("platform = ?", request.Platform)
+	}
+
+	// 根据达人名称筛选
+	if request.TalentName != "" {
+		query = query.Where("talent_name LIKE ?", "%"+request.TalentName+"%")
+	}
+
+	// 获取相关的销量信息,可以通过join连接platform_kuaishou_user_info表
+	query = query.Joins("JOIN platform_kuaishou_user_info pkui ON pkui.id = enterprise_talent_cooperate.platform_user_id")
+
+	// 根据排序字段和排序顺序进行排序
+	if len(request.SortField) > 0 && len(request.SortOrder) > 0 && len(request.SortField) == len(request.SortOrder) {
+		for i := 0; i < len(request.SortField); i++ {
+			sortField := request.SortField[i]
+			sortOrder := request.SortOrder[i]
+			switch sortField {
+			case "fan":
+				if sortOrder == "asc" {
+					query = query.Order("fan asc")
+				} else {
+					query = query.Order("fan desc")
+				}
+
+			case "like_num":
+				if sortOrder == "asc" {
+					query = query.Order("like_num asc")
+				} else {
+					query = query.Order("like_num desc")
+				}
+
+			case "sale_num_total":
+				if sortOrder == "asc" {
+					query = query.Order("sale_num_total asc")
+				} else {
+					query = query.Order("sale_num_total desc")
+				}
+
+			case "cooperate_num":
+				if sortOrder == "asc" {
+					query = query.Order("cooperate_num asc")
+				} else {
+					query = query.Order("cooperate_num desc")
+				}
+			}
+
+		}
+	} else {
+		// Default sorting if no valid sort parameters
+		query = query.Order("create_at asc")
+	}
+
+	// 分页查询
+	offset := (request.PageNum - 1) * request.PageSize
+	query = query.Limit(request.PageSize).Offset(offset)
+
+	// 执行查询
+	if err := query.Find(&etcoopinfo).Error; err != nil {
+		return nil, err
+	}
+
+	// 生成返回的数据
+	result := &http_model.GetLocallifeTalentListData{
+		Total:      conv.MustString(len(etcoopinfo), ""),
+		TalentList: make([]*http_model.LocallifeTalentInfo, 0),
+	}
+
+	for _, item := range etcoopinfo {
+
+		var salesInfo gorm_model.PlatformKuaishouUserInfo
+		if err := db.Where("id = ?", item.PlatformUserID).First(&salesInfo).Error; err != nil {
+			return nil, err
+		}
+		fans, _ := conv.Int(salesInfo.Fan)
+		var taskinfo gorm_model.YoungeeLocalTaskInfo
+		if err := db.Where(gorm_model.YoungeeLocalTaskInfo{TaskId: item.LocalTaskID}).First(&taskinfo).Error; err != nil {
+			return nil, err
+		}
+		var projectinfo gorm_model.YounggeeLocalLifeInfo
+		err := db.Model(&gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ?", taskinfo.LocalId).First(&projectinfo).Error
+		if err != nil {
+			return nil, err
+		}
+		s_type, s_name := stype(db, taskinfo.SupplierId, taskinfo.SupplierStatus, projectinfo.LocalType)
+		result.TalentList = append(result.TalentList, &http_model.LocallifeTalentInfo{
+			TalentId:     item.TalentId,
+			Nickname:     item.TalentName,
+			City:         salesInfo.City,
+			HeadUrl:      salesInfo.HeadUri,
+			FansNum:      fans,
+			AccInteract:  0,
+			AccPlay:      0,
+			AvgCollected: 0,
+			AvgComments:  0,
+			AvgLikes:     0,
+			AccCoopTime:  item.CooperateNum,
+			FirCoopFrom:  s_name,
+			SType:        s_type,
+		})
+	}
+
+	return result, nil
+}
+
+func GetTalentNum(ctx context.Context, request http_model.GetTalentNumRequest) (*http_model.GetTalentNumResponse, error) {
+	db := GetReadDB(ctx)
+	var sectalent, projtalent, localtalent int64
+	sectalent, _ = GetTalentnum(db, request, 1)
+	projtalent, _ = GetTalentnum(db, request, 2)
+	localtalent, _ = GetTalentnum(db, request, 3)
+	count := &http_model.GetTalentNumResponse{
+		SecTalentnum:     sectalent,
+		ProjectTalentnum: projtalent,
+		LocalTalentnum:   localtalent,
+	}
+	return count, nil
+}
+
+func GetTalentnum(db *gorm.DB, request http_model.GetTalentNumRequest, cooptype int) (int64, error) {
+	query := db.Model(&gorm_model.EnterpriseTalentCooperate{}).Where("enterprise_id = ? AND cooperate_type = ?", request.EnterpriseId, cooptype)
+	var total int64
+	if err := query.Count(&total).Error; err != nil {
+		return 0, err
+	}
+	return total, nil
+
+}

+ 3 - 3
db/task.go

@@ -382,7 +382,7 @@ func SetSpecialTaskSettleNum(ctx context.Context, TaskIDs []string) error {
 				return err
 			}
 			sprojectinfo.RecruitNum += 1
-			fmt.Println("......", projectinfo.RecruitNum)
+			//fmt.Println("......", projectinfo.RecruitNum)
 			err = db.Model(gorm_model.YounggeeSProjectInfo{}).Where(" s_project_id =?", taskInfo.SprojectId).Updates(sprojectinfo).Error
 			if err != nil {
 				return err
@@ -395,7 +395,7 @@ func SetSpecialTaskSettleNum(ctx context.Context, TaskIDs []string) error {
 			if err != nil {
 				return err
 			}
-			projectinfo.RecruitNum += 1
+			projectinfo.SettleNum += 1
 			err = db.Model(gorm_model.ProjectInfo{}).Where("project_id = ? ", taskInfo.ProjectID).Updates(projectinfo).Error
 			if err != nil {
 				return err
@@ -447,7 +447,7 @@ func SetSpecialLocalTaskSettleNum(ctx context.Context, TaskIDs []string) error {
 			if err != nil {
 				return err
 			}
-			projectinfo.RecruitNum += 1
+			projectinfo.SettleNum += 1
 			err = db.Model(gorm_model.YounggeeLocalLifeInfo{}).Where("local_id = ? ", taskInfo.LocalId).Updates(projectinfo).Error
 			if err != nil {
 				return err

+ 55 - 0
handler/delete_sub_account.go

@@ -0,0 +1,55 @@
+package handler
+
+import (
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+)
+
+func WrapDeleteSubAccountHandler(ctx *gin.Context) {
+	handler := newdeleteSubAccountHandler(ctx)
+	baseRun(handler)
+}
+
+func newdeleteSubAccountHandler(ctx *gin.Context) *DeleteSubAccountHandler {
+	return &DeleteSubAccountHandler{
+		req:  http_model.NewDeleteSubAccountRequest(),
+		resp: http_model.NewDeleteSubAccountResponse(),
+		ctx:  ctx,
+	}
+}
+
+type DeleteSubAccountHandler struct {
+	req  *http_model.DeleteSubAccountRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *DeleteSubAccountHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *DeleteSubAccountHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *DeleteSubAccountHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *DeleteSubAccountHandler) run() {
+	subAccountData := http_model.DeleteSubAccountRequest{}
+	subAccountData = *h.req
+	err := service.SubAccount.DeleteSubAccount(h.ctx, subAccountData)
+	if err != nil {
+		fmt.Println(err)
+		h.resp.Status = 40000
+		h.resp.Message = err.Error()
+		return
+	}
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+	return
+}
+
+func (h *DeleteSubAccountHandler) checkParam() error {
+	return nil
+}

+ 58 - 0
handler/find_all_job.go

@@ -0,0 +1,58 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapFindAllJobHandler(ctx *gin.Context) {
+	handler := newFindAllJobHandler(ctx)
+	baseRun(handler)
+}
+
+func newFindAllJobHandler(ctx *gin.Context) *FindAllJobHandler {
+	return &FindAllJobHandler{
+		req:  http_model.NewFindAllJobRequest(),
+		resp: http_model.NewFindAllJobResponse(),
+		ctx:  ctx,
+	}
+}
+
+type FindAllJobHandler struct {
+	req  *http_model.FindAllJobRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *FindAllJobHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *FindAllJobHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *FindAllJobHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *FindAllJobHandler) run() {
+	data, err := service.Job.FindJobByEnterpriseId(h.ctx, *h.req)
+	if err != nil {
+		logrus.Errorf("[FindSubAccountByEnterpriseId] call SetSession err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		log.Info("FindSubAccountByEnterpriseId fail,req:%+v", h.req)
+		h.resp.Message = err.Error()
+		h.resp.Status = 40000
+		return
+	}
+	h.resp.Data = data
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+}
+
+func (h *FindAllJobHandler) checkParam() error {
+	return nil
+}

+ 58 - 0
handler/find_all_sub_account.go

@@ -0,0 +1,58 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapFindAllSubAccountHandler(ctx *gin.Context) {
+	handler := newFindAllSubAccountHandler(ctx)
+	baseRun(handler)
+}
+
+func newFindAllSubAccountHandler(ctx *gin.Context) *FindAllSubAccountHandler {
+	return &FindAllSubAccountHandler{
+		req:  http_model.NewFindAllSubAccountRequest(),
+		resp: http_model.NewFindAllSubAccountResponse(),
+		ctx:  ctx,
+	}
+}
+
+type FindAllSubAccountHandler struct {
+	req  *http_model.FindAllSubAccountRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *FindAllSubAccountHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *FindAllSubAccountHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *FindAllSubAccountHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *FindAllSubAccountHandler) run() {
+	data, err := service.SubAccount.FindSubAccountByEnterpriseId(h.ctx, *h.req)
+	if err != nil {
+		logrus.Errorf("[FindSubAccountByEnterpriseId] call SetSession err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
+		log.Info("FindSubAccountByEnterpriseId fail,req:%+v", h.req)
+		h.resp.Message = err.Error()
+		h.resp.Status = 40000
+		return
+	}
+	h.resp.Data = data
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+}
+
+func (h *FindAllSubAccountHandler) checkParam() error {
+	return nil
+}

+ 60 - 0
handler/gatlocaltalentstatuscountnum.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapGetLocalTalentstatusCountHandler(ctx *gin.Context) {
+	handler := newGetLocalTalentstatusCountHandler(ctx)
+	baseRun(handler)
+}
+
+type GetLocalTalentstatusCount struct {
+	ctx  *gin.Context
+	req  *http_model.GetLocalTalentstatusCountRequest
+	resp *http_model.CommonResponse
+}
+
+func (c GetLocalTalentstatusCount) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c GetLocalTalentstatusCount) getResponse() interface{} {
+	return c.resp
+}
+
+func (c GetLocalTalentstatusCount) getRequest() interface{} {
+	return c.req
+}
+
+func (c GetLocalTalentstatusCount) run() {
+	data := http_model.GetLocalTalentstatusCountRequest{}
+	data = *c.req
+	res, err := service.LocalTask.GetLocalTalentstatusCount(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetLocalTalentstatusCount] call GetLocalTalentstatusCount err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorParamCheck, "")
+		logrus.Info("GetLocalTalentstatusCount fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功查询达人状态数量"
+	c.resp.Data = res
+	c.resp.Status = consts.ErrorSuccess
+}
+
+func (c GetLocalTalentstatusCount) checkParam() error {
+	return nil
+}
+
+func newGetLocalTalentstatusCountHandler(ctx *gin.Context) *GetLocalTalentstatusCount {
+	return &GetLocalTalentstatusCount{
+		ctx:  ctx,
+		req:  http_model.NewGetLocalTalentstatusCountRequest(),
+		resp: http_model.NewGetLocalTalentstatusCountResponse(),
+	}
+}

+ 5 - 4
handler/get_user_info.go

@@ -1,18 +1,19 @@
 package handler
 
 import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	log "github.com/sirupsen/logrus"
 	"youngee_b_api/consts"
 	"youngee_b_api/model/http_model"
 	"youngee_b_api/service"
 	"youngee_b_api/util"
-
-	"github.com/gin-gonic/gin"
-	"github.com/sirupsen/logrus"
-	log "github.com/sirupsen/logrus"
 )
 
 func WrapGetUserInfoHandler(ctx *gin.Context) {
 	handler := newGetUserInfoHandler(ctx)
+	userToken := ctx.Request.Header.Get("Authorization")
+	handler.req.Token = userToken
 	baseRun(handler)
 }
 

+ 60 - 0
handler/getgoodstalent.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapGetGoodsTalentHandler(ctx *gin.Context) {
+	handler := newGetGoodsTalentHandler(ctx)
+	baseRun(handler)
+}
+
+type GetGoodsTalent struct {
+	ctx  *gin.Context
+	req  *http_model.GetGoodsTalentRequest
+	resp *http_model.CommonResponse
+}
+
+func (c GetGoodsTalent) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c GetGoodsTalent) getResponse() interface{} {
+	return c.resp
+}
+
+func (c GetGoodsTalent) getRequest() interface{} {
+	return c.req
+}
+
+func (c GetGoodsTalent) run() {
+	data := http_model.GetGoodsTalentRequest{}
+	data = *c.req
+	res, err := service.Talent.GetGoodsTalentList(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetGoodsTalentList] call GetGoodsTalentList err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorParamCheck, "")
+		logrus.Info("GetGoodsTalentList fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功查询带货达人"
+	c.resp.Data = res
+	c.resp.Status = consts.ErrorSuccess
+}
+
+func (c GetGoodsTalent) checkParam() error {
+	return nil
+}
+
+func newGetGoodsTalentHandler(ctx *gin.Context) *GetGoodsTalent {
+	return &GetGoodsTalent{
+		ctx:  ctx,
+		req:  http_model.NewGetGoodsTalentRequest(),
+		resp: http_model.NewGetGoodsTalentResponse(),
+	}
+}

+ 60 - 0
handler/getlocallife.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapGetLocallifeTalentHandler(ctx *gin.Context) {
+	handler := newGetLocallifeTalentHandler(ctx)
+	baseRun(handler)
+}
+
+type GetLocallifeTalent struct {
+	ctx  *gin.Context
+	req  *http_model.GetLocallifeTalentRequest
+	resp *http_model.CommonResponse
+}
+
+func (c GetLocallifeTalent) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c GetLocallifeTalent) getResponse() interface{} {
+	return c.resp
+}
+
+func (c GetLocallifeTalent) getRequest() interface{} {
+	return c.req
+}
+
+func (c GetLocallifeTalent) run() {
+	data := http_model.GetLocallifeTalentRequest{}
+	data = *c.req
+	res, err := service.Talent.GetLocallifeTalentList(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetLocallifeTalentList] call GetLocallifeTalentList err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorParamCheck, "")
+		logrus.Info("GetLocallifeTalentList fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功查询本地生活达人"
+	c.resp.Data = res
+	c.resp.Status = consts.ErrorSuccess
+}
+
+func (c GetLocallifeTalent) checkParam() error {
+	return nil
+}
+
+func newGetLocallifeTalentHandler(ctx *gin.Context) *GetLocallifeTalent {
+	return &GetLocallifeTalent{
+		ctx:  ctx,
+		req:  http_model.NewGetLocallifeTalentRequest(),
+		resp: http_model.NewGetLocallifeTalentResponse(),
+	}
+}

+ 60 - 0
handler/getlocalrecruittime.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/service"
+	"youngee_b_api/util"
+)
+
+func WrapGetLocalRecruitTimeHandler(ctx *gin.Context) {
+	handler := newGetLocalRecruitTimeHandler(ctx)
+	baseRun(handler)
+}
+
+type GetLocalRecruitTime struct {
+	ctx  *gin.Context
+	req  *http_model.GetLocalRecruitTimeRequest
+	resp *http_model.CommonResponse
+}
+
+func (c GetLocalRecruitTime) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c GetLocalRecruitTime) getResponse() interface{} {
+	return c.resp
+}
+
+func (c GetLocalRecruitTime) getRequest() interface{} {
+	return c.req
+}
+
+func (c GetLocalRecruitTime) run() {
+	data := http_model.GetLocalRecruitTimeRequest{}
+	data = *c.req
+	res, err := service.LocalTask.GetLocalRecruitTime(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetLocalRecruitTime] call GetLocalRecruitTime err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorParamCheck, "")
+		logrus.Info("GetLocalRecruitTime fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功查询招募截止时间"
+	c.resp.Data = res
+	c.resp.Status = consts.ErrorSuccess
+}
+
+func (c GetLocalRecruitTime) checkParam() error {
+	return nil
+}
+
+func newGetLocalRecruitTimeHandler(ctx *gin.Context) *GetLocalRecruitTime {
+	return &GetLocalRecruitTime{
+		ctx:  ctx,
+		req:  http_model.NewGetLocalRecruitTimeRequest(),
+		resp: http_model.NewGetLocalRecruitTimeResponse(),
+	}
+}

Some files were not shown because too many files changed in this diff