feat:优化项目信息
This commit is contained in:
@ -49,7 +49,7 @@ func (c *Topic) List(status int, page, pageSize int) (*controller.ReturnPages, e
|
||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("status", status),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{Where: model2.NewWhere("uid", c.ManageUID)}}
|
||||
}, &model2.ModelWhereOrder{Where: model2.NewWhere("uid", c.UID)}}
|
||||
|
||||
var count int64
|
||||
|
||||
@ -94,13 +94,13 @@ func (c *Topic) Form(params *TopicParams) error {
|
||||
|
||||
if params.ID > 0 {
|
||||
mTechnologyTopic.ID = params.ID
|
||||
isExist, err := model2.FirstField(mTechnologyTopic.TechnologyTopic, []string{"id", "m_uid", "status"})
|
||||
isExist, err := model2.FirstField(mTechnologyTopic.TechnologyTopic, []string{"id", "uid", "status"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,课题信息不存在")
|
||||
} else if mTechnologyTopic.MUid != c.ManageUID {
|
||||
} else if mTechnologyTopic.UID != c.UID {
|
||||
return errors.New("无权限操作")
|
||||
} else if mTechnologyTopic.Status != model2.TechnologyTopicStatusForDraft &&
|
||||
mTechnologyTopic.Status != model2.TechnologyTopicStatusForRefuse {
|
||||
@ -122,9 +122,8 @@ func (c *Topic) Form(params *TopicParams) error {
|
||||
mTechnologyTopic.UpdatedAt = time.Now()
|
||||
return model2.Updates(mTechnologyTopic.TechnologyTopic, mTechnologyTopic.TechnologyTopic)
|
||||
}
|
||||
mTechnologyTopic.TenantID = c.TenantID
|
||||
mTechnologyTopic.Local.Local = c.local
|
||||
mTechnologyTopic.MUid = c.ManageUID
|
||||
mTechnologyTopic.UID = c.UID
|
||||
return model2.Create(mTechnologyTopic.TechnologyTopic)
|
||||
}
|
||||
|
||||
@ -139,7 +138,7 @@ func (c *Topic) Delete(id uint64) error {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,课题信息不存在")
|
||||
} else if mTechnologyTopic.MUid != c.ManageUID {
|
||||
} else if mTechnologyTopic.UID != c.UID {
|
||||
return errors.New("无权限操作")
|
||||
}
|
||||
return model2.Delete(mTechnologyTopic.TechnologyTopic)
|
||||
|
Reference in New Issue
Block a user