feat:修改技术文档需求数据模块
This commit is contained in:
@ -3,7 +3,6 @@ package api
|
||||
import (
|
||||
technology2 "SciencesServer/app/api/enterprise/controller/technology"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -61,21 +60,20 @@ type (
|
||||
}
|
||||
// demandForm 需求参数
|
||||
demandForm struct {
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
Introduce string `json:"introduce" form:"introduce" binding:"required"`
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Mobile string `json:"mobile" form:"mobile" binding:"required"`
|
||||
Deadline string `json:"deadline" form:"deadline" binding:"required"`
|
||||
Industry []string `json:"industry" form:"industry" binding:"required"`
|
||||
Kinds []string `json:"kinds" form:"kinds" binding:"required"`
|
||||
config.Area
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
Introduce string `json:"introduce" form:"introduce" binding:"required"`
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Mobile string `json:"mobile" form:"mobile" binding:"required"`
|
||||
Deadline string `json:"deadline" form:"deadline" binding:"required"`
|
||||
Industry []string `json:"industry" form:"industry" binding:"required"`
|
||||
Kinds []string `json:"kinds" form:"kinds" binding:"required"`
|
||||
Budget float64 `json:"budget" form:"budget"`
|
||||
BudgetMode int `json:"budget_mode" form:"budget_mode"`
|
||||
Expect []string `json:"expect" form:"expect"` // 期望合作的企业及模式
|
||||
Expects []string `json:"expects" form:"expects"` // 期望合作的企业及模式
|
||||
DemandBasic string `json:"demand_basic" form:"demand_basic"` // 基础
|
||||
DemandExpect string `json:"demand_expect" form:"demand_expect"` // 预期
|
||||
DemandBenefit string `json:"demand_benefit" form:"demand_benefit"` // 效益
|
||||
Status int `json:"status" form:"status"`
|
||||
IsSubmit int `json:"is_submit" form:"is_submit"`
|
||||
}
|
||||
// topicForm 课题参数
|
||||
topicForm struct {
|
||||
@ -384,12 +382,12 @@ func (a *Technology) DemandAdd(c *gin.Context) {
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.DemandParams{
|
||||
Title: form.Title, Introduce: form.Introduce, Name: form.Name, Mobile: form.Mobile, Deadline: form.Deadline,
|
||||
Industry: form.Industry, Kinds: form.Kinds, Area: form.Area, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
Expect: form.Expect, Demand: struct {
|
||||
Basic string `json:"basic"`
|
||||
Expect string `json:"expect"`
|
||||
Benefit string `json:"benefit"`
|
||||
}{Basic: form.DemandBasic, Expect: form.DemandExpect, Benefit: form.DemandBenefit}, Status: form.Status,
|
||||
Industry: form.Industry, Kinds: form.Kinds, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
Expects: form.Expects, Demand: struct {
|
||||
Basic string
|
||||
Expect string
|
||||
Benefit string
|
||||
}{Basic: form.DemandBasic, Expect: form.DemandExpect, Benefit: form.DemandBenefit}, IsSubmit: form.IsSubmit,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -406,12 +404,12 @@ func (a *Technology) DemandEdit(c *gin.Context) {
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.DemandParams{
|
||||
ID: form.Convert(), Title: form.Title, Introduce: form.Introduce, Name: form.Name, Mobile: form.Mobile, Deadline: form.Deadline,
|
||||
Industry: form.Industry, Kinds: form.Kinds, Area: form.Area, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
Expect: form.Expect, Demand: struct {
|
||||
Basic string `json:"basic"`
|
||||
Expect string `json:"expect"`
|
||||
Benefit string `json:"benefit"`
|
||||
}{Basic: form.DemandBasic, Expect: form.DemandExpect, Benefit: form.DemandBenefit}, Status: form.Status,
|
||||
Industry: form.Industry, Kinds: form.Kinds, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
Expects: form.Expects, Demand: struct {
|
||||
Basic string
|
||||
Expect string
|
||||
Benefit string
|
||||
}{Basic: form.DemandBasic, Expect: form.DemandExpect, Benefit: form.DemandBenefit}, IsSubmit: form.IsSubmit,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -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