yuliang1112 2 жил өмнө
parent
commit
a1d0509daa

+ 20 - 19
model/gorm_model/project.go

@@ -6,36 +6,37 @@ import (
 )
 
 type ProjectInfo struct {
-	ProjectID         int64       `gorm:"column:project_id;primary_key;AUTO_INCREMENT"` // 项目id
-	ProjectName       string    `gorm:"column:project_name"`                          // 项目名称
-	ProjectStatus     int64       `gorm:"column:project_status"`                        // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
-	ProjectType       int64       `gorm:"column:project_type"`                          // 项目类型,1代表全流程项目,2代表专项项目
-	ProjectPlatform   int64       `gorm:"column:project_platform"`                      // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
-	ProjectForm       int64       `gorm:"column:project_form"`                          // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
-	TalentType        string    `gorm:"column:talent_type"`                           // 达人类型
+	ProjectID         int64      `gorm:"column:project_id;primary_key;AUTO_INCREMENT"` // 项目id
+	ProjectName       string     `gorm:"column:project_name"`                          // 项目名称
+	ProjectStatus     int64      `gorm:"column:project_status"`                        // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	ProjectType       int64      `gorm:"column:project_type"`                          // 项目类型,1代表全流程项目,2代表专项项目
+	ProjectPlatform   int64      `gorm:"column:project_platform"`                      // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
+	ProjectForm       int64      `gorm:"column:project_form"`                          // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
+	TalentType        string     `gorm:"column:talent_type"`                           // 达人类型
 	RecruitDdl        *time.Time `gorm:"column:recruit_ddl"`                           // 招募截止时间
-	ContentType       int64       `gorm:"column:content_type"`                          // 内容形式,1代表图文,2代表视频
-	ProjectDetail     string    `gorm:"column:project_detail"`                        // 项目详情
-	ApplyNum          int64       `gorm:"column:apply_num;default:0;NOT NULL"`          // 报名人数
-	RecruitNum        int64       `gorm:"column:recruit_num;default:0;NOT NULL"`        // 已招募人数
-	EnterpriseID      int64       `gorm:"column:enterprise_id"`                         // 所属企业id
-	ProductID         int64       `gorm:"column:product_id"`                            // 关联商品id
+	ContentType       int64      `gorm:"column:content_type"`                          // 内容形式,1代表图文,2代表视频
+	ProjectDetail     string     `gorm:"column:project_detail"`                        // 项目详情
+	ApplyNum          int64      `gorm:"column:apply_num;default:0;NOT NULL"`          // 报名人数
+	RecruitNum        int64      `gorm:"column:recruit_num;default:0;NOT NULL"`        // 已招募人数
+	EnterpriseID      int64      `gorm:"column:enterprise_id"`                         // 所属企业id
+	ProductID         int64      `gorm:"column:product_id"`                            // 关联商品id
 	CreatedAt         *time.Time `gorm:"column:created_at"`                            // 创建时间
 	UpdatedAt         *time.Time `gorm:"column:updated_at"`                            // 修改时间
-	FeeForm           string    `gorm:"column:fee_form"`                              // 稿费形式列表
+	FeeForm           string     `gorm:"column:fee_form"`                              // 稿费形式列表
 	AutoFailAt        *time.Time `gorm:"column:auto_fail_at"`                          // 失效自动处理时间
-	AutoTaskID        int64       `gorm:"column:auto_task_id;NOT NULL"`                 // 定时任务id
-	AutoDefaultID     int64       `gorm:"column:auto_default_id;NOT NULL"`              // 违约状态id
-	PaymentAmount     float64   `gorm:"column:payment_amount"`                        // 支付金额
+	AutoTaskID        int64      `gorm:"column:auto_task_id;NOT NULL"`                 // 定时任务id
+	AutoDefaultID     int64      `gorm:"column:auto_default_id;NOT NULL"`              // 违约状态id
+	PaymentAmount     float64    `gorm:"column:payment_amount"`                        // 支付金额
 	PayAt             *time.Time `gorm:"column:pay_at"`                                // 支付时间
 	AutoScriptBreakAt *time.Time `gorm:"column:auto_script_break_at"`                  // 脚本违约自动处理时间
 	AutoSketchBreakAt *time.Time `gorm:"column:auto_sketch_break_at"`                  // 初稿违约自动处理时间
-	FailReason        int64       `gorm:"column:fail_reason"`                           // 失效原因,1、2分别表示逾期未支付、项目存在风险
+	FailReason        int64      `gorm:"column:fail_reason"`                           // 失效原因,1、2分别表示逾期未支付、项目存在风险
 	PassAt            *time.Time `gorm:"column:pass_at"`                               // 审核通过时间
 	FinishAt          *time.Time `gorm:"column:finish_at"`                             // 结案时间
+	EstimatedCost     string     `gorm:"column:estimated_cost"`                        // 预估成本
+	IsRead            int64      `gorm:"column:is_read"`                               // 是否已读
 }
 
 func (m *ProjectInfo) TableName() string {
 	return "project_info"
 }
