From 1c027dd2d17d8b3f43ed905aa96b1dec4c3ec3ad Mon Sep 17 00:00:00 2001 From: henry Date: Fri, 21 Jan 2022 11:42:58 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=AE=8C=E5=96=84=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/admin/api/technology.go | 34 +++++++++++++++++-- app/api/admin/controller/technology/basic.go | 7 ++++ app/api/admin/controller/technology/patent.go | 5 +++ .../admin/controller/technology/product.go | 23 +++++++++++++ app/api/admin/model/manage_expert.go | 2 +- .../controller/technology/achievement.go | 8 ++--- .../controller/technology/demand.go | 8 ++--- .../controller/technology/instance.go | 14 ++++---- .../controller/technology/product.go | 8 ++--- .../enterprise/controller/technology/topic.go | 4 +-- .../model/technology_achievement.go | 2 +- app/api/website/controller/index.go | 4 +-- .../website/controller/technology/demand.go | 2 +- app/api/website/model/manage_company.go | 2 +- .../website/model/technology_achievement.go | 6 ++-- app/api/website/model/technology_demand.go | 4 +-- app/common/model/common.go | 18 ++++++++++ app/common/model/technology_achievement.go | 16 +-------- app/common/model/technology_demand.go | 16 +-------- app/common/model/technology_instance.go | 16 +-------- app/common/model/technology_prodcut.go | 16 +-------- app/common/model/technology_topic.go | 20 +---------- router/address.go | 3 ++ 23 files changed, 125 insertions(+), 113 deletions(-) create mode 100644 app/api/admin/controller/technology/basic.go diff --git a/app/api/admin/api/technology.go b/app/api/admin/api/technology.go index e976ac6..c16f8aa 100644 --- a/app/api/admin/api/technology.go +++ b/app/api/admin/api/technology.go @@ -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) } diff --git a/app/api/admin/controller/technology/basic.go b/app/api/admin/controller/technology/basic.go new file mode 100644 index 0000000..d714152 --- /dev/null +++ b/app/api/admin/controller/technology/basic.go @@ -0,0 +1,7 @@ +package technology + +import model2 "SciencesServer/app/common/model" + +func handleExamine(iModel model2.IModel, status int) { + +} diff --git a/app/api/admin/controller/technology/patent.go b/app/api/admin/controller/technology/patent.go index a189e38..9519e12 100644 --- a/app/api/admin/controller/technology/patent.go +++ b/app/api/admin/controller/technology/patent.go @@ -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() diff --git a/app/api/admin/controller/technology/product.go b/app/api/admin/controller/technology/product.go index 1ff51a1..85910e4 100644 --- a/app/api/admin/controller/technology/product.go +++ b/app/api/admin/controller/technology/product.go @@ -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() diff --git a/app/api/admin/model/manage_expert.go b/app/api/admin/model/manage_expert.go index 5442517..20fcdb4 100644 --- a/app/api/admin/model/manage_expert.go +++ b/app/api/admin/model/manage_expert.go @@ -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) diff --git a/app/api/enterprise/controller/technology/achievement.go b/app/api/enterprise/controller/technology/achievement.go index d06514c..49f8e04 100644 --- a/app/api/enterprise/controller/technology/achievement.go +++ b/app/api/enterprise/controller/technology/achievement.go @@ -161,8 +161,8 @@ func (c *Achievement) Form(params *AchievementParams) error { return errors.New("操作错误,成果信息不存在或已被删除") } else if mTechnologyAchievement.UID != c.UID { return errors.New("无权限操作") - } else if mTechnologyAchievement.Status != model2.TechnologyAchievementStatusForRefuse && - mTechnologyAchievement.Status != model2.TechnologyAchievementStatusForDraft { + } else if mTechnologyAchievement.Status != model2.TechnologyStatusKindForRefuse && + mTechnologyAchievement.Status != model2.TechnologyStatusKindForDraft { return errors.New("操作错误,当前状态不允许修改") } } @@ -180,14 +180,14 @@ func (c *Achievement) Form(params *AchievementParams) error { mTechnologyAchievement.Source = params.Source if mTechnologyAchievement.ID > 0 { - mTechnologyAchievement.Status = model2.TechnologyAchievementStatusForExamining + mTechnologyAchievement.Status = model2.TechnologyStatusKindForExamining return model2.Updates(mTechnologyAchievement.TechnologyAchievement, mTechnologyAchievement.TechnologyAchievement) } mTechnologyAchievement.TenantID = c.tenantID mTechnologyAchievement.UID = c.UID if params.IsSubmit > 0 { - mTechnologyAchievement.Status = model2.TechnologyAchievementStatusForExamining + mTechnologyAchievement.Status = model2.TechnologyStatusKindForExamining } return model2.Create(mTechnologyAchievement.TechnologyAchievement) } diff --git a/app/api/enterprise/controller/technology/demand.go b/app/api/enterprise/controller/technology/demand.go index 961827f..414a106 100644 --- a/app/api/enterprise/controller/technology/demand.go +++ b/app/api/enterprise/controller/technology/demand.go @@ -119,8 +119,8 @@ func (c *Demand) Form(params *DemandParams) error { return errors.New("操作错误,需求信息不存在或已被删除") } else if mTechnologyDemand.UID != c.UID { return errors.New("无权限操作") - } else if mTechnologyDemand.Status != model2.TechnologyDemandStatusForRefuse && - mTechnologyDemand.Status != model2.TechnologyDemandStatusForDraft { + } else if mTechnologyDemand.Status != model2.TechnologyStatusKindForRefuse && + mTechnologyDemand.Status != model2.TechnologyStatusKindForDraft { return errors.New("操作错误,当前状态不允许修改") } } @@ -145,14 +145,14 @@ func (c *Demand) Form(params *DemandParams) error { }, }) if mTechnologyDemand.ID > 0 { - mTechnologyDemand.Status = model2.TechnologyDemandStatusForExamining + mTechnologyDemand.Status = model2.TechnologyStatusKindForExamining return model2.Updates(mTechnologyDemand.TechnologyDemand, mTechnologyDemand.TechnologyDemand) } mTechnologyDemand.UID = c.UID mTechnologyDemand.TenantID = c.tenantID if params.IsSubmit > 0 { - mTechnologyDemand.Status = model2.TechnologyDemandStatusForExamining + mTechnologyDemand.Status = model2.TechnologyStatusKindForExamining } return model2.Create(mTechnologyDemand.TechnologyDemand) } diff --git a/app/api/enterprise/controller/technology/instance.go b/app/api/enterprise/controller/technology/instance.go index 17d1f21..c0333a5 100644 --- a/app/api/enterprise/controller/technology/instance.go +++ b/app/api/enterprise/controller/technology/instance.go @@ -78,8 +78,8 @@ func (c *Instance) Form(params *InstanceParams) error { return errors.New("操作错误,技术信息不存在或已被删除") } else if c.UID != mTechnologyInstance.UID { return errors.New("操作错误,无权限操作") - } else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft && - mTechnologyInstance.Status != model2.TechnologyInstanceStatusForRefuse { + } else if mTechnologyInstance.Status != model2.TechnologyStatusKindForDraft && + mTechnologyInstance.Status != model2.TechnologyStatusKindForRefuse { return errors.New("操作错误,当前状态不允许修改") } } @@ -99,19 +99,19 @@ func (c *Instance) Form(params *InstanceParams) error { mTechnologyInstance.Purpose = params.Purpose mTechnologyInstance.Remark = params.Remark - if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft && - mTechnologyInstance.Status != model2.TechnologyInstanceStatusForExamining { + if mTechnologyInstance.Status != model2.TechnologyStatusKindForDraft && + mTechnologyInstance.Status != model2.TechnologyStatusKindForExamining { return errors.New("操作错误,状态参数错误") } if params.ID > 0 { - mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining + mTechnologyInstance.Status = model2.TechnologyStatusKindForExamining return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance) } mTechnologyInstance.UID = c.UID mTechnologyInstance.TenantID = c.tenantID if params.IsSubmit > 0 { - mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining + mTechnologyInstance.Status = model2.TechnologyStatusKindForExamining } return model2.Create(mTechnologyInstance.TechnologyInstance) } @@ -128,7 +128,7 @@ func (c *Instance) Shelf(id uint64, status int) error { return errors.New("信息不存在") } else if c.UID != mTechnologyInstance.UID { return errors.New("操作错误,无权限操作") - } else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree { + } else if mTechnologyInstance.Status != model2.TechnologyStatusKindForAgree { return errors.New("操作错误,当前状态不允许处理上下架") } else if mTechnologyInstance.Shelf.ShelfStatus == model2.ShelfStatusKind(status) { return errors.New("操作错误,状态异常") diff --git a/app/api/enterprise/controller/technology/product.go b/app/api/enterprise/controller/technology/product.go index 3c5e2e1..87d8788 100644 --- a/app/api/enterprise/controller/technology/product.go +++ b/app/api/enterprise/controller/technology/product.go @@ -184,8 +184,8 @@ func (c *Product) Form(params *ProductParams) error { return errors.New("操作错误,产品信息不存在或已被删除") } else if mTechnologyProduct.UID != c.UID { return errors.New("无权限操作") - } else if mTechnologyProduct.Status != model2.TechnologyProductStatusForRefuse && - mTechnologyProduct.Status != model2.TechnologyProductStatusForDraft { + } else if mTechnologyProduct.Status != model2.TechnologyStatusKindForRefuse && + mTechnologyProduct.Status != model2.TechnologyStatusKindForDraft { return errors.New("操作错误,当前状态不允许修改") } } @@ -202,14 +202,14 @@ func (c *Product) Form(params *ProductParams) error { mTechnologyProduct.Introduce = params.Introduce if mTechnologyProduct.ID > 0 { - mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining + mTechnologyProduct.Status = model2.TechnologyStatusKindForExamining return model2.Updates(mTechnologyProduct.TechnologyProduct, mTechnologyProduct.TechnologyProduct) } mTechnologyProduct.TenantID = c.tenantID mTechnologyProduct.UID = c.UID if params.IsSubmit > 0 { - mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining + mTechnologyProduct.Status = model2.TechnologyStatusKindForExamining } return model2.Create(mTechnologyProduct.TechnologyProduct) } diff --git a/app/api/enterprise/controller/technology/topic.go b/app/api/enterprise/controller/technology/topic.go index 87168de..122e4e9 100644 --- a/app/api/enterprise/controller/technology/topic.go +++ b/app/api/enterprise/controller/technology/topic.go @@ -102,8 +102,8 @@ func (c *Topic) Form(params *TopicParams) error { return errors.New("操作错误,课题信息不存在") } else if mTechnologyTopic.UID != c.UID { return errors.New("无权限操作") - } else if mTechnologyTopic.Status != model2.TechnologyTopicStatusForDraft && - mTechnologyTopic.Status != model2.TechnologyTopicStatusForRefuse { + } else if mTechnologyTopic.Status != model2.TechnologyStatusKindForDraft && + mTechnologyTopic.Status != model2.TechnologyStatusKindForRefuse { return errors.New("操作错误,当前状态不允许修改") } } diff --git a/app/api/enterprise/model/technology_achievement.go b/app/api/enterprise/model/technology_achievement.go index b2f039a..3fa9fc8 100644 --- a/app/api/enterprise/model/technology_achievement.go +++ b/app/api/enterprise/model/technology_achievement.go @@ -46,7 +46,7 @@ func (m *TechnologyAchievement) Achievements(page, pageSize int, count *int64, w model.NewUserVisit().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)). Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, COUNT(id) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS c ON a.id = c.object_id", model.NewUserCollect().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)). - Where("a.status = ?", model.TechnologyAchievementStatusForAgree). + Where("a.status = ?", model.TechnologyStatusKindForAgree). Where("a.is_deleted = ?", model.DeleteStatusForNot) if len(where) > 0 { diff --git a/app/api/website/controller/index.go b/app/api/website/controller/index.go index ab6be9c..759dd51 100644 --- a/app/api/website/controller/index.go +++ b/app/api/website/controller/index.go @@ -183,7 +183,7 @@ func (c *Index) static() (*InstanceStaticInfo, error) { mTechnologyAchievement := model.NewTechnologyAchievement() if err = model2.Count(mTechnologyAchievement.TechnologyAchievement, &out.AchievementCount, model2.NewWhere("shelf_status", model2.ShelfStatusForUp), - model2.NewWhere("status", model2.TechnologyAchievementStatusForAgree)); err != nil { + model2.NewWhere("status", model2.TechnologyStatusKindForAgree)); err != nil { return nil, err } @@ -197,7 +197,7 @@ func (c *Index) static() (*InstanceStaticInfo, error) { mTechnologyDemand := model.NewTechnologyDemand() if err = model2.Count(mTechnologyDemand.TechnologyDemand, &out.DemandCount, - model2.NewWhere("status", model2.TechnologyDemandStatusForAgree)); err != nil { + model2.NewWhere("status", model2.TechnologyStatusKindForAgree)); err != nil { return nil, err } // 对接信息 diff --git a/app/api/website/controller/technology/demand.go b/app/api/website/controller/technology/demand.go index bad316b..ead7710 100644 --- a/app/api/website/controller/technology/demand.go +++ b/app/api/website/controller/technology/demand.go @@ -43,7 +43,7 @@ func (c *Demand) Instance(title, industry, kind string, page, pageSize int) (*co where := []*model2.ModelWhereOrder{ &model2.ModelWhereOrder{ - Where: model2.NewWhere("status", model2.TechnologyDemandStatusForAgree), + Where: model2.NewWhere("status", model2.TechnologyStatusKindForAgree), Order: model2.NewOrder("id", model2.OrderModeToDesc), }, } diff --git a/app/api/website/model/manage_company.go b/app/api/website/model/manage_company.go index ebeb196..7f1d5ea 100644 --- a/app/api/website/model/manage_company.go +++ b/app/api/website/model/manage_company.go @@ -26,7 +26,7 @@ func (m *ManageCompany) Products(id, uid uint64, page, pageSize int, count *int6 Select("p.id", "p.title", "p.image", "p.industry", "p.maturity", "p.lead_standard", "p.cooperation_mode", "p.keyword", "v.count AS visit_count", "c_u.id AS collect_id", "c.count AS collect_count"). Joins(fmt.Sprintf("LEFT JOIN %s AS p ON u_c.uid = p.uid AND p.shelf_status = %d AND p.status = %d AND p.is_deleted = %d", - model.NewTechnologyProduct().TableName(), model.ShelfStatusForUp, model.TechnologyProductStatusForAgree, model.DeleteStatusForNot)). + model.NewTechnologyProduct().TableName(), model.ShelfStatusForUp, model.TechnologyStatusKindForAgree, model.DeleteStatusForNot)). Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, SUM(count) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS v ON p.id = v.object_id", model.NewUserVisit().TableName(), model.UserVisitKindForTechnologyProduct, model.DeleteStatusForNot)). Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, COUNT(id) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS c ON p.id = c.object_id", diff --git a/app/api/website/model/technology_achievement.go b/app/api/website/model/technology_achievement.go index 20a850d..7036bf4 100644 --- a/app/api/website/model/technology_achievement.go +++ b/app/api/website/model/technology_achievement.go @@ -26,7 +26,7 @@ func (m *TechnologyAchievement) Achievements(page, pageSize int, count *int64, w model.NewUserVisit().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)). Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, COUNT(id) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS c ON a.id = c.object_id", model.NewUserCollect().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)). - Where("a.status = ?", model.TechnologyAchievementStatusForAgree). + Where("a.status = ?", model.TechnologyStatusKindForAgree). Where("a.is_deleted = ?", model.DeleteStatusForNot) if len(where) > 0 { @@ -54,7 +54,7 @@ func (m *TechnologyAchievement) Achievement(where ...*model.ModelWhere) ([]*Tech model.NewUserVisit().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)). Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, COUNT(id) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS c ON a.id = c.object_id", model.NewUserCollect().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)). - Where("a.status = ?", model.TechnologyAchievementStatusForAgree). + Where("a.status = ?", model.TechnologyStatusKindForAgree). Where("a.is_deleted = ?", model.DeleteStatusForNot) out := make([]*TechnologyAchievementInfo, 0) @@ -99,7 +99,7 @@ func (m *TechnologyAchievement) Distribution() ([]*DataAreaDistributionInfo, err Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())). Group("e.province").Group("e.city").Group("e.district"). Order("e.province "+model.OrderModeToAsc).Order("e.city "+model.OrderModeToAsc).Order("e.district "+model.OrderModeToAsc). - Where("a.status = ?", model.TechnologyAchievementStatusForAgree). + Where("a.status = ?", model.TechnologyStatusKindForAgree). Where("a.shelf_status = ?", model.ShelfStatusForUp). Scan(&out).Error diff --git a/app/api/website/model/technology_demand.go b/app/api/website/model/technology_demand.go index 4fb1315..3c4059a 100644 --- a/app/api/website/model/technology_demand.go +++ b/app/api/website/model/technology_demand.go @@ -24,7 +24,7 @@ func (m *TechnologyDemand) Demand(page, pageSize int, count *int64, where ...*mo Joins(fmt.Sprintf("LEFT JOIN %s AS u_c ON d.uid = u_c.uid AND u_c.is_deleted = %d", model.NewUserCompany().TableName(), model.DeleteStatusForNot)). Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u_c.company_id = c.id", model.NewManageCompany().TableName())). - Where("d.status = ?", model.TechnologyDemandStatusForAgree) + Where("d.status = ?", model.TechnologyStatusKindForAgree) if len(where) > 0 { for _, v := range where { @@ -50,7 +50,7 @@ func (m *TechnologyDemand) Distribution() ([]*DataAreaDistributionInfo, error) { Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())). Group("e.province").Group("e.city").Group("e.district"). Order("e.province "+model.OrderModeToAsc).Order("e.city "+model.OrderModeToAsc).Order("e.district "+model.OrderModeToAsc). - Where("d.status = ?", model.TechnologyDemandStatusForAgree). + Where("d.status = ?", model.TechnologyStatusKindForAgree). Scan(&out).Error return out, err diff --git a/app/common/model/common.go b/app/common/model/common.go index 5e93694..6429038 100644 --- a/app/common/model/common.go +++ b/app/common/model/common.go @@ -117,6 +117,24 @@ const ( InvalidStatusForNot ) +// TechnologyStatus 科技信息状态 +type TechnologyStatus struct { + Status TechnologyStatusKind `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` +} + +type TechnologyStatusKind int + +const ( + // TechnologyStatusKindForDraft 草稿箱 + TechnologyStatusKindForDraft TechnologyStatusKind = iota + // TechnologyStatusKindForExamining 审核中 + TechnologyStatusKindForExamining + // TechnologyStatusKindForAgree 审核通过 + TechnologyStatusKindForAgree + // TechnologyStatusKindForRefuse 审核拒绝 + TechnologyStatusKindForRefuse +) + type Area struct { Province string `gorm:"column:province;type:varchar(8);default:'';comment:所在省" json:"province"` City string `gorm:"column:city;type:varchar(8);default:'';comment:所在市" json:"city"` diff --git a/app/common/model/technology_achievement.go b/app/common/model/technology_achievement.go index fd28c4e..f523ab4 100644 --- a/app/common/model/technology_achievement.go +++ b/app/common/model/technology_achievement.go @@ -24,7 +24,7 @@ type TechnologyAchievement struct { Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Source string `gorm:"source:introduce;type:text;comment:成果来源" json:"source"` Shelf - Status TechnologyAchievementStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` + TechnologyStatus ModelDeleted ModelAt } @@ -46,20 +46,6 @@ const ( TechnologyAchievementModeForCharge ) -// TechnologyAchievementStatus 技术成果状态 -type TechnologyAchievementStatus int - -const ( - // TechnologyAchievementStatusForDraft 草稿箱 - TechnologyAchievementStatusForDraft TechnologyAchievementStatus = iota - // TechnologyAchievementStatusForExamining 审核中 - TechnologyAchievementStatusForExamining - // TechnologyAchievementStatusForAgree 审核通过 - TechnologyAchievementStatusForAgree - // TechnologyAchievementStatusForRefuse 审核拒绝 - TechnologyAchievementStatusForRefuse -) - func (m *TechnologyAchievement) TableName() string { return "technology_achievement" } diff --git a/app/common/model/technology_demand.go b/app/common/model/technology_demand.go index 1aed2cc..93a25ba 100644 --- a/app/common/model/technology_demand.go +++ b/app/common/model/technology_demand.go @@ -21,7 +21,7 @@ type TechnologyDemand struct { BudgetMode TechnologyDemandBudgetMode `gorm:"column:budget_mode;type:tinyint(1);default:1;comment:预算模式(1:具体金额,2:面议)" json:"budget_mode"` Deadline time.Time `gorm:"column:deadline;type:date;not null;comment:截止时间" json:"deadline"` Other string `gorm:"column:other;type:varchar(255);default:'';comment:其他信息" json:"-"` - Status TechnologyDemandStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` + TechnologyStatus ModelDeleted ModelAt } @@ -46,20 +46,6 @@ const ( TechnologyDemandBudgetModeForToFace ) -// TechnologyDemandStatus 需求文档状态 -type TechnologyDemandStatus int - -const ( - // TechnologyDemandStatusForDraft 草稿箱 - TechnologyDemandStatusForDraft TechnologyDemandStatus = iota - // TechnologyDemandStatusForExamining 审核中 - TechnologyDemandStatusForExamining - // TechnologyDemandStatusForAgree 审核通过 - TechnologyDemandStatusForAgree - // TechnologyDemandStatusForRefuse 审核拒绝 - TechnologyDemandStatusForRefuse -) - func (m *TechnologyDemand) TableName() string { return m.NewTableName("technology_demand") } diff --git a/app/common/model/technology_instance.go b/app/common/model/technology_instance.go index c1484c0..72c3b68 100644 --- a/app/common/model/technology_instance.go +++ b/app/common/model/technology_instance.go @@ -26,7 +26,7 @@ type TechnologyInstance struct { Purpose string `gorm:"column:purpose;type:text;comment:意图-承担科研项目" json:"purpose"` Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"` Shelf - Status TechnologyInstanceStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` + TechnologyStatus ModelDeleted ModelAt } @@ -47,20 +47,6 @@ const ( TechnologyInstanceSourceForOther ) -// TechnologyInstanceStatus 技术文档状态 -type TechnologyInstanceStatus int - -const ( - // TechnologyInstanceStatusForDraft 草稿箱 - TechnologyInstanceStatusForDraft TechnologyInstanceStatus = iota - // TechnologyInstanceStatusForExamining 审核中 - TechnologyInstanceStatusForExamining - // TechnologyInstanceStatusForAgree 审核通过 - TechnologyInstanceStatusForAgree - // TechnologyInstanceStatusForRefuse 审核拒绝 - TechnologyInstanceStatusForRefuse -) - func (m *TechnologyInstance) TableName() string { return m.NewTableName("technology_instance") } diff --git a/app/common/model/technology_prodcut.go b/app/common/model/technology_prodcut.go index 170270e..38723b0 100644 --- a/app/common/model/technology_prodcut.go +++ b/app/common/model/technology_prodcut.go @@ -22,7 +22,7 @@ type TechnologyProduct struct { Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"` Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"` Shelf - Status TechnologyProductStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` + TechnologyStatus ModelDeleted ModelAt } @@ -41,20 +41,6 @@ const ( TechnologyProductLeadStandardForInternationalLX ) -// TechnologyProductStatus 状态 -type TechnologyProductStatus int - -const ( - // TechnologyProductStatusForDraft 草稿箱 - TechnologyProductStatusForDraft TechnologyProductStatus = iota - // TechnologyProductStatusForExamining 审核中 - TechnologyProductStatusForExamining - // TechnologyProductStatusForAgree 审核通过 - TechnologyProductStatusForAgree - // TechnologyProductStatusForRefuse 审核拒绝 - TechnologyProductStatusForRefuse -) - // TechnologyProductShelfStatus 上下架状态 type TechnologyProductShelfStatus int diff --git a/app/common/model/technology_topic.go b/app/common/model/technology_topic.go index bd6390a..0989c47 100644 --- a/app/common/model/technology_topic.go +++ b/app/common/model/technology_topic.go @@ -20,7 +20,7 @@ type TechnologyTopic struct { Kind TechnologyTopicKind `gorm:"column:kind;type:tinyint(1);default:0;comment:类型" json:"kind"` BeginAt time.Time `gorm:"column:begin_at;type:datetime;not null;comment:开始时间" json:"begin_at"` FinishAt time.Time `gorm:"column:finish_at;type:datetime;not null;comment:结束时间" json:"finish_at"` - Status TechnologyTopicStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"` + TechnologyStatus ModelDeleted ModelAt } @@ -40,24 +40,6 @@ const ( // TechnologyTopicKind 技术课题类型 type TechnologyTopicKind int -const ( -//TechnologyTopicKindFor -) - -// TechnologyTopicStatus 技术课题状态 -type TechnologyTopicStatus int - -const ( - // TechnologyTopicStatusForDraft 草稿箱 - TechnologyTopicStatusForDraft TechnologyTopicStatus = iota - // TechnologyTopicStatusForExamining 审核中 - TechnologyTopicStatusForExamining - // TechnologyTopicStatusForAgree 审核通过 - TechnologyTopicStatusForAgree - // TechnologyTopicStatusForRefuse 审核拒绝 - TechnologyTopicStatusForRefuse -) - func (m *TechnologyTopic) TableName() string { return m.NewTableName("technology_topic") } diff --git a/router/address.go b/router/address.go index 60c46e6..30343c7 100644 --- a/router/address.go +++ b/router/address.go @@ -363,6 +363,9 @@ func registerAdminAPI(app *gin.Engine) { technology.POST("/achievement", _api.Achievement) technology.POST("/achievement/detail", _api.AchievementDetail) technology.POST("/achievement/delete", _api.AchievementDelete) + technology.POST("/demand", _api.Demand) + technology.POST("/demand/detail", _api.DemandDetail) + technology.POST("/demand/delete", _api.DemandDelete) } // Activity 活动管理 activity := v1.Group("/activity")