feat:完善信息

This commit is contained in:
henry
2021-10-14 16:40:23 +08:00
parent 456b8a849e
commit 1fa9adbd25
2 changed files with 40 additions and 1 deletions

View File

@ -30,6 +30,14 @@ type (
Deadline time.Time `json:"deadline"`
CreatedAt time.Time `json:"created_at"`
}
// DemandDetailInfo 需求详细信息
DemandDetailInfo struct {
ID string `json:"id"`
*model2.TechnologyDemand
Kinds []string `json:"kinds"`
Industry []string `json:"industry"`
*model2.TechnologyDemandOther
}
// DemandParams 需求参数信息
DemandParams struct {
ID uint64
@ -77,6 +85,25 @@ func (c *Demand) List(status, page, pageSize int) (*controller.ReturnPages, erro
return &controller.ReturnPages{Data: list, Count: count}, nil
}
// Detail 详细信息
func (c *Demand) Detail(id uint64) (*DemandDetailInfo, error) {
mTechnologyDemand := model.NewTechnologyDemand()
mTechnologyDemand.ID = id
isExist, err := model2.First(mTechnologyDemand.TechnologyDemand)
if err != nil {
return nil, err
} else if !isExist {
return nil, errors.New("操作错误,数据不存在")
}
return &DemandDetailInfo{
ID: mTechnologyDemand.GetEncodeID(), TechnologyDemand: mTechnologyDemand.TechnologyDemand,
Kinds: mTechnologyDemand.GetKindAttribute(), Industry: mTechnologyDemand.GetIndustryAttribute(),
TechnologyDemandOther: mTechnologyDemand.GetOtherAttribute(),
}, nil
}
// Form 数据操作
func (c *Demand) Form(params *DemandParams) error {
mTechnologyDemand := model.NewTechnologyDemand()