feat:增加专利模型数据
This commit is contained in:
27
app/api/enterprise/api/sys.go
Normal file
27
app/api/enterprise/api/sys.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/api/enterprise/controller/sys"
|
||||||
|
"SciencesServer/app/basic/api"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Sys struct{}
|
||||||
|
|
||||||
|
func (*Sys) Patent(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
Kind int `json:"kind" form:"kind"`
|
||||||
|
Title string `json:"title" form:"title"`
|
||||||
|
ApplyCode string `json:"apply_code" form:"apply_code"`
|
||||||
|
OpenCode string `json:"open_code" form:"open_code"`
|
||||||
|
IPCCode string `json:"ipc_code" form:"ipc_code"`
|
||||||
|
api.PageForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := sys.NewPatent()(nil).
|
||||||
|
List(form.Kind, form.Title, form.ApplyCode, form.OpenCode, form.IPCCode, form.Page, form.PageSize)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
@ -158,3 +158,14 @@ func (*User) BackUnbind(c *gin.Context) {
|
|||||||
err := user.NewBank()(api.GetSession()(c).(*session.Enterprise)).Unbind(form.Convert())
|
err := user.NewBank()(api.GetSession()(c).(*session.Enterprise)).Unbind(form.Convert())
|
||||||
api.APIResponse(err)
|
api.APIResponse(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*User) Patent(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
Title string `json:"title" form:"title"`
|
||||||
|
api.PageForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
97
app/api/enterprise/controller/sys/patent.go
Normal file
97
app/api/enterprise/controller/sys/patent.go
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
package sys
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/api/enterprise/model"
|
||||||
|
"SciencesServer/app/basic/controller"
|
||||||
|
model2 "SciencesServer/app/common/model"
|
||||||
|
"SciencesServer/app/session"
|
||||||
|
"SciencesServer/utils"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Patent 专利信息
|
||||||
|
type Patent struct {
|
||||||
|
*session.Enterprise
|
||||||
|
}
|
||||||
|
|
||||||
|
type PatentHandle func(session *session.Enterprise) *Patent
|
||||||
|
|
||||||
|
type (
|
||||||
|
// PatentInfo 专利信息
|
||||||
|
PatentInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Kind model2.SysParentKind `json:"kind"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (c *Patent) filter(src string) string {
|
||||||
|
src = utils.ReplaceAllCompile(src, "\t", "")
|
||||||
|
src = utils.ReplaceAllCompile(src, "\n", "")
|
||||||
|
src = strings.TrimLeft(src, " ")
|
||||||
|
src = strings.TrimRight(src, " ")
|
||||||
|
return src
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
mSysPatent := model.NewSysPatent()
|
||||||
|
|
||||||
|
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{Order: model2.NewOrder("id", model2.OrderModeToDesc)}}
|
||||||
|
|
||||||
|
if kind <= 0 {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhere("kind", kind),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if title != "" {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhereLike("title", title),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if applyCode != "" {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhereLike("apply_code", applyCode),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if openCode != "" {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhereLike("open_code", openCode),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if ipcCode != "" {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhereLike("ipc_code", ipcCode),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
out := make([]*model2.SysPatent, 0)
|
||||||
|
|
||||||
|
var count int64
|
||||||
|
|
||||||
|
if err := model2.Pages(mSysPatent.SysPatent, &out, page, pageSize, &count); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
list := make([]*PatentInfo, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
list = append(list, &PatentInfo{
|
||||||
|
ID: v.GetEncodeID(),
|
||||||
|
Kind: v.Kind,
|
||||||
|
Title: v.Title,
|
||||||
|
})
|
||||||
|
v.ApplyName = c.filter(v.ApplyName)
|
||||||
|
v.ApplyAddress = c.filter(v.ApplyAddress)
|
||||||
|
v.Inventor = c.filter(v.Inventor)
|
||||||
|
v.Description = c.filter(v.Description)
|
||||||
|
}
|
||||||
|
return &controller.ReturnPages{
|
||||||
|
Data: out,
|
||||||
|
Count: count,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPatent() PatentHandle {
|
||||||
|
return func(session *session.Enterprise) *Patent {
|
||||||
|
return &Patent{Enterprise: session}
|
||||||
|
}
|
||||||
|
}
|
@ -120,7 +120,7 @@ func (c *Instance) Form(params *InstanceParams) error {
|
|||||||
func (c *Instance) Shelf(id uint64, status int) error {
|
func (c *Instance) Shelf(id uint64, status int) error {
|
||||||
mTechnologyInstance := model.NewTechnologyInstance()
|
mTechnologyInstance := model.NewTechnologyInstance()
|
||||||
mTechnologyInstance.ID = id
|
mTechnologyInstance.ID = id
|
||||||
isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "m_uid", "shelf_status", "status"})
|
isExist, err := model2.FirstField(mTechnologyInstance.TechnologyInstance, []string{"id", "m_uid", "shelf", "status"})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -130,11 +130,11 @@ func (c *Instance) Shelf(id uint64, status int) error {
|
|||||||
return errors.New("操作错误,无权限操作")
|
return errors.New("操作错误,无权限操作")
|
||||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
|
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
|
||||||
return errors.New("操作错误,当前状态不允许处理上下架")
|
return errors.New("操作错误,当前状态不允许处理上下架")
|
||||||
} else if mTechnologyInstance.ShelfStatus.ShelfStatus == model2.ShelfStatusKind(status) {
|
} else if mTechnologyInstance.ShelfStatus.Shelf == model2.ShelfStatusKind(status) {
|
||||||
return errors.New("操作错误,状态异常")
|
return errors.New("操作错误,状态异常")
|
||||||
}
|
}
|
||||||
if err = model2.Updates(mTechnologyInstance.TechnologyInstance, map[string]interface{}{
|
if err = model2.Updates(mTechnologyInstance.TechnologyInstance, map[string]interface{}{
|
||||||
"shelf_status": status, "updated_at": time.Now(),
|
"shelf": status, "updated_at": time.Now(),
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -158,11 +158,11 @@ func (c *Product) Shelf(id uint64, status int) error {
|
|||||||
return errors.New("操作错误,产品信息不存在或已被删除")
|
return errors.New("操作错误,产品信息不存在或已被删除")
|
||||||
} else if mTechnologyProduct.MUid != c.ManageUID {
|
} else if mTechnologyProduct.MUid != c.ManageUID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
} else if mTechnologyProduct.ShelfStatus.ShelfStatus == model2.ShelfStatusKind(status) {
|
} else if mTechnologyProduct.ShelfStatus.Shelf == model2.ShelfStatusKind(status) {
|
||||||
return errors.New("操作错误,无需变更上下架状态")
|
return errors.New("操作错误,无需变更上下架状态")
|
||||||
}
|
}
|
||||||
return model2.Updates(mTechnologyProduct.TechnologyProduct, map[string]interface{}{
|
return model2.Updates(mTechnologyProduct.TechnologyProduct, map[string]interface{}{
|
||||||
"shelf_status": status, "updated_at": time.Now(),
|
"shelf": status, "updated_at": time.Now(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1,15 @@
|
|||||||
package tenant
|
package tenant
|
||||||
|
|
||||||
|
import "SciencesServer/app/session"
|
||||||
|
|
||||||
|
type Instance struct {
|
||||||
|
*session.Enterprise
|
||||||
|
}
|
||||||
|
|
||||||
|
type InstanceHandle func(session *session.Enterprise) *Instance
|
||||||
|
|
||||||
|
func NewInstance() InstanceHandle {
|
||||||
|
return func(session *session.Enterprise) *Instance {
|
||||||
|
return &Instance{Enterprise: session}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
105
app/api/enterprise/controller/user/patent.go
Normal file
105
app/api/enterprise/controller/user/patent.go
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/api/enterprise/model"
|
||||||
|
"SciencesServer/app/basic/controller"
|
||||||
|
model2 "SciencesServer/app/common/model"
|
||||||
|
"SciencesServer/app/session"
|
||||||
|
"SciencesServer/serve/orm"
|
||||||
|
"errors"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Patent struct {
|
||||||
|
*session.Enterprise
|
||||||
|
local string
|
||||||
|
}
|
||||||
|
|
||||||
|
type PatentHandle func(session *session.Enterprise, local string) *Patent
|
||||||
|
|
||||||
|
type (
|
||||||
|
// PatentParams 专利参数信息
|
||||||
|
PatentParams struct {
|
||||||
|
ID uint64
|
||||||
|
Title string
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (c *PatentParams) add() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *PatentParams) edit() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
return &controller.ReturnPages{
|
||||||
|
Data: nil,
|
||||||
|
Count: 0,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Patent) Form(params *PatentParams) error {
|
||||||
|
if params.ID <= 0 {
|
||||||
|
return params.add()
|
||||||
|
}
|
||||||
|
return params.edit()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shelf 上下架操作
|
||||||
|
func (c *Patent) Shelf(id uint64, status int) error {
|
||||||
|
mUserPatent := model.NewUserPatent()
|
||||||
|
mUserPatent.ID = id
|
||||||
|
|
||||||
|
isExist, err := model2.FirstField(mUserPatent.UserPatent, []string{"id", "uid", "patent_id"})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else if !isExist {
|
||||||
|
return errors.New("操作错误,用户专利信息不存在或已被删除")
|
||||||
|
} else if mUserPatent.UID != c.UID {
|
||||||
|
return errors.New("无权限操作")
|
||||||
|
}
|
||||||
|
mSysPatent := model.NewSysPatent()
|
||||||
|
mSysPatent.ID = mUserPatent.PatentID
|
||||||
|
|
||||||
|
return model2.Updates(mSysPatent.SysPatent, map[string]interface{}{
|
||||||
|
"shelf": status, "updated_at": time.Now(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete 删除操作
|
||||||
|
func (c *Patent) Delete(id uint64) error {
|
||||||
|
mUserPatent := model.NewUserPatent()
|
||||||
|
mUserPatent.ID = id
|
||||||
|
|
||||||
|
isExist, err := model2.FirstField(mUserPatent.UserPatent, []string{"id", "uid", "patent_id"})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
} else if !isExist {
|
||||||
|
return errors.New("操作错误,用户专利信息不存在或已被删除")
|
||||||
|
} else if mUserPatent.UID != c.UID {
|
||||||
|
return errors.New("无权限操作")
|
||||||
|
}
|
||||||
|
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||||
|
if err = model2.Delete(mUserPatent.UserPatent); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mSysPatent := model.NewSysPatent()
|
||||||
|
mSysPatent.ID = mUserPatent.PatentID
|
||||||
|
|
||||||
|
return model2.Delete(mSysPatent.SysPatent)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPatent() PatentHandle {
|
||||||
|
return func(session *session.Enterprise, local string) *Patent {
|
||||||
|
return &Patent{
|
||||||
|
Enterprise: session,
|
||||||
|
local: local,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
app/api/enterprise/model/sys_patent.go
Normal file
12
app/api/enterprise/model/sys_patent.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "SciencesServer/app/common/model"
|
||||||
|
|
||||||
|
// SysPatent 专利信息
|
||||||
|
type SysPatent struct {
|
||||||
|
*model.SysPatent
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSysPatent() *SysPatent {
|
||||||
|
return &SysPatent{model.NewSysPatent()}
|
||||||
|
}
|
11
app/api/enterprise/model/user_patent.go
Normal file
11
app/api/enterprise/model/user_patent.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "SciencesServer/app/common/model"
|
||||||
|
|
||||||
|
type UserPatent struct {
|
||||||
|
*model.UserPatent
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserPatent() *UserPatent {
|
||||||
|
return &UserPatent{model.NewUserPatent()}
|
||||||
|
}
|
@ -49,6 +49,9 @@ func initModel() {
|
|||||||
&synchronized{iModel: model.NewSysConfig(), iValues: func() interface{} {
|
&synchronized{iModel: model.NewSysConfig(), iValues: func() interface{} {
|
||||||
return nil
|
return nil
|
||||||
}},
|
}},
|
||||||
|
&synchronized{iModel: model.NewSysPatent(), iValues: func() interface{} {
|
||||||
|
return nil
|
||||||
|
}},
|
||||||
// 日志管理
|
// 日志管理
|
||||||
&synchronized{iModel: model.NewSysUserRole()},
|
&synchronized{iModel: model.NewSysUserRole()},
|
||||||
&synchronized{iModel: model.NewSysLog()}, &synchronized{iModel: model.NewSysUserLoginLog()},
|
&synchronized{iModel: model.NewSysLog()}, &synchronized{iModel: model.NewSysUserLoginLog()},
|
||||||
|
@ -74,7 +74,7 @@ const (
|
|||||||
|
|
||||||
// ShelfStatus 上下架状态
|
// ShelfStatus 上下架状态
|
||||||
type ShelfStatus struct {
|
type ShelfStatus struct {
|
||||||
ShelfStatus ShelfStatusKind `gorm:"column:shelf_status;type:tinyint(1);default:0;comment:上下架状态(1:上架,2:下架)" json:"shelf_status"`
|
Shelf ShelfStatusKind `gorm:"column:shelf;type:tinyint(1);default:0;comment:上下架状态(1:上架,2:下架)" json:"shelf"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ShelfStatusKind int
|
type ShelfStatusKind int
|
||||||
|
@ -373,6 +373,25 @@ func ScanFields(model IModel, out interface{}, fields []string, where ...*ModelW
|
|||||||
return db.Scan(out).Error
|
return db.Scan(out).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ScanLimitFields(model IModel, out interface{}, fields []string, limit int, where ...*ModelWhereOrder) error {
|
||||||
|
db := orm.GetDB().Table(model.TableName()).Select(fields)
|
||||||
|
|
||||||
|
if len(where) > 0 {
|
||||||
|
for _, wo := range where {
|
||||||
|
if wo.Where != nil {
|
||||||
|
db = db.Where(wo.Where.Condition, wo.Where.Value)
|
||||||
|
}
|
||||||
|
if wo.Order != nil {
|
||||||
|
db = db.Order(fmt.Sprintf("%s %s", wo.Order.Field, wo.Order.Mode))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if db.Migrator().HasColumn(model, FieldsForDeleted) {
|
||||||
|
db = db.Where(FieldsForDeleted, DeleteStatusForNot)
|
||||||
|
}
|
||||||
|
return db.Offset(0).Limit(limit).Scan(out).Error
|
||||||
|
}
|
||||||
|
|
||||||
func Pluck(model IModel, field string, out interface{}, where ...*ModelWhere) error {
|
func Pluck(model IModel, field string, out interface{}, where ...*ModelWhere) error {
|
||||||
db := orm.GetDB().Table(model.TableName())
|
db := orm.GetDB().Table(model.TableName())
|
||||||
|
|
||||||
|
55
app/common/model/sys_patent.go
Normal file
55
app/common/model/sys_patent.go
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
// SysPatent 专利信息数据模型
|
||||||
|
type SysPatent struct {
|
||||||
|
Model
|
||||||
|
Kind SysParentKind `gorm:"column:kind;type:tinyint(1);default:0;comment:专利类型" json:"kind"`
|
||||||
|
Title string `gorm:"column:title;type:varchar(255);default:null;comment:名称标题" json:"title"`
|
||||||
|
FileUrl string `gorm:"column:file_url;type:varchar(255);default:null;comment:文件地址" json:"file_url"`
|
||||||
|
ApplyCode string `gorm:"column:apply_code;type:varchar(50);default:null;comment:申请号" json:"apply_code"`
|
||||||
|
ApplyAt string `gorm:"column:apply_at;type:varchar(30);default:null;comment:申请日" json:"apply_at"`
|
||||||
|
OpenCode string `gorm:"column:open_code;type:varchar(50);default:null;comment:公开(公告)号" json:"open_code"`
|
||||||
|
OpenAt string `gorm:"column:open_at;type:varchar(30);default:null;comment:公开(公告)日" json:"open_at"`
|
||||||
|
ApplyName string `gorm:"column:apply_name;type:varchar(100);default:null;comment:申请(专利权)人" json:"apply_name"`
|
||||||
|
ApplyAddress string `gorm:"column:apply_address;type:varchar(255);default:null;comment:申请人地址" json:"apply_address"`
|
||||||
|
Inventor string `gorm:"column:inventor;type:varchar(100);default:null;comment:发明人" json:"inventor"`
|
||||||
|
Description string `gorm:"column:description;type:text;default:null;comment:摘要" json:"description"`
|
||||||
|
PrincipalClaim string `gorm:"column:principal_claim;type:text;default:null;comment:主权项" json:"principal_claim"`
|
||||||
|
IPCCode string `gorm:"column:ipc_code;type:varchar(50);default:null;comment:IPC主分类号" json:"ipc_code"`
|
||||||
|
ShelfStatus
|
||||||
|
Status SysParentStatus `gorm:"column:status;type:tinyint(1);default:1;comment:专利状态(1:授权,2:实审,3:公开)" json:"-"`
|
||||||
|
ModelDeleted
|
||||||
|
ModelAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// SysParentKind 专利类型
|
||||||
|
type SysParentKind int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// SysParentKindForInvent 发明专利
|
||||||
|
SysParentKindForInvent SysParentKind = iota + 1
|
||||||
|
// SysParentKindForDesign 外观设计
|
||||||
|
SysParentKindForDesign
|
||||||
|
// SysParentKindForNewPractical 实用新型
|
||||||
|
SysParentKindForNewPractical
|
||||||
|
)
|
||||||
|
|
||||||
|
// SysParentStatus 专利状态
|
||||||
|
type SysParentStatus int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// SysParentStatusForAuthorize 授权
|
||||||
|
SysParentStatusForAuthorize SysParentStatus = iota + 1
|
||||||
|
// SysParentStatusForActualTrial 实审
|
||||||
|
SysParentStatusForActualTrial
|
||||||
|
// SysParentStatusForPublic 公开
|
||||||
|
SysParentStatusForPublic
|
||||||
|
)
|
||||||
|
|
||||||
|
func (m *SysPatent) TableName() string {
|
||||||
|
return "sys_patent"
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSysPatent() *SysPatent {
|
||||||
|
return &SysPatent{}
|
||||||
|
}
|
108
app/common/model/technology_prodcut.go
Normal file
108
app/common/model/technology_prodcut.go
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/basic/config"
|
||||||
|
"encoding/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TechnologyProduct 技术产品数据模型
|
||||||
|
type TechnologyProduct struct {
|
||||||
|
Model
|
||||||
|
ModelTenant
|
||||||
|
Local
|
||||||
|
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
||||||
|
Title string `gorm:"column:title;type:varchar(100);default:null;comment:产品名称" json:"title"`
|
||||||
|
Image
|
||||||
|
Video string `gorm:"column:video;type:varchar(255);default:null;comment:视频地址" json:"video"`
|
||||||
|
Material string `gorm:"column:material;type:varchar(255);default:null;comment:证明材料" json:"material"`
|
||||||
|
Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:所属领域" json:"industry"`
|
||||||
|
Customer string `gorm:"column:customer;type:varchar(255);default:null;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:null;comment:关键词" json:"-"`
|
||||||
|
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||||
|
ShelfStatus
|
||||||
|
Status TechnologyProductStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
|
||||||
|
ModelDeleted
|
||||||
|
ModelAt
|
||||||
|
}
|
||||||
|
|
||||||
|
// TechnologyProductLeadStandard 领先标准
|
||||||
|
type TechnologyProductLeadStandard int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// TechnologyProductLeadStandardForDomesticXJ 国内先进
|
||||||
|
TechnologyProductLeadStandardForDomesticXJ TechnologyProductLeadStandard = iota + 1
|
||||||
|
// TechnologyProductLeadStandardForDomesticLX 国内领先
|
||||||
|
TechnologyProductLeadStandardForDomesticLX
|
||||||
|
// TechnologyProductLeadStandardForInternationalXJ 国际先进
|
||||||
|
TechnologyProductLeadStandardForInternationalXJ
|
||||||
|
// TechnologyProductLeadStandardForInternationalLX 国际领先
|
||||||
|
TechnologyProductLeadStandardForInternationalLX
|
||||||
|
)
|
||||||
|
|
||||||
|
// TechnologyProductStatus 状态
|
||||||
|
type TechnologyProductStatus int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// TechnologyProductStatusForDraft 草稿箱
|
||||||
|
TechnologyProductStatusForDraft TechnologyProductStatus = iota
|
||||||
|
// TechnologyProductStatusForExamining 审核中
|
||||||
|
TechnologyProductStatusForExamining
|
||||||
|
// TechnologyProductStatusForAgree 审核通过
|
||||||
|
TechnologyProductStatusForAgree
|
||||||
|
// TechnologyProductStatusForRefuse 审核拒绝
|
||||||
|
TechnologyProductStatusForRefuse
|
||||||
|
)
|
||||||
|
|
||||||
|
// TechnologyProductShelfStatus 上下架状态
|
||||||
|
type TechnologyProductShelfStatus int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// TechnologyProductShelfStatusForUp 上架
|
||||||
|
TechnologyProductShelfStatusForUp TechnologyProductShelfStatus = iota + 1
|
||||||
|
// TechnologyProductShelfStatusForDown 下架
|
||||||
|
TechnologyProductShelfStatusForDown
|
||||||
|
)
|
||||||
|
|
||||||
|
func (m *TechnologyProduct) TableName() string {
|
||||||
|
return "technology_product"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyProduct) GetIndustryAttribute() []string {
|
||||||
|
out := make([]string, 0)
|
||||||
|
_ = json.Unmarshal([]byte(m.Industry), &out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyProduct) SetIndustryAttribute(value []string) {
|
||||||
|
_bytes, _ := json.Marshal(value)
|
||||||
|
m.Industry = string(_bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyProduct) GetCustomerAttribute() []string {
|
||||||
|
out := make([]string, 0)
|
||||||
|
_ = json.Unmarshal([]byte(m.Customer), &out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyProduct) SetCustomerAttribute(value []string) {
|
||||||
|
_bytes, _ := json.Marshal(value)
|
||||||
|
m.Customer = string(_bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyProduct) GetKeywordAttribute() []string {
|
||||||
|
out := make([]string, 0)
|
||||||
|
_ = json.Unmarshal([]byte(m.Keyword), &out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *TechnologyProduct) SetKeywordAttribute(value []string) {
|
||||||
|
_bytes, _ := json.Marshal(value)
|
||||||
|
m.Keyword = string(_bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTechnologyProduct() *TechnologyProduct {
|
||||||
|
return &TechnologyProduct{}
|
||||||
|
}
|
18
app/common/model/user_consume.go
Normal file
18
app/common/model/user_consume.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
// UserConsume 用户资产消耗
|
||||||
|
type UserConsume struct {
|
||||||
|
Model
|
||||||
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
|
Source int `json:"source"`
|
||||||
|
ModelDeleted
|
||||||
|
ModelAt
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserConsume) TableName() string {
|
||||||
|
return "user_consume"
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserConsume() *UserConsume {
|
||||||
|
return &UserConsume{}
|
||||||
|
}
|
19
app/common/model/user_patent.go
Normal file
19
app/common/model/user_patent.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
// UserPatent 用户专利信息数据模型
|
||||||
|
type UserPatent struct {
|
||||||
|
Model
|
||||||
|
Local
|
||||||
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
|
PatentID uint64 `gorm:"column:patent_id;type:int(11);default:0;comment:专利ID" json:"-"`
|
||||||
|
ModelDeleted
|
||||||
|
ModelAt
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserPatent) TableName() string {
|
||||||
|
return "user_patent"
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserPatent() *UserPatent {
|
||||||
|
return &UserPatent{}
|
||||||
|
}
|
@ -127,7 +127,7 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
|||||||
apiPrefix := "/enterprise"
|
apiPrefix := "/enterprise"
|
||||||
g := app.Group(apiPrefix)
|
g := app.Group(apiPrefix)
|
||||||
|
|
||||||
g.Use(NeedLogin(session.NewManage(), AddSkipperURL([]string{}...)))
|
//g.Use(NeedLogin(session.NewManage(), AddSkipperURL([]string{}...)))
|
||||||
|
|
||||||
v1 := g.Group("/v1")
|
v1 := g.Group("/v1")
|
||||||
|
|
||||||
@ -148,6 +148,12 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
|||||||
accountV1.POST("/authorize", _api.Authorize)
|
accountV1.POST("/authorize", _api.Authorize)
|
||||||
accountV1.POST("/logout", _api.Logout)
|
accountV1.POST("/logout", _api.Logout)
|
||||||
}
|
}
|
||||||
|
// Sys 配置管理
|
||||||
|
sysV1 := v1.Group("/sys")
|
||||||
|
{
|
||||||
|
_api := new(api2.Sys)
|
||||||
|
sysV1.POST("/patent", _api.Patent)
|
||||||
|
}
|
||||||
// Technology 技术管理
|
// Technology 技术管理
|
||||||
technologyV1 := g.Group("/technology")
|
technologyV1 := g.Group("/technology")
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user