熊哥提交

This commit is contained in:
henry
2022-02-23 15:18:55 +08:00
parent dcb5948e91
commit 84dd9d1ea8
13 changed files with 125 additions and 61 deletions

View File

@ -26,8 +26,9 @@ type (
ActivityInfo struct {
ID string `json:"id"`
*model.ActivityInstanceInfo
IsJoin bool `json:"is_join"`
Status int `json:"status"` // 状态1未开始2进行中3已结束
Amount float64 `json:"amount"`
IsJoin bool `json:"is_join"`
Status int `json:"status"` // 状态1未开始2进行中3已结束
}
// ActivityDetail 详细信息
ActivityDetail struct {
@ -76,7 +77,7 @@ func (c *Activity) Instance(title, industry string, status, page, pageSize int)
v.Image.Image = v.Image.Analysis(config.SystemConfig[config.SysImageDomain])
data := &ActivityInfo{
ID: v.GetEncodeID(), ActivityInstanceInfo: v, IsJoin: v.JoinID > 0, Status: 2,
ID: v.GetEncodeID(), Amount: v.Amount, ActivityInstanceInfo: v, IsJoin: v.JoinID > 0, Status: 2,
}
if now.Before(v.BeginAt) {
data.Status = 1

View File

@ -4,7 +4,6 @@ import (
"SciencesServer/app/api/admin/model"
model2 "SciencesServer/app/common/model"
"SciencesServer/app/session"
"errors"
)
type Config struct{ *session.Enterprise }
@ -19,22 +18,36 @@ type (
}
)
func (c *Config) Instance(kind int, key string) (*ConfigInfo, error) {
func (c *Config) Instance(kind int, key []string) (map[string]*ConfigInfo, error) {
mSysConfig := model.NewSysConfig()
where := []*model2.ModelWhere{model2.NewWhere("`key`", key)}
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
Where: model2.NewWhereIn("`key`", key),
Order: nil,
}}
if kind > 0 {
where = append(where, model2.NewWhere("kind", kind))
where = append(where, &model2.ModelWhereOrder{
Where: model2.NewWhere("kind", kind),
Order: nil,
})
}
isExist, err := model2.FirstField(mSysConfig.SysConfig, []string{"id", "name", "`value`"}, where...)
out := make([]*model2.SysConfig, 0)
err := model2.ScanFields(mSysConfig.SysConfig, &out, []string{"id", "`key`", "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
list := make(map[string]*ConfigInfo, 0)
for _, v := range out {
list[v.Key] = &ConfigInfo{
Name: v.Name,
Value: v.Value,
}
}
return list, nil
}
func NewConfig() ConfigHandle {