feat:完善信息
This commit is contained in:
@ -36,8 +36,10 @@ func (c *Instance) List(status, page, pageSize int) (*controller.ReturnPages, er
|
||||
mTechnologyInstance := model.NewTechnologyInstance()
|
||||
out := make([]*model2.TechnologyInstance, 0)
|
||||
|
||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{Order: model2.NewOrder("id", model2.OrderModeToDesc)}}
|
||||
|
||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("status", status),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}}
|
||||
var count int64
|
||||
|
||||
if err := model2.Pages(mTechnologyInstance.TechnologyInstance, &out, page, pageSize, &count, where...); err != nil {
|
||||
@ -68,14 +70,14 @@ func (c *Instance) Form(params *InstanceParams) error {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("信息不存在")
|
||||
} else if c.UID != mTechnologyInstance.UID {
|
||||
} else if c.TenantUID != mTechnologyInstance.UID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft &&
|
||||
mTechnologyInstance.Status != model2.TechnologyInstanceStatusForRefuse {
|
||||
return errors.New("操作错误,当前状态不允许修改")
|
||||
}
|
||||
}
|
||||
mTechnologyInstance.UID = c.UID
|
||||
mTechnologyInstance.UID = c.TenantUID
|
||||
mTechnologyInstance.PatentID = params.PatentID
|
||||
mTechnologyInstance.Title = params.Title
|
||||
mTechnologyInstance.Company = params.Company
|
||||
@ -98,6 +100,7 @@ func (c *Instance) Form(params *InstanceParams) error {
|
||||
return errors.New("操作错误,状态参数错误")
|
||||
}
|
||||
if params.ID > 0 {
|
||||
mTechnologyInstance.UpdatedAt = time.Now()
|
||||
return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance)
|
||||
}
|
||||
return model2.Create(mTechnologyInstance.TechnologyInstance)
|
||||
@ -113,7 +116,7 @@ func (c *Instance) Shelf(id uint64, status int) error {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("信息不存在")
|
||||
} else if c.UID != mTechnologyInstance.UID {
|
||||
} else if c.TenantUID != mTechnologyInstance.UID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
|
||||
return errors.New("操作错误,当前状态不允许处理上下架")
|
||||
@ -138,7 +141,7 @@ func (c *Instance) Delete(id uint64) error {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("信息不存在")
|
||||
} else if c.UID != mTechnologyInstance.UID {
|
||||
} else if c.TenantUID != mTechnologyInstance.UID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
if err = model2.Delete(mTechnologyInstance.TechnologyInstance); err != nil {
|
||||
|
@ -65,11 +65,11 @@ func (c *Paper) Form(params *PaperParams) error {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("当前论文信息不存在")
|
||||
} else if mTechnologyPaper.UID != c.UID {
|
||||
} else if mTechnologyPaper.UID != c.TenantUID {
|
||||
return errors.New("无权限操作")
|
||||
}
|
||||
}
|
||||
mTechnologyPaper.UID = c.UID
|
||||
mTechnologyPaper.UID = c.TenantUID
|
||||
mTechnologyPaper.Title = params.Title
|
||||
mTechnologyPaper.Ext = params.Ext
|
||||
mTechnologyPaper.Author = params.Author
|
||||
@ -92,7 +92,7 @@ func (c *Paper) Delete(id uint64) error {
|
||||
|
||||
var count int64
|
||||
|
||||
err := model2.Count(mTechnologyPaper.TechnologyPaper, &count, model2.NewWhere("id", id), model2.NewWhere("uid", c.UID))
|
||||
err := model2.Count(mTechnologyPaper.TechnologyPaper, &count, model2.NewWhere("id", id), model2.NewWhere("uid", c.TenantUID))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user