feat:完善项目管理,增加技术成果数据
This commit is contained in:
@ -114,6 +114,21 @@ type (
|
|||||||
Source string `json:"source" form:"source" binding:"required"`
|
Source string `json:"source" form:"source" binding:"required"`
|
||||||
Director string `json:"director" form:"director" binding:"required"`
|
Director string `json:"director" form:"director" binding:"required"`
|
||||||
}
|
}
|
||||||
|
// achievementForm 成果参数
|
||||||
|
achievementForm struct {
|
||||||
|
Mode int `json:"mode" form:"mode" binding:"required"`
|
||||||
|
Title string `json:"title" form:"title" binding:"required"`
|
||||||
|
api.ImageForm
|
||||||
|
File string `json:"file" form:"file" binding:"required"`
|
||||||
|
Industrys []string `json:"industrys" form:"industrys"`
|
||||||
|
Customers []string `json:"customers" form:"customers"`
|
||||||
|
Maturity int `json:"maturity" form:"maturity"`
|
||||||
|
LeadStandard int `json:"lead_standard" form:"lead_standard"`
|
||||||
|
CooperationMode int `json:"cooperation_mode" form:"cooperation_mode"`
|
||||||
|
Keywords []string `json:"keywords" form:"keywords"`
|
||||||
|
Introduce string `json:"introduce" form:"introduce"`
|
||||||
|
IsSubmit int `json:"is_submit" form:"is_submit"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a *instanceForm) FilterProveImages() string {
|
func (a *instanceForm) FilterProveImages() string {
|
||||||
@ -128,6 +143,10 @@ func (a *productForm) FilterMaterial() string {
|
|||||||
return (&api.ImageForm{Image: a.Material}).FilterImageURL()
|
return (&api.ImageForm{Image: a.Material}).FilterImageURL()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *achievementForm) FilterFile() string {
|
||||||
|
return (&api.ImageForm{Image: a.File}).FilterImageURL()
|
||||||
|
}
|
||||||
|
|
||||||
func (a *Technology) Instance(c *gin.Context) {
|
func (a *Technology) Instance(c *gin.Context) {
|
||||||
form := &struct {
|
form := &struct {
|
||||||
Status int `json:"status" form:"status"`
|
Status int `json:"status" form:"status"`
|
||||||
@ -650,3 +669,79 @@ func (a *Technology) ProjectDelete(c *gin.Context) {
|
|||||||
Delete(form.Convert())
|
Delete(form.Convert())
|
||||||
api.APIResponse(err)(c)
|
api.APIResponse(err)(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*Technology) Achievement(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
Status int `json:"status" form:"status"`
|
||||||
|
api.PageForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||||
|
Instance(form.Status, form.Page, form.PageSize)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Technology) AchievementAdd(c *gin.Context) {
|
||||||
|
form := new(achievementForm)
|
||||||
|
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||||
|
Form(&technology2.AchievementParams{Mode: form.Mode,
|
||||||
|
Title: form.Title, Image: form.FilterImageURL(), File: form.FilterFile(),
|
||||||
|
Introduce: form.Introduce, Industrys: form.Industrys,
|
||||||
|
Maturity: form.Maturity, LeadStandard: form.LeadStandard, CooperationMode: form.CooperationMode,
|
||||||
|
Customers: form.Customers, Keywords: form.Keywords, IsSubmit: form.IsSubmit,
|
||||||
|
})
|
||||||
|
api.APIResponse(err)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Technology) AchievementEdit(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
api.IDStringForm
|
||||||
|
achievementForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||||
|
Form(&technology2.AchievementParams{ID: form.Convert(), Mode: form.Mode,
|
||||||
|
Title: form.Title, Image: form.FilterImageURL(), File: form.FilterFile(),
|
||||||
|
Introduce: form.Introduce, Industrys: form.Industrys,
|
||||||
|
Maturity: form.Maturity, LeadStandard: form.LeadStandard, CooperationMode: form.CooperationMode,
|
||||||
|
Customers: form.Customers, Keywords: form.Keywords, IsSubmit: form.IsSubmit,
|
||||||
|
})
|
||||||
|
api.APIResponse(err)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Technology) AchievementShelf(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
api.IDStringForm
|
||||||
|
Status int `json:"status" form:"status" binding:"required"`
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||||
|
Shelf(form.Convert(), form.Status)
|
||||||
|
api.APIResponse(err)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Technology) AchievementDelete(c *gin.Context) {
|
||||||
|
form := new(api.IDStringForm)
|
||||||
|
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||||
|
Delete(form.Convert())
|
||||||
|
api.APIResponse(err)(c)
|
||||||
|
}
|
||||||
|
|||||||
183
app/api/enterprise/controller/technology/achievement.go
Normal file
183
app/api/enterprise/controller/technology/achievement.go
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
package technology
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/api/enterprise/model"
|
||||||
|
"SciencesServer/app/basic/config"
|
||||||
|
"SciencesServer/app/basic/controller"
|
||||||
|
model2 "SciencesServer/app/common/model"
|
||||||
|
"SciencesServer/app/session"
|
||||||
|
"errors"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Achievement 成果信息
|
||||||
|
type Achievement struct {
|
||||||
|
*session.Enterprise
|
||||||
|
local string
|
||||||
|
}
|
||||||
|
|
||||||
|
type AchievementHandle func(session *session.Enterprise, local string) *Achievement
|
||||||
|
|
||||||
|
type (
|
||||||
|
// AchievementInfo 成果信息
|
||||||
|
AchievementInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
*model.TechnologyAchievementInfo
|
||||||
|
Industrys []string `json:"industrys"`
|
||||||
|
}
|
||||||
|
// AchievementDetail 成果详情
|
||||||
|
AchievementDetail struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
*model2.TechnologyAchievement
|
||||||
|
Customers []string `json:"customers"`
|
||||||
|
Keywords []string `json:"keywords"`
|
||||||
|
}
|
||||||
|
// AchievementParams 成果参数信息
|
||||||
|
AchievementParams struct {
|
||||||
|
ID uint64
|
||||||
|
Title, Image, File, Introduce, Source string
|
||||||
|
Mode, Maturity, LeadStandard, CooperationMode int // 技术成熟度 领先标准 合作模式
|
||||||
|
Industrys, Customers, Keywords []string // 所属客户 关键词
|
||||||
|
IsSubmit int // 是否提交审核
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Instance 基本信息
|
||||||
|
func (c *Achievement) Instance(status, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||||
|
|
||||||
|
where := []*model2.ModelWhere{model2.NewWhere("a.status", status)}
|
||||||
|
|
||||||
|
var count int64
|
||||||
|
|
||||||
|
out, err := mTechnologyAchievement.Achievement(page, pageSize, &count, where...)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
list := make([]*AchievementInfo, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
mTechnologyAchievement.Introduce = v.Industry
|
||||||
|
|
||||||
|
list = append(list, &AchievementInfo{
|
||||||
|
ID: v.GetEncodeID(),
|
||||||
|
TechnologyAchievementInfo: v,
|
||||||
|
Industrys: mTechnologyAchievement.GetIndustryAttribute(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detail 详情信息
|
||||||
|
func (c *Achievement) Detail(id uint64) (*AchievementDetail, error) {
|
||||||
|
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||||
|
mTechnologyAchievement.ID = id
|
||||||
|
|
||||||
|
isExist, err := model2.First(mTechnologyAchievement.TechnologyAchievement)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else if !isExist {
|
||||||
|
return nil, errors.New("操作错误,成果信息不存在或已被删除")
|
||||||
|
}
|
||||||
|
return &AchievementDetail{
|
||||||
|
ID: mTechnologyAchievement.GetEncodeID(),
|
||||||
|
TechnologyAchievement: mTechnologyAchievement.TechnologyAchievement,
|
||||||
|
Customers: mTechnologyAchievement.GetCustomerAttribute(),
|
||||||
|
Keywords: mTechnologyAchievement.GetKeywordAttribute(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Form 数据操作
|
||||||
|
func (c *Achievement) Form(params *AchievementParams) error {
|
||||||
|
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||||
|
|
||||||
|
if params.ID > 0 {
|
||||||
|
mTechnologyAchievement.ID = params.ID
|
||||||
|
|
||||||
|
isExist, err := model2.FirstField(mTechnologyAchievement.TechnologyAchievement, []string{"id", "uid", "status", "created_at", "updated_at"})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else if !isExist {
|
||||||
|
return errors.New("操作错误,成果信息不存在或已被删除")
|
||||||
|
} else if mTechnologyAchievement.UID != c.UID {
|
||||||
|
return errors.New("无权限操作")
|
||||||
|
} else if mTechnologyAchievement.Status != model2.TechnologyAchievementStatusForRefuse &&
|
||||||
|
mTechnologyAchievement.Status != model2.TechnologyAchievementStatusForDraft {
|
||||||
|
return errors.New("操作错误,当前状态不允许修改")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mTechnologyAchievement.Mode = model2.TechnologyAchievementMode(params.Mode)
|
||||||
|
mTechnologyAchievement.Title = params.Title
|
||||||
|
mTechnologyAchievement.Image.Image = params.Image
|
||||||
|
mTechnologyAchievement.File = params.File
|
||||||
|
mTechnologyAchievement.SetIndustryAttribute(params.Industrys)
|
||||||
|
mTechnologyAchievement.SetCustomerAttribute(params.Customers)
|
||||||
|
mTechnologyAchievement.Maturity = config.TechnologyMaturity(params.Maturity)
|
||||||
|
mTechnologyAchievement.LeadStandard = model2.TechnologyProductLeadStandard(params.LeadStandard)
|
||||||
|
mTechnologyAchievement.CooperationMode = config.TechnologyCooperationMode(params.CooperationMode)
|
||||||
|
mTechnologyAchievement.SetKeywordAttribute(params.Keywords)
|
||||||
|
mTechnologyAchievement.Introduce = params.Introduce
|
||||||
|
mTechnologyAchievement.Source = params.Source
|
||||||
|
|
||||||
|
if mTechnologyAchievement.ID > 0 {
|
||||||
|
mTechnologyAchievement.Status = model2.TechnologyAchievementStatusForExamining
|
||||||
|
return model2.Updates(mTechnologyAchievement.TechnologyAchievement, mTechnologyAchievement.TechnologyAchievement)
|
||||||
|
}
|
||||||
|
mTechnologyAchievement.Local.Local = c.local
|
||||||
|
mTechnologyAchievement.UID = c.UID
|
||||||
|
|
||||||
|
if params.IsSubmit > 0 {
|
||||||
|
mTechnologyAchievement.Status = model2.TechnologyAchievementStatusForExamining
|
||||||
|
}
|
||||||
|
return model2.Create(mTechnologyAchievement.TechnologyAchievement)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shelf 上下架
|
||||||
|
func (c *Achievement) Shelf(id uint64, status int) error {
|
||||||
|
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||||
|
mTechnologyAchievement.ID = id
|
||||||
|
|
||||||
|
isExist, err := model2.FirstField(mTechnologyAchievement.TechnologyAchievement, []string{"id", "uid", "shelf_status", "status"})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else if !isExist {
|
||||||
|
return errors.New("操作错误,成果信息不存在或已被删除")
|
||||||
|
} else if mTechnologyAchievement.UID != c.UID {
|
||||||
|
return errors.New("无权限操作")
|
||||||
|
} else if mTechnologyAchievement.ShelfStatus == model2.ShelfStatusKind(status) {
|
||||||
|
return errors.New("操作错误,无需变更上下架状态")
|
||||||
|
}
|
||||||
|
return model2.Updates(mTechnologyAchievement.TechnologyAchievement, map[string]interface{}{
|
||||||
|
"shelf_status": status, "updated_at": time.Now(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete 删除操作
|
||||||
|
func (c *Achievement) Delete(id uint64) error {
|
||||||
|
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||||
|
mTechnologyAchievement.ID = id
|
||||||
|
|
||||||
|
isExist, err := model2.FirstField(mTechnologyAchievement.TechnologyAchievement, []string{"id", "uid"})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else if !isExist {
|
||||||
|
return errors.New("操作错误,成就信息不存在或已被删除")
|
||||||
|
} else if mTechnologyAchievement.UID != c.UID {
|
||||||
|
return errors.New("无权限操作")
|
||||||
|
}
|
||||||
|
return model2.Delete(mTechnologyAchievement.TechnologyAchievement)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAchievement() AchievementHandle {
|
||||||
|
return func(session *session.Enterprise, local string) *Achievement {
|
||||||
|
return &Achievement{
|
||||||
|
Enterprise: session,
|
||||||
|
local: local,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -154,7 +154,7 @@ func (c *Product) Form(params *ProductParams) error {
|
|||||||
if params.ID > 0 {
|
if params.ID > 0 {
|
||||||
mTechnologyProduct.ID = params.ID
|
mTechnologyProduct.ID = params.ID
|
||||||
|
|
||||||
isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "m_uid", "status", "created_at", "updated_at"})
|
isExist, err := model2.FirstField(mTechnologyProduct.TechnologyProduct, []string{"id", "uid", "status", "created_at", "updated_at"})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
49
app/api/enterprise/model/technology_achievement.go
Normal file
49
app/api/enterprise/model/technology_achievement.go
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/common/model"
|
||||||
|
"SciencesServer/serve/orm"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TechnologyAchievement struct {
|
||||||
|
*model.TechnologyAchievement
|
||||||
|
}
|
||||||
|
|
||||||
|
type TechnologyAchievementInfo struct {
|
||||||
|
model.Model
|
||||||
|
Title string `json:"title"`
|
||||||
|
Industry string `json:"-"`
|
||||||
|
VisitCount int `json:"visit_count"`
|
||||||
|
model.Shelf
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Achievement 成果信息
|
||||||
|
func (m *TechnologyAchievement) Achievement(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyAchievementInfo, error) {
|
||||||
|
db := orm.GetDB().Table(m.TableName()+" AS a").
|
||||||
|
Select("a.id", "a.title", "a.industry", "v.count AS visit_count", "a.shelf_status", "a.created_at").
|
||||||
|
Joins(fmt.Sprintf("LEFT JOIN (SELECT achievement_id, COUNT(id) AS count FROM %s WHERE is_deleted = %d) AS v ON a.id = v.achievement_id",
|
||||||
|
model.NewTechnologyAchievementVisit().TableName(), model.DeleteStatusForNot)).
|
||||||
|
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
||||||
|
|
||||||
|
if len(where) > 0 {
|
||||||
|
for _, wo := range where {
|
||||||
|
db = db.Where(wo.Condition, wo.Value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out := make([]*TechnologyAchievementInfo, 0)
|
||||||
|
|
||||||
|
if err := db.Count(count).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := db.Order("a.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTechnologyAchievement() *TechnologyAchievement {
|
||||||
|
return &TechnologyAchievement{model.NewTechnologyAchievement()}
|
||||||
|
}
|
||||||
13
app/api/website/controller/activity.go
Normal file
13
app/api/website/controller/activity.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package controller
|
||||||
|
|
||||||
|
type Activity struct{}
|
||||||
|
|
||||||
|
type ActivityHandle func() *Activity
|
||||||
|
|
||||||
|
func (c *Activity) Instance(title, page, pageSize int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewActivity() ActivityHandle {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@ -1,6 +1,10 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import "SciencesServer/app/service"
|
import (
|
||||||
|
"SciencesServer/app/api/website/model"
|
||||||
|
model2 "SciencesServer/app/common/model"
|
||||||
|
"SciencesServer/app/service"
|
||||||
|
)
|
||||||
|
|
||||||
type Index struct {
|
type Index struct {
|
||||||
*service.Session
|
*service.Session
|
||||||
@ -9,6 +13,59 @@ type Index struct {
|
|||||||
|
|
||||||
type IndexHandle func(session *service.Session, local string) *Index
|
type IndexHandle func(session *service.Session, local string) *Index
|
||||||
|
|
||||||
|
type (
|
||||||
|
// InstanceInfo 首页信息
|
||||||
|
InstanceInfo struct {
|
||||||
|
*InstanceStaticInfo
|
||||||
|
Distribution map[string]*InstanceDistributionInfo `json:"distribution"`
|
||||||
|
}
|
||||||
|
// InstanceStaticInfo 统计信息
|
||||||
|
InstanceStaticInfo struct {
|
||||||
|
ExpertCount int64 `json:"expert_count"`
|
||||||
|
CompanyCount int64 `json:"company_count"`
|
||||||
|
}
|
||||||
|
// InstanceDistributionInfo 分布信息
|
||||||
|
InstanceDistributionInfo struct {
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// static 数量统计
|
||||||
|
func (c *Index) static() (*InstanceStaticInfo, error) {
|
||||||
|
out := new(InstanceStaticInfo)
|
||||||
|
var err error
|
||||||
|
// 专家信息
|
||||||
|
mManageExpert := model.NewManageExpert()
|
||||||
|
|
||||||
|
if err = model2.Count(mManageExpert.ManageExpert, &out.ExpertCount, model2.NewWhere("examine_status", model2.ExamineStatusForAgree)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 专利信息
|
||||||
|
|
||||||
|
//成果信息
|
||||||
|
// 公司信息
|
||||||
|
mManageCompany := model.NewManageCompany()
|
||||||
|
|
||||||
|
if err = model2.Count(mManageCompany.ManageCompany, &out.CompanyCount, model2.NewWhere("examine_status", model2.ExamineStatusForAgree)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Index) distributionExpert() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Instance 首页信息
|
||||||
|
func (c *Index) Instance() (*InstanceInfo, error) {
|
||||||
|
out := new(InstanceInfo)
|
||||||
|
var err error
|
||||||
|
|
||||||
|
if out.InstanceStaticInfo, err = c.static(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func NewIndex() IndexHandle {
|
func NewIndex() IndexHandle {
|
||||||
return func(session *service.Session, local string) *Index {
|
return func(session *service.Session, local string) *Index {
|
||||||
return &Index{
|
return &Index{
|
||||||
|
|||||||
11
app/api/website/model/manage_company.go
Normal file
11
app/api/website/model/manage_company.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "SciencesServer/app/common/model"
|
||||||
|
|
||||||
|
type ManageCompany struct {
|
||||||
|
*model.ManageCompany
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewManageCompany() *ManageCompany {
|
||||||
|
return &ManageCompany{model.NewManageCompany()}
|
||||||
|
}
|
||||||
11
app/api/website/model/manage_expert.go
Normal file
11
app/api/website/model/manage_expert.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "SciencesServer/app/common/model"
|
||||||
|
|
||||||
|
type ManageExpert struct {
|
||||||
|
*model.ManageExpert
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewManageExpert() *ManageExpert {
|
||||||
|
return &ManageExpert{model.NewManageExpert()}
|
||||||
|
}
|
||||||
94
app/common/model/technology_achievement.go
Normal file
94
app/common/model/technology_achievement.go
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/basic/config"
|
||||||
|
"encoding/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TechnologyAchievement 技术成果数据模型
|
||||||
|
type TechnologyAchievement struct {
|
||||||
|
Model
|
||||||
|
Local
|
||||||
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
|
Mode TechnologyAchievementMode `gorm:"column:mode;type:tinyint(1);default:1;comment:成果模式" json:"mode"`
|
||||||
|
Title string `gorm:"column:title;type:varchar(100);default:'';comment:成果名称" json:"title"`
|
||||||
|
Image
|
||||||
|
File string `gorm:"column:file;type:varchar(255);default:'';comment:证明材料" json:"file"`
|
||||||
|
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:所属领域;行业信息" json:"industry"`
|
||||||
|
Customer string `gorm:"column:customer;type:varchar(255);default:'';comment:应用客户" json:"-"`
|
||||||
|
Maturity config.TechnologyMaturity `gorm:"column:maturity;type:tinyint(1);default:0;comment:技术成熟度" json:"maturity"`
|
||||||
|
LeadStandard TechnologyProductLeadStandard `gorm:"column:lead_standard;type:tinyint(1);default:0;comment:领先标准" json:"lead_standard"`
|
||||||
|
CooperationMode config.TechnologyCooperationMode `gorm:"column:cooperation_mode;type:tinyint(1);default:0;comment:合作模式" json:"cooperation_mode"`
|
||||||
|
Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"`
|
||||||
|
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"`
|
||||||
|
ModelDeleted
|
||||||
|
ModelAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// TechnologyAchievementMode 技术成本模式
|
||||||
|
type TechnologyAchievementMode int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// TechnologyAchievementModeForFree 免费模式
|
||||||
|
TechnologyAchievementModeForFree TechnologyAchievementMode = iota + 1
|
||||||
|
// TechnologyAchievementModeForCharge 收费模式
|
||||||
|
TechnologyAchievementModeForCharge
|
||||||
|
)
|
||||||
|
|
||||||
|
// TechnologyAchievementStatus 技术成果状态
|
||||||
|
type TechnologyAchievementStatus int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// TechnologyAchievementStatusForDraft 草稿箱
|
||||||
|
TechnologyAchievementStatusForDraft TechnologyAchievementStatus = iota
|
||||||
|
// TechnologyAchievementStatusForExamining 审核中
|
||||||
|
TechnologyAchievementStatusForExamining
|
||||||
|
// TechnologyAchievementStatusForAgree 审核通过
|
||||||
|
TechnologyAchievementStatusForAgree
|
||||||
|
// TechnologyAchievementStatusForRefuse 审核拒绝
|
||||||
|
TechnologyAchievementStatusForRefuse
|
||||||
|
)
|
||||||
|
|
||||||
|
func (m *TechnologyAchievement) TableName() string {
|
||||||
|
return "technology_achievement"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyAchievement) GetIndustryAttribute() []string {
|
||||||
|
out := make([]string, 0)
|
||||||
|
_ = json.Unmarshal([]byte(m.Industry), &out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyAchievement) SetIndustryAttribute(value []string) {
|
||||||
|
_bytes, _ := json.Marshal(value)
|
||||||
|
m.Industry = string(_bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyAchievement) GetCustomerAttribute() []string {
|
||||||
|
out := make([]string, 0)
|
||||||
|
_ = json.Unmarshal([]byte(m.Customer), &out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyAchievement) SetCustomerAttribute(value []string) {
|
||||||
|
_bytes, _ := json.Marshal(value)
|
||||||
|
m.Customer = string(_bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyAchievement) GetKeywordAttribute() []string {
|
||||||
|
out := make([]string, 0)
|
||||||
|
_ = json.Unmarshal([]byte(m.Keyword), &out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyAchievement) SetKeywordAttribute(value []string) {
|
||||||
|
_bytes, _ := json.Marshal(value)
|
||||||
|
m.Keyword = string(_bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTechnologyAchievement() *TechnologyAchievement {
|
||||||
|
return &TechnologyAchievement{}
|
||||||
|
}
|
||||||
22
app/common/model/technology_achievement_visit.go
Normal file
22
app/common/model/technology_achievement_visit.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// TechnologyAchievementVisit 科技成果访问数据模型
|
||||||
|
type TechnologyAchievementVisit struct {
|
||||||
|
Model
|
||||||
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
|
AchievementID uint64 `gorm:"column:achievement_id;index:idx_achievement_visit_achievement;type:int(11);default:0;comment:科技成果ID" json:"-"`
|
||||||
|
Count int `gorm:"column:count;type:int(8);default:0;comment:浏览次数" json:"count"`
|
||||||
|
Date time.Time `gorm:"column:date;type:datetime;not null;comment:浏览时间" json:"date"`
|
||||||
|
ModelDeleted
|
||||||
|
ModelAt
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyAchievementVisit) TableName() string {
|
||||||
|
return "technology_achievement_visit"
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTechnologyAchievementVisit() *TechnologyAchievementVisit {
|
||||||
|
return &TechnologyAchievementVisit{}
|
||||||
|
}
|
||||||
@ -218,6 +218,11 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
|||||||
technologyV1.POST("/project/edit", _api.ProjectEdit)
|
technologyV1.POST("/project/edit", _api.ProjectEdit)
|
||||||
technologyV1.POST("/project/shelf", _api.ProjectShelf)
|
technologyV1.POST("/project/shelf", _api.ProjectShelf)
|
||||||
technologyV1.POST("/project/delete", _api.ProjectDelete)
|
technologyV1.POST("/project/delete", _api.ProjectDelete)
|
||||||
|
technologyV1.POST("/achievement", _api.Achievement)
|
||||||
|
technologyV1.POST("/achievement/add", _api.AchievementAdd)
|
||||||
|
technologyV1.POST("/achievement/edit", _api.AchievementEdit)
|
||||||
|
technologyV1.POST("/achievement/shelf", _api.AchievementShelf)
|
||||||
|
technologyV1.POST("/achievement/delete", _api.AchievementDelete)
|
||||||
}
|
}
|
||||||
// Service 服务信息
|
// Service 服务信息
|
||||||
serviceV1 := v1.Group("/service")
|
serviceV1 := v1.Group("/service")
|
||||||
|
|||||||
Reference in New Issue
Block a user