-

+ 1 - 3
model/http_model/project_create.go

@@ -1,7 +1,5 @@
 package http_model
 
-import "time"
-
 type CreateProjectPhoto struct {
 	PhotoUrl string `json:"photo_url"` // 图片url
 	PhotoUid string `json:"photo_uid"`
@@ -25,7 +23,7 @@ type CreateProjectRequest struct {
 	ProjectPlatform  int64                   `json:"project_platform"`  // 项目平台,1-7分别代表小红书、抖音、微博、快手、b站、大众点评、知乎
 	ProjectForm      int64                   `json:"project_form"`      // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
 	TalentType       string                  `json:"talent_type"`       // 达人类型
-	RecruitDdl       time.Time               `json:"recruit_ddl"`       // 招募截止时间
+	RecruitDdl       string                  `json:"recruit_ddl"`       // 招募截止时间
 	ContentType      int64                   `json:"content_type"`      // 内容形式,1代表图文,2代表视频
 	ProjectDetail    string                  `json:"project_detail"`    // 项目详情
 	RecruitStrategys []CreateRecruitStrategy `json:"recruit_strategys"` // 定价策略

+ 1 - 3
model/http_model/project_update.go

@@ -1,7 +1,5 @@
 package http_model
 
-import "time"
-
 type UpdateProjectPhoto struct {
 	PhotoUrl string `json:"photo_url"` // 图片url
 	PhotoUid string `json:"photo_uid"`
@@ -21,7 +19,7 @@ type UpdateRecruitStrategy struct {
 type UpdateProjectRequest struct {
 	ProjectForm      string                  `json:"project_form"`      // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
 	TalentType       string                  `json:"talent_type"`       // 达人类型
-	RecruitDdl       time.Time               `json:"recruit_ddl"`       // 招募截止时间
+	RecruitDdl       string                  `json:"recruit_ddl"`       // 招募截止时间
 	ContentType      string                  `json:"content_type"`      // 内容形式,1代表图文,2代表视频
 	ProjectStatus    string                  `json:"project_status"`    // 项目阶段
 	ProjectDetail    string                  `json:"project_detail"`    // 项目详情

+ 7 - 3
service/project.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"strconv"
 	"strings"
+	"time"
 	"youngee_b_api/db"
 	"youngee_b_api/model/common_model"
 	"youngee_b_api/model/gorm_model"
@@ -49,6 +50,7 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
 	}
 	feeFroms := strings.Join(feeFrom, ",")
 	fmt.Printf("创建项目new %+v", newProject)
+	RecruitDdl, _ := time.ParseInLocation("2006-01-02 15:04:05", newProject.RecruitDdl, time.Local)
 	projectInfo := gorm_model.ProjectInfo{}
 	if newProject.ProjectType == int64(1) {
 		projectInfo = gorm_model.ProjectInfo{
@@ -58,7 +60,7 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
 			TalentType:      newProject.TalentType,
 			ProjectPlatform: newProject.ProjectPlatform,
 			ProjectForm:     newProject.ProjectForm,
-			RecruitDdl:      &newProject.RecruitDdl,
+			RecruitDdl:      &RecruitDdl,
 			ProjectDetail:   newProject.ProjectDetail,
 			ContentType:     newProject.ContentType,
 			EnterpriseID:    enterpriseID,
@@ -66,6 +68,7 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
 			FeeForm:         feeFroms,
 			AutoTaskID:      conv.MustInt64(AutoTaskID),
 			AutoDefaultID:   conv.MustInt64(AutoDefaultID),
+			IsRead:          0,
 		}
 	} else {
 		projectInfo = gorm_model.ProjectInfo{
@@ -144,7 +147,8 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
 	return res, nil
 }
 func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectRequest, enterpriseID int64) (*http_model.UpdateProjectData, error) {
-	fmt.Println("newproject:", newProject)
+	fmt.Println("RecruitDdl:", newProject.RecruitDdl)
+	RecruitDdl, _ := time.ParseInLocation("2006-01-02 15:04:05", newProject.RecruitDdl, time.Local)
 	oldProject, err3 := db.GetProjectDetail(ctx, conv.MustInt64(newProject.ProjectID))
 	if err3 != nil {
 		return nil, err3
@@ -158,7 +162,7 @@ func (*project) Update(ctx context.Context, newProject http_model.UpdateProjectR
 	feeFroms := strings.Join(feeFrom, ",")
 	project := gorm_model.ProjectInfo{
 		ProjectID:     conv.MustInt64(newProject.ProjectID),
-		RecruitDdl:    &newProject.RecruitDdl,
+		RecruitDdl:    &RecruitDdl,
 		TalentType:    newProject.TalentType,
 		ContentType:   conv.MustInt64(newProject.ContentType),
 		ProjectDetail: newProject.ProjectDetail,