Răsfoiți Sursa

新增项目详细信息查看

shenzekai 3 ani în urmă
părinte
comite
18cddbdd5b

+ 23 - 20
consts/project.go

@@ -1,7 +1,16 @@
 package consts
 
 var projectStatusMap = map[int64]string{
-	1: "",
+	1: "创建中",
+	2: "待审核",
+	3: "审核通过",
+	4: "招募中",
+	5: "招募完毕",
+	6: "待支付",
+	7: "已支付",
+	8: "失效",
+	9: "执行中",
+	10: "已结案",
 }
 
 func GetProjectStatus(status int64) string {
@@ -13,7 +22,13 @@ func GetProjectStatus(status int64) string {
 }
 
 var ProjectPlatformMap = map[int64]string{
-	1: "",
+	1: "小红书",
+	2: "抖音",
+	3: "微博",
+	4: "快手",
+	5: "b站",
+	6: "大众点评",
+	7: "知乎",
 }
 
 func GetProjectPlatform(status int64) string {
@@ -25,7 +40,10 @@ func GetProjectPlatform(status int64) string {
 }
 
 var ProjectFormMap = map[int64]string{
-	1: "",
+	1: "实体商品寄拍",
+	2: "虚拟产品测评",
+	3: "线下探店打卡",
+	4: "素材微原创",
 }
 
 func GetProjectForm(status int64) string {
@@ -36,24 +54,9 @@ func GetProjectForm(status int64) string {
 	return "未知"
 }
 
-var ProjectFeeFormMap = map[int64]string{
-	1: "",
-}
-
-func GetProjectFeeForms(statuses ...int64) []string {
-	var toasts []string
-	for _, status := range statuses {
-		toast, contain := ProjectFeeFormMap[status]
-		if !contain {
-			toast = "未知"
-		}
-		toasts = append(toasts, toast)
-	}
-	return toasts
-}
-
 var ProjectContentTypeMap = map[int64]string{
-	1: "",
+	1: "图文",
+	2: "视频",
 }
 
 func GetProjectContentType(status int64) string {

+ 16 - 0
db/enterprise.go

@@ -16,6 +16,7 @@ func CreateEnterprise(ctx context.Context, newEnterprise gorm_model.Enterprise)
 	return &newEnterprise.EnterpriseID, nil
 }
 
+//用户ID查找
 func GetEnterpriseByUID(ctx context.Context, userID int64) (*gorm_model.Enterprise, error) {
 	db := GetReadDB(ctx)
 	enterprise := gorm_model.Enterprise{}
@@ -29,3 +30,18 @@ func GetEnterpriseByUID(ctx context.Context, userID int64) (*gorm_model.Enterpri
 	}
 	return &enterprise, nil
 }
+
+//企业ID查找
+func GetEnterpriseByEnterpriseID(ctx context.Context, EnterpriseID int64) (*gorm_model.Enterprise, error) {
+	db := GetReadDB(ctx)
+	enterprise := gorm_model.Enterprise{}
+	err := db.Where("enterprise_id = ?", EnterpriseID).First(&enterprise).Error
+	if err != nil {
+		if err == gorm.ErrRecordNotFound {
+			return nil, nil
+		} else {
+			return nil, err
+		}
+	}
+	return &enterprise, nil
+}

+ 24 - 5
db/project.go

@@ -8,6 +8,7 @@ import (
 	"reflect"
 	"youngee_b_api/model/common_model"
 	"youngee_b_api/model/gorm_model"
+	"youngee_b_api/util"
 )
 
 func CreateProject(ctx context.Context, projectInfo gorm_model.ProjectInfo) (*int64, error) {
@@ -18,7 +19,14 @@ func CreateProject(ctx context.Context, projectInfo gorm_model.ProjectInfo) (*in
 	}
 	return &projectInfo.ProjectID, nil
 }
-
+func UpdateProject(ctx context.Context, project gorm_model.ProjectInfo) (*int64, error) {
+	db := GetReadDB(ctx)
+	err := db.Model(&project).Updates(project).Error
+	if err != nil {
+		return nil, err
+	}
+	return &project.ProjectID, nil
+}
 func GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageNum int32, condition *common_model.ProjectCondition) ([]*gorm_model.ProjectInfo, int64, error) {
 	db := GetReadDB(ctx)
 	// 根据企业id过滤
@@ -31,7 +39,19 @@ func GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageN
 		field := conditionType.Field(i)
 		tag := field.Tag.Get("condition")
 		value := conditionValue.FieldByName(field.Name)
-		db = db.Where(fmt.Sprintf("%s = ?", tag), value)
+		//if ! isBlank(value) {
+		//	db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+		//}
+		if !util.IsBlank(value) && tag != "updated_at" && tag != "project_name" {
+			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+		}
+		if tag == "updated_at" {
+			fmt.Println(value.Interface())
+			db = db.Where(fmt.Sprintf("%s > ?", tag), value.Interface())
+		}
+		if tag == "project_name" && !util.IsBlank(value) {
+			db = db.Where(fmt.Sprintf("%s = ?", tag), value.Interface())
+		}
 	}
 	logrus.Printf("db:%V", db)
 	// 查询总数
@@ -42,9 +62,9 @@ func GetFullProjectList(ctx context.Context, enterpriseID int64, pageSize, pageN
 		return nil, 0, err
 	}
 	// 查询该页数据
-	limit := pageNum
+	limit := pageSize
 	offset := pageSize * pageNum // assert pageNum start with 0
-	err := db.Order("updated_at desc").Limit(int(limit)).Offset(int(offset)).Find(&fullProjects).Error
+	err := db.Order("project_id").Limit(int(limit)).Offset(int(offset)).Find(&fullProjects).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[GetFullProjectList] error query mysql total, err:%+v", err)
 		return nil, 0, err
@@ -63,7 +83,6 @@ func GetProjectDetail(ctx context.Context, projectID int64) (*gorm_model.Project
 			return nil, err
 		}
 	}
-	fmt.Printf("look %+v", ProjectDetail.EnterpriseID)
 	return ProjectDetail, nil
 }
 

