feat:完善项目信息
This commit is contained in:
@ -143,10 +143,12 @@ func (*Service) SolutionCaseDetail(c *gin.Context) {
|
||||
func (*Service) SolutionCaseForm(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.TenantIDStringForm
|
||||
KindID string `json:"kind_id" form:"kind_id" binding:"required"`
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
api.ImageForm
|
||||
Description string `json:"description" form:"description" binding:"description"`
|
||||
Content string `json:"content" form:"content" binding:"required"`
|
||||
Tags []string `json:"tags" form:"tags"`
|
||||
Sort int `json:"sort" form:"sort"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
@ -154,8 +156,8 @@ func (*Service) SolutionCaseForm(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
err := service.NewSolutionCase()(api.GetSession()(c).(*session.Admin)).Form(&service.SolutionCaseParams{
|
||||
ID: form.Convert(), KindID: (&api.IDStringForm{ID: form.KindID}).Convert(),
|
||||
Title: form.Title, Content: form.Content, Sort: form.Sort,
|
||||
ID: form.IDStringForm.Convert(), TenantID: form.TenantIDStringForm.Convert(), KindID: (&api.IDStringForm{ID: form.KindID}).Convert(),
|
||||
Image: form.FilterImageURL(), Title: form.Title, Description: form.Description, Content: form.Content, Sort: form.Sort,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -194,6 +196,7 @@ func (*Service) SolutionCaseKindSelect(c *gin.Context) {
|
||||
func (*Service) SolutionCaseKindForm(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.TenantIDStringForm
|
||||
Mode int `json:"mode" form:"mode" binding:"required"`
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
api.ImageForm
|
||||
@ -204,7 +207,8 @@ func (*Service) SolutionCaseKindForm(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
err := service.NewSolutionCase()(api.GetSession()(c).(*session.Admin)).KindForm(&service.SolutionCaseKindParams{
|
||||
ID: form.Convert(), Mode: form.Mode, Image: form.FilterImageURL(), Title: form.Title, Sort: form.Sort,
|
||||
ID: form.IDStringForm.Convert(), TenantID: form.TenantIDStringForm.Convert(), Mode: form.Mode,
|
||||
Image: form.FilterImageURL(), Title: form.Title, Sort: form.Sort,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -219,3 +223,33 @@ func (*Service) SolutionCaseKindDelete(c *gin.Context) {
|
||||
err := service.NewSolutionCase()(api.GetSession()(c).(*session.Admin)).KindDelete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Service) Message(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.TenantIDStringForm
|
||||
Name string `json:"name" form:"name"`
|
||||
Status int `json:"status" form:"status"`
|
||||
Content string `json:"content" form:"content"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := service.NewMessage()(api.GetSession()(c).(*session.Admin)).Instance(form.TenantIDStringForm.Convert(),
|
||||
form.Name, form.Status, form.Content, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Service) MessageHandle(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
Content string `json:"content" form:"content"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := service.NewMessage()(api.GetSession()(c).(*session.Admin)).Handle(form.Convert(), form.Content)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
105
app/api/admin/controller/service/message.go
Normal file
105
app/api/admin/controller/service/message.go
Normal file
@ -0,0 +1,105 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/admin/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Message struct {
|
||||
*session.Admin
|
||||
}
|
||||
|
||||
type MessageHandle func(session *session.Admin) *Message
|
||||
|
||||
type MessageInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.ServiceMessageInfo
|
||||
Area string `json:"area"`
|
||||
}
|
||||
|
||||
// Instance 列表信息
|
||||
func (c *Message) Instance(tenantID uint64, name string, status int, content string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mServiceMessage := model.NewServiceMessage()
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if c.TenantID > 0 {
|
||||
where = append(where, model2.NewWhere("m.tenant_id", c.TenantID))
|
||||
}
|
||||
if tenantID > 0 {
|
||||
where = append(where, model2.NewWhere("m.tenant_id", tenantID))
|
||||
}
|
||||
if name != "" {
|
||||
where = append(where, model2.NewWhereLike("m.name", name))
|
||||
}
|
||||
if status > 0 {
|
||||
where = append(where, model2.NewWhere("m.status", status))
|
||||
}
|
||||
if content != "" {
|
||||
where = append(where, model2.NewWhereLike("m.content", content))
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mServiceMessage.Message(page, pageSize, &count, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*MessageInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &MessageInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
ServiceMessageInfo: v,
|
||||
Area: v.FormatBasic(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, err
|
||||
}
|
||||
|
||||
// Handle 处理操作
|
||||
func (c *Message) Handle(id uint64, content string) error {
|
||||
mServiceMessage := model.NewServiceMessage()
|
||||
mServiceMessage.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mServiceMessage.ServiceMessage, []string{"id", "tenant_id", "status"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,留言信息不存在或已被删除")
|
||||
} else if c.TenantID > 0 && mServiceMessage.TenantID != c.TenantID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
if mServiceMessage.Status != model2.ServiceMessageStatusForProcessing {
|
||||
return errors.New("操作错误,当前留言信息已处理")
|
||||
}
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
if err = model2.Updates(mServiceMessage.ServiceMessage, map[string]interface{}{
|
||||
"status": model2.ServiceMessageStatusForProcessed, "updated_at": time.Now(),
|
||||
}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mServiceMessageLog := model.NewServiceMessageLog()
|
||||
mServiceMessageLog.UID = c.UID
|
||||
mServiceMessageLog.MessageID = id
|
||||
mServiceMessageLog.Content = content
|
||||
|
||||
if err = model2.Create(mServiceMessage.ServiceMessage); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func NewMessage() MessageHandle {
|
||||
return func(session *session.Admin) *Message {
|
||||
return &Message{session}
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import (
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
"errors"
|
||||
)
|
||||
|
||||
@ -25,11 +26,12 @@ type (
|
||||
SolutionCaseDetailInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.ServiceSolutionCase
|
||||
TenantID string `json:"tenant_id"`
|
||||
KindID string `json:"kind_id"`
|
||||
}
|
||||
// SolutionCaseParams 案例参数信息
|
||||
SolutionCaseParams struct {
|
||||
ID, KindID uint64
|
||||
ID, TenantID, KindID uint64
|
||||
Title, Image, Description, Content string
|
||||
Sort int
|
||||
}
|
||||
@ -37,6 +39,7 @@ type (
|
||||
SolutionCaseKindInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.ServiceSolutionCaseKind
|
||||
TenantID string `json:"tenant_id"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// SolutionCaseKindSelectInfo 案例分类筛选信息
|
||||
@ -47,7 +50,7 @@ type (
|
||||
}
|
||||
// SolutionCaseKindParams 案例分类参数信息
|
||||
SolutionCaseKindParams struct {
|
||||
ID uint64
|
||||
ID, TenantID uint64
|
||||
Mode int
|
||||
Title, Image string
|
||||
Sort int
|
||||
@ -82,7 +85,7 @@ func (c *SolutionCase) Instance(tenantID uint64, title string, kindID uint64, pa
|
||||
list := make([]*SolutionCaseInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
v.Image.Image = v.Image.Analysis("")
|
||||
v.Image.Image = v.Image.Analysis(config2.SettingInfo.Domain)
|
||||
|
||||
list = append(list, &SolutionCaseInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
@ -105,11 +108,12 @@ func (c *SolutionCase) Detail(id uint64) (*SolutionCaseDetailInfo, error) {
|
||||
} else if !isExist {
|
||||
return nil, errors.New("操作错误,案例信息不存在或已被删除")
|
||||
}
|
||||
mServiceSolutionCase.Image.Image = mServiceSolutionCase.Image.Analysis("")
|
||||
mServiceSolutionCase.Image.Image = mServiceSolutionCase.Image.Analysis(config2.SettingInfo.Domain)
|
||||
|
||||
return &SolutionCaseDetailInfo{
|
||||
ID: mServiceSolutionCase.GetEncodeID(),
|
||||
ServiceSolutionCase: mServiceSolutionCase.ServiceSolutionCase,
|
||||
TenantID: mServiceSolutionCase.GetEncodeTenantID(),
|
||||
KindID: (&model2.Model{ID: mServiceSolutionCase.KindID}).GetEncodeID(),
|
||||
}, nil
|
||||
}
|
||||
@ -140,10 +144,16 @@ func (c *SolutionCase) Form(params *SolutionCaseParams) error {
|
||||
mServiceSolutionCase.Sort = params.Sort
|
||||
|
||||
if mServiceSolutionCase.ID > 0 {
|
||||
if c.TenantID <= 0 {
|
||||
mServiceSolutionCase.TenantID = params.TenantID
|
||||
}
|
||||
return model2.Updates(mServiceSolutionCase.ServiceSolutionCase, mServiceSolutionCase.ServiceSolutionCase)
|
||||
}
|
||||
mServiceSolutionCase.TenantID = c.TenantID
|
||||
mServiceSolutionCase.TenantID = params.TenantID
|
||||
|
||||
if c.TenantID > 0 {
|
||||
mServiceSolutionCase.TenantID = c.TenantID
|
||||
}
|
||||
return model2.Create(mServiceSolutionCase.ServiceSolutionCase)
|
||||
}
|
||||
|
||||
@ -193,9 +203,12 @@ func (c *SolutionCase) Kind(tenantID uint64, mode int, title string, page, pageS
|
||||
list := make([]*SolutionCaseKindInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
v.Image.Image = v.Image.Analysis(config2.SettingInfo.Domain)
|
||||
|
||||
list = append(list, &SolutionCaseKindInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
ServiceSolutionCaseKind: v.ServiceSolutionCaseKind,
|
||||
TenantID: v.GetEncodeTenantID(),
|
||||
Area: v.FormatBasic(),
|
||||
})
|
||||
}
|
||||
@ -259,10 +272,16 @@ func (c *SolutionCase) KindForm(params *SolutionCaseKindParams) error {
|
||||
mServiceSolutionCaseKind.Sort = params.Sort
|
||||
|
||||
if mServiceSolutionCaseKind.ID > 0 {
|
||||
if c.TenantID <= 0 {
|
||||
mServiceSolutionCaseKind.TenantID = params.TenantID
|
||||
}
|
||||
return model2.Updates(mServiceSolutionCaseKind.ServiceSolutionCaseKind, mServiceSolutionCaseKind.ServiceSolutionCaseKind)
|
||||
}
|
||||
mServiceSolutionCaseKind.TenantID = c.TenantID
|
||||
mServiceSolutionCaseKind.TenantID = params.TenantID
|
||||
|
||||
if c.TenantID > 0 {
|
||||
mServiceSolutionCaseKind.TenantID = c.TenantID
|
||||
}
|
||||
return model2.Create(mServiceSolutionCaseKind.ServiceSolutionCaseKind)
|
||||
}
|
||||
|
||||
|
48
app/api/admin/model/service_message.go
Normal file
48
app/api/admin/model/service_message.go
Normal file
@ -0,0 +1,48 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ServiceMessage struct {
|
||||
*model.ServiceMessage
|
||||
}
|
||||
|
||||
type ServiceMessageInfo struct {
|
||||
*model.ServiceMessage
|
||||
model.Area
|
||||
HandleContent string `json:"handle_content"`
|
||||
HandleCreatedAt time.Time `json:"handle_created_at"`
|
||||
}
|
||||
|
||||
func (m *ServiceMessage) Message(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ServiceMessageInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS m").
|
||||
Select("m.*", "l.content AS handle_content", "l.created_at AS handle_created_at",
|
||||
"t.province", "t.city").
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT MAX(id) AS id, message_id, MAX(created_at) AS created_at, MAX(content) AS content "+
|
||||
"FROM %s WHERE is_deleted = %d GROUP BY message_id) AS l ON m.id = l.message_id",
|
||||
model.NewServiceMessageLog().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON m.tenant_id = t.id", model.NewSysTenant().TableName()))
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*ServiceMessageInfo, 0)
|
||||
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Order("m.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewServiceMessage() *ServiceMessage {
|
||||
return &ServiceMessage{model.NewServiceMessage()}
|
||||
}
|
11
app/api/admin/model/service_message_log.go
Normal file
11
app/api/admin/model/service_message_log.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type ServiceMessageLog struct {
|
||||
*model.ServiceMessageLog
|
||||
}
|
||||
|
||||
func NewServiceMessageLog() *ServiceMessageLog {
|
||||
return &ServiceMessageLog{model.NewServiceMessageLog()}
|
||||
}
|
@ -14,6 +14,7 @@ type ServiceSolutionCase struct {
|
||||
// ServiceSolutionCaseInfo 服务案例信息
|
||||
type ServiceSolutionCaseInfo struct {
|
||||
model.Model
|
||||
model.ModelTenant
|
||||
Title string `json:"title"`
|
||||
model.Image
|
||||
Description string `json:"description"`
|
||||
@ -26,7 +27,7 @@ type ServiceSolutionCaseInfo struct {
|
||||
// SolutionCase 案例信息
|
||||
func (m *ServiceSolutionCase) SolutionCase(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ServiceSolutionCaseInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS s").
|
||||
Select("s.id", "s.title", "s.image", "s.description", "s.visits", "k.title AS kind_title", "s.created_at",
|
||||
Select("s.id", "s.tenant_id", "s.title", "s.image", "s.description", "s.visits", "k.title AS kind_title", "s.created_at",
|
||||
"t.province", "t.city").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON s.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS k ON s.kind_id = k.id", model.NewServiceSolutionCaseKind().TableName())).
|
||||
|
@ -21,6 +21,6 @@ func (*Message) Launch(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := controller.NewMessage()().Form(form.Name, form.Mobile, form.Email, form.Company, form.Content)
|
||||
err := controller.NewMessage()(api.GetTenantID()(c).(uint64)).Form(form.Name, form.Mobile, form.Email, form.Company, form.Content)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -5,23 +5,28 @@ import (
|
||||
model2 "SciencesServer/app/common/model"
|
||||
)
|
||||
|
||||
type Message struct{}
|
||||
// Message 信息管理
|
||||
type Message struct {
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type MessageHandle func() *Message
|
||||
type MessageHandle func(tenantID uint64) *Message
|
||||
|
||||
// Form 留言发起
|
||||
func (c *Message) Form(name, mobile, email, company, content string) error {
|
||||
mServiceMessage := model.NewServiceMessage()
|
||||
mServiceMessage.TenantID = c.tenantID
|
||||
mServiceMessage.Name = name
|
||||
mServiceMessage.Mobile = mobile
|
||||
mServiceMessage.Email = email
|
||||
mServiceMessage.Company = company
|
||||
mServiceMessage.Content = content
|
||||
mServiceMessage.Status = model2.ServiceMessageStatusForProcessing
|
||||
return model2.Create(mServiceMessage.ServiceMessage)
|
||||
}
|
||||
|
||||
func NewMessage() MessageHandle {
|
||||
return func() *Message {
|
||||
return &Message{}
|
||||
return func(tenantID uint64) *Message {
|
||||
return &Message{tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ type synchronized struct {
|
||||
}
|
||||
|
||||
func (this *Instance) Handle() {
|
||||
fmt.Println("========================\n=== 数据开始迁移 ===\n========================")
|
||||
|
||||
db := this.gormDB
|
||||
|
||||
successCount, failureCount := 0, 0
|
||||
@ -136,17 +138,16 @@ func (this *Instance) Handle() {
|
||||
&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()}, &synchronized{iModel: model.NewServiceMessage()},
|
||||
&synchronized{iModel: model.NewServiceDocking()},
|
||||
&synchronized{iModel: model.NewServiceMessage()}, &synchronized{iModel: model.NewServiceMessageLog()},
|
||||
&synchronized{iModel: model.NewServiceSolutionCase()}, &synchronized{iModel: model.NewServiceSolutionCaseKind()},
|
||||
&synchronized{iModel: model.NewServiceInnovate()}, &synchronized{iModel: model.NewServiceInnovateKind()},
|
||||
// 活动管理
|
||||
&synchronized{iModel: model.NewActivityInstance()}, &synchronized{iModel: model.NewActivityApply()},
|
||||
&synchronized{iModel: model.NewActivityExamine()}, &synchronized{iModel: model.NewActivityJoin()},
|
||||
)
|
||||
fmt.Println("=== 数据开始迁移 ===")
|
||||
fmt.Printf("=== 成功【%d】 ===\n", successCount)
|
||||
fmt.Printf("=== 失败【%d】 ===\n", failureCount)
|
||||
fmt.Println("=== 数据完成迁移 ===")
|
||||
fmt.Printf("========================\n=== 数据完成迁移,成功【%d】,失败【%d】 ===\n========================\n",
|
||||
successCount, failureCount)
|
||||
}
|
||||
|
||||
func WithGormDBOption(db *gorm.DB) Option {
|
||||
|
@ -80,6 +80,13 @@ func (m *Model) GetEncodeID() string {
|
||||
return utils.HASHIDEncode(int(m.ID))
|
||||
}
|
||||
|
||||
func (m *ModelTenant) GetEncodeTenantID() string {
|
||||
if m.TenantID <= 0 {
|
||||
return ""
|
||||
}
|
||||
return utils.HASHIDEncode(int(m.TenantID))
|
||||
}
|
||||
|
||||
func (m *Model) SetDatabase(database string, key ...string) {
|
||||
m.Database = database + "_" + strings.Join(key, "_")
|
||||
}
|
||||
|
@ -3,12 +3,13 @@ package model
|
||||
// ServiceMessage 留言数据模型
|
||||
type ServiceMessage struct {
|
||||
Model
|
||||
ModelTenant
|
||||
Name string `gorm:"column:name;type:varchar(20);default:'';comment:联系人" json:"name"`
|
||||
Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"`
|
||||
Email string `gorm:"column:email;type:varchar(50);default:'';comment:邮箱" json:"email"`
|
||||
Company string `gorm:"column:company;type:varchar(100);default:'';comment:公司名称" json:"company"`
|
||||
Content string `gorm:"column:content;type:varchar(255);default:'';comment:联系内容" json:"content"`
|
||||
Status int `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
|
||||
Status ServiceMessageStatus `gorm:"column:status;type:tinyint(1);default:0;comment:状态" json:"status"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
@ -18,7 +19,7 @@ type ServiceMessageStatus int
|
||||
|
||||
const (
|
||||
// ServiceMessageStatusForProcessing 处理中
|
||||
ServiceMessageStatusForProcessing ServiceMessageStatus = iota
|
||||
ServiceMessageStatusForProcessing ServiceMessageStatus = iota + 1
|
||||
// ServiceMessageStatusForProcessed 已处理
|
||||
ServiceMessageStatusForProcessed
|
||||
)
|
||||
|
19
app/common/model/service_message_log.go
Normal file
19
app/common/model/service_message_log.go
Normal file
@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
// ServiceMessageLog 留言数据日志模型
|
||||
type ServiceMessageLog struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户ID" json:"-"`
|
||||
MessageID uint64 `gorm:"column:message_id;type:int(11);default:0;comment:信息ID" json:"-"`
|
||||
Content string `gorm:"column:content;type:varchar(255);default:'';comment:内容信息" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *ServiceMessageLog) TableName() string {
|
||||
return "service_message_log"
|
||||
}
|
||||
|
||||
func NewServiceMessageLog() *ServiceMessageLog {
|
||||
return &ServiceMessageLog{}
|
||||
}
|
@ -34,11 +34,11 @@ func (m *ServiceSolutionCaseKind) ModeTitle() string {
|
||||
if m.Mode == ServiceSolutionCaseModeForSmallCompany {
|
||||
return "中小型企业"
|
||||
} else if m.Mode == ServiceSolutionCaseModeForBigCompany {
|
||||
return "中小型企业"
|
||||
return "大型企业"
|
||||
} else if m.Mode == ServiceSolutionCaseModeForGovernment {
|
||||
|
||||
return "政府单位"
|
||||
} else if m.Mode == ServiceSolutionCaseModeForResearch {
|
||||
|
||||
return "科研机构"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"gopkg.in/yaml.v2"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@ -76,7 +77,12 @@ func run() {
|
||||
orm.WithSqliteOption(&logic.Sqlite{Path: _sqlite.Path, Name: _sqlite.Name}),
|
||||
).Init()
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
fmt.Println("========================\n=== 数据引擎创建成功 ===\n========================")
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
// 迁移数据
|
||||
migrate.NewInstance(migrate.WithGormDBOption(engine.Engine)).Handle()
|
||||
|
||||
@ -94,7 +100,9 @@ func run() {
|
||||
fmt.Errorf("数据初始化文件错误:%v", err)
|
||||
return
|
||||
}
|
||||
fmt.Println("========================\n=== 数据初始化成功 ===\n========================")
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
fmt.Println("========================\n=== 数据初始化完成 ===\n========================")
|
||||
}
|
||||
|
||||
func saveFile(_file string, data *Config) error {
|
||||
|
@ -263,6 +263,8 @@ func registerAdminAPI(app *gin.Engine) {
|
||||
service.POST("/solution_case/kind/add", _api.SolutionCaseKindForm)
|
||||
service.POST("/solution_case/kind/edit", _api.SolutionCaseKindForm)
|
||||
service.POST("/solution_case/kind/delete", _api.SolutionCaseKindDelete)
|
||||
service.POST("/message", _api.Message)
|
||||
service.POST("/message/handle", _api.MessageHandle)
|
||||
}
|
||||
// Logs 日志管理
|
||||
log := v1.Group("/log")
|
||||
|
Reference in New Issue
Block a user