feat:优化项目信息
This commit is contained in:
@ -97,20 +97,20 @@ func (c *Project) Form(params *ProjectParams) error {
|
||||
|
||||
// Shelf 上下架操作
|
||||
func (c *Project) Shelf(id uint64, status int) error {
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
mTechnologyPatent.ID = id
|
||||
mTechnologyProject := model.NewTechnologyProject()
|
||||
mTechnologyProject.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mTechnologyPatent.TechnologyPatent, []string{"id", "uid"})
|
||||
isExist, err := model2.FirstField(mTechnologyProject.TechnologyProject, []string{"id", "uid"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,项目信息不存在或已被删除")
|
||||
} else if mTechnologyPatent.UID != c.UID {
|
||||
} else if mTechnologyProject.UID != c.UID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
|
||||
return model2.Updates(mTechnologyPatent.TechnologyPatent, map[string]interface{}{
|
||||
return model2.Updates(mTechnologyProject.TechnologyProject, map[string]interface{}{
|
||||
"shelf_status": status, "updated_at": time.Now(),
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user