+ 8 - 0
db/project_photo.go

@@ -13,3 +13,11 @@ func CreateProjectPhoto(ctx context.Context, projectPhotos []gorm_model.ProjectP
 	}
 	return nil
 }
+func DeleteProjectPhotoByProjecttID(ctx context.Context, productID int64) error {
+	db := GetReadDB(ctx)
+	err := db.Where("project_id = ?", productID).Delete(&gorm_model.ProjectPhoto{}).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 22 - 0
db/recruit_strategy.go

@@ -13,3 +13,25 @@ func CreateRecruitStrategy(ctx context.Context, recruitStrategys []gorm_model.Re
 	}
 	return nil
 }
+
+func DeleteRecruitStrategyByProjectID(ctx context.Context, projectID int64) error {
+	db := GetReadDB(ctx)
+	err := db.Where("project_id = ?", projectID).Delete(&gorm_model.RecruitStrategy{}).Error
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+//func UpdateProject(ctx context.Context, project gorm_model.ProjectInfo) (*int64, error) {
+//	db := GetReadDB(ctx)
+//	err := db.Model(&project).Updates(project).Error
+//	if err != nil {
+//		return nil, err
+//	}
+//	return &project.ProjectID, nil
+//}
+//func UpdateRecruitStrategy(ctx context.Context,project gorm_model.RecruitStrategy)
+//{
+//
+//}

+ 15 - 0
db/user.go

@@ -31,3 +31,18 @@ func GetUserByPhone(ctx context.Context, phone string) (*gorm_model.User, error)
 	}
 	return user, nil
 }
+
+//GetUserByPhone 查不到返回空
+func GetUserByID(ctx context.Context, ID int64) (*gorm_model.User, error) {
+	db := GetReadDB(ctx)
+	user := &gorm_model.User{}
+	err := db.Model(user).Where("id = ?", ID).First(user).Error
+	if err != nil {
+		if err == gorm.ErrRecordNotFound {
+			fmt.Println("record not found")
+			return nil, nil
+		}
+		return nil, err
+	}
+	return user, nil
+}

+ 12 - 3
handler/project_list.go

