feat:完善项目信息
This commit is contained in:
@ -112,7 +112,7 @@ func (*Manage) ExpertPaper(c *gin.Context) {
|
|||||||
api.APIResponse(err, data)(c)
|
api.APIResponse(err, data)(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Manage) ExpertCompany(c *gin.Context) {
|
func (*Manage) ExpertCooperate(c *gin.Context) {
|
||||||
form := &struct {
|
form := &struct {
|
||||||
CompanyID string `json:"company_id" form:"company_id" binding:"required"`
|
CompanyID string `json:"company_id" form:"company_id" binding:"required"`
|
||||||
api.PageForm
|
api.PageForm
|
||||||
@ -121,17 +121,105 @@ func (*Manage) ExpertCompany(c *gin.Context) {
|
|||||||
api.APIFailure(err.(error))(c)
|
api.APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data, err := manage.NewExpert()(nil).Company((&api.IDStringForm{ID: form.CompanyID}).Convert(), form.Page, form.PageSize)
|
data, err := manage.NewExpert()(nil).Cooperate((&api.IDStringForm{ID: form.CompanyID}).Convert(), form.Page, form.PageSize)
|
||||||
api.APIResponse(err, data)(c)
|
api.APIResponse(err, data)(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Manage) ExpertCompanyDetail(c *gin.Context) {
|
func (*Manage) ExpertCooperateDetail(c *gin.Context) {
|
||||||
form := new(api.IDStringForm)
|
form := new(api.IDStringForm)
|
||||||
|
|
||||||
if err := api.Bind(form)(c); err != nil {
|
if err := api.Bind(form)(c); err != nil {
|
||||||
api.APIFailure(err.(error))(c)
|
api.APIFailure(err.(error))(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data, err := manage.NewExpert()(nil).CompanyDetail(form.Convert())
|
data, err := manage.NewExpert()(nil).CooperateDetail(form.Convert())
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) Laboratory(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
ExpertID string `json:"expert_id" form:"expert_id" binding:"required"`
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := manage.NewLaboratory()(nil).Instance((&api.IDStringForm{ID: form.ExpertID}).Convert())
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) LaboratoryAchievement(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
ExpertID string `json:"expert_id" form:"expert_id" binding:"required"`
|
||||||
|
api.PageForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := manage.NewLaboratory()(nil).Achievement((&api.IDStringForm{ID: form.ExpertID}).Convert(), form.Page, form.PageSize)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) LaboratoryProject(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
ExpertID string `json:"expert_id" form:"expert_id" binding:"required"`
|
||||||
|
api.PageForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := manage.NewLaboratory()(nil).Project((&api.IDStringForm{ID: form.ExpertID}).Convert(), form.Page, form.PageSize)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) LaboratoryPatent(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
ExpertID string `json:"expert_id" form:"expert_id" binding:"required"`
|
||||||
|
api.PageForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := manage.NewLaboratory()(nil).Patent((&api.IDStringForm{ID: form.ExpertID}).Convert(), form.Page, form.PageSize)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) LaboratoryPaper(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
PaperID string `json:"paper_id" form:"paper_id" binding:"required"`
|
||||||
|
api.PageForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := manage.NewLaboratory()(nil).Paper((&api.IDStringForm{ID: form.PaperID}).Convert(), form.Page, form.PageSize)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) LaboratoryCooperate(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
CompanyID string `json:"company_id" form:"company_id" binding:"required"`
|
||||||
|
api.PageForm
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := manage.NewLaboratory()(nil).Cooperate((&api.IDStringForm{ID: form.CompanyID}).Convert(), form.Page, form.PageSize)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Manage) LaboratoryCooperateDetail(c *gin.Context) {
|
||||||
|
form := new(api.IDStringForm)
|
||||||
|
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := manage.NewLaboratory()(nil).CooperateDetail(form.Convert())
|
||||||
api.APIResponse(err, data)(c)
|
api.APIResponse(err, data)(c)
|
||||||
}
|
}
|
||||||
|
224
app/api/website/controller/manage/common.go
Normal file
224
app/api/website/controller/manage/common.go
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
package manage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/api/website/controller/technology"
|
||||||
|
"SciencesServer/app/api/website/model"
|
||||||
|
"SciencesServer/app/basic/controller"
|
||||||
|
model2 "SciencesServer/app/common/model"
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 公用参数信息
|
||||||
|
|
||||||
|
type (
|
||||||
|
// AchievementInfo 成果信息
|
||||||
|
AchievementInfo struct {
|
||||||
|
*model.TechnologyAchievementInfo
|
||||||
|
ChargeInfo *model2.TechnologyAchievementChargeInfo `json:"charge_info"`
|
||||||
|
}
|
||||||
|
// ProjectInfo 项目信息
|
||||||
|
ProjectInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
*model2.TechnologyProject
|
||||||
|
}
|
||||||
|
// PatentInfo 专利信息
|
||||||
|
PatentInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
*model.PatentInfo
|
||||||
|
}
|
||||||
|
// PaperInfo 论文信息
|
||||||
|
PaperInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
*model2.TechnologyPaper
|
||||||
|
Keywords []string `json:"keywords"`
|
||||||
|
}
|
||||||
|
// CooperateInfo 合作的企业信息
|
||||||
|
CooperateInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
PatentCount int `json:"patent_count"`
|
||||||
|
PaperCount int `json:"paper_count"`
|
||||||
|
}
|
||||||
|
// CooperateDetailInfo 合作的企业详细信息
|
||||||
|
CooperateDetailInfo struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Patent []*technology.PatentInfo `json:"patent"`
|
||||||
|
Paper []*technology.PaperInfo `json:"paper"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// achievement 技术成果信息
|
||||||
|
func achievement(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
mTechnologyAchievement := model.NewTechnologyAchievement()
|
||||||
|
|
||||||
|
var count int64
|
||||||
|
|
||||||
|
out, err := mTechnologyAchievement.Achievement(page, pageSize, &count, model2.NewWhereIn("uid", uids))
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
list := make([]*AchievementInfo, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
list = append(list, &AchievementInfo{
|
||||||
|
TechnologyAchievementInfo: v,
|
||||||
|
ChargeInfo: v.GetChargeInfoAttribute(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// project 项目信息
|
||||||
|
func project(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
mTechnologyProject := model.NewTechnologyProject()
|
||||||
|
out := make([]*model2.TechnologyProject, 0)
|
||||||
|
|
||||||
|
var count int64
|
||||||
|
|
||||||
|
if err := model2.Pages(mTechnologyProject.TechnologyProject, &out, page, pageSize, &count,
|
||||||
|
&model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhereIn("uid", uids),
|
||||||
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
|
}, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhere("shelf_status", model2.ShelfStatusForUp),
|
||||||
|
}); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
list := make([]*ProjectInfo, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
list = append(list, &ProjectInfo{
|
||||||
|
ID: v.GetEncodeID(),
|
||||||
|
TechnologyProject: v,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// patent 专利信息
|
||||||
|
func patent(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
mUserPatent := model.NewUserPatent()
|
||||||
|
var count int64
|
||||||
|
|
||||||
|
out, err := mUserPatent.Patent(page, pageSize, &count, model2.NewWhereIn("u_p.uid", uids))
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
list := make([]*PatentInfo, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
list = append(list, &PatentInfo{
|
||||||
|
ID: v.GetEncodeID(),
|
||||||
|
PatentInfo: v,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
|
}
|
||||||
|
func paper(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
mTechnologyPaper := model.NewTechnologyPaper()
|
||||||
|
|
||||||
|
out := make([]*model2.TechnologyPaper, 0)
|
||||||
|
|
||||||
|
var count int64
|
||||||
|
|
||||||
|
if err := model2.PagesFields(mTechnologyPaper.TechnologyPaper, &out, []string{"id", "title", "ext", "keyword"},
|
||||||
|
page, pageSize, &count, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhereIn("uid", uids),
|
||||||
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
|
}); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
list := make([]*PaperInfo, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
list = append(list, &PaperInfo{
|
||||||
|
ID: v.GetEncodeID(),
|
||||||
|
TechnologyPaper: v,
|
||||||
|
Keywords: v.GetKeywordAttribute(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// cooperate 合作的信息
|
||||||
|
func cooperate(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
mUserCooperateEnterprise := model.NewUserCooperateEnterprise()
|
||||||
|
|
||||||
|
out := make([]*model2.UserCooperateEnterprise, 0)
|
||||||
|
|
||||||
|
var count int64
|
||||||
|
|
||||||
|
if err := model2.PagesFields(mUserCooperateEnterprise.UserCooperateEnterprise, &out, []string{"id", "title", "paper", "patent"},
|
||||||
|
page, pageSize, &count, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhereIn("uid", uids),
|
||||||
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
|
}, &model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhere("kind", model2.UserCooperateEnterpriseModeForCooperateAlready)}); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
list := make([]*CooperateInfo, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
list = append(list, &CooperateInfo{
|
||||||
|
ID: v.GetEncodeID(),
|
||||||
|
Title: v.Title,
|
||||||
|
PatentCount: len(v.GetPatentAttribute()),
|
||||||
|
PaperCount: len(v.GetPaperAttribute()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// cooperateDetail 合作企业详情
|
||||||
|
func cooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||||
|
mUserCooperateEnterprise := model.NewUserCooperateEnterprise()
|
||||||
|
mUserCooperateEnterprise.ID = id
|
||||||
|
|
||||||
|
isExist, err := model2.FirstField(mUserCooperateEnterprise.UserCooperateEnterprise, []string{"id", "title", "paper", "patent"})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else if !isExist {
|
||||||
|
return nil, errors.New("操作错误,企业信息不存在或已被删除")
|
||||||
|
}
|
||||||
|
out := &CooperateDetailInfo{
|
||||||
|
Title: mUserCooperateEnterprise.Title,
|
||||||
|
Patent: make([]*technology.PatentInfo, 0),
|
||||||
|
Paper: make([]*technology.PaperInfo, 0),
|
||||||
|
}
|
||||||
|
// 专利信息
|
||||||
|
mSysPatent := model.NewSysPatent()
|
||||||
|
|
||||||
|
patents := make([]*model.SysPatentInfo, 0)
|
||||||
|
|
||||||
|
if patents, err = mSysPatent.Instance(model2.NewWhereIn("p.id", mUserCooperateEnterprise.GetPatentAttribute())); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, v := range patents {
|
||||||
|
out.Patent = append(out.Patent, &technology.PatentInfo{
|
||||||
|
ID: v.GetEncodeID(),
|
||||||
|
SysPatentInfo: v,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 论文信息
|
||||||
|
mTechnologyPaper := model.NewTechnologyPaper()
|
||||||
|
|
||||||
|
papers := make([]*model2.TechnologyPaper, 0)
|
||||||
|
|
||||||
|
if err = model2.ScanFields(mTechnologyPaper.TechnologyPaper, &papers, []string{"id", "title", "ext", "keyword"},
|
||||||
|
&model2.ModelWhereOrder{
|
||||||
|
Where: model2.NewWhereIn("id", mUserCooperateEnterprise.GetPaperAttribute()),
|
||||||
|
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||||
|
}); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, v := range papers {
|
||||||
|
out.Paper = append(out.Paper, &technology.PaperInfo{
|
||||||
|
ID: v.GetEncodeID(), Title: v.Title, Ext: v.Ext, Keywords: v.GetKeywordAttribute(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
@ -1,12 +1,10 @@
|
|||||||
package manage
|
package manage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"SciencesServer/app/api/website/controller/technology"
|
|
||||||
"SciencesServer/app/api/website/model"
|
"SciencesServer/app/api/website/model"
|
||||||
"SciencesServer/app/basic/controller"
|
"SciencesServer/app/basic/controller"
|
||||||
model2 "SciencesServer/app/common/model"
|
model2 "SciencesServer/app/common/model"
|
||||||
"SciencesServer/app/session"
|
"SciencesServer/app/session"
|
||||||
"errors"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,40 +31,6 @@ type (
|
|||||||
Researchs []string `json:"researchs"`
|
Researchs []string `json:"researchs"`
|
||||||
Introduce string `json:"introduce"`
|
Introduce string `json:"introduce"`
|
||||||
}
|
}
|
||||||
// ExpertAchievementInfo 专家成果信息
|
|
||||||
ExpertAchievementInfo struct {
|
|
||||||
*model.TechnologyAchievementInfo
|
|
||||||
ChargeInfo *model2.TechnologyAchievementChargeInfo `json:"charge_info"`
|
|
||||||
}
|
|
||||||
// ExpertProjectInfo 专家项目信息
|
|
||||||
ExpertProjectInfo struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
*model2.TechnologyProject
|
|
||||||
}
|
|
||||||
// ExpertPatentInfo 专利信息
|
|
||||||
ExpertPatentInfo struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
*model.PatentInfo
|
|
||||||
}
|
|
||||||
// ExpertPaperInfo 论文信息
|
|
||||||
ExpertPaperInfo struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
*model2.TechnologyPaper
|
|
||||||
Keywords []string `json:"keywords"`
|
|
||||||
}
|
|
||||||
// ExpertCompanyInfo 合作企业信息
|
|
||||||
ExpertCompanyInfo struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Title string `json:"title"`
|
|
||||||
PatentCount int `json:"patent_count"`
|
|
||||||
PaperCount int `json:"paper_count"`
|
|
||||||
}
|
|
||||||
// ExpertCompanyDetailInfo 合作企业详细信息
|
|
||||||
ExpertCompanyDetailInfo struct {
|
|
||||||
Title string `json:"title"`
|
|
||||||
Patent []*technology.PatentInfo `json:"patent"`
|
|
||||||
Paper []*technology.PaperInfo `json:"paper"`
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Expert) user(id uint64) ([]uint64, error) {
|
func (c *Expert) user(id uint64) ([]uint64, error) {
|
||||||
@ -109,24 +73,8 @@ func (c *Expert) Achievement(id uint64, page, pageSize int) (*controller.ReturnP
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mTechnologyAchievement := model.NewTechnologyAchievement()
|
|
||||||
|
|
||||||
var count int64
|
return achievement(uids, page, pageSize)
|
||||||
|
|
||||||
out := make([]*model.TechnologyAchievementInfo, 0)
|
|
||||||
|
|
||||||
if out, err = mTechnologyAchievement.Achievement(page, pageSize, &count, model2.NewWhereIn("uid", uids)); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
list := make([]*ExpertAchievementInfo, 0)
|
|
||||||
|
|
||||||
for _, v := range out {
|
|
||||||
list = append(list, &ExpertAchievementInfo{
|
|
||||||
TechnologyAchievementInfo: v,
|
|
||||||
ChargeInfo: v.GetChargeInfoAttribute(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Project 项目信息
|
// Project 项目信息
|
||||||
@ -137,29 +85,8 @@ func (c *Expert) Project(id uint64, page, pageSize int) (*controller.ReturnPages
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mTechnologyProject := model.NewTechnologyProject()
|
|
||||||
out := make([]*model2.TechnologyProject, 0)
|
|
||||||
|
|
||||||
var count int64
|
return project(uids, page, pageSize)
|
||||||
|
|
||||||
if err = model2.Pages(mTechnologyProject.TechnologyProject, &out, page, pageSize, &count,
|
|
||||||
&model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhereIn("uid", uids),
|
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
|
||||||
}, &model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhere("shelf_status", model2.ShelfStatusForUp),
|
|
||||||
}); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
list := make([]*ExpertProjectInfo, 0)
|
|
||||||
|
|
||||||
for _, v := range out {
|
|
||||||
list = append(list, &ExpertProjectInfo{
|
|
||||||
ID: v.GetEncodeID(),
|
|
||||||
TechnologyProject: v,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patent 专利信息
|
// Patent 专利信息
|
||||||
@ -170,23 +97,8 @@ func (c *Expert) Patent(id uint64, page, pageSize int) (*controller.ReturnPages,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mUserPatent := model.NewUserPatent()
|
|
||||||
var count int64
|
|
||||||
|
|
||||||
out := make([]*model.PatentInfo, 0)
|
return paper(uids, page, pageSize)
|
||||||
|
|
||||||
if out, err = mUserPatent.Patent(page, pageSize, &count, model2.NewWhereIn("u_p.uid", uids)); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
list := make([]*ExpertPatentInfo, 0)
|
|
||||||
|
|
||||||
for _, v := range out {
|
|
||||||
list = append(list, &ExpertPatentInfo{
|
|
||||||
ID: v.GetEncodeID(),
|
|
||||||
PatentInfo: v,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paper 论文信息
|
// Paper 论文信息
|
||||||
@ -197,115 +109,25 @@ func (c *Expert) Paper(id uint64, page, pageSize int) (*controller.ReturnPages,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mTechnologyPaper := model.NewTechnologyPaper()
|
|
||||||
|
|
||||||
out := make([]*model2.TechnologyPaper, 0)
|
return paper(uids, page, pageSize)
|
||||||
|
|
||||||
var count int64
|
|
||||||
|
|
||||||
if err = model2.PagesFields(mTechnologyPaper.TechnologyPaper, &out, []string{"id", "title", "ext", "keyword"},
|
|
||||||
page, pageSize, &count, &model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhereIn("uid", uids),
|
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
|
||||||
}); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
list := make([]*ExpertPaperInfo, 0)
|
|
||||||
|
|
||||||
for _, v := range out {
|
|
||||||
list = append(list, &ExpertPaperInfo{
|
|
||||||
ID: v.GetEncodeID(),
|
|
||||||
TechnologyPaper: v,
|
|
||||||
Keywords: v.GetKeywordAttribute(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Company 企业信息
|
// Cooperate 企业信息
|
||||||
func (c *Expert) Company(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
func (c *Expert) Cooperate(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
// 查询专家身份下用户信息
|
// 查询专家身份下用户信息
|
||||||
uids, err := c.user(id)
|
uids, err := c.user(id)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mUserCooperateEnterprise := model.NewUserCooperateEnterprise()
|
|
||||||
|
|
||||||
out := make([]*model2.UserCooperateEnterprise, 0)
|
return cooperate(uids, page, pageSize)
|
||||||
|
|
||||||
var count int64
|
|
||||||
|
|
||||||
if err = model2.PagesFields(mUserCooperateEnterprise.UserCooperateEnterprise, &out, []string{"id", "title", "paper", "patent"},
|
|
||||||
page, pageSize, &count, &model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhereIn("uid", uids),
|
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
|
||||||
}, &model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhere("kind", model2.UserCooperateEnterpriseModeForCooperateAlready)}); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
list := make([]*ExpertCompanyInfo, 0)
|
|
||||||
|
|
||||||
for _, v := range out {
|
|
||||||
list = append(list, &ExpertCompanyInfo{
|
|
||||||
ID: v.GetEncodeID(),
|
|
||||||
Title: v.Title,
|
|
||||||
PatentCount: len(v.GetPatentAttribute()),
|
|
||||||
PaperCount: len(v.GetPaperAttribute()),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CompanyDetail 公司企业详细信息
|
// CooperateDetail 公司企业详细信息
|
||||||
func (c *Expert) CompanyDetail(id uint64) (*ExpertCompanyDetailInfo, error) {
|
func (c *Expert) CooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||||
mUserCooperateEnterprise := model.NewUserCooperateEnterprise()
|
return cooperateDetail(id)
|
||||||
mUserCooperateEnterprise.ID = id
|
|
||||||
|
|
||||||
isExist, err := model2.FirstField(mUserCooperateEnterprise.UserCooperateEnterprise, []string{"id", "title", "paper", "patent"})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
} else if !isExist {
|
|
||||||
return nil, errors.New("操作错误,企业信息不存在或已被删除")
|
|
||||||
}
|
|
||||||
out := &ExpertCompanyDetailInfo{
|
|
||||||
Title: mUserCooperateEnterprise.Title,
|
|
||||||
Patent: make([]*technology.PatentInfo, 0),
|
|
||||||
Paper: make([]*technology.PaperInfo, 0),
|
|
||||||
}
|
|
||||||
// 专利信息
|
|
||||||
mSysPatent := model.NewSysPatent()
|
|
||||||
|
|
||||||
patents := make([]*model.SysPatentInfo, 0)
|
|
||||||
|
|
||||||
if patents, err = mSysPatent.Instance(model2.NewWhereIn("p.id", mUserCooperateEnterprise.GetPatentAttribute())); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
for _, v := range patents {
|
|
||||||
out.Patent = append(out.Patent, &technology.PatentInfo{
|
|
||||||
ID: v.GetEncodeID(),
|
|
||||||
SysPatentInfo: v,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 论文信息
|
|
||||||
mTechnologyPaper := model.NewTechnologyPaper()
|
|
||||||
|
|
||||||
papers := make([]*model2.TechnologyPaper, 0)
|
|
||||||
|
|
||||||
if err = model2.ScanFields(mTechnologyPaper.TechnologyPaper, &papers, []string{"id", "title", "ext", "keyword"},
|
|
||||||
&model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhereIn("id", mUserCooperateEnterprise.GetPaperAttribute()),
|
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
|
||||||
}); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
for _, v := range papers {
|
|
||||||
out.Paper = append(out.Paper, &technology.PaperInfo{
|
|
||||||
ID: v.GetEncodeID(), Title: v.Title, Ext: v.Ext, Keywords: v.GetKeywordAttribute(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewExpert() ExpertHandle {
|
func NewExpert() ExpertHandle {
|
||||||
|
135
app/api/website/controller/manage/laboratory.go
Normal file
135
app/api/website/controller/manage/laboratory.go
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
package manage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/api/website/model"
|
||||||
|
"SciencesServer/app/basic/controller"
|
||||||
|
model2 "SciencesServer/app/common/model"
|
||||||
|
"SciencesServer/app/session"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Laboratory struct {
|
||||||
|
*session.Enterprise
|
||||||
|
}
|
||||||
|
|
||||||
|
type LaboratoryHandle func(session *session.Enterprise) *Laboratory
|
||||||
|
|
||||||
|
type (
|
||||||
|
// LaboratoryBasicInfo 基本信息
|
||||||
|
LaboratoryBasicInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
*model.ManageLaboratoryInfo
|
||||||
|
Industrys []string `json:"industrys"`
|
||||||
|
Keywords []string `json:"keywords"`
|
||||||
|
Researchs []string `json:"researchs"`
|
||||||
|
}
|
||||||
|
// LaboratoryInstanceInfo 实验室信息
|
||||||
|
LaboratoryInstanceInfo struct {
|
||||||
|
LaboratoryBasicInfo
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// expert 所有专家信息
|
||||||
|
func (c *Laboratory) expert(id uint64) ([]uint64, error) {
|
||||||
|
mManageExpert := model.NewManageExpert()
|
||||||
|
|
||||||
|
uids := make([]uint64, 0)
|
||||||
|
|
||||||
|
err := model2.Pluck(mManageExpert.ManageExpert, "uid", &uids, model2.NewWhere("laboratory_id", id),
|
||||||
|
model2.NewWhere("examine_status", model2.ExamineStatusForAgree))
|
||||||
|
|
||||||
|
return uids, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Instance 实验室信息
|
||||||
|
func (c *Laboratory) Instance(id uint64) (*LaboratoryInstanceInfo, error) {
|
||||||
|
mManageLaboratory := model.NewManageLaboratory()
|
||||||
|
out, err := mManageLaboratory.Instance(id)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &LaboratoryInstanceInfo{
|
||||||
|
LaboratoryBasicInfo: LaboratoryBasicInfo{
|
||||||
|
ID: out.GetEncodeID(),
|
||||||
|
ManageLaboratoryInfo: &model.ManageLaboratoryInfo{
|
||||||
|
ManageLaboratory: out.ManageLaboratory,
|
||||||
|
ResearchName: out.ResearchName,
|
||||||
|
ExpertCount: out.ExpertCount,
|
||||||
|
CollectCount: out.CollectCount,
|
||||||
|
VisitCount: out.VisitCount,
|
||||||
|
},
|
||||||
|
Industrys: out.GetIndustryAttribute(),
|
||||||
|
Keywords: out.GetKeywordAttribute(),
|
||||||
|
Researchs: out.GetResearchAttribute(),
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Achievement 成果信息
|
||||||
|
func (c *Laboratory) Achievement(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
uids, err := c.expert(id)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return achievement(uids, page, pageSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Project 项目信息
|
||||||
|
func (c *Laboratory) Project(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
// 查询专家身份下用户信息
|
||||||
|
uids, err := c.expert(id)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return project(uids, page, pageSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patent 专利信息
|
||||||
|
func (c *Laboratory) Patent(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
// 查询专家身份下用户信息
|
||||||
|
uids, err := c.expert(id)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return paper(uids, page, pageSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paper 论文信息
|
||||||
|
func (c *Laboratory) Paper(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
// 查询专家身份下用户信息
|
||||||
|
uids, err := c.expert(id)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return paper(uids, page, pageSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cooperate 企业信息
|
||||||
|
func (c *Laboratory) Cooperate(id uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||||
|
// 查询专家身份下用户信息
|
||||||
|
uids, err := c.expert(id)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return cooperate(uids, page, pageSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CooperateDetail 公司企业详细信息
|
||||||
|
func (c *Laboratory) CooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||||
|
return cooperateDetail(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLaboratory() LaboratoryHandle {
|
||||||
|
return func(session *session.Enterprise) *Laboratory {
|
||||||
|
return &Laboratory{session}
|
||||||
|
}
|
||||||
|
}
|
@ -23,10 +23,8 @@ type (
|
|||||||
// searchIdentityHandle 搜索信息处理
|
// searchIdentityHandle 搜索信息处理
|
||||||
var searchIdentityHandle = map[int]func(ids []uint64) (interface{}, error){
|
var searchIdentityHandle = map[int]func(ids []uint64) (interface{}, error){
|
||||||
config.TenantUserIdentityForCompany: company,
|
config.TenantUserIdentityForCompany: company,
|
||||||
config.TenantUserIdentityForExpert: company,
|
config.TenantUserIdentityForExpert: expert,
|
||||||
config.TenantUserIdentityForResearch: company,
|
config.TenantUserIdentityForLaboratory: laboratory,
|
||||||
config.TenantUserIdentityForLaboratory: company,
|
|
||||||
config.TenantUserIdentityForAgent: company,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// company 公司信息
|
// company 公司信息
|
||||||
@ -67,6 +65,8 @@ func expert(ids []uint64) (interface{}, error) {
|
|||||||
list := make([]*ExpertBasicInfo, 0)
|
list := make([]*ExpertBasicInfo, 0)
|
||||||
|
|
||||||
for _, v := range out {
|
for _, v := range out {
|
||||||
|
v.Image.Image = v.Image.Analysis(config2.SettingInfo.Domain)
|
||||||
|
|
||||||
list = append(list, &ExpertBasicInfo{
|
list = append(list, &ExpertBasicInfo{
|
||||||
ID: v.GetEncodeID(),
|
ID: v.GetEncodeID(),
|
||||||
Name: v.Name,
|
Name: v.Name,
|
||||||
@ -80,32 +80,25 @@ func expert(ids []uint64) (interface{}, error) {
|
|||||||
return list, nil
|
return list, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func research(ids []uint64) (interface{}, error) {
|
// laboratory 实验室信息
|
||||||
mManageCompany := model.NewManageCompany()
|
func laboratory(ids []uint64) (interface{}, error) {
|
||||||
out := make([]*model2.ManageCompany, 0)
|
mManageLaboratory := model.NewManageLaboratory()
|
||||||
|
|
||||||
if err := model2.ScanFields(mManageCompany.ManageCompany, &out, []string{}, &model2.ModelWhereOrder{
|
out, err := mManageLaboratory.Laboratory(model2.NewWhereIn("id", ids))
|
||||||
Where: model2.NewWhereIn("id", ids),
|
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
if err != nil {
|
||||||
}, &model2.ModelWhereOrder{
|
|
||||||
Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree),
|
|
||||||
}); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
list := make([]*LaboratoryBasicInfo, 0)
|
||||||
}
|
|
||||||
|
|
||||||
func laboratory(ids []uint64) (interface{}, error) {
|
for _, v := range out {
|
||||||
mManageCompany := model.NewManageCompany()
|
list = append(list, &LaboratoryBasicInfo{
|
||||||
out := make([]*model2.ManageCompany, 0)
|
ID: v.GetEncodeID(),
|
||||||
|
ManageLaboratoryInfo: v,
|
||||||
if err := model2.ScanFields(mManageCompany.ManageCompany, &out, []string{}, &model2.ModelWhereOrder{
|
Industrys: v.GetIndustryAttribute(),
|
||||||
Where: model2.NewWhereIn("id", ids),
|
Keywords: v.GetKeywordAttribute(),
|
||||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
Researchs: v.GetResearchAttribute(),
|
||||||
}, &model2.ModelWhereOrder{
|
})
|
||||||
Where: model2.NewWhere("examine_status", model2.ExamineStatusForAgree),
|
|
||||||
}); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,70 @@ package model
|
|||||||
import (
|
import (
|
||||||
"SciencesServer/app/common/model"
|
"SciencesServer/app/common/model"
|
||||||
"SciencesServer/serve/orm"
|
"SciencesServer/serve/orm"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ManageLaboratory struct {
|
type ManageLaboratory struct {
|
||||||
*model.ManageLaboratory
|
*model.ManageLaboratory
|
||||||
}
|
}
|
||||||
|
type (
|
||||||
|
// ManageLaboratoryInfo 实验室信息
|
||||||
|
ManageLaboratoryInfo struct {
|
||||||
|
*model.ManageLaboratory
|
||||||
|
ResearchName string `json:"research_name"`
|
||||||
|
ExpertCount int `json:"expert_count"`
|
||||||
|
CollectCount int `json:"collect_count"`
|
||||||
|
VisitCount int `json:"visit_count"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Instance 实验室信息
|
||||||
|
func (m *ManageLaboratory) Instance(id uint64) (*ManageLaboratoryInfo, error) {
|
||||||
|
db := orm.GetDB().Table(m.TableName()+" AS l").
|
||||||
|
Select("l.id", "l.image", "l.url", "l.industry", "l.keyword", "l.contact", "l.contact_mobile", "l.research", "l.introduce",
|
||||||
|
"e.name AS research_name", "e.count AS expert_count", "c.count AS collect_count", "v.count AS visit_count").
|
||||||
|
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON l.research_id = e.id", model.NewManageResearch().TableName())).
|
||||||
|
Joins(fmt.Sprintf("LEFT JOIN (SELECT laboratory_id, COUNT(laboratory_id) AS count FROM %s WHERE examine_status = %d AND is_deleted = %d GROUP BY laboratory_id) AS e ON l.id = e.laboratory_id",
|
||||||
|
model.NewManageExpert().TableName(), model.ExamineStatusForAgree, 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 l.id = c.object_id",
|
||||||
|
model.NewUserCollect().TableName(), model.UserCollectKindForLaboratory, 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 l.id = v.object_id",
|
||||||
|
model.NewUserVisit().TableName(), model.UserVisitKindForLaboratory, model.DeleteStatusForNot)).
|
||||||
|
Where("l.id = ?", id)
|
||||||
|
|
||||||
|
out := new(ManageLaboratoryInfo)
|
||||||
|
|
||||||
|
err := db.Scan(&out).Error
|
||||||
|
|
||||||
|
return out, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Laboratory 实验室信息
|
||||||
|
func (m *ManageLaboratory) Laboratory(where ...*model.ModelWhere) ([]*ManageLaboratoryInfo, error) {
|
||||||
|
db := orm.GetDB().Table(m.TableName()+" AS l").
|
||||||
|
Select("l.id", "l.image", "l.url", "l.industry", "l.keyword", "l.contact", "l.contact_mobile", "l.research",
|
||||||
|
"e.name AS research_name", "e.count AS expert_count", "c.count AS collect_count", "v.count AS visit_count").
|
||||||
|
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON l.research_id = e.id", model.NewManageResearch().TableName())).
|
||||||
|
Joins(fmt.Sprintf("LEFT JOIN (SELECT laboratory_id, COUNT(laboratory_id) AS count FROM %s WHERE examine_status = %d AND is_deleted = %d GROUP BY laboratory_id) AS e ON l.id = e.laboratory_id",
|
||||||
|
model.NewManageExpert().TableName(), model.ExamineStatusForAgree, 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 l.id = c.object_id",
|
||||||
|
model.NewUserCollect().TableName(), model.UserCollectKindForLaboratory, 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 l.id = v.object_id",
|
||||||
|
model.NewUserVisit().TableName(), model.UserVisitKindForLaboratory, model.DeleteStatusForNot)).
|
||||||
|
Where("l.examine_status = ?", model.ExamineStatusForAgree).
|
||||||
|
Where("l.is_deleted = ?", model.DeleteStatusForNot)
|
||||||
|
|
||||||
|
if len(where) > 0 {
|
||||||
|
for _, wo := range where {
|
||||||
|
db = db.Where(wo.Condition, wo.Value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out := make([]*ManageLaboratoryInfo, 0)
|
||||||
|
|
||||||
|
err := db.Scan(&out).Error
|
||||||
|
|
||||||
|
return out, err
|
||||||
|
}
|
||||||
|
|
||||||
// Distribution 分布信息
|
// Distribution 分布信息
|
||||||
func (m *ManageLaboratory) Distribution() ([]*DataAreaDistributionInfo, error) {
|
func (m *ManageLaboratory) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||||
|
@ -8,15 +8,17 @@ import (
|
|||||||
type ManageLaboratory struct {
|
type ManageLaboratory struct {
|
||||||
Model
|
Model
|
||||||
Local
|
Local
|
||||||
ResearchID uint64 `gorm:"column:research_id;type:int(11);default:0;comment:科研机构ID" json:"-"`
|
ResearchID uint64 `gorm:"column:research_id;type:int(11);default:0;comment:科研机构ID" json:"-"`
|
||||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"`
|
Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"`
|
||||||
Code string `gorm:"column:code;type:varchar(30);default:'';comment:信用代码" json:"code"`
|
Code string `gorm:"column:code;type:varchar(30);default:'';comment:信用代码" json:"code"`
|
||||||
|
Contact string `gorm:"column:contact;type:varchar(20);default:'';comment:联系人" json:"contact"`
|
||||||
|
ContactMobile string `gorm:"column:contact_mobile;type:varchar(15);default:'';comment:联系方式" json:"contact_mobile"`
|
||||||
Image
|
Image
|
||||||
Area
|
Area
|
||||||
Url string `gorm:"column:url;type:varchar(255);default:'';comment:实验室网站" json:"url"`
|
Url string `gorm:"column:url;type:varchar(255);default:'';comment:实验室网站" json:"url"`
|
||||||
Position string `gorm:"column:position;type:varchar(50);default:'';comment:坐标" json:"-"`
|
Position string `gorm:"column:position;type:varchar(50);default:'';comment:坐标" json:"-"`
|
||||||
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:行业领域" json:"-"`
|
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:行业领域" json:"-"`
|
||||||
Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"keyword"`
|
Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"`
|
||||||
Research string `gorm:"column:research;type:varchar(255);default:'';comment:研究信息" json:"research"`
|
Research string `gorm:"column:research;type:varchar(255);default:'';comment:研究信息" json:"research"`
|
||||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||||
Examine
|
Examine
|
||||||
|
26
app/common/model/user_collect.go
Normal file
26
app/common/model/user_collect.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
// UserCollect 用户收藏管理数据模型
|
||||||
|
type UserCollect struct {
|
||||||
|
Model
|
||||||
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
|
Kind UserCollectKind `gorm:"column:kind;type:tinyint(3);default:0;comment:收藏数据类型" json:"kind"`
|
||||||
|
ObjectID uint64 `gorm:"column:object_id;type:int(11);default:0;comment:收藏对象ID" json:"-"`
|
||||||
|
ModelDeleted
|
||||||
|
ModelAt
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserCollectKind int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// UserCollectKindForLaboratory 实验室
|
||||||
|
UserCollectKindForLaboratory UserCollectKind = iota + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
func (m *UserCollect) TableName() string {
|
||||||
|
return "user_collect"
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserCollect() *UserCollect {
|
||||||
|
return &UserCollect{}
|
||||||
|
}
|
30
app/common/model/user_visit.go
Normal file
30
app/common/model/user_visit.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// UserVisit 用户浏览记录数据模型
|
||||||
|
type UserVisit struct {
|
||||||
|
Model
|
||||||
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
|
Kind UserVisitKind `gorm:"column:kind;type:tinyint(3);default:0;comment:收藏数据类型" json:"kind"`
|
||||||
|
ObjectID uint64 `gorm:"column:object_id;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
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserVisitKind int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// UserVisitKindForLaboratory 实验室
|
||||||
|
UserVisitKindForLaboratory UserCollectKind = iota + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
func (m *UserVisit) TableName() string {
|
||||||
|
return "user_visit"
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserVisit() *UserVisit {
|
||||||
|
return &UserVisit{}
|
||||||
|
}
|
@ -78,8 +78,15 @@ func registerAPI(app *gin.Engine) {
|
|||||||
manageV1.POST("/expert/project", _api.ExpertProject)
|
manageV1.POST("/expert/project", _api.ExpertProject)
|
||||||
manageV1.POST("/expert/patent", _api.ExpertPatent)
|
manageV1.POST("/expert/patent", _api.ExpertPatent)
|
||||||
manageV1.POST("/expert/paper", _api.ExpertPaper)
|
manageV1.POST("/expert/paper", _api.ExpertPaper)
|
||||||
manageV1.POST("/expert/company", _api.ExpertCompany)
|
manageV1.POST("/expert/cooperate", _api.ExpertCooperate)
|
||||||
manageV1.POST("/expert/company/detail", _api.ExpertCompanyDetail)
|
manageV1.POST("/expert/cooperate/detail", _api.ExpertCooperateDetail)
|
||||||
|
manageV1.POST("/laboratory", _api.Laboratory)
|
||||||
|
manageV1.POST("/laboratory/achievement", _api.ExpertAchievement)
|
||||||
|
manageV1.POST("/laboratory/project", _api.ExpertProject)
|
||||||
|
manageV1.POST("/laboratory/patent", _api.ExpertPatent)
|
||||||
|
manageV1.POST("/laboratory/paper", _api.ExpertPaper)
|
||||||
|
manageV1.POST("/laboratory/cooperate", _api.ExpertCooperate)
|
||||||
|
manageV1.POST("/laboratory/cooperate/detail", _api.ExpertCooperateDetail)
|
||||||
}
|
}
|
||||||
//Technology 技术信息管理
|
//Technology 技术信息管理
|
||||||
technologyV1 := v1.Group("/technology")
|
technologyV1 := v1.Group("/technology")
|
||||||
|
Reference in New Issue
Block a user