feat:完善信息
This commit is contained in:
@ -9,10 +9,9 @@ type Area struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// IdentityForCompany 公身份信息
|
// IdentityForCompany 公司附加信息
|
||||||
IdentityForCompany struct {
|
IdentityForCompany struct {
|
||||||
Name string `json:"name"` // 公司企业名称
|
Industry uint64 `json:"industry"`
|
||||||
Code string `json:"code"` // 企业代码
|
Keywords []string `json:"keywords"`
|
||||||
Area
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -66,6 +66,23 @@ const (
|
|||||||
AccountStatusForDisable
|
AccountStatusForDisable
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ExamineStatus 审核状态
|
||||||
|
type ExamineStatus struct {
|
||||||
|
Status ExamineStatusKind `gorm:"column:status;type:tinyint(1);default:0;comment:审核状态(0:审核中,1:审核通过,2:审核拒绝)" json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExamineStatusKind 审核状态
|
||||||
|
type ExamineStatusKind int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ExamineStatusForOngoing 审核中
|
||||||
|
ExamineStatusForOngoing ExamineStatusKind = iota
|
||||||
|
// ExamineStatusForAgree 审核通过
|
||||||
|
ExamineStatusForAgree
|
||||||
|
// ExamineStatusForRefuse 审核拒绝
|
||||||
|
ExamineStatusForRefuse
|
||||||
|
)
|
||||||
|
|
||||||
type Area struct {
|
type Area struct {
|
||||||
Province uint64 `gorm:"column:province;type:int;default:0;comment:所在省" json:"province"`
|
Province uint64 `gorm:"column:province;type:int;default:0;comment:所在省" json:"province"`
|
||||||
City uint64 `gorm:"column:city;type:int;default:0;comment:所在市" json:"city"`
|
City uint64 `gorm:"column:city;type:int;default:0;comment:所在市" json:"city"`
|
||||||
|
37
app/common/model/manage_company.go
Normal file
37
app/common/model/manage_company.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "SciencesServer/utils"
|
||||||
|
|
||||||
|
// ManageCompany 公司企业管理
|
||||||
|
type ManageCompany struct {
|
||||||
|
Model
|
||||||
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||||
|
Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"`
|
||||||
|
Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"`
|
||||||
|
Image
|
||||||
|
Area
|
||||||
|
Industry uint64 `gorm:"column:industry;type:int(11);default:0;comment:行业领域" json:"industry"`
|
||||||
|
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"`
|
||||||
|
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||||
|
ExamineStatus
|
||||||
|
ModelDeleted
|
||||||
|
ModelAt
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ManageCompany) TableName() string {
|
||||||
|
return "manage_company"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ManageCompany) GetKeywordAttribute() []string {
|
||||||
|
keywords := make([]string, 0)
|
||||||
|
_ = utils.FromJSON(m.Keyword, &keywords)
|
||||||
|
return keywords
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *ManageCompany) SetKeywordAttribute(keywords []string) {
|
||||||
|
m.Keyword = utils.AnyToJSON(keywords)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewManageCompany() *ManageCompany {
|
||||||
|
return &ManageCompany{}
|
||||||
|
}
|
@ -3,7 +3,7 @@ package model
|
|||||||
type UserTenant struct {
|
type UserTenant struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
ModelTenant
|
||||||
UID uint64 `gorm:"column:uid;index:idx_tenant_user_uuid;type:int;default:0;comment:用户表UUID" json:"-"`
|
UID uint64 `gorm:"column:uid;index:idx_user_tenant_uid;type:int;default:0;comment:用户表UUID" json:"-"`
|
||||||
Avatar string `gorm:"column:avatar;type:varchar(255);default:null;comment:头像" json:"avatar"`
|
Avatar string `gorm:"column:avatar;type:varchar(255);default:null;comment:头像" json:"avatar"`
|
||||||
Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"`
|
Name string `gorm:"column:name;type:varchar(20);default:null;comment:真实姓名" json:"name"`
|
||||||
Email string `gorm:"column:email;type:varchar(50);default:null;comment:邮箱" json:"email"`
|
Email string `gorm:"column:email;type:varchar(50);default:null;comment:邮箱" json:"email"`
|
||||||
|
19
app/enterprise/api/tenant.go
Normal file
19
app/enterprise/api/tenant.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/basic/api"
|
||||||
|
"SciencesServer/app/enterprise/controller/tenant"
|
||||||
|
"SciencesServer/app/service"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Tenant struct{}
|
||||||
|
|
||||||
|
func (a *Tenant) SettledCompany(c *gin.Context) {
|
||||||
|
err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Company(nil, nil)
|
||||||
|
api.APIResponse(err)(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Tenant) SettledExpert(c *gin.Context) {
|
||||||
|
|
||||||
|
}
|
@ -69,6 +69,7 @@ func (c *Paper) Form(params *PaperParams) error {
|
|||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mTechnologyPaper.UID = c.UID
|
||||||
mTechnologyPaper.Title = params.Title
|
mTechnologyPaper.Title = params.Title
|
||||||
mTechnologyPaper.Ext = params.Ext
|
mTechnologyPaper.Ext = params.Ext
|
||||||
mTechnologyPaper.Author = params.Author
|
mTechnologyPaper.Author = params.Author
|
||||||
|
1
app/enterprise/controller/tenant/instance.go
Normal file
1
app/enterprise/controller/tenant/instance.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package tenant
|
98
app/enterprise/controller/tenant/settled.go
Normal file
98
app/enterprise/controller/tenant/settled.go
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
package tenant
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/basic/config"
|
||||||
|
model2 "SciencesServer/app/common/model"
|
||||||
|
"SciencesServer/app/enterprise/model"
|
||||||
|
"SciencesServer/app/service"
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Settled 入驻
|
||||||
|
type Settled struct{ *service.SessionEnterprise }
|
||||||
|
|
||||||
|
type SettledHandle func(enterprise *service.SessionEnterprise) *Settled
|
||||||
|
|
||||||
|
type SettledParams struct {
|
||||||
|
ID uint64
|
||||||
|
Image string // logo图片
|
||||||
|
Name string // 名称
|
||||||
|
Code string // 唯一编码
|
||||||
|
config.Area
|
||||||
|
Introduce string `json:"introduce"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *SettledParams) effect(uid uint64, iModel model2.IModel) error {
|
||||||
|
if c.ID <= 0 {
|
||||||
|
var count int64
|
||||||
|
|
||||||
|
if err := model2.Count(iModel, &count, model2.NewWhere("uid", uid)); err != nil {
|
||||||
|
return err
|
||||||
|
} else if count > 0 {
|
||||||
|
return errors.New("无权限操作,当前身份下已含有申请入驻信息")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if isExist, err := model2.FirstField(iModel, []string{"id", "uid", "status"}, model2.NewWhere("id", c.ID)); err != nil {
|
||||||
|
return err
|
||||||
|
} else if !isExist {
|
||||||
|
return errors.New("无权限操作,未知的入驻信息")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Company 公司企业
|
||||||
|
func (c *Settled) Company(params *SettledParams, other *config.IdentityForCompany) error {
|
||||||
|
mManageCompany := model.NewManageCompany()
|
||||||
|
|
||||||
|
err := params.effect(c.UID, mManageCompany.ManageCompany)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mManageCompany.Name = params.Name
|
||||||
|
mManageCompany.Code = params.Code
|
||||||
|
mManageCompany.Image = model2.Image{Image: params.Image}
|
||||||
|
mManageCompany.Area = model2.Area{
|
||||||
|
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||||
|
}
|
||||||
|
mManageCompany.Industry = other.Industry
|
||||||
|
mManageCompany.SetKeywordAttribute(other.Keywords)
|
||||||
|
mManageCompany.Introduce = params.Introduce
|
||||||
|
|
||||||
|
if mManageCompany.ID <= 0 {
|
||||||
|
return model2.Create(mManageCompany.ManageCompany)
|
||||||
|
}
|
||||||
|
if mManageCompany.UID != c.UID {
|
||||||
|
return errors.New("异常,无权限操作")
|
||||||
|
} else if mManageCompany.Status != model2.ExamineStatusForRefuse {
|
||||||
|
return errors.New("操作错误,不允许操作")
|
||||||
|
}
|
||||||
|
return model2.Updates(mManageCompany.ManageCompany, mManageCompany.ManageCompany)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Expert 专家
|
||||||
|
func (c *Settled) Expert() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Research 研究机构
|
||||||
|
func (c *Settled) Research() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Laboratory 实验室
|
||||||
|
func (c *Settled) Laboratory() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Agent 经纪人
|
||||||
|
func (c *Settled) Agent() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSettled() SettledHandle {
|
||||||
|
return func(enterprise *service.SessionEnterprise) *Settled {
|
||||||
|
return &Settled{enterprise}
|
||||||
|
}
|
||||||
|
}
|
11
app/enterprise/model/manage_company.go
Normal file
11
app/enterprise/model/manage_company.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "SciencesServer/app/common/model"
|
||||||
|
|
||||||
|
type ManageCompany struct {
|
||||||
|
*model.ManageCompany
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewManageCompany() *ManageCompany {
|
||||||
|
return &ManageCompany{}
|
||||||
|
}
|
11
app/enterprise/model/sys_tenant.go
Normal file
11
app/enterprise/model/sys_tenant.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "SciencesServer/app/common/model"
|
||||||
|
|
||||||
|
type SysTenant struct {
|
||||||
|
*model.SysTenant
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSysTenant() *SysTenant {
|
||||||
|
return &SysTenant{model.NewSysTenant()}
|
||||||
|
}
|
Reference in New Issue
Block a user