feat:完善项目信息
This commit is contained in:
@ -88,6 +88,7 @@ func (*Activity) Delete(c *gin.Context) {
|
||||
func (*Activity) Joins(c *gin.Context) {
|
||||
form := &struct {
|
||||
ActivityID string `json:"activity_id" form:"activity_id" binding:"required"`
|
||||
Name string `json:"name" form:"name"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
@ -95,7 +96,7 @@ func (*Activity) Joins(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
data, err := activity.NewInstance()(api.GetSession()(c).(*session.Admin)).Joins(
|
||||
(&api.IDStringForm{ID: form.ActivityID}).Convert(), form.Page, form.PageSize)
|
||||
(&api.IDStringForm{ID: form.ActivityID}).Convert(), form.Name, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,56 @@ import (
|
||||
|
||||
type Sys struct{}
|
||||
|
||||
func (*Sys) Banner(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.TenantIDStringForm
|
||||
Title string `json:"title" form:"title"`
|
||||
Local string `json:"local" form:"local"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := sys.NewBanner()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert(), form.Title, form.Local,
|
||||
form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Sys) BannerForm(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
api.TenantIDStringForm
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
Local string `json:"local" form:"local" binding:"required"`
|
||||
Size string `json:"size" form:"size" binding:"required"`
|
||||
Remark string `json:"remark" form:"remark"`
|
||||
IsMultiple int `json:"is_multiple" form:"is_multiple"`
|
||||
api.ImagesForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := sys.NewBanner()(api.GetSession()(c).(*session.Admin)).Form(&sys.BannerParams{
|
||||
ID: form.IDStringForm.Convert(), TenantID: form.IDStringForm.Convert(),
|
||||
Title: form.Title, Local: form.Local, Size: form.Size, Remark: form.Remark, Images: form.FilterImageURL(),
|
||||
IsMultiple: form.IsMultiple,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Sys) BannerDelete(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := sys.NewBanner()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Sys) Industry(c *gin.Context) {
|
||||
data, err := sys.NewIndustry()(api.GetSession()(c).(*session.Admin)).Instance()
|
||||
api.APIResponse(err, data)(c)
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
@ -62,6 +63,7 @@ func (c *Apply) Instance(tenantID uint64, title, contact string, page, pageSize
|
||||
list := make([]*ApplyInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
v.Image.Image = v.Analysis(config.SettingInfo.Domain)
|
||||
list = append(list, &ApplyInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
TenantID: v.GetEncodeTenantID(),
|
||||
@ -80,6 +82,8 @@ func (c *Apply) Detail(id uint64) (*ApplyDetailInfo, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out.Image.Image = out.Analysis(config.SettingInfo.Domain)
|
||||
|
||||
return &ApplyDetailInfo{
|
||||
ID: out.GetEncodeID(),
|
||||
TenantID: out.GetEncodeTenantID(),
|
||||
@ -114,6 +118,7 @@ func (c *Apply) Handle(id uint64, remark string) error {
|
||||
return err
|
||||
}
|
||||
mActivityApplyLog := model.NewActivityApplyLog()
|
||||
mActivityApplyLog.UID = c.UID
|
||||
mActivityApplyLog.ApplyID = mActivityApply.ID
|
||||
mActivityApplyLog.Remark = remark
|
||||
return model2.Create(mActivityApplyLog.ActivityApplyLog, tx)
|
||||
|
@ -91,7 +91,7 @@ func (c *Instance) Index(tenantID uint64, title, contact, contactMobile string,
|
||||
_industry := make([]string, 0)
|
||||
|
||||
for _, v := range v.GetIndustryAttribute() {
|
||||
_industry = append(_industry, config.GetIndustryInfo(v, "-"))
|
||||
_industry = append(_industry, config.GetIndustryInfo(v, "-", "/"))
|
||||
}
|
||||
list = append(list, &InstanceInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
@ -226,11 +226,17 @@ func (c *Instance) Delete(id uint64) error {
|
||||
return model2.Delete(mActivityInstance.ActivityInstance)
|
||||
}
|
||||
|
||||
func (c *Instance) Joins(activityID uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
func (c *Instance) Joins(activityID uint64, name string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mActivityJoin := model.NewActivityJoin()
|
||||
|
||||
where := []*model2.ModelWhere{model2.NewWhere("j.activity_id", activityID)}
|
||||
|
||||
if name != "" {
|
||||
where = append(where, model2.NewWhereLike("u_i.name", name))
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mActivityJoin.Join(page, pageSize, &count, model2.NewWhere("j.activity_id", activityID))
|
||||
out, err := mActivityJoin.Join(page, pageSize, &count, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -68,7 +68,7 @@ func (c *Instance) Expert(name string, status int, page, pageSize int) (*control
|
||||
industry := make([]string, 0)
|
||||
|
||||
for _, v := range strings.Split(v.Industry, ";") {
|
||||
industry = append(industry, config.GetIndustryInfo(v, "-"))
|
||||
industry = append(industry, config.GetIndustryInfo(v, "-", "/"))
|
||||
}
|
||||
// 研究机构,实验室
|
||||
researchName := v.LaboratoryName
|
||||
|
221
app/api/admin/controller/sys/banner.go
Normal file
221
app/api/admin/controller/sys/banner.go
Normal file
@ -0,0 +1,221 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/admin/model"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Banner struct {
|
||||
*session.Admin
|
||||
}
|
||||
|
||||
type BannerHandle func(session *session.Admin) *Banner
|
||||
|
||||
type (
|
||||
// BannerInfo 轮播图信息
|
||||
BannerInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.SysBanner
|
||||
Area string `json:"area"`
|
||||
Images []string `json:"images"`
|
||||
}
|
||||
// BannerLocalInfo 轮播图位置信息
|
||||
BannerLocalInfo struct {
|
||||
Title string `json:"title"`
|
||||
Children []*BannerLocalInfo `json:"children"`
|
||||
}
|
||||
// BannerMarkLocalInfo 轮播图临时位置信息
|
||||
BannerMarkLocalInfo struct {
|
||||
Title string `json:"title"`
|
||||
Children []string `json:"children"`
|
||||
}
|
||||
// BannerParams 轮播图参数信息
|
||||
BannerParams struct {
|
||||
ID, TenantID uint64
|
||||
Title, Local, Size, Remark string
|
||||
Images []string
|
||||
IsMultiple int
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
defaultFirstLevelKey string = "+home"
|
||||
)
|
||||
|
||||
// tree 树状
|
||||
func (c *Banner) tree(src map[string][]string, key string) []*BannerLocalInfo {
|
||||
out := make([]*BannerLocalInfo, 0)
|
||||
|
||||
data, has := src[key]
|
||||
|
||||
if !has {
|
||||
return nil
|
||||
}
|
||||
for _, v := range data {
|
||||
out = append(out, &BannerLocalInfo{
|
||||
Title: v,
|
||||
Children: c.tree(src, v),
|
||||
})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// merge 合并
|
||||
func (c *Banner) merge(obj, parentObj string, out map[string][]string) {
|
||||
if _, has := out[parentObj]; !has {
|
||||
out[parentObj] = []string{obj}
|
||||
return
|
||||
}
|
||||
if !utils.InArray(obj, out[parentObj]) {
|
||||
out[parentObj] = append(out[parentObj], obj)
|
||||
}
|
||||
}
|
||||
|
||||
// filter 筛选
|
||||
func (c *Banner) filter(src []string, sep string) map[string][]string {
|
||||
// 解决方案>中小型企业
|
||||
// 解决方案>政府区域
|
||||
out := make(map[string][]string, 0)
|
||||
|
||||
for _, v := range src {
|
||||
objs := strings.Split(v, sep)
|
||||
|
||||
for i := 0; i < len(objs); i++ {
|
||||
parent := defaultFirstLevelKey
|
||||
|
||||
if i > 0 {
|
||||
parent = objs[i-1]
|
||||
}
|
||||
c.merge(objs[i], parent, out)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Instance 列表信息
|
||||
func (c *Banner) Instance(tenantID uint64, title, local string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mSysBanner := model.NewSysBanner()
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if c.TenantID > 0 {
|
||||
where = append(where, model2.NewWhere("b.tenant_id", c.TenantID))
|
||||
}
|
||||
if tenantID > 0 {
|
||||
where = append(where, model2.NewWhere("b.tenant_id", tenantID))
|
||||
}
|
||||
if title != "" {
|
||||
where = append(where, model2.NewWhereLike("b.title", title))
|
||||
}
|
||||
if local != "" {
|
||||
where = append(where, model2.NewWhereLike("b.local", local))
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mSysBanner.Banner(page, pageSize, &count, where...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*BannerInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &BannerInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
SysBanner: v.SysBanner,
|
||||
Area: v.FormatBasic(),
|
||||
Images: v.Images.AnalysisSlice(config.SettingInfo.Domain),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
||||
// Form 数据操作
|
||||
func (c *Banner) Form(params *BannerParams) error {
|
||||
mSysBanner := model.NewSysBanner()
|
||||
|
||||
if params.ID > 0 {
|
||||
mSysBanner.ID = params.ID
|
||||
|
||||
isExist, err := model2.FirstField(mSysBanner.SysBanner, []string{"id", "tenant_id", "created_at"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,轮播图信息不存在或已被删除")
|
||||
}
|
||||
if c.TenantID > 0 && c.TenantID != mSysBanner.TenantID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
}
|
||||
mSysBanner.Title = params.Title
|
||||
mSysBanner.Local = params.Local
|
||||
mSysBanner.Images.SetImagesAttribute(params.Images)
|
||||
mSysBanner.Size = params.Size
|
||||
mSysBanner.IsMultiple = params.IsMultiple
|
||||
mSysBanner.Remark = params.Remark
|
||||
|
||||
if mSysBanner.ID > 0 {
|
||||
if c.TenantID <= 0 {
|
||||
mSysBanner.TenantID = params.TenantID
|
||||
}
|
||||
return model2.Updates(mSysBanner.SysBanner, mSysBanner.SysBanner)
|
||||
}
|
||||
mSysBanner.TenantID = params.TenantID
|
||||
|
||||
if c.TenantID > 0 {
|
||||
mSysBanner.TenantID = c.TenantID
|
||||
}
|
||||
return model2.Create(mSysBanner.SysBanner)
|
||||
}
|
||||
|
||||
// Local 位置信息
|
||||
func (c *Banner) Local(tenantID uint64) ([]*BannerLocalInfo, error) {
|
||||
mSysBanner := model.NewSysBanner()
|
||||
|
||||
out := make([]string, 0)
|
||||
|
||||
where := make([]*model2.ModelWhere, 0)
|
||||
|
||||
if tenantID > 0 {
|
||||
where = append(where, model2.NewWhere("tenant_id", tenantID))
|
||||
} else {
|
||||
where = append(where, model2.NewWhere("tenant_id", c.TenantID))
|
||||
}
|
||||
if err := model2.Pluck(mSysBanner.SysBanner, "local", &out, where...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c.filter(out, ">")
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Delete 删除操作
|
||||
func (c *Banner) Delete(id uint64) error {
|
||||
mSysBanner := model.NewSysBanner()
|
||||
mSysBanner.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mSysBanner.SysBanner, []string{"id", "tenant_id"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,轮播图信息不存在或已被删除")
|
||||
} else if c.TenantID > 0 && mSysBanner.TenantID != c.TenantID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
return model2.Delete(mSysBanner.SysBanner)
|
||||
}
|
||||
|
||||
func NewBanner() BannerHandle {
|
||||
return func(session *session.Admin) *Banner {
|
||||
return &Banner{session}
|
||||
}
|
||||
}
|
22
app/api/admin/controller/sys/banner_test.go
Normal file
22
app/api/admin/controller/sys/banner_test.go
Normal file
@ -0,0 +1,22 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"SciencesServer/utils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewBanner(t *testing.T) {
|
||||
banner := new(Banner)
|
||||
out := []string{
|
||||
"首页banner",
|
||||
"登录注册",
|
||||
"解决方案>中小型企业",
|
||||
"解决方案>大型企业",
|
||||
"找专家>专家列表",
|
||||
"找专家>专家列表1",
|
||||
"找专家>专家列表>专家详情",
|
||||
}
|
||||
_out := banner.filter(out, ">")
|
||||
t.Log(_out)
|
||||
t.Log(utils.AnyToJSON(banner.tree(_out, defaultFirstLevelKey)))
|
||||
}
|
@ -20,6 +20,7 @@ type (
|
||||
TenantID string `json:"tenant_id"`
|
||||
ParentID string `json:"parent_id"`
|
||||
*model2.SysNavigation
|
||||
Area string `json:"area"`
|
||||
Children []*NavigationInfo `json:"children"`
|
||||
}
|
||||
// NavigationParams 导航参数信息
|
||||
@ -40,6 +41,7 @@ func (c *Navigation) tree(src []*model.SysNavigationInfo, parentID uint64) []*Na
|
||||
TenantID: v.GetEncodeTenantID(),
|
||||
ParentID: (&model2.Model{ID: parentID}).GetEncodeID(),
|
||||
SysNavigation: v.SysNavigation,
|
||||
Area: v.FormatBasic(),
|
||||
Children: c.tree(src, v.ID),
|
||||
})
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ type (
|
||||
*model.ActivityApply
|
||||
Username string `json:"username"`
|
||||
model.Area
|
||||
HandleUsername string `json:"handle_name"`
|
||||
Handler string `json:"handler"`
|
||||
HandleRemark string `json:"handle_remark"`
|
||||
HandleCreatedAt time.Time `json:"handle_created_at"`
|
||||
}
|
||||
@ -28,11 +28,10 @@ func (m *ActivityApply) Apply(page, pageSize int, count *int64, where ...*model.
|
||||
db := orm.GetDB().Table(m.TableName()+" AS a").
|
||||
Select("a.id", "a.tenant_id", "a.identity", "a.image", "a.title", "a.contact", "a.contact_mobile", "a.begin_at",
|
||||
"a.finish_at", "a.amount", "a.max_number", "a.status", "a.created_at",
|
||||
"t.province", "t.city", "l.name AS handle_name", "l.remark AS handle_remark", "l.created_at AS handle_created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u ON a.uid = u.uuid", model.NewUserInstance().TableName())).
|
||||
"t.province", "t.city", "l.name AS handler", "l.remark AS handle_remark", "l.created_at AS handle_created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON a.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT a.apply_id, MAX(a.id) AS id, MAX(a.created_at) AS created_at, MAX(a.remark) AS remark "+
|
||||
"MAX(u.`name`) AS name FROM %s AS a LEFT JOIN %s ON a.uid = u.uuid WHERE a.is_deleted = %d GROUP BY a.apply_id) AS l ON a.id = l.apply_id",
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT a.apply_id, MAX(a.id) AS id, MAX(a.created_at) AS created_at, MAX(a.remark) AS remark, "+
|
||||
"MAX(u.`name`) AS name FROM %s AS a LEFT JOIN %s AS u ON a.uid = u.uuid WHERE a.is_deleted = %d GROUP BY a.apply_id) AS l ON a.id = l.apply_id",
|
||||
model.NewActivityApplyLog().TableName(), model.NewSysUser().TableName(), model.DeleteStatusForNot)).
|
||||
Where("a.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
|
@ -22,7 +22,7 @@ type ActivityJoinInfo struct {
|
||||
func (m *ActivityJoin) Join(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ActivityJoinInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS j").
|
||||
Select("j.id", "j.identity", "u_i.name", "u.mobile", "j.created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_i ON j.uid = u_i.uuid AND j.identity = u_i.identity", model.NewUserIdentity().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_i ON j.uid = u_i.uid AND j.identity = u_i.identity", model.NewUserIdentity().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u ON j.uid = u.uuid", model.NewUserInstance().TableName())).
|
||||
Where("j.is_deleted = ?", model.DeleteStatusForNot).
|
||||
Where("j.status = ?", model.ActivityJoinStatusForSuccess)
|
||||
|
44
app/api/admin/model/sys_banner.go
Normal file
44
app/api/admin/model/sys_banner.go
Normal file
@ -0,0 +1,44 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type SysBanner struct {
|
||||
*model.SysBanner
|
||||
}
|
||||
|
||||
// SysBannerInfo 轮播图信息
|
||||
type SysBannerInfo struct {
|
||||
*model.SysBanner
|
||||
model.Area
|
||||
}
|
||||
|
||||
// Banner 轮播图信息
|
||||
func (m *SysBanner) Banner(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*SysBannerInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS b").
|
||||
Select("b.*", "t.province", "t.city").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON b.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Where("b.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, wo := range where {
|
||||
db = db.Where(wo.Condition, wo.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*SysBannerInfo, 0)
|
||||
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := db.Order("b.id " + model.OrderModeToDesc).Offset((page - 1) * pageSize).Limit(pageSize).Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewSysBanner() *SysBanner {
|
||||
return &SysBanner{model.NewSysBanner()}
|
||||
}
|
@ -48,6 +48,17 @@ func (this *ImageForm) FilterImageURL() string {
|
||||
return strings.Replace(this.Image, config.SettingInfo.Domain, "", -1)
|
||||
}
|
||||
|
||||
type ImagesForm struct {
|
||||
Images []string `json:"images" form:"images"`
|
||||
}
|
||||
|
||||
func (this *ImagesForm) FilterImageURL() []string {
|
||||
for _, v := range this.Images {
|
||||
v = strings.Replace(v, config.SettingInfo.Domain, "", -1)
|
||||
}
|
||||
return this.Images
|
||||
}
|
||||
|
||||
type FileForm struct {
|
||||
File string `json:"file" form:"file"`
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ var (
|
||||
)
|
||||
|
||||
// GetIndustryInfo 获取行业信息
|
||||
func GetIndustryInfo(industry, mark string) string {
|
||||
func GetIndustryInfo(industry, mark, sep string) string {
|
||||
obj := strings.Split(industry, mark)
|
||||
out := make([]string, 0)
|
||||
|
||||
@ -31,5 +31,5 @@ func GetIndustryInfo(industry, mark string) string {
|
||||
}
|
||||
out = append(out, data)
|
||||
}
|
||||
return strings.Join(out, "-")
|
||||
return strings.Join(out, sep)
|
||||
}
|
||||
|
@ -122,6 +122,7 @@ func (this *Instance) Handle() {
|
||||
}},
|
||||
&synchronized{iModel: model.NewSysNavigation()},
|
||||
&synchronized{iModel: model.NewSysAbout()},
|
||||
&synchronized{iModel: model.NewSysBanner()},
|
||||
// 日志管理
|
||||
&synchronized{iModel: model.NewSysLog()}, &synchronized{iModel: model.NewSysUserLoginLog()},
|
||||
// 用户管理
|
||||
|
@ -5,7 +5,7 @@ type ActivityApply struct {
|
||||
Model
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Identity int `gorm:"column:identity;type:tinyint(3);default:0;comment:身份信息" json:"-"`
|
||||
Identity int `gorm:"column:identity;type:tinyint(3);default:0;comment:身份信息" json:"identity"`
|
||||
ActivityInstanceBasic
|
||||
Contact string `gorm:"column:contact;type:varchar(20);default:'';comment:联系人" json:"contact"`
|
||||
ContactMobile string `gorm:"column:contact_mobile;type:varchar(15);default:'';comment:联系方式" json:"contact_mobile"`
|
||||
@ -15,7 +15,7 @@ type ActivityApply struct {
|
||||
MaxNumber int `gorm:"column:max_number;type:int(6);default:0;comment:报名限制人数,0不做限制" json:"max_number"`
|
||||
Address string `gorm:"column:address;type:varchar(255);default:'';comment:活动地址" json:"address"`
|
||||
NotifyCrowd int `gorm:"column:notify_crowd;type:tinyint(3);default:0;comment:通知人群" json:"notify_crowd"`
|
||||
Status ActivityApplyStatus `gorm:"column:status;type:tinyint(1);default:0;comment:审核状态" json:"status"`
|
||||
Status ActivityApplyStatus `gorm:"column:status;type:tinyint(1);default:0;comment:审状态" json:"status"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
config2 "SciencesServer/app/basic/config"
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/utils"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@ -55,6 +56,11 @@ func (m *Images) AnalysisSlice(domain string) []string {
|
||||
return images
|
||||
}
|
||||
|
||||
func (m *Images) SetImagesAttribute(value []string) {
|
||||
_bytes, _ := json.Marshal(value)
|
||||
m.Images = string(_bytes)
|
||||
}
|
||||
|
||||
type Local struct {
|
||||
Local string `gorm:"column:local;type:varchar(8);default:'';comment:数据位置来源" json:"-"`
|
||||
}
|
||||
|
@ -1,7 +1,16 @@
|
||||
package model
|
||||
|
||||
// SysBanner Banner数据管理模型
|
||||
type SysBanner struct {
|
||||
Model
|
||||
ModelTenant
|
||||
Title string `gorm:"column:title;type:varchar(255);default:'';comment:名称标题" json:"title"`
|
||||
Local string `gorm:"column:local;type:varchar(255);default:'';comment:所在位置" json:"local"`
|
||||
Key string `gorm:"column:key;type:varchar(100);default:'';comment:不做参考,页面唯一标识" json:"key"`
|
||||
Images
|
||||
Size string `gorm:"column:size;type:varchar(15);default:'';comment:图片尺寸" json:"size"`
|
||||
IsMultiple int `gorm:"column:is_multiple;type:tinyint(1);default:0;comment:是否多图" json:"is_multiple"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注" json:"remark"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -176,6 +176,10 @@ func registerAdminAPI(app *gin.Engine) {
|
||||
{
|
||||
_api := new(api1.Sys)
|
||||
// 导航信息
|
||||
sys.POST("/banner", _api.Banner)
|
||||
sys.POST("/banner/add", _api.NavigationForm)
|
||||
sys.POST("/banner/edit", _api.NavigationForm)
|
||||
sys.POST("/banner/delete", _api.NavigationDelete)
|
||||
sys.GET("/industry", _api.Industry)
|
||||
sys.POST("/industry/add", _api.NavigationForm)
|
||||
sys.POST("/industry/edit", _api.NavigationForm)
|
||||
|
Reference in New Issue
Block a user