feat:优化项目信息

This commit is contained in:
henry
2022-02-15 17:19:23 +08:00
parent cbc0ad1a41
commit dcb5948e91
45 changed files with 852 additions and 100 deletions

View File

@ -116,6 +116,7 @@ func (this *Instance) Handle() {
}
return out
}},
&synchronized{iModel: model.NewSysVip()},
&synchronized{iModel: model.NewSysNavigation()}, &synchronized{iModel: model.NewSysAbout()},
&synchronized{iModel: model.NewSysBanner()}, &synchronized{iModel: model.NewSysAgreement()},
// 日志管理

View File

@ -2,6 +2,9 @@ package model
import "encoding/json"
type IOrderInstance interface {
}
// OrderInstance 订单数据模型
type OrderInstance struct {
Model
@ -29,12 +32,22 @@ type OrderInstanceParamsKind int
const (
// OrderInstanceParamsKindForActivity 活动信息
OrderInstanceParamsKindForActivity OrderInstanceParamsKind = iota + 1e2 + 1
// OrderInstanceParamsKindForVIP 会员信息
OrderInstanceParamsKindForVIP
)
// OrderInstanceParamsForActivity 订单活动参数
type OrderInstanceParamsForActivity struct {
ID uint64 `json:"id"`
}
type (
// OrderInstanceParamsForActivity 订单活动参数
OrderInstanceParamsForActivity struct {
ID uint64 `json:"id"`
Identity int `json:"identity"`
}
// OrderInstanceParamsForVip 会员参数
OrderInstanceParamsForVip struct {
ID uint64 `json:"id"`
EffectTime int `json:"effect_time"` // 有效时长,月
}
)
// OrderInstanceStatus 订单状态
type OrderInstanceStatus int
@ -56,7 +69,7 @@ func (m *OrderInstance) TableName() string {
return "order_instance"
}
func (m *OrderInstance) SetParamsAttribute(kind OrderInstanceParamsKind, data interface{}) {
func (m *OrderInstance) SetParamsAttribute(kind OrderInstanceParamsKind, data IOrderInstance) {
value := &OrderInstanceParams{Kind: kind, Data: data}
_bytes, _ := json.Marshal(value)
m.Params = string(_bytes)

View File

@ -6,8 +6,9 @@ type ServiceSolutionCaseKind struct {
ModelTenant
Title string `gorm:"column:title;type:varchar(100);default:'';comment:标题" json:"title"`
Image
Mode ServiceSolutionCaseMode `gorm:"column:mode;type:tinyint(3);default:0;comment:方案模式" json:"mode"`
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序,数值越小,优先排序" json:"sort"`
Mode ServiceSolutionCaseMode `gorm:"column:mode;type:tinyint(3);default:0;comment:方案模式" json:"mode"`
Description string `gorm:"column:description;type:varchar(255);default:'';comment:方案描述" json:"description"`
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序,数值越小,优先排序" json:"sort"`
ModelDeleted
ModelAt
}

View File

@ -0,0 +1,54 @@
package model
// SysVip 会员配置数据模型
type SysVip struct {
Model
Level int `gorm:"column:level;tinyint(1);default:0;comment:会员等级" json:"level"`
Title string `gorm:"column:title;varchar(100);default:'';comment:会员名称" json:"title"`
Price float64 `gorm:"column:price;decimal(10,2);default:0;comment:价格" json:"price"`
EffectTime int `gorm:"column:effect_time;tinyint(3);default:0;comment:有效时长、月" json:"effect_time"`
Discount float64 `gorm:"column:discount;decimal(10,2);default:0;comment:折扣" json:"discount"`
Currency float64 `gorm:"column:currency;decimal(10,2);default:0;comment:赠送的创新币" json:"currency"`
Function int `gorm:"column:function;tinyint(3);default:0;comment:支持功能" json:"function"`
IsHidden SysVipStatus `gorm:"column:is_hidden;tinyint(1);default:0;comment:隐藏状态" json:"is_hidden"`
IsDisabled int `gorm:"column:is_disabled;tinyint(1);default:0;comment:禁用状态,不可充值" json:"is_disabled"`
ModelDeleted
ModelAt
}
const (
// SysVipOpenFunctionForSearch 任意检索
SysVipOpenFunctionForSearch int = 1 << 0
// SysVipOpenFunctionForAchievementPush 创新科技资源自动匹配推送功能
SysVipOpenFunctionForAchievementPush int = 1 << 1
// SysVipOpenFunctionForHighCompanyDemand 上市公司及优质客户的企业需求优先推送
SysVipOpenFunctionForHighCompanyDemand int = 1 << 2
// SysVipOpenFunctionForOrdinaryCompanyDemand 普通企业的需求匹配推送
SysVipOpenFunctionForOrdinaryCompanyDemand int = 1 << 3
// SysVipOpenFunctionForMachImport 匹配结果文件导出
SysVipOpenFunctionForMachImport int = 1 << 4
// SysVipOpenFunctionForOverseasDemand 海外需求推荐
SysVipOpenFunctionForOverseasDemand int = 1 << 5
)
// SysVipStatus 会员状态
type SysVipStatus int
func (m *SysVip) TableName() string {
return "sys_vip"
}
func (m *SysVip) GetFunctions() map[int]string {
return map[int]string{
SysVipOpenFunctionForSearch: "任意检索",
SysVipOpenFunctionForAchievementPush: "创新科技资源自动匹配推送功能",
SysVipOpenFunctionForHighCompanyDemand: "上市公司及优质客户的企业需求优先推送",
SysVipOpenFunctionForOrdinaryCompanyDemand: "普通企业的需求匹配推送",
SysVipOpenFunctionForMachImport: "匹配结果文件导出",
SysVipOpenFunctionForOverseasDemand: "海外需求推荐",
}
}
func NewSysVip() *SysVip {
return &SysVip{}
}

View File

@ -9,9 +9,10 @@ import (
type TechnologyAchievement struct {
Model
ModelTenant
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
Mode TechnologyAchievementMode `gorm:"column:mode;type:tinyint(1);default:1;comment:成果模式" json:"mode"`
Title string `gorm:"column:title;type:varchar(100);default:'';comment:成果名称" json:"title"`
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
Mode TechnologyAchievementMode `gorm:"column:mode;type:tinyint(1);default:1;comment:成果模式" json:"mode"`
Title string `gorm:"column:title;type:varchar(100);default:'';comment:成果名称" json:"title"`
Description string `gorm:"source:description;type:varchar(255);comment:成果描述" json:"description"`
Image
File string `gorm:"column:file;type:varchar(255);default:'';comment:证明材料" json:"file"`
Industry string `gorm:"column:industry;type:varchar(255);default:'';comment:所属领域;行业信息" json:"-"`
@ -22,7 +23,6 @@ type TechnologyAchievement struct {
Config string `gorm:"column:config;type:varchar(255);default:'';comment:配置信息" json:"config"`
Keyword string `gorm:"column:keyword;type:varchar(255);default:'';comment:关键词" json:"-"`
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
Source string `gorm:"source:introduce;type:text;comment:成果来源" json:"source"`
Shelf
TechnologyStatus
ModelDeleted
@ -50,6 +50,15 @@ func (m *TechnologyAchievement) TableName() string {
return "technology_achievement"
}
func (m *TechnologyAchievement) GetModeTitle() string {
if m.Mode == TechnologyAchievementModeForFree {
return "免费模式"
} else if m.Mode == TechnologyAchievementModeForCharge {
return "收费模式"
}
return ""
}
func (m *TechnologyAchievement) GetConfigAttribute() *TechnologyAchievementConfig {
out := new(TechnologyAchievementConfig)
_ = json.Unmarshal([]byte(m.Config), &out)

View File

@ -15,11 +15,11 @@ type UserInstance struct {
Name string `gorm:"column:name;type:varchar(20);default:'';comment:真实姓名" json:"name"`
Mobile string `gorm:"column:mobile;index:idx_user_instance_mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"`
Gender
Vip UserInstanceVipKind `gorm:"column:vip;type:tinyint(1);default:0;comment:会员状态/类型" json:"vip"`
VipDeadline time.Time `gorm:"column:vip_deadline;type:datetime;default:null;comment:会员过期时间" json:"vip_deadline"`
Identity int `gorm:"column:identity;type:int(8);default:0;comment:身份信息" json:"-"`
Password string `gorm:"column:password;type:varchar(100);default:'';comment:密码" json:"-"`
Salt string `gorm:"column:salt;type:varchar(10);default:'';comment:盐值" json:"-"`
Vip uint64 `gorm:"column:vip;type:int(11);default:0;comment:会员ID" json:"vip"`
VipDeadline time.Time `gorm:"column:vip_deadline;type:datetime;default:null;comment:会员过期时间" json:"vip_deadline"`
Identity int `gorm:"column:identity;type:int(8);default:0;comment:身份信息" json:"-"`
Password string `gorm:"column:password;type:varchar(100);default:'';comment:密码" json:"-"`
Salt string `gorm:"column:salt;type:varchar(10);default:'';comment:盐值" json:"-"`
AccountStatus
ModelDeleted
ModelAt
@ -35,16 +35,6 @@ const (
UserInstanceSourceForWechat
)
// UserInstanceVipKind 用户会员类型
type UserInstanceVipKind int
const (
// UserInstanceVipForOrdinary 普通VIP
UserInstanceVipForOrdinary UserInstanceVipKind = iota + 1
// UserInstanceVipForSenior 高级VIP
UserInstanceVipForSenior
)
func (m *UserInstance) TableName() string {
return "user_instance"
}