feat: 完成鸽达达后台安全与审计改造
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/imdashboard"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var ImDashboard = cImDashboard{}
|
||||
|
||||
type cImDashboard struct{}
|
||||
|
||||
func (c *cImDashboard) Overview(ctx context.Context, req *imdashboard.OverviewReq) (res *imdashboard.OverviewRes, err error) {
|
||||
data, err := service.SysImDashboard().Overview(ctx, &req.ImDashboardOverviewInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &imdashboard.OverviewRes{ImDashboardOverviewModel: data}, nil
|
||||
}
|
||||
|
||||
func (c *cImDashboard) Trends(ctx context.Context, req *imdashboard.TrendsReq) (res *imdashboard.TrendsRes, err error) {
|
||||
list, err := service.SysImDashboard().Trends(ctx, &req.ImDashboardTrendsInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImDashboardTrendModel{}
|
||||
}
|
||||
return &imdashboard.TrendsRes{List: list}, nil
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/imgroupmessage"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var ImGroupMessage = cImGroupMessage{}
|
||||
|
||||
type cImGroupMessage struct{}
|
||||
|
||||
func (c *cImGroupMessage) List(ctx context.Context, req *imgroupmessage.ListReq) (res *imgroupmessage.ListRes, err error) {
|
||||
list, total, err := service.SysImGroupMessage().List(ctx, &req.ImGroupMessageListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImMessageListModel{}
|
||||
}
|
||||
res = &imgroupmessage.ListRes{List: list}
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cImGroupMessage) View(ctx context.Context, req *imgroupmessage.ViewReq) (*imgroupmessage.ViewRes, error) {
|
||||
data, err := service.SysImGroupMessage().View(ctx, &req.ImMessageViewInp)
|
||||
return &imgroupmessage.ViewRes{ImMessageViewModel: data}, err
|
||||
}
|
||||
func (c *cImGroupMessage) Hide(ctx context.Context, req *imgroupmessage.HideReq) (*imgroupmessage.HideRes, error) {
|
||||
data, err := service.SysImGroupMessage().Hide(ctx, &req.ImMessageActionInp)
|
||||
return &imgroupmessage.HideRes{ImMessageCommandModel: data}, err
|
||||
}
|
||||
func (c *cImGroupMessage) Delete(ctx context.Context, req *imgroupmessage.DeleteReq) (*imgroupmessage.DeleteRes, error) {
|
||||
data, err := service.SysImGroupMessage().Delete(ctx, &req.ImMessageActionInp)
|
||||
return &imgroupmessage.DeleteRes{ImMessageCommandModel: data}, err
|
||||
}
|
||||
func (c *cImGroupMessage) Export(ctx context.Context, req *imgroupmessage.ExportReq) (*imgroupmessage.ExportRes, error) {
|
||||
return &imgroupmessage.ExportRes{}, service.SysImGroupMessage().Export(ctx, &req.ImGroupMessageListInp)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/imloginfailurelog"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var ImLoginFailureLog = cImLoginFailureLog{}
|
||||
|
||||
type cImLoginFailureLog struct{}
|
||||
|
||||
func (c *cImLoginFailureLog) List(ctx context.Context, req *imloginfailurelog.ListReq) (res *imloginfailurelog.ListRes, err error) {
|
||||
list, total, err := service.SysImLoginFailureLog().List(ctx, &req.ImLoginFailureLogListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImLoginFailureLogModel{}
|
||||
}
|
||||
res = &imloginfailurelog.ListRes{List: list}
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cImLoginFailureLog) View(ctx context.Context, req *imloginfailurelog.ViewReq) (*imloginfailurelog.ViewRes, error) {
|
||||
data, err := service.SysImLoginFailureLog().View(ctx, &req.ImLoginFailureViewInp)
|
||||
return &imloginfailurelog.ViewRes{ImLoginFailureLogModel: data}, err
|
||||
}
|
||||
func (c *cImLoginFailureLog) Export(ctx context.Context, req *imloginfailurelog.ExportReq) (*imloginfailurelog.ExportRes, error) {
|
||||
return &imloginfailurelog.ExportRes{}, service.SysImLoginFailureLog().Export(ctx, &req.ImLoginFailureLogListInp)
|
||||
}
|
||||
func (c *cImLoginFailureLog) AddBlacklist(ctx context.Context, req *imloginfailurelog.AddBlacklistReq) (*imloginfailurelog.AddBlacklistRes, error) {
|
||||
return &imloginfailurelog.AddBlacklistRes{}, service.SysImLoginFailureLog().AddBlacklist(ctx, &req.ImLoginFailureAddBlacklistInp)
|
||||
}
|
||||
func (c *cImLoginFailureLog) BanUser(ctx context.Context, req *imloginfailurelog.BanUserReq) (*imloginfailurelog.BanUserRes, error) {
|
||||
data, err := service.SysImLoginFailureLog().BanUser(ctx, &req.ImLoginFailureBanUserInp)
|
||||
return &imloginfailurelog.BanUserRes{ImUserCommandModel: data}, err
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/imprivatemessage"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var ImPrivateMessage = cImPrivateMessage{}
|
||||
|
||||
type cImPrivateMessage struct{}
|
||||
|
||||
func (c *cImPrivateMessage) List(ctx context.Context, req *imprivatemessage.ListReq) (res *imprivatemessage.ListRes, err error) {
|
||||
list, total, err := service.SysImPrivateMessage().List(ctx, &req.ImPrivateMessageListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImMessageListModel{}
|
||||
}
|
||||
res = &imprivatemessage.ListRes{List: list}
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cImPrivateMessage) View(ctx context.Context, req *imprivatemessage.ViewReq) (*imprivatemessage.ViewRes, error) {
|
||||
data, err := service.SysImPrivateMessage().View(ctx, &req.ImMessageViewInp)
|
||||
return &imprivatemessage.ViewRes{ImMessageViewModel: data}, err
|
||||
}
|
||||
func (c *cImPrivateMessage) Hide(ctx context.Context, req *imprivatemessage.HideReq) (*imprivatemessage.HideRes, error) {
|
||||
data, err := service.SysImPrivateMessage().Hide(ctx, &req.ImMessageActionInp)
|
||||
return &imprivatemessage.HideRes{ImMessageCommandModel: data}, err
|
||||
}
|
||||
func (c *cImPrivateMessage) Delete(ctx context.Context, req *imprivatemessage.DeleteReq) (*imprivatemessage.DeleteRes, error) {
|
||||
data, err := service.SysImPrivateMessage().Delete(ctx, &req.ImMessageActionInp)
|
||||
return &imprivatemessage.DeleteRes{ImMessageCommandModel: data}, err
|
||||
}
|
||||
func (c *cImPrivateMessage) Export(ctx context.Context, req *imprivatemessage.ExportReq) (*imprivatemessage.ExportRes, error) {
|
||||
return &imprivatemessage.ExportRes{}, service.SysImPrivateMessage().Export(ctx, &req.ImPrivateMessageListInp)
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/imsecuritypolicy"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var ImSecurityPolicy = cImSecurityPolicy{}
|
||||
|
||||
type cImSecurityPolicy struct{}
|
||||
|
||||
func (c *cImSecurityPolicy) List(ctx context.Context, req *imsecuritypolicy.ListReq) (res *imsecuritypolicy.ListRes, err error) {
|
||||
list, total, err := service.SysImSecurityPolicy().List(ctx, &req.ImSecurityPolicyListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImSecurityPolicyModel{}
|
||||
}
|
||||
res = new(imsecuritypolicy.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cImSecurityPolicy) View(ctx context.Context, req *imsecuritypolicy.ViewReq) (res *imsecuritypolicy.ViewRes, err error) {
|
||||
data, err := service.SysImSecurityPolicy().View(ctx, &req.ImSecurityPolicyViewInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &imsecuritypolicy.ViewRes{ImSecurityPolicyModel: data}, nil
|
||||
}
|
||||
func (c *cImSecurityPolicy) Save(ctx context.Context, req *imsecuritypolicy.SaveReq) (res *imsecuritypolicy.SaveRes, err error) {
|
||||
id, err := service.SysImSecurityPolicy().Save(ctx, &req.ImSecurityPolicySaveInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &imsecuritypolicy.SaveRes{Id: id}, nil
|
||||
}
|
||||
func (c *cImSecurityPolicy) Publish(ctx context.Context, req *imsecuritypolicy.PublishReq) (res *imsecuritypolicy.PublishRes, err error) {
|
||||
err = service.SysImSecurityPolicy().Publish(ctx, &req.ImSecurityPolicyPublishInp)
|
||||
return
|
||||
}
|
||||
func (c *cImSecurityPolicy) RestoreDefault(ctx context.Context, req *imsecuritypolicy.RestoreDefaultReq) (res *imsecuritypolicy.RestoreDefaultRes, err error) {
|
||||
id, err := service.SysImSecurityPolicy().RestoreDefault(ctx, &req.ImSecurityPolicyRestoreInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &imsecuritypolicy.RestoreDefaultRes{Id: id}, nil
|
||||
}
|
||||
func (c *cImSecurityPolicy) IPRuleList(ctx context.Context, req *imsecuritypolicy.IPRuleListReq) (res *imsecuritypolicy.IPRuleListRes, err error) {
|
||||
list, total, err := service.SysImSecurityPolicy().IPRuleList(ctx, &req.ImSecurityIPRuleListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImSecurityIPRuleModel{}
|
||||
}
|
||||
res = new(imsecuritypolicy.IPRuleListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cImSecurityPolicy) IPRuleEdit(ctx context.Context, req *imsecuritypolicy.IPRuleEditReq) (res *imsecuritypolicy.IPRuleEditRes, err error) {
|
||||
err = service.SysImSecurityPolicy().IPRuleEdit(ctx, &req.ImSecurityIPRuleEditInp)
|
||||
return
|
||||
}
|
||||
func (c *cImSecurityPolicy) IPRuleDelete(ctx context.Context, req *imsecuritypolicy.IPRuleDeleteReq) (res *imsecuritypolicy.IPRuleDeleteRes, err error) {
|
||||
err = service.SysImSecurityPolicy().IPRuleDelete(ctx, &req.ImSecurityIPRuleDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/imsensitiveword"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var ImSensitiveWord = cImSensitiveWord{}
|
||||
|
||||
type cImSensitiveWord struct{}
|
||||
|
||||
func (c *cImSensitiveWord) List(ctx context.Context, req *imsensitiveword.ListReq) (res *imsensitiveword.ListRes, err error) {
|
||||
list, total, err := service.SysImSensitiveWord().List(ctx, &req.ImSensitiveWordListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImSensitiveWordListModel{}
|
||||
}
|
||||
res = new(imsensitiveword.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cImSensitiveWord) Edit(ctx context.Context, req *imsensitiveword.EditReq) (res *imsensitiveword.EditRes, err error) {
|
||||
err = service.SysImSensitiveWord().Edit(ctx, &req.ImSensitiveWordEditInp)
|
||||
return
|
||||
}
|
||||
func (c *cImSensitiveWord) Delete(ctx context.Context, req *imsensitiveword.DeleteReq) (res *imsensitiveword.DeleteRes, err error) {
|
||||
err = service.SysImSensitiveWord().Delete(ctx, &req.ImSensitiveWordDeleteInp)
|
||||
return
|
||||
}
|
||||
func (c *cImSensitiveWord) Status(ctx context.Context, req *imsensitiveword.StatusReq) (res *imsensitiveword.StatusRes, err error) {
|
||||
err = service.SysImSensitiveWord().Status(ctx, &req.ImSensitiveWordStatusInp)
|
||||
return
|
||||
}
|
||||
func (c *cImSensitiveWord) BatchImport(ctx context.Context, req *imsensitiveword.BatchImportReq) (res *imsensitiveword.BatchImportRes, err error) {
|
||||
data, err := service.SysImSensitiveWord().BatchImport(ctx, &req.ImSensitiveWordBatchImportInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &imsensitiveword.BatchImportRes{ImSensitiveWordBatchImportModel: data}, nil
|
||||
}
|
||||
func (c *cImSensitiveWord) GroupList(ctx context.Context, req *imsensitiveword.GroupListReq) (res *imsensitiveword.GroupListRes, err error) {
|
||||
list, err := service.SysImSensitiveWord().GroupList(ctx, &req.ImSensitiveWordGroupListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImSensitiveWordGroupModel{}
|
||||
}
|
||||
return &imsensitiveword.GroupListRes{List: list}, nil
|
||||
}
|
||||
func (c *cImSensitiveWord) GroupEdit(ctx context.Context, req *imsensitiveword.GroupEditReq) (res *imsensitiveword.GroupEditRes, err error) {
|
||||
err = service.SysImSensitiveWord().GroupEdit(ctx, &req.ImSensitiveWordGroupEditInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/imuserloginhistory"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var ImUserLoginHistory = cImUserLoginHistory{}
|
||||
|
||||
type cImUserLoginHistory struct{}
|
||||
|
||||
func (c *cImUserLoginHistory) List(ctx context.Context, req *imuserloginhistory.ListReq) (res *imuserloginhistory.ListRes, err error) {
|
||||
list, total, err := service.SysImUserLoginHistory().List(ctx, &req.ImUserLoginHistoryListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImUserLoginHistoryModel{}
|
||||
}
|
||||
res = &imuserloginhistory.ListRes{List: list}
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cImUserLoginHistory) Export(ctx context.Context, req *imuserloginhistory.ExportReq) (*imuserloginhistory.ExportRes, error) {
|
||||
return &imuserloginhistory.ExportRes{}, service.SysImUserLoginHistory().Export(ctx, &req.ImUserLoginHistoryListInp)
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/imuserpolicygroup"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var ImUserPolicyGroup = cImUserPolicyGroup{}
|
||||
|
||||
type cImUserPolicyGroup struct{}
|
||||
|
||||
func (c *cImUserPolicyGroup) List(ctx context.Context, req *imuserpolicygroup.ListReq) (res *imuserpolicygroup.ListRes, err error) {
|
||||
list, total, err := service.SysImUserPolicyGroup().List(ctx, &req.ImUserPolicyGroupListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImUserPolicyGroupListModel{}
|
||||
}
|
||||
res = new(imuserpolicygroup.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cImUserPolicyGroup) View(ctx context.Context, req *imuserpolicygroup.ViewReq) (res *imuserpolicygroup.ViewRes, err error) {
|
||||
data, err := service.SysImUserPolicyGroup().View(ctx, &req.ImUserPolicyGroupViewInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &imuserpolicygroup.ViewRes{ImUserPolicyGroupViewModel: data}, nil
|
||||
}
|
||||
func (c *cImUserPolicyGroup) Edit(ctx context.Context, req *imuserpolicygroup.EditReq) (res *imuserpolicygroup.EditRes, err error) {
|
||||
err = service.SysImUserPolicyGroup().Edit(ctx, &req.ImUserPolicyGroupEditInp)
|
||||
return
|
||||
}
|
||||
func (c *cImUserPolicyGroup) Delete(ctx context.Context, req *imuserpolicygroup.DeleteReq) (res *imuserpolicygroup.DeleteRes, err error) {
|
||||
err = service.SysImUserPolicyGroup().Delete(ctx, &req.ImUserPolicyGroupDeleteInp)
|
||||
return
|
||||
}
|
||||
func (c *cImUserPolicyGroup) Status(ctx context.Context, req *imuserpolicygroup.StatusReq) (res *imuserpolicygroup.StatusRes, err error) {
|
||||
err = service.SysImUserPolicyGroup().Status(ctx, &req.ImUserPolicyGroupStatusInp)
|
||||
return
|
||||
}
|
||||
func (c *cImUserPolicyGroup) MemberList(ctx context.Context, req *imuserpolicygroup.MemberListReq) (res *imuserpolicygroup.MemberListRes, err error) {
|
||||
list, total, err := service.SysImUserPolicyGroup().MemberList(ctx, &req.ImUserPolicyGroupMemberListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImUserPolicyGroupMemberModel{}
|
||||
}
|
||||
res = new(imuserpolicygroup.MemberListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, total)
|
||||
return
|
||||
}
|
||||
func (c *cImUserPolicyGroup) MemberAdd(ctx context.Context, req *imuserpolicygroup.MemberAddReq) (res *imuserpolicygroup.MemberAddRes, err error) {
|
||||
err = service.SysImUserPolicyGroup().MemberAdd(ctx, &req.ImUserPolicyGroupMemberAddInp)
|
||||
return
|
||||
}
|
||||
func (c *cImUserPolicyGroup) MemberRemove(ctx context.Context, req *imuserpolicygroup.MemberRemoveReq) (res *imuserpolicygroup.MemberRemoveRes, err error) {
|
||||
err = service.SysImUserPolicyGroup().MemberRemove(ctx, &req.ImUserPolicyGroupMemberRemoveInp)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user