add golangci-lint.

This commit is contained in:
孟帅 2023-05-31 18:01:50 +08:00
parent 46604b51b2
commit fdc48b9335
17 changed files with 425 additions and 479 deletions

3
server/.golangci.yml Normal file
View File

@ -0,0 +1,3 @@
run:
skip-dirs: # 设置要忽略的目录
- internal/library/hggen/internal

View File

@ -5,9 +5,11 @@
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package consts
type CtxKey string
// ContextKey 上下文
const (
ContextKey = "HotGoContext" // http上下文变量名称
ContextKeyCronArgs = "cronArgs" // 定时任务参数上下文变量名称
ContextTCPKey = "HotGoTCPContext" // tcp上下文变量名称
ContextHTTPKey CtxKey = "httpContext" // http上下文变量名称
ContextKeyCronArgs CtxKey = "cronArgs" // 定时任务参数上下文变量名称
ContextTCPKey CtxKey = "tcpContext" // tcp上下文变量名称
)

View File

@ -15,12 +15,12 @@ import (
// Init 初始化上下文对象指针到上下文对象中,以便后续的请求流程中可以修改
func Init(r *ghttp.Request, customCtx *model.Context) {
r.SetCtxVar(consts.ContextKey, customCtx)
r.SetCtxVar(consts.ContextHTTPKey, customCtx)
}
// Get 获得上下文变量如果没有设置那么返回nil
func Get(ctx context.Context) *model.Context {
value := ctx.Value(consts.ContextKey)
value := ctx.Value(consts.ContextHTTPKey)
if value == nil {
return nil
}

View File

@ -121,7 +121,6 @@ func (s *sAdminCash) List(ctx context.Context, in adminin.CashListInp) (list []*
v.MemberUser = member.Username
}
}
return
}
@ -250,7 +249,6 @@ func (s *sAdminCash) Apply(ctx context.Context, in adminin.CashApplyInp) (err er
err = gerror.Newf("申请提现失败, %+v", err)
return
}
return
}

View File

@ -8,7 +8,6 @@ package admin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/model/entity"
"hotgo/internal/service"
@ -24,40 +23,22 @@ func init() {
service.RegisterAdminMemberPost(NewAdminMemberPost())
}
// UpdatePostIds 更新用户岗位
func (s *sAdminMemberPost) UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error) {
_, err = dao.AdminMemberPost.Ctx(ctx).Where("member_id", memberId).Delete()
if err != nil {
err = gerror.Wrap(err, "删除失败")
if _, err = dao.AdminMemberPost.Ctx(ctx).Where(dao.AdminMemberPost.Columns().MemberId, memberId).Delete(); err != nil {
err = gerror.Wrap(err, "清理用户旧岗位数据失败,请稍后重试!")
return
}
for i := 0; i < len(postIds); i++ {
_, err = dao.AdminMemberPost.Ctx(ctx).
Insert(entity.AdminMemberPost{
MemberId: memberId,
PostId: postIds[i],
})
_, err = dao.AdminMemberPost.Ctx(ctx).Insert(entity.AdminMemberPost{
MemberId: memberId,
PostId: postIds[i],
})
if err != nil {
err = gerror.Wrap(err, "插入用户岗位失败")
err = gerror.Wrap(err, "加入用户岗位数据失败,请稍后重试!")
return err
}
}
return
}
// GetMemberByIds 获取指定用户的岗位ids
func (s *sAdminMemberPost) GetMemberByIds(ctx context.Context, memberId int64) (postIds []int64, err error) {
var list []*entity.AdminMemberPost
err = dao.AdminMemberPost.Ctx(ctx).Fields("post_id").Where("member_id", memberId).Scan(&list)
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return
}
for i := 0; i < len(list); i++ {
postIds = append(postIds, list[i].PostId)
}
return
}

View File

@ -260,6 +260,5 @@ func (s *sAdminSite) handleLogin(ctx context.Context, mb *entity.AdminMember) (r
Token: loginToken,
Expires: expires,
}
return
}

View File

@ -144,7 +144,6 @@ func (s *sSysAttachment) List(ctx context.Context, in sysin.AttachmentListInp) (
v.SizeFormat = format.FileSize(v.Size)
v.FileUrl = service.CommonUpload().LastUrl(ctx, conf, v.FileUrl, v.Drive)
}
return
}

