feat:完善项目
This commit is contained in:
@ -33,7 +33,7 @@ type (
|
||||
)
|
||||
|
||||
// Instance 活动信息
|
||||
func (c *Activity) Instance(title string, mode, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
func (c *Activity) Instance(title string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mActivityInstance := model.NewActivityInstance()
|
||||
|
||||
var count int64
|
||||
@ -43,10 +43,8 @@ func (c *Activity) Instance(title string, mode, page, pageSize int) (*controller
|
||||
if title != "" {
|
||||
where = append(where, model2.NewWhereLike("a.title", title))
|
||||
}
|
||||
if mode > 0 {
|
||||
where = append(where, model2.NewWhere("a.mode", mode))
|
||||
}
|
||||
out, err := mActivityInstance.Activity(c.UID, c.SelectIdentity, page, pageSize, &count)
|
||||
|
||||
out, err := mActivityInstance.Activity(c.UID, c.SelectIdentity, page, pageSize, &count, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -71,6 +69,8 @@ func (c *Activity) Detail(id uint64) (*ActivityDetail, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mActivityInstance.Image.Image = mActivityInstance.Image.Analysis(config.SettingInfo.Domain)
|
||||
|
||||
return &ActivityDetail{
|
||||
ID: out.GetEncodeID(),
|
||||
ActivityInstanceDetail: out,
|
||||
@ -82,7 +82,7 @@ func (c *Activity) Detail(id uint64) (*ActivityDetail, error) {
|
||||
func (c *Activity) Join(id uint64) error {
|
||||
mActivityInstance := model.NewActivityInstance()
|
||||
|
||||
isExist, err := model2.FirstField(mActivityInstance.ActivityInstance, []string{"id", "mode", "join_deadline"},
|
||||
isExist, err := model2.FirstField(mActivityInstance.ActivityInstance, []string{"id", "amount", "join_deadline"},
|
||||
model2.NewWhere("id", id), model2.NewWhere("tenant_id", c.tenantID),
|
||||
model2.NewWhere("status", model2.ActivityInstanceStatusForShow))
|
||||
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"SciencesServer/app/api/admin/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type Config struct{ *session.Enterprise }
|
||||
@ -11,24 +12,29 @@ type Config struct{ *session.Enterprise }
|
||||
type ConfigHandle func(session *session.Enterprise) *Config
|
||||
|
||||
type (
|
||||
// ConfigInfo 配置信息
|
||||
ConfigInfo struct {
|
||||
Kind int `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
)
|
||||
|
||||
func (c *Config) Instance(kind int) ([]*ConfigInfo, error) {
|
||||
func (c *Config) Instance(kind int, key string) (*ConfigInfo, error) {
|
||||
mSysConfig := model.NewSysConfig()
|
||||
|
||||
out := make([]*ConfigInfo, 0)
|
||||
where := []*model2.ModelWhere{model2.NewWhere("`key`", key)}
|
||||
|
||||
if err := model2.ScanFields(mSysConfig.SysConfig, &out, []string{"kind", "name", "`key`", "`value`"},
|
||||
&model2.ModelWhereOrder{Where: model2.NewWhere("kind", kind)}); err != nil {
|
||||
return nil, err
|
||||
if kind > 0 {
|
||||
where = append(where, model2.NewWhere("kind", kind))
|
||||
}
|
||||
return out, nil
|
||||
isExist, err := model2.FirstField(mSysConfig.SysConfig, []string{"id", "name", "`value`"}, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !isExist {
|
||||
return nil, errors.New("操作错误,数据不存在或已被删除")
|
||||
}
|
||||
return &ConfigInfo{Name: mSysConfig.Name, Value: mSysConfig.Value}, nil
|
||||
}
|
||||
|
||||
func NewConfig() ConfigHandle {
|
||||
|
@ -309,43 +309,7 @@ func (c *Index) DistributionCompany(province, city string) (map[string]*Instance
|
||||
}
|
||||
_out := c.distribution(out)
|
||||
c.filter(_out)
|
||||
_out["230000"] = &InstanceDistributionDetailInfo{
|
||||
Code: "230000",
|
||||
Name: "黑龙江",
|
||||
Count: 6000,
|
||||
Industry: nil,
|
||||
Children: map[string]*InstanceDistributionDetailInfo{
|
||||
"230100": &InstanceDistributionDetailInfo{
|
||||
Code: "230100",
|
||||
Name: "哈尔滨市",
|
||||
Count: 3000,
|
||||
Industry: nil,
|
||||
Children: nil,
|
||||
},
|
||||
"230200": &InstanceDistributionDetailInfo{
|
||||
Code: "230200",
|
||||
Name: "齐齐哈尔市",
|
||||
Count: 3000,
|
||||
Industry: nil,
|
||||
Children: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
_out["330000"] = &InstanceDistributionDetailInfo{
|
||||
Code: "330000",
|
||||
Name: "浙江省",
|
||||
Count: 5000,
|
||||
Industry: nil,
|
||||
Children: map[string]*InstanceDistributionDetailInfo{
|
||||
"330100": &InstanceDistributionDetailInfo{
|
||||
Code: "330100",
|
||||
Name: "杭州市",
|
||||
Count: 5000,
|
||||
Industry: nil,
|
||||
Children: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return _out, nil
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,13 @@ type SolutionCaseHandle func(session *session.Enterprise, tenantID uint64) *Solu
|
||||
type (
|
||||
// SolutionCaseInfo 基本信息
|
||||
SolutionCaseInfo struct {
|
||||
ID string `json:"id"`
|
||||
MarkID uint64 `json:"-"`
|
||||
Mode model2.ServiceSolutionCaseMode `json:"mode"`
|
||||
Title string `json:"title"`
|
||||
Image string `json:"image"`
|
||||
Children []*SolutionCaseBasic `json:"children"`
|
||||
ID string `json:"id"`
|
||||
MarkID uint64 `json:"-"`
|
||||
Mode model2.ServiceSolutionCaseMode `json:"mode"`
|
||||
Title string `json:"title"`
|
||||
Image string `json:"image"`
|
||||
Description string `json:"description"`
|
||||
Children []*SolutionCaseBasic `json:"children"`
|
||||
}
|
||||
// SolutionCaseBasic 基本信息
|
||||
SolutionCaseBasic struct {
|
||||
@ -46,9 +47,12 @@ type (
|
||||
)
|
||||
|
||||
// Instance 服务解决方案案例
|
||||
func (c *SolutionCase) Instance() ([]*SolutionCaseInfo, error) {
|
||||
func (c *SolutionCase) Instance(mode int) ([]*SolutionCaseInfo, error) {
|
||||
mServiceSolutionCase := model.NewServiceSolutionCase()
|
||||
out, err := mServiceSolutionCase.SolutionCase(6)
|
||||
|
||||
where := []*model2.ModelWhere{model2.NewWhere("k.mode", mode)} //model2.NewWhere("k.tenant_id", c.tenantID),
|
||||
|
||||
out, err := mServiceSolutionCase.SolutionCase(6, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -73,8 +77,9 @@ func (c *SolutionCase) Instance() ([]*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),
|
||||
Children: []*SolutionCaseBasic{detail},
|
||||
Image: v.Image.Analysis(config.SettingInfo.Domain),
|
||||
Description: v.Description,
|
||||
Children: []*SolutionCaseBasic{detail},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
40
app/api/website/controller/sys/banner.go
Normal file
40
app/api/website/controller/sys/banner.go
Normal file
@ -0,0 +1,40 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
||||
"SciencesServer/config"
|
||||
)
|
||||
|
||||
type Banner struct {
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type BannerHandle func(tenantID uint64) *Banner
|
||||
|
||||
type BannerInfo struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
IsMultiple int `json:"is_multiple"`
|
||||
Images string `json:"images"`
|
||||
}
|
||||
|
||||
func (c *Banner) Instance(key string) (*BannerInfo, error) {
|
||||
mSysBanner := model.NewSysBanner()
|
||||
if err := mSysBanner.Get(c.tenantID, map[string]interface{}{
|
||||
"key": key, "local": key,
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &BannerInfo{
|
||||
ID: mSysBanner.GetEncodeID(),
|
||||
Title: mSysBanner.Title,
|
||||
IsMultiple: mSysBanner.IsMultiple,
|
||||
Images: mSysBanner.Images.AnalysisSlice(config.SettingInfo.Domain),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewBanner() BannerHandle {
|
||||
return func(tenantID uint64) *Banner {
|
||||
return &Banner{tenantID: tenantID}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package controller
|
||||
package sys
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/model"
|
Reference in New Issue
Block a user