feat:完善信息
This commit is contained in:
@ -43,7 +43,7 @@ type (
|
|||||||
|
|
||||||
func (a *Technology) Paper(c *gin.Context) {
|
func (a *Technology) Paper(c *gin.Context) {
|
||||||
form := &struct {
|
form := &struct {
|
||||||
Title string `json:"title"`
|
Title string `json:"title" form:"title"`
|
||||||
api.PageForm
|
api.PageForm
|
||||||
}{}
|
}{}
|
||||||
if err := api.Bind(form)(c); err != nil {
|
if err := api.Bind(form)(c); err != nil {
|
||||||
@ -113,6 +113,18 @@ func (a *Technology) Demand(c *gin.Context) {
|
|||||||
api.APIResponse(err, data)(c)
|
api.APIResponse(err, data)(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Technology) DemandDetail(c *gin.Context) {
|
||||||
|
form := new(api.IDStringForm)
|
||||||
|
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := technology.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||||
|
Detail(form.Convert())
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *Technology) DemandAdd(c *gin.Context) {
|
func (a *Technology) DemandAdd(c *gin.Context) {
|
||||||
form := new(demandForm)
|
form := new(demandForm)
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,14 @@ type (
|
|||||||
Deadline time.Time `json:"deadline"`
|
Deadline time.Time `json:"deadline"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
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 需求参数信息
|
||||||
DemandParams struct {
|
DemandParams struct {
|
||||||
ID uint64
|
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
|
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 数据操作
|
// Form 数据操作
|
||||||
func (c *Demand) Form(params *DemandParams) error {
|
func (c *Demand) Form(params *DemandParams) error {
|
||||||
mTechnologyDemand := model.NewTechnologyDemand()
|
mTechnologyDemand := model.NewTechnologyDemand()
|
||||||
|
|||||||
Reference in New Issue
Block a user