Xingyu Xian 3 недель назад
Родитель
Сommit
a4a6a4bd63

+ 3 - 2
db/s_project.go

@@ -135,6 +135,7 @@ func UpdateSProjectStatus(ctx context.Context, newSProject *http_model.SpecialSP
 // CreateSpecialStrategy 创建定向种草任务服务商修改后的招募策略
 func CreateSpecialStrategy(ctx context.Context, recruitStrategy []gorm_model.RecruitStrategy) error {
 	db := GetWriteDB(ctx)
+	fmt.Println("CreateSpecialStrategy", recruitStrategy)
 	err := db.Create(&recruitStrategy).Error
 	if err != nil {
 		return err
@@ -149,8 +150,8 @@ func UpdateSProjectStrategyStatus(ctx context.Context, req *http_model.SpecialAd
 	var createStrategyId int
 	var createStrategyType int
 	if req.SubAccountId == 0 {
-		createStrategyId = 1
-		createStrategyType = req.SupplierId
+		createStrategyId = req.SupplierId
+		createStrategyType = 1
 	} else {
 		createStrategyType = 2
 		createStrategyId = req.SubAccountId

+ 4 - 3
handler/agree_enterprise_cooperate.go

@@ -37,11 +37,12 @@ func (h *AgreeCooperateHandler) getResponse() interface{} {
 func (h *AgreeCooperateHandler) run() {
 	err := service.Cooperate.AgreeEnterpriseCooperate(h.ctx, h.req.CooperateId)
 	if err != nil {
-		h.resp.Data = err
+		h.resp.Status = 40000
 		h.resp.Message = "同意合作邀约失败"
-	} else {
-		h.resp.Message = "同意合作邀约成功"
+		return
 	}
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
 }
 func (h *AgreeCooperateHandler) checkParam() error {
 	return nil

+ 8 - 5
handler/enterprise_supplier_cooperate.go

@@ -1,7 +1,6 @@
 package handler
 
 import (
-	"fmt"
 	"github.com/gin-gonic/gin"
 	"youngee_b_api/model/http_model"
 	"youngee_b_api/service"
@@ -29,20 +28,24 @@ type EnterpriseListHandler struct {
 func (h *EnterpriseListHandler) getRequest() interface{} {
 	return h.req
 }
+
 func (h *EnterpriseListHandler) getContext() *gin.Context {
 	return h.ctx
 }
+
 func (h *EnterpriseListHandler) getResponse() interface{} {
 	return h.resp
 }
+
 func (h *EnterpriseListHandler) run() {
 	enterpriseListData, err := service.Cooperate.GetEnterpriseInfoBySupplierId(h.ctx, h.req)
 	if err != nil {
-		h.resp.Message = "查询失败"
-		h.resp.Data = err
-		fmt.Println(err)
+		h.resp.Status = 40000
+		h.resp.Message = err.Error()
+		return
 	}
-	h.resp.Message = "成功查询商家合作信息"
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
 	h.resp.Data = enterpriseListData
 }
 func (h *EnterpriseListHandler) checkParam() error {

+ 6 - 4
handler/reject_enterprise_cooperate.go

@@ -37,11 +37,13 @@ func (h *RejectCooperateHandler) getResponse() interface{} {
 func (h *RejectCooperateHandler) run() {
 	err := service.Cooperate.RejectEnterpriseCooperate(h.ctx, h.req.CooperateId)
 	if err != nil {
-		h.resp.Data = err
-		h.resp.Message = "拒绝合作邀约失败"
-	} else {
-		h.resp.Message = "拒绝合作邀约成功"
+		h.resp.Status = 40000
+		h.resp.Message = err.Error()
+		return
 	}
+	h.resp.Status = 20000
+	h.resp.Message = "ok"
+
 }
 func (h *RejectCooperateHandler) checkParam() error {
 	return nil

+ 3 - 0
model/http_model/s_special_project_list.go

@@ -10,6 +10,8 @@ type SpecialSProjectListData struct {
 type SpecialSProjectResponse struct {
 	SProjectId         int                   `json:"s_project_id"`         // 服务商加入商单后的种草任务ID
 	ProjectId          string                `json:"project_id"`           // 服务商加入商单前的种草任务ID
+	ProjectName        string                `json:"project_name"`         // 种草任务名称
+	ProjectStatus      int                   `json:"project_status"`       // 种草任务状态
 	ProjectPlatform    int64                 `json:"project_platform"`     // 种草任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 	ProjectForm        int64                 `json:"project_form"`         // 任务形式,1-3分别代表商品寄拍、素材分发、虚拟产品测评
 	ContentType        int64                 `json:"content_type"`         // 内容形式,1代表图文,2代表视频
@@ -31,6 +33,7 @@ type SpecialSProjectResponse struct {
 	RecruitNum         int                   `json:"recruit_num"`          // 已招募人数
 	SettleNum          int                   `json:"settle_num"`           // 已结算人数
 	ShareCode          string                `json:"share_code"`           // 分享码url
+	AddToListOperate   string                `json:"add_to_list_operate"`  // 接受商单操作人
 }
 
 func NewSpecialSProjectListRequest() *SpecialProjectListRequest {

+ 21 - 6
model/http_model/special_add_strategy.go

@@ -1,12 +1,27 @@
 package http_model
 
-import "youngee_b_api/model/gorm_model"
-
 type SpecialAddStrategyRequest struct {
-	SProjectId       int                          `json:"s_project_id"`      // 服务商种草任务ID
-	RecruitStrategys []gorm_model.RecruitStrategy `json:"recruit_strategys"` // 招募策略
-	SubAccountId     int                          `json:"sub_account_id"`    // 子账号ID
-	SupplierId       int                          `json:"supplier_id"`       // 服务商ID
+	SProjectId       int                     `json:"s_project_id"`      // 服务商种草任务ID
+	RecruitStrategys []ChangeRecruitStrategy `json:"recruit_strategys"` // 招募策略
+	SubAccountId     int                     `json:"sub_account_id"`    // 子账号ID
+	SupplierId       int                     `json:"supplier_id"`       // 服务商ID
+}
+
+type ChangeRecruitStrategy struct {
+	FeeForm                int64   `json:"fee_form"`
+	StrategyID             int64   `json:"strategy_id"`
+	FollowersLow           int64   `json:"followers_low"`
+	FollowersUp            int64   `json:"followers_up"`
+	RecruitNumber          int64   `json:"recruit_number"`
+	Offer                  float64 `json:"offer"`
+	TOffer                 float64 `json:"t_offer"`
+	ProjectID              string  `json:"project_id"`
+	ServiceCharge          float64 `json:"service_charge"`
+	ServiceRate            int     `json:"service_rate"`
+	SProjectId             int     `json:"s_project_id"`
+	SLocalId               int     `json:"s_local_id"`
+	StrategyType           int     `json:"strategy_type"`
+	QuoteRecruitStrategyId int     `json:"quote_recruit_strategy_id"`
 }
 
 func NewSpecialAddStrategyRequest() *SpecialAddStrategyRequest {

+ 3 - 0
model/http_model/special_project_list.go

@@ -22,6 +22,9 @@ type SpecialProjectListData struct {
 
 type SpecialProjectResponse struct {
 	SProjectId         int                   `json:"s_project_id"`         // 服务商加入商单后的种草任务ID
+	ProjectId          string                `json:"project_id"`           // 服务商加入商单前的种草任务ID
+	ProjectStatus      int                   `json:"project_status"`       // 种草任务状态
+	ProjectName        string                `json:"project_name"`         // 种草任务名称
 	ProjectPlatform    int64                 `json:"project_platform"`     // 种草任务平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 	ProjectForm        int64                 `json:"project_form"`         // 任务形式,1-3分别代表商品寄拍、素材分发、虚拟产品测评
 	ContentType        int64                 `json:"content_type"`         // 内容形式,1代表图文,2代表视频

+ 2 - 2
service/local_life.go

@@ -238,7 +238,7 @@ func (*localLife) ShowLocalLife(ctx context.Context, req *http_model.ShowLocalRe
 		}
 
 		// 2.3. 团购信息
-		fmt.Println(localData.TeamBuyingId)
+		// fmt.Println(localData.TeamBuyingId)
 		teamInfo, teamErr := db.FindTeamById(ctx, localData.TeamBuyingId)
 		if teamErr != nil {
 			return nil, teamErr
@@ -276,7 +276,7 @@ func (*localLife) ShowLocalLife(ctx context.Context, req *http_model.ShowLocalRe
 			}
 			result = append(result, num)
 		}
-		fmt.Println(result)
+		// fmt.Println(result)
 
 		talentTypeCategory, talentTypeErr := db.GetTalentCategory(ctx, result)
 		if talentTypeErr != nil {

+ 5 - 4
service/project.go

@@ -444,12 +444,14 @@ func (*project) GetFullProjectList(ctx context.Context, pageSize, pageNum int32,
 			} else {
 				returnList.Total--
 			}
-		} else if projectInfo.AddToListStatus == 2 {
+		} else if addToListStatus == 2 {
 			if projectInfo.AddToListStatus == 2 {
 				returnList.FullProjectPreview = append(returnList.FullProjectPreview, projectInfo)
 			} else {
 				returnList.Total--
 			}
+		} else {
+			returnList.FullProjectPreview = append(returnList.FullProjectPreview, projectInfo)
 		}
 	}
 
@@ -771,11 +773,12 @@ func (*project) GetSpecialProjectTaskList(ctx context.Context, projectID string,
 // ShowTaskProgress ToDo
 // ShowTaskProgress 展示种草子任务进度
 func (p *project) ShowTaskProgress(ctx *gin.Context, req http_model.ShowTaskProgressRequest) (*http_model.ShowTaskProgressData, error) {
+
 	// 1. 初始化返回数据结构体
 	var taskProgressData *http_model.ShowTaskProgressData
 	taskProgressData = &http_model.ShowTaskProgressData{}
 
-	// 1. 保存日志
+	// 1. 获取日志信息
 	taskLogs, total, taskLogsErr := db.GetTaskLogsByTaskId(ctx, req.TaskId)
 	if taskLogsErr != nil {
 		return nil, taskLogsErr
@@ -853,9 +856,7 @@ func (p *project) ShowTaskProgress(ctx *gin.Context, req http_model.ShowTaskProg
 			taskProgressData.CancelTime = taskInfo.CancelTime
 			taskProgressData.CancelReason = taskInfo.CancelReason
 		}
-
 		return taskProgressData, nil
-
 	*/
 }
 

+ 52 - 7
service/s_project.go

@@ -361,6 +361,9 @@ func (*sProject) GetSpecialProjectList(ctx context.Context, supplierId int, page
 		for _, specialProject := range specialProjects {
 			var currSpecialProject *http_model.SpecialProjectResponse
 			currSpecialProject = &http_model.SpecialProjectResponse{}
+			currSpecialProject.ProjectId = specialProject.ProjectId
+			currSpecialProject.ProjectName = specialProject.ProjectName
+			currSpecialProject.ProjectStatus = int(specialProject.ProjectStatus)
 			currSpecialProject.SProjectId = specialProject.SProjectId
 			currSpecialProject.ProjectPlatform = specialProject.ProjectPlatform
 			currSpecialProject.ProjectForm = specialProject.ProjectForm
@@ -440,6 +443,9 @@ func (*sProject) GetSpecialSProjectList(ctx context.Context, supplierId int, pag
 		for _, specialProject := range specialProjects {
 			var currSpecialProject *http_model.SpecialSProjectResponse
 			currSpecialProject = &http_model.SpecialSProjectResponse{}
+			currSpecialProject.ProjectId = specialProject.ProjectId
+			currSpecialProject.ProjectName = specialProject.ProjectName
+			currSpecialProject.ProjectStatus = int(specialProject.ProjectStatus)
 			currSpecialProject.SProjectId = specialProject.SProjectId
 			currSpecialProject.ProjectPlatform = specialProject.ProjectPlatform
 			currSpecialProject.ProjectForm = specialProject.ProjectForm
@@ -449,7 +455,25 @@ func (*sProject) GetSpecialSProjectList(ctx context.Context, supplierId int, pag
 			currSpecialProject.ApplyNum = specialProject.ApplyNum
 			currSpecialProject.RecruitNum = specialProject.RecruitNum
 			currSpecialProject.SettleNum = specialProject.SettleNum
-			currSpecialProject.ProjectId = specialProject.ProjectId
+
+			// 加入商单操作人信息
+			if specialProject.OperatorType == 1 {
+				supplierInfo, supplierErr := db.GetSupplierById(ctx, supplierId)
+				if supplierErr != nil {
+					return nil, supplierErr
+				}
+				if supplierInfo != nil {
+					currSpecialProject.AddToListOperate = supplierInfo.SupplierName
+				}
+			} else if specialProject.OperatorType == 2 {
+				subAccountInfo, subAccountErr := db.FindSubAccountById(ctx, specialProject.SubAccountId)
+				if subAccountErr != nil {
+					return nil, subAccountErr
+				}
+				if subAccountInfo != nil {
+					currSpecialProject.AddToListOperate = subAccountInfo.SubAccountName
+				}
+			}
 
 			// 2. 定向种草任务商品信息填入
 			// 2.1. 商品信息
@@ -523,15 +547,36 @@ func (*sProject) UpdateSProject(ctx context.Context, request *http_model.Special
 func (*sProject) CreateSpecialStrategy(ctx context.Context, request *http_model.SpecialAddStrategyRequest) error {
 	// 1. 添加服务商招募策略
 	// 1.1. 整理数据
+	var recruitStrategys []gorm_model.RecruitStrategy
 	for _, strategy := range request.RecruitStrategys {
+		var recruitStrategy *gorm_model.RecruitStrategy
+		recruitStrategy = &gorm_model.RecruitStrategy{}
+
+		recruitStrategy.StrategyID = strategy.StrategyID
+		recruitStrategy.QuoteRecruitStrategyId = strategy.QuoteRecruitStrategyId
+		recruitStrategy.FeeForm = strategy.FeeForm
+		recruitStrategy.StrategyID = strategy.StrategyID
+		recruitStrategy.FollowersLow = strategy.FollowersLow
+		recruitStrategy.FollowersUp = strategy.FollowersUp
+		recruitStrategy.RecruitNumber = strategy.RecruitNumber
+		recruitStrategy.Offer = strategy.Offer
+		recruitStrategy.ServiceCharge = strategy.ServiceCharge
+		recruitStrategy.StrategyType = 2
+		recruitStrategy.QuoteRecruitStrategyId = strategy.QuoteRecruitStrategyId
+
 		// 一口价需要计算服务费率和达人所见报价
-		strategy.ServiceRate = int(strategy.ServiceCharge / strategy.Offer)
-		strategy.TOffer = strategy.Offer - strategy.ServiceCharge
-		strategy.ProjectID = "0"
-		strategy.SProjectId = request.SProjectId
-		strategy.QuoteRecruitStrategyId = int(strategy.RecruitStrategyID)
+		if strategy.FeeForm == 3 {
+			recruitStrategy.ServiceRate = strategy.ServiceRate
+		} else {
+			recruitStrategy.ServiceRate = int(strategy.ServiceCharge / strategy.Offer)
+		}
+		recruitStrategy.TOffer = strategy.Offer - strategy.ServiceCharge
+		recruitStrategy.ProjectID = "0"
+		recruitStrategy.SProjectId = request.SProjectId
+		recruitStrategys = append(recruitStrategys, *recruitStrategy)
 	}
-	createErr := db.CreateSpecialStrategy(ctx, request.RecruitStrategys)
+
+	createErr := db.CreateSpecialStrategy(ctx, recruitStrategys)
 	if createErr != nil {
 		return createErr
 	}