Pārlūkot izejas kodu

Merge branch 'develop' into XxY

# Conflicts:
#	go.mod
#	model/gorm_model/project_task.go
Xingyu Xian 7 mēneši atpakaļ
vecāks
revīzija
70929362b5
100 mainītis faili ar 4882 papildinājumiem un 132 dzēšanām
  1. 149 0
      app/controller/finance_controller.go
  2. 194 0
      app/controller/task_controller.go
  3. 18 0
      app/dao/enterprise_dao.go
  4. 21 0
      app/dao/info_auto_default_dao.go
  5. 21 0
      app/dao/info_auto_task_dao.go
  6. 18 0
      app/dao/platform_kuaishou_user_info_dao.go
  7. 187 2
      app/dao/project_dao.go
  8. 110 0
      app/dao/project_task_info_dao.go
  9. 50 0
      app/dao/recharge_record_dao.go
  10. 85 3
      app/dao/selection_info_dao.go
  11. 9 0
      app/dao/sub_account_dao.go
  12. 18 0
      app/dao/talent_info_dao.go
  13. 9 0
      app/dao/user_dao.go
  14. 28 0
      app/entity/info_auto_default.go
  15. 23 0
      app/entity/info_auto_task.go
  16. 31 0
      app/entity/platform_kuaishou_user_info.go
  17. 1 0
      app/entity/project.go
  18. 60 0
      app/entity/project_task_info.go
  19. 22 0
      app/entity/recharge_record.go
  20. 1 0
      app/entity/selection_info.go
  21. 44 0
      app/entity/selection_task_info.go
  22. 39 0
      app/entity/talent_info.go
  23. 102 0
      app/schedule/auto_task.go
  24. 346 0
      app/service/default_service.go
  25. 1 1
      app/service/product_service.go
  26. 76 3
      app/service/project_service.go
  27. 361 0
      app/service/recharge_service.go
  28. 76 11
      app/service/selection_info_service.go
  29. 40 0
      app/util/uuid.go
  30. 8 0
      app/vo/TalentCancelParam.go
  31. 8 0
      app/vo/balance_param.go
  32. 15 0
      app/vo/default_search_param.go
  33. 16 0
      app/vo/pay_wx_param.go
  34. 12 0
      app/vo/project_draft_param.go
  35. 7 0
      app/vo/re_balance_show.go
  36. 17 0
      app/vo/re_frozen_info.go
  37. 9 10
      app/vo/re_project_detail.go
  38. 2 0
      app/vo/re_project_task_preview.go
  39. 13 0
      app/vo/re_recharge_info.go
  40. 6 0
      app/vo/re_recharge_show.go
  41. 9 10
      app/vo/re_selection_detail.go
  42. 12 14
      app/vo/re_selection_task_preview.go
  43. 16 0
      app/vo/re_talent_default.go
  44. 22 0
      app/vo/re_task_default_public.go
  45. 20 0
      app/vo/re_task_default_target.go
  46. 8 10
      app/vo/re_task_product.go
  47. 8 0
      app/vo/recharge_param.go
  48. 7 0
      app/vo/recharge_transfer_param.go
  49. 11 0
      app/vo/selection_draft_param.go
  50. 2 0
      config/init.go
  51. 21 0
      db/data.go
  52. 21 0
      db/link.go
  53. 344 1
      db/project.go
  54. 607 0
      db/project_task.go
  55. 22 0
      db/sketch.go
  56. 15 1
      db/task.go
  57. 3 25
      go.mod
  58. 2 0
      go.sum
  59. 61 0
      handler/PassproTaskCoop.go
  60. 56 0
      handler/Prelinklist.go
  61. 61 0
      handler/RefuseproTaskCoop.go
  62. 58 0
      handler/endtask.go
  63. 61 0
      handler/executedata.go
  64. 59 0
      handler/gettasklist.go
  65. 56 0
      handler/predatalist.go
  66. 59 0
      handler/presketchlist.go
  67. 61 0
      handler/project_data.go
  68. 1 1
      handler/project_taskList.go
  69. 61 0
      handler/projectdata.go
  70. 60 0
      handler/reject_data.go
  71. 60 0
      handler/reject_link.go
  72. 58 0
      handler/reject_sketch.go
  73. 59 0
      handler/taskdatalist.go
  74. 59 0
      handler/tasklinklist.go
  75. 59 0
      handler/tasksketchlist.go
  76. 8 7
      main.go
  77. 1 0
      model/gorm_model/project_task.go
  78. 27 0
      model/gorm_model/s_project.go
  79. 20 0
      model/gorm_model/supplier.go
  80. 27 24
      model/gorm_model/talent.go
  81. 14 0
      model/http_model/EndTaskRequest.go
  82. 21 0
      model/http_model/PassproTaskCoopRequest.go
  83. 30 0
      model/http_model/PreLinkList.go
  84. 20 0
      model/http_model/RefuseproTaskCoopRequest.go
  85. 4 4
      model/http_model/data_accept.go
  86. 39 0
      model/http_model/executedata.go
  87. 45 0
      model/http_model/gettasklist.go
  88. 0 1
      model/http_model/link_opinion.go
  89. 30 0
      model/http_model/predatalist.go
  90. 30 0
      model/http_model/presketchlist.go
  91. 18 0
      model/http_model/project_data_request.go
  92. 31 0
      model/http_model/projectdatarequest.go
  93. 18 0
      model/http_model/reject_data.go
  94. 18 0
      model/http_model/reject_link.go
  95. 0 1
      model/http_model/sketch_opinion.go
  96. 18 0
      model/http_model/sketch_reject.go
  97. 8 3
      model/http_model/sktech_info.go
  98. 37 0
      model/http_model/taskdatalist.go
  99. 34 0
      model/http_model/tasklinklist.go
  100. 32 0
      model/http_model/tasksketchlist.go

+ 149 - 0
app/controller/finance_controller.go