View File

@ -25,33 +25,6 @@ import (
"hotgo/utility/simple"
)
// MaskDemoField 演示环境下需要隐藏的配置
var MaskDemoField = []string{
// 邮箱
"smtpUser", "smtpPass",
// 云存储
"uploadUCloudPublicKey", "uploadUCloudPrivateKey",
"uploadCosSecretId", "uploadCosSecretKey",
"uploadOssSecretId", "uploadOssSecretKey",
"uploadQiNiuAccessKey", "uploadQiNiuSecretKey",
// 地图
"geoAmapWebKey",
// 短信
"smsAliYunAccessKeyID", "smsAliYunAccessKeySecret",
"smsTencentSecretId", "smsTencentSecretKey",
// 支付
"payWxPayMchId", "payWxPaySerialNo", "payWxPayAPIv3Key",
"payWxPayPrivateKey", "payQQPayMchId", "payQQPayApiKey",
// 微信
"officialAccountAppSecret", "officialAccountToken", "officialAccountEncodingAESKey",
"openPlatformAppSecret", "openPlatformToken", "openPlatformEncodingAESKey",
}
type sSysConfig struct{}
func NewSysConfig() *sSysConfig {

View File

@ -291,7 +291,8 @@ func (s *sSysGenCodes) Preview(ctx context.Context, in sysin.GenCodesPreviewInp)
// Build 提交生成
func (s *sSysGenCodes) Build(ctx context.Context, in sysin.GenCodesBuildInp) (err error) {
// 先保存配置
if _, err = s.Edit(ctx, sysin.GenCodesEditInp{SysGenCodes: in.SysGenCodes}); err != nil {
ein := in.SysGenCodes
if _, err = s.Edit(ctx, sysin.GenCodesEditInp{SysGenCodes: ein}); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return err
}

View File

@ -19,15 +19,44 @@ import (
)
type (
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)
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)
}
IAdminMemberPost interface {
UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error)
}
IAdminPost interface {
Delete(ctx context.Context, in adminin.PostDeleteInp) (err error)
Edit(ctx context.Context, in adminin.PostEditInp) (err error)
MaxSort(ctx context.Context, in adminin.PostMaxSortInp) (res *adminin.PostMaxSortModel, err error)
NameUnique(ctx context.Context, in adminin.PostNameUniqueInp) (res *adminin.PostNameUniqueModel, err error)
CodeUnique(ctx context.Context, in adminin.PostCodeUniqueInp) (res *adminin.PostCodeUniqueModel, err error)
View(ctx context.Context, in adminin.PostViewInp) (res *adminin.PostViewModel, err error)
List(ctx context.Context, in adminin.PostListInp) (list []*adminin.PostListModel, totalCount int, err error)
GetMemberByStartName(ctx context.Context, memberId int64) (name string, err error)
Status(ctx context.Context, in adminin.PostStatusInp) (err error)
}
IAdminRole interface {
Verify(ctx context.Context, path, method string) bool
List(ctx context.Context, in adminin.RoleListInp) (res *adminin.RoleListModel, totalCount int, err error)
GetName(ctx context.Context, id int64) (name string, err error)
GetMemberList(ctx context.Context, id int64) (list []*adminin.RoleListModel, err error)
GetPermissions(ctx context.Context, in adminin.GetPermissionsInp) (res *adminin.GetPermissionsModel, err error)
UpdatePermissions(ctx context.Context, in adminin.UpdatePermissionsInp) (err error)
Edit(ctx context.Context, in adminin.RoleEditInp) (err error)
Delete(ctx context.Context, in adminin.RoleDeleteInp) (err error)
DataScopeSelect() (res form.Selects)
DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error)
}
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)
}
IAdminMember interface {
AddBalance(ctx context.Context, in adminin.MemberAddBalanceInp) (err error)
@ -63,30 +92,6 @@ type (
GetMenuList(ctx context.Context, memberId int64) (res *role.DynamicRes, err error)
LoginPermissions(ctx context.Context, memberId int64) (lists adminin.MemberLoginPermissions, err error)
}
IAdminOrder interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
AcceptRefund(ctx context.Context, in adminin.OrderAcceptRefundInp) (err error)
ApplyRefund(ctx context.Context, in adminin.OrderApplyRefundInp) (err error)
PayNotify(ctx context.Context, in payin.NotifyCallFuncInp) (err error)
Create(ctx context.Context, in adminin.OrderCreateInp) (res *adminin.OrderCreateModel, err error)
List(ctx context.Context, in adminin.OrderListInp) (list []*adminin.OrderListModel, totalCount int, err error)
Export(ctx context.Context, in adminin.OrderListInp) (err error)
Edit(ctx context.Context, in adminin.OrderEditInp) (err error)
Delete(ctx context.Context, in adminin.OrderDeleteInp) (err error)
View(ctx context.Context, in adminin.OrderViewInp) (res *adminin.OrderViewModel, err error)
Status(ctx context.Context, in adminin.OrderStatusInp) (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)
}
IAdminMemberPost interface {
UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error)
GetMemberByIds(ctx context.Context, memberId int64) (postIds []int64, err error)
}
IAdminMonitor interface {
StartMonitor(ctx context.Context)
GetMeta(ctx context.Context) *model.MonitorData
@ -105,57 +110,62 @@ type (
ReadAll(ctx context.Context, in adminin.NoticeReadAllInp) (err error)
MessageList(ctx context.Context, in adminin.NoticeMessageListInp) (list []*adminin.NoticeMessageListModel, totalCount int, err error)
}
IAdminPost interface {
Delete(ctx context.Context, in adminin.PostDeleteInp) (err error)
Edit(ctx context.Context, in adminin.PostEditInp) (err error)
MaxSort(ctx context.Context, in adminin.PostMaxSortInp) (res *adminin.PostMaxSortModel, err error)
NameUnique(ctx context.Context, in adminin.PostNameUniqueInp) (res *adminin.PostNameUniqueModel, err error)
CodeUnique(ctx context.Context, in adminin.PostCodeUniqueInp) (res *adminin.PostCodeUniqueModel, err error)
View(ctx context.Context, in adminin.PostViewInp) (res *adminin.PostViewModel, err error)
List(ctx context.Context, in adminin.PostListInp) (list []*adminin.PostListModel, totalCount int, err error)
GetMemberByStartName(ctx context.Context, memberId int64) (name string, err error)
Status(ctx context.Context, in adminin.PostStatusInp) (err error)
}
IAdminRole interface {
Verify(ctx context.Context, path, method string) bool
List(ctx context.Context, in adminin.RoleListInp) (res *adminin.RoleListModel, totalCount int, err error)
GetName(ctx context.Context, id int64) (name string, err error)
GetMemberList(ctx context.Context, id int64) (list []*adminin.RoleListModel, err error)
GetPermissions(ctx context.Context, in adminin.GetPermissionsInp) (res *adminin.GetPermissionsModel, err error)
UpdatePermissions(ctx context.Context, in adminin.UpdatePermissionsInp) (err error)
Edit(ctx context.Context, in adminin.RoleEditInp) (err error)
Delete(ctx context.Context, in adminin.RoleDeleteInp) (err error)
DataScopeSelect() (res form.Selects)
DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error)
IAdminOrder interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
AcceptRefund(ctx context.Context, in adminin.OrderAcceptRefundInp) (err error)
ApplyRefund(ctx context.Context, in adminin.OrderApplyRefundInp) (err error)
PayNotify(ctx context.Context, in payin.NotifyCallFuncInp) (err error)
Create(ctx context.Context, in adminin.OrderCreateInp) (res *adminin.OrderCreateModel, err error)
List(ctx context.Context, in adminin.OrderListInp) (list []*adminin.OrderListModel, totalCount int, err error)
Export(ctx context.Context, in adminin.OrderListInp) (err error)
Edit(ctx context.Context, in adminin.OrderEditInp) (err error)
Delete(ctx context.Context, in adminin.OrderDeleteInp) (err error)
View(ctx context.Context, in adminin.OrderViewInp) (res *adminin.OrderViewModel, err error)
Status(ctx context.Context, in adminin.OrderStatusInp) (err error)
}
IAdminSite interface {
Register(ctx context.Context, in adminin.RegisterInp) (err error)
AccountLogin(ctx context.Context, in adminin.AccountLoginInp) (res *adminin.LoginModel, err error)
MobileLogin(ctx context.Context, in adminin.MobileLoginInp) (res *adminin.LoginModel, err error)
}
IAdminCash interface {
View(ctx context.Context, in adminin.CashViewInp) (res *adminin.CashViewModel, err error)
List(ctx context.Context, in adminin.CashListInp) (list []*adminin.CashListModel, totalCount int, err error)
Apply(ctx context.Context, in adminin.CashApplyInp) (err error)
Payment(ctx context.Context, in adminin.CashPaymentInp) (err error)
IAdminDept interface {
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)
}
)
var (
localAdminCash IAdminCash
localAdminCreditsLog IAdminCreditsLog
localAdminMemberPost IAdminMemberPost
localAdminPost IAdminPost
localAdminRole IAdminRole
localAdminDept IAdminDept
localAdminMember IAdminMember
localAdminMenu IAdminMenu
localAdminOrder IAdminOrder
localAdminRole IAdminRole
localAdminSite IAdminSite
localAdminCash IAdminCash
localAdminMemberPost IAdminMemberPost
localAdminMonitor IAdminMonitor
localAdminNotice IAdminNotice
localAdminPost IAdminPost
localAdminOrder IAdminOrder
localAdminSite IAdminSite
)
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?")
@ -167,6 +177,39 @@ func RegisterAdminCreditsLog(i IAdminCreditsLog) {
localAdminCreditsLog = 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 AdminPost() IAdminPost {
if localAdminPost == nil {
panic("implement not found for interface IAdminPost, forgot register?")
}
return localAdminPost
}
func RegisterAdminPost(i IAdminPost) {
localAdminPost = i
}
func AdminRole() IAdminRole {
if localAdminRole == nil {
panic("implement not found for interface IAdminRole, forgot register?")
}
return localAdminRole
}
func RegisterAdminRole(i IAdminRole) {
localAdminRole = i
}
func AdminDept() IAdminDept {
if localAdminDept == nil {
panic("implement not found for interface IAdminDept, forgot register?")
@ -200,61 +243,6 @@ func RegisterAdminMenu(i IAdminMenu) {
localAdminMenu = i
}
func AdminOrder() IAdminOrder {
if localAdminOrder == nil {
panic("implement not found for interface IAdminOrder, forgot register?")
}
return localAdminOrder
}
func RegisterAdminOrder(i IAdminOrder) {
localAdminOrder = i
}
func AdminRole() IAdminRole {
if localAdminRole == nil {
panic("implement not found for interface IAdminRole, forgot register?")
}
return localAdminRole
}
func RegisterAdminRole(i IAdminRole) {
localAdminRole = 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 AdminCash() IAdminCash {
if localAdminCash == nil {
panic("implement not found for interface IAdminCash, forgot register?")
}
return localAdminCash
}
func RegisterAdminCash(i IAdminCash) {
localAdminCash = 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 AdminMonitor() IAdminMonitor {
if localAdminMonitor == nil {
panic("implement not found for interface IAdminMonitor, forgot register?")
@ -277,13 +265,24 @@ func RegisterAdminNotice(i IAdminNotice) {
localAdminNotice = i
}
func AdminPost() IAdminPost {
if localAdminPost == nil {
panic("implement not found for interface IAdminPost, forgot register?")
func AdminOrder() IAdminOrder {
if localAdminOrder == nil {
panic("implement not found for interface IAdminOrder, forgot register?")
}
return localAdminPost
return localAdminOrder
}
func RegisterAdminPost(i IAdminPost) {
localAdminPost = i
func RegisterAdminOrder(i IAdminOrder) {
localAdminOrder = i
}
func AdminSite() IAdminSite {
if localAdminSite == nil {
panic("implement not found for interface IAdminSite, forgot register?")
}
return localAdminSite
}
func RegisterAdminSite(i IAdminSite) {
localAdminSite = i
}

View File

@ -17,10 +17,52 @@ import (
)
type (
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)
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)
Edit(ctx context.Context, in sysin.GenCodesEditInp) (res *sysin.GenCodesEditModel, err error)
Status(ctx context.Context, in sysin.GenCodesStatusInp) (err error)
MaxSort(ctx context.Context, in sysin.GenCodesMaxSortInp) (res *sysin.GenCodesMaxSortModel, err error)
View(ctx context.Context, in sysin.GenCodesViewInp) (res *sysin.GenCodesViewModel, err error)
List(ctx context.Context, in sysin.GenCodesListInp) (list []*sysin.GenCodesListModel, totalCount int, err error)
Selects(ctx context.Context, in sysin.GenCodesSelectsInp) (res *sysin.GenCodesSelectsModel, err error)
TableSelect(ctx context.Context, in sysin.GenCodesTableSelectInp) (res []*sysin.GenCodesTableSelectModel, err error)
ColumnSelect(ctx context.Context, in sysin.GenCodesColumnSelectInp) (res []*sysin.GenCodesColumnSelectModel, err error)
ColumnList(ctx context.Context, in sysin.GenCodesColumnListInp) (res []*sysin.GenCodesColumnListModel, err error)
Preview(ctx context.Context, in sysin.GenCodesPreviewInp) (res *sysin.GenCodesPreviewModel, err error)
Build(ctx context.Context, in sysin.GenCodesBuildInp) (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)
}
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)
}
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)
}
ISysBlacklist interface {
Delete(ctx context.Context, in sysin.BlacklistDeleteInp) (err error)
@ -32,14 +74,26 @@ type (
VariableLoad(ctx context.Context, err error)
Load(ctx context.Context)
}
ISysLoginLog interface {
Model(ctx context.Context) *gdb.Model
List(ctx context.Context, in sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
Export(ctx context.Context, in sysin.LoginLogListInp) (err error)
Delete(ctx context.Context, in sysin.LoginLogDeleteInp) (err error)
View(ctx context.Context, in sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
Push(ctx context.Context, in sysin.LoginLogPushInp)
RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
ISysConfig interface {
InitConfig(ctx context.Context)
GetLogin(ctx context.Context) (conf *model.LoginConfig, err error)
GetWechat(ctx context.Context) (conf *model.WechatConfig, err error)
GetPay(ctx context.Context) (conf *model.PayConfig, err error)
GetSms(ctx context.Context) (conf *model.SmsConfig, err error)
GetGeo(ctx context.Context) (conf *model.GeoConfig, err error)
GetUpload(ctx context.Context) (conf *model.UploadConfig, err error)
GetSmtp(ctx context.Context) (conf *model.EmailConfig, err error)
GetBasic(ctx context.Context) (conf *model.BasicConfig, err error)
GetLoadTCP(ctx context.Context) (conf *model.TCPConfig, err error)
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)
}
ISysCurdDemo interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
@ -52,11 +106,35 @@ type (
Status(ctx context.Context, in sysin.CurdDemoStatusInp) (err error)
Switch(ctx context.Context, in sysin.CurdDemoSwitchInp) (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)
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)
}
ISysAttachment interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
Delete(ctx context.Context, in sysin.AttachmentDeleteInp) (err error)
Edit(ctx context.Context, in sysin.AttachmentEditInp) (err error)
Status(ctx context.Context, in sysin.AttachmentStatusInp) (err error)
MaxSort(ctx context.Context, in sysin.AttachmentMaxSortInp) (res *sysin.AttachmentMaxSortModel, 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)
Add(ctx context.Context, meta *sysin.UploadFileMeta, fullPath, drive string) (models *entity.SysAttachment, 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)
}
ISysEmsLog interface {
Delete(ctx context.Context, in sysin.EmsLogDeleteInp) (err error)
@ -81,13 +159,13 @@ 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)
}
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)
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)
}
ISysSmsLog interface {
Delete(ctx context.Context, in sysin.SmsLogDeleteInp) (err error)
@ -101,225 +179,37 @@ type (
AllowSend(ctx context.Context, models *entity.SysSmsLog, config *model.SmsConfig) (err error)
VerifyCode(ctx context.Context, in sysin.VerifyCodeInp) (err error)
}
ISysAddons interface {
List(ctx context.Context, in sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
Selects(ctx context.Context, in sysin.AddonsSelectsInp) (res *sysin.AddonsSelectsModel, err error)
Build(ctx context.Context, in sysin.AddonsBuildInp) (err error)
Install(ctx context.Context, in sysin.AddonsInstallInp) (err error)
Upgrade(ctx context.Context, in sysin.AddonsUpgradeInp) (err error)
UnInstall(ctx context.Context, in sysin.AddonsUnInstallInp) (err error)
}
ISysConfig interface {
InitConfig(ctx context.Context)
GetLogin(ctx context.Context) (conf *model.LoginConfig, err error)
GetWechat(ctx context.Context) (conf *model.WechatConfig, err error)
GetPay(ctx context.Context) (conf *model.PayConfig, err error)
GetSms(ctx context.Context) (conf *model.SmsConfig, err error)
GetGeo(ctx context.Context) (conf *model.GeoConfig, err error)
GetUpload(ctx context.Context) (conf *model.UploadConfig, err error)
GetSmtp(ctx context.Context) (conf *model.EmailConfig, err error)
GetBasic(ctx context.Context) (conf *model.BasicConfig, err error)
GetLoadTCP(ctx context.Context) (conf *model.TCPConfig, err error)
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)
}
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)
}
ISysGenCodes interface {
Delete(ctx context.Context, in sysin.GenCodesDeleteInp) (err error)
Edit(ctx context.Context, in sysin.GenCodesEditInp) (res *sysin.GenCodesEditModel, err error)
Status(ctx context.Context, in sysin.GenCodesStatusInp) (err error)
MaxSort(ctx context.Context, in sysin.GenCodesMaxSortInp) (res *sysin.GenCodesMaxSortModel, err error)
View(ctx context.Context, in sysin.GenCodesViewInp) (res *sysin.GenCodesViewModel, err error)
List(ctx context.Context, in sysin.GenCodesListInp) (list []*sysin.GenCodesListModel, totalCount int, err error)
Selects(ctx context.Context, in sysin.GenCodesSelectsInp) (res *sysin.GenCodesSelectsModel, err error)
TableSelect(ctx context.Context, in sysin.GenCodesTableSelectInp) (res []*sysin.GenCodesTableSelectModel, err error)
ColumnSelect(ctx context.Context, in sysin.GenCodesColumnSelectInp) (res []*sysin.GenCodesColumnSelectModel, err error)
ColumnList(ctx context.Context, in sysin.GenCodesColumnListInp) (res []*sysin.GenCodesColumnListModel, err error)
Preview(ctx context.Context, in sysin.GenCodesPreviewInp) (res *sysin.GenCodesPreviewModel, err error)
Build(ctx context.Context, in sysin.GenCodesBuildInp) (err error)
}
ISysAttachment interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
Delete(ctx context.Context, in sysin.AttachmentDeleteInp) (err error)
Edit(ctx context.Context, in sysin.AttachmentEditInp) (err error)
Status(ctx context.Context, in sysin.AttachmentStatusInp) (err error)
MaxSort(ctx context.Context, in sysin.AttachmentMaxSortInp) (res *sysin.AttachmentMaxSortModel, 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)
Add(ctx context.Context, meta *sysin.UploadFileMeta, fullPath, drive string) (models *entity.SysAttachment, 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)
}
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)
}
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)
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)
}
)
var (
localSysDictData ISysDictData
localSysGenCodes ISysGenCodes
localSysLog ISysLog
localSysServeLog ISysServeLog
localSysCron ISysCron
localSysBlacklist ISysBlacklist
localSysConfig ISysConfig
localSysCurdDemo ISysCurdDemo
localSysDictType ISysDictType
localSysAttachment ISysAttachment
localSysAddonsConfig ISysAddonsConfig
localSysCronGroup ISysCronGroup
localSysEmsLog ISysEmsLog
localSysProvinces ISysProvinces
localSysCurdDemo ISysCurdDemo
localSysConfig ISysConfig
localSysDictType ISysDictType
localSysGenCodes ISysGenCodes
localSysServeLog ISysServeLog
localSysSmsLog ISysSmsLog
localSysAddons ISysAddons
localSysCron ISysCron
localSysCronGroup ISysCronGroup
localSysLog ISysLog
localSysAttachment ISysAttachment
localSysBlacklist ISysBlacklist
localSysSmsLog ISysSmsLog
localSysLoginLog ISysLoginLog
localSysAddonsConfig ISysAddonsConfig
)
func SysAttachment() ISysAttachment {
if localSysAttachment == nil {
panic("implement not found for interface ISysAttachment, forgot register?")
}
return localSysAttachment
}
func RegisterSysAttachment(i ISysAttachment) {
localSysAttachment = i
}
func SysCron() ISysCron {
if localSysCron == nil {
panic("implement not found for interface ISysCron, forgot register?")
}
return localSysCron
}
func RegisterSysCron(i ISysCron) {
localSysCron = 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 SysAddonsConfig() ISysAddonsConfig {
if localSysAddonsConfig == nil {
panic("implement not found for interface ISysAddonsConfig, forgot register?")
}
return localSysAddonsConfig
}
func RegisterSysAddonsConfig(i ISysAddonsConfig) {
localSysAddonsConfig = 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 SysLoginLog() ISysLoginLog {
if localSysLoginLog == nil {
panic("implement not found for interface ISysLoginLog, forgot register?")
}
return localSysLoginLog
}
func RegisterSysLoginLog(i ISysLoginLog) {
localSysLoginLog = i
}
func SysCurdDemo() ISysCurdDemo {
if localSysCurdDemo == nil {
panic("implement not found for interface ISysCurdDemo, forgot register?")
}
return localSysCurdDemo
}
func RegisterSysCurdDemo(i ISysCurdDemo) {
localSysCurdDemo = 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 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?")
@ -331,17 +221,6 @@ func RegisterSysProvinces(i ISysProvinces) {
localSysProvinces = i
}
func SysSmsLog() ISysSmsLog {
if localSysSmsLog == nil {
panic("implement not found for interface ISysSmsLog, forgot register?")
}
return localSysSmsLog
}
func RegisterSysSmsLog(i ISysSmsLog) {
localSysSmsLog = i
}
func SysAddons() ISysAddons {
if localSysAddons == nil {
panic("implement not found for interface ISysAddons, forgot register?")
@ -353,26 +232,92 @@ func RegisterSysAddons(i ISysAddons) {
localSysAddons = i
}
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 RegisterSysAddonsConfig(i ISysAddonsConfig) {
localSysAddonsConfig = i
}
func SysDictType() ISysDictType {
if localSysDictType == nil {
panic("implement not found for interface ISysDictType, forgot register?")
func SysCronGroup() ISysCronGroup {
if localSysCronGroup == nil {
panic("implement not found for interface ISysCronGroup, forgot register?")
}
return localSysDictType
return localSysCronGroup
}
func RegisterSysDictType(i ISysDictType) {
localSysDictType = i
func RegisterSysCronGroup(i ISysCronGroup) {
localSysCronGroup = i
}
func SysEmsLog() ISysEmsLog {
if localSysEmsLog == nil {
panic("implement not found for interface ISysEmsLog, forgot register?")
}
return localSysEmsLog
}
func RegisterSysEmsLog(i ISysEmsLog) {
localSysEmsLog = i
}
func SysLoginLog() ISysLoginLog {
if localSysLoginLog == nil {
panic("implement not found for interface ISysLoginLog, forgot register?")
}
return localSysLoginLog
}
func RegisterSysLoginLog(i ISysLoginLog) {
localSysLoginLog = i
}
func SysSmsLog() ISysSmsLog {
if localSysSmsLog == nil {
panic("implement not found for interface ISysSmsLog, forgot register?")
}
return localSysSmsLog
}
func RegisterSysSmsLog(i ISysSmsLog) {
localSysSmsLog = i
}
func SysServeLog() ISysServeLog {
if localSysServeLog == nil {
panic("implement not found for interface ISysServeLog, forgot register?")
}
return localSysServeLog
}
func RegisterSysServeLog(i ISysServeLog) {
localSysServeLog = i
}
func SysCron() ISysCron {
if localSysCron == nil {
panic("implement not found for interface ISysCron, forgot register?")
}
return localSysCron
}
func RegisterSysCron(i ISysCron) {
localSysCron = 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 {
@ -386,13 +331,68 @@ func RegisterSysGenCodes(i ISysGenCodes) {
localSysGenCodes = i
}
func SysServeLog() ISysServeLog {
if localSysServeLog == nil {
panic("implement not found for interface ISysServeLog, forgot register?")
func SysLog() ISysLog {
if localSysLog == nil {
panic("implement not found for interface ISysLog, forgot register?")
}
return localSysServeLog
return localSysLog
}
func RegisterSysServeLog(i ISysServeLog) {
localSysServeLog = i
func RegisterSysLog(i ISysLog) {
localSysLog = 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 SysAttachment() ISysAttachment {
if localSysAttachment == nil {
panic("implement not found for interface ISysAttachment, forgot register?")
}
return localSysAttachment
}
func RegisterSysAttachment(i ISysAttachment) {
localSysAttachment = 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?")
}
return localSysCurdDemo
}
func RegisterSysCurdDemo(i ISysCurdDemo) {
localSysCurdDemo = i
}

View File

@ -32,17 +32,6 @@ var (
localCronClient ICronClient
)
func AuthClient() IAuthClient {
if localAuthClient == nil {
panic("implement not found for interface IAuthClient, forgot register?")
}
return localAuthClient
}
func RegisterAuthClient(i IAuthClient) {
localAuthClient = i
}
func CronClient() ICronClient {
if localCronClient == nil {
panic("implement not found for interface ICronClient, forgot register?")
@ -53,3 +42,14 @@ func CronClient() ICronClient {
func RegisterCronClient(i ICronClient) {
localCronClient = i
}
func AuthClient() IAuthClient {
if localAuthClient == nil {
panic("implement not found for interface IAuthClient, forgot register?")
}
return localAuthClient
}
func RegisterAuthClient(i IAuthClient) {
localAuthClient = i
}

View File

@ -51,7 +51,6 @@ func WalkDir(dirname string) (error, []fileInfo) {
fileInfos = append(fileInfos, fi) //slice 中添加成员
}
}
return nil, fileInfos
}
@ -64,7 +63,6 @@ func DirSize(dirname string) string {
for _, n := range files {
ss += n.size
}
return format.FileSize(ss)
}

View File

@ -133,15 +133,10 @@ func Ext(baseName string) string {
}
// UploadFileByte 获取上传文件的byte
func UploadFileByte(file *ghttp.UploadFile) (b []byte, err error) {
func UploadFileByte(file *ghttp.UploadFile) ([]byte, error) {
open, err := file.Open()
if err != nil {
return
return nil, err
}
all, err := io.ReadAll(open)
if err != nil {
return
}
return all, nil
return io.ReadAll(open)
}

View File

@ -47,7 +47,6 @@ func DecryptText(text string) (string, error) {
if err != nil {
return "", err
}
return string(str), nil
}

View File

@ -49,7 +49,6 @@ func GetIds(tree string) (ids []int64) {
ids = append(ids, newId)
}
}
return
}
@ -65,7 +64,7 @@ func GenTree(menus []map[string]interface{}) (realMenu []map[string]interface{})
// GenTreeWithField 生成关系树 自定义生成属性
func GenTreeWithField(menus []map[string]interface{}, op GenOption) (realMenu []map[string]interface{}) {
if len(menus) < 1 {
return nil
return
}
minPid := GetMinPid(menus, op.PidField)

View File

@ -7,6 +7,7 @@ package useragent
import (
"fmt"
"github.com/gogf/gf/v2/text/gstr"
"regexp"
"strings"
)
@ -18,7 +19,7 @@ func GetOs(userAgent string) string {
return osName
}
strRe, _ := regexp.Compile(`(?i:((.*?)))`)
strRe, _ := regexp.Compile(`(?i:\((.*?)\))`)
userAgent = strRe.FindString(userAgent)
levelNames := ":micromessenger:dart:Windows NT:Windows Mobile:Windows Phone:Windows Phone OS:Macintosh|Macintosh:Mac OS:CrOS|CrOS:iPhone OS:iPad|iPad:OS:Android:Linux:blackberry:hpwOS:Series:Symbian:PalmOS:SymbianOS:J2ME:Sailfish:Bada:MeeGo:webOS|hpwOS:Maemo:"
@ -41,9 +42,8 @@ func GetOs(userAgent string) string {
} else if strings.Contains(name, s) {
name = strings.TrimSpace(s)
} else if !strings.Contains(s, name) {
if strings.Contains(name, "iPhone") ||
strings.Contains(name, "iPad") {
s = strings.Trim(s, "Mac OS X")
if strings.Contains(name, "iPhone") || strings.Contains(name, "iPad") {
s = gstr.Trim(s, "Mac OS X")
}
if s != "" {