Merge pull request #20 from bufanyun/v2.0

模块化定时任务,方便在插件中注册任务;增加日志分组
This commit is contained in:
maxbad 2023-06-06 10:12:36 +08:00 committed by GitHub
commit ea56de7e2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 820 additions and 783 deletions

View File

@ -25,6 +25,7 @@ type ListRes struct {
type SelectsReq struct {
g.Meta `path:"/addons/selects" method:"get" tags:"插件管理" summary:"生成入口选项"`
}
type SelectsRes struct {
*sysin.AddonsSelectsModel
}
@ -34,6 +35,7 @@ type BuildReq struct {
g.Meta `path:"/addons/build" method:"post" tags:"插件管理" summary:"提交生成"`
sysin.AddonsBuildInp
}
type BuildRes struct {
}
@ -42,6 +44,7 @@ type InstallReq struct {
g.Meta `path:"/addons/install" method:"post" tags:"插件管理" summary:"安装模块"`
sysin.AddonsInstallInp
}
type InstallRes struct {
}
@ -50,6 +53,7 @@ type UpgradeReq struct {
g.Meta `path:"/addons/upgrade" method:"post" tags:"插件管理" summary:"更新模块"`
sysin.AddonsUpgradeInp
}
type UpgradeRes struct {
}
@ -58,5 +62,6 @@ type UnInstallReq struct {
g.Meta `path:"/addons/uninstall" method:"post" tags:"插件管理" summary:"卸载模块"`
sysin.AddonsUnInstallInp
}
type UnInstallRes struct {
}

View File

@ -31,6 +31,7 @@ type ViewReq struct {
Id int64 `json:"id" v:"required#附件ID不能为空" dc:"附件ID"`
g.Meta `path:"/attachment/view" method:"get" tags:"附件" summary:"获取指定附件信息"`
}
type ViewRes struct {
*sysin.AttachmentViewModel
}
@ -40,4 +41,5 @@ type DeleteReq struct {
Id interface{} `json:"id" v:"required#附件ID不能为空" dc:"附件ID"`
g.Meta `path:"/attachment/delete" method:"post" tags:"附件" summary:"删除附件"`
}
type DeleteRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package blacklist
import (
@ -33,6 +32,7 @@ type ViewReq struct {
Id int64 `json:"id" v:"required#黑名单ID不能为空" dc:"黑名单ID"`
g.Meta `path:"/blacklist/view" method:"get" tags:"黑名单" summary:"获取指定信息"`
}
type ViewRes struct {
*sysin.BlacklistViewModel
}
@ -42,6 +42,7 @@ type EditReq struct {
entity.SysBlacklist
g.Meta `path:"/blacklist/edit" method:"post" tags:"黑名单" summary:"修改/新增黑名单"`
}
type EditRes struct{}
// DeleteReq 删除
@ -49,6 +50,7 @@ type DeleteReq struct {
Id interface{} `json:"id" v:"required#黑名单ID不能为空" dc:"黑名单ID"`
g.Meta `path:"/blacklist/delete" method:"post" tags:"黑名单" summary:"删除黑名单"`
}
type DeleteRes struct{}
// MaxSortReq 最大排序
@ -56,6 +58,7 @@ type MaxSortReq struct {
Id int64 `json:"id" dc:"黑名单ID"`
g.Meta `path:"/blacklist/maxSort" method:"get" tags:"黑名单" summary:"黑名单最大排序"`
}
type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"`
}
@ -65,4 +68,5 @@ type StatusReq struct {
entity.SysBlacklist
g.Meta `path:"/blacklist/status" method:"post" tags:"黑名单" summary:"更新黑名单状态"`
}
type StatusRes struct{}

View File

@ -27,6 +27,7 @@ type ViewReq struct {
g.Meta `path:"/cash/view" method:"get" tags:"提现" summary:"获取指定信息"`
adminin.CashViewInp
}
type ViewRes struct {
*adminin.CashViewModel
}
@ -36,6 +37,7 @@ type ApplyReq struct {
Money float64 `json:"money" description:"提现金额"`
g.Meta `path:"/cash/apply" method:"post" tags:"提现" summary:"申请提现"`
}
type ApplyRes struct{}
// PaymentReq 提现打款处理
@ -45,4 +47,5 @@ type PaymentReq struct {
Msg string `json:"msg" description:"处理结果"`
g.Meta `path:"/cash/payment" method:"post" tags:"提现" summary:"提现打款处理"`
}
type PaymentRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package common
import "github.com/gogf/gf/v2/frame/g"
@ -12,6 +11,7 @@ import "github.com/gogf/gf/v2/frame/g"
type ConsoleStatReq struct {
g.Meta `path:"/console/stat" method:"get" tags:"控制台" summary:"综合数据统计"`
}
type ConsoleStatRes struct {
Visits struct {
DayVisits float64 `json:"dayVisits"`

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package common
import (
@ -15,6 +14,7 @@ type SendTestEmailReq struct {
To string `json:"to" v:"required#接收者邮件不能为空" dc:"接收者邮件,多个用;隔开"`
g.Meta `path:"/ems/sendTest" tags:"邮件" method:"post" summary:"发送测试邮件"`
}
type SendTestEmailRes struct {
}
@ -22,5 +22,6 @@ type SendTestEmailRes struct {
type SendBindEmsReq struct {
g.Meta `path:"/ems/sendBind" tags:"邮件" method:"post" summary:"发送换绑邮件"`
}
type SendBindEmsRes struct {
}

View File

@ -15,6 +15,7 @@ import (
type LoginLogoutReq struct {
g.Meta `path:"/site/logout" method:"post" tags:"后台基础" summary:"注销登录"`
}
type LoginLogoutRes struct{}
// RegisterReq 提交账号注册
@ -22,6 +23,7 @@ type RegisterReq struct {
g.Meta `path:"/site/register" method:"post" tags:"后台基础" summary:"账号注册"`
adminin.RegisterInp
}
type RegisterRes struct {
*adminin.LoginModel
}
@ -30,6 +32,7 @@ type RegisterRes struct {
type LoginCaptchaReq struct {
g.Meta `path:"/site/captcha" method:"get" tags:"后台基础" summary:"获取登录验证码"`
}
type LoginCaptchaRes struct {
Cid string `json:"cid" dc:"验证码ID"`
Base64 string `json:"base64" dc:"验证码"`
@ -40,6 +43,7 @@ type AccountLoginReq struct {
g.Meta `path:"/site/accountLogin" method:"post" tags:"后台基础" summary:"账号登录"`
adminin.AccountLoginInp
}
type AccountLoginRes struct {
*adminin.LoginModel
}
@ -49,6 +53,7 @@ type MobileLoginReq struct {
g.Meta `path:"/site/mobileLogin" method:"post" tags:"后台基础" summary:"手机号登录"`
adminin.MobileLoginInp
}
type MobileLoginRes struct {
*adminin.LoginModel
}
@ -57,6 +62,7 @@ type MobileLoginRes struct {
type SiteConfigReq struct {
g.Meta `path:"/site/config" method:"get" tags:"后台基础" summary:"获取配置"`
}
type SiteConfigRes struct {
Version string `json:"version" dc:"系统版本"`
WsAddr string `json:"wsAddr" dc:"客户端websocket地址"`
@ -68,6 +74,7 @@ type SiteConfigRes struct {
type SiteLoginConfigReq struct {
g.Meta `path:"/site/loginConfig" method:"get" tags:"后台基础" summary:"获取登录配置"`
}
type SiteLoginConfigRes struct {
*model.LoginConfig
}
@ -76,4 +83,5 @@ type SiteLoginConfigRes struct {
type SitePingReq struct {
g.Meta `path:"/site/ping" method:"get" tags:"后台基础" summary:"ping"`
}
type SitePingRes struct{}

View File

@ -14,6 +14,7 @@ type SendTestSmsReq struct {
Code string `json:"code" v:"required#接收验证码不能为空" dc:"接收验证码"`
g.Meta `path:"/sms/sendTest" tags:"短信" method:"post" summary:"发送测试短信"`
}
type SendTestSmsRes struct {
}
@ -21,6 +22,7 @@ type SendTestSmsRes struct {
type SendBindSmsReq struct {
g.Meta `path:"/sms/sendBind" tags:"短信" method:"post" summary:"发送换绑短信"`
}
type SendBindSmsRes struct {
}
@ -30,5 +32,6 @@ type SendSmsReq struct {
Event string `json:"event" v:"required#事件模板不能为空" dc:"事件模板"`
Mobile string `json:"mobile" v:"required#接收手机号不能为空" dc:"接收手机号"`
}
type SendSmsRes struct {
}

View File

@ -15,6 +15,7 @@ type WechatAuthorizeReq struct {
g.Meta `path:"/wechat/authorize" method:"get" tags:"微信" summary:"微信用户授权"`
commonin.WechatAuthorizeInp
}
type WechatAuthorizeRes struct {
*commonin.WechatAuthorizeModel
}
@ -24,6 +25,7 @@ type WechatAuthorizeCallReq struct {
g.Meta `path:"/wechat/authorizeCall" method:"get" tags:"微信" summary:"微信用户授权"`
commonin.WechatAuthorizeCallInp
}
type WechatAuthorizeCallRes struct {
*commonin.WechatAuthorizeCallModel
}

View File

@ -16,6 +16,7 @@ type GetReq struct {
Group string `json:"group" dc:"分组名称" v:"required#分组名称不能为空" `
g.Meta `path:"/config/get" method:"get" tags:"配置" summary:"获取指定分组的配置"`
}
type GetRes struct {
*sysin.GetConfigModel
}
@ -26,6 +27,7 @@ type UpdateReq struct {
List g.Map `json:"list" dc:"更新配置列表" `
g.Meta `path:"/config/update" method:"post" tags:"配置" summary:"获取指定分组的配置"`
}
type UpdateRes struct {
}
@ -33,12 +35,14 @@ type UpdateRes struct {
type TypeSelectReq struct {
g.Meta `path:"/config/typeSelect" method:"get" tags:"配置" summary:"数据类型选项"`
}
type TypeSelectRes []form.Select
// GetCashReq 获取提现配置
type GetCashReq struct {
g.Meta `path:"/config/getCash" method:"get" tags:"配置" summary:"获取提现配置"`
}
type GetCashRes struct {
*sysin.GetConfigModel
}

View File

@ -36,6 +36,7 @@ type ExportRes struct{}
type OptionReq struct {
g.Meta `path:"/creditsLog/option" method:"get" summary:"资产变动" tags:"获取变动状态选项"`
}
type OptionRes struct {
CreditType []g.Map `json:"creditType" dc:"变动类型 "`
CreditGroup []g.Map `json:"creditGroup" dc:"变动组别"`

View File

@ -27,6 +27,7 @@ type ViewReq struct {
g.Meta `path:"/cron/view" method:"get" tags:"定时任务" summary:"获取指定信息"`
sysin.CronViewInp
}
type ViewRes struct {
*sysin.CronViewModel
}
@ -36,6 +37,7 @@ type EditReq struct {
g.Meta `path:"/cron/edit" method:"post" tags:"定时任务" summary:"修改/新增定时任务"`
sysin.CronEditInp
}
type EditRes struct {
*sysin.CronEditModel
}
@ -45,6 +47,7 @@ type DeleteReq struct {
g.Meta `path:"/cron/delete" method:"post" tags:"定时任务" summary:"删除定时任务"`
sysin.CronDeleteInp
}
type DeleteRes struct {
*sysin.CronDeleteModel
}
@ -54,6 +57,7 @@ type MaxSortReq struct {
g.Meta `path:"/cron/maxSort" method:"get" tags:"定时任务" summary:"定时任务最大排序"`
sysin.CronMaxSortInp
}
type MaxSortRes struct {
*sysin.CronMaxSortModel
}
@ -63,6 +67,7 @@ type StatusReq struct {
g.Meta `path:"/cron/status" method:"post" tags:"定时任务" summary:"更新定时任务状态"`
sysin.CronStatusInp
}
type StatusRes struct {
*sysin.CronStatusModel
}
@ -72,6 +77,7 @@ type OnlineExecReq struct {
g.Meta `path:"/cron/onlineExec" method:"post" tags:"定时任务" summary:"在线执行"`
sysin.OnlineExecInp
}
type OnlineExecRes struct {
*sysin.OnlineExecModel
}

View File

@ -7,7 +7,6 @@ package cron
import (
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
)
@ -28,6 +27,7 @@ type GroupViewReq struct {
g.Meta `path:"/cronGroup/view" method:"get" tags:"定时任务分组" summary:"获取指定信息"`
sysin.CronGroupViewInp
}
type GroupViewRes struct {
*sysin.CronGroupViewModel
}
@ -37,6 +37,7 @@ type GroupEditReq struct {
g.Meta `path:"/cronGroup/edit" method:"post" tags:"定时任务分组" summary:"修改/新增定时任务分组"`
sysin.CronGroupEditInp
}
type GroupEditRes struct {
*sysin.CronGroupEditModel
}
@ -46,6 +47,7 @@ type GroupDeleteReq struct {
g.Meta `path:"/cronGroup/delete" method:"post" tags:"定时任务分组" summary:"删除定时任务分组"`
sysin.CronGroupDeleteInp
}
type GroupDeleteRes struct {
*sysin.CronGroupDeleteModel
}
@ -55,16 +57,17 @@ type GroupMaxSortReq struct {
g.Meta `path:"/cronGroup/maxSort" method:"get" tags:"定时任务分组" summary:"定时任务分组最大排序"`
sysin.CronGroupMaxSortInp
}
type GroupMaxSortRes struct {
*sysin.CronGroupMaxSortModel
}
// GroupStatusReq 更新状态
type GroupStatusReq struct {
entity.SysCronGroup
g.Meta `path:"/cronGroup/status" method:"post" tags:"定时任务分组" summary:"更新定时任务分组状态"`
sysin.CronGroupStatusInp
}
type GroupStatusRes struct {
*sysin.CronGroupStatusModel
}

View File

@ -28,6 +28,7 @@ type ViewReq struct {
Id int64 `json:"id" v:"required#部门ID不能为空" dc:"部门ID"`
g.Meta `path:"/dept/view" method:"get" tags:"部门" summary:"获取指定信息"`
}
type ViewRes struct {
*adminin.DeptViewModel
}
@ -37,6 +38,7 @@ type EditReq struct {
entity.AdminDept
g.Meta `path:"/dept/edit" method:"post" tags:"部门" summary:"修改/新增部门"`
}
type EditRes struct{}
// DeleteReq 删除字典类型
@ -44,6 +46,7 @@ type DeleteReq struct {
Id interface{} `json:"id" v:"required#部门ID不能为空" dc:"部门ID"`
g.Meta `path:"/dept/delete" method:"post" tags:"部门" summary:"删除部门"`
}
type DeleteRes struct{}
// MaxSortReq 最大排序
@ -51,6 +54,7 @@ type MaxSortReq struct {
Id int64 `json:"id" dc:"部门ID"`
g.Meta `path:"/dept/maxSort" method:"get" tags:"部门" summary:"部门最大排序"`
}
type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"`
}
@ -60,6 +64,7 @@ type StatusReq struct {
entity.AdminDept
g.Meta `path:"/dept/status" method:"post" tags:"部门" summary:"更新部门状态"`
}
type StatusRes struct{}
// OptionReq 获取部门选项树

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package dict
import (
@ -27,6 +26,7 @@ type DataDeleteReq struct {
Id interface{} `json:"id" v:"required#字典数据ID不能为空" dc:"字典数据ID"`
g.Meta `path:"/dictData/delete" method:"post" tags:"字典数据" summary:"删除字典数据"`
}
type DataDeleteRes struct{}
// DataListReq 查询列表
@ -49,10 +49,12 @@ type DataSelectReq struct {
g.Meta `path:"/dictData/option/{Type}" method:"get" summary:"字典数据" tags:"获取指定字典选项"`
Type string `in:"path" v:"required#字典类型不能为空" dc:"字典类型"`
}
type DataSelectRes sysin.DataSelectModel
type DataSelectsReq struct {
g.Meta `path:"/dictData/options" method:"get" summary:"字典数据" tags:"获取多个字典选项"`
Types []string `json:"types"`
}
type DataSelectsRes map[string]sysin.DataSelectModel

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package dict
import (
@ -16,6 +15,7 @@ import (
type TypeTreeReq struct {
g.Meta `path:"/dictType/tree" tags:"字典类型" method:"get" summary:"字典类型树列表"`
}
type TypeTreeRes struct {
List []*sysin.DictTypeTree `json:"list" dc:"数据列表"`
}
@ -33,4 +33,5 @@ type TypeDeleteReq struct {
Id interface{} `json:"id" v:"required#字典类型ID不能为空" dc:"字典类型ID"`
g.Meta `path:"/dictType/delete" method:"post" tags:"字典类型" summary:"删除字典类型"`
}
type TypeDeleteRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package emslog
import (
@ -28,6 +27,7 @@ type ViewReq struct {
g.Meta `path:"/emsLog/view" method:"get" tags:"邮件记录" summary:"获取指定信息"`
sysin.EmsLogViewInp
}
type ViewRes struct {
*sysin.EmsLogViewModel
}
@ -37,6 +37,7 @@ type EditReq struct {
g.Meta `path:"/emsLog/edit" method:"post" tags:"邮件记录" summary:"修改/新增邮件记录"`
sysin.EmsLogEditInp
}
type EditRes struct{}
// DeleteReq 删除
@ -44,6 +45,7 @@ type DeleteReq struct {
g.Meta `path:"/emsLog/delete" method:"post" tags:"邮件记录" summary:"删除邮件记录"`
sysin.EmsLogDeleteInp
}
type DeleteRes struct{}
// StatusReq 更新状态
@ -51,6 +53,7 @@ type StatusReq struct {
g.Meta `path:"/emsLog/status" method:"post" tags:"邮件记录" summary:"更新邮件记录状态"`
sysin.EmsLogStatusInp
}
type StatusRes struct{}
// SendTestReq 更新状态
@ -58,4 +61,5 @@ type SendTestReq struct {
g.Meta `path:"/emsLog/sendTest" method:"post" tags:"邮件记录" summary:"发送测试邮件"`
sysin.SendEmsInp
}
type SendTestRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package gencodes
import (
@ -29,6 +28,7 @@ type ViewReq struct {
Id int64 `json:"id" v:"required#生成代码ID不能为空" dc:"生成代码ID"`
g.Meta `path:"/genCodes/view" method:"get" tags:"生成代码" summary:"获取指定信息"`
}
type ViewRes struct {
*sysin.GenCodesViewModel
}
@ -38,6 +38,7 @@ type EditReq struct {
entity.SysGenCodes
g.Meta `path:"/genCodes/edit" method:"post" tags:"生成代码" summary:"修改/新增生成代码"`
}
type EditRes struct {
*sysin.GenCodesEditModel
}
@ -47,6 +48,7 @@ type DeleteReq struct {
Id interface{} `json:"id" v:"required#生成代码ID不能为空" dc:"生成代码ID"`
g.Meta `path:"/genCodes/delete" method:"post" tags:"生成代码" summary:"删除生成代码"`
}
type DeleteRes struct{}
// MaxSortReq 最大排序
@ -54,6 +56,7 @@ type MaxSortReq struct {
Id int64 `json:"id" dc:"生成代码ID"`
g.Meta `path:"/genCodes/maxSort" method:"get" tags:"生成代码" summary:"生成代码最大排序"`
}
type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"`
}
@ -63,11 +66,13 @@ type StatusReq struct {
entity.SysGenCodes
g.Meta `path:"/genCodes/status" method:"post" tags:"生成代码" summary:"更新生成代码状态"`
}
type StatusRes struct{}
type SelectsReq struct {
g.Meta `path:"/genCodes/selects" method:"get" tags:"生成代码" summary:"生成入口选项"`
}
type SelectsRes struct {
*sysin.GenCodesSelectsModel
}
@ -76,18 +81,21 @@ type TableSelectReq struct {
g.Meta `path:"/genCodes/tableSelect" method:"get" tags:"生成代码" summary:"数据库表选项"`
sysin.GenCodesTableSelectInp
}
type TableSelectRes []*sysin.GenCodesTableSelectModel
type ColumnSelectReq struct {
g.Meta `path:"/genCodes/columnSelect" method:"get" tags:"生成代码" summary:"表字段选项"`
sysin.GenCodesColumnSelectInp
}
type ColumnSelectRes []*sysin.GenCodesColumnSelectModel
type ColumnListReq struct {
g.Meta `path:"/genCodes/columnList" method:"get" tags:"生成代码" summary:"表字段列表"`
sysin.GenCodesColumnListInp
}
type ColumnListRes []*sysin.GenCodesColumnListModel
// PreviewReq 生成预览
@ -95,6 +103,7 @@ type PreviewReq struct {
g.Meta `path:"/genCodes/preview" method:"post" tags:"生成代码" summary:"生成预览"`
sysin.GenCodesPreviewInp
}
type PreviewRes struct {
*sysin.GenCodesPreviewModel
}
@ -104,5 +113,6 @@ type BuildReq struct {
g.Meta `path:"/genCodes/build" method:"post" tags:"生成代码" summary:"提交生成"`
sysin.GenCodesPreviewInp
}
type BuildRes struct {
}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package log
import (
@ -16,6 +15,7 @@ import (
type ClearReq struct {
g.Meta `path:"/log/clear" method:"post" tags:"日志" summary:"清空日志"`
}
type ClearRes struct{}
// ExportReq 导出
@ -31,6 +31,7 @@ type ExportReq struct {
Ip string `json:"ip" dc:"访问IP"`
ErrorCode string `json:"error_code" dc:"状态码"`
}
type ExportRes struct{}
// ListReq 获取菜单列表
@ -58,6 +59,7 @@ type DeleteReq struct {
g.Meta `path:"/log/delete" method:"post" tags:"日志" summary:"删除日志"`
Id interface{} `json:"id" v:"required#日志ID不能为空" description:"日志ID"`
}
type DeleteRes struct{}
// ViewReq 获取指定信息
@ -65,6 +67,7 @@ type ViewReq struct {
g.Meta `path:"/log/view" method:"get" tags:"日志" summary:"获取指定信息"`
Id string `json:"id" v:"required#日志ID不能为空" description:"日志ID"`
}
type ViewRes struct {
*sysin.LogViewModel
}

View File

@ -16,6 +16,7 @@ type UpdateCashReq struct {
g.Meta `path:"/member/updateCash" method:"post" tags:"用户" summary:"更新提现信息"`
adminin.MemberUpdateCashInp
}
type UpdateCashRes struct{}
// UpdateEmailReq 换绑邮箱
@ -23,6 +24,7 @@ type UpdateEmailReq struct {
g.Meta `path:"/member/updateEmail" method:"post" tags:"用户" summary:"换绑邮箱"`
adminin.MemberUpdateEmailInp
}
type UpdateEmailRes struct{}
// UpdateMobileReq 换绑手机号
@ -30,6 +32,7 @@ type UpdateMobileReq struct {
g.Meta `path:"/member/updateMobile" method:"post" tags:"用户" summary:"换绑手机号"`
adminin.MemberUpdateMobileInp
}
type UpdateMobileRes struct{}
// UpdateProfileReq 更新用户资料
@ -37,6 +40,7 @@ type UpdateProfileReq struct {
g.Meta `path:"/member/updateProfile" method:"post" tags:"用户" summary:"更新用户资料"`
adminin.MemberUpdateProfileInp
}
type UpdateProfileRes struct{}
// UpdatePwdReq 修改登录密码
@ -44,6 +48,7 @@ type UpdatePwdReq struct {
g.Meta `path:"/member/updatePwd" method:"post" tags:"用户" summary:"重置密码"`
adminin.MemberUpdatePwdInp
}
type UpdatePwdRes struct{}
// ResetPwdReq 重置密码
@ -51,6 +56,7 @@ type ResetPwdReq struct {
g.Meta `path:"/member/resetPwd" method:"post" tags:"用户" summary:"重置密码"`
adminin.MemberResetPwdInp
}
type ResetPwdRes struct{}
// ListReq 查询列表
@ -69,6 +75,7 @@ type ViewReq struct {
g.Meta `path:"/member/view" method:"get" tags:"用户" summary:"获取指定信息"`
adminin.MemberViewInp
}
type ViewRes struct {
*adminin.MemberViewModel
}
@ -78,6 +85,7 @@ type EditReq struct {
g.Meta `path:"/member/edit" method:"post" tags:"用户" summary:"修改/新增用户"`
adminin.MemberEditInp
}
type EditRes struct{}
// DeleteReq 删除
@ -85,6 +93,7 @@ type DeleteReq struct {
g.Meta `path:"/member/delete" method:"post" tags:"用户" summary:"删除用户"`
adminin.MemberDeleteInp
}
type DeleteRes struct{}
// StatusReq 更新用户状态
@ -92,18 +101,21 @@ type StatusReq struct {
g.Meta `path:"/member/status" method:"post" tags:"用户" summary:"更新用户状态"`
adminin.MemberStatusInp
}
type StatusRes struct{}
// SelectReq 获取可选的后台用户选项
type SelectReq struct {
g.Meta `path:"/member/option" method:"get" tags:"用户" summary:"获取可选的后台用户选项"`
}
type SelectRes []*adminin.MemberSelectModel
// InfoReq 获取登录用户信息
type InfoReq struct {
g.Meta `path:"/member/info" method:"get" tags:"用户" summary:"获取登录用户信息"`
}
type InfoRes struct {
*adminin.LoginMemberInfoModel
}
@ -113,6 +125,7 @@ type AddBalanceReq struct {
g.Meta `path:"/member/addBalance" method:"post" tags:"用户" summary:"增加余额"`
adminin.MemberAddBalanceInp
}
type AddBalanceRes struct{}
// AddIntegralReq 增加积分
@ -120,4 +133,5 @@ type AddIntegralReq struct {
g.Meta `path:"/member/addIntegral" method:"post" tags:"用户" summary:"增加积分"`
adminin.MemberAddIntegralInp
}
type AddIntegralRes struct{}

View File

@ -16,6 +16,7 @@ type MaxSortReq struct {
g.Meta `path:"/menu/maxSort" method:"get" tags:"菜单" summary:"菜单最大排序"`
Id int64 `json:"id" dc:"菜单ID"`
}
type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"`
}
@ -26,6 +27,7 @@ type CodeUniqueReq struct {
Code string `json:"code" v:"required#菜单编码不能为空" dc:"菜单编码"`
Id int64 `json:"id" dc:"菜单ID"`
}
type CodeUniqueRes struct {
IsUnique bool `json:"is_unique" dc:"是否唯一"`
}
@ -36,6 +38,7 @@ type NameUniqueReq struct {
Name string `json:"name" v:"required#菜单名称不能为空" dc:"菜单名称"`
Id int64 `json:"id" dc:"菜单ID"`
}
type NameUniqueRes struct {
IsUnique bool `json:"is_unique" dc:"是否唯一"`
}
@ -45,6 +48,7 @@ type EditReq struct {
g.Meta `path:"/menu/edit" method:"post" tags:"菜单" summary:"修改/新增菜单"`
entity.AdminMenu
}
type EditRes struct{}
// DeleteReq 删除菜单
@ -52,6 +56,7 @@ type DeleteReq struct {
g.Meta `path:"/menu/delete" method:"post" tags:"菜单" summary:"删除菜单"`
Id interface{} `json:"id" v:"required#菜单ID不能为空" dc:"菜单ID"`
}
type DeleteRes struct{}
// ViewReq 获取指定菜单信息
@ -59,6 +64,7 @@ type ViewReq struct {
g.Meta `path:"/menu/view" method:"get" tags:"菜单" summary:"获取指定菜单信息"`
Id string `json:"id" v:"required#菜单ID不能为空" dc:"菜单ID"`
}
type ViewRes struct {
*entity.AdminMenu
}

View File

@ -15,6 +15,7 @@ type OfflineReq struct {
g.Meta `path:"/monitor/offline" method:"post" tags:"在线用户" summary:"下线用户"`
Id string `json:"id" v:"required#SID不能为空" description:"SID"`
}
type OfflineRes struct{}
// OnlineListReq 获取在线用户列表
@ -37,6 +38,7 @@ type OnlineViewReq struct {
g.Meta `path:"/monitor/onlineView" method:"get" tags:"在线用户" summary:"获取指定用户信息"`
Id string `json:"id" v:"required#SID不能为空" description:"SID"`
}
type OnlineViewRes struct {
*OnlineModel
}

View File

@ -33,6 +33,7 @@ type ApplyRefundRes struct {
type OptionReq struct {
g.Meta `path:"/order/option" method:"get" summary:"充值订单" tags:"获取订单状态选项"`
}
type OptionRes struct {
Status []g.Map `json:"status" dc:"订单状态"`
AcceptRefundStatus []g.Map `json:"acceptRefundStatus" dc:"订单退款受理状态"`
@ -83,6 +84,7 @@ type EditReq struct {
g.Meta `path:"/order/edit" method:"post" tags:"充值订单" summary:"修改/新增充值订单"`
adminin.OrderEditInp
}
type EditRes struct{}
// DeleteReq 删除充值订单

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package post
import (
@ -18,6 +17,7 @@ type EditReq struct {
g.Meta `path:"/post/edit" method:"post" tags:"岗位" summary:"修改/新增岗位"`
entity.AdminPost
}
type EditRes struct{}
// DeleteReq 删除岗位
@ -25,6 +25,7 @@ type DeleteReq struct {
g.Meta `path:"/post/delete" method:"post" tags:"岗位" summary:"删除岗位"`
Id interface{} `json:"id" v:"required#岗位ID不能为空" description:"岗位ID"`
}
type DeleteRes struct{}
// MaxSortReq 最大排序
@ -32,6 +33,7 @@ type MaxSortReq struct {
g.Meta `path:"/post/maxSort" method:"get" tags:"岗位" summary:"岗位最大排序"`
Id int64 `json:"id" description:"岗位ID"`
}
type MaxSortRes struct {
Sort int `json:"sort" description:"排序"`
}
@ -56,6 +58,7 @@ type ViewReq struct {
g.Meta `path:"/post/view" method:"get" tags:"岗位" summary:"获取指定信息"`
Id string `json:"id" v:"required#岗位ID不能为空" description:"岗位ID"`
}
type ViewRes struct {
*adminin.PostViewModel
}
@ -66,6 +69,7 @@ type CodeUniqueReq struct {
Code string `json:"code" v:"required#岗位编码不能为空" description:"岗位编码"`
Id int64 `json:"id" description:"岗位ID"`
}
type CodeUniqueRes struct {
IsUnique bool `json:"is_unique" description:"是否唯一"`
}
@ -76,6 +80,7 @@ type NameUniqueReq struct {
Name string `json:"name" v:"required#岗位名称不能为空" description:"岗位名称"`
Id int64 `json:"id" description:"岗位ID"`
}
type NameUniqueRes struct {
IsUnique bool `json:"is_unique" description:"是否唯一"`
}
@ -85,4 +90,5 @@ type StatusReq struct {
entity.AdminPost
g.Meta `path:"/post/status" method:"post" tags:"岗位" summary:"更新岗位状态"`
}
type StatusRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package provinces
import (
@ -33,6 +32,7 @@ type ViewReq struct {
Id int64 `json:"id" v:"required#省市区ID不能为空" dc:"省市区ID"`
g.Meta `path:"/provinces/view" method:"get" tags:"省市区" summary:"获取指定信息"`
}
type ViewRes struct {
*sysin.ProvincesViewModel
}
@ -42,6 +42,7 @@ type EditReq struct {
g.Meta `path:"/provinces/edit" method:"post" tags:"省市区" summary:"修改/新增省市区"`
sysin.ProvincesEditInp
}
type EditRes struct{}
// DeleteReq 删除
@ -49,12 +50,14 @@ type DeleteReq struct {
g.Meta `path:"/provinces/delete" method:"post" tags:"省市区" summary:"删除省市区"`
sysin.ProvincesDeleteInp
}
type DeleteRes struct{}
// MaxSortReq 最大排序
type MaxSortReq struct {
g.Meta `path:"/provinces/maxSort" method:"get" tags:"省市区" summary:"省市区最大排序"`
}
type MaxSortRes struct {
*sysin.ProvincesMaxSortModel
}
@ -64,12 +67,14 @@ type StatusReq struct {
entity.SysProvinces
g.Meta `path:"/provinces/status" method:"post" tags:"省市区" summary:"更新省市区状态"`
}
type StatusRes struct{}
// TreeReq 关系树选项列表
type TreeReq struct {
g.Meta `path:"/provinces/tree" tags:"省市区" method:"get" summary:"省市区关系树选项列表"`
}
type TreeRes struct {
List []map[string]interface{} `json:"list" dc:"数据列表"`
}
@ -90,6 +95,7 @@ type UniqueIdReq struct {
g.Meta `path:"/provinces/uniqueId" method:"get" tags:"省市区" summary:"地区ID是否唯一"`
sysin.ProvincesUniqueIdInp
}
type UniqueIdRes struct {
*sysin.ProvincesUniqueIdModel
}
@ -99,6 +105,7 @@ type SelectReq struct {
g.Meta `path:"/provinces/select" method:"get" summary:"省市区" tags:"省市区选项"`
sysin.ProvincesSelectInp
}
type SelectRes struct {
*sysin.ProvincesSelectModel
}
@ -108,4 +115,5 @@ type CityLabelReq struct {
g.Meta `path:"/provinces/cityLabel" method:"get" summary:"省市区" tags:"获取指定城市标签"`
sysin.ProvincesCityLabelInp
}
type CityLabelRes sysin.ProvincesCityLabelModel

View File

@ -78,6 +78,7 @@ type EditReq struct {
g.Meta `path:"/role/edit" method:"post" tags:"角色" summary:"修改/新增角色"`
adminin.RoleEditInp
}
type EditRes struct{}
// DeleteReq 删除角色
@ -85,12 +86,14 @@ type DeleteReq struct {
g.Meta `path:"/role/delete" method:"post" tags:"角色" summary:"删除角色"`
adminin.RoleDeleteInp
}
type DeleteRes struct{}
// DataScopeSelectReq 获取数据权限选项
type DataScopeSelectReq struct {
g.Meta `path:"/role/dataScope/select" method:"get" summary:"角色" tags:"获取数据权限选项"`
}
type DataScopeSelectRes struct {
List form.Selects `json:"list" dc:"数据选项"`
}
@ -100,4 +103,5 @@ type DataScopeEditReq struct {
g.Meta `path:"/role/dataScope/edit" method:"post" tags:"角色" summary:"修改指定角色的数据权限"`
adminin.DataScopeEditInp
}
type DataScopeEditRes struct{}

View File

@ -23,6 +23,7 @@ type ViewReq struct {
Id int64 `json:"id" v:"required#短信记录ID不能为空" dc:"短信记录ID"`
g.Meta `path:"/smsLog/view" method:"get" tags:"短信记录" summary:"获取指定信息"`
}
type ViewRes struct {
*sysin.SmsLogViewModel
}
@ -32,6 +33,7 @@ type EditReq struct {
entity.SysSmsLog
g.Meta `path:"/smsLog/edit" method:"post" tags:"短信记录" summary:"修改/新增短信记录"`
}
type EditRes struct{}
// DeleteReq 删除
@ -39,6 +41,7 @@ type DeleteReq struct {
Id interface{} `json:"id" v:"required#短信记录ID不能为空" dc:"短信记录ID"`
g.Meta `path:"/smsLog/delete" method:"post" tags:"短信记录" summary:"删除短信记录"`
}
type DeleteRes struct{}
// MaxSortReq 最大排序
@ -46,6 +49,7 @@ type MaxSortReq struct {
Id int64 `json:"id" dc:"短信记录ID"`
g.Meta `path:"/smsLog/maxSort" method:"get" tags:"短信记录" summary:"短信记录最大排序"`
}
type MaxSortRes struct {
Sort int `json:"sort" dc:"排序"`
}
@ -55,6 +59,7 @@ type StatusReq struct {
entity.SysSmsLog
g.Meta `path:"/smsLog/status" method:"post" tags:"短信记录" summary:"更新短信记录状态"`
}
type StatusRes struct{}
// SendTestReq 更新状态
@ -62,4 +67,5 @@ type SendTestReq struct {
entity.SysSmsLog
g.Meta `path:"/smsLog/sendTest" method:"post" tags:"短信记录" summary:"发送测试短信"`
}
type SendTestRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package user
import (
@ -13,6 +12,7 @@ import (
type HelloReq struct {
g.Meta `path:"/hello" tags:"Hello" method:"get" summary:"You first hello api"`
}
type HelloRes struct {
g.Meta `mime:"text/html" example:"string"`
}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package member
import "github.com/gogf/gf/v2/frame/g"
@ -13,4 +12,5 @@ type GetIdByCodeReq struct {
g.Meta `path:"/member/getIdByCode" method:"post" tags:"用户" summary:"通过邀请码获取用户ID"`
Code string `json:"code" dc:"邀请码"`
}
type GetIdByCodeRes struct{}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package user
import (
@ -13,6 +12,7 @@ import (
type HelloReq struct {
g.Meta `path:"/hello" tags:"Hello" method:"get" summary:"You first hello api"`
}
type HelloRes struct {
g.Meta `mime:"text/html" example:"string"`
}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package base
import "github.com/gogf/gf/v2/frame/g"
@ -11,6 +10,7 @@ import "github.com/gogf/gf/v2/frame/g"
type SiteIndexReq struct {
g.Meta `path:"/index" method:"get" summary:"首页" tags:"首页"`
}
type SiteIndexRes struct {
g.Meta `mime:"text/html" type:"string" example:"<html/>"`
}

View File

@ -11,7 +11,6 @@ require (
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible
github.com/apache/rocketmq-client-go/v2 v2.1.0
github.com/casbin/casbin/v2 v2.55.0
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/forgoer/openssl v1.4.0
github.com/go-pay/gopay v1.5.91
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.4.1

View File

@ -108,8 +108,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/eapache/go-resiliency v1.2.0 h1:v7g92e/KSN71Rq7vSThKaWIq68fL4YHvWyiUKorFR1Q=

View File

@ -7,9 +7,9 @@ package cmd
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcmd"
"hotgo/internal/crons"
"hotgo/internal/global"
"hotgo/internal/library/cron"
"hotgo/internal/service"
)
@ -19,6 +19,9 @@ var (
Brief: "定时任务用来部署一些可独立运行的定时任务通过tcp方式和后台保持长连接通讯动态调整任务属性。",
Description: ``,
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
// 服务日志处理
cron.Logger().SetHandlers(global.LoggingServeLogHandler)
// 启动定时任务
service.SysCron().StartCron(ctx)
@ -32,8 +35,8 @@ var (
<-serverCloseSignal
service.CronClient().Stop(ctx)
crons.StopALL()
g.Log().Debug(ctx, "cron successfully closed ..")
cron.StopALL()
cron.Logger().Debug(ctx, "cron successfully closed ..")
serverWg.Done()
return
},

View File

@ -10,8 +10,11 @@ import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/os/gcmd"
"hotgo/internal/consts"
"hotgo/internal/library/addons"
"hotgo/internal/library/casbin"
"hotgo/internal/library/hggen"
"hotgo/internal/library/payment"
"hotgo/internal/router"
"hotgo/internal/service"
"hotgo/internal/websocket"
@ -23,9 +26,7 @@ var (
Usage: "http",
Brief: "HTTP服务也可以称为主服务包含http、websocket、tcpserver多个可对外服务",
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
// 加载权限
casbin.InitEnforcer(ctx)
// 初始化http服务
s := g.Server()
// 错误状态码接管
@ -70,11 +71,25 @@ var (
addons.RegisterModulesRouter(ctx, group)
})
// 初始化casbin权限
casbin.InitEnforcer(ctx)
// 初始化生成代码配置
hggen.InIt(ctx)
// 启动tcp服务
service.TCPServer().Start(ctx)
// https
setSSL(ctx, s)
// 启动服务监控
service.AdminMonitor().StartMonitor(ctx)
// 加载ip访问黑名单
service.SysBlacklist().Load(ctx)
// 注册支付成功回调方法
payment.RegisterNotifyCallMap(map[string]payment.NotifyCallFunc{
consts.OrderGroupAdminOrder: service.AdminOrder().PayNotify, // 后台充值订单
})
serverWg.Add(1)
@ -96,13 +111,3 @@ var (
},
}
)
func setSSL(ctx context.Context, s *ghttp.Server) {
config, err := service.SysConfig().GetLoadSSL(ctx)
if err != nil {
g.Log().Fatal(ctx, "ssl配置获取失败err:%+v", err)
}
if config != nil && config.Switch {
s.EnableHTTPS(config.CrtPath, config.KeyPath)
}
}

View File

@ -7,8 +7,8 @@ package cmd
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcmd"
"hotgo/internal/global"
"hotgo/internal/library/queue"
"hotgo/utility/simple"
)
@ -19,10 +19,13 @@ var (
Brief: "消息队列",
Description: ``,
Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
// 服务日志处理
queue.Logger().SetHandlers(global.LoggingServeLogHandler)
simple.SafeGo(ctx, func(ctx context.Context) {
g.Log().Debug(ctx, "start queue consumer..")
queue.Logger().Debug(ctx, "start queue consumer..")
queue.StartConsumersListener(ctx)
g.Log().Debug(ctx, "start queue consumer success..")
queue.Logger().Debug(ctx, "start queue consumer success..")
})
serverWg.Add(1)
@ -31,7 +34,7 @@ var (
signalListen(ctx, signalHandlerForOverall)
<-serverCloseSignal
g.Log().Debug(ctx, "queue successfully closed ..")
queue.Logger().Debug(ctx, "queue successfully closed ..")
serverWg.Done()
return
},

View File

@ -50,7 +50,6 @@ func (c *cCash) List(ctx context.Context, req *cash.ListReq) (res *cash.ListRes,
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
res.Page = req.Page
res.PerPage = req.PerPage
return
}

View File

@ -41,7 +41,6 @@ func (c *cMonitor) Offline(ctx context.Context, req *monitor.OfflineReq) (res *m
websocket.SendSuccess(client, "kick")
websocket.Close(client)
})
return
}
@ -94,18 +93,17 @@ func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (
res.PerPage = req.PerPage
sort.Sort(monitor.OnlineModels(clients))
isDemo := g.Cfg().MustGet(ctx, "hotgo.isDemo", false)
isDemo := g.Cfg().MustGet(ctx, "hotgo.isDemo", false).Bool()
_, perPage, offset := form.CalPage(ctx, req.Page, req.PerPage)
for k, v := range clients {
if k >= offset && i <= perPage {
if isDemo.Bool() {
if isDemo {
v.Addr = consts.DemoTips
}
res.List = append(res.List, v)
i++
}
}
return
}

View File

@ -18,6 +18,8 @@ type cConsole struct{}
func (c *cConsole) Stat(_ context.Context, _ *common.ConsoleStatReq) (res *common.ConsoleStatRes, err error) {
res = new(common.ConsoleStatRes)
// 此处均为模拟数据,可以根据实际业务情况替换成真实数据
res.Visits.DayVisits = 12010
res.Visits.Rise = 13501
res.Visits.Decline = 10502

View File

@ -24,7 +24,6 @@ func (c *cUpload) UploadImage(ctx context.Context, _ *common.UploadImageReq) (re
err = gerror.New("没有找到上传的文件")
return
}
return service.CommonUpload().UploadImage(ctx, file)
}
@ -35,6 +34,5 @@ func (c *cUpload) UploadFile(ctx context.Context, _ *common.UploadFileReq) (res
err = gerror.New("没有找到上传的文件")
return
}
return service.CommonUpload().UploadFile(ctx, file)
}

View File

@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package sys
import (
@ -94,6 +93,5 @@ func (c *cDictData) Selects(ctx context.Context, req *dict.DataSelectsReq) (res
}
res[v] = option
}
return
}

View File

@ -37,7 +37,6 @@ func (c *cNotify) WxPay(ctx context.Context, _ *pay.NotifyWxPayReq) (res *pay.No
}
res = &pay.NotifyWxPayRes{PayType: consts.PayTypeWxPay, Code: "SUCCESS", Message: "收单成功"}
return
}

View File

@ -23,7 +23,6 @@ import (
"hotgo/utility/format"
"os"
"runtime"
"strconv"
"time"
)
@ -77,8 +76,8 @@ func (c *cMonitor) RunInfo(client *websocket.Client, req *websocket.WRequest) {
"goSize": file.DirSize(pwd),
}
isDemo := g.Cfg().MustGet(client.Context(), "hotgo.isDemo", false)
if isDemo.Bool() {
isDemo := g.Cfg().MustGet(client.Context(), "hotgo.isDemo", false).Bool()
if isDemo {
data["rootPath"] = consts.DemoTips
data["pwd"] = consts.DemoTips
data["intranet_ip"] = consts.DemoTips
@ -104,7 +103,7 @@ func (c *cMonitor) Trends(client *websocket.Client, req *websocket.WRequest) {
mMem, memErr = mem.VirtualMemory()
mMemUsed float64
mDisk, diskErr = disk.Usage("/")
mProcess, ProcessErr = process.Pids()
mProcess, processErr = process.Pids()
mLoadAvg = new(model.LoadAvgStats)
monitorHeads []MonitorHead
nets []NetC
@ -112,32 +111,32 @@ func (c *cMonitor) Trends(client *websocket.Client, req *websocket.WRequest) {
)
if cpuErr != nil {
g.Log().Infof(client.Context(), "read CPU info fail:%+v", cpuErr)
g.Log().Warningf(client.Context(), "read CPU info fail:%+v", cpuErr)
mCpu = []cpu.InfoStat{{VendorID: "", ModelName: ""}}
}
if memErr != nil {
g.Log().Infof(client.Context(), "read mem info fail:%+v", memErr)
g.Log().Warningf(client.Context(), "read mem info fail:%+v", memErr)
mMem = new(mem.VirtualMemoryStat)
}
if diskErr != nil {
g.Log().Infof(client.Context(), "read disk info fail:%+v", diskErr)
g.Log().Warningf(client.Context(), "read disk info fail:%+v", diskErr)
mDisk = new(disk.UsageStat)
}
if ProcessErr != nil {
g.Log().Infof(client.Context(), "read process.Pids fail:%+v", ProcessErr)
if processErr != nil {
g.Log().Warningf(client.Context(), "read process.Pids fail:%+v", processErr)
}
// cpu使用率
cu, err := cpu.Percent(time.Second, false)
if err == nil {
mCpuUsed, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", cu[0]), 64)
mCpuUsed = gconv.Float64(fmt.Sprintf("%.2f", cu[0]))
}
// 内存使用率
mMemUsed, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", mMem.UsedPercent), 64)
mMemUsed = gconv.Float64(fmt.Sprintf("%.2f", mMem.UsedPercent))
// 负载
if len(meta.LoadAvg) > 0 {

View File

@ -11,11 +11,12 @@ import (
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/library/cron"
"hotgo/internal/service"
)
func init() {
cronList = append(cronList, CloseOrder)
cron.Register(CloseOrder)
}
// CloseOrder 取消过期订单
@ -38,6 +39,6 @@ func (c *cCloseOrder) Execute(ctx context.Context) {
dao.AdminOrder.Columns().Status: consts.OrderStatusClose,
}).Update()
if err != nil {
g.Log().Warning(ctx, "cron CloseOrder Execute err:%+v", err)
cron.Logger().Warning(ctx, "cron CloseOrder Execute err:%+v", err)
}
}

View File

@ -3,17 +3,16 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package crons
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/library/cron"
"time"
)
func init() {
cronList = append(cronList, Test)
cron.Register(Test)
}
// Test 测试任务(无参数)
@ -29,5 +28,5 @@ func (c *cTest) GetName() string {
// Execute 执行任务
func (c *cTest) Execute(ctx context.Context) {
g.Log().Infof(ctx, "cron test Execute:%v", time.Now())
cron.Logger().Infof(ctx, "cron test Execute:%v", time.Now())
}

View File

@ -3,18 +3,17 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package crons
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/consts"
"hotgo/internal/library/cron"
"time"
)
func init() {
cronList = append(cronList, Test2)
cron.Register(Test2)
}
// Test2 测试2任务带参数
@ -32,11 +31,11 @@ func (c *cTest2) GetName() string {
func (c *cTest2) Execute(ctx context.Context) {
args, ok := ctx.Value(consts.ContextKeyCronArgs).([]string)
if !ok {
g.Log().Warning(ctx, "参数解析失败!")
cron.Logger().Warning(ctx, "参数解析失败!")
return
}
if len(args) != 3 {
g.Log().Warning(ctx, "test2 传入参数不正确!")
cron.Logger().Warning(ctx, "test2 传入参数不正确!")
return
}
@ -46,5 +45,5 @@ func (c *cTest2) Execute(ctx context.Context) {
msg = args[2]
)
g.Log().Infof(ctx, "cron test2 Execute:%v, name:%v, age:%v, msg:%v", time.Now(), name, age, msg)
cron.Logger().Infof(ctx, "cron test2 Execute:%v, name:%v, age:%v, msg:%v", time.Now(), name, age, msg)
}

View File

@ -18,7 +18,6 @@ import (
"github.com/gogf/gf/v2/text/gstr"
"hotgo/internal/consts"
"hotgo/internal/library/cache"
"hotgo/internal/library/hggen"
"hotgo/internal/library/queue"
"hotgo/internal/model/entity"
"hotgo/internal/service"
@ -47,22 +46,12 @@ func Init(ctx context.Context) {
// 设置缓存适配器
cache.SetAdapter(ctx)
// 启动服务监控
service.AdminMonitor().StartMonitor(ctx)
// 加载ip访问黑名单
service.SysBlacklist().Load(ctx)
// 初始化功能库配置
service.SysConfig().InitConfig(ctx)
// 注册支付成功回调方法
payNotifyCall()
// 初始化生成代码配置
hggen.InIt(ctx)
}
// LoggingServeLogHandler 服务日志处理
// 需要将异常日志保存到服务日志时可以通过SetHandlers设置此方法
func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) {
in.Next(ctx)
@ -120,6 +109,6 @@ func LoggingServeLogHandler(ctx context.Context, in *glog.HandlerInput) {
})
if err != nil {
g.Log("serveLog").Errorf(ctx, "LoggingServeLogHandler err:%+v", err)
g.Dump("LoggingServeLogHandler err:%+v", err)
}
}

View File

@ -1,13 +0,0 @@
package global
import (
"hotgo/internal/consts"
"hotgo/internal/library/payment"
"hotgo/internal/service"
)
// 注册支付成功回调方法
func payNotifyCall() {
payment.RegisterNotifyCall(consts.OrderGroupAdminOrder, service.AdminOrder().PayNotify) // 后台充值订单
// ...
}

View File

@ -1,9 +1,9 @@
// Package crons
// Package cron
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package crons
package cron
import (
"context"
@ -11,6 +11,7 @@ import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcron"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/dao"
@ -20,19 +21,19 @@ import (
"sync"
)
var crons = &cronManager{
tasks: make(map[string]*TaskItem),
}
// cronStrategy 任务接口
type cronStrategy interface {
GetName() string
Execute(ctx context.Context)
}
var (
// 添加新的任务时只需实现cronStrategy接口并加入到cronList即可
cronList []cronStrategy
inst = new(tasks)
)
type tasks struct {
list []*TaskItem
// consumerManager 任务管理者
type cronManager struct {
tasks map[string]*TaskItem
sync.RWMutex
}
@ -45,40 +46,40 @@ type TaskItem struct {
Count int // 执行次数仅Policy=4时有效
}
func LoadCronList() {
for _, cron := range cronList {
inst.Add(&TaskItem{
Name: cron.GetName(),
Fun: cron.Execute,
})
}
func Logger() *glog.Logger {
return g.Log("cron")
}
// Register 注册任务
func Register(c cronStrategy) {
crons.Lock()
defer crons.Unlock()
name := c.GetName()
if _, ok := crons.tasks[name]; ok {
Logger().Debugf(gctx.GetInitCtx(), "cron.Register name:%v duplicate registration.", name)
return
}
crons.tasks[name] = &TaskItem{Name: c.GetName(), Fun: c.Execute}
}
// StopALL 停止所有任务
func StopALL() {
for _, v := range gcron.Entries() {
gcron.Remove(v.Name)
}
}
// StartALL 启动任务
func StartALL(sysCron []*entity.SysCron) error {
if len(inst.list) == 0 {
LoadCronList()
}
var (
err error
ct = gctx.New()
)
if len(sysCron) == 0 {
g.Log().Debug(ct, "no scheduled task is available.")
return nil
// StartALL 启动所有任务
func StartALL(sysCron []*entity.SysCron) (err error) {
if len(crons.tasks) == 0 {
g.Log().Debug(gctx.GetInitCtx(), "no scheduled task is available.")
return
}
for _, cron := range sysCron {
f := inst.Get(cron.Name)
if f == nil {
f, ok := crons.tasks[cron.Name]
if !ok {
return gerror.Newf("该任务没有加入任务列表:%v", cron.Name)
}
@ -120,17 +121,14 @@ func StartALL(sysCron []*entity.SysCron) error {
// 执行完毕,单次和多次执行的任务更新状态
if cron.Policy == consts.CronPolicyOnce || cron.Policy == consts.CronPolicyTimes {
_, err = dao.SysCron.Ctx(ct).Where("id", cron.Id).
Data(g.Map{"status": consts.StatusDisable, "updated_at": gtime.Now()}).
Update()
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
if _, err = dao.SysCron.Ctx(gctx.GetInitCtx()).Where("id", cron.Id).Data(g.Map{"status": consts.StatusDisable, "updated_at": gtime.Now()}).Update(); err != nil {
err = gerror.Wrap(err, "定时任务执行失败!")
return err
}
}
}
g.Log().Debug(ct, "load cron success..")
Logger().Debug(gctx.GetInitCtx(), "load cron success..")
return nil
}
@ -143,7 +141,6 @@ func RefreshStatus(sysCron *entity.SysCron) (err error) {
if sysCron.Status == consts.StatusEnabled {
return Start(sysCron)
}
return Stop(sysCron)
}
@ -159,15 +156,14 @@ func Stop(sysCron *entity.SysCron) (err error) {
// Once 立即执行一次某个任务
func Once(ctx context.Context, sysCron *entity.SysCron) error {
for _, v := range cronList {
if v.GetName() == sysCron.Name {
for _, v := range crons.tasks {
if v.Name == sysCron.Name {
simple.SafeGo(ctx, func(ctx context.Context) {
v.Execute(ctx)
v.Fun(ctx)
})
return nil
}
}
return gerror.Newf("定时任务不存在:%+v", sysCron.Name)
}
@ -182,7 +178,6 @@ func Delete(sysCron *entity.SysCron) (err error) {
gcron.Remove(v.Name)
}
}
return
}
@ -191,53 +186,11 @@ func Start(sysCron *entity.SysCron) (err error) {
if sysCron == nil {
return
}
cr := gcron.Search(sysCron.Name)
if cr != nil {
cr.Start()
c := gcron.Search(sysCron.Name)
if c != nil {
c.Start()
return
}
return StartALL([]*entity.SysCron{sysCron})
}
// Add 添加任务
func (t *tasks) Add(task *TaskItem) *tasks {
if task.Name == "" || task.Fun == nil {
return t
}
t.Lock()
defer t.Unlock()
t.list = append(t.list, task)
return t
}
// Get 找到任务
func (t *tasks) Get(name string) *TaskItem {
if len(t.list) == 0 {
return nil
}
for _, item := range t.list {
if item.Name == name {
return item
}
}
return nil
}
// Del 删除任务
func (t *tasks) Del(name string) (newList []*TaskItem) {
if len(t.list) == 0 {
return nil
}
t.Lock()
defer t.Unlock()
for _, item := range t.list {
if item.Name == name {
continue
}
newList = append(newList, item)
}
return newList
}

View File

@ -19,10 +19,10 @@ func Send(config *model.EmailConfig, to string, subject string, body string) err
}
func sendToMail(config *model.EmailConfig, to, subject, body, mailType string) error {
if config == nil {
return gerror.New("邮件配置不能为空")
}
var (
contentType string
auth = smtp.PlainAuth("", config.User, config.Password, config.Host)

View File

@ -99,17 +99,14 @@ func Cz88Find(ctx context.Context, ip string) (*IpLocationData, error) {
if detail == nil {
return nil, fmt.Errorf("no ip data is queried. procedure:%v", ip)
}
locationData := &IpLocationData{
return &IpLocationData{
Ip: ip,
Country: detail.Country,
Region: detail.Region,
Province: detail.Province,
City: detail.City,
Area: detail.County,
}
return locationData, nil
}, nil
}
// IsJurisByIpTitle 判断地区名称是否为直辖市

View File

@ -8,6 +8,7 @@ package location
import (
"context"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"hotgo/internal/consts"
@ -15,6 +16,10 @@ import (
"hotgo/utility/tree"
)
func GetModel(ctx context.Context) *gdb.Model {
return g.Model("sys_provinces").Ctx(ctx)
}
// ParseSimpleRegion 通过地区ID解析地区名称自动加入上级地区
func ParseSimpleRegion(ctx context.Context, id int64, spilt ...string) (string, error) {
if id == 0 {
@ -25,7 +30,7 @@ func ParseSimpleRegion(ctx context.Context, id int64, spilt ...string) (string,
err error
)
if err = g.Model("sys_provinces").Ctx(ctx).Fields("title,level,tree").Where("id", id).Scan(&models); err != nil {
if err = GetModel(ctx).Fields("title,level,tree").Where("id", id).Scan(&models); err != nil {
return "", err
}
@ -71,14 +76,14 @@ func ParseRegion(ctx context.Context, province int64, city int64, county int64,
}
if province > 0 && province < 999999 {
provinceName, err = g.Model("sys_provinces").Ctx(ctx).Where("id", province).Fields("title").Value()
provinceName, err = GetModel(ctx).Where("id", province).Fields("title").Value()
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return "", err
}
if city > 0 {
cityName, err = g.Model("sys_provinces").Ctx(ctx).Where("id", city).Fields("title").Value()
cityName, err = GetModel(ctx).Where("id", city).Fields("title").Value()
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return "", err
@ -86,7 +91,7 @@ func ParseRegion(ctx context.Context, province int64, city int64, county int64,
}
if county > 0 {
countyName, err = g.Model("sys_provinces").Ctx(ctx).Where("id", county).Fields("title").Value()
countyName, err = GetModel(ctx).Where("id", county).Fields("title").Value()
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return "", err

View File

@ -7,7 +7,6 @@ package tcp
import (
"context"
"fmt"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/gtcp"
@ -87,13 +86,7 @@ func NewClient(config *ClientConfig) (client *Client, err error) {
client.auth = config.Auth
client.loginEvent = config.LoginEvent
client.closeEvent = config.CloseEvent
logger := glog.New()
path := g.Cfg().MustGet(client.Ctx, "logger.path", "logs/logger").String()
if err = logger.SetPath(fmt.Sprintf("%s/tcp.client/%s.%s", path, config.Auth.Group, config.Auth.Name)); err != nil {
return
}
client.Logger = logger
client.Logger = g.Log("tcpClient")
if config.ConnectInterval <= 0 {
client.connectInterval = 5 * time.Second

View File

@ -7,7 +7,6 @@ package tcp
import (
"context"
"fmt"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/gtcp"
@ -73,17 +72,10 @@ func NewServer(config *ServerConfig) (server *Server, err error) {
server.ln = gtcp.NewServer(server.addr, server.accept, config.Name)
server.clients = make(map[string]*ClientConn)
server.closeFlag = false
logger := glog.New()
path := g.Cfg().MustGet(server.Ctx, "logger.path", "logs/logger").String()
if err = logger.SetPath(fmt.Sprintf("%s/tcp.server/%s", path, config.Name)); err != nil {
return
}
server.Logger = logger
server.Logger = g.Log("tcpServer")
server.rpc = NewRpc(server.Ctx)
server.startCron()
return
}

View File

@ -29,6 +29,13 @@ func RegisterNotifyCall(group string, f NotifyCallFunc) {
notifyCall[group] = f
}
// RegisterNotifyCallMap 注册支付成功回调方法
func RegisterNotifyCallMap(calls map[string]NotifyCallFunc) {
for group, f := range calls {
RegisterNotifyCall(group, f)
}
}
// NotifyCall 执行订单分组的异步回调
func NotifyCall(ctx context.Context, in payin.NotifyCallFuncInp) {
f, ok := notifyCall[in.Pay.OrderGroup]

View File

@ -2,7 +2,6 @@ package queue
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"sync"
)
@ -28,7 +27,7 @@ func RegisterConsumer(cs consumerStrategy) {
defer consumers.Unlock()
topic := cs.GetTopic()
if _, ok := consumers.list[topic]; ok {
g.Log().Debugf(ctx, "queue.RegisterConsumer topic:%v duplicate registration.", topic)
Logger().Debugf(ctx, "queue.RegisterConsumer topic:%v duplicate registration.", topic)
return
}
consumers.list[topic] = cs
@ -51,7 +50,7 @@ func consumerListen(ctx context.Context, job consumerStrategy) {
)
if err != nil {
g.Log().Fatalf(ctx, "InstanceConsumer %s err:%+v", topic, err)
Logger().Fatalf(ctx, "InstanceConsumer %s err:%+v", topic, err)
return
}
@ -67,6 +66,6 @@ func consumerListen(ctx context.Context, job consumerStrategy) {
ConsumerLog(ctx, topic, mqMsg, err)
}); listenErr != nil {
g.Log().Fatalf(ctx, "消费队列:%s 监听失败, err:%+v", topic, listenErr)
Logger().Fatalf(ctx, "消费队列:%s 监听失败, err:%+v", topic, listenErr)
}
}

View File

@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gfile"
"hotgo/internal/library/queue/disk"
"sync"
@ -45,7 +44,7 @@ func (q *DiskConsumerMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg M
if index, offset, data, err := queue.Read(); err == nil {
var mqMsg MqMsg
if err = json.Unmarshal(data, &mqMsg); err != nil {
g.Log().Warningf(ctx, "disk.ListenReceiveMsgDo Unmarshal err:%+v, topic%v, data:%+v .", err, topic, string(data))
Logger().Warningf(ctx, "disk.ListenReceiveMsgDo Unmarshal err:%+v, topic%v, data:%+v .", err, topic, string(data))
continue
}
if mqMsg.MsgId != "" {
@ -130,14 +129,14 @@ func NewDiskQueue(topic string, config *disk.Config) *disk.Queue {
if !gfile.Exists(conf.Path) {
if err := gfile.Mkdir(conf.Path); err != nil {
g.Log().Errorf(ctx, "NewDiskQueue Failed to create the cache directory. Procedure, err:%+v", err)
Logger().Errorf(ctx, "NewDiskQueue Failed to create the cache directory. Procedure, err:%+v", err)
return nil
}
}
queue, err := disk.New(conf)
if err != nil {
g.Log().Errorf(ctx, "NewDiskQueue err:%v", err)
Logger().Errorf(ctx, "NewDiskQueue err:%v", err)
return nil
}
return queue

View File

@ -71,7 +71,6 @@ func (r *KafkaMq) SendByteMsg(topic string, body []byte) (mqMsg MqMsg, err error
case <-sendCtx.Done():
return mqMsg, gerror.New("send mqMst timeout")
}
return mqMsg, nil
}
@ -95,11 +94,11 @@ func (r *KafkaMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg MqMsg))
go func(consumerCtx context.Context) {
for {
if err = r.consumerIns.Consume(consumerCtx, []string{topic}, &consumer); err != nil {
g.Log().Fatalf(ctx, "kafka Error from consumer, err%+v", err)
Logger().Fatalf(ctx, "kafka Error from consumer, err%+v", err)
}
if consumerCtx.Err() != nil {
g.Log().Debugf(ctx, fmt.Sprintf("kafka consoumer stop : %v", consumerCtx.Err()))
Logger().Debugf(ctx, fmt.Sprintf("kafka consoumer stop : %v", consumerCtx.Err()))
return
}
consumer.ready = make(chan bool)
@ -108,13 +107,13 @@ func (r *KafkaMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg MqMsg))
// await till the consumer has been set up
<-consumer.ready
g.Log().Debug(ctx, "kafka consumer up and running!...")
Logger().Debug(ctx, "kafka consumer up and running!...")
gproc.AddSigHandlerShutdown(func(sig os.Signal) {
g.Log().Debug(ctx, "kafka consumer close...")
Logger().Debug(ctx, "kafka consumer close...")
cancel()
if err = r.consumerIns.Close(); err != nil {
g.Log().Fatalf(ctx, "kafka Error closing client, err:%+v", err)
Logger().Fatalf(ctx, "kafka Error closing client, err:%+v", err)
}
})
return
@ -256,6 +255,5 @@ func (consumer *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, clai
})
session.MarkMessage(message, "")
}
return nil
}

View File

@ -8,6 +8,7 @@ package queue
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/glog"
)
const (
@ -15,16 +16,20 @@ const (
ProducerLogErrFormat = "生产 [%s] 失败, body:%+v, err:%+v"
)
func Logger() *glog.Logger {
return g.Log("queue")
}
// ConsumerLog 消费日志
func ConsumerLog(ctx context.Context, topic string, mqMsg MqMsg, err error) {
if err != nil {
g.Log().Errorf(ctx, ConsumerLogErrFormat, topic, string(mqMsg.Body), err)
Logger().Errorf(ctx, ConsumerLogErrFormat, topic, string(mqMsg.Body), err)
}
}
// ProducerLog 生产日志
func ProducerLog(ctx context.Context, topic string, mqMsg MqMsg, err error) {
if err != nil {
g.Log().Errorf(ctx, ProducerLogErrFormat, topic, string(mqMsg.Body), err)
Logger().Errorf(ctx, ProducerLogErrFormat, topic, string(mqMsg.Body), err)
}
}

View File

@ -79,7 +79,7 @@ func init() {
mqProducerInstanceMap = make(map[string]MqProducer)
mqConsumerInstanceMap = make(map[string]MqConsumer)
if err := g.Cfg().MustGet(ctx, "queue").Scan(&config); err != nil {
g.Log().Warningf(ctx, "queue init err:%+v", err)
Logger().Warningf(ctx, "queue init err:%+v", err)
}
}
@ -207,7 +207,6 @@ func NewConsumer(groupName string) (mqClient MqConsumer, err error) {
mutex.Lock()
defer mutex.Unlock()
mqConsumerInstanceMap[groupName] = mqClient
return
}

View File

@ -148,7 +148,7 @@ func (r *RedisMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg MqMsg))
}
for err = range errCh {
if err != nil && err != context.Canceled && err != context.DeadlineExceeded {
g.Log().Infof(ctx, "ListenReceiveMsgDo Delay topic:%v, err:%+v", topic, err)
Logger().Infof(ctx, "ListenReceiveMsgDo Delay topic:%v, err:%+v", topic, err)
}
}
}()
@ -166,7 +166,7 @@ func (r *RedisMq) loopReadQueue(key string) (mqMsgList []MqMsg) {
for {
data, err := conn.Do(ctx, "RPOP", key)
if err != nil {
g.Log().Warningf(ctx, "loopReadQueue redis RPOP err:%+v", err)
Logger().Warningf(ctx, "loopReadQueue redis RPOP err:%+v", err)
break
}
@ -176,7 +176,7 @@ func (r *RedisMq) loopReadQueue(key string) (mqMsgList []MqMsg) {
var mqMsg MqMsg
if err = data.Scan(&mqMsg); err != nil {
g.Log().Warningf(ctx, "loopReadQueue Scan err:%+v", err)
Logger().Warningf(ctx, "loopReadQueue Scan err:%+v", err)
break
}

View File

@ -3,13 +3,8 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package queue
import (
"github.com/gogf/gf/v2/frame/g"
)
type RocketMqLogger struct {
Flag string
LevelLog string
@ -22,18 +17,17 @@ func (l *RocketMqLogger) Debug(msg string, fields map[string]interface{}) {
if msg == "" && len(fields) == 0 {
return
}
if l.LevelLog == "debug" || l.LevelLog == "all" {
g.Log().Debug(ctx, msg)
Logger().Debug(ctx, msg)
}
}
func (l *RocketMqLogger) Level(level string) {
g.Log().Info(ctx, level)
Logger().Info(ctx, level)
}
func (l *RocketMqLogger) OutputPath(path string) (err error) {
g.Log().Info(ctx, path)
Logger().Info(ctx, path)
return nil
}
@ -46,7 +40,7 @@ func (l *RocketMqLogger) Info(msg string, fields map[string]interface{}) {
}
if l.LevelLog == "info" || l.LevelLog == "all" {
g.Log().Info(ctx, msg)
Logger().Info(ctx, msg)
}
}
@ -59,7 +53,7 @@ func (l *RocketMqLogger) Warning(msg string, fields map[string]interface{}) {
}
if l.LevelLog == "warn" || l.LevelLog == "all" {
g.Log().Warning(ctx, msg)
Logger().Warning(ctx, msg)
}
}
@ -71,7 +65,7 @@ func (l *RocketMqLogger) Error(msg string, fields map[string]interface{}) {
return
}
if l.LevelLog == "error" || l.LevelLog == "all" {
g.Log().Error(ctx, msg)
Logger().Error(ctx, msg)
}
}
@ -84,6 +78,6 @@ func (l *RocketMqLogger) Fatal(msg string, fields map[string]interface{}) {
}
if l.LevelLog == "fatal" || l.LevelLog == "all" {
g.Log().Fatal(ctx, msg)
Logger().Fatal(ctx, msg)
}
}

View File

@ -21,11 +21,6 @@ func JsonExit(r *ghttp.Request, code int, message string, data ...interface{}) {
}
// RJson 标准返回结果数据结构封装
// @Description: 返回固定数据结构的JSON
// @param r
// @param code 状态码(200:成功,302跳转和http请求状态码一至)
// @param message 请求结果信息
// @param data 请求结果,根据不同接口返回结果的数据结构不同
func RJson(r *ghttp.Request, code int, message string, data ...interface{}) {
responseData := interface{}(nil)
if len(data) > 0 {

View File

@ -33,6 +33,5 @@ func New(name ...string) Drive {
default:
panic(fmt.Sprintf("暂不支持短信驱动:%v", instanceName))
}
return drive
}

View File

@ -125,6 +125,5 @@ func (d *tencent) SendCode(ctx context.Context, in sysin.SendCodeInp, config *mo
* [UnsupportedOperation.ContainDomesticAndInternationalPhoneNumber](https://cloud.tencent.com/document/product/382/9558#.E7.9F.AD.E4.BF.A1.E5.8F.91.E9.80.81.E6.8F.90.E7.A4.BA.EF.BC.9Aunsupportedoperation.containdomesticandinternationalphonenumber-.E5.A6.82.E4.BD.95.E5.A4.84.E7.90.86.EF.BC.9F)
* 更多错误可咨询[腾讯云助手](https://tccc.qcloud.com/web/im/index.html#/chat?webAppId=8fa15978f85cb41f7e2ea36920cb3ae1&title=Sms)
*/
return
}

View File

@ -81,7 +81,6 @@ func Login(ctx context.Context, user *model.Identity) (string, int64, error) {
if err = cache.Instance().Set(ctx, bindKey, tokenKey, duration); err != nil {
return "", 0, err
}
return header, config.Expires, nil
}
@ -270,7 +269,6 @@ func parseToken(ctx context.Context, header string) (*Claims, error) {
if !ok {
return nil, errorLogin
}
return claims, nil
}
@ -283,7 +281,6 @@ func GetAuthorization(r *ghttp.Request) string {
if authorization == "" {
return r.Get("authorization").String()
}
return gstr.Replace(authorization, "Bearer ", "")
}

View File

@ -68,7 +68,6 @@ func GetOpenUserAccessToken(ctx context.Context, code string) (accessToken offic
err = gerror.Newf("GetOpenUserAccessToken err:%+v", accessToken.ErrMsg)
return
}
return
}
@ -98,7 +97,6 @@ func GetUserAccessToken(ctx context.Context, code string) (accessToken officialO
err = gerror.Newf("GetUserAccessToken err:%+v", accessToken.ErrMsg)
return
}
return
}

View File

@ -55,7 +55,6 @@ func allow(memberId int64) bool {
v.lastSeen = gtime.Now()
return true
}
return false
}

View File

@ -172,12 +172,6 @@ func (s *sSysConfig) GetLoadToken(ctx context.Context) (conf *model.TokenConfig,
return
}
// GetLoadSSL 获取本地日志配置
func (s *sSysConfig) GetLoadSSL(ctx context.Context) (conf *model.SSLConfig, err error) {
err = g.Cfg().MustGet(ctx, "hotgo.ssl").Scan(&conf)
return
}
// GetLoadLog 获取本地日志配置
func (s *sSysConfig) GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error) {
err = g.Cfg().MustGet(ctx, "hotgo.log").Scan(&conf)

View File

@ -12,8 +12,8 @@ import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"hotgo/internal/consts"
"hotgo/internal/crons"
"hotgo/internal/dao"
"hotgo/internal/library/cron"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/sysin"
@ -39,12 +39,12 @@ func (s *sSysCron) StartCron(ctx context.Context) {
Where("status", consts.StatusEnabled).
Order("sort asc,id desc").
Scan(&list); err != nil {
g.Log().Fatalf(ctx, "定时任务获取失败, err . %v", err)
cron.Logger().Fatalf(ctx, "定时任务获取失败, err . %v", err)
return
}
if err := crons.StartALL(list); err != nil {
g.Log().Fatalf(ctx, "定时任务启动失败, err . %v", err)
if err := cron.StartALL(list); err != nil {
cron.Logger().Fatalf(ctx, "定时任务启动失败, err . %v", err)
return
}
}
@ -66,7 +66,7 @@ func (s *sSysCron) Delete(ctx context.Context, in sysin.CronDeleteInp) (err erro
if _, err = dao.SysCron.Ctx(ctx).Where("id", in.Id).Delete(); err != nil {
return
}
return crons.Delete(models)
return cron.Delete(models)
})
return
}
@ -84,7 +84,7 @@ func (s *sSysCron) Edit(ctx context.Context, in sysin.CronEditInp) (err error) {
return
}
simple.SafeGo(ctx, func(ctx context.Context) {
_ = crons.RefreshStatus(&in.SysCron)
_ = cron.RefreshStatus(&in.SysCron)
})
return
}
@ -128,7 +128,7 @@ func (s *sSysCron) Status(ctx context.Context, in sysin.CronStatusInp) (err erro
models.Status = in.Status
simple.SafeGo(ctx, func(ctx context.Context) {
_ = crons.RefreshStatus(models)
_ = cron.RefreshStatus(models)
})
return
}
@ -201,5 +201,5 @@ func (s *sSysCron) OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err
}
newCtx := context.WithValue(gctx.New(), consts.ContextKeyCronArgs, strings.Split(data.Params, consts.CronSplitStr))
return crons.Once(newCtx, data)
return cron.Once(newCtx, data)
}

View File

@ -31,7 +31,6 @@ func (s *sSysDictData) Delete(ctx context.Context, in sysin.DictDataDeleteInp) e
err = gerror.Wrap(err, consts.ErrorORM)
return err
}
return nil
}
@ -110,7 +109,6 @@ func (s *sSysDictData) List(ctx context.Context, in sysin.DictDataListInp) (list
for _, v := range list {
v.TypeID, _ = dao.SysDictType.GetId(ctx, v.Type)
}
return list, totalCount, err
}

View File

@ -1,5 +1,7 @@
package model
// 后台配置.
// BasicConfig 基础配置
type BasicConfig struct {
CaptchaSwitch int `json:"basicCaptchaSwitch"`
@ -170,123 +172,3 @@ type LoginConfig struct {
AutoOpenId int `json:"loginAutoOpenId"`
ForceInvite int `json:"loginForceInvite"`
}
///////////// 以下是本地配置
// SSLConfig https配置
type SSLConfig struct {
Switch bool `json:"switch"`
CrtPath string `json:"crtPath"`
KeyPath string `json:"keyPath"`
}
// LogConfig 日志配置
type LogConfig struct {
Switch bool `json:"switch"`
Queue bool `json:"queue"`
Module []string `json:"module"`
SkipCode []string `json:"skipCode"`
}
// ServeLogConfig 服务日志配置
type ServeLogConfig struct {
Switch bool `json:"switch"`
Queue bool `json:"queue"`
LevelFormat []string `json:"levelFormat"`
}
// GenerateAppCrudTemplate curd模板
type GenerateAppCrudTemplate struct {
Group string `json:"group"`
IsAddon bool `json:"isAddon"`
MasterPackage string `json:"masterPackage"`
TemplatePath string `json:"templatePath"`
ApiPath string `json:"apiPath"`
InputPath string `json:"inputPath"`
ControllerPath string `json:"controllerPath"`
LogicPath string `json:"logicPath"`
RouterPath string `json:"routerPath"`
SqlPath string `json:"sqlPath"`
WebApiPath string `json:"webApiPath"`
WebViewsPath string `json:"webViewsPath"`
}
// GenerateAppQueueTemplate 消息队列模板
type GenerateAppQueueTemplate struct {
Group string `json:"group"`
TemplatePath string `json:"templatePath"`
}
// GenerateAppTreeTemplate 关系树列表模板
type GenerateAppTreeTemplate struct {
Group string `json:"group"`
TemplatePath string `json:"templatePath"`
}
// GenerateConfig 生成代码配置
type GenerateConfig struct {
AllowedIPs []string `json:"allowedIPs"`
Application struct {
Crud struct {
Templates []*GenerateAppCrudTemplate `json:"templates"`
} `json:"crud"`
Queue struct {
Templates []*GenerateAppQueueTemplate `json:"templates"`
} `json:"queue"`
Tree struct {
Templates []*GenerateAppTreeTemplate `json:"templates"`
} `json:"tree"`
} `json:"application"`
Delimiters []string `json:"delimiters"`
DevPath string `json:"devPath"`
DisableTables []string `json:"disableTables"`
SelectDbs []string `json:"selectDbs"`
Addon *BuildAddonConfig `json:"addon"`
}
// BuildAddonConfig 构建插件模块配置
type BuildAddonConfig struct {
SrcPath string `json:"srcPath"`
TemplatePath string `json:"templatePath"`
WebApiPath string `json:"webApiPath"`
WebViewsPath string `json:"webViewsPath"`
}
// CacheConfig 缓存配置
type CacheConfig struct {
Adapter string `json:"adapter"`
FileDir string `json:"fileDir"`
}
type TCPServerConfig struct {
Address string `json:"address"`
}
type TCPClientConfig struct {
Cron *TCPClientConnConfig `json:"cron"`
Auth *TCPClientConnConfig `json:"auth"`
}
type TCPClientConnConfig struct {
Group string `json:"group"`
Name string `json:"name"`
Address string `json:"address"`
AppId string `json:"appId"`
SecretKey string `json:"secretKey"`
}
// TCPConfig tcp服务器配置
type TCPConfig struct {
Server *TCPServerConfig `json:"server"`
Client *TCPClientConfig `json:"client"`
}
// TokenConfig 登录令牌配置
type TokenConfig struct {
SecretKey string `json:"secretKey"`
Expires int64 `json:"expires"`
AutoRefresh bool `json:"autoRefresh"`
RefreshInterval int64 `json:"refreshInterval"`
MaxRefreshTimes int64 `json:"maxRefreshTimes"`
MultiLogin bool `json:"multiLogin"`
}

View File

@ -0,0 +1,117 @@
package model
// 本地配置.
// LogConfig 日志配置
type LogConfig struct {
Switch bool `json:"switch"`
Queue bool `json:"queue"`
Module []string `json:"module"`
SkipCode []string `json:"skipCode"`
}
// ServeLogConfig 服务日志配置
type ServeLogConfig struct {
Switch bool `json:"switch"`
Queue bool `json:"queue"`
LevelFormat []string `json:"levelFormat"`
}
// GenerateAppCrudTemplate curd模板
type GenerateAppCrudTemplate struct {
Group string `json:"group"`
IsAddon bool `json:"isAddon"`
MasterPackage string `json:"masterPackage"`
TemplatePath string `json:"templatePath"`
ApiPath string `json:"apiPath"`
InputPath string `json:"inputPath"`
ControllerPath string `json:"controllerPath"`
LogicPath string `json:"logicPath"`
RouterPath string `json:"routerPath"`
SqlPath string `json:"sqlPath"`
WebApiPath string `json:"webApiPath"`
WebViewsPath string `json:"webViewsPath"`
}
// GenerateAppQueueTemplate 消息队列模板
type GenerateAppQueueTemplate struct {
Group string `json:"group"`
TemplatePath string `json:"templatePath"`
}
// GenerateAppTreeTemplate 关系树列表模板
type GenerateAppTreeTemplate struct {
Group string `json:"group"`
TemplatePath string `json:"templatePath"`
}
// GenerateConfig 生成代码配置
type GenerateConfig struct {
AllowedIPs []string `json:"allowedIPs"`
Application struct {
Crud struct {
Templates []*GenerateAppCrudTemplate `json:"templates"`
} `json:"crud"`
Queue struct {
Templates []*GenerateAppQueueTemplate `json:"templates"`
} `json:"queue"`
Tree struct {
Templates []*GenerateAppTreeTemplate `json:"templates"`
} `json:"tree"`
} `json:"application"`
Delimiters []string `json:"delimiters"`
DevPath string `json:"devPath"`
DisableTables []string `json:"disableTables"`
SelectDbs []string `json:"selectDbs"`
Addon *BuildAddonConfig `json:"addon"`
}
// BuildAddonConfig 构建插件模块配置
type BuildAddonConfig struct {
SrcPath string `json:"srcPath"`
TemplatePath string `json:"templatePath"`
WebApiPath string `json:"webApiPath"`
WebViewsPath string `json:"webViewsPath"`
}
// CacheConfig 缓存配置
type CacheConfig struct {
Adapter string `json:"adapter"`
FileDir string `json:"fileDir"`
}
// TCPServerConfig tcp服务器配置
type TCPServerConfig struct {
Address string `json:"address"`
}
// TCPClientConfig tcp客户端配置
type TCPClientConfig struct {
Cron *TCPClientConnConfig `json:"cron"`
Auth *TCPClientConnConfig `json:"auth"`
}
// TCPClientConnConfig tcp客户端认证
type TCPClientConnConfig struct {
Group string `json:"group"`
Name string `json:"name"`
Address string `json:"address"`
AppId string `json:"appId"`
SecretKey string `json:"secretKey"`
}
// TCPConfig tcp服务器配置
type TCPConfig struct {
Server *TCPServerConfig `json:"server"`
Client *TCPClientConfig `json:"client"`
}
// TokenConfig 登录令牌配置
type TokenConfig struct {
SecretKey string `json:"secretKey"`
Expires int64 `json:"expires"`
AutoRefresh bool `json:"autoRefresh"`
RefreshInterval int64 `json:"refreshInterval"`
MaxRefreshTimes int64 `json:"maxRefreshTimes"`
MultiLogin bool `json:"multiLogin"`
}

View File

@ -19,32 +19,6 @@ import (
)
type (
IAdminMember interface {
AddBalance(ctx context.Context, in adminin.MemberAddBalanceInp) (err error)
AddIntegral(ctx context.Context, in adminin.MemberAddIntegralInp) (err error)
UpdateCash(ctx context.Context, in adminin.MemberUpdateCashInp) (err error)
UpdateEmail(ctx context.Context, in adminin.MemberUpdateEmailInp) (err error)
UpdateMobile(ctx context.Context, in adminin.MemberUpdateMobileInp) (err error)
UpdateProfile(ctx context.Context, in adminin.MemberUpdateProfileInp) (err error)
UpdatePwd(ctx context.Context, in adminin.MemberUpdatePwdInp) (err error)
ResetPwd(ctx context.Context, in adminin.MemberResetPwdInp) (err error)
VerifyUnique(ctx context.Context, in adminin.VerifyUniqueInp) (err error)
Delete(ctx context.Context, in adminin.MemberDeleteInp) (err error)
Edit(ctx context.Context, in adminin.MemberEditInp) (err error)
View(ctx context.Context, in adminin.MemberViewInp) (res *adminin.MemberViewModel, err error)
List(ctx context.Context, in adminin.MemberListInp) (list []*adminin.MemberListModel, totalCount int, err error)
Status(ctx context.Context, in adminin.MemberStatusInp) (err error)
GenTree(ctx context.Context, pid int64) (level int, newTree string, err error)
LoginMemberInfo(ctx context.Context) (res *adminin.LoginMemberInfoModel, err error)
MemberLoginStat(ctx context.Context, in adminin.MemberLoginStatInp) (res *adminin.MemberLoginStatModel, err error)
GetIdByCode(ctx context.Context, in adminin.GetIdByCodeInp) (res *adminin.GetIdByCodeModel, err error)
Select(ctx context.Context, in adminin.MemberSelectInp) (res []*adminin.MemberSelectModel, err error)
VerifySuperId(ctx context.Context, verifyId int64) bool
FilterAuthModel(ctx context.Context, memberId int64) *gdb.Model
}
IAdminMemberPost interface {
UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error)
}
IAdminMenu interface {
MaxSort(ctx context.Context, req *menu.MaxSortReq) (res *menu.MaxSortRes, err error)
NameUnique(ctx context.Context, req *menu.NameUniqueReq) (res *menu.NameUniqueRes, err error)
@ -56,48 +30,6 @@ type (
GetMenuList(ctx context.Context, memberId int64) (res *role.DynamicRes, 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)
}
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)
}
IAdminDept interface {
Delete(ctx context.Context, in adminin.DeptDeleteInp) (err error)
Edit(ctx context.Context, in adminin.DeptEditInp) (err error)
Status(ctx context.Context, in adminin.DeptStatusInp) (err error)
MaxSort(ctx context.Context, in adminin.DeptMaxSortInp) (res *adminin.DeptMaxSortModel, err error)
View(ctx context.Context, in adminin.DeptViewInp) (res *adminin.DeptViewModel, err error)
Option(ctx context.Context, in adminin.DeptOptionInp) (res *adminin.DeptOptionModel, totalCount int, err error)
List(ctx context.Context, in adminin.DeptListInp) (res *adminin.DeptListModel, err error)
GetName(ctx context.Context, id int64) (name string, err error)
}
IAdminMonitor interface {
StartMonitor(ctx context.Context)
GetMeta(ctx context.Context) *model.MonitorData
@ -138,56 +70,91 @@ type (
DataScopeSelect() (res form.Selects)
DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (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 {
Delete(ctx context.Context, in adminin.DeptDeleteInp) (err error)
Edit(ctx context.Context, in adminin.DeptEditInp) (err error)
Status(ctx context.Context, in adminin.DeptStatusInp) (err error)
MaxSort(ctx context.Context, in adminin.DeptMaxSortInp) (res *adminin.DeptMaxSortModel, err error)
View(ctx context.Context, in adminin.DeptViewInp) (res *adminin.DeptViewModel, err error)
Option(ctx context.Context, in adminin.DeptOptionInp) (res *adminin.DeptOptionModel, totalCount int, err error)
List(ctx context.Context, in adminin.DeptListInp) (res *adminin.DeptListModel, err error)
GetName(ctx context.Context, id int64) (name string, err error)
}
IAdminMemberPost interface {
UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (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)
}
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 {
AddBalance(ctx context.Context, in adminin.MemberAddBalanceInp) (err error)
AddIntegral(ctx context.Context, in adminin.MemberAddIntegralInp) (err error)
UpdateCash(ctx context.Context, in adminin.MemberUpdateCashInp) (err error)
UpdateEmail(ctx context.Context, in adminin.MemberUpdateEmailInp) (err error)
UpdateMobile(ctx context.Context, in adminin.MemberUpdateMobileInp) (err error)
UpdateProfile(ctx context.Context, in adminin.MemberUpdateProfileInp) (err error)
UpdatePwd(ctx context.Context, in adminin.MemberUpdatePwdInp) (err error)
ResetPwd(ctx context.Context, in adminin.MemberResetPwdInp) (err error)
VerifyUnique(ctx context.Context, in adminin.VerifyUniqueInp) (err error)
Delete(ctx context.Context, in adminin.MemberDeleteInp) (err error)
Edit(ctx context.Context, in adminin.MemberEditInp) (err error)
View(ctx context.Context, in adminin.MemberViewInp) (res *adminin.MemberViewModel, err error)
List(ctx context.Context, in adminin.MemberListInp) (list []*adminin.MemberListModel, totalCount int, err error)
Status(ctx context.Context, in adminin.MemberStatusInp) (err error)
GenTree(ctx context.Context, pid int64) (level int, newTree string, err error)
LoginMemberInfo(ctx context.Context) (res *adminin.LoginMemberInfoModel, err error)
MemberLoginStat(ctx context.Context, in adminin.MemberLoginStatInp) (res *adminin.MemberLoginStatModel, err error)
GetIdByCode(ctx context.Context, in adminin.GetIdByCodeInp) (res *adminin.GetIdByCodeModel, err error)
Select(ctx context.Context, in adminin.MemberSelectInp) (res []*adminin.MemberSelectModel, err error)
VerifySuperId(ctx context.Context, verifyId int64) bool
FilterAuthModel(ctx context.Context, memberId int64) *gdb.Model
}
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 (
localAdminSite IAdminSite
localAdminCash IAdminCash
localAdminCreditsLog IAdminCreditsLog
localAdminDept IAdminDept
localAdminMemberPost IAdminMemberPost
localAdminMenu IAdminMenu
localAdminMonitor IAdminMonitor
localAdminOrder IAdminOrder
localAdminPost IAdminPost
localAdminRole IAdminRole
localAdminCash IAdminCash
localAdminSite IAdminSite
localAdminMember IAdminMember
localAdminMemberPost IAdminMemberPost
localAdminMenu IAdminMenu
localAdminNotice IAdminNotice
localAdminCreditsLog IAdminCreditsLog
)
func AdminSite() IAdminSite {
if localAdminSite == nil {
panic("implement not found for interface IAdminSite, forgot register?")
}
return localAdminSite
}
func RegisterAdminSite(i IAdminSite) {
localAdminSite = 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 AdminDept() IAdminDept {
if localAdminDept == nil {
panic("implement not found for interface IAdminDept, forgot register?")
@ -199,6 +166,28 @@ func RegisterAdminDept(i IAdminDept) {
localAdminDept = i
}
func AdminMemberPost() IAdminMemberPost {
if localAdminMemberPost == nil {
panic("implement not found for interface IAdminMemberPost, forgot register?")
}
return localAdminMemberPost
}
func RegisterAdminMemberPost(i IAdminMemberPost) {
localAdminMemberPost = i
}
func AdminMenu() IAdminMenu {
if localAdminMenu == nil {
panic("implement not found for interface IAdminMenu, forgot register?")
}
return localAdminMenu
}
func RegisterAdminMenu(i IAdminMenu) {
localAdminMenu = i
}
func AdminMonitor() IAdminMonitor {
if localAdminMonitor == nil {
panic("implement not found for interface IAdminMonitor, forgot register?")
@ -243,6 +232,28 @@ func RegisterAdminRole(i IAdminRole) {
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 AdminSite() IAdminSite {
if localAdminSite == nil {
panic("implement not found for interface IAdminSite, forgot register?")
}
return localAdminSite
}
func RegisterAdminSite(i IAdminSite) {
localAdminSite = i
}
func AdminMember() IAdminMember {
if localAdminMember == nil {
panic("implement not found for interface IAdminMember, forgot register?")
@ -254,28 +265,6 @@ func RegisterAdminMember(i IAdminMember) {
localAdminMember = i
}
func AdminMemberPost() IAdminMemberPost {
if localAdminMemberPost == nil {
panic("implement not found for interface IAdminMemberPost, forgot register?")
}
return localAdminMemberPost
}
func RegisterAdminMemberPost(i IAdminMemberPost) {
localAdminMemberPost = i
}
func AdminMenu() IAdminMenu {
if localAdminMenu == nil {
panic("implement not found for interface IAdminMenu, forgot register?")
}
return localAdminMenu
}
func RegisterAdminMenu(i IAdminMenu) {
localAdminMenu = i
}
func AdminNotice() IAdminNotice {
if localAdminNotice == nil {
panic("implement not found for interface IAdminNotice, forgot register?")
@ -286,3 +275,14 @@ func AdminNotice() IAdminNotice {
func RegisterAdminNotice(i IAdminNotice) {
localAdminNotice = i
}
func AdminCreditsLog() IAdminCreditsLog {
if localAdminCreditsLog == nil {
panic("implement not found for interface IAdminCreditsLog, forgot register?")
}
return localAdminCreditsLog
}
func RegisterAdminCreditsLog(i IAdminCreditsLog) {
localAdminCreditsLog = i
}

View File

@ -17,71 +17,29 @@ import (
)
type (
ISysSmsLog interface {
Delete(ctx context.Context, in sysin.SmsLogDeleteInp) (err error)
Edit(ctx context.Context, in sysin.SmsLogEditInp) (err error)
Status(ctx context.Context, in sysin.SmsLogStatusInp) (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)
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)
}
ISysServeLog interface {
Model(ctx context.Context) *gdb.Model
List(ctx context.Context, in sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error)
Export(ctx context.Context, in sysin.ServeLogListInp) (err error)
Delete(ctx context.Context, in sysin.ServeLogDeleteInp) (err error)
View(ctx context.Context, in sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
RealWrite(ctx context.Context, models entity.SysServeLog) (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)
}
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)
}
ISysCron interface {
StartCron(ctx context.Context)
Delete(ctx context.Context, in sysin.CronDeleteInp) (err error)
Edit(ctx context.Context, in sysin.CronEditInp) (err error)
Status(ctx context.Context, in sysin.CronStatusInp) (err error)
MaxSort(ctx context.Context, in sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error)
View(ctx context.Context, in sysin.CronViewInp) (res *sysin.CronViewModel, 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)
}
ISysCurdDemo interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, in sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
Export(ctx context.Context, in sysin.CurdDemoListInp) (err error)
Edit(ctx context.Context, in sysin.CurdDemoEditInp) (err error)
Delete(ctx context.Context, in sysin.CurdDemoDeleteInp) (err error)
MaxSort(ctx context.Context, in sysin.CurdDemoMaxSortInp) (res *sysin.CurdDemoMaxSortModel, err error)
View(ctx context.Context, in sysin.CurdDemoViewInp) (res *sysin.CurdDemoViewModel, err error)
Status(ctx context.Context, in sysin.CurdDemoStatusInp) (err error)
Switch(ctx context.Context, in sysin.CurdDemoSwitchInp) (err error)
}
ISysDictType interface {
Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error)
Delete(ctx context.Context, in sysin.DictTypeDeleteInp) (err error)
Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error)
TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, 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)
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)
}
ISysGenCodes interface {
Delete(ctx context.Context, in sysin.GenCodesDeleteInp) (err error)
@ -97,12 +55,70 @@ type (
Preview(ctx context.Context, in sysin.GenCodesPreviewInp) (res *sysin.GenCodesPreviewModel, err error)
Build(ctx context.Context, in sysin.GenCodesBuildInp) (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)
}
ISysServeLog interface {
Model(ctx context.Context) *gdb.Model
List(ctx context.Context, in sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error)
Export(ctx context.Context, in sysin.ServeLogListInp) (err error)
Delete(ctx context.Context, in sysin.ServeLogDeleteInp) (err error)
View(ctx context.Context, in sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
RealWrite(ctx context.Context, models entity.SysServeLog) (err error)
}
ISysAddonsConfig interface {
GetConfigByGroup(ctx context.Context, in sysin.GetAddonsConfigInp) (res *sysin.GetAddonsConfigModel, err error)
ConversionType(ctx context.Context, models *entity.SysAddonsConfig) (value interface{}, err error)
UpdateConfigByGroup(ctx context.Context, in sysin.UpdateAddonsConfigInp) (err error)
}
ISysAttachment interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
Delete(ctx context.Context, in sysin.AttachmentDeleteInp) (err error)
View(ctx context.Context, in sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
List(ctx context.Context, in sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
}
ISysCron interface {
StartCron(ctx context.Context)
Delete(ctx context.Context, in sysin.CronDeleteInp) (err error)
Edit(ctx context.Context, in sysin.CronEditInp) (err error)
Status(ctx context.Context, in sysin.CronStatusInp) (err error)
MaxSort(ctx context.Context, in sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error)
View(ctx context.Context, in sysin.CronViewInp) (res *sysin.CronViewModel, 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)
}
ISysDictType interface {
Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error)
Delete(ctx context.Context, in sysin.DictTypeDeleteInp) (err error)
Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error)
TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error)
}
ISysSmsLog interface {
Delete(ctx context.Context, in sysin.SmsLogDeleteInp) (err error)
Edit(ctx context.Context, in sysin.SmsLogEditInp) (err error)
Status(ctx context.Context, in sysin.SmsLogStatusInp) (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)
}
ISysBlacklist interface {
Delete(ctx context.Context, in sysin.BlacklistDeleteInp) (err error)
Edit(ctx context.Context, in sysin.BlacklistEditInp) (err error)
@ -127,30 +143,33 @@ type (
GetLoadCache(ctx context.Context) (conf *model.CacheConfig, err error)
GetLoadGenerate(ctx context.Context) (conf *model.GenerateConfig, err error)
GetLoadToken(ctx context.Context) (conf *model.TokenConfig, err error)
GetLoadSSL(ctx context.Context) (conf *model.SSLConfig, err error)
GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error)
GetLoadServeLog(ctx context.Context) (conf *model.ServeLogConfig, err error)
GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (res *sysin.GetConfigModel, err error)
ConversionType(ctx context.Context, models *entity.SysConfig) (value interface{}, err error)
UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) (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)
ISysCurdDemo interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
List(ctx context.Context, in sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
Export(ctx context.Context, in sysin.CurdDemoListInp) (err error)
Edit(ctx context.Context, in sysin.CurdDemoEditInp) (err error)
Delete(ctx context.Context, in sysin.CurdDemoDeleteInp) (err error)
MaxSort(ctx context.Context, in sysin.CurdDemoMaxSortInp) (res *sysin.CurdDemoMaxSortModel, err error)
View(ctx context.Context, in sysin.CurdDemoViewInp) (res *sysin.CurdDemoViewModel, err error)
Status(ctx context.Context, in sysin.CurdDemoStatusInp) (err error)
Switch(ctx context.Context, in sysin.CurdDemoSwitchInp) (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)
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)
}
ISysProvinces interface {
Tree(ctx context.Context) (list []g.Map, err error)
@ -164,90 +183,37 @@ type (
UniqueId(ctx context.Context, in sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
Select(ctx context.Context, in sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
}
ISysAddonsConfig interface {
GetConfigByGroup(ctx context.Context, in sysin.GetAddonsConfigInp) (res *sysin.GetAddonsConfigModel, err error)
ConversionType(ctx context.Context, models *entity.SysAddonsConfig) (value interface{}, err error)
UpdateConfigByGroup(ctx context.Context, in sysin.UpdateAddonsConfigInp) (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)
}
)
var (
localSysCron ISysCron
localSysConfig ISysConfig
localSysCurdDemo ISysCurdDemo
localSysServeLog ISysServeLog
localSysEmsLog ISysEmsLog
localSysProvinces ISysProvinces
localSysAddons ISysAddons
localSysBlacklist ISysBlacklist
localSysConfig ISysConfig
localSysDictType ISysDictType
localSysEmsLog ISysEmsLog
localSysGenCodes ISysGenCodes
localSysAttachment ISysAttachment
localSysCronGroup ISysCronGroup
localSysDictData ISysDictData
localSysLog ISysLog
localSysLoginLog ISysLoginLog
localSysProvinces ISysProvinces
localSysAddonsConfig ISysAddonsConfig
localSysServeLog ISysServeLog
localSysDictData ISysDictData
localSysGenCodes ISysGenCodes
localSysCron ISysCron
localSysDictType ISysDictType
localSysSmsLog ISysSmsLog
localSysAddonsConfig ISysAddonsConfig
localSysAttachment ISysAttachment
)
func SysConfig() ISysConfig {
if localSysConfig == nil {
panic("implement not found for interface ISysConfig, forgot register?")
func SysAddonsConfig() ISysAddonsConfig {
if localSysAddonsConfig == nil {
panic("implement not found for interface ISysAddonsConfig, forgot register?")
}
return localSysConfig
return localSysAddonsConfig
}
func RegisterSysConfig(i ISysConfig) {
localSysConfig = i
}
func SysDictType() ISysDictType {
if localSysDictType == nil {
panic("implement not found for interface ISysDictType, forgot register?")
}
return localSysDictType
}
func RegisterSysDictType(i ISysDictType) {
localSysDictType = 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 SysGenCodes() ISysGenCodes {
if localSysGenCodes == nil {
panic("implement not found for interface ISysGenCodes, forgot register?")
}
return localSysGenCodes
}
func RegisterSysGenCodes(i ISysGenCodes) {
localSysGenCodes = i
func RegisterSysAddonsConfig(i ISysAddonsConfig) {
localSysAddonsConfig = i
}
func SysAttachment() ISysAttachment {
@ -261,81 +227,26 @@ func RegisterSysAttachment(i ISysAttachment) {
localSysAttachment = i
}
func SysBlacklist() ISysBlacklist {
if localSysBlacklist == nil {
panic("implement not found for interface ISysBlacklist, forgot register?")
func SysCron() ISysCron {
if localSysCron == nil {
panic("implement not found for interface ISysCron, forgot register?")
}
return localSysBlacklist
return localSysCron
}
func RegisterSysBlacklist(i ISysBlacklist) {
localSysBlacklist = i
func RegisterSysCron(i ISysCron) {
localSysCron = i
}
func SysDictData() ISysDictData {
if localSysDictData == nil {
panic("implement not found for interface ISysDictData, forgot register?")
func SysDictType() ISysDictType {
if localSysDictType == nil {
panic("implement not found for interface ISysDictType, forgot register?")
}
return localSysDictData
return localSysDictType
}
func RegisterSysDictData(i ISysDictData) {
localSysDictData = i
}
func SysLog() ISysLog {
if localSysLog == nil {
panic("implement not found for interface ISysLog, forgot register?")
}
return localSysLog
}
func RegisterSysLog(i ISysLog) {
localSysLog = 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 SysAddonsConfig() ISysAddonsConfig {
if localSysAddonsConfig == nil {
panic("implement not found for interface ISysAddonsConfig, forgot register?")
}
return localSysAddonsConfig
}
func RegisterSysAddonsConfig(i ISysAddonsConfig) {
localSysAddonsConfig = i
}
func SysCronGroup() ISysCronGroup {
if localSysCronGroup == nil {
panic("implement not found for interface ISysCronGroup, forgot register?")
}
return localSysCronGroup
}
func RegisterSysCronGroup(i ISysCronGroup) {
localSysCronGroup = i
func RegisterSysDictType(i ISysDictType) {
localSysDictType = i
}
func SysSmsLog() ISysSmsLog {
@ -349,6 +260,39 @@ func RegisterSysSmsLog(i ISysSmsLog) {
localSysSmsLog = i
}
func SysAddons() ISysAddons {
if localSysAddons == nil {
panic("implement not found for interface ISysAddons, forgot register?")
}
return localSysAddons
}
func RegisterSysAddons(i ISysAddons) {
localSysAddons = i
}
func SysBlacklist() ISysBlacklist {
if localSysBlacklist == nil {
panic("implement not found for interface ISysBlacklist, forgot register?")
}
return localSysBlacklist
}
func RegisterSysBlacklist(i ISysBlacklist) {
localSysBlacklist = i
}
func SysConfig() ISysConfig {
if localSysConfig == nil {
panic("implement not found for interface ISysConfig, forgot register?")
}
return localSysConfig
}
func RegisterSysConfig(i ISysConfig) {
localSysConfig = i
}
func SysCurdDemo() ISysCurdDemo {
if localSysCurdDemo == nil {
panic("implement not found for interface ISysCurdDemo, forgot register?")
@ -360,6 +304,83 @@ func RegisterSysCurdDemo(i ISysCurdDemo) {
localSysCurdDemo = 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 SysProvinces() ISysProvinces {
if localSysProvinces == nil {
panic("implement not found for interface ISysProvinces, forgot register?")
}
return localSysProvinces
}
func RegisterSysProvinces(i ISysProvinces) {
localSysProvinces = i
}
func SysCronGroup() ISysCronGroup {
if localSysCronGroup == nil {
panic("implement not found for interface ISysCronGroup, forgot register?")
}
return localSysCronGroup
}
func RegisterSysCronGroup(i ISysCronGroup) {
localSysCronGroup = i
}
func SysLog() ISysLog {
if localSysLog == nil {
panic("implement not found for interface ISysLog, forgot register?")
}
return localSysLog
}
func RegisterSysLog(i ISysLog) {
localSysLog = 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 SysGenCodes() ISysGenCodes {
if localSysGenCodes == nil {
panic("implement not found for interface ISysGenCodes, forgot register?")
}
return localSysGenCodes
}
func RegisterSysGenCodes(i ISysGenCodes) {
localSysGenCodes = 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 SysServeLog() ISysServeLog {
if localSysServeLog == nil {
panic("implement not found for interface ISysServeLog, forgot register?")
@ -370,25 +391,3 @@ func SysServeLog() ISysServeLog {
func RegisterSysServeLog(i ISysServeLog) {
localSysServeLog = i
}
func SysAddons() ISysAddons {
if localSysAddons == nil {
panic("implement not found for interface ISysAddons, forgot register?")
}
return localSysAddons
}
func RegisterSysAddons(i ISysAddons) {
localSysAddons = i
}
func SysCron() ISysCron {
if localSysCron == nil {
panic("implement not found for interface ISysCron, forgot register?")
}
return localSysCron
}
func RegisterSysCron(i ISysCron) {
localSysCron = i
}

View File

@ -28,8 +28,8 @@ type (
)
var (
localCronClient ICronClient
localAuthClient IAuthClient
localCronClient ICronClient
)
func AuthClient() IAuthClient {

View File

@ -6,11 +6,6 @@ hotgo:
ipMethod: "whois"
# 是否为演示系统 false|true
isDemo: false
# https
ssl:
switch: false # 是否开启https访问需要配置sslCrtPathsslKeyPath证书夹
crtPath: "storage/cert/ssl/server.crt" # 证书路径
keyPath: "storage/cert/ssl/server.key" # 密钥路径
# 全局请求日志
log:
switch: true # 日志开关默认为true
@ -44,11 +39,19 @@ server:
errorLogPattern: "error/{Y-m-d}.log" # 异常错误日志文件格式默认为"error-{Ymd}.log"
accessLogEnabled: true # 是否记录访问日志默认为false
accessLogPattern: "access/{Y-m-d}.log" # 访问日志文件格式默认为"access-{Ymd}.log"
maxHeaderBytes: "100KB" # 请求头大小限制请求头包括客户端提交的Cookie数据默认设置为100KB
clientMaxBodySize: "200MB" # 客户端提交的Body大小限制同时也影响文件上传大小默认设置为200MB
serverAgent: "HG HTTP Server"
# PProf配置
pprofEnabled: true # 是否开启PProf性能调试特性默认为false
pprofPattern: "/pprof" # 开启PProf时有效表示PProf特性的页面访问路径对当前Server绑定的所有域名有效
# 服务日志配置
logger:
level: "all"
flags: 42
rotateExpire: "7d" # 日志保留天数
rotateBackupLimit: 2 # 最大备份数量
rotateBackupCompress: 2 # 日志文件压缩级别0-9,9最高
tcp:
@ -73,11 +76,10 @@ tcp:
secretKey: "123456" # 密钥
# Global logging.
logger:
# 统一默认日志配置
defaultLogger: &defaultLogger
level: "all"
flags: 42
path: "logs/logger" # 日志文件路径默认为空表示关闭仅输出到终端
file: "{Y-m-d}.log" # 日志文件格式默认为"{Y-m-d}.log"
stdoutColorDisabled: false # 关闭终端的颜色打印默认开启
writerColorEnable: false # 日志文件是否带上颜色默认false表示不带颜色
@ -86,6 +88,29 @@ logger:
rotateBackupCompress: 2 # 日志文件压缩级别0-9,9最高
# 日志配置
logger:
# 全局日志g.Log()
path: "logs/logger" # 日志文件路径默认为空表示关闭仅输出到终端
<<: *defaultLogger
# 定时任务g.Log("cron")
cron:
path: "logs/cron" # 日志文件路径默认为空表示关闭仅输出到终端
<<: *defaultLogger
# 消息队列g.Log("cron")
queue:
path: "logs/queue" # 日志文件路径默认为空表示关闭仅输出到终端
<<: *defaultLogger
# tcp服务器g.Log("tcpServer")
tcpServer:
path: "logs/tcpServer" # 日志文件路径默认为空表示关闭仅输出到终端
<<: *defaultLogger
# tcp客户端g.Log("tcpClient")
tcpClient:
path: "logs/tcpClient" # 日志文件路径默认为空表示关闭仅输出到终端
<<: *defaultLogger
# 模板配置
viewer:
paths: "resource/template"
@ -130,8 +155,8 @@ router:
prefix: "/api"
# 不需要验证登录的路由地址
exceptPath: []
# ws
ws:
# websocket
websocket:
# 前缀
prefix: "/socket"
# 不需要验证登录的路由地址

View File

@ -15,6 +15,7 @@ type GetReq struct {
g.Meta `path:"/config/get" method:"get" tags:"@{.label}" summary:"获取指定分组的配置"`
sysin.GetConfigInp
}
type GetRes struct {
*sysin.GetConfigModel
}
@ -24,5 +25,6 @@ type UpdateReq struct {
g.Meta `path:"/config/update" method:"post" tags:"@{.label}" summary:"获取指定分组的配置"`
sysin.UpdateConfigInp
}
type UpdateRes struct {
}

View File

@ -49,6 +49,7 @@ type EditReq struct {
g.Meta `path:"/@{.varName | LcFirst}/edit" method:"post" tags:"@{.tableComment}" summary:"修改/新增@{.tableComment}"`
@{.templateGroup}in.@{.varName}EditInp
}
type EditRes struct{}
@{end}
@{ if eq .options.Step.HasDel true }