|
@@ -86,6 +86,71 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
|
|
fmt.Printf("%+v", res)
|
|
fmt.Printf("%+v", res)
|
|
return res, nil
|
|
return res, nil
|
|
}
|
|
}
|
|
|
|
+func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectRequest, enterpriseID int64) (*http_model.UpdateProjectData, error) {
|
|
|
|
+ project := gorm_model.ProjectInfo{
|
|
|
|
+ ProjectID: conv.MustInt64(newProject.ProjectID),
|
|
|
|
+ RecruitDdl: newProject.RecruitDdl,
|
|
|
|
+ TalentType: newProject.TalentType,
|
|
|
|
+ ContentType: conv.MustInt64(newProject.ContentType),
|
|
|
|
+ ProjectDetail: newProject.ProjectDetail,
|
|
|
|
+ ProjectForm: conv.MustInt64(newProject.ProjectForm),
|
|
|
|
+ EnterpriseID: enterpriseID,
|
|
|
|
+ ProjectStatus: 2,
|
|
|
|
+ }
|
|
|
|
+ projectID, err := db.UpdateProject(ctx, project)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ // 删除该项目之前的所有图片
|
|
|
|
+ err = db.DeleteProjectPhotoByProjecttID(ctx, *projectID)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ if newProject.ProjectPhotos != nil {
|
|
|
|
+ // 新增图片
|
|
|
|
+ projectPhotos := []gorm_model.ProjectPhoto{}
|
|
|
|
+ for _, photo := range newProject.ProjectPhotos {
|
|
|
|
+ projectPhoto := gorm_model.ProjectPhoto{
|
|
|
|
+ PhotoUrl: photo.PhotoUrl,
|
|
|
|
+ PhotoUid: photo.PhotoUid,
|
|
|
|
+ }
|
|
|
|
+ projectPhotos = append(projectPhotos, projectPhoto)
|
|
|
|
+ }
|
|
|
|
+ err = db.CreateProjectPhoto(ctx, projectPhotos)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 删除该项目之前的所有策略
|
|
|
|
+ err = db.DeleteRecruitStrategyByProjectID(ctx, *projectID)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ if newProject.RecruitStrategys != nil {
|
|
|
|
+ // 新增图片
|
|
|
|
+ RecruitStrategys := []gorm_model.RecruitStrategy{}
|
|
|
|
+ for _, Strategy := range newProject.RecruitStrategys {
|
|
|
|
+ RecruitStrategy := gorm_model.RecruitStrategy{
|
|
|
|
+ FeeForm: conv.MustInt64(Strategy.FeeForm),
|
|
|
|
+ StrategyID: conv.MustInt64(Strategy.StrategyID),
|
|
|
|
+ FollowersLow: conv.MustInt64(Strategy.FollowersLow),
|
|
|
|
+ FollowersUp: conv.MustInt64(Strategy.FollowersUp),
|
|
|
|
+ RecruitNumber: conv.MustInt64(Strategy.RecruitNumber),
|
|
|
|
+ Offer: conv.MustInt64(Strategy.Offer),
|
|
|
|
+ }
|
|
|
|
+ fmt.Printf("Offer:\t %+v", Strategy.Offer)
|
|
|
|
+ RecruitStrategys = append(RecruitStrategys, RecruitStrategy)
|
|
|
|
+ }
|
|
|
|
+ err = db.CreateRecruitStrategy(ctx, RecruitStrategys)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ res := &http_model.UpdateProjectData{
|
|
|
|
+ ProjectID: *projectID,
|
|
|
|
+ }
|
|
|
|
+ return res, nil
|
|
|
|
+}
|
|
|
|
|
|
func (*project) GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageNum int32, condition *common_model.ProjectCondition) (*http_model.FullProjectListData, error) {
|
|
func (*project) GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageNum int32, condition *common_model.ProjectCondition) (*http_model.FullProjectListData, error) {
|
|
|
|
|
|
@@ -106,6 +171,18 @@ func (*project) GetPorjectDetail(ctx context.Context, projectID int64) (*http_mo
|
|
logrus.WithContext(ctx).Errorf("[project service] call GetPorjectDetail error,err:%+v", err)
|
|
logrus.WithContext(ctx).Errorf("[project service] call GetPorjectDetail error,err:%+v", err)
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
+ enterprise, err := db.GetEnterpriseByEnterpriseID(ctx, project.EnterpriseID)
|
|
|
|
+ fmt.Println("%+v", enterprise.UserID)
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.WithContext(ctx).Errorf("[project service] call GetEnterpriseByEnterpriseID error,err:%+v", err)
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ user, err := db.GetUserByID(ctx, enterprise.UserID)
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.WithContext(ctx).Errorf("[project service] call GetUserByID error,err:%+v", err)
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ fmt.Println("%+v", user.Phone)
|
|
//var RecruitStrategys []http_model.ShowRecruitStrategy
|
|
//var RecruitStrategys []http_model.ShowRecruitStrategy
|
|
ProjectDetail := http_model.ShowProjectData{
|
|
ProjectDetail := http_model.ShowProjectData{
|
|
ProjectID: conv.MustString(project.ProjectID),
|
|
ProjectID: conv.MustString(project.ProjectID),
|
|
@@ -119,8 +196,9 @@ func (*project) GetPorjectDetail(ctx context.Context, projectID int64) (*http_mo
|
|
ContentType: conv.MustString(project.ContentType),
|
|
ContentType: conv.MustString(project.ContentType),
|
|
ProductID: conv.MustString(project.ProductID),
|
|
ProductID: conv.MustString(project.ProductID),
|
|
EnterpriseID: conv.MustString(project.EnterpriseID),
|
|
EnterpriseID: conv.MustString(project.EnterpriseID),
|
|
|
|
+ CreateAt: project.CreatedAt,
|
|
|
|
+ Phone: user.Phone,
|
|
}
|
|
}
|
|
- fmt.Printf("%+v", ProjectDetail.EnterpriseID)
|
|
|
|
Strategys, err := db.GetRecruitStrategys(ctx, projectID)
|
|
Strategys, err := db.GetRecruitStrategys(ctx, projectID)
|
|
if err != nil {
|
|
if err != nil {
|
|
logrus.WithContext(ctx).Error()
|
|
logrus.WithContext(ctx).Error()
|