mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-09-17 08:46:39 +08:00
优化home模块页面错误处理
This commit is contained in:
parent
5abfeb5485
commit
2d0d7e5604
@ -8,7 +8,7 @@ package base
|
|||||||
import "github.com/gogf/gf/v2/frame/g"
|
import "github.com/gogf/gf/v2/frame/g"
|
||||||
|
|
||||||
type SiteIndexReq struct {
|
type SiteIndexReq struct {
|
||||||
g.Meta `path:"/index" method:"get" summary:"首页" tags:"首页"`
|
g.Meta `path:"/" method:"get" summary:"首页" tags:"首页"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SiteIndexRes struct {
|
type SiteIndexRes struct {
|
||||||
|
@ -24,7 +24,15 @@ func (a *cSite) Index(ctx context.Context, _ *base.SiteIndexReq) (res *base.Site
|
|||||||
service.View().Render(ctx, model.View{Data: g.Map{
|
service.View().Render(ctx, model.View{Data: g.Map{
|
||||||
"name": simple.AppName(ctx),
|
"name": simple.AppName(ctx),
|
||||||
"version": consts.VersionApp,
|
"version": consts.VersionApp,
|
||||||
"debug": g.Cfg().MustGet(ctx, "hotgo.debug", true),
|
|
||||||
}})
|
}})
|
||||||
|
|
||||||
|
//err = gerror.New("这是一个测试错误")
|
||||||
|
//return
|
||||||
|
|
||||||
|
//err = gerror.NewCode(gcode.New(10000, "这是一个测试自定义错误码错误", nil))
|
||||||
|
//return
|
||||||
|
|
||||||
|
//service.View().Error(ctx, gerror.New("这是一个允许被自定义格式的错误,默认和通用错误格式一致,你可以修改它"))
|
||||||
|
//return
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
15
server/internal/logic/middleware/home_auth.go
Normal file
15
server/internal/logic/middleware/home_auth.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package middleware
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gogf/gf/v2/net/ghttp"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HomeAuth 前台页面鉴权中间件
|
||||||
|
func (s *sMiddleware) HomeAuth(r *ghttp.Request) {
|
||||||
|
r.Response.Header().Set("Content-Type", "text/html")
|
||||||
|
|
||||||
|
// 鉴权
|
||||||
|
// ...
|
||||||
|
|
||||||
|
r.Middleware.Next()
|
||||||
|
}
|
@ -17,15 +17,22 @@ import (
|
|||||||
"hotgo/internal/library/response"
|
"hotgo/internal/library/response"
|
||||||
"hotgo/internal/model/input/payin"
|
"hotgo/internal/model/input/payin"
|
||||||
"hotgo/utility/charset"
|
"hotgo/utility/charset"
|
||||||
|
"hotgo/utility/simple"
|
||||||
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ResponseHandler HTTP响应预处理
|
// ResponseHandler HTTP响应预处理
|
||||||
func (s *sMiddleware) ResponseHandler(r *ghttp.Request) {
|
func (s *sMiddleware) ResponseHandler(r *ghttp.Request) {
|
||||||
r.Middleware.Next()
|
r.Middleware.Next()
|
||||||
|
|
||||||
// 模板页面响应
|
// 已存在响应
|
||||||
if "text/html" == r.Response.Header().Get("Content-Type") {
|
if r.Response.BufferLength() > 0 && contexts.Get(r.Context()).Response != nil {
|
||||||
r.Middleware.Next()
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// html模板响应
|
||||||
|
if r.Response.Header().Get("Content-Type") == "text/html" {
|
||||||
|
s.responseHtml(r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,10 +42,27 @@ func (s *sMiddleware) ResponseHandler(r *ghttp.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 默认json响应
|
||||||
responseJson(r)
|
responseJson(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
// rTemplate 支付通知响应
|
// responseHtml html模板响应
|
||||||
|
func (s *sMiddleware) responseHtml(r *ghttp.Request) {
|
||||||
|
code, message, resp := parseResponse(r)
|
||||||
|
if code == gcode.CodeOK.Code() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
r.Response.ClearBuffer()
|
||||||
|
_ = r.Response.WriteTplContent(simple.DefaultErrorTplContent(r.Context()), g.Map{
|
||||||
|
"code": code,
|
||||||
|
"message": message,
|
||||||
|
"stack": resp,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// responsePayNotify 支付通知响应
|
||||||
func (s *sMiddleware) responsePayNotify(r *ghttp.Request) {
|
func (s *sMiddleware) responsePayNotify(r *ghttp.Request) {
|
||||||
var (
|
var (
|
||||||
ctx = r.Context()
|
ctx = r.Context()
|
||||||
@ -46,18 +70,16 @@ func (s *sMiddleware) responsePayNotify(r *ghttp.Request) {
|
|||||||
data *payin.PayNotifyModel
|
data *payin.PayNotifyModel
|
||||||
)
|
)
|
||||||
|
|
||||||
// 异常
|
code, message, resp := parseResponse(r)
|
||||||
if err = r.GetError(); err != nil {
|
if code != gcode.CodeOK.Code() {
|
||||||
g.Log("exception").Error(ctx, err)
|
response.RJson(r, code, message, data)
|
||||||
r.Response.ClearBuffer()
|
|
||||||
r.Response.WriteStatus(500, err.Error())
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = gconv.Scan(r.GetHandlerResponse(), &data); err != nil || data == nil {
|
if err = gconv.Scan(resp, &data); err != nil || data == nil {
|
||||||
g.Log("exception").Errorf(ctx, "middleware.responsePayNotify Scan err:%+v, data:%+v", err, data)
|
g.Log("exception").Errorf(ctx, "middleware.responsePayNotify Scan err:%+v, data:%+v", err, data)
|
||||||
r.Response.ClearBuffer()
|
r.Response.ClearBuffer()
|
||||||
r.Response.WriteStatus(500, err.Error())
|
r.Response.WriteStatus(http.StatusInternalServerError, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,46 +102,43 @@ func (s *sMiddleware) responsePayNotify(r *ghttp.Request) {
|
|||||||
err = gerror.Newf("无效的支付方式,这可能是没有配置通知回调响应方式导致的:%+v", data)
|
err = gerror.Newf("无效的支付方式,这可能是没有配置通知回调响应方式导致的:%+v", data)
|
||||||
g.Log("exception").Error(ctx, err)
|
g.Log("exception").Error(ctx, err)
|
||||||
r.Response.ClearBuffer()
|
r.Response.ClearBuffer()
|
||||||
r.Response.WriteStatus(500, err.Error())
|
r.Response.WriteStatus(http.StatusInternalServerError, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// responseJson json响应
|
||||||
func responseJson(r *ghttp.Request) {
|
func responseJson(r *ghttp.Request) {
|
||||||
var (
|
code, message, data := parseResponse(r)
|
||||||
ctx = r.Context()
|
|
||||||
comResponse = contexts.Get(ctx).Response
|
|
||||||
code = gcode.CodeOK.Code()
|
|
||||||
message = "操作成功"
|
|
||||||
data interface{}
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
// 已存在响应内容,且是comResponse返回的时,中断运行
|
|
||||||
if r.Response.BufferLength() > 0 && comResponse != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = r.GetError(); err != nil {
|
|
||||||
// 记录到自定义错误日志文件
|
|
||||||
code = gerror.Code(err).Code()
|
|
||||||
|
|
||||||
if code == gcode.CodeNil.Code() {
|
|
||||||
g.Log().Stdout(false).Printf(ctx, "exception:%v", err)
|
|
||||||
} else {
|
|
||||||
g.Log().Errorf(ctx, "exception:%v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 是否输出错误到页面
|
|
||||||
if g.Cfg().MustGet(ctx, "hotgo.debug", true).Bool() {
|
|
||||||
message = gerror.Current(err).Error()
|
|
||||||
data = charset.ParseErrStack(err)
|
|
||||||
} else {
|
|
||||||
message = consts.ErrorMessage(gerror.Current(err))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
data = r.GetHandlerResponse()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回固定的友好信息
|
|
||||||
response.RJson(r, code, message, data)
|
response.RJson(r, code, message, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parseResponse 解析响应数据
|
||||||
|
func parseResponse(r *ghttp.Request) (code int, message string, resp interface{}) {
|
||||||
|
var (
|
||||||
|
ctx = r.Context()
|
||||||
|
err = r.GetError()
|
||||||
|
)
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
return gcode.CodeOK.Code(), "操作成功", r.GetHandlerResponse()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否输出错误堆栈到页面
|
||||||
|
if g.Cfg().MustGet(ctx, "hotgo.debug", true).Bool() {
|
||||||
|
message = gerror.Current(err).Error()
|
||||||
|
resp = charset.ParseErrStack(err)
|
||||||
|
} else {
|
||||||
|
message = consts.ErrorMessage(gerror.Current(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析错误状态码
|
||||||
|
code = gerror.Code(err).Code()
|
||||||
|
|
||||||
|
// 记录异常日志
|
||||||
|
if code == gcode.CodeNil.Code() {
|
||||||
|
g.Log().Stdout(false).Printf(ctx, "exception:%v", err)
|
||||||
|
} else {
|
||||||
|
g.Log().Errorf(ctx, "exception:%v", err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -7,10 +7,13 @@ package view
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"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/simple"
|
||||||
)
|
)
|
||||||
|
|
||||||
type sView struct{}
|
type sView struct{}
|
||||||
@ -83,70 +86,23 @@ func (s *sView) Render(ctx context.Context, data ...model.View) {
|
|||||||
s.RenderTpl(ctx, g.Cfg().MustGet(ctx, "viewer.homeLayout").String(), data...)
|
s.RenderTpl(ctx, g.Cfg().MustGet(ctx, "viewer.homeLayout").String(), data...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render302 跳转中间页面
|
// Error 自定义错误页面
|
||||||
func (s *sView) Render302(ctx context.Context, data ...model.View) {
|
|
||||||
view := model.View{}
|
|
||||||
if len(data) > 0 {
|
|
||||||
view = data[0]
|
|
||||||
}
|
|
||||||
if view.Title == "" {
|
|
||||||
view.Title = "页面跳转中"
|
|
||||||
}
|
|
||||||
s.RenderTpl(ctx, "default/pages/302.html", view)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render401 401页面
|
|
||||||
func (s *sView) Render401(ctx context.Context, data ...model.View) {
|
|
||||||
view := model.View{}
|
|
||||||
if len(data) > 0 {
|
|
||||||
view = data[0]
|
|
||||||
}
|
|
||||||
if view.Title == "" {
|
|
||||||
view.Title = "无访问权限"
|
|
||||||
}
|
|
||||||
s.RenderTpl(ctx, "default/pages/401.html", view)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render403 403页面
|
|
||||||
func (s *sView) Render403(ctx context.Context, data ...model.View) {
|
|
||||||
view := model.View{}
|
|
||||||
if len(data) > 0 {
|
|
||||||
view = data[0]
|
|
||||||
}
|
|
||||||
if view.Title == "" {
|
|
||||||
view.Title = "无访问权限"
|
|
||||||
}
|
|
||||||
s.RenderTpl(ctx, "default/pages/403.html", view)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render404 404页面
|
|
||||||
func (s *sView) Render404(ctx context.Context, data ...model.View) {
|
|
||||||
view := model.View{}
|
|
||||||
if len(data) > 0 {
|
|
||||||
view = data[0]
|
|
||||||
}
|
|
||||||
if view.Title == "" {
|
|
||||||
view.Title = "资源不存在"
|
|
||||||
}
|
|
||||||
s.RenderTpl(ctx, "default/pages/404.html", view)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render500 500页面
|
|
||||||
func (s *sView) Render500(ctx context.Context, data ...model.View) {
|
|
||||||
view := model.View{}
|
|
||||||
if len(data) > 0 {
|
|
||||||
view = data[0]
|
|
||||||
}
|
|
||||||
if view.Title == "" {
|
|
||||||
view.Title = "请求执行错误"
|
|
||||||
}
|
|
||||||
s.RenderTpl(ctx, "default/pages/500.html", view)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *sView) Error(ctx context.Context, err error) {
|
func (s *sView) Error(ctx context.Context, err error) {
|
||||||
view := model.View{
|
var (
|
||||||
Title: "错误提示",
|
request = g.RequestFromCtx(ctx)
|
||||||
Error: err.Error(),
|
code = gerror.Code(err)
|
||||||
|
stack string
|
||||||
|
)
|
||||||
|
|
||||||
|
// 是否输出错误堆栈到页面
|
||||||
|
if g.Cfg().MustGet(ctx, "hotgo.debug", true).Bool() {
|
||||||
|
stack = charset.SerializeStack(err)
|
||||||
}
|
}
|
||||||
s.RenderTpl(ctx, "default/pages/500.html", view)
|
|
||||||
|
request.Response.ClearBuffer()
|
||||||
|
_ = request.Response.WriteTplContent(simple.DefaultErrorTplContent(ctx), g.Map{
|
||||||
|
"code": code.Code(),
|
||||||
|
"message": code.Message(),
|
||||||
|
"stack": stack,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -8,19 +8,25 @@ package router
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/gogf/gf/v2/net/ghttp"
|
"github.com/gogf/gf/v2/net/ghttp"
|
||||||
api "hotgo/api/home/base"
|
|
||||||
"hotgo/internal/consts"
|
"hotgo/internal/consts"
|
||||||
"hotgo/internal/controller/home/base"
|
"hotgo/internal/controller/home/base"
|
||||||
|
"hotgo/internal/service"
|
||||||
"hotgo/utility/simple"
|
"hotgo/utility/simple"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Home 前台页面路由
|
// Home 前台页面路由
|
||||||
func Home(ctx context.Context, group *ghttp.RouterGroup) {
|
func Home(ctx context.Context, group *ghttp.RouterGroup) {
|
||||||
// 注册首页路由
|
group.Middleware(service.Middleware().HomeAuth)
|
||||||
group.ALL("/", func(r *ghttp.Request) {
|
|
||||||
_, _ = base.Site.Index(r.Context(), &api.SiteIndexReq{})
|
// 允许通过根地址访问的路由可以同时加到这里
|
||||||
|
// 访问地址:http://127.0.0.1:8000
|
||||||
|
group.Group("/", func(group *ghttp.RouterGroup) {
|
||||||
|
group.Bind(
|
||||||
|
base.Site, // 基础
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 默认访问地址:http://127.0.0.1:8000/home
|
||||||
group.Group(simple.RouterPrefix(ctx, consts.AppHome), func(group *ghttp.RouterGroup) {
|
group.Group(simple.RouterPrefix(ctx, consts.AppHome), func(group *ghttp.RouterGroup) {
|
||||||
group.Bind(
|
group.Bind(
|
||||||
base.Site, // 基础
|
base.Site, // 基础
|
||||||
|
@ -32,6 +32,17 @@ type (
|
|||||||
View(ctx context.Context, in adminin.OrderViewInp) (res *adminin.OrderViewModel, err error)
|
View(ctx context.Context, in adminin.OrderViewInp) (res *adminin.OrderViewModel, err error)
|
||||||
Status(ctx context.Context, in adminin.OrderStatusInp) (err error)
|
Status(ctx context.Context, in adminin.OrderStatusInp) (err error)
|
||||||
}
|
}
|
||||||
|
IAdminSite interface {
|
||||||
|
Register(ctx context.Context, in adminin.RegisterInp) (err error)
|
||||||
|
AccountLogin(ctx context.Context, in adminin.AccountLoginInp) (res *adminin.LoginModel, err error)
|
||||||
|
MobileLogin(ctx context.Context, in adminin.MobileLoginInp) (res *adminin.LoginModel, err error)
|
||||||
|
}
|
||||||
|
IAdminCash interface {
|
||||||
|
View(ctx context.Context, in adminin.CashViewInp) (res *adminin.CashViewModel, err error)
|
||||||
|
List(ctx context.Context, in adminin.CashListInp) (list []*adminin.CashListModel, totalCount int, err error)
|
||||||
|
Apply(ctx context.Context, in adminin.CashApplyInp) (err error)
|
||||||
|
Payment(ctx context.Context, in adminin.CashPaymentInp) (err error)
|
||||||
|
}
|
||||||
IAdminDept interface {
|
IAdminDept interface {
|
||||||
Delete(ctx context.Context, in adminin.DeptDeleteInp) (err error)
|
Delete(ctx context.Context, in adminin.DeptDeleteInp) (err error)
|
||||||
Edit(ctx context.Context, in adminin.DeptEditInp) (err error)
|
Edit(ctx context.Context, in adminin.DeptEditInp) (err error)
|
||||||
@ -42,6 +53,54 @@ type (
|
|||||||
List(ctx context.Context, in adminin.DeptListInp) (res *adminin.DeptListModel, err error)
|
List(ctx context.Context, in adminin.DeptListInp) (res *adminin.DeptListModel, err error)
|
||||||
GetName(ctx context.Context, id int64) (name string, err error)
|
GetName(ctx context.Context, id int64) (name string, err error)
|
||||||
}
|
}
|
||||||
|
IAdminMonitor interface {
|
||||||
|
StartMonitor(ctx context.Context)
|
||||||
|
GetMeta(ctx context.Context) *model.MonitorData
|
||||||
|
}
|
||||||
|
IAdminNotice interface {
|
||||||
|
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||||
|
Delete(ctx context.Context, in adminin.NoticeDeleteInp) (err error)
|
||||||
|
Edit(ctx context.Context, in adminin.NoticeEditInp) (err error)
|
||||||
|
Status(ctx context.Context, in adminin.NoticeStatusInp) (err error)
|
||||||
|
MaxSort(ctx context.Context, in adminin.NoticeMaxSortInp) (res *adminin.NoticeMaxSortModel, err error)
|
||||||
|
View(ctx context.Context, in adminin.NoticeViewInp) (res *adminin.NoticeViewModel, err error)
|
||||||
|
List(ctx context.Context, in adminin.NoticeListInp) (list []*adminin.NoticeListModel, totalCount int, err error)
|
||||||
|
PullMessages(ctx context.Context, in adminin.PullMessagesInp) (res *adminin.PullMessagesModel, err error)
|
||||||
|
UnreadCount(ctx context.Context, in adminin.NoticeUnreadCountInp) (res *adminin.NoticeUnreadCountModel, err error)
|
||||||
|
UpRead(ctx context.Context, in adminin.NoticeUpReadInp) (err error)
|
||||||
|
ReadAll(ctx context.Context, in adminin.NoticeReadAllInp) (err error)
|
||||||
|
MessageList(ctx context.Context, in adminin.NoticeMessageListInp) (list []*adminin.NoticeMessageListModel, totalCount int, err error)
|
||||||
|
}
|
||||||
|
IAdminPost interface {
|
||||||
|
Delete(ctx context.Context, in adminin.PostDeleteInp) (err error)
|
||||||
|
Edit(ctx context.Context, in adminin.PostEditInp) (err error)
|
||||||
|
MaxSort(ctx context.Context, in adminin.PostMaxSortInp) (res *adminin.PostMaxSortModel, err error)
|
||||||
|
NameUnique(ctx context.Context, in adminin.PostNameUniqueInp) (res *adminin.PostNameUniqueModel, err error)
|
||||||
|
CodeUnique(ctx context.Context, in adminin.PostCodeUniqueInp) (res *adminin.PostCodeUniqueModel, err error)
|
||||||
|
View(ctx context.Context, in adminin.PostViewInp) (res *adminin.PostViewModel, err error)
|
||||||
|
List(ctx context.Context, in adminin.PostListInp) (list []*adminin.PostListModel, totalCount int, err error)
|
||||||
|
GetMemberByStartName(ctx context.Context, memberId int64) (name string, err error)
|
||||||
|
Status(ctx context.Context, in adminin.PostStatusInp) (err error)
|
||||||
|
}
|
||||||
|
IAdminRole interface {
|
||||||
|
Verify(ctx context.Context, path, method string) bool
|
||||||
|
List(ctx context.Context, in adminin.RoleListInp) (res *adminin.RoleListModel, totalCount int, err error)
|
||||||
|
GetName(ctx context.Context, id int64) (name string, err error)
|
||||||
|
GetMemberList(ctx context.Context, id int64) (list []*adminin.RoleListModel, err error)
|
||||||
|
GetPermissions(ctx context.Context, in adminin.GetPermissionsInp) (res *adminin.GetPermissionsModel, err error)
|
||||||
|
UpdatePermissions(ctx context.Context, in adminin.UpdatePermissionsInp) (err error)
|
||||||
|
Edit(ctx context.Context, in adminin.RoleEditInp) (err error)
|
||||||
|
Delete(ctx context.Context, in adminin.RoleDeleteInp) (err error)
|
||||||
|
DataScopeSelect() (res form.Selects)
|
||||||
|
DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error)
|
||||||
|
}
|
||||||
|
IAdminCreditsLog interface {
|
||||||
|
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||||
|
SaveBalance(ctx context.Context, in adminin.CreditsLogSaveBalanceInp) (res *adminin.CreditsLogSaveBalanceModel, err error)
|
||||||
|
SaveIntegral(ctx context.Context, in adminin.CreditsLogSaveIntegralInp) (res *adminin.CreditsLogSaveIntegralModel, err error)
|
||||||
|
List(ctx context.Context, in adminin.CreditsLogListInp) (list []*adminin.CreditsLogListModel, totalCount int, err error)
|
||||||
|
Export(ctx context.Context, in adminin.CreditsLogListInp) (err error)
|
||||||
|
}
|
||||||
IAdminMember interface {
|
IAdminMember interface {
|
||||||
AddBalance(ctx context.Context, in adminin.MemberAddBalanceInp) (err error)
|
AddBalance(ctx context.Context, in adminin.MemberAddBalanceInp) (err error)
|
||||||
AddIntegral(ctx context.Context, in adminin.MemberAddIntegralInp) (err error)
|
AddIntegral(ctx context.Context, in adminin.MemberAddIntegralInp) (err error)
|
||||||
@ -68,51 +127,6 @@ type (
|
|||||||
IAdminMemberPost interface {
|
IAdminMemberPost interface {
|
||||||
UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error)
|
UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error)
|
||||||
}
|
}
|
||||||
IAdminMonitor interface {
|
|
||||||
StartMonitor(ctx context.Context)
|
|
||||||
GetMeta(ctx context.Context) *model.MonitorData
|
|
||||||
}
|
|
||||||
IAdminPost interface {
|
|
||||||
Delete(ctx context.Context, in adminin.PostDeleteInp) (err error)
|
|
||||||
Edit(ctx context.Context, in adminin.PostEditInp) (err error)
|
|
||||||
MaxSort(ctx context.Context, in adminin.PostMaxSortInp) (res *adminin.PostMaxSortModel, err error)
|
|
||||||
NameUnique(ctx context.Context, in adminin.PostNameUniqueInp) (res *adminin.PostNameUniqueModel, err error)
|
|
||||||
CodeUnique(ctx context.Context, in adminin.PostCodeUniqueInp) (res *adminin.PostCodeUniqueModel, err error)
|
|
||||||
View(ctx context.Context, in adminin.PostViewInp) (res *adminin.PostViewModel, err error)
|
|
||||||
List(ctx context.Context, in adminin.PostListInp) (list []*adminin.PostListModel, totalCount int, err error)
|
|
||||||
GetMemberByStartName(ctx context.Context, memberId int64) (name string, err error)
|
|
||||||
Status(ctx context.Context, in adminin.PostStatusInp) (err error)
|
|
||||||
}
|
|
||||||
IAdminRole interface {
|
|
||||||
Verify(ctx context.Context, path, method string) bool
|
|
||||||
List(ctx context.Context, in adminin.RoleListInp) (res *adminin.RoleListModel, totalCount int, err error)
|
|
||||||
GetName(ctx context.Context, id int64) (name string, err error)
|
|
||||||
GetMemberList(ctx context.Context, id int64) (list []*adminin.RoleListModel, err error)
|
|
||||||
GetPermissions(ctx context.Context, in adminin.GetPermissionsInp) (res *adminin.GetPermissionsModel, err error)
|
|
||||||
UpdatePermissions(ctx context.Context, in adminin.UpdatePermissionsInp) (err error)
|
|
||||||
Edit(ctx context.Context, in adminin.RoleEditInp) (err error)
|
|
||||||
Delete(ctx context.Context, in adminin.RoleDeleteInp) (err error)
|
|
||||||
DataScopeSelect() (res form.Selects)
|
|
||||||
DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error)
|
|
||||||
}
|
|
||||||
IAdminSite interface {
|
|
||||||
Register(ctx context.Context, in adminin.RegisterInp) (err error)
|
|
||||||
AccountLogin(ctx context.Context, in adminin.AccountLoginInp) (res *adminin.LoginModel, err error)
|
|
||||||
MobileLogin(ctx context.Context, in adminin.MobileLoginInp) (res *adminin.LoginModel, err error)
|
|
||||||
}
|
|
||||||
IAdminCash interface {
|
|
||||||
View(ctx context.Context, in adminin.CashViewInp) (res *adminin.CashViewModel, err error)
|
|
||||||
List(ctx context.Context, in adminin.CashListInp) (list []*adminin.CashListModel, totalCount int, err error)
|
|
||||||
Apply(ctx context.Context, in adminin.CashApplyInp) (err error)
|
|
||||||
Payment(ctx context.Context, in adminin.CashPaymentInp) (err error)
|
|
||||||
}
|
|
||||||
IAdminCreditsLog interface {
|
|
||||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
|
||||||
SaveBalance(ctx context.Context, in adminin.CreditsLogSaveBalanceInp) (res *adminin.CreditsLogSaveBalanceModel, err error)
|
|
||||||
SaveIntegral(ctx context.Context, in adminin.CreditsLogSaveIntegralInp) (res *adminin.CreditsLogSaveIntegralModel, err error)
|
|
||||||
List(ctx context.Context, in adminin.CreditsLogListInp) (list []*adminin.CreditsLogListModel, totalCount int, err error)
|
|
||||||
Export(ctx context.Context, in adminin.CreditsLogListInp) (err error)
|
|
||||||
}
|
|
||||||
IAdminMenu interface {
|
IAdminMenu interface {
|
||||||
MaxSort(ctx context.Context, req *menu.MaxSortReq) (res *menu.MaxSortRes, err error)
|
MaxSort(ctx context.Context, req *menu.MaxSortReq) (res *menu.MaxSortRes, err error)
|
||||||
NameUnique(ctx context.Context, req *menu.NameUniqueReq) (res *menu.NameUniqueRes, err error)
|
NameUnique(ctx context.Context, req *menu.NameUniqueReq) (res *menu.NameUniqueRes, err error)
|
||||||
@ -124,46 +138,32 @@ type (
|
|||||||
GetMenuList(ctx context.Context, memberId int64) (res *role.DynamicRes, err error)
|
GetMenuList(ctx context.Context, memberId int64) (res *role.DynamicRes, err error)
|
||||||
LoginPermissions(ctx context.Context, memberId int64) (lists adminin.MemberLoginPermissions, err error)
|
LoginPermissions(ctx context.Context, memberId int64) (lists adminin.MemberLoginPermissions, err error)
|
||||||
}
|
}
|
||||||
IAdminNotice interface {
|
|
||||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
|
||||||
Delete(ctx context.Context, in adminin.NoticeDeleteInp) (err error)
|
|
||||||
Edit(ctx context.Context, in adminin.NoticeEditInp) (err error)
|
|
||||||
Status(ctx context.Context, in adminin.NoticeStatusInp) (err error)
|
|
||||||
MaxSort(ctx context.Context, in adminin.NoticeMaxSortInp) (res *adminin.NoticeMaxSortModel, err error)
|
|
||||||
View(ctx context.Context, in adminin.NoticeViewInp) (res *adminin.NoticeViewModel, err error)
|
|
||||||
List(ctx context.Context, in adminin.NoticeListInp) (list []*adminin.NoticeListModel, totalCount int, err error)
|
|
||||||
PullMessages(ctx context.Context, in adminin.PullMessagesInp) (res *adminin.PullMessagesModel, err error)
|
|
||||||
UnreadCount(ctx context.Context, in adminin.NoticeUnreadCountInp) (res *adminin.NoticeUnreadCountModel, err error)
|
|
||||||
UpRead(ctx context.Context, in adminin.NoticeUpReadInp) (err error)
|
|
||||||
ReadAll(ctx context.Context, in adminin.NoticeReadAllInp) (err error)
|
|
||||||
MessageList(ctx context.Context, in adminin.NoticeMessageListInp) (list []*adminin.NoticeMessageListModel, totalCount int, err error)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
localAdminCash IAdminCash
|
|
||||||
localAdminCreditsLog IAdminCreditsLog
|
localAdminCreditsLog IAdminCreditsLog
|
||||||
localAdminMenu IAdminMenu
|
|
||||||
localAdminNotice IAdminNotice
|
|
||||||
localAdminPost IAdminPost
|
|
||||||
localAdminRole IAdminRole
|
|
||||||
localAdminSite IAdminSite
|
|
||||||
localAdminDept IAdminDept
|
|
||||||
localAdminMember IAdminMember
|
localAdminMember IAdminMember
|
||||||
localAdminMemberPost IAdminMemberPost
|
localAdminMemberPost IAdminMemberPost
|
||||||
|
localAdminMenu IAdminMenu
|
||||||
|
localAdminPost IAdminPost
|
||||||
|
localAdminRole IAdminRole
|
||||||
|
localAdminCash IAdminCash
|
||||||
|
localAdminDept IAdminDept
|
||||||
localAdminMonitor IAdminMonitor
|
localAdminMonitor IAdminMonitor
|
||||||
|
localAdminNotice IAdminNotice
|
||||||
localAdminOrder IAdminOrder
|
localAdminOrder IAdminOrder
|
||||||
|
localAdminSite IAdminSite
|
||||||
)
|
)
|
||||||
|
|
||||||
func AdminDept() IAdminDept {
|
func AdminCreditsLog() IAdminCreditsLog {
|
||||||
if localAdminDept == nil {
|
if localAdminCreditsLog == nil {
|
||||||
panic("implement not found for interface IAdminDept, forgot register?")
|
panic("implement not found for interface IAdminCreditsLog, forgot register?")
|
||||||
}
|
}
|
||||||
return localAdminDept
|
return localAdminCreditsLog
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterAdminDept(i IAdminDept) {
|
func RegisterAdminCreditsLog(i IAdminCreditsLog) {
|
||||||
localAdminDept = i
|
localAdminCreditsLog = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func AdminMember() IAdminMember {
|
func AdminMember() IAdminMember {
|
||||||
@ -188,50 +188,6 @@ func RegisterAdminMemberPost(i IAdminMemberPost) {
|
|||||||
localAdminMemberPost = i
|
localAdminMemberPost = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func AdminMonitor() IAdminMonitor {
|
|
||||||
if localAdminMonitor == nil {
|
|
||||||
panic("implement not found for interface IAdminMonitor, forgot register?")
|
|
||||||
}
|
|
||||||
return localAdminMonitor
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterAdminMonitor(i IAdminMonitor) {
|
|
||||||
localAdminMonitor = i
|
|
||||||
}
|
|
||||||
|
|
||||||
func AdminOrder() IAdminOrder {
|
|
||||||
if localAdminOrder == nil {
|
|
||||||
panic("implement not found for interface IAdminOrder, forgot register?")
|
|
||||||
}
|
|
||||||
return localAdminOrder
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterAdminOrder(i IAdminOrder) {
|
|
||||||
localAdminOrder = i
|
|
||||||
}
|
|
||||||
|
|
||||||
func AdminCash() IAdminCash {
|
|
||||||
if localAdminCash == nil {
|
|
||||||
panic("implement not found for interface IAdminCash, forgot register?")
|
|
||||||
}
|
|
||||||
return localAdminCash
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterAdminCash(i IAdminCash) {
|
|
||||||
localAdminCash = i
|
|
||||||
}
|
|
||||||
|
|
||||||
func AdminCreditsLog() IAdminCreditsLog {
|
|
||||||
if localAdminCreditsLog == nil {
|
|
||||||
panic("implement not found for interface IAdminCreditsLog, forgot register?")
|
|
||||||
}
|
|
||||||
return localAdminCreditsLog
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterAdminCreditsLog(i IAdminCreditsLog) {
|
|
||||||
localAdminCreditsLog = i
|
|
||||||
}
|
|
||||||
|
|
||||||
func AdminMenu() IAdminMenu {
|
func AdminMenu() IAdminMenu {
|
||||||
if localAdminMenu == nil {
|
if localAdminMenu == nil {
|
||||||
panic("implement not found for interface IAdminMenu, forgot register?")
|
panic("implement not found for interface IAdminMenu, forgot register?")
|
||||||
@ -243,17 +199,6 @@ func RegisterAdminMenu(i IAdminMenu) {
|
|||||||
localAdminMenu = i
|
localAdminMenu = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func AdminNotice() IAdminNotice {
|
|
||||||
if localAdminNotice == nil {
|
|
||||||
panic("implement not found for interface IAdminNotice, forgot register?")
|
|
||||||
}
|
|
||||||
return localAdminNotice
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterAdminNotice(i IAdminNotice) {
|
|
||||||
localAdminNotice = i
|
|
||||||
}
|
|
||||||
|
|
||||||
func AdminPost() IAdminPost {
|
func AdminPost() IAdminPost {
|
||||||
if localAdminPost == nil {
|
if localAdminPost == nil {
|
||||||
panic("implement not found for interface IAdminPost, forgot register?")
|
panic("implement not found for interface IAdminPost, forgot register?")
|
||||||
@ -276,6 +221,61 @@ func RegisterAdminRole(i IAdminRole) {
|
|||||||
localAdminRole = i
|
localAdminRole = i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AdminCash() IAdminCash {
|
||||||
|
if localAdminCash == nil {
|
||||||
|
panic("implement not found for interface IAdminCash, forgot register?")
|
||||||
|
}
|
||||||
|
return localAdminCash
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterAdminCash(i IAdminCash) {
|
||||||
|
localAdminCash = i
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdminDept() IAdminDept {
|
||||||
|
if localAdminDept == nil {
|
||||||
|
panic("implement not found for interface IAdminDept, forgot register?")
|
||||||
|
}
|
||||||
|
return localAdminDept
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterAdminDept(i IAdminDept) {
|
||||||
|
localAdminDept = i
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdminMonitor() IAdminMonitor {
|
||||||
|
if localAdminMonitor == nil {
|
||||||
|
panic("implement not found for interface IAdminMonitor, forgot register?")
|
||||||
|
}
|
||||||
|
return localAdminMonitor
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterAdminMonitor(i IAdminMonitor) {
|
||||||
|
localAdminMonitor = i
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdminNotice() IAdminNotice {
|
||||||
|
if localAdminNotice == nil {
|
||||||
|
panic("implement not found for interface IAdminNotice, forgot register?")
|
||||||
|
}
|
||||||
|
return localAdminNotice
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterAdminNotice(i IAdminNotice) {
|
||||||
|
localAdminNotice = i
|
||||||
|
}
|
||||||
|
|
||||||
|
func AdminOrder() IAdminOrder {
|
||||||
|
if localAdminOrder == nil {
|
||||||
|
panic("implement not found for interface IAdminOrder, forgot register?")
|
||||||
|
}
|
||||||
|
return localAdminOrder
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterAdminOrder(i IAdminOrder) {
|
||||||
|
localAdminOrder = i
|
||||||
|
}
|
||||||
|
|
||||||
func AdminSite() IAdminSite {
|
func AdminSite() IAdminSite {
|
||||||
if localAdminSite == nil {
|
if localAdminSite == nil {
|
||||||
panic("implement not found for interface IAdminSite, forgot register?")
|
panic("implement not found for interface IAdminSite, forgot register?")
|
||||||
|
@ -15,6 +15,7 @@ type (
|
|||||||
IMiddleware interface {
|
IMiddleware interface {
|
||||||
AdminAuth(r *ghttp.Request)
|
AdminAuth(r *ghttp.Request)
|
||||||
ApiAuth(r *ghttp.Request)
|
ApiAuth(r *ghttp.Request)
|
||||||
|
HomeAuth(r *ghttp.Request)
|
||||||
Ctx(r *ghttp.Request)
|
Ctx(r *ghttp.Request)
|
||||||
CORS(r *ghttp.Request)
|
CORS(r *ghttp.Request)
|
||||||
DemoLimit(r *ghttp.Request)
|
DemoLimit(r *ghttp.Request)
|
||||||
|
@ -29,11 +29,58 @@ type (
|
|||||||
UniqueId(ctx context.Context, in sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
|
UniqueId(ctx context.Context, in sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
|
||||||
Select(ctx context.Context, in sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
|
Select(ctx context.Context, in sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
|
||||||
}
|
}
|
||||||
ISysAttachment interface {
|
ISysSmsLog interface {
|
||||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
Delete(ctx context.Context, in sysin.SmsLogDeleteInp) (err error)
|
||||||
Delete(ctx context.Context, in sysin.AttachmentDeleteInp) (err error)
|
Edit(ctx context.Context, in sysin.SmsLogEditInp) (err error)
|
||||||
View(ctx context.Context, in sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
|
Status(ctx context.Context, in sysin.SmsLogStatusInp) (err error)
|
||||||
List(ctx context.Context, in sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
|
MaxSort(ctx context.Context, in sysin.SmsLogMaxSortInp) (res *sysin.SmsLogMaxSortModel, err error)
|
||||||
|
View(ctx context.Context, in sysin.SmsLogViewInp) (res *sysin.SmsLogViewModel, err error)
|
||||||
|
List(ctx context.Context, in sysin.SmsLogListInp) (list []*sysin.SmsLogListModel, totalCount int, err error)
|
||||||
|
SendCode(ctx context.Context, in sysin.SendCodeInp) (err error)
|
||||||
|
GetTemplate(ctx context.Context, template string, config *model.SmsConfig) (val string, err error)
|
||||||
|
AllowSend(ctx context.Context, models *entity.SysSmsLog, config *model.SmsConfig) (err error)
|
||||||
|
VerifyCode(ctx context.Context, in sysin.VerifyCodeInp) (err error)
|
||||||
|
}
|
||||||
|
ISysAddons interface {
|
||||||
|
List(ctx context.Context, in sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
|
||||||
|
Selects(ctx context.Context, in sysin.AddonsSelectsInp) (res *sysin.AddonsSelectsModel, err error)
|
||||||
|
Build(ctx context.Context, in sysin.AddonsBuildInp) (err error)
|
||||||
|
Install(ctx context.Context, in sysin.AddonsInstallInp) (err error)
|
||||||
|
Upgrade(ctx context.Context, in sysin.AddonsUpgradeInp) (err error)
|
||||||
|
UnInstall(ctx context.Context, in sysin.AddonsUnInstallInp) (err error)
|
||||||
|
}
|
||||||
|
ISysLoginLog interface {
|
||||||
|
Model(ctx context.Context) *gdb.Model
|
||||||
|
List(ctx context.Context, in sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
|
||||||
|
Export(ctx context.Context, in sysin.LoginLogListInp) (err error)
|
||||||
|
Delete(ctx context.Context, in sysin.LoginLogDeleteInp) (err error)
|
||||||
|
View(ctx context.Context, in sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
|
||||||
|
Push(ctx context.Context, in sysin.LoginLogPushInp)
|
||||||
|
RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
|
||||||
|
}
|
||||||
|
ISysLog interface {
|
||||||
|
Export(ctx context.Context, in sysin.LogListInp) (err error)
|
||||||
|
RealWrite(ctx context.Context, log entity.SysLog) (err error)
|
||||||
|
AutoLog(ctx context.Context) error
|
||||||
|
AnalysisLog(ctx context.Context) entity.SysLog
|
||||||
|
View(ctx context.Context, in sysin.LogViewInp) (res *sysin.LogViewModel, err error)
|
||||||
|
Delete(ctx context.Context, in sysin.LogDeleteInp) (err error)
|
||||||
|
List(ctx context.Context, in sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error)
|
||||||
|
}
|
||||||
|
ISysCronGroup interface {
|
||||||
|
Delete(ctx context.Context, in sysin.CronGroupDeleteInp) (err error)
|
||||||
|
Edit(ctx context.Context, in sysin.CronGroupEditInp) (err error)
|
||||||
|
Status(ctx context.Context, in sysin.CronGroupStatusInp) (err error)
|
||||||
|
MaxSort(ctx context.Context, in sysin.CronGroupMaxSortInp) (res *sysin.CronGroupMaxSortModel, err error)
|
||||||
|
View(ctx context.Context, in sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error)
|
||||||
|
List(ctx context.Context, in sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error)
|
||||||
|
Select(ctx context.Context, in sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error)
|
||||||
|
}
|
||||||
|
ISysDictData interface {
|
||||||
|
Delete(ctx context.Context, in sysin.DictDataDeleteInp) error
|
||||||
|
Edit(ctx context.Context, in sysin.DictDataEditInp) (err error)
|
||||||
|
List(ctx context.Context, in sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
|
||||||
|
Select(ctx context.Context, in sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
|
||||||
}
|
}
|
||||||
ISysCron interface {
|
ISysCron interface {
|
||||||
StartCron(ctx context.Context)
|
StartCron(ctx context.Context)
|
||||||
@ -45,15 +92,6 @@ type (
|
|||||||
List(ctx context.Context, in sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error)
|
List(ctx context.Context, in sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error)
|
||||||
OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err error)
|
OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err error)
|
||||||
}
|
}
|
||||||
ISysCronGroup interface {
|
|
||||||
Delete(ctx context.Context, in sysin.CronGroupDeleteInp) (err error)
|
|
||||||
Edit(ctx context.Context, in sysin.CronGroupEditInp) (err error)
|
|
||||||
Status(ctx context.Context, in sysin.CronGroupStatusInp) (err error)
|
|
||||||
MaxSort(ctx context.Context, in sysin.CronGroupMaxSortInp) (res *sysin.CronGroupMaxSortModel, err error)
|
|
||||||
View(ctx context.Context, in sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error)
|
|
||||||
List(ctx context.Context, in sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error)
|
|
||||||
Select(ctx context.Context, in sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error)
|
|
||||||
}
|
|
||||||
ISysGenCodes interface {
|
ISysGenCodes interface {
|
||||||
Delete(ctx context.Context, in sysin.GenCodesDeleteInp) (err error)
|
Delete(ctx context.Context, in sysin.GenCodesDeleteInp) (err error)
|
||||||
Edit(ctx context.Context, in sysin.GenCodesEditInp) (res *sysin.GenCodesEditModel, err error)
|
Edit(ctx context.Context, in sysin.GenCodesEditInp) (res *sysin.GenCodesEditModel, err error)
|
||||||
@ -83,32 +121,6 @@ type (
|
|||||||
VariableLoad(ctx context.Context, err error)
|
VariableLoad(ctx context.Context, err error)
|
||||||
Load(ctx context.Context)
|
Load(ctx context.Context)
|
||||||
}
|
}
|
||||||
ISysLoginLog interface {
|
|
||||||
Model(ctx context.Context) *gdb.Model
|
|
||||||
List(ctx context.Context, in sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
|
|
||||||
Export(ctx context.Context, in sysin.LoginLogListInp) (err error)
|
|
||||||
Delete(ctx context.Context, in sysin.LoginLogDeleteInp) (err error)
|
|
||||||
View(ctx context.Context, in sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
|
|
||||||
Push(ctx context.Context, in sysin.LoginLogPushInp)
|
|
||||||
RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
|
|
||||||
}
|
|
||||||
ISysDictData interface {
|
|
||||||
Delete(ctx context.Context, in sysin.DictDataDeleteInp) error
|
|
||||||
Edit(ctx context.Context, in sysin.DictDataEditInp) (err error)
|
|
||||||
List(ctx context.Context, in sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
|
|
||||||
Select(ctx context.Context, in sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
|
|
||||||
}
|
|
||||||
ISysEmsLog interface {
|
|
||||||
Delete(ctx context.Context, in sysin.EmsLogDeleteInp) (err error)
|
|
||||||
Edit(ctx context.Context, in sysin.EmsLogEditInp) (err error)
|
|
||||||
Status(ctx context.Context, in sysin.EmsLogStatusInp) (err error)
|
|
||||||
View(ctx context.Context, in sysin.EmsLogViewInp) (res *sysin.EmsLogViewModel, err error)
|
|
||||||
List(ctx context.Context, in sysin.EmsLogListInp) (list []*sysin.EmsLogListModel, totalCount int, err error)
|
|
||||||
Send(ctx context.Context, in sysin.SendEmsInp) (err error)
|
|
||||||
GetTemplate(ctx context.Context, template string, config *model.EmailConfig) (val string, err error)
|
|
||||||
AllowSend(ctx context.Context, models *entity.SysEmsLog, config *model.EmailConfig) (err error)
|
|
||||||
VerifyCode(ctx context.Context, in sysin.VerifyEmsCodeInp) (err error)
|
|
||||||
}
|
|
||||||
ISysCurdDemo interface {
|
ISysCurdDemo interface {
|
||||||
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||||
List(ctx context.Context, in sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
|
List(ctx context.Context, in sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
|
||||||
@ -126,14 +138,16 @@ type (
|
|||||||
Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error)
|
Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error)
|
||||||
TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error)
|
TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error)
|
||||||
}
|
}
|
||||||
ISysLog interface {
|
ISysEmsLog interface {
|
||||||
Export(ctx context.Context, in sysin.LogListInp) (err error)
|
Delete(ctx context.Context, in sysin.EmsLogDeleteInp) (err error)
|
||||||
RealWrite(ctx context.Context, log entity.SysLog) (err error)
|
Edit(ctx context.Context, in sysin.EmsLogEditInp) (err error)
|
||||||
AutoLog(ctx context.Context) error
|
Status(ctx context.Context, in sysin.EmsLogStatusInp) (err error)
|
||||||
AnalysisLog(ctx context.Context) entity.SysLog
|
View(ctx context.Context, in sysin.EmsLogViewInp) (res *sysin.EmsLogViewModel, err error)
|
||||||
View(ctx context.Context, in sysin.LogViewInp) (res *sysin.LogViewModel, err error)
|
List(ctx context.Context, in sysin.EmsLogListInp) (list []*sysin.EmsLogListModel, totalCount int, err error)
|
||||||
Delete(ctx context.Context, in sysin.LogDeleteInp) (err error)
|
Send(ctx context.Context, in sysin.SendEmsInp) (err error)
|
||||||
List(ctx context.Context, in sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error)
|
GetTemplate(ctx context.Context, template string, config *model.EmailConfig) (val string, err error)
|
||||||
|
AllowSend(ctx context.Context, models *entity.SysEmsLog, config *model.EmailConfig) (err error)
|
||||||
|
VerifyCode(ctx context.Context, in sysin.VerifyEmsCodeInp) (err error)
|
||||||
}
|
}
|
||||||
ISysServeLog interface {
|
ISysServeLog interface {
|
||||||
Model(ctx context.Context) *gdb.Model
|
Model(ctx context.Context) *gdb.Model
|
||||||
@ -143,25 +157,11 @@ type (
|
|||||||
View(ctx context.Context, in sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
|
View(ctx context.Context, in sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
|
||||||
RealWrite(ctx context.Context, models entity.SysServeLog) (err error)
|
RealWrite(ctx context.Context, models entity.SysServeLog) (err error)
|
||||||
}
|
}
|
||||||
ISysSmsLog interface {
|
ISysAttachment interface {
|
||||||
Delete(ctx context.Context, in sysin.SmsLogDeleteInp) (err error)
|
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
|
||||||
Edit(ctx context.Context, in sysin.SmsLogEditInp) (err error)
|
Delete(ctx context.Context, in sysin.AttachmentDeleteInp) (err error)
|
||||||
Status(ctx context.Context, in sysin.SmsLogStatusInp) (err error)
|
View(ctx context.Context, in sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
|
||||||
MaxSort(ctx context.Context, in sysin.SmsLogMaxSortInp) (res *sysin.SmsLogMaxSortModel, err error)
|
List(ctx context.Context, in sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
|
||||||
View(ctx context.Context, in sysin.SmsLogViewInp) (res *sysin.SmsLogViewModel, err error)
|
|
||||||
List(ctx context.Context, in sysin.SmsLogListInp) (list []*sysin.SmsLogListModel, totalCount int, err error)
|
|
||||||
SendCode(ctx context.Context, in sysin.SendCodeInp) (err error)
|
|
||||||
GetTemplate(ctx context.Context, template string, config *model.SmsConfig) (val string, err error)
|
|
||||||
AllowSend(ctx context.Context, models *entity.SysSmsLog, config *model.SmsConfig) (err error)
|
|
||||||
VerifyCode(ctx context.Context, in sysin.VerifyCodeInp) (err error)
|
|
||||||
}
|
|
||||||
ISysAddons interface {
|
|
||||||
List(ctx context.Context, in sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
|
|
||||||
Selects(ctx context.Context, in sysin.AddonsSelectsInp) (res *sysin.AddonsSelectsModel, err error)
|
|
||||||
Build(ctx context.Context, in sysin.AddonsBuildInp) (err error)
|
|
||||||
Install(ctx context.Context, in sysin.AddonsInstallInp) (err error)
|
|
||||||
Upgrade(ctx context.Context, in sysin.AddonsUpgradeInp) (err error)
|
|
||||||
UnInstall(ctx context.Context, in sysin.AddonsUnInstallInp) (err error)
|
|
||||||
}
|
}
|
||||||
ISysConfig interface {
|
ISysConfig interface {
|
||||||
InitConfig(ctx context.Context)
|
InitConfig(ctx context.Context)
|
||||||
@ -186,23 +186,23 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
localSysBlacklist ISysBlacklist
|
localSysAddons ISysAddons
|
||||||
localSysCronGroup ISysCronGroup
|
|
||||||
localSysGenCodes ISysGenCodes
|
|
||||||
localSysAddonsConfig ISysAddonsConfig
|
|
||||||
localSysEmsLog ISysEmsLog
|
|
||||||
localSysLoginLog ISysLoginLog
|
localSysLoginLog ISysLoginLog
|
||||||
|
localSysProvinces ISysProvinces
|
||||||
|
localSysSmsLog ISysSmsLog
|
||||||
|
localSysCronGroup ISysCronGroup
|
||||||
localSysDictData ISysDictData
|
localSysDictData ISysDictData
|
||||||
|
localSysLog ISysLog
|
||||||
|
localSysAddonsConfig ISysAddonsConfig
|
||||||
|
localSysBlacklist ISysBlacklist
|
||||||
|
localSysCron ISysCron
|
||||||
|
localSysGenCodes ISysGenCodes
|
||||||
|
localSysAttachment ISysAttachment
|
||||||
localSysConfig ISysConfig
|
localSysConfig ISysConfig
|
||||||
localSysCurdDemo ISysCurdDemo
|
localSysCurdDemo ISysCurdDemo
|
||||||
localSysDictType ISysDictType
|
localSysDictType ISysDictType
|
||||||
localSysLog ISysLog
|
localSysEmsLog ISysEmsLog
|
||||||
localSysServeLog ISysServeLog
|
localSysServeLog ISysServeLog
|
||||||
localSysSmsLog ISysSmsLog
|
|
||||||
localSysAddons ISysAddons
|
|
||||||
localSysCron ISysCron
|
|
||||||
localSysProvinces ISysProvinces
|
|
||||||
localSysAttachment ISysAttachment
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func SysBlacklist() ISysBlacklist {
|
func SysBlacklist() ISysBlacklist {
|
||||||
@ -216,15 +216,15 @@ func RegisterSysBlacklist(i ISysBlacklist) {
|
|||||||
localSysBlacklist = i
|
localSysBlacklist = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func SysCronGroup() ISysCronGroup {
|
func SysCron() ISysCron {
|
||||||
if localSysCronGroup == nil {
|
if localSysCron == nil {
|
||||||
panic("implement not found for interface ISysCronGroup, forgot register?")
|
panic("implement not found for interface ISysCron, forgot register?")
|
||||||
}
|
}
|
||||||
return localSysCronGroup
|
return localSysCron
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterSysCronGroup(i ISysCronGroup) {
|
func RegisterSysCron(i ISysCron) {
|
||||||
localSysCronGroup = i
|
localSysCron = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func SysGenCodes() ISysGenCodes {
|
func SysGenCodes() ISysGenCodes {
|
||||||
@ -249,39 +249,6 @@ func RegisterSysAddonsConfig(i ISysAddonsConfig) {
|
|||||||
localSysAddonsConfig = i
|
localSysAddonsConfig = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func SysEmsLog() ISysEmsLog {
|
|
||||||
if localSysEmsLog == nil {
|
|
||||||
panic("implement not found for interface ISysEmsLog, forgot register?")
|
|
||||||
}
|
|
||||||
return localSysEmsLog
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterSysEmsLog(i ISysEmsLog) {
|
|
||||||
localSysEmsLog = i
|
|
||||||
}
|
|
||||||
|
|
||||||
func SysLoginLog() ISysLoginLog {
|
|
||||||
if localSysLoginLog == nil {
|
|
||||||
panic("implement not found for interface ISysLoginLog, forgot register?")
|
|
||||||
}
|
|
||||||
return localSysLoginLog
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterSysLoginLog(i ISysLoginLog) {
|
|
||||||
localSysLoginLog = i
|
|
||||||
}
|
|
||||||
|
|
||||||
func SysDictData() ISysDictData {
|
|
||||||
if localSysDictData == nil {
|
|
||||||
panic("implement not found for interface ISysDictData, forgot register?")
|
|
||||||
}
|
|
||||||
return localSysDictData
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterSysDictData(i ISysDictData) {
|
|
||||||
localSysDictData = i
|
|
||||||
}
|
|
||||||
|
|
||||||
func SysConfig() ISysConfig {
|
func SysConfig() ISysConfig {
|
||||||
if localSysConfig == nil {
|
if localSysConfig == nil {
|
||||||
panic("implement not found for interface ISysConfig, forgot register?")
|
panic("implement not found for interface ISysConfig, forgot register?")
|
||||||
@ -315,15 +282,15 @@ func RegisterSysDictType(i ISysDictType) {
|
|||||||
localSysDictType = i
|
localSysDictType = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func SysLog() ISysLog {
|
func SysEmsLog() ISysEmsLog {
|
||||||
if localSysLog == nil {
|
if localSysEmsLog == nil {
|
||||||
panic("implement not found for interface ISysLog, forgot register?")
|
panic("implement not found for interface ISysEmsLog, forgot register?")
|
||||||
}
|
}
|
||||||
return localSysLog
|
return localSysEmsLog
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterSysLog(i ISysLog) {
|
func RegisterSysEmsLog(i ISysEmsLog) {
|
||||||
localSysLog = i
|
localSysEmsLog = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func SysServeLog() ISysServeLog {
|
func SysServeLog() ISysServeLog {
|
||||||
@ -337,6 +304,39 @@ func RegisterSysServeLog(i ISysServeLog) {
|
|||||||
localSysServeLog = i
|
localSysServeLog = i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SysAttachment() ISysAttachment {
|
||||||
|
if localSysAttachment == nil {
|
||||||
|
panic("implement not found for interface ISysAttachment, forgot register?")
|
||||||
|
}
|
||||||
|
return localSysAttachment
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterSysAttachment(i ISysAttachment) {
|
||||||
|
localSysAttachment = i
|
||||||
|
}
|
||||||
|
|
||||||
|
func SysLoginLog() ISysLoginLog {
|
||||||
|
if localSysLoginLog == nil {
|
||||||
|
panic("implement not found for interface ISysLoginLog, forgot register?")
|
||||||
|
}
|
||||||
|
return localSysLoginLog
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterSysLoginLog(i ISysLoginLog) {
|
||||||
|
localSysLoginLog = i
|
||||||
|
}
|
||||||
|
|
||||||
|
func SysProvinces() ISysProvinces {
|
||||||
|
if localSysProvinces == nil {
|
||||||
|
panic("implement not found for interface ISysProvinces, forgot register?")
|
||||||
|
}
|
||||||
|
return localSysProvinces
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterSysProvinces(i ISysProvinces) {
|
||||||
|
localSysProvinces = i
|
||||||
|
}
|
||||||
|
|
||||||
func SysSmsLog() ISysSmsLog {
|
func SysSmsLog() ISysSmsLog {
|
||||||
if localSysSmsLog == nil {
|
if localSysSmsLog == nil {
|
||||||
panic("implement not found for interface ISysSmsLog, forgot register?")
|
panic("implement not found for interface ISysSmsLog, forgot register?")
|
||||||
@ -359,35 +359,35 @@ func RegisterSysAddons(i ISysAddons) {
|
|||||||
localSysAddons = i
|
localSysAddons = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func SysCron() ISysCron {
|
func SysDictData() ISysDictData {
|
||||||
if localSysCron == nil {
|
if localSysDictData == nil {
|
||||||
panic("implement not found for interface ISysCron, forgot register?")
|
panic("implement not found for interface ISysDictData, forgot register?")
|
||||||
}
|
}
|
||||||
return localSysCron
|
return localSysDictData
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterSysCron(i ISysCron) {
|
func RegisterSysDictData(i ISysDictData) {
|
||||||
localSysCron = i
|
localSysDictData = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func SysProvinces() ISysProvinces {
|
func SysLog() ISysLog {
|
||||||
if localSysProvinces == nil {
|
if localSysLog == nil {
|
||||||
panic("implement not found for interface ISysProvinces, forgot register?")
|
panic("implement not found for interface ISysLog, forgot register?")
|
||||||
}
|
}
|
||||||
return localSysProvinces
|
return localSysLog
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterSysProvinces(i ISysProvinces) {
|
func RegisterSysLog(i ISysLog) {
|
||||||
localSysProvinces = i
|
localSysLog = i
|
||||||
}
|
}
|
||||||
|
|
||||||
func SysAttachment() ISysAttachment {
|
func SysCronGroup() ISysCronGroup {
|
||||||
if localSysAttachment == nil {
|
if localSysCronGroup == nil {
|
||||||
panic("implement not found for interface ISysAttachment, forgot register?")
|
panic("implement not found for interface ISysCronGroup, forgot register?")
|
||||||
}
|
}
|
||||||
return localSysAttachment
|
return localSysCronGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterSysAttachment(i ISysAttachment) {
|
func RegisterSysCronGroup(i ISysCronGroup) {
|
||||||
localSysAttachment = i
|
localSysCronGroup = i
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
IAuthClient interface {
|
||||||
|
Start(ctx context.Context)
|
||||||
|
Stop(ctx context.Context)
|
||||||
|
IsLogin() bool
|
||||||
|
OnResponseAuthSummary(ctx context.Context, args ...interface{})
|
||||||
|
}
|
||||||
ICronClient interface {
|
ICronClient interface {
|
||||||
Start(ctx context.Context)
|
Start(ctx context.Context)
|
||||||
Stop(ctx context.Context)
|
Stop(ctx context.Context)
|
||||||
@ -19,12 +25,6 @@ type (
|
|||||||
OnCronStatus(ctx context.Context, args ...interface{})
|
OnCronStatus(ctx context.Context, args ...interface{})
|
||||||
OnCronOnlineExec(ctx context.Context, args ...interface{})
|
OnCronOnlineExec(ctx context.Context, args ...interface{})
|
||||||
}
|
}
|
||||||
IAuthClient interface {
|
|
||||||
Start(ctx context.Context)
|
|
||||||
Stop(ctx context.Context)
|
|
||||||
IsLogin() bool
|
|
||||||
OnResponseAuthSummary(ctx context.Context, args ...interface{})
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -16,11 +16,6 @@ type (
|
|||||||
GetTitle(ctx context.Context, in *model.ViewGetTitleInput) string
|
GetTitle(ctx context.Context, in *model.ViewGetTitleInput) string
|
||||||
RenderTpl(ctx context.Context, tpl string, data ...model.View)
|
RenderTpl(ctx context.Context, tpl string, data ...model.View)
|
||||||
Render(ctx context.Context, data ...model.View)
|
Render(ctx context.Context, data ...model.View)
|
||||||
Render302(ctx context.Context, data ...model.View)
|
|
||||||
Render401(ctx context.Context, data ...model.View)
|
|
||||||
Render403(ctx context.Context, data ...model.View)
|
|
||||||
Render404(ctx context.Context, data ...model.View)
|
|
||||||
Render500(ctx context.Context, data ...model.View)
|
|
||||||
Error(ctx context.Context, err error)
|
Error(ctx context.Context, err error)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
94
server/resource/template/error/default.html
Normal file
94
server/resource/template/error/default.html
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-cmn-Hans">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/>
|
||||||
|
<title>错误页面</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
margin: 0;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 85%;
|
||||||
|
margin: 50px auto;
|
||||||
|
padding: 40px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3em;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: 1.2em;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #007bff;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 3px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
background-color: #0069d9;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background-color: #f6f8fa;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.45;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 16px;
|
||||||
|
white-space: pre;
|
||||||
|
word-wrap: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre code {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
@{ if eq .code 404 }
|
||||||
|
<div class="container">
|
||||||
|
<h1>@{.code} 页面未找到</h1>
|
||||||
|
<p>抱歉,我们无法找到要求的页面。</p>
|
||||||
|
<a href="#" onclick="history.back()">返回</a>
|
||||||
|
</div>
|
||||||
|
@{ else if eq .code 403 }
|
||||||
|
<div class="container">
|
||||||
|
<h1>@{.code} 禁止访问</h1>
|
||||||
|
<p>抱歉,您无权访问此页面。</p>
|
||||||
|
<a href="#" onclick="history.back()">返回</a>
|
||||||
|
</div>
|
||||||
|
@{ else if eq .code 500 }
|
||||||
|
<div class="container">
|
||||||
|
<h1>@{.code} 内部服务器错误</h1>
|
||||||
|
<p>哎呀,服务器出了点问题。</p>
|
||||||
|
<a href="#" onclick="history.back()">返回</a>
|
||||||
|
</div>
|
||||||
|
@{else}
|
||||||
|
<div class="container">
|
||||||
|
<h1>错误码 [ @{.code} ]</h1>
|
||||||
|
<p>@{.message}</p>
|
||||||
|
@{ if ne .stack "" }
|
||||||
|
<pre><code>@{.stack}</code></pre>
|
||||||
|
@{end}
|
||||||
|
<a href="#" onclick="history.back()">返回</a>
|
||||||
|
</div>
|
||||||
|
@{end}
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -6,9 +6,11 @@
|
|||||||
package charset
|
package charset
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"github.com/gogf/gf/v2/errors/gerror"
|
"github.com/gogf/gf/v2/errors/gerror"
|
||||||
"github.com/gogf/gf/v2/text/gstr"
|
"github.com/gogf/gf/v2/text/gstr"
|
||||||
|
"github.com/gogf/gf/v2/util/gutil"
|
||||||
r "math/rand"
|
r "math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -48,6 +50,16 @@ func ParseStack(st string) []string {
|
|||||||
return stack
|
return stack
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SerializeStack 解析错误并序列化堆栈信息
|
||||||
|
func SerializeStack(err error) string {
|
||||||
|
buffer := bytes.NewBuffer(nil)
|
||||||
|
gutil.DumpTo(buffer, ParseErrStack(err), gutil.DumpOption{
|
||||||
|
WithType: false,
|
||||||
|
ExportedOnly: false,
|
||||||
|
})
|
||||||
|
return buffer.String()
|
||||||
|
}
|
||||||
|
|
||||||
// SubstrAfter 截取指定字符后的内容
|
// SubstrAfter 截取指定字符后的内容
|
||||||
func SubstrAfter(str string, symbol string) string {
|
func SubstrAfter(str string, symbol string) string {
|
||||||
comma := strings.Index(str, symbol)
|
comma := strings.Index(str, symbol)
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"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"
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
|
"github.com/gogf/gf/v2/os/gfile"
|
||||||
"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"
|
||||||
@ -46,6 +47,11 @@ func FilterMaskDemo(ctx context.Context, src g.Map) g.Map {
|
|||||||
return src
|
return src
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DefaultErrorTplContent 获取默认的错误模板内容
|
||||||
|
func DefaultErrorTplContent(ctx context.Context) string {
|
||||||
|
return gfile.GetContents(g.Cfg().MustGet(ctx, "viewer.paths").String() + "/error/default.html")
|
||||||
|
}
|
||||||
|
|
||||||
// DecryptText 解密文本
|
// DecryptText 解密文本
|
||||||
func DecryptText(text string) (string, error) {
|
func DecryptText(text string) (string, error) {
|
||||||
str, err := gbase64.Decode([]byte(text))
|
str, err := gbase64.Decode([]byte(text))
|
||||||
|
Loading…
Reference in New Issue
Block a user