feat:完善项目信息

This commit is contained in:
henry
2022-01-21 11:42:58 +08:00
parent dda20eb011
commit 1c027dd2d1
23 changed files with 125 additions and 113 deletions

View File

@ -85,6 +85,10 @@ func (*Technology) PatentBind(c *gin.Context) {
api.APIResponse(err)(c)
}
func (*Technology) PatentExamine(c *gin.Context) {
}
func (*Technology) PatentDelete(c *gin.Context) {
form := new(api.IDStringForm)
@ -239,13 +243,39 @@ func (*Technology) AchievementDelete(c *gin.Context) {
}
func (*Technology) Demand(c *gin.Context) {
form := &struct {
api.TenantIDStringForm
Title string `json:"title" form:"title"`
Kind int `json:"kind" form:"kind"`
api.PageForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology.NewDemand()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert(), form.Title, form.Kind,
form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (*Technology) DemandDetail(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology.NewDemand()(api.GetSession()(c).(*session.Admin)).Detail(form.Convert())
api.APIResponse(err, data)(c)
}
func (*Technology) DemandDelete() {
func (*Technology) DemandDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology.NewDemand()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
api.APIResponse(err)(c)
}

View File

@ -0,0 +1,7 @@
package technology
import model2 "SciencesServer/app/common/model"
func handleExamine(iModel model2.IModel, status int) {
}

View File

@ -230,6 +230,11 @@ func (c *Patent) Bind(id, uid uint64) error {
})
}
// Examine 审核操作
func (c *Patent) Examine() {
}
// Delete 删除操作
func (c *Patent) Delete(id uint64) error {
mSysPatent := model.NewSysPatent()

View File

@ -83,6 +83,29 @@ func (c *Product) Form() {
}
// Examine 审核操作
func (c *Product) Examine(id uint64, status int, remark string) error {
mTechnologyProduct := model.NewTechnologyProduct()
mTechnologyProduct.ID = id
isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "tenant_id", "status"})
if err != nil {
return err
} else if !isExist {
return errors.New("操作错误,产品信息不存在或已被删除")
}
if c.TenantID > 0 && mTechnologyProduct.TenantID != c.TenantID {
return errors.New("操作错误,无权限操作")
}
if mTechnologyProduct.Status != model2.TechnologyStatusKindForExamining {
return errors.New("操作错误,当前产品状态不允许审核")
}
return model2.Updates(mTechnologyProduct.TechnologyProduct, map[string]interface{}{
"status": status,
})
}
// Delete 删除操作
func (c *Product) Delete(id uint64) error {
mTechnologyProduct := model.NewTechnologyProduct()

View File

@ -58,7 +58,7 @@ func (m *ManageExpert) Experts(page, pageSize int, count *int64, where ...*model
"LEFT JOIN (SELECT uid, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY uid) AS u_p ON u.uid = u_p.uid "+
" WHERE u.is_deleted = %d AND u.invalid_status = %d GROUP BY u.expert_id) AS u ON e.id = u.expert_id",
model.NewUserExpert().TableName(),
model.NewTechnologyAchievement().TableName(), model.DeleteStatusForNot, model.TechnologyAchievementStatusForAgree,
model.NewTechnologyAchievement().TableName(), model.DeleteStatusForNot, model.TechnologyStatusKindForAgree,
model.NewUserPatent().TableName(), model.DeleteStatusForNot,
model.DeleteStatusForNot, model.InvalidStatusForNot)).
Where("e.is_deleted = ?", model.DeleteStatusForNot)