feat:增加用户服务需求数据模型

This commit is contained in:
henry
2021-11-29 17:24:48 +08:00
parent 998b78fb23
commit a441d1f2f1
8 changed files with 348 additions and 9 deletions

View File

@ -113,13 +113,13 @@ func (c *Demand) Form(params *DemandParams) error {
if params.ID > 0 {
mTechnologyDemand.ID = params.ID
isExist, err := model2.FirstField(mTechnologyDemand.TechnologyDemand, []string{"id", "m_uid", "status"})
isExist, err := model2.FirstField(mTechnologyDemand.TechnologyDemand, []string{"id", "uid", "status"})
if err != nil {
return err
} else if !isExist {
return errors.New("操作错误,数据不存在")
} else if mTechnologyDemand.MUid != c.ManageUID {
return errors.New("操作错误,需求信息不存在或已删除")
} else if mTechnologyDemand.UID != c.UID {
return errors.New("无权限操作")
} else if mTechnologyDemand.Status != model2.TechnologyDemandStatusForRefuse &&
mTechnologyDemand.Status != model2.TechnologyDemandStatusForDraft {
@ -155,8 +155,7 @@ func (c *Demand) Form(params *DemandParams) error {
mTechnologyDemand.UpdatedAt = time.Now()
return model2.Updates(mTechnologyDemand.TechnologyDemand, mTechnologyDemand.TechnologyDemand)
}
mTechnologyDemand.TenantID = c.TenantID
mTechnologyDemand.MUid = c.ManageUID
mTechnologyDemand.UID = c.UID
mTechnologyDemand.Local.Local = c.local
return model2.Create(mTechnologyDemand.TechnologyDemand)
}
@ -172,7 +171,7 @@ func (c *Demand) Delete(id uint64) error {
return err
} else if !isExist {
return errors.New("操作错误,数据不存在")
} else if mTechnologyDemand.MUid != c.ManageUID {
} else if mTechnologyDemand.UID != c.UID {
return errors.New("无权限操作")
}
if err = model2.Delete(mTechnologyDemand.TechnologyDemand); err != nil {