|
@@ -109,7 +109,16 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
|
|
// build
|
|
// build
|
|
if newProject.ProjectType == int64(1) {
|
|
if newProject.ProjectType == int64(1) {
|
|
recruitStrategys := []gorm_model.RecruitStrategy{}
|
|
recruitStrategys := []gorm_model.RecruitStrategy{}
|
|
- for _, strategy := range newProject.RecruitStrategys {
|
|
|
|
|
|
+ for _, strategy := range newProject.RecruitStrategys { // 查询对应定价策略
|
|
|
|
+ pricingStrategy, err := db.GetPricingStrategy(ctx, strategy.FollowersLow, strategy.FeeForm, newProject.ProjectPlatform)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ // fmt.Printf(" %+v 对应定价策略 %+v", strategy, pricingStrategy)
|
|
|
|
+ // 根据定价策略计算达人所见报价
|
|
|
|
+ if strategy.FeeForm == 2 {
|
|
|
|
+ strategy.TOffer = strategy.Offer * (1 - conv.MustFloat64(pricingStrategy.ServiceRate)/1000)
|
|
|
|
+ }
|
|
recruitStrategy := gorm_model.RecruitStrategy{
|
|
recruitStrategy := gorm_model.RecruitStrategy{
|
|
FeeForm: strategy.FeeForm,
|
|
FeeForm: strategy.FeeForm,
|
|
StrategyID: strategy.StrategyID,
|
|
StrategyID: strategy.StrategyID,
|
|
@@ -117,6 +126,7 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
|
|
FollowersUp: strategy.FollowersUp,
|
|
FollowersUp: strategy.FollowersUp,
|
|
RecruitNumber: strategy.RecruitNumber,
|
|
RecruitNumber: strategy.RecruitNumber,
|
|
Offer: strategy.Offer,
|
|
Offer: strategy.Offer,
|
|
|
|
+ TOffer: strategy.TOffer,
|
|
ProjectID: *projectID,
|
|
ProjectID: *projectID,
|
|
}
|
|
}
|
|
recruitStrategys = append(recruitStrategys, recruitStrategy)
|
|
recruitStrategys = append(recruitStrategys, recruitStrategy)
|
|
@@ -134,6 +144,17 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
|
|
}
|
|
}
|
|
func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectRequest, enterpriseID int64) (*http_model.UpdateProjectData, error) {
|
|
func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectRequest, enterpriseID int64) (*http_model.UpdateProjectData, error) {
|
|
fmt.Println("newproject:", newProject)
|
|
fmt.Println("newproject:", newProject)
|
|
|
|
+ oldProject, err3 := db.GetProjectDetail(ctx, conv.MustInt64(newProject.ProjectID))
|
|
|
|
+ if err3 != nil {
|
|
|
|
+ return nil, err3
|
|
|
|
+ }
|
|
|
|
+ feeFrom := []string{}
|
|
|
|
+ for _, strategy := range newProject.RecruitStrategys {
|
|
|
|
+ //if strategy.StrategyID
|
|
|
|
+ feeFrom = append(feeFrom, strconv.FormatInt(strategy.FeeForm, 10))
|
|
|
|
+ //feeForm += string(strategy.StrategyID)
|
|
|
|
+ }
|
|
|
|
+ feeFroms := strings.Join(feeFrom, ",")
|
|
project := gorm_model.ProjectInfo{
|
|
project := gorm_model.ProjectInfo{
|
|
ProjectID: conv.MustInt64(newProject.ProjectID),
|
|
ProjectID: conv.MustInt64(newProject.ProjectID),
|
|
RecruitDdl: &newProject.RecruitDdl,
|
|
RecruitDdl: &newProject.RecruitDdl,
|
|
@@ -143,6 +164,7 @@ func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectR
|
|
ProjectForm: conv.MustInt64(newProject.ProjectForm),
|
|
ProjectForm: conv.MustInt64(newProject.ProjectForm),
|
|
EnterpriseID: enterpriseID,
|
|
EnterpriseID: enterpriseID,
|
|
ProjectStatus: conv.MustInt64(newProject.ProjectStatus),
|
|
ProjectStatus: conv.MustInt64(newProject.ProjectStatus),
|
|
|
|
+ FeeForm: feeFroms,
|
|
}
|
|
}
|
|
projectID, err := db.UpdateProject(ctx, project)
|
|
projectID, err := db.UpdateProject(ctx, project)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -154,7 +176,7 @@ func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectR
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
fmt.Printf("照片:\t %+v", newProject.ProjectPhotos)
|
|
fmt.Printf("照片:\t %+v", newProject.ProjectPhotos)
|
|
- if newProject.ProjectPhotos != nil {
|
|
|
|
|
|
+ if len(newProject.ProjectPhotos) != 0 {
|
|
// 新增图片
|
|
// 新增图片
|
|
projectPhotos := []gorm_model.ProjectPhoto{}
|
|
projectPhotos := []gorm_model.ProjectPhoto{}
|
|
for _, photo := range newProject.ProjectPhotos {
|
|
for _, photo := range newProject.ProjectPhotos {
|
|
@@ -180,13 +202,24 @@ func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectR
|
|
// 新增策略
|
|
// 新增策略
|
|
RecruitStrategys := []gorm_model.RecruitStrategy{}
|
|
RecruitStrategys := []gorm_model.RecruitStrategy{}
|
|
for _, Strategy := range newProject.RecruitStrategys {
|
|
for _, Strategy := range newProject.RecruitStrategys {
|
|
|
|
+ // 查询对应定价策略
|
|
|
|
+ pricingStrategy, err := db.GetPricingStrategy(ctx, Strategy.FollowersLow, Strategy.FeeForm, oldProject.ProjectPlatform)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ // 根据定价策略计算达人所见报价
|
|
|
|
+ if Strategy.FeeForm == 2 {
|
|
|
|
+ Strategy.TOffer = Strategy.Offer * (1 - conv.MustFloat64(pricingStrategy.ServiceRate)/1000)
|
|
|
|
+ }
|
|
|
|
+
|
|
RecruitStrategy := gorm_model.RecruitStrategy{
|
|
RecruitStrategy := gorm_model.RecruitStrategy{
|
|
FeeForm: conv.MustInt64(Strategy.FeeForm),
|
|
FeeForm: conv.MustInt64(Strategy.FeeForm),
|
|
StrategyID: conv.MustInt64(Strategy.StrategyID),
|
|
StrategyID: conv.MustInt64(Strategy.StrategyID),
|
|
FollowersLow: conv.MustInt64(Strategy.FollowersLow),
|
|
FollowersLow: conv.MustInt64(Strategy.FollowersLow),
|
|
FollowersUp: conv.MustInt64(Strategy.FollowersUp),
|
|
FollowersUp: conv.MustInt64(Strategy.FollowersUp),
|
|
RecruitNumber: conv.MustInt64(Strategy.RecruitNumber),
|
|
RecruitNumber: conv.MustInt64(Strategy.RecruitNumber),
|
|
- Offer: conv.MustInt64(Strategy.Offer),
|
|
|
|
|
|
+ Offer: Strategy.Offer,
|
|
|
|
+ TOffer: Strategy.TOffer,
|
|
ProjectID: project.ProjectID,
|
|
ProjectID: project.ProjectID,
|
|
}
|
|
}
|
|
fmt.Printf("Offer:\t %+v", Strategy.Offer)
|
|
fmt.Printf("Offer:\t %+v", Strategy.Offer)
|
|
@@ -377,6 +410,15 @@ func (*project) ChangeTaskStatus(ctx *gin.Context, data http_model.ProjectChange
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (*project) ChangeSpecialTaskStatus(ctx *gin.Context, data http_model.ProjectChangeTaskStatusRequest) interface{} {
|
|
|
|
+ err := db.ChangeSpecialTaskStatus(ctx, data.TaskIds, data.TaskStatus, data.TaskStage)
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.WithContext(ctx).Errorf("[project service] call ChangeSpecialTaskStatus error,err:%+v", err)
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
|
|
+}
|
|
|
|
+
|
|
func (p *project) GetTaskScriptList(ctx *gin.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) (*http_model.TaskScriptListData, error) {
|
|
func (p *project) GetTaskScriptList(ctx *gin.Context, projectID string, pageSize, pageNum int64, conditions *common_model.TalentConditions) (*http_model.TaskScriptListData, error) {
|
|
TaskScripts, total, err := db.GetTaskScriptList(ctx, projectID, pageSize, pageNum, conditions)
|
|
TaskScripts, total, err := db.GetTaskScriptList(ctx, projectID, pageSize, pageNum, conditions)
|
|
if err != nil {
|
|
if err != nil {
|