@@ -4,6 +4,7 @@ import (
 	"errors"
 	"fmt"
 	"github.com/issue9/conv"
+	"time"
 	"youngee_b_api/consts"
 	"youngee_b_api/middleware"
 	"youngee_b_api/model/http_model"
@@ -68,20 +69,28 @@ func (h *FullProjectListHandler) run() {
 }
 func (h *FullProjectListHandler) checkParam() error {
 	var errs []error
-	if h.req.PageNum <= 0 || h.req.PageSize <= 0 {
+	if h.req.PageNum < 0 || h.req.PageSize <= 0 {
 		errs = append(errs, errors.New("page param error"))
 	}
+	h.req.PageNum--
 	h.req.ProjectForm = util.IsNull(h.req.ProjectForm)
-	h.req.PageNum++
 	if _, err := conv.Int64(h.req.ProjectForm); err != nil {
 		errs = append(errs, err)
 	}
+	h.req.ProjectId = util.IsNull(h.req.ProjectId)
+	if _, err := conv.Int64(h.req.ProjectId); err != nil {
+		errs = append(errs, err)
+	}
+	//h.req.ProjectName = util.IsNull(h.req.ProjectName)
+
 	h.req.ProjectStatus = util.IsNull(h.req.ProjectStatus)
 	if _, err := conv.Int64(h.req.ProjectStatus); err != nil {
 		errs = append(errs, err)
 	}
+	formatTime, _ := time.Parse("2006-01-02 15:04:05", h.req.ProjectUpdated)
+	//fmt.Println(h.req.ProjectUpdated)
 	h.req.ProjectUpdated = util.IsNull(h.req.ProjectUpdated)
-	if _, err := conv.Int64(h.req.ProjectUpdated); err != nil {
+	if _, err := conv.Int64(formatTime.Unix()); err != nil {
 		errs = append(errs, err)
 	}
 	h.req.ProjectContentType = util.IsNull(h.req.ProjectContentType)

+ 60 - 0
handler/project_update.go

@@ -0,0 +1,60 @@
+package handler
+
+import (
+	"youngee_b_api/consts"
+	"youngee_b_api/middleware"
+	"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 WrapUpdateProjectHandler(ctx *gin.Context) {
+	handler := newUpdateProjectHandler(ctx)
+	baseRun(handler)
+}
+
+func newUpdateProjectHandler(ctx *gin.Context) *UpdateProjectHandler {
+	return &UpdateProjectHandler{
+		req:  http_model.NewUpdateProjectRequest(),
+		resp: http_model.NewUpdateProjectResponse(),
+		ctx:  ctx,
+	}
+}
+
+type UpdateProjectHandler struct {
+	req  *http_model.UpdateProjectRequest
+	resp *http_model.CommonResponse
+	ctx  *gin.Context
+}
+
+func (h *UpdateProjectHandler) getRequest() interface{} {
+	return h.req
+}
+func (h *UpdateProjectHandler) getContext() *gin.Context {
+	return h.ctx
+}
+func (h *UpdateProjectHandler) getResponse() interface{} {
+	return h.resp
+}
+func (h *UpdateProjectHandler) run() {
+	data := http_model.UpdateProjectRequest{}
+	data = *h.req
+	auth := middleware.GetSessionAuth(h.ctx)
+	enterpriseID := auth.EnterpriseID
+	res, err := service.Project.Update(h.ctx, data, enterpriseID)
+	if err != nil {
+		logrus.Errorf("[UpdateProjectHandler] call Create err:%+v\n", err)
+		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
+		log.Info("UpdateProject fail,req:%+v", h.req)
+		return
+	}
+	h.resp.Message = "成功创建项目"
+	h.resp.Data = res
+}
+func (h *UpdateProjectHandler) checkParam() error {
+	return nil
+}

+ 2 - 0
model/common_model/project_condition.go

@@ -1,6 +1,8 @@
 package common_model
 
 type ProjectCondition struct {
+	ProjectId          int64 `condition:"project_id"`       // 项目ID
+	ProjectName        string `condition:"project_name"`     // 项目名
 	ProjectStatus      int64  `condition:"project_status"`   // 项目状态
 	ProjectPlatform    int64  `condition:"project_platform"` // 项目平台
 	ProjectForm        int64  `condition:"project_form"`     // 项目形式

+ 4 - 2
model/http_model/full_project_list.go

@@ -3,10 +3,12 @@ package http_model
 type FullProjectListRequest struct {
 	PageSize           int32  `json:"page_size"`
 	PageNum            int32  `json:"page_num"`
+	ProjectId          string `json:"project_id"`           // 项目ID
+	ProjectName        string `json:"project_name"`         // 项目名
 	ProjectStatus      string `json:"project_status"`       // 项目状态
 	ProjectPlatform    string `json:"project_platform"`     // 项目平台
 	ProjectForm        string `json:"project_form"`         // 项目形式
-	ProjectFeeForms    string `json:"project_fee_forms"`    // 稿费形式
+	//ProjectFeeForms    string `json:"project_fee_forms"`    // 稿费形式
 	ProjectContentType string `json:"project_content_type"` // 内容形式
 	ProjectUpdated     string `json:"project_updated"`      // 最后操作时间
 }
@@ -16,7 +18,7 @@ type FullProjectPreview struct {
 	ProjectStatus      string   `json:"project_status"`       // 项目状态
 	ProjectPlatform    string   `json:"project_platform"`     // 项目平台
 	ProjectForm        string   `json:"project_form"`         // 项目形式
-	ProjectFeeForms    []string `json:"project_fee_forms"`    // 稿费形式
+	//ProjectFeeForms    []string `json:"project_fee_forms"`    // 稿费形式
 	ProjectContentType string   `json:"project_content_type"` // 内容形式
 	ProjectUpdated     string   `json:"project_updated"`      // 最后操作时间
 }

+ 2 - 0
model/http_model/project_show.go

@@ -31,6 +31,8 @@ type ShowProjectData struct {
 	ProductID        string                `json:"product_id"`        // 关联商品id
 	EnterpriseID     string                `json:"enterprise_id"`     // 企业id
 	ProjectID        string                `json:"project_id"`        // 项目id
+	CreateAt         time.Time             `json:"create_at"`         //创建时间
+	Phone            string                `json:"phone"`             //联系方式
 }
 
 type ShowProjectRequest struct {

+ 42 - 0
model/http_model/project_update.go

@@ -0,0 +1,42 @@
+package http_model
+
+import "time"
+
+type UpdateProjectPhoto struct {
+	PhotoUrl string `json:"photo_url"` // 图片url
+	PhotoUid string `json:"photo_uid"`
+}
+
+type UpdateRecruitStrategy struct {
+	FeeForm       string `json:"fee_form"`       // 稿费形式,1-3分别代表自报价、固定稿费、产品置换
+	StrategyID    int64  `json:"strategy_id"`    // 策略id
+	FollowersLow  int64  `json:"followers_low"`  // 达人粉丝数下限
+	FollowersUp   int64  `json:"followers_up"`   // 达人粉丝数上限
+	RecruitNumber int64  `json:"recruit_number"` // 招募数量
+	Offer         int64  `json:"offer"`          // 报价
+}
+
+type UpdateProjectRequest struct {
+	ProjectForm      string                  `json:"project_form"`      // 项目形式,1-4分别代表实体商品寄拍、虚拟产品测评、线下探店打卡、素材微原创
+	TalentType       string                  `json:"talent_type"`       // 达人类型
+	RecruitDdl       time.Time               `json:"recruit_ddl"`       // 招募截止时间
+	ContentType      string                  `json:"content_type"`      // 内容形式,1代表图文,2代表视频
+	ProjectDetail    string                  `json:"project_detail"`    // 项目详情
+	RecruitStrategys []UpdateRecruitStrategy `json:"recruit_strategys"` // 定价策略
+	ProjectPhotos    []UpdateProjectPhoto    `json:"project_photos"`    // 项目图片
+	EnterpriseID     string                  `json:"enterprise_id"`     // 企业id
+	ProjectID        string                  `json:"project_id"`        // 项目id
+}
+
+type UpdateProjectData struct {
+	ProjectID int64 `json:"Project_id"` // 项目id
+}
+
+func NewUpdateProjectRequest() *UpdateProjectRequest {
+	return new(UpdateProjectRequest)
+}
+func NewUpdateProjectResponse() *CommonResponse {
+	resp := new(CommonResponse)
+	resp.Data = new(UpdateProjectData)
+	return resp
+}

+ 4 - 5
pack/full_project.go

@@ -16,16 +16,15 @@ func MGormFullProjectToHttpFullProjectPreview(gormProjectInfos []*gorm_model.Pro
 	return httpProjectPreviews
 }
 func GormFullProjectToHttpFullProjectPreview(gormProjectInfo *gorm_model.ProjectInfo) *http_model.FullProjectPreview {
-	var feeForms []int64
-
+	updatedTime := conv.MustString(gormProjectInfo.UpdatedAt)
+	updatedTime = updatedTime[0:19]
 	return &http_model.FullProjectPreview{
 		ProjectId:          conv.MustString(gormProjectInfo.ProjectID),
 		ProjectName:        gormProjectInfo.ProjectName,
 		ProjectStatus:      consts.GetProjectStatus(gormProjectInfo.ProjectStatus),
 		ProjectPlatform:    consts.GetProjectPlatform(gormProjectInfo.ProjectPlatform),
 		ProjectForm:        consts.GetProjectForm(gormProjectInfo.ProjectForm),
-		ProjectFeeForms:    consts.GetProjectFeeForms(feeForms...),
-		ProjectContentType: consts.GetProjectContentType(gormProjectInfo.ProjectType),
-		ProjectUpdated:     conv.MustString(gormProjectInfo.UpdatedAt.Unix()),
+		ProjectContentType: consts.GetProjectContentType(gormProjectInfo.ContentType),
+		ProjectUpdated:     updatedTime,
 	}
 }

+ 5 - 3
pack/full_project_condition.go

@@ -2,18 +2,20 @@ package pack
 
 import (
 	"github.com/issue9/conv"
-	"time"
 	"youngee_b_api/model/common_model"
 	"youngee_b_api/model/http_model"
 )
 
 func HttpFullProjectRequestToCondition(req *http_model.FullProjectListRequest) *common_model.ProjectCondition {
-	projectUpdated := time.UnixMilli(conv.MustInt64(req.ProjectUpdated))
+	projectUpdated := conv.MustString(req.ProjectUpdated)
+	projectName := req.ProjectName
 	return &common_model.ProjectCondition{
+		ProjectId:          conv.MustInt64(req.ProjectId,0),
+		ProjectName:        projectName,
 		ProjectStatus:      conv.MustInt64(req.ProjectStatus,0),
 		ProjectPlatform:    conv.MustInt64(req.ProjectPlatform,0),
 		ProjectForm:        conv.MustInt64(req.ProjectForm,0),
 		ProjectContentType: conv.MustInt64(req.ProjectContentType,0),
-		ProjectUpdated:     projectUpdated.String(),
+		ProjectUpdated:     projectUpdated,
 	}
 }

+ 1 - 0
route/init.go

@@ -46,6 +46,7 @@ func InitRoute(r *gin.Engine) {
 		m.POST("/product/find", handler.WrapFindProductHandler)
 		m.POST("/project/create", handler.WrapCreateProjectHandler)
 		m.POST("/project/show", handler.WrapShowProjectHandler)
+		m.POST("/project/update", handler.WrapUpdateProjectHandler)
 		m.POST("/product/create", handler.WrapCreateProductHandler)
 		m.POST("/product/list", handler.WrapFullProjectListHandler)
 	}

+ 1 - 2
service/enterprise.go

@@ -2,12 +2,11 @@ package service
 
 import (
 	"context"
+	log "github.com/sirupsen/logrus"
 	"time"
 	"youngee_b_api/db"
 	"youngee_b_api/model/gorm_model"
 	"youngee_b_api/model/http_model"
-
-	log "github.com/sirupsen/logrus"
 )
 
 var Enterprise *enterprise

+ 79 - 1
service/project.go

@@ -86,6 +86,71 @@ func (*project) Create(ctx context.Context, newProject http_model.CreateProjectR
 	fmt.Printf("%+v", res)
 	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) {
 
@@ -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)
 		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
 	ProjectDetail := http_model.ShowProjectData{
 		ProjectID:       conv.MustString(project.ProjectID),
@@ -119,8 +196,9 @@ func (*project) GetPorjectDetail(ctx context.Context, projectID int64) (*http_mo
 		ContentType:     conv.MustString(project.ContentType),
 		ProductID:       conv.MustString(project.ProductID),
 		EnterpriseID:    conv.MustString(project.EnterpriseID),
+		CreateAt:        project.CreatedAt,
+		Phone:           user.Phone,
 	}
-	fmt.Printf("%+v", ProjectDetail.EnterpriseID)
 	Strategys, err := db.GetRecruitStrategys(ctx, projectID)
 	if err != nil {
 		logrus.WithContext(ctx).Error()

+ 22 - 0
util/type.go

@@ -1,8 +1,30 @@
 package util
 
+import "reflect"
+
+// 判断是否为空字符串
 func IsNull(s string) string {
 	if s == ""{
 		return "0"
 	}
 	return s
 }
+
+// 判断 reflect.Value 是否为空
+func IsBlank(value reflect.Value) bool {
+	switch value.Kind() {
+	case reflect.String:
+		return value.Len() == 0
+	case reflect.Bool:
+		return !value.Bool()
+	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+		return value.Int() == 0
+	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+		return value.Uint() == 0
+	case reflect.Float32, reflect.Float64:
+		return value.Float() == 0
+	case reflect.Interface, reflect.Ptr:
+		return value.IsNil()
+	}
+	return reflect.DeepEqual(value.Interface(), reflect.Zero(value.Type()).Interface())
+}

BIN
youngee_b_api.exe