feat:完善项目
This commit is contained in:
@ -20,10 +20,11 @@ type InnovateHandle func(session *session.Enterprise, tenantID uint64) *Innovate
|
||||
type (
|
||||
// InnovateInfo 创新服务信息
|
||||
InnovateInfo struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Tags []string `json:"tags"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Tags []string `json:"tags"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
// InnovateKindInfo 创新服务分类信息
|
||||
InnovateKindInfo struct {
|
||||
@ -39,7 +40,7 @@ type (
|
||||
)
|
||||
|
||||
// Instance 首页信息
|
||||
func (c *Innovate) Instance(kind uint64, title string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
func (c *Innovate) Instance(kindID uint64, title string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mServiceInnovate := model.NewServiceInnovate()
|
||||
|
||||
out := make([]*model2.ServiceInnovate, 0)
|
||||
@ -48,14 +49,14 @@ func (c *Innovate) Instance(kind uint64, title string, page, pageSize int) (*con
|
||||
|
||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{Order: model2.NewOrder("id", model2.OrderModeToDesc)}}
|
||||
|
||||
if kind > 0 {
|
||||
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhere("kind", kind)})
|
||||
if kindID > 0 {
|
||||
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhere("kind_id", kindID)})
|
||||
}
|
||||
if title != "" {
|
||||
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhereLike("title", title)})
|
||||
}
|
||||
|
||||
if err := model2.PagesFields(mServiceInnovate.ServiceInnovate, &out, []string{"id", "title", "tag", "created_at"}, page, pageSize,
|
||||
if err := model2.PagesFields(mServiceInnovate.ServiceInnovate, &out, []string{"id", "title", "description", "tag", "created_at"}, page, pageSize,
|
||||
&count, where...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -63,7 +64,8 @@ func (c *Innovate) Instance(kind uint64, title string, page, pageSize int) (*con
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &InnovateInfo{
|
||||
ID: v.GetEncodeID(), Title: v.Title, Tags: v.GetTagAttribute(), CreatedAt: v.CreatedAt,
|
||||
ID: v.GetEncodeID(), Title: v.Title, Description: v.Description, Tags: v.GetTagAttribute(),
|
||||
CreatedAt: v.CreatedAt,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
|
@ -64,7 +64,7 @@ func (c *SolutionCase) Instance(mode int) ([]*SolutionCaseInfo, error) {
|
||||
|
||||
detail := &SolutionCaseBasic{
|
||||
ID: (&model2.Model{ID: v.DetailID}).GetEncodeID(), Title: v.DetailTitle,
|
||||
Image: (&model2.Image{Image: v.DetailImage}).Analysis(config.SettingInfo.Domain),
|
||||
Image: (&model2.Image{Image: v.DetailImage}).Analysis(config.SystemConfig[config.SysImageDomain]),
|
||||
Description: v.DetailDescription,
|
||||
}
|
||||
for _, val := range ret {
|
||||
@ -77,7 +77,7 @@ func (c *SolutionCase) Instance(mode int) ([]*SolutionCaseInfo, error) {
|
||||
if !isExist {
|
||||
ret = append(ret, &SolutionCaseInfo{
|
||||
ID: v.GetEncodeID(), MarkID: v.ID, Mode: v.Mode, Title: v.Title,
|
||||
Image: v.Image.Analysis(config.SettingInfo.Domain),
|
||||
Image: v.Image.Analysis(config.SystemConfig[config.SysImageDomain]),
|
||||
Description: v.Description,
|
||||
Children: []*SolutionCaseBasic{detail},
|
||||
})
|
||||
@ -109,7 +109,7 @@ func (c *SolutionCase) List(kindID uint64, page, pageSize int) (*controller.Retu
|
||||
for _, v := range out {
|
||||
list = append(list, &SolutionCaseBasic{
|
||||
ID: v.GetEncodeID(), Title: v.Title,
|
||||
Image: v.Image.Analysis(config.SettingInfo.Domain),
|
||||
Image: v.Image.Analysis(config.SystemConfig[config.SysImageDomain]),
|
||||
Description: v.Description,
|
||||
})
|
||||
}
|
||||
@ -135,7 +135,7 @@ func (c *SolutionCase) Detail(id uint64) (*SolutionCaseDetail, error) {
|
||||
SolutionCaseBasic: SolutionCaseBasic{
|
||||
ID: mServiceSolutionCase.GetEncodeID(),
|
||||
Title: mServiceSolutionCase.Title,
|
||||
Image: mServiceSolutionCase.Image.Analysis(config.SettingInfo.Domain),
|
||||
Image: mServiceSolutionCase.Image.Analysis(config.SystemConfig[config.SysImageDomain]),
|
||||
Description: mServiceSolutionCase.Description,
|
||||
},
|
||||
Visits: mServiceSolutionCase.Visits,
|
||||
|
Reference in New Issue
Block a user