更换应用名相关调整

This commit is contained in:
天墨雀丹红 2023-07-04 20:43:45 +08:00
parent 9113fc5297
commit a9046dd3c0
14 changed files with 98 additions and 63 deletions

View File

@ -7,17 +7,19 @@ package admin
import ( import (
"context" "context"
"sort"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/text/gstr"
"hotgo/api/admin/monitor" "hotgo/api/admin/monitor"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/model/input/form" "hotgo/internal/model/input/form"
"hotgo/internal/websocket" "hotgo/internal/websocket"
"hotgo/utility/simple" "hotgo/utility/simple"
"hotgo/utility/useragent" "hotgo/utility/useragent"
"sort"
) )
// Monitor 监控 // Monitor 监控
@ -93,7 +95,7 @@ func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (
res.PerPage = req.PerPage res.PerPage = req.PerPage
sort.Sort(monitor.OnlineModels(clients)) sort.Sort(monitor.OnlineModels(clients))
isDemo := g.Cfg().MustGet(ctx, "hotgo.isDemo", false).Bool() isDemo := g.Cfg().MustGet(ctx, simple.AppName(ctx)+".isDemo", false).Bool()
_, perPage, offset := form.CalPage(ctx, req.Page, req.PerPage) _, perPage, offset := form.CalPage(ctx, req.Page, req.PerPage)
for k, v := range clients { for k, v := range clients {

View File

@ -7,6 +7,10 @@ package admin
import ( import (
"fmt" "fmt"
"os"
"runtime"
"time"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
@ -15,15 +19,14 @@ import (
"github.com/shirou/gopsutil/v3/host" "github.com/shirou/gopsutil/v3/host"
"github.com/shirou/gopsutil/v3/mem" "github.com/shirou/gopsutil/v3/mem"
"github.com/shirou/gopsutil/v3/process" "github.com/shirou/gopsutil/v3/process"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/model" "hotgo/internal/model"
"hotgo/internal/service" "hotgo/internal/service"
"hotgo/internal/websocket" "hotgo/internal/websocket"
"hotgo/utility/file" "hotgo/utility/file"
"hotgo/utility/format" "hotgo/utility/format"
"os" "hotgo/utility/simple"
"runtime"
"time"
) )
var ( var (
@ -76,7 +79,7 @@ func (c *cMonitor) RunInfo(client *websocket.Client, req *websocket.WRequest) {
"goSize": file.DirSize(pwd), "goSize": file.DirSize(pwd),
} }
isDemo := g.Cfg().MustGet(client.Context(), "hotgo.isDemo", false).Bool() isDemo := g.Cfg().MustGet(client.Context(), simple.AppName(client.Context())+".isDemo", false).Bool()
if isDemo { if isDemo {
data["rootPath"] = consts.DemoTips data["rootPath"] = consts.DemoTips
data["pwd"] = consts.DemoTips data["pwd"] = consts.DemoTips

View File

@ -7,12 +7,15 @@ package casbin
import ( import (
"context" "context"
"net/http"
"strings"
"github.com/casbin/casbin/v2" "github.com/casbin/casbin/v2"
_ "github.com/gogf/gf/contrib/drivers/mysql/v2" _ "github.com/gogf/gf/contrib/drivers/mysql/v2"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"hotgo/internal/consts" "hotgo/internal/consts"
"net/http" "hotgo/utility/simple"
"strings"
) )
const ( const (
@ -55,7 +58,7 @@ func loadPermissions(ctx context.Context) {
rules [][]string rules [][]string
polices []*Policy polices []*Policy
err error err error
superRoleKey = g.Cfg().MustGet(ctx, "hotgo.admin.superRoleKey") superRoleKey = g.Cfg().MustGet(ctx, simple.AppName(ctx)+".admin.superRoleKey")
) )
err = g.Model("hg_admin_role r"). err = g.Model("hg_admin_role r").

View File

@ -8,6 +8,12 @@ package location
import ( import (
"context" "context"
"fmt" "fmt"
"io"
"net"
"net/http"
"strings"
"time"
"github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/container/gmap"
"github.com/gogf/gf/v2/encoding/gcharset" "github.com/gogf/gf/v2/encoding/gcharset"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
@ -15,12 +21,9 @@ import (
"github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"github.com/kayon/iploc" "github.com/kayon/iploc"
"hotgo/utility/simple"
"hotgo/utility/validate" "hotgo/utility/validate"
"io"
"net"
"net/http"
"strings"
"time"
) )
const ( const (
@ -141,7 +144,7 @@ func GetLocation(ctx context.Context, ip string) (data *IpLocationData, err erro
return data1, nil return data1, nil
} }
mode := g.Cfg().MustGet(ctx, "hotgo.ipMethod", "cz88").String() mode := g.Cfg().MustGet(ctx, simple.AppName(ctx)+".ipMethod", "cz88").String()
switch mode { switch mode {
case "whois": case "whois":
data, err = WhoisLocation(ctx, ip) data, err = WhoisLocation(ctx, ip)

View File

@ -8,6 +8,7 @@ package admin
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/gogf/gf/v2/crypto/gmd5" "github.com/gogf/gf/v2/crypto/gmd5"
"github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
@ -16,6 +17,7 @@ import (
"github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"github.com/gogf/gf/v2/util/grand" "github.com/gogf/gf/v2/util/grand"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/dao" "hotgo/internal/dao"
"hotgo/internal/library/contexts" "hotgo/internal/library/contexts"
@ -26,6 +28,7 @@ import (
"hotgo/internal/model/input/adminin" "hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/sysin" "hotgo/internal/model/input/sysin"
"hotgo/internal/service" "hotgo/internal/service"
"hotgo/utility/simple"
"hotgo/utility/tree" "hotgo/utility/tree"
"hotgo/utility/validate" "hotgo/utility/validate"
) )
@ -718,7 +721,7 @@ func (s *sAdminMember) Select(ctx context.Context, in adminin.MemberSelectInp) (
// VerifySuperId 验证是否为超管 // VerifySuperId 验证是否为超管
func (s *sAdminMember) VerifySuperId(ctx context.Context, verifyId int64) bool { func (s *sAdminMember) VerifySuperId(ctx context.Context, verifyId int64) bool {
for _, id := range g.Cfg().MustGet(ctx, "hotgo.admin.superIds").Int64s() { for _, id := range g.Cfg().MustGet(ctx, simple.AppName(ctx)+".admin.superIds").Int64s() {
if id == verifyId { if id == verifyId {
return true return true
} }

View File

@ -7,10 +7,13 @@ package admin
import ( import (
"context" "context"
"sort"
"github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/dao" "hotgo/internal/dao"
"hotgo/internal/library/casbin" "hotgo/internal/library/casbin"
@ -21,8 +24,8 @@ import (
"hotgo/internal/model/input/form" "hotgo/internal/model/input/form"
"hotgo/internal/service" "hotgo/internal/service"
"hotgo/utility/convert" "hotgo/utility/convert"
"hotgo/utility/simple"
"hotgo/utility/tree" "hotgo/utility/tree"
"sort"
) )
type sAdminRole struct{} type sAdminRole struct{}
@ -39,7 +42,7 @@ func init() {
func (s *sAdminRole) Verify(ctx context.Context, path, method string) bool { func (s *sAdminRole) Verify(ctx context.Context, path, method string) bool {
var ( var (
user = contexts.Get(ctx).User user = contexts.Get(ctx).User
sk = g.Cfg().MustGet(ctx, "hotgo.admin.superRoleKey") sk = g.Cfg().MustGet(ctx, simple.AppName(ctx)+".admin.superRoleKey")
err error err error
) )
@ -272,7 +275,7 @@ func (s *sAdminRole) DataScopeSelect() (res form.Selects) {
func (s *sAdminRole) DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error) { func (s *sAdminRole) DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error) {
var ( var (
models *entity.AdminRole models *entity.AdminRole
sk = g.Cfg().MustGet(ctx, "hotgo.admin.superRoleKey") sk = g.Cfg().MustGet(ctx, simple.AppName(ctx)+".admin.superRoleKey")
) )
if err = dao.AdminRole.Ctx(ctx).Where("id", in.Id).Scan(&models); err != nil { if err = dao.AdminRole.Ctx(ctx).Where("id", in.Id).Scan(&models); err != nil {

View File

@ -8,6 +8,9 @@ package middleware
import ( import (
"context" "context"
"fmt" "fmt"
"net/http"
"strings"
"github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
@ -16,6 +19,7 @@ import (
"github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/text/gstr"
"go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/attribute"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/global" "hotgo/internal/global"
"hotgo/internal/library/addons" "hotgo/internal/library/addons"
@ -24,9 +28,8 @@ import (
"hotgo/internal/library/token" "hotgo/internal/library/token"
"hotgo/internal/model" "hotgo/internal/model"
"hotgo/internal/service" "hotgo/internal/service"
"hotgo/utility/simple"
"hotgo/utility/validate" "hotgo/utility/validate"
"net/http"
"strings"
) )
type sMiddleware struct { type sMiddleware struct {
@ -92,7 +95,7 @@ func (s *sMiddleware) CORS(r *ghttp.Request) {
// DemoLimit 演示系統操作限制 // DemoLimit 演示系統操作限制
func (s *sMiddleware) DemoLimit(r *ghttp.Request) { func (s *sMiddleware) DemoLimit(r *ghttp.Request) {
isDemo := g.Cfg().MustGet(r.Context(), "hotgo.isDemo", false) isDemo := g.Cfg().MustGet(r.Context(), simple.AppName(r.Context())+".isDemo", false)
if !isDemo.Bool() { if !isDemo.Bool() {
r.Middleware.Next() r.Middleware.Next()
return return

View File

@ -11,6 +11,7 @@ import (
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/util/gmeta" "github.com/gogf/gf/v2/util/gmeta"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/library/contexts" "hotgo/internal/library/contexts"
"hotgo/internal/library/response" "hotgo/internal/library/response"
@ -75,7 +76,7 @@ func parseResponse(r *ghttp.Request) (code int, message string, resp interface{}
} }
// 是否输出错误堆栈到页面 // 是否输出错误堆栈到页面
if g.Cfg().MustGet(ctx, "hotgo.debug", true).Bool() { if g.Cfg().MustGet(ctx, simple.AppName(ctx)+".debug", true).Bool() {
message = gerror.Current(err).Error() message = gerror.Current(err).Error()
if getContentType(r) == consts.HTTPContentTypeHtml { if getContentType(r) == consts.HTTPContentTypeHtml {
resp = charset.SerializeStack(err) resp = charset.SerializeStack(err)

View File

@ -7,16 +7,19 @@ package sys
import ( import (
"context" "context"
"github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/text/gstr"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/dao" "hotgo/internal/dao"
"hotgo/internal/model/entity" "hotgo/internal/model/entity"
"hotgo/internal/model/input/sysin" "hotgo/internal/model/input/sysin"
"hotgo/internal/service" "hotgo/internal/service"
"hotgo/utility/simple"
) )
var AddonsMaskDemoField []string var AddonsMaskDemoField []string
@ -55,7 +58,7 @@ func (s *sSysAddonsConfig) GetConfigByGroup(ctx context.Context, in sysin.GetAdd
return nil, err return nil, err
} }
isDemo := g.Cfg().MustGet(ctx, "hotgo.isDemo", false) isDemo := g.Cfg().MustGet(ctx, simple.AppName(ctx)+".isDemo", false)
if len(models) > 0 { if len(models) > 0 {
res = new(sysin.GetAddonsConfigModel) res = new(sysin.GetAddonsConfigModel)
res.List = make(g.Map, len(models)) res.List = make(g.Map, len(models))
@ -112,19 +115,19 @@ func (s *sSysAddonsConfig) UpdateConfigByGroup(ctx context.Context, in sysin.Upd
row := s.getConfigByKey(k, models) row := s.getConfigByKey(k, models)
// 新增 // 新增
if row == nil { if row == nil {
//row.Id = 0 // row.Id = 0
//row.Key = k // row.Key = k
//row.Value = gconv.String(v) // row.Value = gconv.String(v)
//row.Group = in.Group // row.Group = in.Group
//row.Status = consts.StatusEnabled // row.Status = consts.StatusEnabled
//row.CreatedAt = gtime.Now() // row.CreatedAt = gtime.Now()
//row.UpdatedAt = gtime.Now() // row.UpdatedAt = gtime.Now()
//_, err := dao.SysAddonsConfig.Ctx(ctx).Data(row).Insert() // _, err := dao.SysAddonsConfig.Ctx(ctx).Data(row).Insert()
//if err != nil { // if err != nil {
// err = gerror.Wrap(err, consts.ErrorORM) // err = gerror.Wrap(err, consts.ErrorORM)
// return err // return err
//} // }
//continue // continue
return gerror.Newf("暂不支持从前台添加变量,请先在数据库表[%v]中配置变量:%v", dao.SysAddonsConfig.Table(), k) return gerror.Newf("暂不支持从前台添加变量,请先在数据库表[%v]中配置变量:%v", dao.SysAddonsConfig.Table(), k)
} }

View File

@ -8,11 +8,13 @@ package sys
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/dao" "hotgo/internal/dao"
"hotgo/internal/library/payment" "hotgo/internal/library/payment"
@ -174,13 +176,13 @@ func (s *sSysConfig) GetLoadToken(ctx context.Context) (conf *model.TokenConfig,
// GetLoadLog 获取本地日志配置 // GetLoadLog 获取本地日志配置
func (s *sSysConfig) GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error) { func (s *sSysConfig) GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error) {
err = g.Cfg().MustGet(ctx, "hotgo.log").Scan(&conf) err = g.Cfg().MustGet(ctx, simple.AppName(ctx)+".log").Scan(&conf)
return return
} }
// GetLoadServeLog 获取本地服务日志配置 // GetLoadServeLog 获取本地服务日志配置
func (s *sSysConfig) GetLoadServeLog(ctx context.Context) (conf *model.ServeLogConfig, err error) { func (s *sSysConfig) GetLoadServeLog(ctx context.Context) (conf *model.ServeLogConfig, err error) {
err = g.Cfg().MustGet(ctx, "hotgo.serveLog").Scan(&conf) err = g.Cfg().MustGet(ctx, simple.AppName(ctx)+".serveLog").Scan(&conf)
return return
} }
@ -242,19 +244,19 @@ func (s *sSysConfig) UpdateConfigByGroup(ctx context.Context, in sysin.UpdateCon
row := s.getConfigByKey(k, models) row := s.getConfigByKey(k, models)
// 新增 // 新增
if row == nil { if row == nil {
//row.Id = 0 // row.Id = 0
//row.Key = k // row.Key = k
//row.Value = gconv.String(v) // row.Value = gconv.String(v)
//row.Group = in.Group // row.Group = in.Group
//row.Status = consts.StatusEnabled // row.Status = consts.StatusEnabled
//row.CreatedAt = gtime.Now() // row.CreatedAt = gtime.Now()
//row.UpdatedAt = gtime.Now() // row.UpdatedAt = gtime.Now()
//_, err := dao.SysConfig.Ctx(ctx).Data(row).Insert() // _, err := dao.SysConfig.Ctx(ctx).Data(row).Insert()
//if err != nil { // if err != nil {
// err = gerror.Wrap(err, consts.ErrorORM) // err = gerror.Wrap(err, consts.ErrorORM)
// return err // return err
//} // }
//continue // continue
err = gerror.Newf("暂不支持从前台添加变量,请先在数据库表[%v]中配置变量:%v", dao.SysConfig.Table(), k) err = gerror.Newf("暂不支持从前台添加变量,请先在数据库表[%v]中配置变量:%v", dao.SysConfig.Table(), k)
return return
} }

View File

@ -8,6 +8,7 @@ package sys
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
@ -16,6 +17,7 @@ import (
"github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/internal/dao" "hotgo/internal/dao"
"hotgo/internal/library/contexts" "hotgo/internal/library/contexts"
@ -241,7 +243,7 @@ func (s *sSysLog) View(ctx context.Context, in sysin.LogViewInp) (res *sysin.Log
return return
} }
if g.Cfg().MustGet(ctx, "hotgo.isDemo", false).Bool() { if g.Cfg().MustGet(ctx, simple.AppName(ctx)+".isDemo", false).Bool() {
res.HeaderData = gjson.New(`{ res.HeaderData = gjson.New(`{
"none": [ "none": [
"` + consts.DemoTips + `" "` + consts.DemoTips + `"
@ -317,7 +319,7 @@ func (s *sSysLog) List(ctx context.Context, in sysin.LogListInp) (list []*sysin.
return return
} }
isDemo := g.Cfg().MustGet(ctx, "hotgo.isDemo", false).Bool() isDemo := g.Cfg().MustGet(ctx, simple.AppName(ctx)+".isDemo", false).Bool()
for i := 0; i < len(list); i++ { for i := 0; i < len(list); i++ {
// 管理员 // 管理员
if list[i].AppId == consts.AppAdmin { if list[i].AppId == consts.AppAdmin {
@ -329,25 +331,25 @@ func (s *sSysLog) List(ctx context.Context, in sysin.LogListInp) (list []*sysin.
list[i].MemberName = memberName.String() list[i].MemberName = memberName.String()
} }
//// 接口 // // 接口
//if list[i].AppId == consts.AppApi { // if list[i].AppId == consts.AppApi {
// //memberName, err = dao.Member.Ctx(ctx).Fields("realname").Where("id", res.List[i].MemberId).Value() // //memberName, err = dao.Member.Ctx(ctx).Fields("realname").Where("id", res.List[i].MemberId).Value()
// //if err != nil { // //if err != nil {
// // err = gerror.Wrap(err, consts.ErrorORM) // // err = gerror.Wrap(err, consts.ErrorORM)
// // return nil, err // // return nil, err
// //} // //}
//} // }
if list[i].MemberName == "" { if list[i].MemberName == "" {
list[i].MemberName = "游客" list[i].MemberName = "游客"
} }
//// 获取省市编码对应的地区名称 // // 获取省市编码对应的地区名称
//region, err := dao.SysProvinces.GetRegion(ctx, list[i].ProvinceId, list[i].CityId) // region, err := dao.SysProvinces.GetRegion(ctx, list[i].ProvinceId, list[i].CityId)
//if err != nil { // if err != nil {
// return list, totalCount, err // return list, totalCount, err
//} // }
//list[i].Region = region // list[i].Region = region
// 截取请求url路径 // 截取请求url路径
if gstr.Contains(list[i].Url, "?") { if gstr.Contains(list[i].Url, "?") {

View File

@ -7,9 +7,11 @@ package view
import ( import (
"context" "context"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/model" "hotgo/internal/model"
"hotgo/internal/service" "hotgo/internal/service"
"hotgo/utility/charset" "hotgo/utility/charset"
@ -95,7 +97,7 @@ func (s *sView) Error(ctx context.Context, err error) {
) )
// 是否输出错误堆栈到页面 // 是否输出错误堆栈到页面
if g.Cfg().MustGet(ctx, "hotgo.debug", true).Bool() { if g.Cfg().MustGet(ctx, simple.AppName(ctx)+".debug", true).Bool() {
stack = charset.SerializeStack(err) stack = charset.SerializeStack(err)
} }

View File

@ -7,8 +7,11 @@ package form
import ( import (
"context" "context"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"hotgo/utility/simple"
) )
var ( var (
@ -21,7 +24,7 @@ func DefaultPageSize(ctx context.Context) int {
if pageSize > 0 { if pageSize > 0 {
return pageSize return pageSize
} }
pageSize = g.Cfg().MustGet(ctx, "hotgo.admin.defaultPageSize", 10).Int() pageSize = g.Cfg().MustGet(ctx, simple.AppName(ctx)+".admin.defaultPageSize", 10).Int()
if pageSize <= 0 { if pageSize <= 0 {
pageSize = 10 pageSize = 10
} }
@ -33,7 +36,7 @@ func DefaultPage(ctx context.Context) int {
if page > 0 { if page > 0 {
return page return page
} }
page = g.Cfg().MustGet(ctx, "hotgo.admin.defaultPage", 1).Int() page = g.Cfg().MustGet(ctx, simple.AppName(ctx)+".admin.defaultPage", 1).Int()
if page <= 0 { if page <= 0 {
page = 1 page = 1
} }
@ -118,7 +121,7 @@ type SelectInt64 struct {
// DefaultMaxSort 默认最大排序 // DefaultMaxSort 默认最大排序
func DefaultMaxSort(ctx context.Context, baseSort int) int { func DefaultMaxSort(ctx context.Context, baseSort int) int {
return baseSort + g.Cfg().MustGet(ctx, "hotgo.admin.maxSortIncrement", 10).Int() return baseSort + g.Cfg().MustGet(ctx, simple.AppName(ctx)+".admin.maxSortIncrement", 10).Int()
} }
// AvatarGroup 头像组 // AvatarGroup 头像组

View File

@ -7,6 +7,7 @@ package simple
import ( import (
"context" "context"
"github.com/gogf/gf/v2/crypto/gmd5" "github.com/gogf/gf/v2/crypto/gmd5"
"github.com/gogf/gf/v2/encoding/gbase64" "github.com/gogf/gf/v2/encoding/gbase64"
"github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/errors/gerror"
@ -15,6 +16,7 @@ import (
"github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/os/grpool" "github.com/gogf/gf/v2/os/grpool"
"github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/consts" "hotgo/internal/consts"
"hotgo/utility/encrypt" "hotgo/utility/encrypt"
) )
@ -35,7 +37,7 @@ func FilterMaskDemo(ctx context.Context, src g.Map) g.Map {
return nil return nil
} }
if !g.Cfg().MustGet(ctx, "hotgo.isDemo", false).Bool() { if !g.Cfg().MustGet(ctx, AppName(ctx)+".isDemo", false).Bool() {
return src return src
} }