@@ -0,0 +1,149 @@
+package controller
+
+import (
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/app/service"
+	"youngee_b_api/app/util"
+	"youngee_b_api/app/vo"
+)
+
+type FinanceController struct{}
+
+// 充值管理——对公转账
+func (t FinanceController) TransferToPublic(c *gin.Context) {
+	param := &vo.RechargeTransferParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	rechargeId, err := service.RechargeService{}.TransferToPublic(param)
+	if err != nil {
+		logrus.Errorf("[TransferToPublic] call Show err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["rechargeId"] = *rechargeId
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 获取微信支付CodeUrl
+func (t FinanceController) GetCodeUrl(c *gin.Context) {
+	param := &vo.GetCodeUrlParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	tradeId := util.GetRandomString(32)
+	fmt.Println("amount:", param.Amount)
+	codeUrl, timeExpire, err := service.RechargeService{}.NativeApiServicePrepay(tradeId, param.Amount)
+	if err != nil {
+		logrus.Errorf("[GetCodeUrl] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	reCodeUrl := vo.ReCodeUrl{
+		CodeUrl:    codeUrl,
+		TradeId:    tradeId,
+		TimeExpire: timeExpire.Format("2006-01-02 15:04:05"),
+	}
+	returnSuccess(c, 20000, reCodeUrl)
+}
+
+// 根据交易id查询微信是否扫码付款
+func (t FinanceController) QueryOrderByTradeId(c *gin.Context) {
+	param := &vo.QueryOrderByTradeIdParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	tradeState, err := service.RechargeService{}.QueryOrderByTradeId(param.TradeId)
+	if err != nil {
+		logrus.Errorf("[QueryOrderByTradeId] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["tradeState"] = tradeState
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 余额管理——总金额、可用余额、冻结金额
+func (t FinanceController) ShowBalance(c *gin.Context) {
+	param := &vo.BalanceParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	reBalanceShow, err := service.RechargeService{}.ShowBalance(param)
+	if err != nil {
+		logrus.Errorf("[ShowBalance] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, reBalanceShow)
+}
+
+// 余额管理——冻结记录
+func (t FinanceController) FrozenInfoList(c *gin.Context) {
+	param := &vo.BalanceParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	result, err := service.RechargeService{}.FrozenInfoList(param)
+	if err != nil {
+		logrus.Errorf("[FrozenInfoList] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, result)
+}
+
+// 充值管理——累计充值金额、确认中金额
+func (t FinanceController) ShowRecharge(c *gin.Context) {
+	param := &vo.RechargeParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	reRechargeShow, err := service.RechargeService{}.ShowRecharge(param)
+	if err != nil {
+		logrus.Errorf("[ShowRecharge] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, reRechargeShow)
+}
+
+// 充值管理——充值记录
+func (t FinanceController) RechargeInfoList(c *gin.Context) {
+	param := &vo.RechargeParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	result, err := service.RechargeService{}.RechargeInfoList(param)
+	if err != nil {
+		logrus.Errorf("[RechargeInfoList] call Show err:%+v\n", err)
+		returnError(c, 40000, err.Error())
+		return
+	}
+	returnSuccess(c, 20000, result)
+}

+ 194 - 0
app/controller/task_controller.go

@@ -115,6 +115,26 @@ func (t TaskController) GetSelectionDetail(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
+// 电商带货提交审核
+func (t TaskController) SelectionToReview(c *gin.Context) {
+	data := &vo.SelectionInfoUpdateParam{}
+	err := c.BindJSON(data)
+	if err != nil || data.SelectionID == "" {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	selectionId, err := service.SelectionInfoService{}.SelectionToReview(data)
+	if err != nil {
+		logrus.Errorf("[SelectionToReview] call SelectionToReview err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["selectionId"] = *selectionId
+	returnSuccess(c, 20000, resultMap)
+}
+
 // 电商带货任务列表
 func (t TaskController) SelectionTaskList(c *gin.Context) {
 	param := &vo.SelectionSearchParam{}
@@ -292,6 +312,26 @@ func (t TaskController) GetProjectDetail(c *gin.Context) {
 	returnSuccess(c, 20000, res)
 }
 
+// 种草提交审核
+func (t TaskController) ProjectToReview(c *gin.Context) {
+	data := &vo.ProjectUpdateParam{}
+	err := c.BindJSON(data)
+	if err != nil || data.ProjectID == "" {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	projectId, err := service.ProjectService{}.ProjectToReview(data)
+	if err != nil {
+		logrus.Errorf("[ProjectToReview] call ProjectToReview err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["projectId"] = *projectId
+	returnSuccess(c, 20000, resultMap)
+}
+
 // 公开种草任务列表
 func (t TaskController) ProjectTaskList(c *gin.Context) {
 	param := &vo.ProjectSearchParam{}
@@ -330,3 +370,157 @@ func (t TaskController) ProjectDel(c *gin.Context) {
 	resultMap["projectId"] = *projectId
 	returnSuccess(c, 20000, resultMap)
 }
+
+// 草稿箱——电商带货
+func (t TaskController) GetSelectionDraftList(c *gin.Context) {
+	param := &vo.SelectionDraftParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	res, err := service.SelectionInfoService{}.GetSelectionDraftList(param)
+	if err != nil {
+		logrus.Errorf("[SelectionTaskList] call Show err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+
+	returnSuccess(c, 20000, res)
+}
+
+// 草稿箱——品牌种草
+func (t TaskController) GetProjectDraftList(c *gin.Context) {
+	param := &vo.ProjectDraftParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	res, err := service.ProjectService{}.GetProjectDraftList(param)
+	if err != nil {
+		logrus.Errorf("[SelectionTaskList] call Show err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+
+	returnSuccess(c, 20000, res)
+}
+
+// 违约管理——违约公开任务列表
+func (t TaskController) GetPublicDefaultList(c *gin.Context) {
+	param := &vo.DefaultSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	res, err := service.DefaultService{}.GetPublicDefaultList(param)
+	if err != nil {
+		logrus.Errorf("[GetPublicDefaultList] call Show err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+
+	returnSuccess(c, 20000, res)
+}
+
+// 违约管理——违约定向任务列表
+func (t TaskController) GetTargetDefaultList(c *gin.Context) {
+	param := &vo.DefaultSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	res, err := service.DefaultService{}.GetTargetDefaultList(param)
+	if err != nil {
+		logrus.Errorf("[GetTargetDefaultList] call Show err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+
+	returnSuccess(c, 20000, res)
+}
+
+// 违约管理——公开任务-违约达人列表
+func (t TaskController) GetPublicDefaultTalentList(c *gin.Context) {
+	param := &vo.DefaultSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	res, err := service.DefaultService{}.GetPublicDefaultTalentList(param)
+	if err != nil {
+		logrus.Errorf("[GetPublicDefaultTalentList] call Show err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+
+	returnSuccess(c, 20000, res)
+}
+
+// 违约管理——定向任务-违约达人列表
+func (t TaskController) GetTargetDefaultTalentList(c *gin.Context) {
+	param := &vo.DefaultSearchParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	res, err := service.DefaultService{}.GetTargetDefaultTalentList(param)
+	if err != nil {
+		logrus.Errorf("[GetTargetDefaultTalentList] call Show err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+
+	returnSuccess(c, 20000, res)
+}
+
+// 违约管理——达人解约
+func (t TaskController) CancelTalent(c *gin.Context) {
+	param := &vo.TalentCancelParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	err = service.DefaultService{}.CancelTalent(param)
+	if err != nil {
+		logrus.Errorf("[CancelTalent] call Show err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+	resultMap := make(map[string]string)
+	resultMap["taskId"] = param.TaskId
+	returnSuccess(c, 20000, resultMap)
+}
+
+// 违约管理——达人批量解约
+func (t TaskController) CancelTalentList(c *gin.Context) {
+	param := &vo.TalentCancelParam{}
+	err := c.BindJSON(param)
+	if err != nil {
+		logrus.Errorf("Request bind err:%+v\n", err)
+		returnError(c, 40000, "参数错误")
+		return
+	}
+	err = service.DefaultService{}.CancelTalentList(param)
+	if err != nil {
+		logrus.Errorf("[CancelTalentList] call Show err:%+v\n", err)
+		returnError(c, 40000, "error")
+		return
+	}
+	resultMap := make(map[string][]string)
+	resultMap["taskIds"] = param.TaskIds
+	returnSuccess(c, 20000, resultMap)
+}

+ 18 - 0
app/dao/enterprise_dao.go

@@ -4,6 +4,15 @@ import "youngee_b_api/app/entity"
 
 type EnterpriseDao struct{}
 
+func (d EnterpriseDao) GetEnterpriseInfo(enterpriseId string) (*entity.Enterprise, error) {
+	var enterprise entity.Enterprise
+	err := Db.Debug().Model(&entity.Enterprise{}).Where("enterprise_id = ?", enterpriseId).First(&enterprise).Error
+	if err != nil {
+		return nil, err
+	}
+	return &enterprise, nil
+}
+
 func (d EnterpriseDao) GetEnterprise(enterpriseId string) (*entity.Enterprise, error) {
 	var enterprise entity.Enterprise
 	err := Db.Model(&entity.Enterprise{}).Where("enterprise_id = ?", enterpriseId).Select("business_name, user_id").First(&enterprise).Error
@@ -12,3 +21,12 @@ func (d EnterpriseDao) GetEnterprise(enterpriseId string) (*entity.Enterprise, e
 	}
 	return &enterprise, nil
 }
+
+func (d EnterpriseDao) GetEnterprisePhone(enterpriseId string) (string, error) {
+	var phone string
+	err := Db.Model(&entity.Enterprise{}).Where("enterprise_id = ?", enterpriseId).Select("phone").First(&phone).Error
+	if err != nil {
+		return "", err
+	}
+	return phone, nil
+}

+ 21 - 0
app/dao/info_auto_default_dao.go

@@ -0,0 +1,21 @@
+package dao
+
+import (
+	"youngee_b_api/app/entity"
+)
+
+type InfoAutoDefaultDao struct{}
+
+// 获取指定 enterpriseId 下的最新一条自动任务配置
+func (d InfoAutoDefaultDao) GetAutoDefaultLast(enterpriseId string) entity.InfoAutoDefault {
+	autoDefaultInfo := entity.InfoAutoDefault{}
+	Db.Model(&entity.InfoAutoDefault{}).Where("enterprise_id = ?", enterpriseId).Last(&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
+}

+ 21 - 0
app/dao/info_auto_task_dao.go

@@ -0,0 +1,21 @@
+package dao
+
+import (
+	"youngee_b_api/app/entity"
+)
+
+type InfoAutoTaskDao struct{}
+
+// 获取指定 enterpriseId 下的最新一条自动任务配置
+func (d InfoAutoTaskDao) GetAutoTaskLast(enterpriseId string) entity.InfoAutoTask {
+	autoTaskInfo := entity.InfoAutoTask{}
+	Db.Model(&entity.InfoAutoTask{}).Where("enterprise_id = ?", enterpriseId).Last(&autoTaskInfo)
+	return autoTaskInfo
+}
+
+// 获取指定 autoTaskId 的指定字段值
+func (d InfoAutoTaskDao) GetValueByIdFieldName(autoTaskId int64, fieldName string) entity.InfoAutoTask {
+	autoTaskInfo := entity.InfoAutoTask{}
+	Db.Model(&entity.InfoAutoTask{}).Select(fieldName).Where("auto_task_id = ?", autoTaskId).First(&autoTaskInfo)
+	return autoTaskInfo
+}

+ 18 - 0
app/dao/platform_kuaishou_user_info_dao.go

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

+ 187 - 2
app/dao/project_dao.go

@@ -2,6 +2,7 @@ package dao
 
 import (
 	"errors"
+	"fmt"
 	"gorm.io/gorm"
 	"time"
 	"youngee_b_api/app/entity"
@@ -10,9 +11,10 @@ import (
 
 type ProjectDAO struct{}
 
-func (d ProjectDAO) GetProjectById(ProjectId string) (*entity.Project, error) {
+// 根据projectId获取project信息
+func (d ProjectDAO) GetProjectById(projectId string) (*entity.Project, error) {
 	var Project entity.Project
-	err := Db.Where("project_id = ?", ProjectId).First(&Project).Error
+	err := Db.Where("project_id = ?", projectId).First(&Project).Error
 	if err != nil {
 		if errors.Is(err, gorm.ErrRecordNotFound) {
 			return nil, nil
@@ -23,6 +25,16 @@ func (d ProjectDAO) GetProjectById(ProjectId string) (*entity.Project, error) {
 	return &Project, err
 }
 
+// 根据projectId获取违约状态id
+func (d ProjectDAO) GetAutoDefaultId(projectId string) (*int64, error) {
+	var autoDefaultId int64
+	err := Db.Model(&entity.Project{}).Where("project_id = ?", projectId).Select("auto_default_id").Find(&autoDefaultId).Error
+	if err != nil {
+		return nil, nil
+	}
+	return &autoDefaultId, nil
+}
+
 // 根据enterpriseId查询指定某天的所有带货数据
 func (d ProjectDAO) GetProjectListOfDay(enterpriseId string, date time.Time) ([]entity.Project, error) {
 	var Projects []entity.Project
@@ -123,3 +135,176 @@ func (d ProjectDAO) DeleteProject(projectId string) (*string, error) {
 	}
 	return &projectId, nil
 }
+
+// 获取草稿箱——电商带货任务列表
+func (d ProjectDAO) GetProjectDraftList(param *vo.ProjectDraftParam) ([]vo.ReProjectTaskPreview, int64, error) {
+	var reProjectTaskPreviews []vo.ReProjectTaskPreview
+	var projects []entity.Project
+	var total int64
+	query := Db.Model(&entity.Project{}).Where("project_status = ?", 1)
+	// 动态添加查询条件
+	if param.SubAccountId == 0 {
+		if param.EnterpriseId == "" {
+			return reProjectTaskPreviews, 0, errors.New("enterpriseId is empty")
+		}
+		query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	} else {
+		query = query.Where("sub_account_id = ?", param.SubAccountId)
+	}
+	if param.ProjectType != 0 {
+		query = query.Where("project_type = ?", param.ProjectType)
+	}
+	if param.ProjectPlatform != 0 {
+		query = query.Where("project_platform = ?", param.ProjectPlatform)
+	}
+	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
+	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
+		return nil, 0, err
+	}
+	for _, project := range projects {
+		reProjectTaskPreview := vo.ReProjectTaskPreview{
+			EnterpriseId:    project.EnterpriseID,
+			SubAccountId:    project.SubAccountId,
+			ProjectId:       project.ProjectId,
+			ProjectPlatform: project.ProjectPlatform,
+			ProjectType:     project.ProjectType,
+			CreatedAt:       project.CreatedAt.Format("2006-01-02 15:04:05"),
+			ProductId:       project.ProductID,
+		}
+		reProjectTaskPreviews = append(reProjectTaskPreviews, reProjectTaskPreview)
+	}
+
+	return reProjectTaskPreviews, total, nil
+}
+
+// 获取公开种草中全部指定状态值的项目
+func (d ProjectDAO) GetProjectList(value int64, fieldName string) ([]*entity.Project, error) {
+	var projectInfos []*entity.Project
+	err := Db.Model(entity.Project{}).Where(fmt.Sprintf("project_type = ? AND %s = ? ", fieldName), 1, value).Find(&projectInfos).Error
+	if err != nil {
+		return nil, err
+	}
+	return projectInfos, nil
+}
+
+// 违约管理——违约公开种草任务列表
+func (d ProjectDAO) GetProjectPublicList(param *vo.DefaultSearchParam) ([]vo.ReTaskDefaultPublic, int64, error) {
+	var reTaskDefaultPublics []vo.ReTaskDefaultPublic
+	var projects []entity.Project
+	var total int64
+	query := Db.Model(&entity.Project{}).Where("project_type = ?", 1)
+	// 动态添加查询条件
+	if param.SubAccountId == 0 {
+		if param.EnterpriseId == "" {
+			return reTaskDefaultPublics, 0, errors.New("enterpriseId is empty")
+		}
+		query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	} else {
+		query = query.Where("sub_account_id = ?", param.SubAccountId)
+	}
+	if param.Platform != 0 {
+		query = query.Where("project_platform = ?", param.Platform)
+	}
+	if param.TaskId != "" {
+		query = query.Where("project_id = ?", param.TaskId)
+	}
+	query.Count(&total)
+	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_form, content_type, product_id")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
+		return nil, 0, err
+	}
+	for _, project := range projects {
+		reTaskDefaultPublic := vo.ReTaskDefaultPublic{
+			EnterpriseId: project.EnterpriseID,
+			SubAccountId: project.SubAccountId,
+			TaskId:       project.ProjectId,
+			Platform:     project.ProjectPlatform,
+			TaskForm:     project.ProjectForm,
+			ContentType:  project.ContentType,
+			TaskType:     1,
+			ProductId:    project.ProductID,
+		}
+		reTaskDefaultPublics = append(reTaskDefaultPublics, reTaskDefaultPublic)
+	}
+
+	return reTaskDefaultPublics, total, nil
+}
+
+// 违约管理——违约定向种草任务列表
+func (d ProjectDAO) GetProjectTargetList(param *vo.DefaultSearchParam) ([]vo.ReTaskDefaultTarget, int64, error) {
+	var reTaskDefaultTargets []vo.ReTaskDefaultTarget
+	var projects []entity.Project
+	var total int64
+	query := Db.Model(&entity.Project{}).Where("project_type = ?", 2)
+	// 动态添加查询条件
+	if param.SubAccountId == 0 {
+		if param.EnterpriseId == "" {
+			return reTaskDefaultTargets, 0, errors.New("enterpriseId is empty")
+		}
+		query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	} else {
+		query = query.Where("sub_account_id = ?", param.SubAccountId)
+	}
+	if param.Platform != 0 {
+		query = query.Where("project_platform = ?", param.Platform)
+	}
+	if param.TaskId != "" {
+		query = query.Where("project_id = ?", param.TaskId)
+	}
+	query.Count(&total)
+	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, tools, content_type, product_id")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
+		return nil, 0, err
+	}
+	for _, project := range projects {
+		reTaskDefaultPublic := vo.ReTaskDefaultTarget{
+			EnterpriseId: project.EnterpriseID,
+			SubAccountId: project.SubAccountId,
+			TaskId:       project.ProjectId,
+			Platform:     project.ProjectPlatform,
+			Tools:        project.Tools,
+			ContentType:  project.ContentType,
+			TaskType:     1,
+			ProductId:    project.ProductID,
+		}
+		reTaskDefaultTargets = append(reTaskDefaultTargets, reTaskDefaultPublic)
+	}
+
+	return reTaskDefaultTargets, total, nil
+}
+
+// 获取品牌种草冻结中的任务
+func (d ProjectDAO) GetProjectFrozenList(enterpriseId string) ([]*entity.Project, error) {
+	var projects []*entity.Project
+	query := Db.Debug().Model(entity.Project{})
+	query.Select("project_id, product_id, enterprise_id, sub_account_id, project_platform, payment_amount, pay_at") // 冻结金额:payment_amount
+	err := query.Where(fmt.Sprintf("enterprise_id = ? AND (project_status between 7 and 8) "), enterpriseId).Find(&projects).Error
+	if err != nil {
+		if errors.Is(err, gorm.ErrRecordNotFound) {
+			return projects, nil
+		} else {
+			return nil, err
+		}
+	}
+	return projects, nil
+}
+
+// 获取品牌种草冻结解除的任务
+func (d ProjectDAO) GetProjectFrozenCancelList(enterpriseId string) ([]*entity.Project, error) {
+	var projects []*entity.Project
+	query := Db.Debug().Model(entity.Project{})
+	query.Select("project_id, product_id, enterprise_id, sub_account_id, project_platform, settlement_amount, pay_at") // 解冻金额:settlement_amount
+	err := query.Where(fmt.Sprintf("enterprise_id = ? AND (project_status between 9 and 10) "), enterpriseId).Find(&projects).Error
+	if err != nil {
+		if errors.Is(err, gorm.ErrRecordNotFound) {
+			return projects, nil
+		} else {
+			return nil, err
+		}
+	}
+	return projects, nil
+}

+ 110 - 0
app/dao/project_task_info_dao.go

@@ -0,0 +1,110 @@
+package dao
+
+import (
+	"youngee_b_api/app/entity"
+	"youngee_b_api/app/vo"
+)
+
+type ProjectTaskInfoDao struct{}
+
+// 获取指定违约类型的种草子任务数量
+func (d ProjectTaskInfoDao) CountByDefaultType(projectId string, defaultType int64) int64 {
+	var total int64
+	Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND cur_default_type = ?", projectId, defaultType).Count(&total)
+	return total
+}
+
+// 获取指定任务阶段的种草子任务数量
+func (d ProjectTaskInfoDao) CountByTaskStage(projectId string, taskStage int64) int64 {
+	var total int64
+	Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND task_stage = ?", projectId, taskStage).Count(&total)
+	return total
+}
+
+// 获取未传初稿的种草子任务数据
+func (d ProjectTaskInfoDao) GetListBySketchDefault(param *vo.DefaultSearchParam) ([]entity.ProjectTaskInfo, int64, error) {
+	projectTaskInfos := []entity.ProjectTaskInfo{}
+	var total int64
+	query := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND cur_default_type = ?", param.TaskId, 4)
+	query.Count(&total)
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, sketch_missing_time")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("sketch_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+		return nil, 0, err
+	}
+	return projectTaskInfos, total, nil
+}
+
+// 获取未发作品的种草子任务数据
+func (d ProjectTaskInfoDao) GetListByLinkDefault(param *vo.DefaultSearchParam) ([]entity.ProjectTaskInfo, int64, error) {
+	projectTaskInfos := []entity.ProjectTaskInfo{}
+	var total int64
+	query := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND cur_default_type = ?", param.TaskId, 6)
+	query.Count(&total)
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, link_missing_time")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("link_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+		return nil, 0, err
+	}
+	return projectTaskInfos, total, nil
+}
+
+// 获取未传数据的种草子任务数据
+func (d ProjectTaskInfoDao) GetListByDataDefault(param *vo.DefaultSearchParam) ([]entity.ProjectTaskInfo, int64, error) {
+	projectTaskInfos := []entity.ProjectTaskInfo{}
+	var total int64
+	query := Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND cur_default_type = ?", param.TaskId, 8)
+	query.Count(&total)
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, data_missing_time")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("data_missing_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+		return nil, 0, err
+	}
+	return projectTaskInfos, total, nil
+}
+
+// 获取终止合作的种草子任务数据
+func (d ProjectTaskInfoDao) GetListByTerminateDefault(param *vo.DefaultSearchParam) ([]entity.ProjectTaskInfo, int64, error) {
+	projectTaskInfos := []entity.ProjectTaskInfo{}
+	var total int64
+	query := Db.Debug().Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND task_stage = ?", param.TaskId, 17)
+	query.Count(&total)
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, terminate_time, terminate_reason, terminate_operator_type, terminate_operator")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("terminate_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+		return nil, 0, err
+	}
+	return projectTaskInfos, total, nil
+}
+
+// 获取已解约的种草子任务数据
+func (d ProjectTaskInfoDao) GetListByCancelDefault(param *vo.DefaultSearchParam) ([]entity.ProjectTaskInfo, int64, error) {
+	projectTaskInfos := []entity.ProjectTaskInfo{}
+	var total int64
+	query := Db.Debug().Model(&entity.ProjectTaskInfo{}).Where("project_id = ? AND task_stage = ?", param.TaskId, 16)
+	query.Count(&total)
+	query = query.Select("task_id, talent_id, settle_amount, draft_fee, cancel_time, cancel_reason, cancel_operator_type, cancel_operator")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("cancel_time desc").Offset(offset).Limit(param.PageSize).Find(&projectTaskInfos).Error; err != nil {
+		return nil, 0, err
+	}
+	return projectTaskInfos, total, nil
+}
+
+// 更新字段
+func (d ProjectTaskInfoDao) UpdateField(taskId string, updateData map[string]interface{}) error {
+	err := Db.Model(&entity.ProjectTaskInfo{}).Where("task_id = ?", taskId).Updates(updateData).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// 批量更新字段
+func (d ProjectTaskInfoDao) UpdateFieldBatch(taskIds []string, updateData map[string]interface{}) error {
+	err := Db.Model(&entity.ProjectTaskInfo{}).Where("task_id IN ?", taskIds).Updates(updateData).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 50 - 0
app/dao/recharge_record_dao.go

@@ -0,0 +1,50 @@
+package dao
+
+import (
+	"youngee_b_api/app/entity"
+	"youngee_b_api/app/vo"
+)
+
+type RechargeRecordDao struct{}
+
+func (d RechargeRecordDao) Insert(rechargeRecord *entity.RechargeRecord) error {
+	err := Db.Debug().Model(entity.RechargeRecord{}).Omit("confirm_at").Create(rechargeRecord).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// 获取指定企业id的充值金额、确认中金额
+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
+	if err != nil {
+		return 0, err
+	}
+	return totalAmount, nil
+}
+
+// 获取指定企业id的充值记录
+func (d RechargeRecordDao) RechargeInfoList(param *vo.RechargeParam) ([]entity.RechargeRecord, int64, error) {
+	rechargeRecords := []entity.RechargeRecord{}
+	var total int64
+	query := Db.Debug().Model(&entity.RechargeRecord{}).Where("enterprise_id = ? AND status = ?", param.EnterpriseId, param.RechargeState)
+	query.Count(&total)
+	query = query.Select("recharge_id, recharge_amount, transfer_voucher_url, recharge_method, commit_at, confirm_at, refuse_at, fail_reason")
+	offset := (param.Page - 1) * param.PageSize
+	var err error
+	if param.RechargeState == 1 {
+		err = query.Order("commit_at desc").Offset(offset).Limit(param.PageSize).Find(&rechargeRecords).Error
+	} else if param.RechargeState == 2 {
+		err = query.Order("confirm_at desc").Offset(offset).Limit(param.PageSize).Find(&rechargeRecords).Error
+	} else if param.RechargeState == 3 {
+		err = query.Order("refuse_at desc").Offset(offset).Limit(param.PageSize).Find(&rechargeRecords).Error
+	}
+	if err != nil {
+		return nil, 0, err
+	}
+
+	return rechargeRecords, total, nil
+}

+ 85 - 3
app/dao/selection_info_dao.go

@@ -2,6 +2,7 @@ package dao
 
 import (
 	"errors"
+	"fmt"
 	"gorm.io/gorm"
 	"time"
 	"youngee_b_api/app/entity"
@@ -56,7 +57,7 @@ func (d SelectionInfoDAO) UpdateSelectionInfo(selectionInfo entity.SelectionInfo
 }
 
 // 获取带货任务列表
-func (d ProjectDAO) GetSelectionPreviews(param *vo.SelectionSearchParam) ([]vo.ReSelectionTaskPreview, int64, error) {
+func (d SelectionInfoDAO) GetSelectionPreviews(param *vo.SelectionSearchParam) ([]vo.ReSelectionTaskPreview, int64, error) {
 	var reSelectionTaskPreviews []vo.ReSelectionTaskPreview
 	var selectionInfos []entity.SelectionInfo
 	var total int64
@@ -101,8 +102,8 @@ func (d ProjectDAO) GetSelectionPreviews(param *vo.SelectionSearchParam) ([]vo.R
 			SelectionId:       selectionInfo.SelectionID,
 			SelectionPlatform: selectionInfo.Platform,
 			SelectionStatus:   selectionInfo.SelectionStatus,
-			CreatedAt:         selectionInfo.CreatedAt,
-			TaskDdl:           selectionInfo.TaskDdl,
+			CreatedAt:         selectionInfo.CreatedAt.Format("2006-01-02 15:04:05"),
+			TaskDdl:           selectionInfo.TaskDdl.Format("2006-01-02 15:04:05"),
 			SampleNum:         selectionInfo.SampleNum,
 			EnrollNum:         selectionInfo.EnrollNum,
 			ChooseNum:         selectionInfo.ChooseNum,
@@ -125,3 +126,84 @@ func (d SelectionInfoDAO) DeleteSelection(selectionId string) (*string, error) {
 	}
 	return &selectionId, nil
 }
+
+// 获取草稿箱——电商带货任务列表
+func (d SelectionInfoDAO) GetSelectionDraftList(param *vo.SelectionDraftParam) ([]vo.ReSelectionTaskPreview, int64, error) {
+	var reSelectionTaskPreviews []vo.ReSelectionTaskPreview
+	var selectionInfos []entity.SelectionInfo
+	var total int64
+	query := Db.Model(&entity.SelectionInfo{}).Where("selection_status = ?", 1)
+	// 动态添加查询条件
+	if param.SubAccountId == 0 {
+		if param.EnterpriseId == "" {
+			return reSelectionTaskPreviews, 0, errors.New("enterpriseId is empty")
+		}
+		query = query.Where("enterprise_id = ?", param.EnterpriseId)
+	} else {
+		query = query.Where("sub_account_id = ?", param.SubAccountId)
+	}
+	if param.SelectionPlatform != 0 {
+		query = query.Where("platform = ?", param.SelectionPlatform)
+	}
+	query.Count(&total)
+	query = query.Select("enterprise_id, sub_account_id, selection_id, platform, created_at, product_id")
+	offset := (param.Page - 1) * param.PageSize
+	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&selectionInfos).Error; err != nil {
+		return nil, 0, err
+	}
+	for _, selectionInfo := range selectionInfos {
+		reSelectionTaskPreview := vo.ReSelectionTaskPreview{
+			EnterpriseId:      selectionInfo.EnterpriseID,
+			SubAccountId:      selectionInfo.SubAccountId,
+			SelectionId:       selectionInfo.SelectionID,
+			SelectionPlatform: selectionInfo.Platform,
+			CreatedAt:         selectionInfo.CreatedAt.Format("2006-01-02 15:04:05"),
+			ProductId:         selectionInfo.ProductID,
+		}
+		reSelectionTaskPreviews = append(reSelectionTaskPreviews, reSelectionTaskPreview)
+	}
+
+	return reSelectionTaskPreviews, total, nil
+}
+
+// 获取电商带货悬赏任务中全部指定状态值的项目
+func (d SelectionInfoDAO) GetSelectionInfoList(value int64, fieldName string) ([]*entity.SelectionInfo, error) {
+	var selectionInfos []*entity.SelectionInfo
+	err := Db.Model(entity.SelectionInfo{}).Where(fmt.Sprintf("task_mode = ? AND %s = ? ", fieldName), 1, value).Find(&selectionInfos).Error
+	if err != nil {
+		return nil, err
+	}
+	return selectionInfos, nil
+}
+
+// 获取电商带货冻结中的任务
+func (d SelectionInfoDAO) GetSelectionFrozenList(enterpriseId string) ([]*entity.SelectionInfo, error) {
+	var selectionInfos []*entity.SelectionInfo
+	query := Db.Debug().Model(entity.SelectionInfo{})
+	query.Select("selection_id, product_id, enterprise_id, sub_account_id, platform, estimated_cost, pay_at") // 冻结金额:estimated_cost
+	err := query.Where(fmt.Sprintf("enterprise_id = ? AND (selection_status between 5 and 6) "), enterpriseId).Find(&selectionInfos).Error
+	if err != nil {
+		if errors.Is(err, gorm.ErrRecordNotFound) {
+			return selectionInfos, nil
+		} else {
+			return nil, err
+		}
+	}
+	return selectionInfos, nil
+}
+
+// 获取电商带货冻结解除的任务
+func (d SelectionInfoDAO) GetSelectionFrozenCancelList(enterpriseId string) ([]*entity.SelectionInfo, error) {
+	var selectionInfos []*entity.SelectionInfo
+	query := Db.Debug().Model(entity.SelectionInfo{})
+	query.Select("selection_id, product_id, enterprise_id, sub_account_id, platform, settlement_amount, pay_at") // 解冻金额:settlement_amount
+	err := query.Where(fmt.Sprintf("enterprise_id = ? AND (selection_status between 7 and 8) "), enterpriseId).Find(&selectionInfos).Error
+	if err != nil {
+		if errors.Is(err, gorm.ErrRecordNotFound) {
+			return selectionInfos, nil
+		} else {
+			return nil, err
+		}
+	}
+	return selectionInfos, nil
+}

+ 9 - 0
app/dao/sub_account_dao.go

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

+ 18 - 0
app/dao/talent_info_dao.go

@@ -0,0 +1,18 @@
+package dao
+
+import (
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/app/entity"
+)
+
+type TalentInfoDao struct{}
+
+func (d TalentInfoDao) SelectTalentPhone(talentId string) (*string, error) {
+	var talentInfo *entity.YoungeeTalentInfo
+	err := Db.Model(entity.YoungeeTalentInfo{}).Select("talent_phone_number").Where("id = ?", talentId).Find(&talentInfo).Error
+	if err != nil {
+		logrus.Errorf("[SelectTalentInfo] error query, err:%+v", err)
+		return nil, err
+	}
+	return &talentInfo.TalentPhoneNumber, nil
+}

+ 9 - 0
app/dao/user_dao.go

@@ -12,3 +12,12 @@ func (d UserDao) GetPhoneByUserId(userId int64) (string, error) {
 	}
 	return user.Phone, nil
 }
+
+func (d UserDao) GetNameByUserId(userId int64) (string, error) {
+	var user entity.User
+	err := Db.Model(&entity.User{}).Where("id = ?", userId).Select("username").First(&user).Error
+	if err != nil {
+		return "", err
+	}
+	return user.Username, nil
+}

+ 28 - 0
app/entity/info_auto_default.go

@@ -0,0 +1,28 @@
+package entity
+
+// Code generated by sql2gorm. DO NOT EDIT.
+
+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"`                        // 数据违约 自报价、固定稿费 超时未上传数据
+}
+
+func (m *InfoAutoDefault) TableName() string {
+	return "info_auto_default_handle"
+}

+ 23 - 0
app/entity/info_auto_task.go

@@ -0,0 +1,23 @@
+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"`                       // 选品项目失效自动处理
+}
+
+func (m *InfoAutoTask) TableName() string {
+	return "info_auto_task"
+}

+ 31 - 0
app/entity/platform_kuaishou_user_info.go

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

+ 1 - 0
app/entity/project.go

@@ -21,6 +21,7 @@ type Project struct {
 	EnterpriseID      string    `gorm:"column:enterprise_id"`                  // 所属企业id
 	SubAccountId      int64     `gorm:"column:sub_account_id"`                 // 子账号id
 	ProductID         int64     `gorm:"column:product_id"`                     // 关联商品id
+	ProductCategory   string    `gorm:"column:product_category"`               // 商品类目1--20
 	CreatedAt         time.Time `gorm:"column:created_at"`                     // 创建时间
 	UpdatedAt         time.Time `gorm:"column:updated_at"`                     // 修改时间
 	FeeForm           string    `gorm:"column:fee_form"`                       // 稿费形式列表

+ 60 - 0
app/entity/project_task_info.go

@@ -0,0 +1,60 @@
+package entity
+
+import (
+	"time"
+)
+
+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
+	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
+	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分别代表产品置换、固定稿费、自报价
+	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表
+	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被解约
+	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分别代表待添加、已添加、待修改、已修改、已通过
+	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分别表示待结算、已结算
+	DraftFee               float64   `gorm:"column:draft_fee;NOT NULL"`                   // 达人稿费,达人所见的稿费金额
+	TerminateTime          time.Time `gorm:"column:terminate_time"`
+	TerminateReason        string    `gorm:"column:terminate_reason"`
+	CancelTime             time.Time `gorm:"column:cancel_time"`
+	CancelReason           string    `gorm:"column:cancel_reason"`
+	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"`
+	TerminateOperator      string    `gorm:"column:terminate_operator"`
+	CancelOperatorType     int       `gorm:"column:cancel_operator_type;default:0;NOT NULL"`
+	CancelOperator         string    `gorm:"column:cancel_operator"`
+}
+
+func (m *ProjectTaskInfo) TableName() string {
+	return "youngee_task_info"
+}

+ 22 - 0
app/entity/recharge_record.go

@@ -0,0 +1,22 @@
+package entity
+
+import "time"
+
+type RechargeRecord struct {
+	RechargeID         string    `gorm:"column:recharge_id;primary_key"`       // 充值订单ID
+	EnterpriseID       string    `gorm:"column:enterprise_id;NOT NULL"`        // 企业id
+	RechargeAmount     float64   `gorm:"column:recharge_amount;NOT NULL"`      // 充值金额
+	TransferVoucherUrl string    `gorm:"column:transfer_voucher_url;NOT NULL"` // 转账凭证图片链接
+	Phone              string    `gorm:"column:phone;NOT NULL"`                // 联系方式
+	RechargeMethod     int64     `gorm:"column:recharge_method;NOT NULL"`      // 充值方式:1为对公转账,2为支付宝在线支付,3为微信支付
+	Status             int64     `gorm:"column:status;NOT NULL"`               // 充值状态:0为充值待确认,1为充值已确认
+	InvoiceStatus      int       `gorm:"column:invoice_status;NOT NULL"`       // 开票状态:1为可开票,2为待开票,3为已开票
+	CommitAt           time.Time `gorm:"column:commit_at;NOT NULL"`            // 充值申请提交时间
+	ConfirmAt          time.Time `gorm:"column:confirm_at"`                    // 充值确认时间
+	FailReason         string    `gorm:"column:fail_reason;NOT NULL"`          // 失败原因
+	RefuseAt           time.Time `gorm:"column:refuse_at;NOT NULL"`            // 充值失败时间
+}
+
+func (m *RechargeRecord) TableName() string {
+	return "younggee_recharge_record"
+}

+ 1 - 0
app/entity/selection_info.go

@@ -12,6 +12,7 @@ type SelectionInfo struct {
 	EnterpriseID     string    `gorm:"column:enterprise_id"`            // 所属企业id
 	SubAccountId     int64     `gorm:"column:sub_account_id"`           // 子账号id
 	ProductID        int64     `gorm:"column:product_id"`               // 关联商品id
+	ProductCategory  string    `gorm:"column:product_category"`         // 商品类目1--20
 	SelectionStatus  int64     `gorm:"column:selection_status"`         // 选品项目状态,1-8分别代表创建中、待审核、审核通过、待支付、已支付、执行中、失效、已结案
 	Platform         int64     `gorm:"column:platform"`                 // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 	SampleNum        int64     `gorm:"column:sample_num"`               // 样品数量

+ 44 - 0
app/entity/selection_task_info.go

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

+ 39 - 0
app/entity/talent_info.go

@@ -0,0 +1,39 @@
+// Code generated by sql2gorm. DO NOT EDIT.
+package entity
+
+import (
+	"time"
+)
+
+type YoungeeTalentInfo struct {
+	ID                string    `gorm:"column:id;primary_key"`               // 达人id
+	TalentWxOpenid    string    `gorm:"column:talent_wx_openid;NOT NULL"`    // 达人的微信openid
+	TalentWxNickname  string    `gorm:"column:talent_wx_nickname"`           // 达人的微信昵称
+	TalentWxNumber    string    `gorm:"column:talent_wx_number"`             // 达人微信号
+	Income            int64     `gorm:"column:income;default:0"`             // 收益总数
+	Withdrawing       int64     `gorm:"column:withdrawing;default:0"`        // 提现中金额
+	Canwithdraw       int64     `gorm:"column:canwithdraw;default:0"`        // 可提现金额
+	Withdrawed        int64     `gorm:"column:withdrawed;default:0"`         // 已提现金额
+	TalentGender      int64     `gorm:"column:talent_gender"`                // 性别,0未知 1男 2女
+	TalentPhoneNumber string    `gorm:"column:talent_phone_number"`          // 电话号码
+	TalentAgeBracket  int64     `gorm:"column:talent_age_bracket"`           // 年龄段,取tallent_age_bracket表id
+	TalentNationality int64     `gorm:"column:talent_nationality"`           // 国籍,取tallent_nationality表id
+	VisitStoreRegion  int64     `gorm:"column:visit_store_region"`           // 探店区域,取region_info表中的self_code
+	IsBindInfo        uint      `gorm:"column:is_bind_info;default:0"`       // 是否填写个人资料
+	IsBindLocation    uint      `gorm:"column:is_bind_location;default:0"`   // 是否绑定收货地址
+	IsBindBank        uint      `gorm:"column:is_bind_bank;default:0"`       // 是否绑定银行账户信息
+	InBlacklist       uint      `gorm:"column:in_blacklist;default:0"`       // 是否加入黑名单 0否 1是
+	TaskAll           int64     `gorm:"column:task_all;default:0"`           // 任务总数
+	TaskApply         int64     `gorm:"column:task_apply;default:0"`         // 报名任务数量
+	TaskExecute       int64     `gorm:"column:task_execute;default:0"`       // 执行中任务数量
+	TaskEnd           int64     `gorm:"column:task_end;default:0"`           // 结束任务数量
+	CreateDate        time.Time `gorm:"column:create_date;NOT NULL"`         // 创建时间
+	LastLoginDate     time.Time `gorm:"column:last_login_date;NOT NULL"`     // 最后登录时间
+	ApplyNum          int64     `gorm:"column:apply_num;default:5;NOT NULL"` // 剩余申请次数(每天更新)
+	UserType          int64     `gorm:"column:user_type"`
+	Sex               int64     `gorm:"column:sex"`
+}
+
+func (m *YoungeeTalentInfo) TableName() string {
+	return "youngee_talent_info"
+}

+ 102 - 0
app/schedule/auto_task.go

@@ -0,0 +1,102 @@
+package schedule
+
+import (
+	"fmt"
+	"github.com/caixw/lib.go/conv"
+	"github.com/robfig/cron/v3"
+	"log"
+	"time"
+	"youngee_b_api/app/dao"
+	"youngee_b_api/app/entity"
+)
+
+func AutoTask() error {
+	// 新建一个定时任务对象
+	crontab := cron.New(cron.WithSeconds()) // 精确到秒
+	spec := "0 0 */5 * * ?"                 //cron表达式,每10h一次
+	// "0 0 12 * * ?" 每天中午12点执行
+
+	// 添加定时任务
+	// 定时任务1  品牌种草失效自动处理
+	_, err1 := crontab.AddFunc(spec, AutoInvalidTask)
+	if err1 != nil {
+		return err1
+	}
+	// 定时任务2  电商带货失效自动处理
+	_, err2 := crontab.AddFunc(spec, AutoSelectionInvalidTask)
+	if err2 != nil {
+		return err2
+	}
+
+	// 启动定时器
+	crontab.Start()
+	// 定时任务是另起协程执行的,这里使用 select 简单阻塞.需要根据实际情况进行控制
+	//select {} //阻塞主线程停止
+	return nil
+}
+
+// 定时任务1  品牌种草失效自动处理
+func AutoInvalidTask() {
+	log.Println("AutoInvalidTask running Start, Time :", time.Now())
+	var projectInfos []*entity.Project
+	projectInfos, _ = dao.ProjectDAO{}.GetProjectList(6, "project_status")
+	// 对于所有未支付的品牌种草项目进行处理
+	for _, projectInfo := range projectInfos {
+		projectId := projectInfo.ProjectId
+		autoTaskId := projectInfo.AutoTaskID
+		autoTaskInfo := dao.InfoAutoTaskDao{}.GetValueByIdFieldName(autoTaskId, "invalid")
+		dd, _ := time.ParseDuration(conv.MustString(autoTaskInfo.Invalid, "") + "h")
+		// 失效时间计算:任务截止时间 + 设置的失效自动执行时间
+		timeInvalid := projectInfo.RecruitDdl.Add(dd)
+		if projectInfo.AutoFailAt.IsZero() {
+			dao.Db.Model(&entity.Project{}).Where("project_id = ?", projectId).Updates(&entity.Project{AutoFailAt: timeInvalid})
+		}
+		projectNeedMod := entity.Project{}
+		dao.Db.Where("project_id = ?", projectId).First(&projectNeedMod)
+		fmt.Println(fmt.Sprintf("品牌种草项目 %s 失效自动处理时间为:%s", projectId, projectNeedMod.AutoFailAt))
+		// 如果失效自动处理的时间不为空
+		if !projectNeedMod.AutoFailAt.IsZero() {
+			timeNow := time.Now()
+			// 如果 未失效 && 已经过了失效自动处理的时间
+			if projectNeedMod.ProjectStatus < 8 && projectNeedMod.AutoFailAt.Sub(time.Now()) <= 0 {
+				dao.Db.Model(entity.Project{}).Where("project_id = ?", projectId).Updates(&entity.Project{ProjectStatus: 8, FinishAt: timeInvalid, FailReason: 1})
+				fmt.Println(fmt.Sprintf("已更新品牌种草项目 %s 状态为超时未支付的失效状态", projectId))
+				dao.Db.Model(entity.ProjectTaskInfo{}).Where("project_id = ?", projectId).Updates(entity.ProjectTaskInfo{TaskStage: 3, CompleteStatus: 3, CompleteDate: timeNow})
+			}
+		}
+	}
+	log.Println("AutoInvalidTask running End, Time :", time.Now())
+}
+
+// 定时任务2  电商带货失效自动处理
+func AutoSelectionInvalidTask() {
+	log.Println("AutoSelectionInvalidTask running Start, Time :", time.Now())
+	var selectionInfos []*entity.SelectionInfo
+	selectionInfos, _ = dao.SelectionInfoDAO{}.GetSelectionInfoList(4, "selection_status")
+	// 对于所有未支付的电商带货项目进行处理
+	for _, selectionInfo := range selectionInfos {
+		selectionId := selectionInfo.SelectionID
+		autoTaskId := selectionInfo.AutoTaskID
+		autoTaskInfo := dao.InfoAutoTaskDao{}.GetValueByIdFieldName(autoTaskId, "selection_invalid")
+		dd, _ := time.ParseDuration(conv.MustString(autoTaskInfo.SelectionInvalid, "") + "h")
+		// 失效时间计算:任务截止时间 + 设置的失效自动执行时间
+		timeInvalid := selectionInfo.PassAt.Add(dd)
+		if selectionInfo.AutoFailAt.IsZero() {
+			dao.Db.Model(&entity.SelectionInfo{}).Where("selection_id = ?", selectionId).Updates(&entity.SelectionInfo{AutoFailAt: timeInvalid})
+		}
+		selectionInfoNeedMod := entity.SelectionInfo{}
+		dao.Db.Where("selection_id = ?", selectionId).First(&selectionInfoNeedMod)
+		fmt.Println(fmt.Sprintf("电商带货项目 %s 失效自动处理时间为:%s", selectionId, selectionInfoNeedMod.AutoFailAt))
+		// 如果失效自动处理的时间不为空
+		if !selectionInfoNeedMod.AutoFailAt.IsZero() {
+			timeNow := time.Now()
+			// 如果 未失效 && 已经过了失效自动处理的时间
+			if selectionInfoNeedMod.SelectionStatus < 5 && selectionInfoNeedMod.AutoFailAt.Sub(time.Now()) <= 0 {
+				dao.Db.Model(entity.SelectionInfo{}).Where("selection_id = ?", selectionId).Updates(&entity.SelectionInfo{SelectionStatus: 7, FinishAt: timeInvalid, FailReason: 1})
+				fmt.Println(fmt.Sprintf("已更新电商带货项目 %s 状态为超时未支付的失效状态", selectionId))
+				dao.Db.Model(entity.SelectionInfo{}).Where("selection_id = ?", selectionId).Updates(entity.SelectionTaskInfo{TaskStage: 3, CompleteStatus: 3, CompleteDate: timeNow})
+			}
+		}
+	}
+	log.Println("AutoSelectionInvalidTask running End, Time :", time.Now())
+}

+ 346 - 0
app/service/default_service.go

@@ -0,0 +1,346 @@
+package service
+
+import (
+	"strconv"
+	"time"
+	"youngee_b_api/app/dao"
+	"youngee_b_api/app/entity"
+	"youngee_b_api/app/vo"
+)
+
+type DefaultService struct{}
+
+// 违约管理——违约公开任务列表
+func (s DefaultService) GetPublicDefaultList(param *vo.DefaultSearchParam) (vo.ResultVO, error) {
+	if param.Page <= 0 {
+		param.Page = 1
+	}
+	if param.PageSize <= 0 {
+		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
+			}
+		} 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, 17)
+		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
+}
+
+// 违约管理——违约定向任务列表
+func (s DefaultService) GetTargetDefaultList(param *vo.DefaultSearchParam) (vo.ResultVO, error) {
+	if param.Page <= 0 {
+		param.Page = 1
+	}
+	if param.PageSize <= 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	// 以下代码只考虑了种草
+	reTaskDefaultTargets, total, err := (&dao.ProjectDAO{}).GetProjectTargetList(param)
+	if err != nil {
+		return result, err
+	}
+	for i := range reTaskDefaultTargets {
+		// 获取商品详情字段
+		var creatorName string
+		var productName string
+		var productPrice float64
+		var mainImage string
+		if reTaskDefaultTargets[i].SubAccountId == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reTaskDefaultTargets[i].EnterpriseId)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(reTaskDefaultTargets[i].SubAccountId)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
+		product, err := dao.ProductDAO{}.GetProductByID(reTaskDefaultTargets[i].ProductId)
+		if err == nil && product != nil {
+			productName = product.ProductName
+			productPrice = product.ProductPrice
+		}
+		mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reTaskDefaultTargets[i].ProductId)
+		reTaskDefaultTargets[i].CreatorName = creatorName
+		reTaskDefaultTargets[i].ProductName = productName
+		reTaskDefaultTargets[i].ProductPrice = productPrice
+		reTaskDefaultTargets[i].MainImage = mainImage
+		// 终止合作还是解约字段待确认
+		endCooperationNum := dao.ProjectTaskInfoDao{}.CountByTaskStage(reTaskDefaultTargets[i].TaskId, 17)
+		reTaskDefaultTargets[i].EndCooperationNum = endCooperationNum
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reTaskDefaultTargets,
+	}
+	return result, nil
+}
+
+// 违约管理——公开任务-违约达人列表
+func (s DefaultService) GetPublicDefaultTalentList(param *vo.DefaultSearchParam) (vo.ResultVO, error) {
+	if param.Page <= 0 {
+		param.Page = 1
+	}
+	if param.PageSize <= 0 {
+		param.PageSize = 10
+	}
+	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 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)
+	}
+	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
+}
+
+// 违约管理——定向任务-违约达人列表
+func (s DefaultService) GetTargetDefaultTalentList(param *vo.DefaultSearchParam) (vo.ResultVO, error) {
+	if param.Page <= 0 {
+		param.Page = 1
+	}
+	if param.PageSize <= 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	var reTalentDefaults []*vo.ReTalentDefault
+	// 以下代码只考虑了种草
+	var projectTaskInfos []entity.ProjectTaskInfo
+	var total int64
+	var err error
+	defaultType := param.DefaultType
+	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,
+			DraftFee:    projectTaskInfo.DraftFee,
+			OpenId:      platformKuaishouUserInfo.OpenId,
+			NickName:    platformKuaishouUserInfo.NickName,
+			HeadUri:     platformKuaishouUserInfo.HeadUri,
+			City:        "-",
+		}
+		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
+			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)
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reTalentDefaults,
+	}
+	return result, nil
+}
+
+// 违约管理——达人解约
+func (s DefaultService) CancelTalent(param *vo.TalentCancelParam) error {
+	updateData := map[string]interface{}{
+		"task_stage":    16,
+		"settle_amount": param.RealPayment,
+		"real_payment":  param.RealPayment,
+		"cancel_reason": param.CancelReason,
+		"cancel_time":   time.Now(),
+	}
+	err := dao.ProjectTaskInfoDao{}.UpdateField(param.TaskId, updateData)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// 违约管理——达人批量解约
+func (s DefaultService) CancelTalentList(param *vo.TalentCancelParam) error {
+	updateData := map[string]interface{}{
+		"task_stage":    16,
+		"settle_amount": param.RealPayment,
+		"real_payment":  param.RealPayment,
+		"cancel_reason": param.CancelReason,
+		"cancel_time":   time.Now(),
+	}
+	err := dao.ProjectTaskInfoDao{}.UpdateFieldBatch(param.TaskIds, updateData)
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 1 - 1
app/service/product_service.go

@@ -47,7 +47,7 @@ func (p ProductService) GetTaskProductsByUserId(param vo.GetAllProductParam) (vo
 			ProductCategory: product.ProductCategory,
 			ProductPrice:    product.ProductPrice,
 			ProductDetail:   product.ProductDetail,
-			CreatedAt:       product.CreatedAt,
+			CreatedAt:       product.CreatedAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:        photoUrl,
 		}
 		reProducts = append(reProducts, reProduct)

+ 76 - 3
app/service/project_service.go

@@ -37,12 +37,18 @@ func (s ProjectService) CreateProject(param *vo.ProjectCreateParam) (*string, er
 	} else {
 		operatorType = 2
 	}
+	// 获取定时任务配置id
+	infoAutoTask := entity.InfoAutoTask{}
+	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(param.EnterpriseId)
+	infoAutoDefault := entity.InfoAutoDefault{}
+	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(param.EnterpriseId)
 	t := time.Now()
 	newProject := entity.Project{
 		ProjectStatus:    1,
 		ProjectType:      param.ProjectType,
 		ProjectId:        projectId,
 		ProductID:        param.ProductId,
+		ProductCategory:  product.ProductCategory,
 		EnterpriseID:     param.EnterpriseId,
 		SubAccountId:     param.SubAccountId,
 		ProjectPlatform:  param.Platform,
@@ -50,6 +56,8 @@ func (s ProjectService) CreateProject(param *vo.ProjectCreateParam) (*string, er
 		ProductSnap:      string(productInfoToJson),
 		ProductPhotoSnap: string(productPhotosToJson),
 		CreatedAt:        t,
+		AutoTaskID:       infoAutoTask.AutoTaskID,
+		AutoDefaultID:    infoAutoDefault.AutoDefaultID,
 	}
 	if param.ProjectType == 1 {
 		newProject.ServiceChargeRate = param.ServiceChargeRate
@@ -379,7 +387,7 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 	reProjectDetail.ProjectId = projectId
 	reProjectDetail.ProjectStatus = project.ProjectStatus
 	reProjectDetail.ProjectPlatform = project.ProjectPlatform
-	reProjectDetail.CreatedAt = project.CreatedAt
+	reProjectDetail.CreatedAt = project.CreatedAt.Format("2006-01-02 15:04:05")
 	reProjectDetail.EstimatedCost = project.EstimatedCost
 	reProjectDetail.ServiceChargeRate = project.ServiceChargeRate
 	var creatorName, phone string
@@ -413,14 +421,14 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 			ProductCategory: product.ProductCategory,
 			ProductPrice:    product.ProductPrice,
 			ProductDetail:   product.ProductDetail,
-			CreatedAt:       product.CreatedAt,
+			CreatedAt:       product.CreatedAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:        photoUrl,
 		}
 	}
 	reProjectDetail.ProductInfo = &reProduct
 	// 招募要求
 	reProjectDetail.TalentType = project.TalentType
-	reProjectDetail.RecruitDdl = project.RecruitDdl
+	reProjectDetail.RecruitDdl = project.RecruitDdl.Format("2006-01-02 15:04:05")
 	reProjectDetail.ProjectForm = project.ProjectForm
 	reProjectDetail.ContentType = project.ContentType
 	reProjectDetail.ProjectDetail = project.ProjectDetail
@@ -464,6 +472,22 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 	return &reProjectDetail, nil
 }
 
+// 种草提交审核
+func (s ProjectService) ProjectToReview(projectUpdateParam *vo.ProjectUpdateParam) (*string, error) {
+	projectId := projectUpdateParam.ProjectID
+	t := time.Now()
+	updateProject := entity.Project{
+		ProjectId:     projectId,
+		ProjectStatus: 2,
+		UpdatedAt:     t,
+	}
+	err := dao.ProjectDAO{}.UpdateProject(updateProject)
+	if err != nil {
+		return nil, err
+	}
+	return &projectId, nil
+}
+
 // 公开种草任务列表
 func (s ProjectService) GetProjectTaskList(param *vo.ProjectSearchParam) (vo.ResultVO, error) {
 	if param.Page == 0 {
@@ -522,3 +546,52 @@ func (s ProjectService) DeleteProject(projectId string) (*string, error) {
 	}
 	return res, nil
 }
+
+// 草稿箱——品牌种草
+func (s ProjectService) GetProjectDraftList(param *vo.ProjectDraftParam) (vo.ResultVO, error) {
+	if param.Page == 0 {
+		param.Page = 1
+	}
+	if param.PageSize == 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	reSelectionTaskPreviews, total, err := (&dao.ProjectDAO{}).GetProjectDraftList(param)
+	if err != nil {
+		return result, err
+	}
+	for i := range reSelectionTaskPreviews {
+		var creatorName string
+		var productName string
+		var productPrice float64
+		var mainImage string
+		if reSelectionTaskPreviews[i].SubAccountId == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reSelectionTaskPreviews[i].EnterpriseId)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(reSelectionTaskPreviews[i].SubAccountId)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
+		product, err := dao.ProductDAO{}.GetProductByID(reSelectionTaskPreviews[i].ProductId)
+		if err == nil && product != nil {
+			productName = product.ProductName
+			productPrice = product.ProductPrice
+		}
+		mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reSelectionTaskPreviews[i].ProductId)
+		reSelectionTaskPreviews[i].CreatorName = creatorName
+		reSelectionTaskPreviews[i].ProductName = productName
+		reSelectionTaskPreviews[i].ProductPrice = productPrice
+		reSelectionTaskPreviews[i].MainImage = mainImage
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reSelectionTaskPreviews,
+	}
+	return result, nil
+}

+ 361 - 0
app/service/recharge_service.go

@@ -0,0 +1,361 @@
+package service
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	log "github.com/sirupsen/logrus"
+	"github.com/wechatpay-apiv3/wechatpay-go/core"
+	"github.com/wechatpay-apiv3/wechatpay-go/core/option"
+	"github.com/wechatpay-apiv3/wechatpay-go/services/payments/native"
+	"github.com/wechatpay-apiv3/wechatpay-go/utils"
+	"gorm.io/gorm"
+	"time"
+	"youngee_b_api/app/dao"
+	"youngee_b_api/app/entity"
+	"youngee_b_api/app/util"
+	"youngee_b_api/app/vo"
+)
+
+type RechargeService struct{}
+
+// 充值管理——对公转账
+func (s RechargeService) TransferToPublic(param *vo.RechargeTransferParam) (*string, error) {
+	var rechargeId string
+	var phone string
+	//if param.SubAccountId == 0 {
+	//	rechargeId = util.MakeRechargeId(param.EnterpriseId)
+	//	phone, _ = dao.EnterpriseDao{}.GetEnterprisePhone(param.EnterpriseId)
+	//} else {
+	//	rechargeId = util.MakeRechargeId(strconv.FormatInt(param.SubAccountId, 10))
+	//	phone, _ = dao.SubAccountDao{}.GetSubAccountPhone(param.SubAccountId)
+	//}
+	rechargeId = util.MakeRechargeId(param.EnterpriseId)
+	phone, _ = dao.EnterpriseDao{}.GetEnterprisePhone(param.EnterpriseId)
+	rechargeRecord := entity.RechargeRecord{
+		RechargeID:         rechargeId,
+		EnterpriseID:       param.EnterpriseId,
+		RechargeAmount:     param.Amount,
+		TransferVoucherUrl: param.TransferVoucherUrl,
+		Phone:              phone,
+		RechargeMethod:     1,
+		Status:             1,
+		InvoiceStatus:      1,
+		CommitAt:           time.Now(),
+	}
+	err := dao.RechargeRecordDao{}.Insert(&rechargeRecord)
+	if err != nil {
+		return nil, err
+	}
+	return &rechargeId, nil
+}
+
+// 获取微信支付CodeUrl
+func (s RechargeService) NativeApiServicePrepay(tradeId string, amount int64) (string, *time.Time, error) {
+	var (
+		mchID                      string = "1615933939"                               // 商户号
+		mchCertificateSerialNumber string = "33DDFEC51BF5412F663B9B56510FD567B625FC68" // 商户证书序列号
+		mchAPIv3Key                string = "V10987654321younggee12345678910V"         // 商户APIv3密钥,用于加密和解密平台证书
+	)
+	fmt.Println("充值的金额为:", amount)
+
+	// 使用 utils 提供的函数从本地文件中加载商户私钥
+	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("./apiclient_key.pem") // 商户私钥,用于生成请求的签名
+	if err != nil {
+		log.Print("load merchant private key error")
+	}
+
+	ctx := context.Background()
+	// 使用商户私钥等初始化 微信支付client,并使它具有自动定时获取微信支付平台证书的能力
+	opts := []core.ClientOption{
+		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
+	}
+	client, err := core.NewClient(ctx, opts...)
+	if err != nil {
+		log.Printf("new wechat pay client err: %s", err)
+	}
+
+	// 采用 Native 支付方式
+	svc := native.NativeApiService{Client: client}
+	// 发送请求
+	timeExpire := time.Now().Add(10 * time.Minute)
+	resp, result, err := svc.Prepay(ctx,
+		native.PrepayRequest{
+			Appid:         core.String("wxac396a3be7a16844"),
+			Mchid:         core.String("1615933939"),
+			Description:   core.String("样叽微信支付充值"),
+			OutTradeNo:    core.String(tradeId),
+			TimeExpire:    core.Time(timeExpire),
+			Attach:        core.String("微信支付充值"),
+			NotifyUrl:     core.String("https://www.weixin.qq.com/wxpay/pay.php"),
+			SupportFapiao: core.Bool(true),
+			Amount: &native.Amount{
+				Currency: core.String("CNY"),
+				Total:    core.Int64(amount),
+			},
+		},
+	)
+
+	if err != nil {
+		// 处理错误
+		log.Printf("call Prepay err:%s", err)
+		return "", nil, err
+	} else {
+		// 处理返回结果
+		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
+		log.Println("codeUrl:", *resp.CodeUrl)
+	}
+	return *resp.CodeUrl, &timeExpire, nil
+}
+
+// 根据交易id查询微信是否扫码付款
+// https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_2.shtml
+func (s RechargeService) QueryOrderByTradeId(tradeId string) (tradeState string, err error) {
+	var (
+		mchID                      string = "1615933939"                               // 商户号
+		mchCertificateSerialNumber string = "33DDFEC51BF5412F663B9B56510FD567B625FC68" // 商户证书序列号
+		mchAPIv3Key                string = "V10987654321younggee12345678910V"         // 商户APIv3密钥
+	)
+
+	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
+	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("./apiclient_key.pem")
+	if err != nil {
+		log.Print("load merchant private key error")
+	}
+
+	ctx := context.Background()
+	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
+	opts := []core.ClientOption{
+		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
+	}
+	client, err := core.NewClient(ctx, opts...)
+	if err != nil {
+		log.Printf("new wechat pay client err: %s", err)
+	}
+
+	svc := native.NativeApiService{Client: client}
+	resp, result, err := svc.QueryOrderByOutTradeNo(ctx,
+		native.QueryOrderByOutTradeNoRequest{
+			OutTradeNo: core.String(tradeId),
+			Mchid:      core.String("1615933939"),
+		},
+	)
+	fmt.Printf("支付 %+v\n", resp)
+	if err != nil {
+		// 处理错误
+		log.Printf("call QueryOrderByOutTradeNo err: %s", err)
+		return "", err
+	} else {
+		// 处理返回结果
+		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
+	}
+	fmt.Printf("支付状态 %+v\n", *resp.TradeState)
+	return *resp.TradeState, nil
+}
+
+// 余额管理——总金额、可用余额、冻结金额
+func (s RechargeService) ShowBalance(param *vo.BalanceParam) (*vo.ReBalanceShow, error) {
+	reBalanceShow := new(vo.ReBalanceShow)
+	enterprise, err := dao.EnterpriseDao{}.GetEnterpriseInfo(param.EnterpriseId)
+	if err != nil {
+		if errors.Is(err, gorm.ErrRecordNotFound) {
+			return reBalanceShow, nil
+		} else {
+			return nil, err
+		}
+	}
+	reBalanceShow.TotalBalance = enterprise.Balance
+	reBalanceShow.AvailBalance = enterprise.AvailableBalance
+	reBalanceShow.FrozenBalance = enterprise.FrozenBalance
+	return reBalanceShow, nil
+}
+
+// 余额管理——冻结记录
+func (s RechargeService) FrozenInfoList(param *vo.BalanceParam) (vo.ResultVO, error) {
+	if param.Page <= 0 {
+		param.Page = 1
+	}
+	if param.PageSize <= 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	var reBalanceShows []*vo.ReFrozenInfo
+	var selectionInfos []*entity.SelectionInfo
+	var projects []*entity.Project
+	if param.FrozenState == 1 {
+		// 电商带货
+		selectionInfos, _ = dao.SelectionInfoDAO{}.GetSelectionFrozenList(param.EnterpriseId)
+		// 品牌种草
+		projects, _ = dao.ProjectDAO{}.GetProjectFrozenList(param.EnterpriseId)
+		// 本地生活
+
+	} else {
+		// 电商带货
+		selectionInfos, _ = dao.SelectionInfoDAO{}.GetSelectionFrozenCancelList(param.EnterpriseId)
+		// 品牌种草
+		projects, _ = dao.ProjectDAO{}.GetProjectFrozenCancelList(param.EnterpriseId)
+		// 本地生活
+
+	}
+	// 汇总结果
+	for _, selection := range selectionInfos {
+		// 获取商品详情字段
+		var creatorName string
+		var productName string
+		var productPrice float64
+		var mainImage string
+		if selection.SubAccountId == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(selection.EnterpriseID)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(selection.SubAccountId)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
+		product, err := dao.ProductDAO{}.GetProductByID(selection.ProductID)
+		if err == nil && product != nil {
+			productName = product.ProductName
+			productPrice = product.ProductPrice
+		}
+		mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(selection.ProductID)
+		// 电商带货汇总
+		reBalanceShow := &vo.ReFrozenInfo{
+			ProductId:     selection.ProductID,
+			MainImage:     mainImage,
+			ProductName:   productName,
+			ProductPrice:  productPrice,
+			Platform:      selection.Platform,
+			CreatorName:   creatorName,
+			TaskType:      "电商带货",
+			FrozenBalance: selection.EstimatedCost,
+			FrozenTime:    selection.PayAt.Format("2006-01-02 15:04:05"),
+			EnterpriseId:  selection.EnterpriseID,
+			SubAccountId:  selection.SubAccountId,
+			TaskId:        selection.SelectionID,
+		}
+		if param.FrozenState == 2 {
+			reBalanceShow.FrozenCancelBalance = selection.SettlementAmount
+		}
+		reBalanceShows = append(reBalanceShows, reBalanceShow)
+	}
+	for _, project := range projects {
+		// 获取商品详情字段
+		var creatorName string
+		var productName string
+		var productPrice float64
+		var mainImage string
+		if project.SubAccountId == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(project.EnterpriseID)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(project.SubAccountId)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
+		product, err := dao.ProductDAO{}.GetProductByID(project.ProductID)
+		if err == nil && product != nil {
+			productName = product.ProductName
+			productPrice = product.ProductPrice
+		}
+		mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(project.ProductID)
+		// 电商带货汇总
+		reBalanceShow := &vo.ReFrozenInfo{
+			ProductId:     project.ProductID,
+			MainImage:     mainImage,
+			ProductName:   productName,
+			ProductPrice:  productPrice,
+			Platform:      project.ProjectPlatform,
+			CreatorName:   creatorName,
+			TaskType:      "品牌种草",
+			FrozenBalance: project.PaymentAmount,
+			FrozenTime:    project.PayAt.Format("2006-01-02 15:04:05"),
+			EnterpriseId:  project.EnterpriseID,
+			SubAccountId:  project.SubAccountId,
+			TaskId:        project.ProjectId,
+		}
+		if param.FrozenState == 2 {
+			reBalanceShow.FrozenCancelBalance = project.SettlementAmount
+		}
+		reBalanceShows = append(reBalanceShows, reBalanceShow)
+	}
+
+	startIndex := (param.Page - 1) * param.PageSize
+	endIndex := startIndex + param.PageSize
+
+	// 分页
+	if startIndex >= len(reBalanceShows) {
+		return result, nil
+	}
+	if endIndex > len(reBalanceShows) {
+		endIndex = len(reBalanceShows)
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    int64(len(reBalanceShows)),
+		Data:     reBalanceShows[startIndex:endIndex],
+	}
+	return result, nil
+}
+
+// 充值管理——累计充值金额、确认中金额
+func (s RechargeService) ShowRecharge(param *vo.RechargeParam) (*vo.ReRechargeShow, error) {
+	reRechargeShow := new(vo.ReRechargeShow)
+	confirmingRecharge, _ := dao.RechargeRecordDao{}.GetRechargeAmount(param.EnterpriseId, 1)
+	totalRecharge, _ := dao.RechargeRecordDao{}.GetRechargeAmount(param.EnterpriseId, 2)
+	reRechargeShow.ConfirmingRecharge = confirmingRecharge
+	reRechargeShow.TotalRecharge = totalRecharge
+	return reRechargeShow, nil
+}
+
+// 充值管理——充值记录
+func (s RechargeService) RechargeInfoList(param *vo.RechargeParam) (vo.ResultVO, error) {
+	if param.Page <= 0 {
+		param.Page = 1
+	}
+	if param.PageSize <= 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	var reRechargeInfos []*vo.ReRechargeInfo
+	rechargeRecords, total, err := dao.RechargeRecordDao{}.RechargeInfoList(param)
+	if err != nil {
+		return result, err
+	}
+	for _, rechargeRecord := range rechargeRecords {
+		var creatorName string
+		enterprise, err := dao.EnterpriseDao{}.GetEnterprise(param.EnterpriseId)
+		if err == nil && enterprise != nil {
+			creatorName = enterprise.BusinessName
+		}
+		reRechargeInfo := &vo.ReRechargeInfo{
+			RechargeId:         rechargeRecord.RechargeID,
+			CreatorName:        creatorName,
+			RechargeAmount:     rechargeRecord.RechargeAmount,
+			RechargeMethod:     rechargeRecord.RechargeMethod,
+			TransferVoucherUrl: rechargeRecord.TransferVoucherUrl,
+		}
+		if param.RechargeState == 1 {
+			reRechargeInfo.CommitAt = rechargeRecord.CommitAt.Format("2006-01-02 15:04:05")
+		} else if param.RechargeState == 2 {
+			reRechargeInfo.ConfirmAt = rechargeRecord.ConfirmAt.Format("2006-01-02 15:04:05")
+		} else if param.RechargeState == 3 {
+			reRechargeInfo.RefuseAt = rechargeRecord.RefuseAt.Format("2006-01-02 15:04:05")
+			reRechargeInfo.FailReason = rechargeRecord.FailReason
+		}
+		reRechargeInfos = append(reRechargeInfos, reRechargeInfo)
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reRechargeInfos,
+	}
+	return result, nil
+}

+ 76 - 11
app/service/selection_info_service.go

@@ -3,7 +3,6 @@ package service
 import (
 	"encoding/json"
 	"errors"
-	"github.com/caixw/lib.go/conv"
 	"github.com/sirupsen/logrus"
 	"reflect"
 	"time"
@@ -56,7 +55,7 @@ func (s SelectionInfoService) CreateSelectionInfo(param *vo.SelectionInfoCreateP
 	// a) 生成选品id
 	selectionId := util.GetSelectionID()
 	// b) 查找关联商品信息
-	product, err := dao.ProductDAO{}.GetProductByID(conv.MustInt64(param.ProductId, 0))
+	product, err := dao.ProductDAO{}.GetProductByID(param.ProductId)
 	if err != nil {
 		return nil, err
 	}
@@ -69,11 +68,15 @@ func (s SelectionInfoService) CreateSelectionInfo(param *vo.SelectionInfoCreateP
 	// c) 选品名称
 	//selectionName := product.ProductName
 	// d)创建选品
+	// 获取定时任务配置
+	infoAutoTask := entity.InfoAutoTask{}
+	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(param.EnterpriseId)
 	t := time.Now()
 	newSelection := entity.SelectionInfo{
 		SelectionStatus:  1,
 		SelectionID:      selectionId,
 		ProductID:        param.ProductId,
+		ProductCategory:  product.ProductCategory,
 		EnterpriseID:     param.EnterpriseId,
 		SubAccountId:     param.SubAccountId,
 		Platform:         param.Platform,
@@ -81,10 +84,7 @@ func (s SelectionInfoService) CreateSelectionInfo(param *vo.SelectionInfoCreateP
 		ProductPhotoSnap: string(productPhotosToJson),
 		CreatedAt:        t,
 		UpdatedAt:        t,
-		CommissionRate:   0,
-		EstimatedCost:    0,
-		TaskReward:       0,
-		SettlementAmount: 0,
+		AutoTaskID:       infoAutoTask.AutoTaskID,
 	}
 	err = dao.SelectionInfoDAO{}.CreateSelectionInfo(newSelection)
 	if err != nil {
@@ -304,8 +304,8 @@ func (s SelectionInfoService) GetSelectionDetail(selectionId string) (*vo.ReSele
 	reSelectionDetail.SelectionId = selectionId
 	reSelectionDetail.SelectionStatus = selection.SelectionStatus
 	reSelectionDetail.SelectionPlatform = selection.Platform
-	reSelectionDetail.CreatedAt = selection.CreatedAt
-	reSelectionDetail.SubmitAt = selection.SubmitAt
+	reSelectionDetail.CreatedAt = selection.CreatedAt.Format("2006-01-02 15:04:05")
+	reSelectionDetail.SubmitAt = selection.SubmitAt.Format("2006-01-02 15:04:05")
 	var creatorName, phone string
 	var rewardSum float64
 	if selection.SubAccountId == 0 {
@@ -338,13 +338,13 @@ func (s SelectionInfoService) GetSelectionDetail(selectionId string) (*vo.ReSele
 			ProductCategory: product.ProductCategory,
 			ProductPrice:    product.ProductPrice,
 			ProductDetail:   product.ProductDetail,
-			CreatedAt:       product.CreatedAt,
+			CreatedAt:       product.CreatedAt.Format("2006-01-02 15:04:05"),
 			PhotoUrl:        photoUrl,
 		}
 	}
 	reSelectionDetail.ProductInfo = &reProduct
 	// 样品奖励
-	reSelectionDetail.TaskDdl = selection.TaskDdl
+	reSelectionDetail.TaskDdl = selection.TaskDdl.Format("2006-01-02 15:04:05")
 	reSelectionDetail.SampleNum = selection.SampleNum
 	var freeStrategyPreviews []*vo.FreeStrategyPreview // 领样策略
 	freeStrategys, err := dao.FreeStrategyDao{}.GetFreeStrategyBySelectionId(selectionId)
@@ -400,6 +400,22 @@ func (s SelectionInfoService) GetSelectionDetail(selectionId string) (*vo.ReSele
 	return &reSelectionDetail, nil
 }
 
+// 电商带货提交审核
+func (s SelectionInfoService) SelectionToReview(selectionUpdateParam *vo.SelectionInfoUpdateParam) (*string, error) {
+	selectionId := selectionUpdateParam.SelectionID
+	t := time.Now()
+	updateSelection := entity.SelectionInfo{
+		SelectionID:     selectionId,
+		SelectionStatus: 2,
+		UpdatedAt:       t,
+	}
+	err := dao.SelectionInfoDAO{}.UpdateSelectionInfo(updateSelection)
+	if err != nil {
+		return nil, err
+	}
+	return &selectionId, nil
+}
+
 // 电商带货任务列表
 func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchParam) (vo.ResultVO, error) {
 	if param.Page == 0 {
@@ -409,7 +425,7 @@ func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchPara
 		param.PageSize = 10
 	}
 	var result vo.ResultVO
-	reSelectionTaskPreviews, total, err := (&dao.ProjectDAO{}).GetSelectionPreviews(param)
+	reSelectionTaskPreviews, total, err := (&dao.SelectionInfoDAO{}).GetSelectionPreviews(param)
 	if err != nil {
 		return result, err
 	}
@@ -464,3 +480,52 @@ func (s SelectionInfoService) DeleteSelection(selectionId string) (*string, erro
 	}
 	return res, nil
 }
+
+// 草稿箱——电商带货
+func (s SelectionInfoService) GetSelectionDraftList(param *vo.SelectionDraftParam) (vo.ResultVO, error) {
+	if param.Page == 0 {
+		param.Page = 1
+	}
+	if param.PageSize == 0 {
+		param.PageSize = 10
+	}
+	var result vo.ResultVO
+	reSelectionTaskPreviews, total, err := (&dao.SelectionInfoDAO{}).GetSelectionDraftList(param)
+	if err != nil {
+		return result, err
+	}
+	for i := range reSelectionTaskPreviews {
+		var creatorName string
+		var productName string
+		var productPrice float64
+		var mainImage string
+		if reSelectionTaskPreviews[i].SubAccountId == 0 {
+			enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reSelectionTaskPreviews[i].EnterpriseId)
+			if err == nil && enterprise != nil {
+				creatorName = enterprise.BusinessName
+			}
+		} else {
+			subAccount, err := dao.SubAccountDao{}.GetSubAccount(reSelectionTaskPreviews[i].SubAccountId)
+			if err == nil && subAccount != nil {
+				creatorName = subAccount.SubAccountName
+			}
+		}
+		product, err := dao.ProductDAO{}.GetProductByID(reSelectionTaskPreviews[i].ProductId)
+		if err == nil && product != nil {
+			productName = product.ProductName
+			productPrice = product.ProductPrice
+		}
+		mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reSelectionTaskPreviews[i].ProductId)
+		reSelectionTaskPreviews[i].CreatorName = creatorName
+		reSelectionTaskPreviews[i].ProductName = productName
+		reSelectionTaskPreviews[i].ProductPrice = productPrice
+		reSelectionTaskPreviews[i].MainImage = mainImage
+	}
+	result = vo.ResultVO{
+		Page:     param.Page,
+		PageSize: param.PageSize,
+		Total:    total,
+		Data:     reSelectionTaskPreviews,
+	}
+	return result, nil
+}

+ 40 - 0
app/util/uuid.go

@@ -6,6 +6,9 @@ import (
 	"github.com/issue9/conv"
 	"math/rand"
 	"time"
+	"youngee_b_api/app/dao"
+	"youngee_b_api/app/entity"
+	"youngee_b_api/util"
 )
 
 var snowflakeInstance *snowflake.Snowflake
@@ -49,3 +52,40 @@ func GetProjectID() string {
 	selectionId := conv.MustString(time.Now().Year())[2:] + td + conv.MustString(rand.Intn(100000-10000)+10000)
 	return selectionId
 }
+
+func MakeRechargeId(EnterpriseID string) string {
+	// 1、年月日
+	year := time.Now().Year()
+	month := time.Now().Month()
+	day := time.Now().Day()
+	yearData, _ := util.GetDayNum("year", year)
+	monthData, _ := util.GetDayNum("month", int(month))
+	dayData, _ := util.GetDayNum("day", day)
+	sum := 0
+	sum += dayData + monthData
+	leap := 0
+	if (yearData%400 == 0) || ((yearData%4 == 0) && (yearData%100 != 0)) {
+		leap = 1
+	}
+	if (leap == 1) && (monthData > 2) {
+		sum += 1
+	}
+	last := ""
+	rechargeIdPrefix := "8" + EnterpriseID[len(EnterpriseID)-2:] + conv.MustString(sum)
+	var rechargeIdLast string
+	err := dao.Db.Model(entity.RechargeRecord{}).Select("recharge_id").Where("recharge_id like ?", rechargeIdPrefix+"%").
+		Last(&rechargeIdLast).Error
+	if err != nil {
+		last = "0"
+	} else {
+		last = rechargeIdLast[len(rechargeIdLast)-2:]
+	}
+	var lastInt int
+	lastInt = conv.MustInt(last)
+	if lastInt+1 < 10 {
+		last = "0" + conv.MustString(conv.MustInt(last)+1)
+	} else {
+		last = conv.MustString(conv.MustInt(last) + 1)
+	}
+	return rechargeIdPrefix + last
+}

+ 8 - 0
app/vo/TalentCancelParam.go

@@ -0,0 +1,8 @@
+package vo
+
+type TalentCancelParam struct {
+	TaskId       string   `json:"task_id"`
+	TaskIds      []string `json:"task_ids"`
+	RealPayment  float64  `json:"real_payment"`
+	CancelReason string   `json:"cancel_reason"`
+}

+ 8 - 0
app/vo/balance_param.go

@@ -0,0 +1,8 @@
+package vo
+
+type BalanceParam struct {
+	EnterpriseId string `json:"enterprise_id"` // 企业id
+	FrozenState  int64  `json:"frozen_state"`  // 冻结状态(1冻结中 2冻结解除)
+	Page         int    `json:"page"`
+	PageSize     int    `json:"page_size"`
+}

+ 15 - 0
app/vo/default_search_param.go

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

+ 16 - 0
app/vo/pay_wx_param.go

@@ -0,0 +1,16 @@
+package vo
+
+type GetCodeUrlParam struct {
+	EnterpriseId string `json:"enterprise_id"` // 企业id
+	Amount       int64  `json:"amount"`        // 金额(分)
+}
+
+type QueryOrderByTradeIdParam struct {
+	TradeId string `json:"trade_id"`
+}
+
+type ReCodeUrl struct {
+	CodeUrl    string `json:"codeUrl"`
+	TradeId    string `json:"tradeId"`
+	TimeExpire string `json:"timeExpire"`
+}

+ 12 - 0
app/vo/project_draft_param.go

@@ -0,0 +1,12 @@
+package vo
+
+type ProjectDraftParam struct {
+	EnterpriseId    string `json:"enterprise_id"`
+	SubAccountId    int64  `json:"sub_account_id"`
+	Page            int    `json:"page"`
+	PageSize        int    `json:"page_size"`
+	ProjectPlatform int64  `json:"project_platform"` // 平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	ProjectType     int64  `json:"project_type"`     // 项目类型 1全流程 2专项
+
+	//ProjectId string `json:"project_id"` // 任务ID
+}

+ 7 - 0
app/vo/re_balance_show.go

@@ -0,0 +1,7 @@
+package vo
+
+type ReBalanceShow struct {
+	TotalBalance  float64 `json:"totalBalance"`  // 总金额
+	AvailBalance  float64 `json:"availBalance"`  // 可用余额
+	FrozenBalance float64 `json:"frozenBalance"` // 冻结金额
+}

+ 17 - 0
app/vo/re_frozen_info.go

@@ -0,0 +1,17 @@
+package vo
+
+type ReFrozenInfo struct {
+	ProductId           int64   `json:"productId"`
+	MainImage           string  `json:"mainImage"`
+	ProductName         string  `json:"productName"`
+	ProductPrice        float64 `json:"productPrice"`
+	Platform            int64   `json:"platform"`
+	CreatorName         string  `json:"creatorName"`
+	TaskType            string  `json:"taskType"` // 任务类型
+	FrozenBalance       float64 `json:"frozenBalance"`
+	FrozenCancelBalance float64 `json:"frozenCancelBalance"`
+	FrozenTime          string  `json:"frozenTime"`
+	EnterpriseId        string  `json:"enterpriseId"`
+	SubAccountId        int64   `json:"subAccountId"`
+	TaskId              string  `json:"taskId"`
+}

+ 9 - 10
app/vo/re_project_detail.go

@@ -1,26 +1,25 @@
 package vo
 
 import (
-	"time"
 	"youngee_b_api/app/entity"
 )
 
 type ReProjectDetail struct {
 	// 系统信息
-	ProjectId         string    `json:"projectId"`           // 项目id 生成规则:年(2位)+一年中的第几天(3位)+5位数随机数,雪花算法也可,生成10位订单号
-	ProjectStatus     int64     `json:"projectStatus"`       // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
-	ProjectPlatform   int64     `json:"projectPlatform"`     //  项目平台,1-7分别代表红book、抖音、微博、快手、b站、大众点评、知乎
-	CreatedAt         time.Time `json:"createdAt"`           // 创建时间
-	CreatorName       string    `json:"creatorName"`         // 创建者
-	Phone             string    `json:"phone"`               // 联系方式
-	EstimatedCost     float64   `json:"estimatedCost"`       // 成本预估
-	ServiceChargeRate float64   `json:"service_charge_rate"` // 公开服务费率
+	ProjectId         string  `json:"projectId"`           // 项目id 生成规则:年(2位)+一年中的第几天(3位)+5位数随机数,雪花算法也可,生成10位订单号
+	ProjectStatus     int64   `json:"projectStatus"`       // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	ProjectPlatform   int64   `json:"projectPlatform"`     //  项目平台,1-7分别代表红book、抖音、微博、快手、b站、大众点评、知乎
+	CreatedAt         string  `json:"createdAt"`           // 创建时间
+	CreatorName       string  `json:"creatorName"`         // 创建者
+	Phone             string  `json:"phone"`               // 联系方式
+	EstimatedCost     float64 `json:"estimatedCost"`       // 成本预估
+	ServiceChargeRate float64 `json:"service_charge_rate"` // 公开服务费率
 	// 支付方式参数待定
 	// 关联商品
 	ProductInfo *ReTaskProduct `json:"productInfo"`
 	// 招募要求
 	TalentType       string                    `json:"talentType"`
-	RecruitDdl       time.Time                 `json:"recruitDdl"`
+	RecruitDdl       string                    `json:"recruitDdl"`
 	ProjectForm      int64                     `json:"projectForm"`
 	ContentType      int64                     `json:"contentType"`
 	ProjectDetail    string                    `json:"projectDetail"`

+ 2 - 0
app/vo/re_project_task_preview.go

@@ -18,4 +18,6 @@ type ReProjectTaskPreview struct {
 	NeedQuality     int64   `json:"needQuality"`
 	NeedCalculate   int64   `json:"needCalculate"`
 	CreatorName     string  `json:"creatorName"`
+	ProjectType     int64   `json:"projectType"`
+	CreatedAt       string  `json:"createdAt"`
 }

+ 13 - 0
app/vo/re_recharge_info.go

@@ -0,0 +1,13 @@
+package vo
+
+type ReRechargeInfo struct {
+	RechargeId         string  `json:"recharge_id"`
+	CreatorName        string  `json:"creatorName"`
+	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"` // 失败原因
+}

+ 6 - 0
app/vo/re_recharge_show.go

@@ -0,0 +1,6 @@
+package vo
+
+type ReRechargeShow struct {
+	TotalRecharge      float64 `json:"totalRecharge"`      // 累计充值金额
+	ConfirmingRecharge float64 `json:"rechargeConfirming"` // 充值确认中金额
+}

+ 9 - 10
app/vo/re_selection_detail.go

@@ -1,25 +1,24 @@
 package vo
 
 import (
-	"time"
 	"youngee_b_api/app/entity"
 )
 
 type ReSelectionDetail struct {
 	// 系统信息
-	SelectionId       string    `json:"selectionId"`       // 项目id 生成规则:年(2位)+一年中的第几天(3位)+5位数随机数,雪花算法也可,生成10位订单号
-	SelectionStatus   int64     `json:"selectionStatus"`   // 项目状态,1-8分别代表创建中、待审核、审核通过、待支付、已支付、执行中、失效、已结案
-	SelectionPlatform int64     `json:"selectionPlatform"` //  项目平台,1-7分别代表红book、抖音、微博、快手、b站、大众点评、知乎
-	CreatedAt         time.Time `json:"createdAt"`         // 创建时间
-	CreatorName       string    `json:"creatorName"`       // 创建者
-	Phone             string    `json:"phone"`             // 联系方式
-	RewardSum         float64   `json:"rewardSum"`         // 悬赏池总金额
-	SubmitAt          time.Time `json:"submitAt"`          // 提交审核时间
+	SelectionId       string  `json:"selectionId"`       // 项目id 生成规则:年(2位)+一年中的第几天(3位)+5位数随机数,雪花算法也可,生成10位订单号
+	SelectionStatus   int64   `json:"selectionStatus"`   // 项目状态,1-8分别代表创建中、待审核、审核通过、待支付、已支付、执行中、失效、已结案
+	SelectionPlatform int64   `json:"selectionPlatform"` //  项目平台,1-7分别代表红book、抖音、微博、快手、b站、大众点评、知乎
+	CreatedAt         string  `json:"createdAt"`         // 创建时间
+	CreatorName       string  `json:"creatorName"`       // 创建者
+	Phone             string  `json:"phone"`             // 联系方式
+	RewardSum         float64 `json:"rewardSum"`         // 悬赏池总金额
+	SubmitAt          string  `json:"submitAt"`          // 提交审核时间
 	// 支付方式参数待定
 	// 关联商品
 	ProductInfo *ReTaskProduct `json:"productInfo"`
 	// 样品奖励
-	TaskDdl         time.Time                `json:"taskDdl"`
+	TaskDdl         string                   `json:"taskDdl"`
 	SampleNum       int64                    `json:"sampleNum"` // 样品数量
 	FreeStrategys   []*FreeStrategyPreview   // 领样策略
 	RewardStrategys []*RewardStrategyPreview // 悬赏策略

+ 12 - 14
app/vo/re_selection_task_preview.go

@@ -1,23 +1,21 @@
 package vo
 
-import "time"
-
 type ReSelectionTaskPreview struct {
 	ProductId    int64   `json:"productId"`
 	MainImage    string  `json:"mainImage"`
 	ProductName  string  `json:"productName"`
 	ProductPrice float64 `json:"productPrice"`
 
-	EnterpriseId      string    `json:"enterpriseId"`
-	SubAccountId      int64     `json:"subAccountId"`
-	SelectionId       string    `json:"selectionId"`
-	SelectionPlatform int64     `json:"selectionPlatform"`
-	SelectionStatus   int64     `json:"selectionStatus"`
-	CreatedAt         time.Time `json:"createdAt"`
-	TaskDdl           time.Time `json:"taskDdl"`
-	SampleNum         int64     `json:"sampleNum"` // 样品数量
-	Reward            float64   `json:"reward"`    // 悬赏池总金额
-	EnrollNum         int64     `json:"enrollNum"` // 报名数量
-	ChooseNum         int64     `json:"chooseNum"` // 已选数量
-	CreatorName       string    `json:"creatorName"`
+	EnterpriseId      string  `json:"enterpriseId"`
+	SubAccountId      int64   `json:"subAccountId"`
+	SelectionId       string  `json:"selectionId"`
+	SelectionPlatform int64   `json:"selectionPlatform"`
+	SelectionStatus   int64   `json:"selectionStatus"`
+	CreatedAt         string  `json:"createdAt"`
+	TaskDdl           string  `json:"taskDdl"`
+	SampleNum         int64   `json:"sampleNum"` // 样品数量
+	Reward            float64 `json:"reward"`    // 悬赏池总金额
+	EnrollNum         int64   `json:"enrollNum"` // 报名数量
+	ChooseNum         int64   `json:"chooseNum"` // 已选数量
+	CreatorName       string  `json:"creatorName"`
 }

+ 16 - 0
app/vo/re_talent_default.go

@@ -0,0 +1,16 @@
+package vo
+
+type ReTalentDefault struct {
+	TalentId     string  `json:"talentId"`
+	OpenId       string  `json:"openId"` // 表platform_kuaishou_user_info
+	NickName     string  `json:"nickName"`
+	HeadUri      string  `json:"headUri"`
+	City         string  `json:"city"`
+	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"` // 操作人
+}

+ 22 - 0
app/vo/re_task_default_public.go

@@ -0,0 +1,22 @@
+package vo
+
+type ReTaskDefaultPublic struct {
+	ProductId    int64   `json:"productId"`
+	MainImage    string  `json:"mainImage"`
+	ProductName  string  `json:"productName"`
+	ProductPrice float64 `json:"productPrice"`
+
+	EnterpriseId      string `json:"enterpriseId"`
+	SubAccountId      int64  `json:"subAccountId"`
+	TaskId            string `json:"taskId"`
+	TaskType          int64  `json:"taskType"` // 任务类型 1品牌种草 2本地生活
+	Platform          int64  `json:"platform"`
+	TaskForm          int64  `json:"taskForm"`    // 任务形式
+	ContentType       int64  `json:"contentType"` // 内容形式
+	CreatorName       string `json:"creatorName"`
+	NoSketchNum       int64  `json:"sampleNum"` // 未传初稿
+	NoLinkNum         int64  `json:"reward"`    // 未发作品
+	NoDataNum         int64  `json:"enrollNum"` // 未传数据
+	EndCooperationNum int64  `json:"chooseNum"` // 终止合作
+
+}

+ 20 - 0
app/vo/re_task_default_target.go

@@ -0,0 +1,20 @@
+package vo
+
+type ReTaskDefaultTarget struct {
+	ProductId    int64   `json:"productId"`
+	MainImage    string  `json:"mainImage"`
+	ProductName  string  `json:"productName"`
+	ProductPrice float64 `json:"productPrice"`
+
+	EnterpriseId      string `json:"enterpriseId"`
+	SubAccountId      int64  `json:"subAccountId"`
+	TaskId            string `json:"taskId"`
+	TaskType          int64  `json:"taskType"` // 任务类型 1品牌种草 2本地生活
+	Platform          int64  `json:"platform"`
+	TaskForm          int64  `json:"taskForm"`    // 任务形式
+	ContentType       int64  `json:"contentType"` // 内容形式
+	CreatorName       string `json:"creatorName"`
+	Tools             string `json:"tools"`     // 工具选择
+	EndCooperationNum int64  `json:"chooseNum"` // 终止合作
+
+}

+ 8 - 10
app/vo/re_task_product.go

@@ -1,14 +1,12 @@
 package vo
 
-import "time"
-
 type ReTaskProduct struct {
-	ProductID       int64     `json:"productId"`
-	ProductName     string    `json:"productName"`
-	ProductType     int64     `json:"productType"`
-	ProductCategory string    `json:"productCategory"`
-	ProductPrice    float64   `json:"productPrice"`
-	ProductDetail   string    `json:"productDetail"`
-	CreatedAt       time.Time `json:"createdAt"`
-	PhotoUrl        string    `json:"photoUrl"`
+	ProductID       int64   `json:"productId"`
+	ProductName     string  `json:"productName"`
+	ProductType     int64   `json:"productType"`
+	ProductCategory string  `json:"productCategory"`
+	ProductPrice    float64 `json:"productPrice"`
+	ProductDetail   string  `json:"productDetail"`
+	CreatedAt       string  `json:"createdAt"`
+	PhotoUrl        string  `json:"photoUrl"`
 }

+ 8 - 0
app/vo/recharge_param.go

@@ -0,0 +1,8 @@
+package vo
+
+type RechargeParam struct {
+	EnterpriseId  string `json:"enterprise_id"`  // 企业id
+	RechargeState int64  `json:"recharge_state"` // 充值状态(1充值待确认 2已充值 3充值失败)
+	Page          int    `json:"page"`
+	PageSize      int    `json:"page_size"`
+}

+ 7 - 0
app/vo/recharge_transfer_param.go

@@ -0,0 +1,7 @@
+package vo
+
+type RechargeTransferParam struct {
+	EnterpriseId       string  `json:"enterprise_id"`
+	Amount             float64 `json:"amount"`
+	TransferVoucherUrl string  `json:"transfer_voucher_url"`
+}

+ 11 - 0
app/vo/selection_draft_param.go

@@ -0,0 +1,11 @@
+package vo
+
+type SelectionDraftParam struct {
+	EnterpriseId      string `json:"enterprise_id"`
+	SubAccountId      int64  `json:"sub_account_id"`
+	Page              int    `json:"page"`
+	PageSize          int    `json:"page_size"`
+	SelectionPlatform int64  `json:"selection_platform"` // 平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+
+	//SelectionId string `json:"selection_id"` // 任务ID
+}

+ 2 - 0
config/init.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"io/ioutil"
 	"os"
+	"youngee_b_api/app/dao"
 	"youngee_b_api/db"
 	"youngee_b_api/model/system_model"
 	"youngee_b_api/redis"
@@ -32,6 +33,7 @@ func Init() *system_model.Server {
 
 func loadExternelConfig(config *system_model.Config) {
 	db.Init(config.Mysql)
+	dao.Init(config.Mysql)
 	redis.Init(config.Redis)
 	service.LoginAuthInit(config.Server.Session)
 	service.SendCodeInit(config.Server.Session)

+ 21 - 0
db/data.go

@@ -183,6 +183,27 @@ func AcceptData(ctx context.Context, TaskIDs []string) error {
 	return nil
 }
 
+// RejectData 拒绝数据-结案
+func RejectData(ctx context.Context, TaskIDs []string) error {
+	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}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Data db] Update YounggeeDataInfo error,err:%+v", err)
+		return err
+	}
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{DataStatus: 3}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Data db] Update YoungeeTaskInfo error,err:%+v", err)
+		return err
+	}
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{TaskStage: 13}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Data db] Update YoungeeTaskInfo error,err:%+v", err)
+		return err
+	}
+	return nil
+}
+
 // GetSpecialTaskDataList 专项任务-查询上传数据的task list
 func GetSpecialTaskDataList(ctx context.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) ([]*http_model.SpecialTaskDataInfo, int64, error) {
 	db := GetReadDB(ctx)

+ 21 - 0
db/link.go

@@ -168,6 +168,27 @@ func AcceptLink(ctx context.Context, TaskIDs []string) error {
 	return nil
 }
 
+// RejectLink 同意链接
+func RejectLink(ctx context.Context, TaskIDs []string) error {
+	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()}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Link db] Update YounggeeLinkInfo error,err:%+v", err)
+		return err
+	}
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{LinkStatus: 3}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Link db] Update YoungeeTaskInfo error,err:%+v", err)
+		return err
+	}
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{TaskStage: 11}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Link db] Update YoungeeTaskInfo error,err:%+v", err)
+		return err
+	}
+	return nil
+}
+
 // GetSpecialTaskLinkList 专项任务-查询上传链接的task list
 func GetSpecialTaskLinkList(ctx context.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) ([]*http_model.SpecialTaskLinkInfo, int64, error) {
 	db := GetReadDB(ctx)

+ 344 - 1
db/project.go

@@ -122,7 +122,7 @@ func GetProjectDraftList(ctx context.Context, enterpriseID string, pageSize, pag
 	return projectDrafts, total, nil
 }
 
-func GetProjectTaskList(ctx context.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TaskConditions) ([]*http_model.ProjectTaskInfo, int64, error) {
+func GetProjectTaskList(ctx context.Context, pageSize, pageNum int64, conditions *common_model.TaskConditions) ([]*http_model.ProjectTaskInfo, int64, error) {
 	db := GetReadDB(ctx)
 	// 查询task表信息
 	db = db.Debug().Model(gorm_model.YoungeeTaskInfo{})
@@ -327,3 +327,346 @@ func GetCreatingNumber(ctx context.Context, enterpriseID string) (*int64, error)
 	}
 	return &creatingNumber, nil
 }
+
+func GetProjectData(ctx context.Context, projectid string) (http_model.ProjectDataResponse, error) {
+	db := GetReadDB(ctx)
+	var projectInfo gorm_model.ProjectInfo
+	// 查询项目基本信息
+	if err := db.Where("project_id = ?", projectid).First(&projectInfo).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[Project db] GetProjectData error, err: %+v", err)
+		return http_model.ProjectDataResponse{}, err
+	}
+	fmt.Println("projectInfo---", projectInfo.ProjectID)
+	var projectTasks []gorm_model.YoungeeTaskInfo
+	if err := db.Where("project_id = ? AND task_status = ?", projectid, 2).Find(&projectTasks).Error; err != nil {
+		return http_model.ProjectDataResponse{}, err
+	}
+
+	var totalTasks int64
+	if err := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_status = ?", projectid, 2).Count(&totalTasks).Error; err != nil {
+		return http_model.ProjectDataResponse{}, err
+	}
+
+	// 初始化统计数据
+	dateStats := make(map[string]int)
+	fansCounts := map[int64]int{0: 0, 1: 0, 2: 0, 3: 0}
+	feeCounts := map[int]int{1: 0, 2: 0, 3: 0}
+	startDate := *projectInfo.CreatedAt
+	endDate := time.Now()
+
+	// 填充日期统计
+	for d := startDate; d.Before(endDate) || d.Equal(endDate); d = d.Add(24 * time.Hour) {
+		dateStats[d.Format("2006-01-02")] = 0
+	}
+
+	var totalCost float64
+	var totalFans int
+	var serverTaskCount float64
+	var maleCount int64
+
+	// 处理每个任务
+	for _, task := range projectTasks {
+		totalCost += task.DraftFee
+		var talentInfo gorm_model.YoungeeTalentInfo
+
+		// 查询达人信息
+		if err := db.Where("id = ?", task.TalentID).First(&talentInfo).Error; err != nil {
+			logrus.WithContext(ctx).Errorf("[Project db] GetProjectData error, err: %+v", err)
+			return http_model.ProjectDataResponse{}, err
+		}
+
+		// 统计性别
+		if talentInfo.Sex == 1 {
+			maleCount++
+		}
+		totalFans += task.FansNum
+
+		// 统计来自服务商的任务
+		if task.SupplierId != 0 && task.SupplierStatus == 2 {
+			serverTaskCount++
+		}
+
+		// 稿费形式统计
+		feeCounts[task.FeeForm]++
+
+		// 统计粉丝数
+		switch {
+		case task.FansNum < 10000:
+			fansCounts[0]++
+		case task.FansNum < 100000:
+			fansCounts[1]++
+		case task.FansNum < 1000000:
+			fansCounts[2]++
+		default:
+			fansCounts[3]++
+		}
+
+		SelectDate := task.SelectDate.Format("2006-01-02")
+		if _, exists := dateStats[SelectDate]; exists {
+			dateStats[SelectDate]++
+		}
+	}
+
+	// 计算平均值
+	var avgFansNum int
+	if totalTasks > 0 {
+		avgFansNum = totalFans / int(totalTasks)
+	} else {
+		avgFansNum = 0
+	}
+
+	var fromType float64
+	if totalTasks > 0 {
+		fromType = serverTaskCount / float64(totalTasks)
+	} else {
+		fromType = 0
+	}
+
+	var manRatio float64
+	if totalTasks > 0 {
+		manRatio = float64(maleCount) / float64(totalTasks)
+	} else {
+		manRatio = 0
+	}
+	// 构建响应
+	res := http_model.ProjectDataResponse{
+		Recruittime: *projectInfo.PassAt,
+		RecruitDDl:  *projectInfo.RecruitDdl,
+		AgreeNum:    projectInfo.RecruitNum,
+		ApplyNum:    projectInfo.ApplyNum,
+		DraftFee:    totalCost,
+		AvgFansNum:  avgFansNum,
+		FromType:    fromType,
+		ManRatio:    manRatio,
+		DateStats:   dateStats,
+		FeeMap:      feeCounts,
+		FansMap:     fansCounts,
+	}
+	return res, nil
+}
+
+func GetProjectExecuteData(ctx context.Context, projectid string) (http_model.ExecuteDataResponse, error) {
+	db := GetReadDB(ctx)
+	var projectData gorm_model.ProjectInfo
+
+	// 查询项目基本信息
+	err := db.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectid).First(&projectData).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Project db] GetProjectData error, err: %+v", err)
+		return http_model.ExecuteDataResponse{}, err
+	}
+	// 查询项目任务信息
+	var projectTaskInfo []gorm_model.YoungeeTaskInfo
+	query := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("project_id = ? AND task_status = ?", projectid, 2).Find(&projectTaskInfo)
+	var total int64
+	if err = query.Count(&total).Error; err != nil {
+		return http_model.ExecuteDataResponse{}, err
+	}
+
+	// 初始化统计数据
+	skedateStats := make(map[string]int)
+	linkdateStatics := make(map[string]int)
+	startDate := *projectData.CreatedAt
+	endDate := time.Now()
+	// 填充日期统计
+	for d := startDate; d.Before(endDate) || d.Equal(endDate); d = d.Add(24 * time.Hour) {
+		skedateStats[d.Format("2006-01-02")] = 0
+		linkdateStatics[d.Format("2006-01-02")] = 0
+	}
+
+	var presketchnum int64                                         //代传初稿数
+	var sketchnum int64                                            //待审
+	var sketchaccnum int64                                         //通过
+	var prelinknum, linknum, linkaccnum, predatanum, datanum int64 //待传连接数,待审,通过
+	var duration time.Duration
+	var accskecnt int
+	var avgduration time.Duration
+	var avgccreateduraion time.Duration
+	var createduraion time.Duration
+	var crecnt, submint, firacccnt int
+	var firaccratio, firacclinkratio float64
+	var linkaccduartion, avglinkduration, backduration, avgbackdurtion time.Duration
+	var acclinkcnt, backcnt, submintcnt, firlinkacccnt int
+	var defaultnum int64
+	var defaultratio float64
+	var sktchinfo gorm_model.YounggeeSketchInfo
+	var draftee, settle_amount float64
+	for _, task := range projectTaskInfo {
+		draftee += task.DraftFee
+		switch task.TaskStage {
+		case 9:
+			presketchnum += 1
+		case 10:
+			sketchnum += 1
+		case 11:
+			prelinknum += 1
+		case 12:
+			linknum += 1
+		case 13:
+			predatanum += 1
+		}
+		if task.SketchStatus == 5 {
+			sketchaccnum += 1
+		}
+		if task.LinkStatus == 5 {
+			linkaccnum += 1
+		}
+		if task.CurDefaultType != 0 {
+			defaultnum += 1
+		}
+		if task.TaskStage == 15 {
+			settle_amount += task.SettleAmount
+		}
+		if task.TaskStage > 9 {
+			//初稿
+			//err = db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ? ", task.TaskID).First(&sktchinfo).Error
+			err = db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ?", task.TaskID).Order("create_at ASC").First(&sktchinfo).Error
+
+			if err != nil {
+				return http_model.ExecuteDataResponse{}, err
+			} else {
+
+				if projectData.ProjectForm == 1 {
+					if !task.SignedTime.IsZero() {
+						createduraion += sktchinfo.CreateAt.Sub(task.SignedTime)
+						crecnt += 1
+
+					}
+				} else {
+					if sktchinfo.IsSubmit == 1 {
+						createduraion += sktchinfo.CreateAt.Sub(task.SelectDate)
+						crecnt += 1
+					}
+				} //平均创作耗时
+				var sktchaccinfo gorm_model.YounggeeSketchInfo
+				err = db.Model(gorm_model.YounggeeSketchInfo{}).Where("task_id = ?", task.TaskID).Order("create_at ASC").Last(&sktchaccinfo).Error
+				if err != nil {
+					return http_model.ExecuteDataResponse{}, err
+				}
+
+				if sktchaccinfo.IsOk == 1 {
+					duration += sktchaccinfo.AgreeAt.Sub(sktchinfo.CreateAt)
+					accskecnt += 1 //审稿耗时
+					submint += 1
+					if sktchaccinfo.SketchID == sktchinfo.SketchID {
+						firacccnt += 1
+					} //首次通过
+					AgreeDate := sktchaccinfo.AgreeAt.Format("2006-01-02")
+					if _, exists := skedateStats[AgreeDate]; exists {
+						skedateStats[AgreeDate]++
+					}
+				}
+			}
+		}
+		if task.TaskStage > 11 {
+			var linkinfo gorm_model.YounggeeLinkInfo //最后一次上传link
+			err = db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id = ? ", task.TaskID).Order("create_at ASC").Last(&linkinfo).Error
+			if err != nil {
+				continue
+			} else {
+
+				if linkinfo.IsOk == 1 {
+					linkaccduartion += linkinfo.AgreeAt.Sub(linkinfo.CreateAt)
+					acclinkcnt += 1
+				} //平均质检时间
+				var linkfirinfo gorm_model.YounggeeLinkInfo //最后一次上传link
+				err = db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id = ? ", task.TaskID).Order("create_at ASC").First(&linkfirinfo).Error
+				if err != nil {
+					return http_model.ExecuteDataResponse{}, err
+				} else {
+					backduration += linkinfo.CreateAt.Sub(sktchinfo.AgreeAt)
+					backcnt += 1
+					var linklasinfo gorm_model.YounggeeLinkInfo //最后一次上传link
+					err = db.Model(gorm_model.YounggeeLinkInfo{}).Where("task_id = ? ", task.TaskID).Order("create_at ASC").Last(&linklasinfo).Error
+					if err != nil {
+						return http_model.ExecuteDataResponse{}, err
+					}
+					if linklasinfo.IsOk == 1 {
+						submintcnt += 1
+						if linklasinfo.LinkID == linkfirinfo.LinkID {
+							firlinkacccnt += 1
+						} //首次通过
+						AgreeDate := linklasinfo.AgreeAt.Format("2006-01-02")
+						if _, exists := linkdateStatics[AgreeDate]; exists {
+							linkdateStatics[AgreeDate]++
+						}
+
+					}
+				}
+
+			}
+
+		}
+	}
+	if submint > 0 && firacccnt > 0 {
+		firaccratio = float64(firacccnt) / float64(submint)
+	} else {
+		firaccratio = 0
+	}
+	if submintcnt > 0 && firlinkacccnt > 0 {
+		firacclinkratio = float64(firlinkacccnt) / float64(submintcnt)
+	} else {
+		firacclinkratio = 0
+	}
+	if accskecnt > 0 {
+		avgduration = duration / time.Duration(accskecnt)
+	} else {
+		avgduration = 0
+	}
+	if crecnt > 0 {
+		avgccreateduraion = createduraion / time.Duration(crecnt)
+	} else {
+		avgccreateduraion = 0
+	}
+	if acclinkcnt > 0 {
+		avglinkduration = linkaccduartion / time.Duration(acclinkcnt)
+	} else {
+		avglinkduration = 0
+	}
+	if backcnt > 0 {
+		avgbackdurtion = backduration / time.Duration(backcnt)
+	} else {
+		avgbackdurtion = 0
+	}
+	if defaultnum > 0 {
+		defaultratio = float64(defaultnum) / float64(total)
+	} else {
+		defaultratio = 0
+	}
+	res := http_model.ExecuteDataResponse{
+		Excutetime:      *projectData.PayAt,
+		PreSketchNum:    presketchnum,
+		SketchNum:       sketchnum,
+		SketchAccNum:    sketchaccnum,
+		AvgAccTime:      avgduration,
+		AvgCreTime:      avgccreateduraion,
+		FirAccRatio:     firaccratio,
+		PreLinkNum:      prelinknum,
+		LinkNum:         linknum,
+		LinkAccNum:      linkaccnum,
+		AvgLinkAccTime:  avglinkduration,
+		AvgBackTime:     avgbackdurtion,
+		FirAccLinkRatio: firacclinkratio,
+		PreDataNum:      predatanum,
+		DataNum:         datanum,
+		DefaultNum:      defaultnum,
+		DefaultRatio:    defaultratio,
+		DraftFee:        draftee,
+		Settle_Amount:   settle_amount,
+	}
+	return res, nil
+}
+
+func GetProjecdata(ctx context.Context, projectid string) (http_model.ProjectdataResponse, error) {
+	db := GetReadDB(ctx)
+	var projectInfo gorm_model.ProjectInfo
+
+	// 查询项目基本信息
+	if err := db.Where("project_id = ?", projectid).First(&projectInfo).Error; err != nil {
+		logrus.WithContext(ctx).Errorf("[Project db] GetProjectData error, err: %+v", err)
+		return http_model.ProjectdataResponse{}, err
+	}
+
+	res := http_model.ProjectdataResponse{}
+	return res, nil
+}

+ 607 - 0
db/project_task.go

@@ -0,0 +1,607 @@
+package db
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"github.com/issue9/conv"
+	"gorm.io/gorm"
+	"time"
+	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/model/http_model"
+)
+
+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)
+
+	// 构建查询条件
+	if request.FeeFrom != nil {
+		query = query.Where("fee_form = ?", request.FeeFrom)
+	}
+	if request.Type != nil {
+		switch *request.Type {
+		case 1:
+			query = query.Where("supplier_id = 0 AND supplier_status = 0")
+		case 2:
+			query = query.Where("supplier_id != 0 AND supplier_status = 2")
+		}
+	}
+
+	// 计算总数
+	var total int64
+	if err := query.Count(&total).Error; err != nil {
+		return nil, err
+	}
+
+	// 添加分页逻辑
+	pageSize := request.PageSize
+	if pageSize == 0 {
+		pageSize = 10
+	}
+	pageNum := request.PageNum
+	if pageNum == 0 {
+		pageNum = 1
+	}
+	offset := (pageNum - 1) * pageSize
+
+	// 执行分页查询
+	if err := query.Offset(offset).Limit(pageSize).Find(&projecrtaskinfo).Error; err != nil {
+		return nil, err
+	}
+
+	taskInfoPointers := make([]*http_model.TaskInfo, 0, len(projecrtaskinfo))
+	for _, task := range projecrtaskinfo {
+		boperator := getBOperator(db, task.BOperator)
+		response := &http_model.TaskInfo{
+			TaskId:             task.TaskID,
+			ProjectId:          task.ProjectID,
+			TalentId:           task.TalentID,
+			FansNum:            task.FansNum,
+			DraftFee:           task.DraftFee,
+			Voteavg:            task.VoteAvg,
+			FeeFrom:            task.FeeForm,
+			TaskStage:          task.TaskStage,
+			Commentavg:         task.CommitAvg,
+			CurrentDefaultType: task.CurDefaultType,
+			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+			Boperator:          boperator,
+			CreateAt:           task.CreateDate,
+		}
+		taskInfoPointers = append(taskInfoPointers, response)
+	}
+
+	return &http_model.GetTaskListData{
+		TaskList: taskInfoPointers,
+		Total:    conv.MustString(total, ""),
+	}, nil
+}
+
+func getBOperator(db *gorm.DB, bOperatorID string) string {
+	if bOperatorID == "" {
+		return ""
+	}
+	var boperatorinfo gorm_model.Enterprise
+	if err := db.Where(gorm_model.Enterprise{EnterpriseID: bOperatorID}).First(&boperatorinfo).Error; err != nil {
+		return ""
+	}
+	return boperatorinfo.BusinessName
+}
+
+func determineFrom(supplierID, supplierStatus int) int {
+	if supplierID != 0 && supplierStatus == 2 {
+		return 2
+	}
+	return 1
+}
+
+func PassProTaskCoop(ctx context.Context, projectId string, taskIds []string, operatorid string, operatetype int) (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
+	}
+	if int64(len(taskIds)) == 0 || count != int64(len(taskIds)) {
+		return false, errors.New("任务id有误")
+	}
+
+	// 2. 查询任务对应达人id(用于生成达人消息)
+	var talentIds []string
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ?", taskIds).Select("talent_id").Find(&talentIds).Error
+	if err != nil {
+		return false, err
+	}
+
+	// 3. 查询任务对应project名称(用于生成达人消息)
+	var project gorm_model.ProjectInfo
+	err = db.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Find(&project).Error
+	if err != nil {
+		return false, err
+	}
+	var taskstages int
+	if project.ProjectForm == 1 {
+		taskstages = 4
+	} else {
+		taskstages = 9
+	}
+
+	//4.根据达人来源改变状态、阶段、数目
+	var tasks []gorm_model.YoungeeTaskInfo
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ? AND task_stage = 1", taskIds).Find(&tasks).Error
+	if err != nil {
+		return false, err
+	}
+	err = db.Transaction(func(tx *gorm.DB) error {
+		// 2. 修改任务状态和任务阶段
+		for _, taskInfo := range tasks {
+			if taskInfo.SupplierId != 0 && taskInfo.SupplierStatus == 2 { //服务商招募数量+1
+				updateData := gorm_model.YoungeeTaskInfo{
+					TaskStage:     taskstages,
+					TaskStatus:    2,
+					UpdateAt:      time.Now(),
+					BOperator:     operatorid,
+					BOperatorType: operatetype,
+				}
+				err = tx.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ? AND task_stage = 1", taskInfo.TaskID).Updates(updateData).Error
+				if err != nil {
+					return err
+				}
+
+				//project招募数+1,预估成本+服务商价格
+				var projectinfo gorm_model.ProjectInfo
+				err = db.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Find(&projectinfo).Error
+				if err != nil {
+					return err
+				}
+				projectinfo.RecruitNum += 1
+				projectinfo.EstimatedCost += taskInfo.SupportFee
+				err = tx.Model(gorm_model.ProjectInfo{}).Where("project_id = ? ", projectId).Updates(projectinfo).Error
+				if err != nil {
+					return err
+				}
+				//服务商s_project已招募人数+1
+				var sprojectinfo gorm_model.YounggeeSProjectInfo
+				err = db.Model(gorm_model.YounggeeSProjectInfo{}).Where("project_id = ?", projectId).Find(&sprojectinfo).Error
+				if err != nil {
+					return err
+				}
+				sprojectinfo.RecruitNum += 1
+				err = tx.Model(gorm_model.YounggeeSProjectInfo{}).Where("project_id = ? ", projectId).Updates(projectinfo).Error
+				if err != nil {
+					return err
+				}
+
+			}
+
+			if taskInfo.SupplierId == 0 && taskInfo.SupplierStatus == 0 { //来源于公海
+				updateData := gorm_model.YoungeeTaskInfo{
+					TaskStage:     taskstages,
+					TaskStatus:    2,
+					UpdateAt:      time.Now(),
+					BOperator:     operatorid,
+					BOperatorType: operatetype,
+				}
+				err = tx.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ? AND task_stage = 1", taskInfo.TaskID).Updates(updateData).Error
+				if err != nil {
+					return err
+				}
+
+				//project招募数+1
+				var projectinfo gorm_model.ProjectInfo
+				err = db.Model(gorm_model.ProjectInfo{}).Where("project_id = ?", projectId).Find(&projectinfo).Error
+				if err != nil {
+					return err
+				}
+				projectinfo.RecruitNum += 1
+				err = tx.Model(gorm_model.ProjectInfo{}).Where("project_id = ? ", projectId).Updates(projectinfo).Error
+				if err != nil {
+					return err
+				}
+			}
+
+		}
+		// 4. 生成达人消息
+		for _, talendId := range talentIds {
+			err = CreateMessage(ctx, 1, 1, talendId, project.ProjectName)
+			if err != nil {
+				return err
+			}
+		}
+		// 返回 nil 提交事务
+		return nil
+	})
+	if err != nil {
+		return false, err
+	}
+	return true, nil
+}
+
+func RefuseproTaskCoop(ctx context.Context, taskIds []string, operatorid string, operatetype int) (bool, error) {
+	db := GetWriteDB(ctx)
+	// 1. 校验
+	var count int64
+	err := db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ? AND task_stage = 3", taskIds).Count(&count).Error
+	if err != nil {
+		return false, err
+	}
+	if count != int64(len(taskIds)) {
+		return false, errors.New("任务id有误")
+	}
+
+	// 2. 查询任务对应达人id(用于生成达人消息)
+	var talentIds []string
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ?", taskIds).Select("talent_id").Find(&talentIds).Error
+	if err != nil {
+		return false, err
+	}
+
+	var tasks []gorm_model.YoungeeTaskInfo
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id IN ? AND task_stage = 1", taskIds).Find(&tasks).Error
+
+	err = db.Transaction(func(tx *gorm.DB) error {
+		// 2. 修改任务状态和任务阶段
+		for _, taskInfo := range tasks {
+			updateData := gorm_model.YoungeeTaskInfo{
+				TaskStage:     3,
+				TaskStatus:    3,
+				UpdateAt:      time.Now(),
+				BOperator:     operatorid,
+				BOperatorType: operatetype,
+			}
+			err = tx.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id = ? AND task_stage = 1", taskInfo.TaskID).Updates(updateData).Error
+		}
+		if err != nil {
+			return err
+		}
+
+		// 返回 nil 提交事务
+		return nil
+	})
+	if err != nil {
+		return false, err
+	}
+	return true, nil
+}
+
+func GetPreSketchList(ctx context.Context, request http_model.PreSketchListRequest) (*http_model.GetSketchTaskListData, error) {
+	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 total int64
+	if err := query.Count(&total).Error; err != nil {
+		return nil, err
+	}
+
+	// 添加分页逻辑
+	pageSize := request.PageSize
+	if pageSize == 0 {
+		pageSize = 10
+	}
+	pageNum := request.PageNum
+	if pageNum == 0 {
+		pageNum = 1
+	}
+	offset := (pageNum - 1) * pageSize
+	// 执行分页查询
+	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 {
+		taskinfo := &http_model.TaskInfo{
+			TaskId:             task.TaskID,
+			ProjectId:          task.ProjectID,
+			TalentId:           task.TalentID,
+			FansNum:            task.FansNum,
+			DraftFee:           task.DraftFee,
+			Voteavg:            task.VoteAvg,
+			FeeFrom:            task.FeeForm,
+			TaskStage:          task.TaskStage,
+			Commentavg:         task.CommitAvg,
+			CurrentDefaultType: task.CurDefaultType,
+			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+		}
+		response := &http_model.TasksketchInfo{
+			Task: taskinfo,
+			DDl:  time.Now(), //截止时间再改
+		}
+		taskInfoPointers = append(taskInfoPointers, response)
+
+	}
+	return &http_model.GetSketchTaskListData{
+		TasksketchList: taskInfoPointers,
+		Total:          conv.MustString(total, ""),
+	}, nil
+}
+
+func GetSketchList(ctx context.Context, request http_model.TasksketchlistRequest) (*http_model.GetsketchtaskListData, error) {
+	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 total int64
+	if err := query.Count(&total).Error; err != nil {
+		return nil, err
+	}
+
+	// 添加分页逻辑
+	pageSize := request.PageSize
+	if pageSize == 0 {
+		pageSize = 10
+	}
+	pageNum := request.PageNum
+	if pageNum == 0 {
+		pageNum = 1
+	}
+	offset := (pageNum - 1) * pageSize
+	// 执行分页查询
+	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 {
+		taskinfo := &http_model.TaskInfo{
+			TaskId:             task.TaskID,
+			ProjectId:          task.ProjectID,
+			TalentId:           task.TalentID,
+			FansNum:            task.FansNum,
+			DraftFee:           task.DraftFee,
+			Voteavg:            task.VoteAvg,
+			FeeFrom:            task.FeeForm,
+			TaskStage:          task.TaskStage,
+			Commentavg:         task.CommitAvg,
+			CurrentDefaultType: task.CurDefaultType,
+			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+		}
+		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
+		}
+		response := &http_model.Tasksketchinfo{
+			Task:     taskinfo,
+			SketchId: sketchinfo.SketchID,
+			SubmitAt: sketchinfo.SubmitAt,
+			AgreeAt:  sketchinfo.AgreeAt,
+		}
+		taskInfoPointers = append(taskInfoPointers, response)
+
+	}
+	return &http_model.GetsketchtaskListData{
+		TasksketchList: taskInfoPointers,
+		Total:          conv.MustString(total, ""),
+	}, nil
+}
+
+func GetPreLinkList(ctx context.Context, request http_model.PreLinkListRequest) (*http_model.GetprelinkListData, error) {
+	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 total int64
+	if err := query.Count(&total).Error; err != nil {
+		return nil, err
+	}
+
+	// 添加分页逻辑
+	pageSize := request.PageSize
+	if pageSize == 0 {
+		pageSize = 10
+	}
+	pageNum := request.PageNum
+	if pageNum == 0 {
+		pageNum = 1
+	}
+	offset := (pageNum - 1) * pageSize
+	// 执行分页查询
+	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 {
+		taskinfo := &http_model.TaskInfo{
+			TaskId:             task.TaskID,
+			ProjectId:          task.ProjectID,
+			TalentId:           task.TalentID,
+			FansNum:            task.FansNum,
+			DraftFee:           task.DraftFee,
+			Voteavg:            task.VoteAvg,
+			FeeFrom:            task.FeeForm,
+			TaskStage:          task.TaskStage,
+			Commentavg:         task.CommitAvg,
+			CurrentDefaultType: task.CurDefaultType,
+			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+		}
+		response := &http_model.Tasklinkinfo{
+			Task: taskinfo,
+			DDl:  time.Now(), //截止时间再改
+		}
+		taskInfoPointers = append(taskInfoPointers, response)
+
+	}
+	return &http_model.GetprelinkListData{
+		TasklinkList: taskInfoPointers,
+		Total:        conv.MustString(total, ""),
+	}, nil
+}
+
+func GetLinkList(ctx context.Context, request http_model.TaskLinklistRequest) (*http_model.GettasklinkListData, error) {
+	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 total int64
+	if err := query.Count(&total).Error; err != nil {
+		return nil, err
+	}
+
+	// 添加分页逻辑
+	pageSize := request.PageSize
+	if pageSize == 0 {
+		pageSize = 10
+	}
+	pageNum := request.PageNum
+	if pageNum == 0 {
+		pageNum = 1
+	}
+	offset := (pageNum - 1) * pageSize
+	// 执行分页查询
+	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 {
+		taskinfo := &http_model.TaskInfo{
+			TaskId:             task.TaskID,
+			ProjectId:          task.ProjectID,
+			TalentId:           task.TalentID,
+			FansNum:            task.FansNum,
+			DraftFee:           task.DraftFee,
+			Voteavg:            task.VoteAvg,
+			FeeFrom:            task.FeeForm,
+			TaskStage:          task.TaskStage,
+			Commentavg:         task.CommitAvg,
+			CurrentDefaultType: task.CurDefaultType,
+			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+		}
+		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
+		}
+		response := &http_model.TaskLinkinfo{
+			Task:     taskinfo,
+			LinkId:   linkinfo.LinkID,
+			SubmitAt: linkinfo.SubmitAt,
+			AgreeAt:  linkinfo.AgreeAt,
+			LinkUrl:  linkinfo.LinkUrl,
+			PhotoUrl: linkinfo.PhotoUrl,
+		}
+		taskInfoPointers = append(taskInfoPointers, response)
+
+	}
+	return &http_model.GettasklinkListData{
+		TaskLinklist: taskInfoPointers,
+		Total:        conv.MustString(total, ""),
+	}, nil
+}
+
+func GetPreDataList(ctx context.Context, request http_model.PreDataListRequest) (*http_model.GetPreDataListData, error) {
+	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 total int64
+	if err := query.Count(&total).Error; err != nil {
+		return nil, err
+	}
+
+	// 添加分页逻辑
+	pageSize := request.PageSize
+	if pageSize == 0 {
+		pageSize = 10
+	}
+	pageNum := request.PageNum
+	if pageNum == 0 {
+		pageNum = 1
+	}
+	offset := (pageNum - 1) * pageSize
+	// 执行分页查询
+	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 {
+		taskinfo := &http_model.TaskInfo{
+			TaskId:             task.TaskID,
+			ProjectId:          task.ProjectID,
+			TalentId:           task.TalentID,
+			FansNum:            task.FansNum,
+			DraftFee:           task.DraftFee,
+			Voteavg:            task.VoteAvg,
+			FeeFrom:            task.FeeForm,
+			TaskStage:          task.TaskStage,
+			Commentavg:         task.CommitAvg,
+			CurrentDefaultType: task.CurDefaultType,
+			From:               determineFrom(task.SupplierId, task.SupplierStatus),
+		}
+		response := &http_model.Taskdatainfo{
+			Task: taskinfo,
+			DDl:  time.Now(), //截止时间再改
+		}
+		taskInfoPointers = append(taskInfoPointers, response)
+
+	}
+	return &http_model.GetPreDataListData{
+		TaskdataList: taskInfoPointers,
+		Total:        conv.MustString(total, ""),
+	}, nil
+}
+
+func GetDataList(ctx context.Context, request http_model.TaskDatalistRequest) (*http_model.GetTaskDatalistData, error) {
+	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 total int64
+	if err := query.Count(&total).Error; err != nil {
+		return nil, err
+	}
+
+	// 添加分页逻辑
+	pageSize := request.PageSize
+	if pageSize == 0 {
+		pageSize = 10
+	}
+	pageNum := request.PageNum
+	if pageNum == 0 {
+		pageNum = 1
+	}
+	offset := (pageNum - 1) * pageSize
+	// 执行分页查询
+	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 {
+		taskinfo := &http_model.TaskInfo{
+			TaskId:       task.TaskID,
+			ProjectId:    task.ProjectID,
+			TalentId:     task.TalentID,
+			FansNum:      task.FansNum,
+			DraftFee:     task.DraftFee,
+			FeeFrom:      task.FeeForm,
+			TaskStage:    task.TaskStage,
+			SettleAmount: task.SettleAmount,
+			From:         determineFrom(task.SupplierId, task.SupplierStatus),
+		}
+		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
+		}
+		response := &http_model.TaskDatainfo{
+			Task:          taskinfo,
+			DataId:        datainfo.DataID,
+			SubmitAt:      datainfo.SubmitAt,
+			AgreeAt:       datainfo.AgreeAt,
+			PhotoUrl:      datainfo.PhotoUrl,
+			PlayNumber:    datainfo.PlayNumber,
+			LikeNumber:    datainfo.LikeNumber,
+			CollectNumber: datainfo.CollectNumber,
+			CommentNumber: datainfo.CommentNumber,
+		}
+		taskInfoPointers = append(taskInfoPointers, response)
+
+	}
+	return &http_model.GetTaskDatalistData{
+		TaskDatalist: taskInfoPointers,
+		Total:        conv.MustString(total, ""),
+	}, nil
+}

+ 22 - 0
db/sketch.go

@@ -173,6 +173,28 @@ func AcceptSketch(ctx context.Context, TaskIDs []string) error {
 	return nil
 }
 
+// RejectSketch 不同意初稿
+func RejectSketch(ctx context.Context, TaskIDs []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": 0, "is_review": 1, "reject_at": time.Now()}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch db] Update YounggeeSketchInfo error,err:%+v", err)
+		return err
+	}
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{SketchStatus: 3}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch db] Update YoungeeTaskInfo error,err:%+v", err)
+		return err
+	}
+
+	err = db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{TaskStage: 9}).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[Sketch db] Update YoungeeTaskInfo error,err:%+v", err)
+		return err
+	}
+	return nil
+}
+
 // FindPhoto
 func FindSketchInfo(ctx context.Context, TaskID string) (*gorm_model.YounggeeSketchInfo, error) {
 	db := GetReadDB(ctx)

+ 15 - 1
db/task.go

@@ -156,7 +156,7 @@ func GetUnfinishedTaskNumber(ctx context.Context, projectID string) (*int64, err
 func SetTaskFinish(ctx context.Context, TaskIDs []string) error {
 	db := GetReadDB(ctx)
 	// 1. 修改任务表,更新任务阶段为已结案,结案方式为正常结束,数据状态为已通过,
-	err := db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{DataStatus: 5, TaskStage: 15, CompleteStatus: 2, WithdrawStatus: 2, CompleteDate: time.Now()}).Error
+	err := db.Model(gorm_model.YoungeeTaskInfo{}).Where("task_id in ?", TaskIDs).Updates(gorm_model.YoungeeTaskInfo{DataStatus: 5, TaskStage: 15, CompleteStatus: 2, WithdrawStatus: 2, CompleteDate: time.Now(), SettleStatus: 2}).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[Task db] Update YoungeeTaskInfo error,err:%+v", err)
 		return err
@@ -394,3 +394,17 @@ func UpdateTask(ctx context.Context, updateData gorm_model.YoungeeTaskInfo, tx *
 
 	return true, nil
 }
+
+func EndTask(ctx context.Context, req http_model.EndTaskRequest) error {
+	db := GetWriteDB(ctx)
+	updates := gorm_model.YoungeeTaskInfo{TaskStage: 17}
+
+	// 更新指定任务的 Stage
+	err := db.Model(&gorm_model.YoungeeTaskInfo{}).Where("task_id IN ?", req.TaskId).Updates(updates).Error
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[EndTask] error updating task stage, task_id: %s, err: %+v", req.TaskId, err)
+		return err
+	}
+
+	return nil
+}

+ 3 - 25
go.mod

@@ -11,22 +11,15 @@ require (
 )
 
 require (
-	github.com/BurntSushi/toml v0.3.1 // indirect
 	github.com/KyleBanks/depth v1.2.1 // indirect
 	github.com/PuerkitoBio/purell v1.1.1 // indirect
 	github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
 	github.com/agiledragon/gomonkey v2.0.2+incompatible // indirect
 	github.com/agiledragon/gomonkey/v2 v2.3.1 // indirect
 	github.com/cespare/xxhash/v2 v2.1.2 // indirect
-	github.com/chzyer/logex v1.1.10 // indirect
-	github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
-	github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect
-	github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
-	github.com/creack/pty v1.1.9 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
 	github.com/fsnotify/fsnotify v1.4.9 // indirect
-	github.com/ghodss/yaml v1.0.0 // indirect
 	github.com/gin-contrib/gzip v0.0.3 // indirect
 	github.com/gin-contrib/sse v0.1.0 // indirect
 	github.com/go-openapi/jsonpointer v0.19.5 // indirect
@@ -36,27 +29,18 @@ require (
 	github.com/go-playground/locales v0.14.0 // indirect
 	github.com/go-playground/universal-translator v0.18.0 // indirect
 	github.com/go-sql-driver/mysql v1.6.0 // indirect
-	github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect
 	github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
 	github.com/golang/protobuf v1.5.2 // indirect
 	github.com/google/go-cmp v0.5.5 // indirect
-	github.com/google/gofuzz v1.0.0 // indirect
-	github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
-	github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
-	github.com/hpcloud/tail v1.0.0 // indirect
-	github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.115 // indirect
-	github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 // indirect
+	github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.117 // indirect
 	github.com/issue9/assert/v2 v2.0.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/josharian/intern v1.0.0 // indirect
-	github.com/jtolds/gls v4.20.0+incompatible // indirect
 	github.com/kr/pretty v0.3.0 // indirect
-	github.com/kr/pty v1.1.1 // indirect
 	github.com/kr/text v0.2.0 // indirect
 	github.com/leodido/go-urn v1.2.1 // indirect
 	github.com/lin-jim-leon/kuaishou v0.3.0 // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
-	github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
 	github.com/nxadm/tail v1.4.8 // indirect
 	github.com/onsi/ginkgo v1.16.5 // indirect
 	github.com/onsi/ginkgo/v2 v2.0.0 // indirect
@@ -64,28 +48,23 @@ require (
 	github.com/otiai10/copy v1.7.0 // indirect
 	github.com/otiai10/curr v1.0.0 // indirect
 	github.com/otiai10/mint v1.3.3 // indirect
-	github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
 	github.com/rogpeppe/go-internal v1.8.0 // indirect
-	github.com/russross/blackfriday/v2 v2.0.1 // indirect
-	github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
-	github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
-	github.com/smartystreets/goconvey v1.6.4 // indirect
-	github.com/stretchr/objx v0.5.0 // indirect
 	github.com/stretchr/testify v1.8.4 // indirect
 	github.com/tidwall/match v1.1.1 // indirect
 	github.com/tidwall/pretty v1.2.0 // indirect
 	github.com/tjfoc/gmsm v1.4.1 // indirect
 	github.com/ugorji/go/codec v1.2.7 // indirect
+	go.mongodb.org/mongo-driver v1.12.0 // indirect
 	github.com/urfave/cli/v2 v2.3.0 // indirect
 	github.com/yuin/goldmark v1.4.13 // indirect
 	go.mongodb.org/mongo-driver v1.12.0 // indirect
 	golang.org/x/mod v0.8.0 // indirect
 	golang.org/x/sync v0.1.0 // indirect
-	golang.org/x/term v0.20.0 // indirect
 	golang.org/x/text v0.15.0 // indirect
 	golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
 	gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
+	gopkg.in/ini.v1 v1.67.0 // indirect
 	gopkg.in/errgo.v2 v2.1.0 // indirect
 	gopkg.in/fsnotify.v1 v1.4.7 // indirect
 	gopkg.in/ini.v1 v1.67.0 // indirect
@@ -111,7 +90,6 @@ require (
 	github.com/swaggo/gin-swagger v1.4.1
 	github.com/swaggo/swag v1.8.1
 	github.com/tidwall/gjson v1.14.1
-	github.com/ugorji/go v1.2.7 // indirect
 	github.com/wechatpay-apiv3/wechatpay-go v0.2.15
 	golang.org/x/crypto v0.23.0 // indirect
 	golang.org/x/net v0.21.0 // indirect

+ 2 - 0
go.sum

@@ -102,6 +102,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.115 h1:0i/6REsHzn1KCW7hF0H1XxXibzmY9CuGUkOX71yRNwY=
 github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.115/go.mod h1:JWz2ujO9X3oU5wb6kXp+DpR2UuDj2SldDbX8T0FSuhI=
+github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.117 h1:TUiy5+4+Q7AWNfvKjQQL6lXOylnp7HL47JyYJ+HgN+I=
+github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.117/go.mod h1:JWz2ujO9X3oU5wb6kXp+DpR2UuDj2SldDbX8T0FSuhI=
 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/issue9/assert/v2 v2.0.0 h1:vN7fr70g5ND6zM39tPZk/E4WCyjGMqApmFbujSTmEo0=
 github.com/issue9/assert/v2 v2.0.0/go.mod h1:rKr1eVGzXUhAo2af1thiKAhIA8uiSK9Wyn7mcZ4BzAg=

+ 61 - 0
handler/PassproTaskCoop.go

@@ -0,0 +1,61 @@
+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 WrapPassproTaskCoopHandler(ctx *gin.Context) {
+	handler := newPassproTaskCoopHandler(ctx)
+	baseRun(handler)
+}
+
+type PassproTaskCoop struct {
+	ctx  *gin.Context
+	req  *http_model.PassproTaskCoopRequest
+	resp *http_model.CommonResponse
+}
+
+func (c PassproTaskCoop) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c PassproTaskCoop) getResponse() interface{} {
+	return c.resp
+}
+
+func (c PassproTaskCoop) getRequest() interface{} {
+	return c.req
+}
+
+func (c PassproTaskCoop) run() {
+	data := http_model.PassproTaskCoopRequest{}
+	data = *c.req
+	//auth := middleware.GetSessionAuth(c.ctx)
+	//enterpriseID := auth.EnterpriseID
+	res, err := service.Task.PassCoop(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[PassproTaskCoop] call PassproTaskCoop err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("PassproTaskCoop fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功合作公开种草任务"
+	c.resp.Data = res
+}
+
+func (c PassproTaskCoop) checkParam() error {
+	return nil
+}
+
+func newPassproTaskCoopHandler(ctx *gin.Context) *PassproTaskCoop {
+	return &PassproTaskCoop{
+		ctx:  ctx,
+		req:  http_model.NewPassproTaskCoopRequest(),
+		resp: http_model.NewPassproTaskCoopResponse(),
+	}
+}

+ 56 - 0
handler/Prelinklist.go

@@ -0,0 +1,56 @@
+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 WrapPreLinkListHandler(ctx *gin.Context) {
+	handler := newPreLinkListHandler(ctx)
+	baseRun(handler)
+}
+
+func newPreLinkListHandler(ctx *gin.Context) *PreLinkListHandler {
+	return &PreLinkListHandler{
+		req:  http_model.NewPreLinkListRequest(),
+		resp: http_model.NewPreLinkListResponse(),
+		ctx:  ctx,
+	}
+}
+
+type PreLinkListHandler struct {
+	req  *http_model.PreLinkListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h PreLinkListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h PreLinkListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h PreLinkListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h PreLinkListHandler) run() {
+	data := http_model.PreLinkListRequest{}
+	data = *h.req
+	res, err := service.Task.GetPreLinkList(h.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetPreLinkList] call GetPreLinkList err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		logrus.Info("GetPreLinkList fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "成功查询链接待传列表"
+	h.resp.Data = res
+}
+
+func (h PreLinkListHandler) checkParam() error {
+	return nil
+}

+ 61 - 0
handler/RefuseproTaskCoop.go

@@ -0,0 +1,61 @@
+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 WrapRefuseproTaskCoopHandler(ctx *gin.Context) {
+	handler := newRefuseproTaskCoopHandler(ctx)
+	baseRun(handler)
+}
+
+type RefuseproTaskCoop struct {
+	ctx  *gin.Context
+	req  *http_model.RefuseproTaskCoopRequest
+	resp *http_model.CommonResponse
+}
+
+func (c RefuseproTaskCoop) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c RefuseproTaskCoop) getResponse() interface{} {
+	return c.resp
+}
+
+func (c RefuseproTaskCoop) getRequest() interface{} {
+	return c.req
+}
+
+func (c RefuseproTaskCoop) run() {
+	data := http_model.RefuseproTaskCoopRequest{}
+	data = *c.req
+	//auth := middleware.GetSessionAuth(c.ctx)
+	//enterpriseID := auth.EnterpriseID
+	res, err := service.Task.RefuseCoop(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[RefuseproTaskCoop] call RefuseproTaskCoop err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("RefuseproTaskCoop fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功拒绝种草任务"
+	c.resp.Data = res
+}
+
+func (c RefuseproTaskCoop) checkParam() error {
+	return nil
+}
+
+func newRefuseproTaskCoopHandler(ctx *gin.Context) *RefuseproTaskCoop {
+	return &RefuseproTaskCoop{
+		ctx:  ctx,
+		req:  http_model.NewRefuseproTaskCoopRequest(),
+		resp: http_model.NewRefuseproTaskCoopResponse(),
+	}
+}

+ 58 - 0
handler/endtask.go

@@ -0,0 +1,58 @@
+package handler
+
+import (
+	"github.com/gin-gonic/gin"
+	"github.com/sirupsen/logrus"
+	"youngee_b_api/consts"
+	"youngee_b_api/db"
+	"youngee_b_api/model/http_model"
+	"youngee_b_api/util"
+)
+
+func WrapEndTaskHandler(ctx *gin.Context) {
+	handler := newEndTaskHandler(ctx)
+	baseRun(handler)
+}
+
+type EndTask struct {
+	ctx  *gin.Context
+	req  *http_model.EndTaskRequest
+	resp *http_model.CommonResponse
+}
+
+func (c EndTask) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c EndTask) getResponse() interface{} {
+	return c.resp
+}
+
+func (c EndTask) getRequest() interface{} {
+	return c.req
+}
+
+func (c EndTask) run() {
+	data := http_model.EndTaskRequest{}
+	data = *c.req
+	err := db.EndTask(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetSecTaskList] call EndTask err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("GetSecTaskList fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功终止任务状态"
+}
+
+func (c EndTask) checkParam() error {
+	return nil
+}
+
+func newEndTaskHandler(ctx *gin.Context) *EndTask {
+	return &EndTask{
+		ctx:  ctx,
+		req:  http_model.NewEndTaskRequest(),
+		resp: http_model.NewEndTaskResponse(),
+	}
+}

+ 61 - 0
handler/executedata.go

@@ -0,0 +1,61 @@
+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 WrapExecuteDataHandler(ctx *gin.Context) {
+	handler := newExecuteDataHandler(ctx)
+	baseRun(handler)
+}
+
+type ExecuteData struct {
+	ctx  *gin.Context
+	req  *http_model.ExecuteDataRequest
+	resp *http_model.CommonResponse
+}
+
+func (c ExecuteData) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c ExecuteData) getResponse() interface{} {
+	return c.resp
+}
+
+func (c ExecuteData) getRequest() interface{} {
+	return c.req
+}
+
+func (c ExecuteData) run() {
+	data := http_model.ExecuteDataRequest{}
+	data = *c.req
+	//auth := middleware.GetSessionAuth(c.ctx)
+	//enterpriseID := auth.EnterpriseID
+	res, err := service.Project.ExecuteData(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[ExecuteData] call ExecuteData err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("ExecuteData fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功看数据"
+	c.resp.Data = res
+}
+
+func (c ExecuteData) checkParam() error {
+	return nil
+}
+
+func newExecuteDataHandler(ctx *gin.Context) *ExecuteData {
+	return &ExecuteData{
+		ctx:  ctx,
+		req:  http_model.NewExecuteDataRequest(),
+		resp: http_model.NewExecuteDataResponse(),
+	}
+}

+ 59 - 0
handler/gettasklist.go

@@ -0,0 +1,59 @@
+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 WrapGetTaskListHandler(ctx *gin.Context) {
+	handler := newGetTaskListHandler(ctx)
+	baseRun(handler)
+}
+
+type GetTaskList struct {
+	ctx  *gin.Context
+	req  *http_model.GetTaskListRequest
+	resp *http_model.CommonResponse
+}
+
+func (c GetTaskList) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c GetTaskList) getResponse() interface{} {
+	return c.resp
+}
+
+func (c GetTaskList) getRequest() interface{} {
+	return c.req
+}
+
+func (c GetTaskList) run() {
+	data := http_model.GetTaskListRequest{}
+	data = *c.req
+	res, err := service.Task.GetList(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetSecTaskList] call GetSecTaskList err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("GetSecTaskList fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功查询种草达人"
+	c.resp.Data = res
+}
+
+func (c GetTaskList) checkParam() error {
+	return nil
+}
+
+func newGetTaskListHandler(ctx *gin.Context) *GetTaskList {
+	return &GetTaskList{
+		ctx:  ctx,
+		req:  http_model.NewGetTaskListRequest(),
+		resp: http_model.NewGetTaskListResponse(),
+	}
+}

+ 56 - 0
handler/predatalist.go

@@ -0,0 +1,56 @@
+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 WrapPreDataListHandler(ctx *gin.Context) {
+	handler := newPreDataListHandler(ctx)
+	baseRun(handler)
+}
+
+func newPreDataListHandler(ctx *gin.Context) *PreDataListHandler {
+	return &PreDataListHandler{
+		req:  http_model.NewPreDataListRequest(),
+		resp: http_model.NewPreDataListResponse(),
+		ctx:  ctx,
+	}
+}
+
+type PreDataListHandler struct {
+	req  *http_model.PreDataListRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h PreDataListHandler) getRequest() interface{} {
+	return h.req
+}
+func (h PreDataListHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h PreDataListHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h PreDataListHandler) run() {
+	data := http_model.PreDataListRequest{}
+	data = *h.req
+	res, err := service.Task.GetPreDataList(h.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetPreDataList] call GetPreDataList err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		logrus.Info("GetPreDataList fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "成功查询数据待传列表"
+	h.resp.Data = res
+}
+
+func (h PreDataListHandler) checkParam() error {
+	return nil
+}

+ 59 - 0
handler/presketchlist.go

@@ -0,0 +1,59 @@
+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 WrapPreSketchListHandler(ctx *gin.Context) {
+	handler := newPreSketchListHandler(ctx)
+	baseRun(handler)
+}
+
+type PreSketchList struct {
+	ctx  *gin.Context
+	req  *http_model.PreSketchListRequest
+	resp *http_model.CommonResponse
+}
+
+func (c PreSketchList) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c PreSketchList) getResponse() interface{} {
+	return c.resp
+}
+
+func (c PreSketchList) getRequest() interface{} {
+	return c.req
+}
+
+func (c PreSketchList) run() {
+	data := http_model.PreSketchListRequest{}
+	data = *c.req
+	res, err := service.Task.GetPreSketchList(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetPreSketchList] call GetPreSketchList err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("GetPreSketchList fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功查询待传初稿"
+	c.resp.Data = res
+}
+
+func (c PreSketchList) checkParam() error {
+	return nil
+}
+
+func newPreSketchListHandler(ctx *gin.Context) *PreSketchList {
+	return &PreSketchList{
+		ctx:  ctx,
+		req:  http_model.NewPreSketchListRequest(),
+		resp: http_model.NewPreSketchListResponse(),
+	}
+}

+ 61 - 0
handler/project_data.go

@@ -0,0 +1,61 @@
+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 WrapDataHandler(ctx *gin.Context) {
+	handler := newDataHandler(ctx)
+	baseRun(handler)
+}
+
+type Data struct {
+	ctx  *gin.Context
+	req  *http_model.DataRequest
+	resp *http_model.CommonResponse
+}
+
+func (c Data) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c Data) getResponse() interface{} {
+	return c.resp
+}
+
+func (c Data) getRequest() interface{} {
+	return c.req
+}
+
+func (c Data) run() {
+	data := http_model.DataRequest{}
+	data = *c.req
+	//auth := middleware.GetSessionAuth(c.ctx)
+	//enterpriseID := auth.EnterpriseID
+	res, err := service.Project.ProjectData(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[Data] call Data err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("Data fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功看数据"
+	c.resp.Data = res
+}
+
+func (c Data) checkParam() error {
+	return nil
+}
+
+func newDataHandler(ctx *gin.Context) *Data {
+	return &Data{
+		ctx:  ctx,
+		req:  http_model.NewDataRequest(),
+		resp: http_model.NewDataResponse(),
+	}
+}

+ 1 - 1
handler/project_taskList.go

@@ -55,7 +55,7 @@ func (h *ProjectTaskListHandler) getResponse() interface{} {
 }
 func (h *ProjectTaskListHandler) run() {
 	conditions := pack.HttpProjectTaskRequestToCondition(h.req)
-	data, err := service.Project.GetProjectTaskList(h.ctx, h.req.ProjectId, h.req.PageSize, h.req.PageNum, conditions)
+	data, err := service.Project.GetProjectTaskList(h.ctx, h.req.PageSize, h.req.PageNum, conditions)
 	if err != nil {
 		logrus.WithContext(h.ctx).Errorf("[ProjectTaskListHandler] error GetProjectTaskList, err:%+v", err)
 		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)

+ 61 - 0
handler/projectdata.go

@@ -0,0 +1,61 @@
+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 WrapProjectDataHandler(ctx *gin.Context) {
+	handler := newProjectDataHandler(ctx)
+	baseRun(handler)
+}
+
+type ProjectData struct {
+	ctx  *gin.Context
+	req  *http_model.ProjectDataRequest
+	resp *http_model.CommonResponse
+}
+
+func (c ProjectData) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c ProjectData) getResponse() interface{} {
+	return c.resp
+}
+
+func (c ProjectData) getRequest() interface{} {
+	return c.req
+}
+
+func (c ProjectData) run() {
+	data := http_model.ProjectDataRequest{}
+	data = *c.req
+	//auth := middleware.GetSessionAuth(c.ctx)
+	//enterpriseID := auth.EnterpriseID
+	res, err := service.Project.Data(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[ProjectData] call ProjectData err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("ProjectData fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功看数据"
+	c.resp.Data = res
+}
+
+func (c ProjectData) checkParam() error {
+	return nil
+}
+
+func newProjectDataHandler(ctx *gin.Context) *ProjectData {
+	return &ProjectData{
+		ctx:  ctx,
+		req:  http_model.NewProjectDataRequest(),
+		resp: http_model.NewProjectDataResponse(),
+	}
+}

+ 60 - 0
handler/reject_data.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"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 WrapRejectDataHandler(ctx *gin.Context) {
+	handler := newRejectDataHandler(ctx)
+	baseRun(handler)
+}
+
+func newRejectDataHandler(ctx *gin.Context) *RejectDataHandler {
+	return &RejectDataHandler{
+		req:  http_model.NewRejectDataRequest(),
+		resp: http_model.NewRejectDataResponse(),
+		ctx:  ctx,
+	}
+}
+
+type RejectDataHandler struct {
+	req  *http_model.RejectDataRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *RejectDataHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *RejectDataHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *RejectDataHandler) getResponse() interface{} {
+	return h.resp
+}
+
+func (h *RejectDataHandler) run() {
+	data := http_model.RejectDataRequest{}
+	data = *h.req
+	res, err := service.Data.RejectData(h.ctx, data)
+	if err != nil {
+		logrus.Errorf("[ReviseOpinionHandler] call Create err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("CreateProject fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "成功拒绝数据"
+	h.resp.Data = res
+	h.resp.Data = data
+}
+
+func (h *RejectDataHandler) checkParam() error {
+	return nil
+}

+ 60 - 0
handler/reject_link.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"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 WrapRejectLinkHandler(ctx *gin.Context) {
+	handler := newRejectLinkHandler(ctx)
+	baseRun(handler)
+}
+
+func newRejectLinkHandler(ctx *gin.Context) *RejectLinkHandler {
+	return &RejectLinkHandler{
+		req:  http_model.NewRejectLinkRequest(),
+		resp: http_model.NewRejectLinkResponse(),
+		ctx:  ctx,
+	}
+}
+
+type RejectLinkHandler struct {
+	req  *http_model.RejectLinkRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *RejectLinkHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *RejectLinkHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *RejectLinkHandler) getResponse() interface{} {
+	return h.resp
+}
+
+func (h *RejectLinkHandler) run() {
+	data := http_model.RejectLinkRequest{}
+	data = *h.req
+	res, err := service.Link.RejectLink(h.ctx, data)
+	if err != nil {
+		logrus.Errorf("[ReviseOpinionHandler] call Create err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("CreateProject fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "成功拒绝链接"
+	h.resp.Data = res
+	h.resp.Data = data
+}
+
+func (h *RejectLinkHandler) checkParam() error {
+	return nil
+}

+ 58 - 0
handler/reject_sketch.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 WrapRejectSketchHandler(ctx *gin.Context) {
+	handler := newRejectSketchHandler(ctx)
+	baseRun(handler)
+}
+
+func newRejectSketchHandler(ctx *gin.Context) *RejectSketchHandler {
+	return &RejectSketchHandler{
+		req:  http_model.NewRejectSketchRequest(),
+		resp: http_model.NewRejectSketchResponse(),
+		ctx:  ctx,
+	}
+}
+
+type RejectSketchHandler struct {
+	req  *http_model.RejectSketchRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *RejectSketchHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *RejectSketchHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *RejectSketchHandler) getResponse() interface{} {
+	return h.resp
+}
+
+func (h *RejectSketchHandler) run() {
+	data := http_model.RejectSketchRequest{}
+	data = *h.req
+	res, err := service.Sketch.RejectSketch(h.ctx, data)
+	if err != nil {
+		logrus.Errorf("[ReviseOpinionHandler] call Create err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("CreateProject fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "成功拒绝初稿"
+	h.resp.Data = res
+	h.resp.Data = data
+}
+func (h *RejectSketchHandler) checkParam() error {
+	return nil
+}

+ 59 - 0
handler/taskdatalist.go

@@ -0,0 +1,59 @@
+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 WrapTaskDatalistHandler(ctx *gin.Context) {
+	handler := newTaskDatalistHandler(ctx)
+	baseRun(handler)
+}
+
+type TaskDatalist struct {
+	ctx  *gin.Context
+	req  *http_model.TaskDatalistRequest
+	resp *http_model.CommonResponse
+}
+
+func (c TaskDatalist) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c TaskDatalist) getResponse() interface{} {
+	return c.resp
+}
+
+func (c TaskDatalist) getRequest() interface{} {
+	return c.req
+}
+
+func (c TaskDatalist) run() {
+	data := http_model.TaskDatalistRequest{}
+	data = *c.req
+	res, err := service.Task.GetTaskDatalist(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetTaskDatalist] call GetTaskDatalist err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("GetTaskDatalist fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功查询数据待审列表"
+	c.resp.Data = res
+}
+
+func (c TaskDatalist) checkParam() error {
+	return nil
+}
+
+func newTaskDatalistHandler(ctx *gin.Context) *TaskDatalist {
+	return &TaskDatalist{
+		ctx:  ctx,
+		req:  http_model.NewTaskDatalistRequest(),
+		resp: http_model.NewTaskDatalistResponse(),
+	}
+}

+ 59 - 0
handler/tasklinklist.go

@@ -0,0 +1,59 @@
+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 WrapTaskLinklistHandler(ctx *gin.Context) {
+	handler := newTaskLinklistHandler(ctx)
+	baseRun(handler)
+}
+
+type TaskLinklist struct {
+	ctx  *gin.Context
+	req  *http_model.TaskLinklistRequest
+	resp *http_model.CommonResponse
+}
+
+func (c TaskLinklist) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c TaskLinklist) getResponse() interface{} {
+	return c.resp
+}
+
+func (c TaskLinklist) getRequest() interface{} {
+	return c.req
+}
+
+func (c TaskLinklist) run() {
+	data := http_model.TaskLinklistRequest{}
+	data = *c.req
+	res, err := service.Task.GetTaskLinklist(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetTaskLinklist] call GetTaskLinklist err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("GetTaskLinklist fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功查询链接待审列表"
+	c.resp.Data = res
+}
+
+func (c TaskLinklist) checkParam() error {
+	return nil
+}
+
+func newTaskLinklistHandler(ctx *gin.Context) *TaskLinklist {
+	return &TaskLinklist{
+		ctx:  ctx,
+		req:  http_model.NewTaskLinklistRequest(),
+		resp: http_model.NewTaskLinklistResponse(),
+	}
+}

+ 59 - 0
handler/tasksketchlist.go

@@ -0,0 +1,59 @@
+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 WrapTasksketchlistHandler(ctx *gin.Context) {
+	handler := newTasksketchlistHandler(ctx)
+	baseRun(handler)
+}
+
+type Tasksketchlist struct {
+	ctx  *gin.Context
+	req  *http_model.TasksketchlistRequest
+	resp *http_model.CommonResponse
+}
+
+func (c Tasksketchlist) getContext() *gin.Context {
+	return c.ctx
+}
+
+func (c Tasksketchlist) getResponse() interface{} {
+	return c.resp
+}
+
+func (c Tasksketchlist) getRequest() interface{} {
+	return c.req
+}
+
+func (c Tasksketchlist) run() {
+	data := http_model.TasksketchlistRequest{}
+	data = *c.req
+	res, err := service.Task.GetTasksketchlist(c.ctx, data)
+	if err != nil {
+		logrus.Errorf("[GetTasksketchList] call GetTasksketchList err:%+v\n", err)
+		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
+		logrus.Info("GetTasksketchList fail,req:%+v", c.req)
+		return
+	}
+	c.resp.Message = "成功查询初稿待审列表"
+	c.resp.Data = res
+}
+
+func (c Tasksketchlist) checkParam() error {
+	return nil
+}
+
+func newTasksketchlistHandler(ctx *gin.Context) *Tasksketchlist {
+	return &Tasksketchlist{
+		ctx:  ctx,
+		req:  http_model.NewTasksketchlistRequest(),
+		resp: http_model.NewTasksketchlistResponse(),
+	}
+}

+ 8 - 7
main.go

@@ -2,25 +2,26 @@ package main
 
 import (
 	"fmt"
-	"log"
+	"github.com/gin-gonic/gin"
 	"youngee_b_api/config"
 	_ "youngee_b_api/docs"
 	"youngee_b_api/route"
 	"youngee_b_api/service"
-
-	"github.com/gin-gonic/gin"
 )
 
 func main() {
 	r := gin.Default()
 	route.InitRoute(r)
 	config := config.Init()
+	// what?
 	mailConfig := "./config/mail.json"
 	service.SMTPMailServiceIstance.Init(mailConfig)
+
 	addr := fmt.Sprintf("%v:%v", config.Host, config.Port)
-	err := service.AutoTask()
-	if err != nil {
-		log.Println("service AutoTask error:", err)
-	}
+	//err := service.AutoTask()
+	//err := schedule.AutoTask()
+	//if err != nil {
+	//	log.Println("service AutoTask error:", err)
+	//}
 	r.Run(addr) // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
 }

+ 1 - 0
model/gorm_model/project_task.go

@@ -65,6 +65,7 @@ type YoungeeTaskInfo struct {
 	LinkMissingStatus      int       `gorm:"column:link_missing_status"`                  // 未发作品违约状态,0无违约,1有违约
 	DataMissingTime        time.Time `gorm:"column:data_missing_time"`                    // 未传数据违约时间
 	DataMissingStatus      int       `gorm:"column:data_missing_status"`                  // 未传数据违约状态,0无违约,1有违约
+	OpenId                 string    `gorm:"column:open_id"`                              // 达人报名的快手唯一标识
 }
 
 func (m *YoungeeTaskInfo) TableName() string {

+ 27 - 0
model/gorm_model/s_project.go

@@ -0,0 +1,27 @@
+package gorm_model
+
+// 服务商加入商单的种草任务
+type YounggeeSProjectInfo struct {
+	SProjectId          int     `gorm:"column:s_project_id;type:int(11);primary_key;AUTO_INCREMENT;comment:服务商种草任务ID" json:"s_project_id"`
+	ProjectId           string  `gorm:"column:project_id;type:varchar(255);comment:被服务商加入商单的原种草任务ID" json:"project_id"`
+	ProjectStatus       int     `gorm:"column:project_status;type:tinyint(4);comment:项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案" json:"project_status"`
+	ProjectType         int     `gorm:"column:project_type;type:tinyint(4);comment:种草任务类型,1为公开,2为定向" json:"project_type"`
+	ProjectName         string  `gorm:"column:project_name;type:varchar(50);comment:种草任务名称" json:"project_name"`
+	ProjectPlatform     int     `gorm:"column:project_platform;type:tinyint(4);comment:种草任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎" json:"project_platform"`
+	ProjectForm         int     `gorm:"column:project_form;type:tinyint(4);comment:任务形式,1-3分别代表商品寄拍、素材分发、虚拟产品测评" json:"project_form"`
+	ContentType         int     `gorm:"column:content_type;type:tinyint(4);comment:内容形式,1代表图文,2代表视频" json:"content_type"`
+	ShareCode           string  `gorm:"column:share_code;type:varchar(255);comment:分享码URL" json:"share_code"`
+	SupplierId          int     `gorm:"column:supplier_id;type:int(11);comment:服务商ID" json:"supplier_id"`
+	EnterpriseId        string  `gorm:"column:enterprise_id;type:varchar(255);comment:所属企业id" json:"enterprise_id"`
+	ApplyNum            int     `gorm:"column:apply_num;type:int(11);default:0;comment:报名人数;NOT NULL" json:"apply_num"`
+	RecruitNum          int     `gorm:"column:recruit_num;type:int(11);default:0;comment:已招募人数;NOT NULL" json:"recruit_num"`
+	SettleNum           int     `gorm:"column:settle_num;type:int(11);default:0;comment:已结算人数" json:"settle_num"`
+	SubAccountId        int     `gorm:"column:sub_account_id;type:int(11);default:0;comment:服务商子账号ID" json:"sub_account_id"`
+	ServiceCharge       float64 `gorm:"column:service_charge;type:decimal(10,2);default:0.00;comment:服务商预估可赚服务费" json:"service_charge"`
+	ServiceChargeActual float64 `gorm:"column:service_charge_actual;type:decimal(10,2);default:0.00;comment:服务商实际可赚服务费" json:"service_charge_actual"`
+	OperatorType        int     `gorm:"column:operator_type;type:int(11);default:0;comment:添加商单操作人类型,1为服务商主账号,2为服务商子账号" json:"operator_type"`
+}
+
+func (m *YounggeeSProjectInfo) TableName() string {
+	return "younggee_s_project_info"
+}

+ 20 - 0
model/gorm_model/supplier.go

@@ -0,0 +1,20 @@
+package gorm_model
+
+type Supplier struct {
+	SupplierID      int    `gorm:"column:supplier_id"`      // 服务商ID
+	SupplierName    string `gorm:"column:supplier_name"`    // 服务商名称
+	PhoneNumber     string `gorm:"column:phone_number"`     // 手机号
+	BusinessLicense string `gorm:"column:business_license"` // 营业执照url
+	USCI            string `gorm:"column:usci"`             // 统一社会信用代码
+	CompanyName     string `gorm:"column:company_name"`     // 公司名称
+	IDFront         string `gorm:"column:id_front"`         // 身份证人像面url
+	IDBack          string `gorm:"column:id_back"`          // 身份证国徽面url
+	IDNumber        string `gorm:"column:id_number"`        // 身份证号
+	Name            string `gorm:"column:name"`             // 姓名
+	UserID          int    `gorm:"column:user_id"`          // 用户表中的用户ID
+	SupplierType    int    `gorm:"column:supplier_type"`    // 服务商用户类型,1为个人PR,2为机构
+}
+
+func (Supplier) TableName() string {
+	return "younggee_supplier"
+}

+ 27 - 24
model/gorm_model/talent.go

@@ -6,30 +6,33 @@ import (
 )
 
 type YoungeeTalentInfo struct {
-	ID                string    `gorm:"column:id;primary_key"`               // 达人id
-	TalentWxOpenid    string    `gorm:"column:talent_wx_openid;NOT NULL"`    // 达人的微信openid
-	TalentWxNickname  string    `gorm:"column:talent_wx_nickname"`           // 达人的微信昵称
-	TalentWxNumber    string    `gorm:"column:talent_wx_number"`             // 达人微信号
-	Income            int64     `gorm:"column:income;default:0"`             // 收益总数
-	Withdrawing       int64     `gorm:"column:withdrawing;default:0"`        // 提现中金额
-	Canwithdraw       int64     `gorm:"column:canwithdraw;default:0"`        // 可提现金额
-	Withdrawed        int64     `gorm:"column:withdrawed;default:0"`         // 已提现金额
-	TalentGender      int       `gorm:"column:talent_gender"`                // 性别,0未知 1男 2女
-	TalentPhoneNumber string    `gorm:"column:talent_phone_number"`          // 电话号码
-	TalentAgeBracket  int       `gorm:"column:talent_age_bracket"`           // 年龄段,取tallent_age_bracket表id
-	TalentNationality int       `gorm:"column:talent_nationality"`           // 国籍,取tallent_nationality表id
-	VisitStoreRegion  int       `gorm:"column:visit_store_region"`           // 探店区域,取region_info表中的self_code
-	IsBindInfo        uint      `gorm:"column:is_bind_info;default:0"`       // 是否填写个人资料
-	IsBindLocation    uint      `gorm:"column:is_bind_location;default:0"`   // 是否绑定收货地址
-	IsBindBank        uint      `gorm:"column:is_bind_bank;default:0"`       // 是否绑定银行账户信息
-	InBlacklist       uint      `gorm:"column:in_blacklist;default:0"`       // 是否加入黑名单 0否 1是
-	TaskAll           int       `gorm:"column:task_all;default:0"`           // 任务总数
-	TaskApply         int       `gorm:"column:task_apply;default:0"`         // 报名任务数量
-	TaskExecute       int       `gorm:"column:task_execute;default:0"`       // 执行中任务数量
-	TaskEnd           int       `gorm:"column:task_end;default:0"`           // 结束任务数量
-	CreateDate        time.Time `gorm:"column:create_date;NOT NULL"`         // 创建时间
-	LastLoginDate     time.Time `gorm:"column:last_login_date;NOT NULL"`     // 最后登录时间
-	ApplyNum          int       `gorm:"column:apply_num;default:5;NOT NULL"` // 剩余申请次数(每天更新)
+	ID                string    `gorm:"column:id;primary_key;type:char(25)"`                                 // 达人id
+	TalentWxOpenid    string    `gorm:"column:talent_wx_openid;NOT NULL;type:char(128)"`                     // 达人的微信openid
+	Avatar            string    `gorm:"column:avatar;type:varchar(1000);NOT NULL"`                           // 头像
+	TalentWxNickname  string    `gorm:"column:talent_wx_nickname;type:varchar(30);DEFAULT NULL"`             // 达人的微信昵称
+	Income            float64   `gorm:"column:income;type:decimal(10,2);DEFAULT NULL"`                       // 收益总数
+	Withdrawing       float64   `gorm:"column:withdrawing;type:decimal(10,2);DEFAULT NULL"`                  // 提现中金额
+	Canwithdraw       float64   `gorm:"column:canwithdraw;type:decimal(10,2);DEFAULT NULL"`                  // 可提现金额
+	Withdrawed        float64   `gorm:"column:withdrawed;type:decimal(10,2);DEFAULT NULL"`                   // 已提现金额
+	Point             int       `gorm:"column:point;type:int;DEFAULT NULL"`                                  // 可用积分
+	TalentPhoneNumber string    `gorm:"column:talent_phone_number;type:char(20);DEFAULT NULL"`               // 电话号码
+	TalentAgeBracket  int8      `gorm:"column:talent_age_bracket;type:tinyint(1);DEFAULT NULL"`              // 年龄段
+	TalentNationality int8      `gorm:"column:talent_nationality;type:tinyint(1);DEFAULT NULL"`              // 国籍
+	VisitStoreRegion  int       `gorm:"column:visit_store_region;type:int;DEFAULT NULL"`                     // 探店区域
+	IsBindInfo        uint8     `gorm:"column:is_bind_info;type:tinyint(1);DEFAULT 0"`                       // 是否填写个人资料
+	IsBindAccount     uint8     `gorm:"column:is_bind_account;type:tinyint(1);DEFAULT 0"`                    // 是否绑定账号
+	IsBindLocation    uint8     `gorm:"column:is_bind_location;type:tinyint(1);DEFAULT 0"`                   // 是否绑定收货地址
+	IsBindBank        uint8     `gorm:"column:is_bind_bank;type:tinyint(1);DEFAULT 0"`                       // 是否绑定银行账户信息
+	InBlacklist       uint8     `gorm:"column:in_blacklist;type:tinyint(1);DEFAULT 0"`                       // 是否加入黑名单
+	TaskAll           int       `gorm:"column:task_all;type:int;DEFAULT 0"`                                  // 任务总数
+	TaskApply         int       `gorm:"column:task_apply;type:int;DEFAULT 0"`                                // 报名任务数量
+	TaskExecute       int       `gorm:"column:task_execute;type:int;DEFAULT 0"`                              // 执行中任务数量
+	TaskEnd           int       `gorm:"column:task_end;type:int;DEFAULT 0"`                                  // 结束任务数量
+	CreateDate        time.Time `gorm:"column:create_date;type:datetime;NOT NULL;DEFAULT CURRENT_TIMESTAMP"` // 创建时间
+	LastLoginDate     time.Time `gorm:"column:last_login_date;type:datetime;NOT NULL"`                       // 最后登录时间
+	ApplyNum          int       `gorm:"column:apply_num;type:int;NOT NULL;DEFAULT 5"`                        // 剩余申请次数
+	UserType          uint8     `gorm:"column:user_type;type:tinyint;DEFAULT 1"`                             // 用户类型
+	Sex               int8      `gorm:"column:sex;type:tinyint(1);DEFAULT NULL"`                             // 性别
 }
 
 func (m *YoungeeTalentInfo) TableName() string {

+ 14 - 0
model/http_model/EndTaskRequest.go

@@ -0,0 +1,14 @@
+package http_model
+
+type EndTaskRequest struct {
+	TaskId []int `json:"task_ids"`
+}
+
+func NewEndTaskRequest() *EndTaskRequest {
+	return new(EndTaskRequest)
+}
+
+func NewEndTaskResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	return resp
+}

+ 21 - 0
model/http_model/PassproTaskCoopRequest.go

@@ -0,0 +1,21 @@
+package http_model
+
+type PassproTaskCoopRequest struct {
+	ProjectId   string   `json:"project_id"`
+	TaskIds     []string `json:"task_ids"`
+	OperatorId  string   `json:"operator_id"`
+	OperateType int      `json:"operate_type"`
+}
+
+type PassproTaskCoopData struct {
+}
+
+func NewPassproTaskCoopRequest() *PassproTaskCoopRequest {
+	return new(PassproTaskCoopRequest)
+}
+
+func NewPassproTaskCoopResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(PassproTaskCoopData)
+	return resp
+}

+ 30 - 0
model/http_model/PreLinkList.go

@@ -0,0 +1,30 @@
+package http_model
+
+import "time"
+
+type PreLinkListRequest struct {
+	PageSize   int    `json:"page_size"`
+	PageNum    int    `json:"page_num"`
+	ProjectId  string `json:"project_id"`  // 项目ID
+	LinkStatus string `json:"link_status"` // 链接状态,11待传链接
+}
+
+type GetprelinkListData struct {
+	TasklinkList []*Tasklinkinfo `json:"task_list"`
+	Total        string          `json:"total"`
+}
+
+type Tasklinkinfo struct {
+	Task *TaskInfo `json:"task_info"`
+	DDl  time.Time `json:"ddl"` // 提交时间
+}
+
+func NewPreLinkListRequest() *PreLinkListRequest {
+	return new(PreLinkListRequest)
+}
+
+func NewPreLinkListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetSketchTaskListData)
+	return resp
+}

+ 20 - 0
model/http_model/RefuseproTaskCoopRequest.go

@@ -0,0 +1,20 @@
+package http_model
+
+type RefuseproTaskCoopRequest struct {
+	TaskIds     []string `json:"task_ids"`
+	OperatorId  string   `json:"operator_id"`
+	OperateType int      `json:"operate_type"`
+}
+
+type RefuseproTaskCoopData struct {
+}
+
+func NewRefuseproTaskCoopRequest() *RefuseproTaskCoopRequest {
+	return new(RefuseproTaskCoopRequest)
+}
+
+func NewRefuseproTaskCoopResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(RefuseproTaskCoopData)
+	return resp
+}

+ 4 - 4
model/http_model/data_accept.go

@@ -1,10 +1,10 @@
 package http_model
 
 type AcceptDataRequest struct {
-	Payment   float64 `json:"payment"`      //招募策略id
-	TaskIds   string  `json:"task_id_list"` //任务id列表
-	ProjectId string  `json:"project_id"`   //项目id
-	IsSpecial int     `json:"is_special"`   // 是否为专项项目
+	//Payment   float64 `json:"payment"`      //招募策略id
+	TaskIds   string `json:"task_id_list"` //任务id列表
+	ProjectId string `json:"project_id"`   //项目id
+	IsSpecial int    `json:"is_special"`   // 是否为专项项目
 }
 
 type AcceptDataData struct {

+ 39 - 0
model/http_model/executedata.go

@@ -0,0 +1,39 @@
+package http_model
+
+import "time"
+
+type ExecuteDataRequest struct {
+	ProjectId string `json:"project_id"`
+}
+
+type ExecuteDataResponse struct {
+	Excutetime      time.Time     `json:"recruit_time"`
+	PreSketchNum    int64         `json:"presketch_num"`
+	SketchNum       int64         `json:"sketch_num"`
+	SketchAccNum    int64         `json:"sketch_accept_num"`
+	AvgAccTime      time.Duration `json:"avg_acc_time"`
+	AvgCreTime      time.Duration `json:"avg_cre_time"`
+	FirAccRatio     float64       `json:"fir_acc_ratio"`
+	PreLinkNum      int64         `json:"pre_link_num"`
+	LinkNum         int64         `json:"link_num"`
+	LinkAccNum      int64         `json:"link_accept_num"`
+	AvgLinkAccTime  time.Duration `json:"avg_link_acc_time"`
+	AvgBackTime     time.Duration `json:"avg_back_time"`
+	FirAccLinkRatio float64       `json:"fir_acc_link_ratio"`
+	PreDataNum      int64         `json:"pre_data_num"`
+	DataNum         int64         `json:"data_num"`
+	DefaultNum      int64         `json:"default_num"`
+	DefaultRatio    float64       `json:"default_ratio"`
+	DraftFee        float64       `json:"draft_fee"`
+	Settle_Amount   float64       `json:"settle_amount"`
+}
+
+func NewExecuteDataRequest() *ExecuteDataRequest {
+	return new(ExecuteDataRequest)
+}
+
+func NewExecuteDataResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ExecuteDataResponse)
+	return resp
+}

+ 45 - 0
model/http_model/gettasklist.go

@@ -0,0 +1,45 @@
+package http_model
+
+import "time"
+
+type GetTaskListRequest struct {
+	PageSize  int    `json:"page_size"`
+	PageNum   int    `json:"page_num"`
+	FeeFrom   *int   `json:"fee_from,omitempty"`
+	Type      *int   `json:"type,omitempty"` // 查询类型,1、2分别表示达人来源于公海(商家端),服务商
+	ProjectId string `json:"project_id"`
+	CoopType  int    `json:"coop_type"` //1未处理,2同意,3拒绝
+}
+
+type GetTaskListData struct {
+	TaskList []*TaskInfo `json:"task_list"`
+	Total    string      `json:"total"`
+}
+
+type TaskInfo struct {
+	TaskId             string    `json:"task_id"`
+	ProjectId          string    `json:"project_id"`
+	TalentId           string    `json:"talent_id"`
+	FansNum            int       `json:"fans_num"`
+	DraftFee           float64   `json:"draft_fee"`
+	FeeFrom            int       `json:"fee_from"`
+	TaskStage          int       `json:"task_stage"`
+	Voteavg            int       `json:"vote_avg"`
+	Commentavg         int       `json:"commit_avg"`
+	CurrentDefaultType int       `json:"current_default_type"`
+	From               int       `json:"from"`   //1公海,2服务商
+	SType              int       `json:"s_type"` //1个人,2机构
+	Boperator          string    `json:"b_operator"`
+	SettleAmount       float64   `json:"settle_amount"`
+	CreateAt           time.Time `json:"create_time"`
+}
+
+func NewGetTaskListRequest() *GetTaskListRequest {
+	return new(GetTaskListRequest)
+}
+
+func NewGetTaskListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetTaskListData)
+	return resp
+}

+ 0 - 1
model/http_model/link_opinion.go

@@ -1,7 +1,6 @@
 package http_model
 
 type LinkOpinionRequest struct {
-	StrategyID  int64  `json:"strategy_id"`  //招募策略id
 	TaskID      string `json:"task_id"`      //任务-id
 	LinkOpinion string `json:"Link_opinion"` //链接审核意见
 }

+ 30 - 0
model/http_model/predatalist.go

@@ -0,0 +1,30 @@
+package http_model
+
+import "time"
+
+type PreDataListRequest struct {
+	PageSize   int    `json:"page_size"`
+	PageNum    int    `json:"page_num"`
+	ProjectId  string `json:"project_id"`  // 项目ID
+	DataStatus string `json:"data_status"` // 数据状态,13待传数据
+}
+
+type GetPreDataListData struct {
+	TaskdataList []*Taskdatainfo `json:"task_list"`
+	Total        string          `json:"total"`
+}
+
+type Taskdatainfo struct {
+	Task *TaskInfo `json:"task_info"`
+	DDl  time.Time `json:"ddl"` // 截止时间
+}
+
+func NewPreDataListRequest() *PreDataListRequest {
+	return new(PreDataListRequest)
+}
+
+func NewPreDataListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetSketchTaskListData)
+	return resp
+}

+ 30 - 0
model/http_model/presketchlist.go

@@ -0,0 +1,30 @@
+package http_model
+
+import "time"
+
+type PreSketchListRequest struct {
+	PageSize     int    `json:"page_size"`
+	PageNum      int    `json:"page_num"`
+	ProjectId    string `json:"project_id"`    // 项目ID
+	ScriptStatus int    `json:"script_status"` // 稿件状态,10初稿待审
+}
+
+type GetSketchTaskListData struct {
+	TasksketchList []*TasksketchInfo `json:"task_list"`
+	Total          string            `json:"total"`
+}
+
+type TasksketchInfo struct {
+	Task *TaskInfo `json:"task_info"`
+	DDl  time.Time `json:"ddl"`
+}
+
+func NewPreSketchListRequest() *PreSketchListRequest {
+	return new(PreSketchListRequest)
+}
+
+func NewPreSketchListResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetSketchTaskListData)
+	return resp
+}

+ 18 - 0
model/http_model/project_data_request.go

@@ -0,0 +1,18 @@
+package http_model
+
+type DataRequest struct {
+	ProjectId string `json:"project_id"`
+}
+
+type ProjectdataResponse struct {
+}
+
+func NewDataRequest() *DataRequest {
+	return new(DataRequest)
+}
+
+func NewDataResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ProjectdataResponse)
+	return resp
+}

+ 31 - 0
model/http_model/projectdatarequest.go

@@ -0,0 +1,31 @@
+package http_model
+
+import "time"
+
+type ProjectDataRequest struct {
+	ProjectId string `json:"project_id"`
+}
+
+type ProjectDataResponse struct {
+	RecruitDDl  time.Time      `json:"recruit_ddl"`
+	Recruittime time.Time      `json:"recruit_time"`
+	ApplyNum    int64          `json:"apply_num"`
+	AgreeNum    int64          `json:"agree_num"`
+	DraftFee    float64        `json:"draft_fee"`
+	AvgFansNum  int            `json:"avg_fans_num"`
+	FromType    float64        `json:"from_type"`
+	ManRatio    float64        `json:"man_ratio"`
+	FeeMap      map[int]int    `json:"fee_map"`
+	FansMap     map[int64]int  `json:"fans_map"`
+	DateStats   map[string]int `json:"date_stats"`
+}
+
+func NewProjectDataRequest() *ProjectDataRequest {
+	return new(ProjectDataRequest)
+}
+
+func NewProjectDataResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(ProjectDataResponse)
+	return resp
+}

+ 18 - 0
model/http_model/reject_data.go

@@ -0,0 +1,18 @@
+package http_model
+
+type RejectDataRequest struct {
+	TaskIds string `json:"task_id_list"` //任务id列表
+}
+
+type RejectDataData struct {
+	TaskIds []string `json:"task_id_list"` //任务id列表
+}
+
+func NewRejectDataRequest() *RejectDataRequest {
+	return new(RejectDataRequest)
+}
+func NewRejectDataResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(RejectDataData)
+	return resp
+}

+ 18 - 0
model/http_model/reject_link.go

@@ -0,0 +1,18 @@
+package http_model
+
+type RejectLinkRequest struct {
+	TaskIds string `json:"task_id_list"` //任务id列表
+}
+
+type RejectLinkData struct {
+	TaskIds []string `json:"task_id_list"` //任务id列表
+}
+
+func NewRejectLinkRequest() *RejectLinkRequest {
+	return new(RejectLinkRequest)
+}
+func NewRejectLinkResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(RejectLinkData)
+	return resp
+}

+ 0 - 1
model/http_model/sketch_opinion.go

@@ -1,7 +1,6 @@
 package http_model
 
 type SketchOpinionRequest struct {
-	StrategyID    int64  `json:"strategy_id"`    //招募策略id
 	TaskID        string `json:"task_id"`        //任务-id
 	SketchOpinion string `json:"sketch_opinion"` //初稿意见
 }

+ 18 - 0
model/http_model/sketch_reject.go

@@ -0,0 +1,18 @@
+package http_model
+
+type RejectSketchRequest struct {
+	TaskIds string `json:"task_id_list"` //任务id列表
+}
+
+type RejectSketchData struct {
+	TaskIds []string `json:"task_id_list"` //任务id列表
+}
+
+func NewRejectSketchRequest() *RejectSketchRequest {
+	return new(RejectSketchRequest)
+}
+func NewRejectSketchResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(RejectSketchData)
+	return resp
+}

+ 8 - 3
model/http_model/sktech_info.go

@@ -1,5 +1,7 @@
 package http_model
 
+import "time"
+
 type GetSketchInfoRequest struct {
 	TaskID string `json:"task_id"`
 }
@@ -11,9 +13,12 @@ type SketchPhotoInfo struct {
 }
 
 type GetSketchInfoData struct {
-	SketchPhotos []SketchPhotoInfo `json:"sketch_photos"` //初稿图片以及视频
-	Title        string            `json:"title"`
-	Content      string            `json:"content"`
+	SketchPhotos   []SketchPhotoInfo `json:"sketch_photos"` //初稿图片以及视频
+	Title          string            `json:"title"`
+	Content        string            `json:"content"`
+	Agreeat        time.Time         `json:"agree_at"`
+	Submitat       time.Time         `json:"submit_at"`
+	ReverseOpinion string            `json:"reverse_opinion"`
 }
 
 func NewGetSketchInfoRequest() *GetSketchInfoRequest {

+ 37 - 0
model/http_model/taskdatalist.go

@@ -0,0 +1,37 @@
+package http_model
+
+import "time"
+
+type TaskDatalistRequest struct {
+	PageSize   int    `json:"page_size"`
+	PageNum    int    `json:"page_num"`
+	ProjectId  string `json:"project_id"`  // 项目ID
+	DataStatus string `json:"data_status"` // 链接状态,14
+}
+
+type GetTaskDatalistData struct {
+	TaskDatalist []*TaskDatainfo `json:"task_list"`
+	Total        string          `json:"total"`
+}
+
+type TaskDatainfo struct {
+	Task          *TaskInfo `json:"task_info"`
+	SubmitAt      time.Time `json:"submit_at"` // 提交时间
+	AgreeAt       time.Time `json:"agree_at"`
+	DataId        int       `json:"data_id"` //初稿ID
+	PhotoUrl      string    `json:"photo_url"`
+	PlayNumber    int       `json:"play_number"`
+	LikeNumber    int       `json:"like_number"`
+	CommentNumber int       `json:"comment_number"`
+	CollectNumber int       `json:"collect_number"`
+}
+
+func NewTaskDatalistRequest() *TaskDatalistRequest {
+	return new(TaskDatalistRequest)
+}
+
+func NewTaskDatalistResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetSketchTaskListData)
+	return resp
+}

+ 34 - 0
model/http_model/tasklinklist.go

@@ -0,0 +1,34 @@
+package http_model
+
+import "time"
+
+type TaskLinklistRequest struct {
+	PageSize   int    `json:"page_size"`
+	PageNum    int    `json:"page_num"`
+	ProjectId  string `json:"project_id"`  // 项目ID
+	LinkStatus string `json:"link_status"` // 链接状态,12待审
+}
+
+type GettasklinkListData struct {
+	TaskLinklist []*TaskLinkinfo `json:"task_list"`
+	Total        string          `json:"total"`
+}
+
+type TaskLinkinfo struct {
+	Task     *TaskInfo `json:"task_info"`
+	SubmitAt time.Time `json:"submit_at"` // 提交时间
+	AgreeAt  time.Time `json:"agree_at"`
+	LinkId   int       `json:"link_id"` //初稿ID
+	LinkUrl  string    `json:"link_url"`
+	PhotoUrl string    `json:"photo_url"`
+}
+
+func NewTaskLinklistRequest() *TaskLinklistRequest {
+	return new(TaskLinklistRequest)
+}
+
+func NewTaskLinklistResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetSketchTaskListData)
+	return resp
+}

+ 32 - 0
model/http_model/tasksketchlist.go

@@ -0,0 +1,32 @@
+package http_model
+
+import "time"
+
+type TasksketchlistRequest struct {
+	PageSize     int    `json:"page_size"`
+	PageNum      int    `json:"page_num"`
+	ProjectId    string `json:"project_id"`    // 项目ID
+	ScriptStatus int    `json:"script_status"` // 稿件状态
+}
+
+type GetsketchtaskListData struct {
+	TasksketchList []*Tasksketchinfo `json:"task_list"`
+	Total          string            `json:"total"`
+}
+
+type Tasksketchinfo struct {
+	Task     *TaskInfo `json:"task_info"`
+	SubmitAt time.Time `json:"submit_at"` // 提交时间
+	AgreeAt  time.Time `json:"agree_at"`
+	SketchId int       `json:"sketch_id"` //初稿ID
+}
+
+func NewTasksketchlistRequest() *TasksketchlistRequest {
+	return new(TasksketchlistRequest)
+}
+
+func NewTasksketchlistResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(GetSketchTaskListData)
+	return resp
+}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels