feat:修改技术文档需求数据模块
This commit is contained in:
@ -3,7 +3,6 @@ package technology
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/utils"
|
||||
@ -45,16 +44,15 @@ type (
|
||||
ID uint64
|
||||
Title, Introduce, Name, Mobile, Deadline string
|
||||
Industry, Kinds []string
|
||||
config.Area
|
||||
Budget float64
|
||||
BudgetMode int
|
||||
Expect []string `json:"expect"` // 期望合作的企业及模式
|
||||
Demand struct {
|
||||
Basic string `json:"basic"` // 基础
|
||||
Expect string `json:"expect"` // 预期
|
||||
Benefit string `json:"benefit"` // 效益
|
||||
} `json:"demand"` // 需求详细信息
|
||||
Status int `json:"status"`
|
||||
Budget float64
|
||||
BudgetMode int
|
||||
Expects []string // 期望合作的企业及模式
|
||||
Demand struct {
|
||||
Basic string // 基础
|
||||
Expect string // 预期
|
||||
Benefit string // 效益
|
||||
} // 需求详细信息
|
||||
IsSubmit int
|
||||
}
|
||||
)
|
||||
|
||||
@ -113,7 +111,7 @@ func (c *Demand) Form(params *DemandParams) error {
|
||||
if params.ID > 0 {
|
||||
mTechnologyDemand.ID = params.ID
|
||||
|
||||
isExist, err := model2.FirstField(mTechnologyDemand.TechnologyDemand, []string{"id", "uid", "status"})
|
||||
isExist, err := model2.FirstField(mTechnologyDemand.TechnologyDemand, []string{"id", "uid", "status", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -129,20 +127,15 @@ func (c *Demand) Form(params *DemandParams) error {
|
||||
mTechnologyDemand.Title = params.Title
|
||||
mTechnologyDemand.Name = params.Name
|
||||
mTechnologyDemand.Mobile = params.Mobile
|
||||
mTechnologyDemand.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District,
|
||||
Address: params.Area.Address,
|
||||
}
|
||||
mTechnologyDemand.Introduce = params.Introduce
|
||||
mTechnologyDemand.SetKindAttribute(params.Kinds)
|
||||
mTechnologyDemand.SetIndustryAttribute(params.Industry)
|
||||
mTechnologyDemand.Budget = params.Budget
|
||||
mTechnologyDemand.BudgetMode = model2.TechnologyDemandBudgetMode(params.BudgetMode)
|
||||
mTechnologyDemand.Deadline = utils.DataTimeToDate(params.Deadline)
|
||||
mTechnologyDemand.Status = model2.TechnologyDemandStatus(params.Status)
|
||||
|
||||
mTechnologyDemand.SetOtherAttribute(&model2.TechnologyDemandOther{
|
||||
Expect: params.Expect,
|
||||
Expect: params.Expects,
|
||||
Demand: struct {
|
||||
Basic string `json:"basic"`
|
||||
Expect string `json:"expect"`
|
||||
@ -152,11 +145,15 @@ func (c *Demand) Form(params *DemandParams) error {
|
||||
},
|
||||
})
|
||||
if mTechnologyDemand.ID > 0 {
|
||||
mTechnologyDemand.UpdatedAt = time.Now()
|
||||
mTechnologyDemand.Status = model2.TechnologyDemandStatusForExamining
|
||||
return model2.Updates(mTechnologyDemand.TechnologyDemand, mTechnologyDemand.TechnologyDemand)
|
||||
}
|
||||
mTechnologyDemand.UID = c.UID
|
||||
mTechnologyDemand.Local.Local = c.local
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
mTechnologyDemand.Status = model2.TechnologyDemandStatusForExamining
|
||||
}
|
||||
return model2.Create(mTechnologyDemand.TechnologyDemand)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user