feat:完善项目管理,增加网站首页接口信息
This commit is contained in:
@ -27,8 +27,8 @@ type (
|
||||
Status model.AccountStatusKind
|
||||
}
|
||||
InstanceLoginReturn struct {
|
||||
Token string `json:"token"`
|
||||
EffectTime int `json:"effect_time"`
|
||||
Token string `json:"token"`
|
||||
TokenEffectTime int `json:"token_effect_time"`
|
||||
}
|
||||
)
|
||||
|
||||
@ -51,7 +51,7 @@ func (c *Instance) Login() InstanceLoginCallback {
|
||||
|
||||
service.Publish(config.EventForRedisHashProduce, config.RedisKeyForAccount, _session.UIDToString(), _session)
|
||||
|
||||
return &InstanceLoginReturn{Token: token, EffectTime: config.SettingInfo.TokenEffectTime}
|
||||
return &InstanceLoginReturn{Token: token, TokenEffectTime: config.SettingInfo.TokenEffectTime}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ func (m *ActivityInstance) Joins(page, pageSize int, count *int64, where ...*mod
|
||||
Where("j.status = ?", model.ActivityJoinStatusForSuccess)
|
||||
|
||||
if len(where) > 0 {
|
||||
` for _, v := range where {
|
||||
for _, v := range where {
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
@ -39,7 +39,7 @@ func (m *ActivityInstance) Joins(page, pageSize int, count *int64, where ...*mod
|
||||
if err := db.Order("j.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil`
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewActivityInstance() *ActivityInstance {
|
||||
|
1
app/api/website/api/docking.go
Normal file
1
app/api/website/api/docking.go
Normal file
@ -0,0 +1 @@
|
||||
package api
|
@ -1,7 +1,14 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/controller"
|
||||
"SciencesServer/app/basic/api"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Index struct{}
|
||||
|
||||
func (*Index) Instance() {
|
||||
|
||||
func (*Index) Instance(c *gin.Context) {
|
||||
data, err := controller.NewIndex()(nil, "").Instance()
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
13
app/api/website/controller/docking.go
Normal file
13
app/api/website/controller/docking.go
Normal file
@ -0,0 +1,13 @@
|
||||
package controller
|
||||
|
||||
type Docking struct{}
|
||||
|
||||
type DockingHandle func()
|
||||
|
||||
func (c *Docking) Message() {
|
||||
|
||||
}
|
||||
|
||||
func NewDocking() DockingHandle {
|
||||
return nil
|
||||
}
|
@ -4,6 +4,9 @@ import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Index struct {
|
||||
@ -17,18 +20,91 @@ type (
|
||||
// InstanceInfo 首页信息
|
||||
InstanceInfo struct {
|
||||
*InstanceStaticInfo
|
||||
Distribution map[string]*InstanceDistributionInfo `json:"distribution"`
|
||||
Distribution *InstanceDistributionInfo `json:"distribution"`
|
||||
}
|
||||
// InstanceStaticInfo 统计信息
|
||||
InstanceStaticInfo struct {
|
||||
ExpertCount int64 `json:"expert_count"`
|
||||
CompanyCount int64 `json:"company_count"`
|
||||
ExpertCount int64 `json:"expert_count"` // 专家数量
|
||||
CompanyCount int64 `json:"company_count"` // 公司数量
|
||||
PatentCount int64 `json:"patent_count"` // 专利数量
|
||||
AchievementCount int64 `json:"achievement_count"` // 成果数量
|
||||
DemandCount int64 `json:"demand_count"` // 需求数量
|
||||
DockingCount int64 `json:"docking_count"` // 对接数量
|
||||
}
|
||||
// InstanceDistributionInfo 分布信息
|
||||
InstanceDistributionInfo struct {
|
||||
Expert map[string]*InstanceDistributionDetailInfo `json:"expert"` // 专家信息
|
||||
Laboratory map[string]*InstanceDistributionDetailInfo `json:"laboratory"` // 公司信息
|
||||
Demand map[string]*InstanceDistributionDetailInfo `json:"demand"` // 专利信息
|
||||
Patent map[string]*InstanceDistributionDetailInfo `json:"patent"` // 成果信息
|
||||
Achievement map[string]*InstanceDistributionDetailInfo `json:"achievement"` // 需求信息
|
||||
}
|
||||
// InstanceDistributionDetailInfo 分布区域信息
|
||||
InstanceDistributionDetailInfo struct {
|
||||
Code string `json:"code"` // 区域编码
|
||||
Name string `json:"name"` // 区域名称
|
||||
Count int `json:"count"` // 数量
|
||||
Industry map[string]int `json:"industry"` // 行业领域
|
||||
Children map[string]*InstanceDistributionDetailInfo `json:"children"` // 子集信息
|
||||
}
|
||||
)
|
||||
|
||||
// industry 所属行业信息
|
||||
func (c *Index) industry(src, sep string) map[string]int {
|
||||
values := strings.Split(src, sep)
|
||||
|
||||
out := make(map[string]int, 0)
|
||||
|
||||
for _, value := range values {
|
||||
_values := make([]string, 0)
|
||||
_ = utils.FromJSON(value, &_values)
|
||||
|
||||
for _, v := range _values {
|
||||
if _, has := out[v]; has {
|
||||
out[v]++
|
||||
continue
|
||||
}
|
||||
out[v] = 1
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// distribution 分布统计
|
||||
func (c *Index) distribution(src []*model.DataAreaDistributionInfo) map[string]*InstanceDistributionDetailInfo {
|
||||
out := make(map[string]*InstanceDistributionDetailInfo, 0)
|
||||
|
||||
for _, v := range src {
|
||||
industrys := c.industry(v.Industry, "&")
|
||||
|
||||
_, has := out[v.Province]
|
||||
|
||||
if !has {
|
||||
out[v.Province] = &InstanceDistributionDetailInfo{
|
||||
Code: v.Province,
|
||||
Name: config.SettingAreaInfo[config.DefaultChinaAreaCode][v.Province],
|
||||
Industry: nil,
|
||||
Count: 1,
|
||||
Children: make(map[string]*InstanceDistributionDetailInfo, 0),
|
||||
}
|
||||
goto NEXT
|
||||
}
|
||||
out[v.Province].Count++
|
||||
NEXT:
|
||||
if _, has = out[v.Province].Children[v.City]; !has {
|
||||
out[v.Province].Children[v.City] = &InstanceDistributionDetailInfo{
|
||||
Code: v.City,
|
||||
Count: 1,
|
||||
Name: config.SettingAreaInfo[v.Province][v.City],
|
||||
Industry: industrys,
|
||||
}
|
||||
continue
|
||||
}
|
||||
out[v.Province].Children[v.City].Count++
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// static 数量统计
|
||||
func (c *Index) static() (*InstanceStaticInfo, error) {
|
||||
out := new(InstanceStaticInfo)
|
||||
@ -40,29 +116,127 @@ func (c *Index) static() (*InstanceStaticInfo, error) {
|
||||
return nil, err
|
||||
}
|
||||
// 专利信息
|
||||
mSysPatent := model.NewSysPatent()
|
||||
|
||||
if err = model2.Count(mSysPatent.SysPatent, &out.PatentCount, model2.NewWhere("shelf_status", model2.ShelfStatusForUp)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
//成果信息
|
||||
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||
|
||||
if err = model2.Count(mTechnologyAchievement.TechnologyAchievement, &out.AchievementCount, model2.NewWhere("shelf_status", model2.ShelfStatusForUp),
|
||||
model2.NewWhere("status", model2.TechnologyAchievementStatusForAgree)); 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
|
||||
}
|
||||
// 需求信息
|
||||
mTechnologyDemand := model.NewTechnologyDemand()
|
||||
|
||||
if err = model2.Count(mTechnologyDemand.TechnologyDemand, &out.DemandCount,
|
||||
model2.NewWhere("status", model2.TechnologyDemandStatusForAgree)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 对接信息
|
||||
mServiceDocking := model.NewServiceDocking()
|
||||
|
||||
if err = model2.Count(mServiceDocking.ServiceDocking, &out.DockingCount); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *Index) distributionExpert() {
|
||||
// distributionExpert 专家分布
|
||||
func (c *Index) distributionExpert() (map[string]*InstanceDistributionDetailInfo, error) {
|
||||
mManageExpert := model.NewManageExpert()
|
||||
out, err := mManageExpert.Distribution()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.distribution(out), nil
|
||||
}
|
||||
|
||||
// distributionLaboratory 实验室分布
|
||||
func (c *Index) distributionLaboratory() (map[string]*InstanceDistributionDetailInfo, error) {
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
out, err := mManageLaboratory.Distribution()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.distribution(out), nil
|
||||
}
|
||||
|
||||
// distributionDemand 需求信息
|
||||
func (c *Index) distributionDemand() (map[string]*InstanceDistributionDetailInfo, error) {
|
||||
mTechnologyDemand := model.NewTechnologyDemand()
|
||||
out, err := mTechnologyDemand.Distribution()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.distribution(out), nil
|
||||
}
|
||||
|
||||
// distributionPatent 专利信息
|
||||
func (c *Index) distributionPatent() (map[string]*InstanceDistributionDetailInfo, error) {
|
||||
mSysPatent := model.NewSysPatent()
|
||||
out, err := mSysPatent.Distribution()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.distribution(out), nil
|
||||
}
|
||||
|
||||
// distributionAchievement 技术成果信息
|
||||
func (c *Index) distributionAchievement() (map[string]*InstanceDistributionDetailInfo, error) {
|
||||
mSysPatent := model.NewSysPatent()
|
||||
out, err := mSysPatent.Distribution()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.distribution(out), nil
|
||||
}
|
||||
|
||||
// Instance 首页信息
|
||||
func (c *Index) Instance() (*InstanceInfo, error) {
|
||||
out := new(InstanceInfo)
|
||||
out := &InstanceInfo{
|
||||
InstanceStaticInfo: new(InstanceStaticInfo),
|
||||
Distribution: new(InstanceDistributionInfo),
|
||||
}
|
||||
var err error
|
||||
|
||||
// 数量统计信息
|
||||
if out.InstanceStaticInfo, err = c.static(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 专家区域分布信息
|
||||
if out.Distribution.Expert, err = c.distributionExpert(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 实验室区域分布信息
|
||||
if out.Distribution.Laboratory, err = c.distributionLaboratory(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 需求信息区域分布信息
|
||||
if out.Distribution.Demand, err = c.distributionDemand(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 专利信息区域分布信息
|
||||
if out.Distribution.Patent, err = c.distributionPatent(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 成果信息区域分布信息
|
||||
if out.Distribution.Achievement, err = c.distributionAchievement(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
|
8
app/api/website/model/base.go
Normal file
8
app/api/website/model/base.go
Normal file
@ -0,0 +1,8 @@
|
||||
package model
|
||||
|
||||
// DataAreaDistributionInfo 数据区域分期
|
||||
type DataAreaDistributionInfo struct {
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
Industry string `json:"industry"`
|
||||
}
|
@ -1,11 +1,28 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
)
|
||||
|
||||
type ManageExpert struct {
|
||||
*model.ManageExpert
|
||||
}
|
||||
|
||||
// Distribution 分布信息
|
||||
func (m *ManageExpert) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||
out := make([]*DataAreaDistributionInfo, 0)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()).
|
||||
Select("province", "city", "GROUP_CONCAT(industry SEPARATOR '&') AS industry").
|
||||
Group("province").Group("city").
|
||||
Order("province "+model.OrderModeToAsc).Order("city "+model.OrderModeToAsc).
|
||||
Where("examine_status = ?", model.ExamineStatusForAgree).
|
||||
Scan(&out).Error
|
||||
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewManageExpert() *ManageExpert {
|
||||
return &ManageExpert{model.NewManageExpert()}
|
||||
}
|
||||
|
28
app/api/website/model/manage_laboratory.go
Normal file
28
app/api/website/model/manage_laboratory.go
Normal file
@ -0,0 +1,28 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
)
|
||||
|
||||
type ManageLaboratory struct {
|
||||
*model.ManageLaboratory
|
||||
}
|
||||
|
||||
// Distribution 分布信息
|
||||
func (m *ManageLaboratory) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||
out := make([]*DataAreaDistributionInfo, 0)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()).
|
||||
Select("province", "city", "GROUP_CONCAT(industry SEPARATOR '&') AS industry").
|
||||
Group("province").Group("city").
|
||||
Order("province "+model.OrderModeToAsc).Order("city "+model.OrderModeToAsc).
|
||||
Where("examine_status = ?", model.ExamineStatusForAgree).
|
||||
Scan(&out).Error
|
||||
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewManageLaboratory() *ManageLaboratory {
|
||||
return &ManageLaboratory{model.NewManageLaboratory()}
|
||||
}
|
11
app/api/website/model/service_docking.go
Normal file
11
app/api/website/model/service_docking.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type ServiceDocking struct {
|
||||
*model.ServiceDocking
|
||||
}
|
||||
|
||||
func NewServiceDocking() *ServiceDocking {
|
||||
return &ServiceDocking{model.NewServiceDocking()}
|
||||
}
|
34
app/api/website/model/sys_patent.go
Normal file
34
app/api/website/model/sys_patent.go
Normal file
@ -0,0 +1,34 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type SysPatent struct {
|
||||
*model.SysPatent
|
||||
}
|
||||
|
||||
// Distribution 分布信息
|
||||
func (m *SysPatent) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||
out := make([]*DataAreaDistributionInfo, 0)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS p").
|
||||
Select("e.province", "e.city", "GROUP_CONCAT(p_c.industry_detail SEPARATOR '&') AS industry").
|
||||
Joins(fmt.Sprintf("RIGHT JOIN %s AS p_c ON p.ipc_code = p_c.ipc AND p_c.is_deleted = %d",
|
||||
model.NewSysPatentClassify().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("RIGHT JOIN %s AS u_p ON p.id = u_p.patent_id AND u_p.is_deleted = %d",
|
||||
model.NewUserPatent().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_e ON u_p.uid = u_e.uid", model.NewUserExpert().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
|
||||
Where("p.is_deleted = ?", model.DeleteStatusForNot).
|
||||
Where("p.shelf_status = ?", model.ShelfStatusForUp).
|
||||
Group("e.province").Group("e.city").
|
||||
Order("e.province " + model.OrderModeToAsc).Order("e.city " + model.OrderModeToAsc).Scan(&out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewSysPatent() *SysPatent {
|
||||
return &SysPatent{model.NewSysPatent()}
|
||||
}
|
11
app/api/website/model/sys_patent_classify.go
Normal file
11
app/api/website/model/sys_patent_classify.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type SysPatentClassify struct {
|
||||
*model.SysPatentClassify
|
||||
}
|
||||
|
||||
func NewSysPatentClassify() *SysPatentClassify {
|
||||
return &SysPatentClassify{model.NewSysPatentClassify()}
|
||||
}
|
32
app/api/website/model/technology_achievement.go
Normal file
32
app/api/website/model/technology_achievement.go
Normal file
@ -0,0 +1,32 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type TechnologyAchievement struct {
|
||||
*model.TechnologyAchievement
|
||||
}
|
||||
|
||||
// Distribution 分布信息
|
||||
func (m *TechnologyAchievement) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||
out := make([]*DataAreaDistributionInfo, 0)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS a").
|
||||
Select("e.province", "e.city", "GROUP_CONCAT(a.industry SEPARATOR '&') AS industry").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_e ON a.uid = u_e.uid", model.NewUserExpert().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
|
||||
Group("e.province").Group("e.city").
|
||||
Order("e.province "+model.OrderModeToAsc).Order("e.city "+model.OrderModeToAsc).
|
||||
Where("a.status = ?", model.TechnologyAchievementStatusForAgree).
|
||||
Where("a.shelf_status = ?", model.ShelfStatusForUp).
|
||||
Scan(&out).Error
|
||||
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewTechnologyAchievement() *TechnologyAchievement {
|
||||
return &TechnologyAchievement{model.NewTechnologyAchievement()}
|
||||
}
|
31
app/api/website/model/technology_demand.go
Normal file
31
app/api/website/model/technology_demand.go
Normal file
@ -0,0 +1,31 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type TechnologyDemand struct {
|
||||
*model.TechnologyDemand
|
||||
}
|
||||
|
||||
// Distribution 分布信息
|
||||
func (m *TechnologyDemand) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||
out := make([]*DataAreaDistributionInfo, 0)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS d").
|
||||
Select("e.province", "e.city", "GROUP_CONCAT(d.industry SEPARATOR '&') AS industry").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_e ON d.uid = u_e.uid", model.NewUserExpert().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
|
||||
Group("e.province").Group("e.city").
|
||||
Order("e.province "+model.OrderModeToAsc).Order("e.city "+model.OrderModeToAsc).
|
||||
Where("d.status = ?", model.TechnologyDemandStatusForAgree).
|
||||
Scan(&out).Error
|
||||
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewTechnologyDemand() *TechnologyDemand {
|
||||
return &TechnologyDemand{model.NewTechnologyDemand()}
|
||||
}
|
@ -57,6 +57,7 @@ func initModel() {
|
||||
&synchronized{iModel: model.NewSysPatent(), iValues: func() interface{} {
|
||||
return nil
|
||||
}},
|
||||
&synchronized{iModel: model.NewSysPatentClassify()},
|
||||
&synchronized{iModel: model.NewSysIdentity(), iValues: func() interface{} {
|
||||
out := make([]*model.SysIdentity, 0)
|
||||
|
||||
@ -116,6 +117,7 @@ func initModel() {
|
||||
&synchronized{iModel: model.NewSysLog()}, &synchronized{iModel: model.NewSysUserLoginLog()},
|
||||
// 用户管理
|
||||
&synchronized{iModel: model.NewUserInstance()}, &synchronized{iModel: model.NewUserIdentity()},
|
||||
&synchronized{iModel: model.NewUserAssets()},
|
||||
&synchronized{iModel: model.NewUserPatent()}, &synchronized{iModel: model.NewUserBank()},
|
||||
&synchronized{iModel: model.NewUserCompany()}, &synchronized{iModel: model.NewUserExpert()},
|
||||
&synchronized{iModel: model.NewUserLaboratory()}, &synchronized{iModel: model.NewUserResearch()},
|
||||
@ -125,6 +127,13 @@ func initModel() {
|
||||
&synchronized{iModel: model.NewManageLaboratory()}, &synchronized{iModel: model.NewManageResearch()},
|
||||
&synchronized{iModel: model.NewManageAgent()},
|
||||
// 数据管理
|
||||
&synchronized{iModel: model.NewManageCompany()}, &synchronized{iModel: model.NewManageExpert()},
|
||||
&synchronized{iModel: model.NewManageLaboratory()}, &synchronized{iModel: model.NewManageResearch()},
|
||||
&synchronized{iModel: model.NewManageAgent()},
|
||||
&synchronized{iModel: model.NewTechnologyAchievement()}, &synchronized{iModel: model.NewTechnologyDemand()},
|
||||
&synchronized{iModel: model.NewTechnologyPaper()}, &synchronized{iModel: model.NewTechnologyProduct()},
|
||||
&synchronized{iModel: model.NewTechnologyProject()}, &synchronized{iModel: model.NewTechnologyTopic()},
|
||||
&synchronized{iModel: model.NewServiceDocking()},
|
||||
)
|
||||
}
|
||||
func initCacheMode() {
|
||||
|
17
app/common/model/service_docking.go
Normal file
17
app/common/model/service_docking.go
Normal file
@ -0,0 +1,17 @@
|
||||
package model
|
||||
|
||||
// ServiceDocking 对接信息数据模型
|
||||
type ServiceDocking struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *ServiceDocking) TableName() string {
|
||||
return "service_docking"
|
||||
}
|
||||
|
||||
func NewServiceDocking() *ServiceDocking {
|
||||
return &ServiceDocking{}
|
||||
}
|
@ -4,18 +4,18 @@ package model
|
||||
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:'';comment:名称标题" json:"title"`
|
||||
Title string `gorm:"column:title;type:varchar(100);default:'';comment:名称标题" json:"title"`
|
||||
FileUrl string `gorm:"column:file_url;type:varchar(255);default:'';comment:文件地址" json:"file_url"`
|
||||
ApplyCode string `gorm:"column:apply_code;type:varchar(50);default:'';comment:申请号" json:"apply_code"`
|
||||
ApplyAt string `gorm:"column:apply_at;type:varchar(30);default:'';comment:申请日" json:"apply_at"`
|
||||
OpenCode string `gorm:"column:open_code;type:varchar(50);default:'';comment:公开(公告)号" json:"open_code"`
|
||||
OpenAt string `gorm:"column:open_at;type:varchar(30);default:'';comment:公开(公告)日" json:"open_at"`
|
||||
ApplyCode string `gorm:"column:apply_code;type:varchar(30);default:'';comment:申请号" json:"apply_code"`
|
||||
ApplyAt string `gorm:"column:apply_at;type:varchar(10);default:'';comment:申请日" json:"apply_at"`
|
||||
OpenCode string `gorm:"column:open_code;type:varchar(30);default:'';comment:公开(公告)号" json:"open_code"`
|
||||
OpenAt string `gorm:"column:open_at;type:varchar(10);default:'';comment:公开(公告)日" json:"open_at"`
|
||||
ApplyName string `gorm:"column:apply_name;type:varchar(255);default:'';comment:申请(专利权)人" json:"apply_name"`
|
||||
ApplyAddress string `gorm:"column:apply_address;type:varchar(255);default:'';comment:申请人地址" json:"apply_address"`
|
||||
Inventor string `gorm:"column:inventor;type:varchar(255);default:'';comment:发明人" json:"inventor"`
|
||||
Description string `gorm:"column:description;type:text;comment:摘要" json:"description"`
|
||||
PrincipalClaim string `gorm:"column:principal_claim;type:text;comment:主权项" json:"principal_claim"`
|
||||
IPCCode string `gorm:"column:ipc_code;type:varchar(50);default:'';comment:IPC主分类号" json:"ipc_code"`
|
||||
IPCCode string `gorm:"column:ipc_code;type:varchar(30);default:'';comment:IPC主分类号" json:"ipc_code"`
|
||||
Shelf
|
||||
Status SysParentStatus `gorm:"column:status;type:tinyint(1);default:1;comment:专利状态(1:授权,2:实审,3:公开)" json:"-"`
|
||||
ModelDeleted
|
||||
|
19
app/common/model/sys_patent_classify.go
Normal file
19
app/common/model/sys_patent_classify.go
Normal file
@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
// SysPatentClassify 专利分类信息数据模型
|
||||
type SysPatentClassify struct {
|
||||
Model
|
||||
IPC string `gorm:"column:ipc;type:varchar(18);default:'';comment:IPC主分类号" json:"ipc"`
|
||||
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:行业领域" json:"industry"`
|
||||
IndustryDetail string `gorm:"column:industry_detail;type:varchar(255);default:'';comment:详细行业领域,包含父级领域信息" json:"industry_detail"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *SysPatentClassify) TableName() string {
|
||||
return "sys_patent_classify"
|
||||
}
|
||||
|
||||
func NewSysPatentClassify() *SysPatentClassify {
|
||||
return &SysPatentClassify{}
|
||||
}
|
@ -7,7 +7,6 @@ import (
|
||||
"SciencesServer/cron"
|
||||
"SciencesServer/router"
|
||||
"SciencesServer/serve/cache"
|
||||
"SciencesServer/serve/es"
|
||||
"SciencesServer/serve/logger"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/serve/orm/logic"
|
||||
@ -69,7 +68,7 @@ func (this *Serve) Run() {
|
||||
app.Init()
|
||||
tools.Init()
|
||||
// 开启Elasticsearch
|
||||
es.NewInstance(es.WithEsAddress([]string{"http://192.168.0.188:9200"})).Init().Local()
|
||||
//es.NewInstance(es.WithEsAddress([]string{"http://192.168.0.188:9200"})).Init().Local()
|
||||
// 开启web
|
||||
web.NewWeb()(&web.WebConfig{
|
||||
Port: config.SettingInfo.Server.Port, ReadTimeout: config.SettingInfo.Server.ReadTimeout,
|
||||
|
@ -1,21 +1,31 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
api2 "SciencesServer/app/api/enterprise/api"
|
||||
"SciencesServer/app/api/manage/api"
|
||||
api3 "SciencesServer/app/basic/api"
|
||||
api3 "SciencesServer/app/api/enterprise/api"
|
||||
api1 "SciencesServer/app/api/manage/api"
|
||||
api2 "SciencesServer/app/api/website/api"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/session"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// registerAPI 注册API
|
||||
func registerAPI(app *gin.Engine) {
|
||||
apiPrefix := "/api"
|
||||
g := app.Group(apiPrefix)
|
||||
v1 := g.Group("/v1")
|
||||
|
||||
// Index 首页信息管理
|
||||
indexV1 := v1.Group("/index")
|
||||
{
|
||||
_api := new(api2.Index)
|
||||
indexV1.GET("", _api.Instance)
|
||||
}
|
||||
}
|
||||
|
||||
// registerManageAPI 注册API
|
||||
func registerManageAPI(app *gin.Engine) {
|
||||
apiPrefix := "/manage"
|
||||
// registerAdminAPI 注册API
|
||||
func registerAdminAPI(app *gin.Engine) {
|
||||
apiPrefix := "/admin"
|
||||
g := app.Group(apiPrefix)
|
||||
|
||||
// 登录验证
|
||||
@ -31,20 +41,20 @@ func registerManageAPI(app *gin.Engine) {
|
||||
// apiPrefix + "/account/logout",
|
||||
//}...)))
|
||||
// Captcha 验证码
|
||||
g.GET("/captcha", new(api.Captcha).Captcha)
|
||||
g.GET("/captcha", new(api1.Captcha).Captcha)
|
||||
// Upload 上传管理
|
||||
g.POST("/upload", new(api3.Upload).Upload)
|
||||
g.POST("/upload", new(api.Upload).Upload)
|
||||
// Account 账户管理
|
||||
account := g.Group("/account")
|
||||
{
|
||||
_api := new(api.Account)
|
||||
_api := new(api1.Account)
|
||||
account.POST("/login", _api.Login)
|
||||
account.POST("/logout", _api.Logout)
|
||||
}
|
||||
// User 用户管理
|
||||
user := g.Group("/user")
|
||||
{
|
||||
_api := new(api.User)
|
||||
_api := new(api1.User)
|
||||
user.GET("/info", _api.Info)
|
||||
user.GET("/menu", _api.Menu)
|
||||
user.POST("/list", _api.List)
|
||||
@ -59,7 +69,7 @@ func registerManageAPI(app *gin.Engine) {
|
||||
// Tenant 租户管理
|
||||
tenant := g.Group("/tenant")
|
||||
{
|
||||
_api := new(api.Tenant)
|
||||
_api := new(api1.Tenant)
|
||||
tenant.POST("/list", _api.List)
|
||||
tenant.POST("/add", _api.Add)
|
||||
tenant.POST("/edit", _api.Edit)
|
||||
@ -76,7 +86,7 @@ func registerManageAPI(app *gin.Engine) {
|
||||
// Menu 菜单管理
|
||||
menu := g.Group("/menu")
|
||||
{
|
||||
_api := new(api.Menu)
|
||||
_api := new(api1.Menu)
|
||||
menu.GET("/list", _api.List)
|
||||
menu.POST("/add", _api.Add)
|
||||
menu.POST("/edit", _api.Edit)
|
||||
@ -86,13 +96,13 @@ func registerManageAPI(app *gin.Engine) {
|
||||
// Auth 权限管理
|
||||
auth := g.Group("/auth")
|
||||
{
|
||||
_api := new(api.Auth)
|
||||
_api := new(api1.Auth)
|
||||
auth.POST("/list", _api.List)
|
||||
}
|
||||
// Department 部门管理
|
||||
department := g.Group("/department")
|
||||
{
|
||||
_api := new(api.Department)
|
||||
_api := new(api1.Department)
|
||||
department.GET("/list", _api.List)
|
||||
department.GET("/select", _api.Select)
|
||||
department.POST("/add", _api.Add)
|
||||
@ -102,7 +112,7 @@ func registerManageAPI(app *gin.Engine) {
|
||||
// Role 角色管理
|
||||
role := g.Group("/role")
|
||||
{
|
||||
_api := new(api.Role)
|
||||
_api := new(api1.Role)
|
||||
role.POST("/list", _api.List)
|
||||
role.POST("/select", _api.Select)
|
||||
role.POST("/add", _api.Add)
|
||||
@ -117,7 +127,7 @@ func registerManageAPI(app *gin.Engine) {
|
||||
// Logs 日志管理
|
||||
log := g.Group("/log")
|
||||
{
|
||||
_api := new(api.Log)
|
||||
_api := new(api1.Log)
|
||||
log.POST("/login", _api.Login)
|
||||
}
|
||||
}
|
||||
@ -136,11 +146,11 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
||||
v1 := g.Group("/v1")
|
||||
|
||||
// Upload 上传管理
|
||||
v1.POST("/upload", new(api3.Upload).Upload)
|
||||
v1.POST("/upload", new(api.Upload).Upload)
|
||||
// Config 配置管理
|
||||
configV1 := v1.Group("/config")
|
||||
{
|
||||
_api := new(api2.Config)
|
||||
_api := new(api3.Config)
|
||||
configV1.GET("/area", _api.Area)
|
||||
configV1.GET("/identity", _api.Identity)
|
||||
configV1.GET("/industry", _api.Industry)
|
||||
@ -148,7 +158,7 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
||||
// Account 账号管理
|
||||
accountV1 := v1.Group("/account")
|
||||
{
|
||||
_api := new(api2.Account)
|
||||
_api := new(api3.Account)
|
||||
accountV1.POST("/login", _api.Login)
|
||||
accountV1.POST("/register", _api.Register)
|
||||
accountV1.POST("/authorize", _api.Authorize)
|
||||
@ -157,26 +167,26 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
||||
// User 用户管理
|
||||
userV1 := v1.Group("/user")
|
||||
{
|
||||
_api := new(api2.User)
|
||||
_api := new(api3.User)
|
||||
userV1.GET("/info", _api.Info)
|
||||
userV1.GET("/patent", _api.Patent)
|
||||
}
|
||||
// Home 首页管理
|
||||
homeV1 := v1.Group("/home")
|
||||
{
|
||||
_api := new(api2.Home)
|
||||
_api := new(api3.Home)
|
||||
homeV1.GET("", _api.Instance)
|
||||
}
|
||||
// Sys 配置管理
|
||||
sysV1 := v1.Group("/sys")
|
||||
{
|
||||
_api := new(api2.Sys)
|
||||
_api := new(api3.Sys)
|
||||
sysV1.POST("/patent", _api.Patent)
|
||||
}
|
||||
// Settled 入驻管理
|
||||
settledV1 := v1.Group("/settled")
|
||||
{
|
||||
_api := new(api2.Settled)
|
||||
_api := new(api3.Settled)
|
||||
settledV1.GET("", _api.Index)
|
||||
settledV1.POST("/company", _api.Company)
|
||||
settledV1.POST("/company/get", _api.CompanyGet)
|
||||
@ -188,7 +198,7 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
||||
// Technology 技术管理
|
||||
technologyV1 := g.Group("/technology")
|
||||
{
|
||||
_api := new(api2.Technology)
|
||||
_api := new(api3.Technology)
|
||||
technologyV1.POST("/paper", _api.Paper)
|
||||
technologyV1.POST("/paper/add", _api.PaperAdd)
|
||||
technologyV1.POST("/paper/edit", _api.PaperEdit)
|
||||
@ -227,7 +237,7 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
||||
// Service 服务信息
|
||||
serviceV1 := v1.Group("/service")
|
||||
{
|
||||
_api := new(api2.Service)
|
||||
_api := new(api3.Service)
|
||||
serviceV1.POST("/demand", _api.Demand)
|
||||
serviceV1.POST("/demand/detail", _api.DemandDetail)
|
||||
serviceV1.POST("/demand/add", _api.DemandAdd)
|
||||
@ -237,7 +247,7 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
||||
// Manage 管理信息
|
||||
manageV1 := v1.Group("/manage")
|
||||
{
|
||||
_api := new(api2.Manage)
|
||||
_api := new(api3.Manage)
|
||||
manageV1.POST("/enterprise", _api.Enterprise)
|
||||
manageV1.POST("/enterprise/add", _api.EnterpriseAdd)
|
||||
manageV1.POST("/enterprise/edit", _api.EnterpriseEdit)
|
||||
@ -255,7 +265,7 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
||||
// Activity 活动信息
|
||||
activityV1 := v1.Group("/activity")
|
||||
{
|
||||
_api := new(api2.Activity)
|
||||
_api := new(api3.Activity)
|
||||
activityV1.POST("/apply", _api.Applys)
|
||||
activityV1.POST("/apply/revoke", _api.ApplyRevoke)
|
||||
activityV1.POST("/apply/delete", _api.ApplyDelete)
|
||||
|
@ -57,7 +57,7 @@ func (this *Router) Init() *gin.Engine {
|
||||
app.StaticFS("/upload", http.Dir("./upload"))
|
||||
// 注册路由
|
||||
registerAPI(app)
|
||||
registerManageAPI(app)
|
||||
registerAdminAPI(app)
|
||||
registerEnterpriseAPI(app)
|
||||
|
||||
app.MaxMultipartMemory = 4 << 20
|
||||
|
Reference in New Issue
Block a user