mirror of
https://github.com/tiger1103/gfast.git
synced 2026-09-20 17:57:51 +00:00
添加任务信息
This commit is contained in:
@@ -69,7 +69,7 @@ func (c *CmsMenu) Add(r *ghttp.Request) {
|
||||
}
|
||||
list := gconv.Maps(menus)
|
||||
list = utils.PushSonToParent(list, 0, "parent_id")
|
||||
typeChecker, err := dict_service.GetDictWithDataByType("cms_category_type")
|
||||
typeChecker, err := dict_service.GetDictWithDataByType("cms_category_type", "")
|
||||
if err != nil {
|
||||
response.FailJson(true, r, err.Error())
|
||||
}
|
||||
@@ -111,7 +111,7 @@ func (c *CmsMenu) Edit(r *ghttp.Request) {
|
||||
}
|
||||
list := gconv.Maps(menus)
|
||||
list = utils.PushSonToParent(list, 0, "parent_id")
|
||||
typeChecker, err := dict_service.GetDictWithDataByType("cms_category_type")
|
||||
typeChecker, err := dict_service.GetDictWithDataByType("cms_category_type", gconv.String(menuInfo.CateType))
|
||||
if err != nil {
|
||||
response.FailJson(true, r, err.Error())
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package admin
|
||||
|
||||
import "github.com/gogf/gf/net/ghttp"
|
||||
import (
|
||||
"gfast/app/service/admin/dict_service"
|
||||
"gfast/library/response"
|
||||
"github.com/gogf/gf/frame/g"
|
||||
"github.com/gogf/gf/net/ghttp"
|
||||
)
|
||||
|
||||
type MonitorJob struct{}
|
||||
|
||||
@@ -9,5 +14,18 @@ func (c *MonitorJob) List(r *ghttp.Request) {}
|
||||
|
||||
//添加任务
|
||||
func (c *MonitorJob) Add(r *ghttp.Request) {
|
||||
|
||||
//获取相关选项
|
||||
jobStatus, err := dict_service.GetDictWithDataByType("sys_job_status", "")
|
||||
if err != nil {
|
||||
response.FailJson(true, r, err.Error())
|
||||
}
|
||||
jobGroup, err := dict_service.GetDictWithDataByType("sys_job_group", "")
|
||||
if err != nil {
|
||||
response.FailJson(true, r, err.Error())
|
||||
}
|
||||
res := g.Map{
|
||||
"jobStatus": jobStatus,
|
||||
"jobGroup": jobGroup,
|
||||
}
|
||||
response.SusJson(true, r, "添加任务", res)
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ func GetDictById(id int) (dict *sys_dict_type.Entity, err error) {
|
||||
}
|
||||
|
||||
//通过字典键类型获取选项
|
||||
func GetDictWithDataByType(dictType string) (dict g.Map, err error) {
|
||||
func GetDictWithDataByType(dictType, defaultValue string) (dict g.Map, err error) {
|
||||
dictEntity, err := sys_dict_type.Model.FindOne("dict_type", dictType)
|
||||
if err != nil {
|
||||
g.Log().Error(err)
|
||||
@@ -158,9 +158,18 @@ func GetDictWithDataByType(dictType string) (dict g.Map, err error) {
|
||||
}
|
||||
values := make(g.List, len(dictDataEntities))
|
||||
for k, v := range dictDataEntities {
|
||||
isDefault := 0
|
||||
if defaultValue != "" {
|
||||
if defaultValue == v.DictValue {
|
||||
isDefault = 1
|
||||
}
|
||||
} else {
|
||||
isDefault = v.IsDefault
|
||||
}
|
||||
values[k] = g.Map{
|
||||
"key": v.DictValue,
|
||||
"value": v.DictLabel,
|
||||
"key": v.DictValue,
|
||||
"value": v.DictLabel,
|
||||
"isDefault": isDefault,
|
||||
}
|
||||
}
|
||||
dict = g.Map{
|
||||
|
||||
@@ -96,20 +96,21 @@ func ForceLogout(ids []int) error {
|
||||
entity, err := user_online.Model.FindOne("id", id)
|
||||
if err != nil {
|
||||
g.Log().Error(err)
|
||||
return gerror.New("获取在线用户信息失败")
|
||||
}
|
||||
if err != nil || entity == nil {
|
||||
return gerror.New("获取用户在线信息失败")
|
||||
if entity == nil {
|
||||
continue
|
||||
}
|
||||
entity.Delete()
|
||||
_, userKey := GetUuidUserKeyByToken(entity.Token)
|
||||
if userKey == "" {
|
||||
return gerror.New("用户信息获取失败")
|
||||
continue
|
||||
}
|
||||
userKey = boot.AdminGfToken.CacheKey + userKey
|
||||
_, err = g.Redis().Do("DEL", userKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
entity.Delete()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user