im 管理后台
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/cash"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Cash = cCash{}
|
||||
)
|
||||
|
||||
type cCash struct{}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCash) View(ctx context.Context, req *cash.ViewReq) (res *cash.ViewRes, err error) {
|
||||
data, err := service.AdminCash().View(ctx, &req.CashViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cash.ViewRes)
|
||||
res.CashViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCash) List(ctx context.Context, req *cash.ListReq) (res *cash.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminCash().List(ctx, &req.CashListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cash.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Apply 申请提现
|
||||
func (c *cCash) Apply(ctx context.Context, req *cash.ApplyReq) (res *cash.ApplyRes, err error) {
|
||||
err = service.AdminCash().Apply(ctx, &adminin.CashApplyInp{
|
||||
Money: req.Money,
|
||||
MemberId: contexts.GetUserId(ctx),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// Payment 提现打款处理
|
||||
func (c *cCash) Payment(ctx context.Context, req *cash.PaymentReq) (res *cash.PaymentRes, err error) {
|
||||
err = service.AdminCash().Payment(ctx, &req.CashPaymentInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Package admin
|
||||
// @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
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-15 15:59:58
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/creditslog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
CreditsLog = cCreditsLog{}
|
||||
)
|
||||
|
||||
type cCreditsLog struct{}
|
||||
|
||||
// List 查看资产变动列表
|
||||
func (c *cCreditsLog) List(ctx context.Context, req *creditslog.ListReq) (res *creditslog.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminCreditsLog().List(ctx, &req.CreditsLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(creditslog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出资产变动列表
|
||||
func (c *cCreditsLog) Export(ctx context.Context, req *creditslog.ExportReq) (res *creditslog.ExportRes, err error) {
|
||||
err = service.AdminCreditsLog().Export(ctx, &req.CreditsLogListInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/dept"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Dept = cDept{}
|
||||
)
|
||||
|
||||
type cDept struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDept) Delete(ctx context.Context, req *dept.DeleteReq) (res *dept.DeleteRes, err error) {
|
||||
err = service.AdminDept().Delete(ctx, &req.DeptDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDept) Edit(ctx context.Context, req *dept.EditReq) (res *dept.EditRes, err error) {
|
||||
err = service.AdminDept().Edit(ctx, &req.DeptEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cDept) MaxSort(ctx context.Context, req *dept.MaxSortReq) (res *dept.MaxSortRes, err error) {
|
||||
res = new(dept.MaxSortRes)
|
||||
res.DeptMaxSortModel, err = service.AdminDept().MaxSort(ctx, &req.DeptMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cDept) View(ctx context.Context, req *dept.ViewReq) (res *dept.ViewRes, err error) {
|
||||
res = new(dept.ViewRes)
|
||||
res.DeptViewModel, err = service.AdminDept().View(ctx, &req.DeptViewInp)
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cDept) List(ctx context.Context, req *dept.ListReq) (res *dept.ListRes, err error) {
|
||||
data, err := service.AdminDept().List(ctx, &req.DeptListInp)
|
||||
if err != nil || data == nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*dept.ListRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// Option 获取部门选项树
|
||||
func (c *cDept) Option(ctx context.Context, req *dept.OptionReq) (res *dept.OptionRes, err error) {
|
||||
list, totalCount, err := service.AdminDept().Option(ctx, &req.DeptOptionInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(dept.OptionRes)
|
||||
res.DeptOptionModel = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// TreeOption 获取部门管理关系树选项
|
||||
func (c *cDept) TreeOption(ctx context.Context, req *dept.TreeOptionReq) (res *dept.TreeOptionRes, err error) {
|
||||
data, err := service.AdminDept().TreeOption(ctx)
|
||||
res = (*dept.TreeOptionRes)(&data)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/member"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/input/adminin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Member = cMember{}
|
||||
)
|
||||
|
||||
type cMember struct{}
|
||||
|
||||
// UpdateCash 修改代理商提现信息
|
||||
func (c *cMember) UpdateCash(ctx context.Context, req *member.UpdateCashReq) (res *member.UpdateCashRes, err error) {
|
||||
err = service.AdminMember().UpdateCash(ctx, &req.MemberUpdateCashInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateEmail 换绑邮箱
|
||||
func (c *cMember) UpdateEmail(ctx context.Context, req *member.UpdateEmailReq) (res *member.UpdateEmailRes, err error) {
|
||||
err = service.AdminMember().UpdateEmail(ctx, &req.MemberUpdateEmailInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateMobile 换绑手机号
|
||||
func (c *cMember) UpdateMobile(ctx context.Context, req *member.UpdateMobileReq) (res *member.UpdateMobileRes, err error) {
|
||||
err = service.AdminMember().UpdateMobile(ctx, &req.MemberUpdateMobileInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateProfile 更新用户资料
|
||||
func (c *cMember) UpdateProfile(ctx context.Context, req *member.UpdateProfileReq) (res *member.UpdateProfileRes, err error) {
|
||||
err = service.AdminMember().UpdateProfile(ctx, &req.MemberUpdateProfileInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePwd 修改登录密码
|
||||
func (c *cMember) UpdatePwd(ctx context.Context, req *member.UpdatePwdReq) (res *member.UpdatePwdRes, err error) {
|
||||
var memberId = contexts.Get(ctx).User.Id
|
||||
if memberId <= 0 {
|
||||
err = gerror.New("获取用户信息失败!")
|
||||
return
|
||||
}
|
||||
|
||||
err = service.AdminMember().UpdatePwd(ctx, &adminin.MemberUpdatePwdInp{
|
||||
Id: memberId,
|
||||
OldPassword: req.OldPassword,
|
||||
NewPassword: req.NewPassword,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// ResetPwd 重置密码
|
||||
func (c *cMember) ResetPwd(ctx context.Context, req *member.ResetPwdReq) (res *member.ResetPwdRes, err error) {
|
||||
err = service.AdminMember().ResetPwd(ctx, &req.MemberResetPwdInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MemberInfo 登录用户信息
|
||||
func (c *cMember) MemberInfo(ctx context.Context, _ *member.InfoReq) (res *member.InfoRes, err error) {
|
||||
data, err := service.AdminMember().LoginMemberInfo(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(member.InfoRes)
|
||||
res.LoginMemberInfoModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除用户
|
||||
func (c *cMember) Delete(ctx context.Context, req *member.DeleteReq) (res *member.DeleteRes, err error) {
|
||||
err = service.AdminMember().Delete(ctx, &req.MemberDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改/新增用户
|
||||
func (c *cMember) Edit(ctx context.Context, req *member.EditReq) (res *member.EditRes, err error) {
|
||||
err = service.AdminMember().Edit(ctx, &req.MemberEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定用户信息
|
||||
func (c *cMember) View(ctx context.Context, req *member.ViewReq) (res *member.ViewRes, err error) {
|
||||
data, err := service.AdminMember().View(ctx, &req.MemberViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(member.ViewRes)
|
||||
res.MemberViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看用户列表
|
||||
func (c *cMember) List(ctx context.Context, req *member.ListReq) (res *member.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminMember().List(ctx, &req.MemberListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(member.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新用户状态
|
||||
func (c *cMember) Status(ctx context.Context, req *member.StatusReq) (res *member.StatusRes, err error) {
|
||||
err = service.AdminMember().Status(ctx, &req.MemberStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Select 获取可选的后台用户选项
|
||||
func (c *cMember) Select(ctx context.Context, req *member.SelectReq) (res *member.SelectRes, err error) {
|
||||
data, err := service.AdminMember().Select(ctx, &req.MemberSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*member.SelectRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// AddBalance 增加用户余额
|
||||
func (c *cMember) AddBalance(ctx context.Context, req *member.AddBalanceReq) (res *member.AddBalanceRes, err error) {
|
||||
err = service.AdminMember().AddBalance(ctx, &req.MemberAddBalanceInp)
|
||||
return
|
||||
}
|
||||
|
||||
// AddIntegral 增加用户积分
|
||||
func (c *cMember) AddIntegral(ctx context.Context, req *member.AddIntegralReq) (res *member.AddIntegralRes, err error) {
|
||||
err = service.AdminMember().AddIntegral(ctx, &req.MemberAddIntegralInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/menu"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Menu 菜单
|
||||
var (
|
||||
Menu = cMenu{}
|
||||
)
|
||||
|
||||
type cMenu struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cMenu) Delete(ctx context.Context, req *menu.DeleteReq) (res *menu.DeleteRes, err error) {
|
||||
err = service.AdminMenu().Delete(ctx, &req.MenuDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cMenu) Edit(ctx context.Context, req *menu.EditReq) (res *menu.EditRes, err error) {
|
||||
err = service.AdminMenu().Edit(ctx, &req.MenuEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// List 获取列表
|
||||
func (c *cMenu) List(ctx context.Context, req *menu.ListReq) (res menu.ListRes, err error) {
|
||||
res.MenuListModel, err = service.AdminMenu().List(ctx, &req.MenuListInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"hotgo/api/admin/monitor"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/internal/websocket"
|
||||
"hotgo/utility/simple"
|
||||
"hotgo/utility/useragent"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// Monitor 监控
|
||||
var Monitor = cMonitor{
|
||||
wsManager: websocket.Manager(),
|
||||
}
|
||||
|
||||
type cMonitor struct {
|
||||
wsManager *websocket.ClientManager
|
||||
}
|
||||
|
||||
// UserOffline 下线用户
|
||||
func (c *cMonitor) UserOffline(ctx context.Context, req *monitor.UserOfflineReq) (res *monitor.UserOfflineRes, err error) {
|
||||
client := c.wsManager.GetClient(req.Id)
|
||||
if client == nil {
|
||||
err = gerror.New("客户端已离线")
|
||||
return
|
||||
}
|
||||
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
websocket.SendSuccess(client, "kick")
|
||||
websocket.Close(client)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// UserOnlineList 获取用户在线列表
|
||||
func (c *cMonitor) UserOnlineList(ctx context.Context, req *monitor.UserOnlineListReq) (res *monitor.UserOnlineListRes, err error) {
|
||||
var (
|
||||
clients []*monitor.UserOnlineModel
|
||||
i int
|
||||
)
|
||||
|
||||
if c.wsManager.GetClientsLen() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for conn := range c.wsManager.GetClients() {
|
||||
if conn.SendClose || conn.User == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.UserId > 0 && req.UserId != conn.User.Id {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.Username != "" && req.Username != conn.User.Username {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.IP != "" && !gstr.Contains(conn.IP, req.IP) {
|
||||
continue
|
||||
}
|
||||
|
||||
if len(req.FirstTime) == 2 && (conn.User.LoginAt.Before(req.FirstTime[0]) || conn.User.LoginAt.After(req.FirstTime[1])) {
|
||||
continue
|
||||
}
|
||||
|
||||
clients = append(clients, &monitor.UserOnlineModel{
|
||||
ID: conn.ID,
|
||||
IP: conn.IP,
|
||||
Os: useragent.GetOs(conn.UserAgent),
|
||||
Browser: useragent.GetBrowser(conn.UserAgent),
|
||||
FirstTime: conn.User.LoginAt.Unix(),
|
||||
HeartbeatTime: conn.HeartbeatTime,
|
||||
App: conn.User.App,
|
||||
UserId: conn.User.Id,
|
||||
Username: conn.User.Username,
|
||||
Avatar: conn.User.Avatar,
|
||||
})
|
||||
}
|
||||
|
||||
res = new(monitor.UserOnlineListRes)
|
||||
res.PageRes.Pack(req, len(clients))
|
||||
|
||||
sort.Slice(clients, func(i, j int) bool {
|
||||
if clients[i].FirstTime == clients[j].FirstTime {
|
||||
return clients[i].ID < clients[j].ID
|
||||
}
|
||||
return clients[i].FirstTime < clients[j].FirstTime
|
||||
})
|
||||
|
||||
_, perPage, offset := form.CalPage(req.Page, req.PerPage)
|
||||
for k, v := range clients {
|
||||
if k >= offset && i <= perPage {
|
||||
if simple.IsDemo(ctx) {
|
||||
v.IP = consts.DemoTips
|
||||
}
|
||||
res.List = append(res.List, v)
|
||||
i++
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// NetOnlineList 获取服务在线列表
|
||||
func (c *cMonitor) NetOnlineList(ctx context.Context, req *monitor.NetOnlineListReq) (res *monitor.NetOnlineListRes, err error) {
|
||||
var (
|
||||
clients []*monitor.NetOnlineModel
|
||||
i int
|
||||
cols = dao.SysServeLicense.Columns()
|
||||
serv = service.TCPServer().Instance()
|
||||
models *entity.SysServeLicense
|
||||
)
|
||||
|
||||
conns := serv.GetClients()
|
||||
if len(conns) == 0 {
|
||||
res = new(monitor.NetOnlineListRes)
|
||||
res.PageRes.Pack(req, 0)
|
||||
return
|
||||
}
|
||||
|
||||
for _, conn := range conns {
|
||||
v := &monitor.NetOnlineModel{
|
||||
AuthMeta: conn.Auth,
|
||||
Id: conn.CID,
|
||||
IsAuth: conn.Auth != nil,
|
||||
Addr: conn.RemoteAddr().String(),
|
||||
Port: gstr.SubStrFromEx(conn.LocalAddr().String(), `:`),
|
||||
FirstTime: conn.FirstTime,
|
||||
HeartbeatTime: conn.Heartbeat,
|
||||
Proto: "TCP",
|
||||
}
|
||||
|
||||
if v.IsAuth {
|
||||
if err = dao.SysServeLicense.Ctx(ctx).Where(cols.Appid, conn.Auth.AppId).Where(cols.Group, conn.Auth.Group).Scan(&models); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if models == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
v.LicenseId = models.Id
|
||||
v.LicenseName = models.Name
|
||||
v.LoginTimes = models.LoginTimes
|
||||
v.Online = serv.GetAppIdOnline(models.Appid)
|
||||
v.OnlineLimit = models.OnlineLimit
|
||||
}
|
||||
|
||||
if req.Addr != "" && !gstr.Contains(v.Addr, req.Addr) {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.Name != "" && !gstr.Contains(v.Name, req.Name) {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.Group != "" && (!v.IsAuth || v.Group != req.Group) {
|
||||
continue
|
||||
}
|
||||
|
||||
if req.AppId != "" && (!v.IsAuth || v.AppId != req.AppId) {
|
||||
continue
|
||||
}
|
||||
|
||||
ft := gtime.New(conn.FirstTime)
|
||||
if len(req.FirstTime) == 2 && (ft.Before(req.FirstTime[0]) || ft.After(req.FirstTime[1])) {
|
||||
continue
|
||||
}
|
||||
clients = append(clients, v)
|
||||
}
|
||||
|
||||
res = new(monitor.NetOnlineListRes)
|
||||
res.PageRes.Pack(req, len(clients))
|
||||
|
||||
sort.Slice(clients, func(i, j int) bool {
|
||||
return clients[i].Id > clients[j].Id
|
||||
})
|
||||
|
||||
_, perPage, offset := form.CalPage(req.Page, req.PerPage)
|
||||
for k, v := range clients {
|
||||
if k >= offset && i <= perPage {
|
||||
res.List = append(res.List, v)
|
||||
i++
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// NetOption 获取服务选项
|
||||
func (c *cMonitor) NetOption(ctx context.Context, req *monitor.NetOptionReq) (res *monitor.NetOptionRes, err error) {
|
||||
res = new(monitor.NetOptionRes)
|
||||
|
||||
for _, v := range service.TCPServer().Instance().GetRoutes() {
|
||||
// 无需勾选的路由
|
||||
disabled := false
|
||||
if v.Id == "ServerLoginReq" || v.Id == "ServerHeartbeatReq" {
|
||||
disabled = true
|
||||
}
|
||||
|
||||
res.Routes = append(res.Routes, &monitor.RouteSelect{
|
||||
Value: v.Id,
|
||||
Label: v.Id,
|
||||
Disabled: disabled,
|
||||
IsRPC: v.IsRPC,
|
||||
})
|
||||
}
|
||||
|
||||
sort.Slice(res.Routes, func(i, j int) bool {
|
||||
if res.Routes[i].IsRPC && !res.Routes[j].IsRPC {
|
||||
return true
|
||||
} else if !res.Routes[i].IsRPC && res.Routes[j].IsRPC {
|
||||
return false
|
||||
}
|
||||
return res.Routes[i].Label < res.Routes[j].Label
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// NetOffline 下线服务
|
||||
func (c *cMonitor) NetOffline(ctx context.Context, req *monitor.NetOfflineReq) (res *monitor.NetOfflineRes, err error) {
|
||||
conn := service.TCPServer().Instance().GetClientById(req.Id)
|
||||
if conn == nil {
|
||||
err = gerror.New("客户端不在线")
|
||||
return
|
||||
}
|
||||
// 关闭连接
|
||||
conn.Close()
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/notice"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Notice = cNotice{}
|
||||
)
|
||||
|
||||
type cNotice struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cNotice) Delete(ctx context.Context, req *notice.DeleteReq) (res *notice.DeleteRes, err error) {
|
||||
err = service.AdminNotice().Delete(ctx, &req.NoticeDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cNotice) Edit(ctx context.Context, req *notice.EditReq) (res *notice.EditRes, err error) {
|
||||
err = service.AdminNotice().Edit(ctx, &req.NoticeEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cNotice) MaxSort(ctx context.Context, req *notice.MaxSortReq) (res *notice.MaxSortRes, err error) {
|
||||
res = new(notice.MaxSortRes)
|
||||
res.NoticeMaxSortModel, err = service.AdminNotice().MaxSort(ctx, &req.NoticeMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cNotice) View(ctx context.Context, req *notice.ViewReq) (res *notice.ViewRes, err error) {
|
||||
data, err := service.AdminNotice().View(ctx, &req.NoticeViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(notice.ViewRes)
|
||||
res.NoticeViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cNotice) List(ctx context.Context, req *notice.ListReq) (res *notice.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminNotice().List(ctx, &req.NoticeListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = new(notice.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cNotice) Status(ctx context.Context, req *notice.StatusReq) (res *notice.StatusRes, err error) {
|
||||
err = service.AdminNotice().Status(ctx, &req.NoticeStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Notify 更新通知
|
||||
func (c *cNotice) Notify(ctx context.Context, req *notice.EditNotifyReq) (res *notice.EditNotifyRes, err error) {
|
||||
req.Type = consts.NoticeTypeNotify
|
||||
err = service.AdminNotice().Edit(ctx, &req.NoticeEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Notice 更新公告
|
||||
func (c *cNotice) Notice(ctx context.Context, req *notice.EditNoticeReq) (res *notice.EditNoticeRes, err error) {
|
||||
req.Type = consts.NoticeTypeNotice
|
||||
err = service.AdminNotice().Edit(ctx, &req.NoticeEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Letter 更新私信
|
||||
func (c *cNotice) Letter(ctx context.Context, req *notice.EditLetterReq) (res *notice.EditLetterRes, err error) {
|
||||
req.Type = consts.NoticeTypeLetter
|
||||
err = service.AdminNotice().Edit(ctx, &req.NoticeEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpRead 更新已读
|
||||
func (c *cNotice) UpRead(ctx context.Context, req *notice.UpReadReq) (res *notice.UpReadRes, err error) {
|
||||
err = service.AdminNotice().UpRead(ctx, &req.NoticeUpReadInp)
|
||||
return
|
||||
}
|
||||
|
||||
// PullMessages 拉取未读消息列表
|
||||
func (c *cNotice) PullMessages(ctx context.Context, req *notice.PullMessagesReq) (res *notice.PullMessagesRes, err error) {
|
||||
data, err := service.AdminNotice().PullMessages(ctx, &req.PullMessagesInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(notice.PullMessagesRes)
|
||||
res.PullMessagesModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// ReadAll 全部已读
|
||||
func (c *cNotice) ReadAll(ctx context.Context, req *notice.ReadAllReq) (res *notice.ReadAllRes, err error) {
|
||||
err = service.AdminNotice().ReadAll(ctx, &req.NoticeReadAllInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MessageList 我的消息列表
|
||||
func (c *cNotice) MessageList(ctx context.Context, req *notice.MessageListReq) (res *notice.MessageListRes, err error) {
|
||||
list, totalCount, err := service.AdminNotice().MessageList(ctx, &req.NoticeMessageListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(notice.MessageListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/order"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Order = cOrder{}
|
||||
)
|
||||
|
||||
type cOrder struct{}
|
||||
|
||||
// AcceptRefund 受理申请退款
|
||||
func (c *cOrder) AcceptRefund(ctx context.Context, req *order.AcceptRefundReq) (res *order.AcceptRefundRes, err error) {
|
||||
err = service.AdminOrder().AcceptRefund(ctx, &req.OrderAcceptRefundInp)
|
||||
return
|
||||
}
|
||||
|
||||
// ApplyRefund 申请退款
|
||||
func (c *cOrder) ApplyRefund(ctx context.Context, req *order.ApplyRefundReq) (res *order.ApplyRefundRes, err error) {
|
||||
err = service.AdminOrder().ApplyRefund(ctx, &req.OrderApplyRefundInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Create 创建充值订单
|
||||
func (c *cOrder) Create(ctx context.Context, req *order.CreateReq) (res *order.CreateRes, err error) {
|
||||
data, err := service.AdminOrder().Create(ctx, &req.OrderCreateInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(order.CreateRes)
|
||||
res.OrderCreateModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看充值订单列表
|
||||
func (c *cOrder) List(ctx context.Context, req *order.ListReq) (res *order.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminOrder().List(ctx, &req.OrderListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(order.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出充值订单列表
|
||||
func (c *cOrder) Export(ctx context.Context, req *order.ExportReq) (res *order.ExportRes, err error) {
|
||||
err = service.AdminOrder().Export(ctx, &req.OrderListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新充值订单
|
||||
func (c *cOrder) Edit(ctx context.Context, req *order.EditReq) (res *order.EditRes, err error) {
|
||||
err = service.AdminOrder().Edit(ctx, &req.OrderEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定充值订单信息
|
||||
func (c *cOrder) View(ctx context.Context, req *order.ViewReq) (res *order.ViewRes, err error) {
|
||||
data, err := service.AdminOrder().View(ctx, &req.OrderViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(order.ViewRes)
|
||||
res.OrderViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除充值订单
|
||||
func (c *cOrder) Delete(ctx context.Context, req *order.DeleteReq) (res *order.DeleteRes, err error) {
|
||||
err = service.AdminOrder().Delete(ctx, &req.OrderDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新充值订单状态
|
||||
func (c *cOrder) Status(ctx context.Context, req *order.StatusReq) (res *order.StatusRes, err error) {
|
||||
err = service.AdminOrder().Status(ctx, &req.OrderStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/post"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Post 岗位
|
||||
var Post = cPost{}
|
||||
|
||||
type cPost struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cPost) Delete(ctx context.Context, req *post.DeleteReq) (res *post.DeleteRes, err error) {
|
||||
err = service.AdminPost().Delete(ctx, &req.PostDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改/新增
|
||||
func (c *cPost) Edit(ctx context.Context, req *post.EditReq) (res *post.EditRes, err error) {
|
||||
err = service.AdminPost().Edit(ctx, &req.PostEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cPost) MaxSort(ctx context.Context, req *post.MaxSortReq) (res *post.MaxSortRes, err error) {
|
||||
res = new(post.MaxSortRes)
|
||||
res.PostMaxSortModel, err = service.AdminPost().MaxSort(ctx, &req.PostMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cPost) View(ctx context.Context, req *post.ViewReq) (res *post.ViewRes, err error) {
|
||||
data, err := service.AdminPost().View(ctx, &req.PostViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(post.ViewRes)
|
||||
res.PostViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 获取列表
|
||||
func (c *cPost) List(ctx context.Context, req *post.ListReq) (res *post.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminPost().List(ctx, &req.PostListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(post.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cPost) Status(ctx context.Context, req *post.StatusReq) (res *post.StatusRes, err error) {
|
||||
err = service.AdminPost().Status(ctx, &req.PostStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// Package admin
|
||||
// @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 admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/role"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Role = cRole{}
|
||||
)
|
||||
|
||||
type cRole struct{}
|
||||
|
||||
// List 获取列表
|
||||
func (c *cRole) List(ctx context.Context, req *role.ListReq) (res *role.ListRes, err error) {
|
||||
list, totalCount, err := service.AdminRole().List(ctx, &req.RoleListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(role.ListRes)
|
||||
res.RoleListModel = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改角色
|
||||
func (c *cRole) Edit(ctx context.Context, req *role.EditReq) (res *role.EditRes, err error) {
|
||||
err = service.AdminRole().Edit(ctx, &req.RoleEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cRole) Delete(ctx context.Context, req *role.DeleteReq) (res *role.DeleteRes, err error) {
|
||||
err = service.AdminRole().Delete(ctx, &req.RoleDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Dynamic 动态路由
|
||||
func (c *cRole) Dynamic(ctx context.Context, _ *role.DynamicReq) (res *role.DynamicRes, err error) {
|
||||
return service.AdminMenu().GetMenuList(ctx, contexts.GetUserId(ctx))
|
||||
}
|
||||
|
||||
// GetPermissions 获取指定角色权限
|
||||
func (c *cRole) GetPermissions(ctx context.Context, req *role.GetPermissionsReq) (res *role.GetPermissionsRes, err error) {
|
||||
data, err := service.AdminRole().GetPermissions(ctx, &req.GetPermissionsInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(role.GetPermissionsRes)
|
||||
res.GetPermissionsModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePermissions 修改角色菜单权限
|
||||
func (c *cRole) UpdatePermissions(ctx context.Context, req *role.UpdatePermissionsReq) (res *role.UpdatePermissionsRes, err error) {
|
||||
err = service.AdminRole().UpdatePermissions(ctx, &req.UpdatePermissionsInp)
|
||||
return
|
||||
}
|
||||
|
||||
// DataScopeSelect 获取数据权限选项
|
||||
func (c *cRole) DataScopeSelect(_ context.Context, _ *role.DataScopeSelectReq) (res *role.DataScopeSelectRes, err error) {
|
||||
res = new(role.DataScopeSelectRes)
|
||||
res.List = consts.DataScopeSelect
|
||||
return
|
||||
}
|
||||
|
||||
// DataScopeEdit 获取数据权限选项
|
||||
func (c *cRole) DataScopeEdit(ctx context.Context, req *role.DataScopeEditReq) (res *role.DataScopeEditRes, err error) {
|
||||
err = service.AdminRole().DataScopeEdit(ctx, &req.DataScopeEditInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/common"
|
||||
)
|
||||
|
||||
var Console = cConsole{}
|
||||
|
||||
type cConsole struct{}
|
||||
|
||||
// Stat 综合数据统计
|
||||
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
|
||||
res.Visits.Amount = 10403
|
||||
|
||||
res.Saleroom.WeekSaleroom = 20501
|
||||
res.Saleroom.Amount = 21002
|
||||
res.Saleroom.Degree = 83.66
|
||||
|
||||
res.OrderLarge.WeekLarge = 39901
|
||||
res.OrderLarge.Rise = 31012
|
||||
res.OrderLarge.Decline = 30603
|
||||
res.OrderLarge.Amount = 36084
|
||||
|
||||
res.Volume.WeekLarge = 40021
|
||||
res.Volume.Rise = 40202
|
||||
res.Volume.Decline = 45003
|
||||
res.Volume.Amount = 49004
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var Ems = new(cEms)
|
||||
|
||||
type cEms struct{}
|
||||
|
||||
// SendTest 发送测试邮件
|
||||
func (c *cEms) SendTest(ctx context.Context, req *common.SendTestEmailReq) (res *common.SendTestEmailRes, err error) {
|
||||
err = service.SysEmsLog().Send(ctx, &sysin.SendEmsInp{
|
||||
Event: consts.EmsTemplateText,
|
||||
Email: req.To,
|
||||
Content: `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="iso-8859-15">
|
||||
<title>这是一封来自HotGo的测试邮件</title>
|
||||
</head>
|
||||
<body>
|
||||
这是您通过HotGo后台发送的测试邮件。当你收到这封邮件的时候,说明已经联调成功了,恭喜你!
|
||||
</body>
|
||||
</html>`,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// SendBindEms 发送换绑邮件
|
||||
func (c *cEms) SendBindEms(ctx context.Context, _ *common.SendBindEmsReq) (res *common.SendBindEmsRes, err error) {
|
||||
var (
|
||||
memberId = contexts.GetUserId(ctx)
|
||||
models *entity.AdminMember
|
||||
)
|
||||
|
||||
if memberId <= 0 {
|
||||
err = gerror.New("用户身份异常,请重新登录!")
|
||||
return
|
||||
}
|
||||
|
||||
if err = dao.AdminMember.Ctx(ctx).Fields(dao.AdminMember.Columns().Email).Where(dao.AdminMember.Columns().Id, memberId).Scan(&models); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if models == nil {
|
||||
err = gerror.New("用户信息不存在")
|
||||
return
|
||||
}
|
||||
|
||||
if models.Email == "" {
|
||||
err = gerror.New("未绑定邮箱无需发送")
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysEmsLog().Send(ctx, &sysin.SendEmsInp{
|
||||
Event: consts.EmsTemplateBind,
|
||||
Email: models.Email,
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/i18n/gi18n"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/captcha"
|
||||
"hotgo/internal/library/token"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/gogf/gf/v2/text/gstr"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/gogf/gf/v2/util/gmode"
|
||||
)
|
||||
|
||||
var Site = cSite{}
|
||||
|
||||
type cSite struct{}
|
||||
|
||||
// Ping ping
|
||||
func (c *cSite) Ping(_ context.Context, _ *common.SitePingReq) (res *common.SitePingRes, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Config 获取配置
|
||||
func (c *cSite) Config(ctx context.Context, _ *common.SiteConfigReq) (res *common.SiteConfigRes, err error) {
|
||||
request := ghttp.RequestFromCtx(ctx)
|
||||
res = &common.SiteConfigRes{
|
||||
Version: consts.VersionApp,
|
||||
WsAddr: c.getWsAddr(ctx, request),
|
||||
Domain: c.getDomain(ctx, request),
|
||||
Mode: gmode.Mode(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cSite) getWsAddr(ctx context.Context, request *ghttp.Request) string {
|
||||
// 如果是本地IP访问,则认为是调试模式,走实际请求地址,否则走配置中的地址
|
||||
// 尝试读取hostname,兼容本地运行模式
|
||||
ip := ghttp.RequestFromCtx(ctx).GetHeader("hostname")
|
||||
if len(ip) == 0 {
|
||||
ip = ghttp.RequestFromCtx(ctx).GetHost()
|
||||
}
|
||||
|
||||
if validate.IsLocalIPAddr(ip) {
|
||||
return "ws://" + ip + ":" + gstr.StrEx(request.Host, ":") + g.Cfg().MustGet(ctx, "router.websocket.prefix").String()
|
||||
}
|
||||
|
||||
basic, err := service.SysConfig().GetBasic(ctx)
|
||||
if err != nil || basic == nil {
|
||||
return ""
|
||||
}
|
||||
return basic.WsAddr
|
||||
}
|
||||
|
||||
func (c *cSite) getDomain(ctx context.Context, request *ghttp.Request) string {
|
||||
// 如果是本地IP访问,则认为是调试模式,走实际请求地址,否则走配置中的地址
|
||||
// 尝试读取hostname,兼容本地运行模式
|
||||
ip := ghttp.RequestFromCtx(ctx).GetHeader("hostname")
|
||||
if len(ip) == 0 {
|
||||
ip = ghttp.RequestFromCtx(ctx).GetHost()
|
||||
}
|
||||
|
||||
if validate.IsLocalIPAddr(ip) {
|
||||
return "http://" + ip + ":" + gstr.StrEx(request.Host, ":")
|
||||
}
|
||||
|
||||
basic, err := service.SysConfig().GetBasic(ctx)
|
||||
if err != nil || basic == nil {
|
||||
return ""
|
||||
}
|
||||
return basic.Domain
|
||||
}
|
||||
|
||||
// LoginConfig 登录配置
|
||||
func (c *cSite) LoginConfig(ctx context.Context, _ *common.SiteLoginConfigReq) (res *common.SiteLoginConfigRes, err error) {
|
||||
res = new(common.SiteLoginConfigRes)
|
||||
login, err := service.SysConfig().GetLogin(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res.LoginConfig = login
|
||||
res.I18nSwitch = g.Cfg().MustGet(ctx, "system.i18n.switch", true).Bool()
|
||||
res.DefaultLanguage = g.Cfg().MustGet(ctx, "system.i18n.defaultLanguage", consts.SysDefaultLanguage).String()
|
||||
res.ProjectName = gi18n.T(ctx, "HotGo管理系统")
|
||||
return
|
||||
}
|
||||
|
||||
// Captcha 登录验证码
|
||||
func (c *cSite) Captcha(ctx context.Context, _ *common.LoginCaptchaReq) (res *common.LoginCaptchaRes, err error) {
|
||||
loginConf, err := service.SysConfig().GetLogin(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
cid, base64 := captcha.Generate(ctx, loginConf.CaptchaType)
|
||||
res = &common.LoginCaptchaRes{Cid: cid, Base64: base64}
|
||||
return
|
||||
}
|
||||
|
||||
// Register 账号注册
|
||||
func (c *cSite) Register(ctx context.Context, req *common.RegisterReq) (res *common.RegisterRes, err error) {
|
||||
err = service.AdminSite().Register(ctx, &req.RegisterInp)
|
||||
return
|
||||
}
|
||||
|
||||
// AccountLogin 账号登录
|
||||
func (c *cSite) AccountLogin(ctx context.Context, req *common.AccountLoginReq) (res *common.AccountLoginRes, err error) {
|
||||
login, err := service.SysConfig().GetLogin(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if !req.IsLock && login.CaptchaSwitch == consts.StatusEnabled {
|
||||
// 校验 验证码
|
||||
if !captcha.Verify(req.Cid, req.Code) {
|
||||
err = gerror.New("验证码错误")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
model, err := service.AdminSite().AccountLogin(ctx, &req.AccountLoginInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = gconv.Scan(model, &res)
|
||||
return
|
||||
}
|
||||
|
||||
// MobileLogin 手机号登录
|
||||
func (c *cSite) MobileLogin(ctx context.Context, req *common.MobileLoginReq) (res *common.MobileLoginRes, err error) {
|
||||
model, err := service.AdminSite().MobileLogin(ctx, &req.MobileLoginInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = gconv.Scan(model, &res)
|
||||
return
|
||||
}
|
||||
|
||||
// Logout 注销登录
|
||||
func (c *cSite) Logout(ctx context.Context, _ *common.LoginLogoutReq) (res *common.LoginLogoutRes, err error) {
|
||||
err = token.Logout(ghttp.RequestFromCtx(ctx))
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao"
|
||||
"hotgo/internal/library/contexts"
|
||||
"hotgo/internal/model/entity"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var Sms = new(cSms)
|
||||
|
||||
type cSms struct{}
|
||||
|
||||
// SendTest 发送测试短信
|
||||
func (c *cSms) SendTest(ctx context.Context, req *common.SendTestSmsReq) (res *common.SendTestSmsRes, err error) {
|
||||
err = service.SysSmsLog().SendCode(ctx, &req.SendCodeInp)
|
||||
return
|
||||
}
|
||||
|
||||
// SendBindSms 发送换绑短信
|
||||
func (c *cSms) SendBindSms(ctx context.Context, _ *common.SendBindSmsReq) (res *common.SendBindSmsRes, err error) {
|
||||
var (
|
||||
memberId = contexts.GetUserId(ctx)
|
||||
models *entity.AdminMember
|
||||
)
|
||||
|
||||
if memberId <= 0 {
|
||||
err = gerror.New("用户身份异常,请重新登录!")
|
||||
return
|
||||
}
|
||||
|
||||
if err = dao.AdminMember.Ctx(ctx).Fields(dao.AdminMember.Columns().Mobile).Where(dao.AdminMember.Columns().Id, memberId).Scan(&models); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if models == nil {
|
||||
err = gerror.New("用户信息不存在")
|
||||
return
|
||||
}
|
||||
|
||||
if models.Mobile == "" {
|
||||
err = gerror.New("未绑定手机号无需发送")
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysSmsLog().SendCode(ctx, &sysin.SendCodeInp{
|
||||
Event: consts.SmsTemplateBind,
|
||||
Mobile: models.Mobile,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// SendSms 发送短信
|
||||
func (c *cSms) SendSms(ctx context.Context, req *common.SendSmsReq) (res *common.SendSmsRes, err error) {
|
||||
err = service.SysSmsLog().SendCode(ctx, &req.SendCodeInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/library/storager"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var Upload = new(cUpload)
|
||||
|
||||
type cUpload struct{}
|
||||
|
||||
// UploadFile 上传文件
|
||||
func (c *cUpload) UploadFile(ctx context.Context, _ *common.UploadFileReq) (res common.UploadFileRes, err error) {
|
||||
r := g.RequestFromCtx(ctx)
|
||||
uploadType := r.Header.Get("uploadType")
|
||||
if uploadType != "default" && !validate.InSlice(storager.KindSlice, uploadType) {
|
||||
err = gerror.New("上传类型是无效的")
|
||||
return
|
||||
}
|
||||
|
||||
file := r.GetUploadFile("file")
|
||||
if file == nil {
|
||||
err = gerror.New("没有找到上传的文件")
|
||||
return
|
||||
}
|
||||
return service.CommonUpload().UploadFile(ctx, uploadType, file)
|
||||
}
|
||||
|
||||
// CheckMultipart 检查文件分片
|
||||
func (c *cUpload) CheckMultipart(ctx context.Context, req *common.CheckMultipartReq) (res *common.CheckMultipartRes, err error) {
|
||||
data, err := service.CommonUpload().CheckMultipart(ctx, &req.CheckMultipartInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = new(common.CheckMultipartRes)
|
||||
res.CheckMultipartModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// UploadPart 上传分片
|
||||
func (c *cUpload) UploadPart(ctx context.Context, req *common.UploadPartReq) (res *common.UploadPartRes, err error) {
|
||||
data, err := service.CommonUpload().UploadPart(ctx, &req.UploadPartInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = new(common.UploadPartRes)
|
||||
res.UploadPartModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// ImageTransferStorage 图片链接转存
|
||||
func (c *cUpload) ImageTransferStorage(ctx context.Context, req *common.ImageTransferStorageReq) (res *common.ImageTransferStorageRes, err error) {
|
||||
res = new(common.ImageTransferStorageRes)
|
||||
res.ImageTransferStorageModel, err = service.CommonUpload().ImageTransferStorage(ctx, &req.ImageTransferStorageInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Package common
|
||||
// @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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/common"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Wechat = cWechat{}
|
||||
)
|
||||
|
||||
type cWechat struct{}
|
||||
|
||||
func (c *cWechat) Authorize(ctx context.Context, req *common.WechatAuthorizeReq) (res *common.WechatAuthorizeRes, err error) {
|
||||
_, err = service.CommonWechat().Authorize(ctx, &req.WechatAuthorizeInp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *cWechat) AuthorizeCall(ctx context.Context, req *common.WechatAuthorizeCallReq) (res *common.WechatAuthorizeCallRes, err error) {
|
||||
_, err = service.CommonWechat().AuthorizeCall(ctx, &req.WechatAuthorizeCallInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Package pay
|
||||
// @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
|
||||
// @AutoGenerate Version 2.5.3
|
||||
// @AutoGenerate Date 2023-04-15 15:59:58
|
||||
package pay
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/pay"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Refund = cRefund{}
|
||||
)
|
||||
|
||||
type cRefund struct{}
|
||||
|
||||
// List 查看交易退款列表
|
||||
func (c *cRefund) List(ctx context.Context, req *pay.RefundListReq) (res *pay.RefundListRes, err error) {
|
||||
list, totalCount, err := service.PayRefund().List(ctx, &req.PayRefundListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(pay.RefundListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出交易退款列表
|
||||
func (c *cRefund) Export(ctx context.Context, req *pay.RefundExportReq) (res *pay.RefundExportRes, err error) {
|
||||
err = service.PayRefund().Export(ctx, &req.PayRefundListInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/addons"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Addons = cAddons{}
|
||||
)
|
||||
|
||||
type cAddons struct{}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cAddons) List(ctx context.Context, req *addons.ListReq) (res *addons.ListRes, err error) {
|
||||
list, totalCount, err := service.SysAddons().List(ctx, &req.AddonsListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(addons.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Build 生成预览
|
||||
func (c *cAddons) Build(ctx context.Context, req *addons.BuildReq) (res *addons.BuildRes, err error) {
|
||||
err = service.SysAddons().Build(ctx, &req.AddonsBuildInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Install 安装模块
|
||||
func (c *cAddons) Install(ctx context.Context, req *addons.InstallReq) (res *addons.InstallRes, err error) {
|
||||
if err = service.SysAddons().Install(ctx, &req.AddonsInstallInp); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Upgrade 更新模块
|
||||
func (c *cAddons) Upgrade(ctx context.Context, req *addons.UpgradeReq) (res *addons.UpgradeRes, err error) {
|
||||
if err = service.SysAddons().Upgrade(ctx, &req.AddonsUpgradeInp); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UnInstall 卸载模块
|
||||
func (c *cAddons) UnInstall(ctx context.Context, req *addons.UnInstallReq) (res *addons.UnInstallRes, err error) {
|
||||
if err = service.SysAddons().UnInstall(ctx, &req.AddonsUnInstallInp); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/attachment"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Attachment = cAttachment{}
|
||||
)
|
||||
|
||||
type cAttachment struct{}
|
||||
|
||||
// Delete 删除附件
|
||||
func (c *cAttachment) Delete(ctx context.Context, req *attachment.DeleteReq) (res *attachment.DeleteRes, err error) {
|
||||
err = service.SysAttachment().Delete(ctx, &req.AttachmentDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定附件信息
|
||||
func (c *cAttachment) View(ctx context.Context, req *attachment.ViewReq) (res *attachment.ViewRes, err error) {
|
||||
data, err := service.SysAttachment().View(ctx, &req.AttachmentViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(attachment.ViewRes)
|
||||
res.AttachmentViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看附件列表
|
||||
func (c *cAttachment) List(ctx context.Context, req *attachment.ListReq) (res *attachment.ListRes, err error) {
|
||||
list, totalCount, err := service.SysAttachment().List(ctx, &req.AttachmentListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(attachment.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// ClearKind 清空上传类型
|
||||
func (c *cAttachment) ClearKind(ctx context.Context, req *attachment.ClearKindReq) (res *attachment.ClearKindRes, err error) {
|
||||
err = service.SysAttachment().ClearKind(ctx, &req.AttachmentClearKindInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/blacklist"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Blacklist = cBlacklist{}
|
||||
)
|
||||
|
||||
type cBlacklist struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cBlacklist) Delete(ctx context.Context, req *blacklist.DeleteReq) (res *blacklist.DeleteRes, err error) {
|
||||
err = service.SysBlacklist().Delete(ctx, &req.BlacklistDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cBlacklist) Edit(ctx context.Context, req *blacklist.EditReq) (res *blacklist.EditRes, err error) {
|
||||
err = service.SysBlacklist().Edit(ctx, &req.BlacklistEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cBlacklist) View(ctx context.Context, req *blacklist.ViewReq) (res *blacklist.ViewRes, err error) {
|
||||
data, err := service.SysBlacklist().View(ctx, &req.BlacklistViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(blacklist.ViewRes)
|
||||
res.BlacklistViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cBlacklist) List(ctx context.Context, req *blacklist.ListReq) (res *blacklist.ListRes, err error) {
|
||||
list, totalCount, err := service.SysBlacklist().List(ctx, &req.BlacklistListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(blacklist.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新黑名单状态
|
||||
func (c *cBlacklist) Status(ctx context.Context, req *blacklist.StatusReq) (res *blacklist.StatusRes, err error) {
|
||||
err = service.SysBlacklist().Status(ctx, &req.BlacklistStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/config"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Config = cConfig{}
|
||||
)
|
||||
|
||||
type cConfig struct{}
|
||||
|
||||
// GetConfig 获取指定分组的配置
|
||||
func (c *cConfig) GetConfig(ctx context.Context, req *config.GetReq) (res *config.GetRes, err error) {
|
||||
res = new(config.GetRes)
|
||||
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, &req.GetConfigInp)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateConfig 更新指定分组的配置
|
||||
func (c *cConfig) UpdateConfig(ctx context.Context, req *config.UpdateReq) (res *config.UpdateRes, err error) {
|
||||
err = service.SysConfig().UpdateConfigByGroup(ctx, &req.UpdateConfigInp)
|
||||
return
|
||||
}
|
||||
|
||||
// TypeSelect 数据类型选项
|
||||
func (c *cConfig) TypeSelect(_ context.Context, _ *config.TypeSelectReq) (res config.TypeSelectRes, err error) {
|
||||
for _, v := range consts.ConfigTypes {
|
||||
res = append(res, form.Select{
|
||||
Value: v,
|
||||
Name: v,
|
||||
Label: v,
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetCash 获取提现的配置
|
||||
func (c *cConfig) GetCash(ctx context.Context, _ *config.GetCashReq) (res *config.GetCashRes, err error) {
|
||||
res = new(config.GetCashRes)
|
||||
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, &sysin.GetConfigInp{Group: "cash"})
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/cron"
|
||||
"hotgo/api/servmsg"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Cron = cCron{}
|
||||
)
|
||||
|
||||
type cCron struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cCron) Delete(ctx context.Context, req *cron.DeleteReq) (res *cron.DeleteRes, err error) {
|
||||
err = service.TCPServer().CronDelete(ctx, &servmsg.CronDeleteReq{CronDeleteInp: &req.CronDeleteInp})
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cCron) Edit(ctx context.Context, req *cron.EditReq) (res *cron.EditRes, err error) {
|
||||
err = service.TCPServer().CronEdit(ctx, &servmsg.CronEditReq{CronEditInp: &req.CronEditInp})
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cCron) MaxSort(ctx context.Context, req *cron.MaxSortReq) (res *cron.MaxSortRes, err error) {
|
||||
res = new(cron.MaxSortRes)
|
||||
res.CronMaxSortModel, err = service.SysCron().MaxSort(ctx, &req.CronMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCron) View(ctx context.Context, req *cron.ViewReq) (res *cron.ViewRes, err error) {
|
||||
data, err := service.SysCron().View(ctx, &req.CronViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.ViewRes)
|
||||
res.CronViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCron) List(ctx context.Context, req *cron.ListReq) (res *cron.ListRes, err error) {
|
||||
list, totalCount, err := service.SysCron().List(ctx, &req.CronListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cCron) Status(ctx context.Context, req *cron.StatusReq) (res *cron.StatusRes, err error) {
|
||||
if req.Id <= 0 {
|
||||
return nil, gerror.New("定时任务ID不能为空")
|
||||
}
|
||||
|
||||
err = service.TCPServer().CronStatus(ctx, &servmsg.CronStatusReq{CronStatusInp: &req.CronStatusInp})
|
||||
return
|
||||
}
|
||||
|
||||
// OnlineExec 在线执行
|
||||
func (c *cCron) OnlineExec(ctx context.Context, req *cron.OnlineExecReq) (res *cron.OnlineExecRes, err error) {
|
||||
if req.Id <= 0 {
|
||||
return nil, gerror.New("定时任务ID不能为空")
|
||||
}
|
||||
|
||||
err = service.TCPServer().CronOnlineExec(ctx, &servmsg.CronOnlineExecReq{OnlineExecInp: &req.OnlineExecInp})
|
||||
return
|
||||
}
|
||||
|
||||
// DispatchLog 调度日志
|
||||
func (c *cCron) DispatchLog(ctx context.Context, req *cron.DispatchLogReq) (res *cron.DispatchLogRes, err error) {
|
||||
if req.Id <= 0 {
|
||||
return nil, gerror.New("定时任务ID不能为空")
|
||||
}
|
||||
|
||||
res = new(cron.DispatchLogRes)
|
||||
res.DispatchLogModel = new(sysin.DispatchLogModel)
|
||||
res.Log, err = service.TCPServer().DispatchLog(ctx, &servmsg.CronDispatchLogReq{DispatchLogInp: &req.DispatchLogInp})
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/cron"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
CronGroup = cCronGroup{}
|
||||
)
|
||||
|
||||
type cCronGroup struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cCronGroup) Delete(ctx context.Context, req *cron.GroupDeleteReq) (res *cron.GroupDeleteRes, err error) {
|
||||
err = service.SysCronGroup().Delete(ctx, &req.CronGroupDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cCronGroup) Edit(ctx context.Context, req *cron.GroupEditReq) (res *cron.GroupEditRes, err error) {
|
||||
err = service.SysCronGroup().Edit(ctx, &req.CronGroupEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cCronGroup) MaxSort(ctx context.Context, req *cron.GroupMaxSortReq) (res *cron.GroupMaxSortRes, err error) {
|
||||
res = new(cron.GroupMaxSortRes)
|
||||
res.CronGroupMaxSortModel, err = service.SysCronGroup().MaxSort(ctx, &req.CronGroupMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCronGroup) View(ctx context.Context, req *cron.GroupViewReq) (res *cron.GroupViewRes, err error) {
|
||||
data, err := service.SysCronGroup().View(ctx, &req.CronGroupViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.GroupViewRes)
|
||||
res.CronGroupViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCronGroup) List(ctx context.Context, req *cron.GroupListReq) (res *cron.GroupListRes, err error) {
|
||||
list, totalCount, err := service.SysCronGroup().List(ctx, &req.CronGroupListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.GroupListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res *cron.GroupStatusRes, err error) {
|
||||
err = service.SysCronGroup().Status(ctx, &req.CronGroupStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Select 选项
|
||||
func (c *cCronGroup) Select(ctx context.Context, req *cron.GroupSelectReq) (res *cron.GroupSelectRes, err error) {
|
||||
data, err := service.SysCronGroup().Select(ctx, &req.CronGroupSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.GroupSelectRes)
|
||||
res.CronGroupSelectModel = data
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2025 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.18.6
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/curddemo"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
CurdDemo = cCurdDemo{}
|
||||
)
|
||||
|
||||
type cCurdDemo struct{}
|
||||
|
||||
// List 查看CURD列表列表
|
||||
func (c *cCurdDemo) List(ctx context.Context, req *curddemo.ListReq) (res *curddemo.ListRes, err error) {
|
||||
list, totalCount, err := service.SysCurdDemo().List(ctx, &req.CurdDemoListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.CurdDemoListModel{}
|
||||
}
|
||||
|
||||
res = new(curddemo.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出CURD列表列表
|
||||
func (c *cCurdDemo) Export(ctx context.Context, req *curddemo.ExportReq) (res *curddemo.ExportRes, err error) {
|
||||
err = service.SysCurdDemo().Export(ctx, &req.CurdDemoListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新CURD列表
|
||||
func (c *cCurdDemo) Edit(ctx context.Context, req *curddemo.EditReq) (res *curddemo.EditRes, err error) {
|
||||
err = service.SysCurdDemo().Edit(ctx, &req.CurdDemoEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 获取CURD列表最大排序
|
||||
func (c *cCurdDemo) MaxSort(ctx context.Context, req *curddemo.MaxSortReq) (res *curddemo.MaxSortRes, err error) {
|
||||
data, err := service.SysCurdDemo().MaxSort(ctx, &req.CurdDemoMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(curddemo.MaxSortRes)
|
||||
res.CurdDemoMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定CURD列表信息
|
||||
func (c *cCurdDemo) View(ctx context.Context, req *curddemo.ViewReq) (res *curddemo.ViewRes, err error) {
|
||||
data, err := service.SysCurdDemo().View(ctx, &req.CurdDemoViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(curddemo.ViewRes)
|
||||
res.CurdDemoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除CURD列表
|
||||
func (c *cCurdDemo) Delete(ctx context.Context, req *curddemo.DeleteReq) (res *curddemo.DeleteRes, err error) {
|
||||
err = service.SysCurdDemo().Delete(ctx, &req.CurdDemoDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新CURD列表状态
|
||||
func (c *cCurdDemo) Status(ctx context.Context, req *curddemo.StatusReq) (res *curddemo.StatusRes, err error) {
|
||||
err = service.SysCurdDemo().Status(ctx, &req.CurdDemoStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Switch 更新CURD列表开关状态
|
||||
func (c *cCurdDemo) Switch(ctx context.Context, req *curddemo.SwitchReq) (res *curddemo.SwitchRes, err error) {
|
||||
err = service.SysCurdDemo().Switch(ctx, &req.CurdDemoSwitchInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/dict"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
DictData = cDictData{}
|
||||
)
|
||||
|
||||
type cDictData struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDictData) Delete(ctx context.Context, req *dict.DataDeleteReq) (res *dict.DataDeleteRes, err error) {
|
||||
err = service.SysDictData().Delete(ctx, &req.DictDataDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDictData) Edit(ctx context.Context, req *dict.DataEditReq) (res *dict.DataEditRes, err error) {
|
||||
err = service.SysDictData().Edit(ctx, &req.DictDataEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cDictData) List(ctx context.Context, req *dict.DataListReq) (res *dict.DataListRes, err error) {
|
||||
list, totalCount, err := service.SysDictData().List(ctx, &req.DictDataListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(dict.DataListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Select 指定选项
|
||||
func (c *cDictData) Select(ctx context.Context, req *dict.DataSelectReq) (res dict.DataSelectRes, err error) {
|
||||
list, err := service.SysDictData().Select(ctx, &req.DataSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = dict.DataSelectRes(list)
|
||||
return
|
||||
}
|
||||
|
||||
// Selects 多个选项
|
||||
func (c *cDictData) Selects(ctx context.Context, req *dict.DataSelectsReq) (res dict.DataSelectsRes, err error) {
|
||||
res = make(dict.DataSelectsRes)
|
||||
for _, v := range req.Types {
|
||||
option, err := service.SysDictData().Select(ctx, &sysin.DataSelectInp{Type: v})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res[v] = option
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/dict"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
DictType = cDictType{}
|
||||
)
|
||||
|
||||
type cDictType struct{}
|
||||
|
||||
// Tree 树
|
||||
func (c *cDictType) Tree(ctx context.Context, _ *dict.TypeTreeReq) (res *dict.TypeTreeRes, err error) {
|
||||
res = new(dict.TypeTreeRes)
|
||||
res.List, err = service.SysDictType().Tree(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDictType) Delete(ctx context.Context, req *dict.TypeDeleteReq) (res *dict.TypeDeleteRes, err error) {
|
||||
err = service.SysDictType().Delete(ctx, &req.DictTypeDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDictType) Edit(ctx context.Context, req *dict.TypeEditReq) (res *dict.TypeEditRes, err error) {
|
||||
err = service.SysDictType().Edit(ctx, &req.DictTypeEditInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/emslog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
EmsLog = cEmsLog{}
|
||||
)
|
||||
|
||||
type cEmsLog struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cEmsLog) Delete(ctx context.Context, req *emslog.DeleteReq) (res *emslog.DeleteRes, err error) {
|
||||
err = service.SysEmsLog().Delete(ctx, &req.EmsLogDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cEmsLog) Edit(ctx context.Context, req *emslog.EditReq) (res *emslog.EditRes, err error) {
|
||||
err = service.SysEmsLog().Edit(ctx, &req.EmsLogEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cEmsLog) View(ctx context.Context, req *emslog.ViewReq) (res *emslog.ViewRes, err error) {
|
||||
data, err := service.SysEmsLog().View(ctx, &req.EmsLogViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(emslog.ViewRes)
|
||||
res.EmsLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cEmsLog) List(ctx context.Context, req *emslog.ListReq) (res *emslog.ListRes, err error) {
|
||||
list, totalCount, err := service.SysEmsLog().List(ctx, &req.EmsLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(emslog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cEmsLog) Status(ctx context.Context, req *emslog.StatusReq) (res *emslog.StatusRes, err error) {
|
||||
err = service.SysEmsLog().Status(ctx, &req.EmsLogStatusInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/gencodes"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
GenCodes = cGenCodes{}
|
||||
)
|
||||
|
||||
type cGenCodes struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cGenCodes) Delete(ctx context.Context, req *gencodes.DeleteReq) (res *gencodes.DeleteRes, err error) {
|
||||
err = service.SysGenCodes().Delete(ctx, &req.GenCodesDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cGenCodes) Edit(ctx context.Context, req *gencodes.EditReq) (res *gencodes.EditRes, err error) {
|
||||
data, err := service.SysGenCodes().Edit(ctx, &req.GenCodesEditInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.EditRes)
|
||||
res.GenCodesEditModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cGenCodes) MaxSort(ctx context.Context, req *gencodes.MaxSortReq) (res *gencodes.MaxSortRes, err error) {
|
||||
res = new(gencodes.MaxSortRes)
|
||||
res.GenCodesMaxSortModel, err = service.SysGenCodes().MaxSort(ctx, &req.GenCodesMaxSortInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cGenCodes) View(ctx context.Context, req *gencodes.ViewReq) (res *gencodes.ViewRes, err error) {
|
||||
data, err := service.SysGenCodes().View(ctx, &req.GenCodesViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.ViewRes)
|
||||
res.GenCodesViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cGenCodes) List(ctx context.Context, req *gencodes.ListReq) (res *gencodes.ListRes, err error) {
|
||||
list, totalCount, err := service.SysGenCodes().List(ctx, &req.GenCodesListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cGenCodes) Status(ctx context.Context, req *gencodes.StatusReq) (res *gencodes.StatusRes, err error) {
|
||||
err = service.SysGenCodes().Status(ctx, &req.GenCodesStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Selects 获取指定信息
|
||||
func (c *cGenCodes) Selects(ctx context.Context, req *gencodes.SelectsReq) (res *gencodes.SelectsRes, err error) {
|
||||
data, err := service.SysGenCodes().Selects(ctx, &req.GenCodesSelectsInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.SelectsRes)
|
||||
res.GenCodesSelectsModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// TableSelect 数据库表选项
|
||||
func (c *cGenCodes) TableSelect(ctx context.Context, req *gencodes.TableSelectReq) (res *gencodes.TableSelectRes, err error) {
|
||||
data, err := service.SysGenCodes().TableSelect(ctx, &req.GenCodesTableSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*gencodes.TableSelectRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// ColumnSelect 表字段选项
|
||||
func (c *cGenCodes) ColumnSelect(ctx context.Context, req *gencodes.ColumnSelectReq) (res *gencodes.ColumnSelectRes, err error) {
|
||||
data, err := service.SysGenCodes().ColumnSelect(ctx, &req.GenCodesColumnSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*gencodes.ColumnSelectRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// ColumnList 表字段列表
|
||||
func (c *cGenCodes) ColumnList(ctx context.Context, req *gencodes.ColumnListReq) (res *gencodes.ColumnListRes, err error) {
|
||||
data, err := service.SysGenCodes().ColumnList(ctx, &req.GenCodesColumnListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*gencodes.ColumnListRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// Preview 生成预览
|
||||
func (c *cGenCodes) Preview(ctx context.Context, req *gencodes.PreviewReq) (res *gencodes.PreviewRes, err error) {
|
||||
data, err := service.SysGenCodes().Preview(ctx, &req.GenCodesPreviewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.PreviewRes)
|
||||
res.GenCodesPreviewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Build 生成预览
|
||||
func (c *cGenCodes) Build(ctx context.Context, req *gencodes.BuildReq) (res *gencodes.BuildRes, err error) {
|
||||
err = service.SysGenCodes().Build(ctx, &req.GenCodesBuildInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"hotgo/api/admin/log"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Log 日志
|
||||
var Log = sLog{}
|
||||
|
||||
type sLog struct{}
|
||||
|
||||
// Clear 清空日志
|
||||
func (c *sLog) Clear(ctx context.Context, _ *log.ClearReq) (res *log.ClearRes, err error) {
|
||||
err = gerror.New("暂时考虑到安全问题,请到数据库清空")
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出
|
||||
func (c *sLog) Export(ctx context.Context, req *log.ExportReq) (res *log.ExportRes, err error) {
|
||||
err = service.SysLog().Export(ctx, &req.LogListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// List 获取访问日志列表
|
||||
func (c *sLog) List(ctx context.Context, req *log.ListReq) (res *log.ListRes, err error) {
|
||||
list, totalCount, err := service.SysLog().List(ctx, &req.LogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(log.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *sLog) View(ctx context.Context, req *log.ViewReq) (res *log.ViewRes, err error) {
|
||||
res = new(log.ViewRes)
|
||||
res.LogViewModel, err = service.SysLog().View(ctx, &req.LogViewInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *sLog) Delete(ctx context.Context, req *log.DeleteReq) (res *log.DeleteRes, err error) {
|
||||
err = service.SysLog().Delete(ctx, &req.LogDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Package sys
|
||||
// @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
|
||||
// @AutoGenerate Version 2.1.1
|
||||
// @AutoGenerate Date 2023-01-19 16:57:33
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/loginlog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
LoginLog = cLoginLog{}
|
||||
)
|
||||
|
||||
type cLoginLog struct{}
|
||||
|
||||
// List 查看登录日志列表
|
||||
func (c *cLoginLog) List(ctx context.Context, req *loginlog.ListReq) (res *loginlog.ListRes, err error) {
|
||||
list, totalCount, err := service.SysLoginLog().List(ctx, &req.LoginLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(loginlog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出登录日志列表
|
||||
func (c *cLoginLog) Export(ctx context.Context, req *loginlog.ExportReq) (res *loginlog.ExportRes, err error) {
|
||||
err = service.SysLoginLog().Export(ctx, &req.LoginLogListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除登录日志
|
||||
func (c *cLoginLog) Delete(ctx context.Context, req *loginlog.DeleteReq) (res *loginlog.DeleteRes, err error) {
|
||||
err = service.SysLoginLog().Delete(ctx, &req.LoginLogDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.15.7
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/normaltreedemo"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
NormalTreeDemo = cNormalTreeDemo{}
|
||||
)
|
||||
|
||||
type cNormalTreeDemo struct{}
|
||||
|
||||
// List 查看普通树表列表
|
||||
func (c *cNormalTreeDemo) List(ctx context.Context, req *normaltreedemo.ListReq) (res *normaltreedemo.ListRes, err error) {
|
||||
list, totalCount, err := service.SysNormalTreeDemo().List(ctx, &req.NormalTreeDemoListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.NormalTreeDemoListModel{}
|
||||
}
|
||||
|
||||
res = new(normaltreedemo.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新普通树表
|
||||
func (c *cNormalTreeDemo) Edit(ctx context.Context, req *normaltreedemo.EditReq) (res *normaltreedemo.EditRes, err error) {
|
||||
err = service.SysNormalTreeDemo().Edit(ctx, &req.NormalTreeDemoEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 获取普通树表最大排序
|
||||
func (c *cNormalTreeDemo) MaxSort(ctx context.Context, req *normaltreedemo.MaxSortReq) (res *normaltreedemo.MaxSortRes, err error) {
|
||||
data, err := service.SysNormalTreeDemo().MaxSort(ctx, &req.NormalTreeDemoMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(normaltreedemo.MaxSortRes)
|
||||
res.NormalTreeDemoMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定普通树表信息
|
||||
func (c *cNormalTreeDemo) View(ctx context.Context, req *normaltreedemo.ViewReq) (res *normaltreedemo.ViewRes, err error) {
|
||||
data, err := service.SysNormalTreeDemo().View(ctx, &req.NormalTreeDemoViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(normaltreedemo.ViewRes)
|
||||
res.NormalTreeDemoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除普通树表
|
||||
func (c *cNormalTreeDemo) Delete(ctx context.Context, req *normaltreedemo.DeleteReq) (res *normaltreedemo.DeleteRes, err error) {
|
||||
err = service.SysNormalTreeDemo().Delete(ctx, &req.NormalTreeDemoDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// TreeOption 获取普通树表关系树选项
|
||||
func (c *cNormalTreeDemo) TreeOption(ctx context.Context, req *normaltreedemo.TreeOptionReq) (res *normaltreedemo.TreeOptionRes, err error) {
|
||||
data, err := service.SysNormalTreeDemo().TreeOption(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(data) > 0 {
|
||||
res = (*normaltreedemo.TreeOptionRes)(&data)
|
||||
} else {
|
||||
temp := make(normaltreedemo.TreeOptionRes, 0)
|
||||
res = &temp
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2025 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.17.8
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/optiontreedemo"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
OptionTreeDemo = cOptionTreeDemo{}
|
||||
)
|
||||
|
||||
type cOptionTreeDemo struct{}
|
||||
|
||||
// List 查看选项树表列表
|
||||
func (c *cOptionTreeDemo) List(ctx context.Context, req *optiontreedemo.ListReq) (res *optiontreedemo.ListRes, err error) {
|
||||
list, totalCount, err := service.SysOptionTreeDemo().List(ctx, &req.OptionTreeDemoListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.OptionTreeDemoListModel{}
|
||||
}
|
||||
|
||||
res = new(optiontreedemo.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新选项树表
|
||||
func (c *cOptionTreeDemo) Edit(ctx context.Context, req *optiontreedemo.EditReq) (res *optiontreedemo.EditRes, err error) {
|
||||
err = service.SysOptionTreeDemo().Edit(ctx, &req.OptionTreeDemoEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 获取选项树表最大排序
|
||||
func (c *cOptionTreeDemo) MaxSort(ctx context.Context, req *optiontreedemo.MaxSortReq) (res *optiontreedemo.MaxSortRes, err error) {
|
||||
data, err := service.SysOptionTreeDemo().MaxSort(ctx, &req.OptionTreeDemoMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(optiontreedemo.MaxSortRes)
|
||||
res.OptionTreeDemoMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定选项树表信息
|
||||
func (c *cOptionTreeDemo) View(ctx context.Context, req *optiontreedemo.ViewReq) (res *optiontreedemo.ViewRes, err error) {
|
||||
data, err := service.SysOptionTreeDemo().View(ctx, &req.OptionTreeDemoViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(optiontreedemo.ViewRes)
|
||||
res.OptionTreeDemoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除选项树表
|
||||
func (c *cOptionTreeDemo) Delete(ctx context.Context, req *optiontreedemo.DeleteReq) (res *optiontreedemo.DeleteRes, err error) {
|
||||
err = service.SysOptionTreeDemo().Delete(ctx, &req.OptionTreeDemoDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// TreeOption 获取选项树表关系树选项
|
||||
func (c *cOptionTreeDemo) TreeOption(ctx context.Context, req *optiontreedemo.TreeOptionReq) (res *optiontreedemo.TreeOptionRes, err error) {
|
||||
data, err := service.SysOptionTreeDemo().TreeOption(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(data) > 0 {
|
||||
res = (*optiontreedemo.TreeOptionRes)(&data)
|
||||
} else {
|
||||
temp := make(optiontreedemo.TreeOptionRes, 0)
|
||||
res = &temp
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/provinces"
|
||||
"hotgo/internal/library/location"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Provinces = cProvinces{}
|
||||
)
|
||||
|
||||
type cProvinces struct{}
|
||||
|
||||
// Tree 关系树选项列表
|
||||
func (c *cProvinces) Tree(ctx context.Context, _ *provinces.TreeReq) (res *provinces.TreeRes, err error) {
|
||||
res = new(provinces.TreeRes)
|
||||
res.List, err = service.SysProvinces().Tree(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cProvinces) Delete(ctx context.Context, req *provinces.DeleteReq) (res *provinces.DeleteRes, err error) {
|
||||
err = service.SysProvinces().Delete(ctx, &req.ProvincesDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cProvinces) Edit(ctx context.Context, req *provinces.EditReq) (res *provinces.EditRes, err error) {
|
||||
err = service.SysProvinces().Edit(ctx, &req.ProvincesEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cProvinces) MaxSort(ctx context.Context, req *provinces.MaxSortReq) (res *provinces.MaxSortRes, err error) {
|
||||
data, err := service.SysProvinces().MaxSort(ctx, &req.ProvincesMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.MaxSortRes)
|
||||
res.ProvincesMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cProvinces) View(ctx context.Context, req *provinces.ViewReq) (res *provinces.ViewRes, err error) {
|
||||
data, err := service.SysProvinces().View(ctx, &req.ProvincesViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.ViewRes)
|
||||
res.ProvincesViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cProvinces) List(ctx context.Context, req *provinces.ListReq) (res *provinces.ListRes, err error) {
|
||||
list, totalCount, err := service.SysProvinces().List(ctx, &req.ProvincesListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新省市区状态
|
||||
func (c *cProvinces) Status(ctx context.Context, req *provinces.StatusReq) (res *provinces.StatusRes, err error) {
|
||||
err = service.SysProvinces().Status(ctx, &req.ProvincesStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// ChildrenList 获取省市区下级列表
|
||||
func (c *cProvinces) ChildrenList(ctx context.Context, req *provinces.ChildrenListReq) (res *provinces.ChildrenListRes, err error) {
|
||||
list, totalCount, err := service.SysProvinces().ChildrenList(ctx, &req.ProvincesChildrenListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.ChildrenListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// UniqueId 地区ID是否唯一
|
||||
func (c *cProvinces) UniqueId(ctx context.Context, req *provinces.UniqueIdReq) (res *provinces.UniqueIdRes, err error) {
|
||||
data, err := service.SysProvinces().UniqueId(ctx, &req.ProvincesUniqueIdInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.UniqueIdRes)
|
||||
res.ProvincesUniqueIdModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Select 省市区选项
|
||||
func (c *cProvinces) Select(ctx context.Context, req *provinces.SelectReq) (res *provinces.SelectRes, err error) {
|
||||
data, err := service.SysProvinces().Select(ctx, &req.ProvincesSelectInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.SelectRes)
|
||||
res.ProvincesSelectModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// CityLabel 省市区选项
|
||||
func (c *cProvinces) CityLabel(ctx context.Context, req *provinces.CityLabelReq) (res *provinces.CityLabelRes, err error) {
|
||||
cityLabel, err := location.ParseSimpleRegion(ctx, req.Id, req.Spilt)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*provinces.CityLabelRes)(&cityLabel)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// Package sys
|
||||
// @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
|
||||
// @AutoGenerate Version 2.7.6
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/servelicense"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
ServeLicense = cServeLicense{}
|
||||
)
|
||||
|
||||
type cServeLicense struct{}
|
||||
|
||||
// List 查看服务授权许可列表
|
||||
func (c *cServeLicense) List(ctx context.Context, req *servelicense.ListReq) (res *servelicense.ListRes, err error) {
|
||||
list, totalCount, err := service.SysServeLicense().List(ctx, &req.ServeLicenseListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelicense.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出服务授权许可列表
|
||||
func (c *cServeLicense) Export(ctx context.Context, req *servelicense.ExportReq) (res *servelicense.ExportRes, err error) {
|
||||
err = service.SysServeLicense().Export(ctx, &req.ServeLicenseListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新服务授权许可
|
||||
func (c *cServeLicense) Edit(ctx context.Context, req *servelicense.EditReq) (res *servelicense.EditRes, err error) {
|
||||
err = service.SysServeLicense().Edit(ctx, &req.ServeLicenseEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定服务授权许可信息
|
||||
func (c *cServeLicense) View(ctx context.Context, req *servelicense.ViewReq) (res *servelicense.ViewRes, err error) {
|
||||
data, err := service.SysServeLicense().View(ctx, &req.ServeLicenseViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelicense.ViewRes)
|
||||
res.ServeLicenseViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除服务授权许可
|
||||
func (c *cServeLicense) Delete(ctx context.Context, req *servelicense.DeleteReq) (res *servelicense.DeleteRes, err error) {
|
||||
err = service.SysServeLicense().Delete(ctx, &req.ServeLicenseDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新服务授权许可状态
|
||||
func (c *cServeLicense) Status(ctx context.Context, req *servelicense.StatusReq) (res *servelicense.StatusRes, err error) {
|
||||
err = service.SysServeLicense().Status(ctx, &req.ServeLicenseStatusInp)
|
||||
return
|
||||
}
|
||||
|
||||
// AssignRouter 分配服务授权许可路由
|
||||
func (c *cServeLicense) AssignRouter(ctx context.Context, req *servelicense.AssignRouterReq) (res *servelicense.AssignRouterRes, err error) {
|
||||
err = service.SysServeLicense().AssignRouter(ctx, &req.ServeLicenseAssignRouterInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/servelog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
ServeLog = cServeLog{}
|
||||
)
|
||||
|
||||
type cServeLog struct{}
|
||||
|
||||
// List 查看服务日志列表
|
||||
func (c *cServeLog) List(ctx context.Context, req *servelog.ListReq) (res *servelog.ListRes, err error) {
|
||||
list, totalCount, err := service.SysServeLog().List(ctx, &req.ServeLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出服务日志列表
|
||||
func (c *cServeLog) Export(ctx context.Context, req *servelog.ExportReq) (res *servelog.ExportRes, err error) {
|
||||
err = service.SysServeLog().Export(ctx, &req.ServeLogListInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定服务日志信息
|
||||
func (c *cServeLog) View(ctx context.Context, req *servelog.ViewReq) (res *servelog.ViewRes, err error) {
|
||||
data, err := service.SysServeLog().View(ctx, &req.ServeLogViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelog.ViewRes)
|
||||
res.ServeLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除服务日志
|
||||
func (c *cServeLog) Delete(ctx context.Context, req *servelog.DeleteReq) (res *servelog.DeleteRes, err error) {
|
||||
err = service.SysServeLog().Delete(ctx, &req.ServeLogDeleteInp)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/smslog"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
SmsLog = cSmsLog{}
|
||||
)
|
||||
|
||||
type cSmsLog struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cSmsLog) Delete(ctx context.Context, req *smslog.DeleteReq) (res *smslog.DeleteRes, err error) {
|
||||
err = service.SysSmsLog().Delete(ctx, &req.SmsLogDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cSmsLog) View(ctx context.Context, req *smslog.ViewReq) (res *smslog.ViewRes, err error) {
|
||||
data, err := service.SysSmsLog().View(ctx, &req.SmsLogViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(smslog.ViewRes)
|
||||
res.SmsLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cSmsLog) List(ctx context.Context, req *smslog.ListReq) (res *smslog.ListRes, err error) {
|
||||
list, totalCount, err := service.SysSmsLog().List(ctx, &req.SmsLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(smslog.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
// @AutoGenerate Version 2.15.7
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/testcategory"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
TestCategory = cTestCategory{}
|
||||
)
|
||||
|
||||
type cTestCategory struct{}
|
||||
|
||||
// List 查看测试分类列表
|
||||
func (c *cTestCategory) List(ctx context.Context, req *testcategory.ListReq) (res *testcategory.ListRes, err error) {
|
||||
list, totalCount, err := service.SysTestCategory().List(ctx, &req.TestCategoryListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.TestCategoryListModel{}
|
||||
}
|
||||
|
||||
res = new(testcategory.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新测试分类
|
||||
func (c *cTestCategory) Edit(ctx context.Context, req *testcategory.EditReq) (res *testcategory.EditRes, err error) {
|
||||
err = service.SysTestCategory().Edit(ctx, &req.TestCategoryEditInp)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 获取测试分类最大排序
|
||||
func (c *cTestCategory) MaxSort(ctx context.Context, req *testcategory.MaxSortReq) (res *testcategory.MaxSortRes, err error) {
|
||||
data, err := service.SysTestCategory().MaxSort(ctx, &req.TestCategoryMaxSortInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(testcategory.MaxSortRes)
|
||||
res.TestCategoryMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定测试分类信息
|
||||
func (c *cTestCategory) View(ctx context.Context, req *testcategory.ViewReq) (res *testcategory.ViewRes, err error) {
|
||||
data, err := service.SysTestCategory().View(ctx, &req.TestCategoryViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(testcategory.ViewRes)
|
||||
res.TestCategoryViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除测试分类
|
||||
func (c *cTestCategory) Delete(ctx context.Context, req *testcategory.DeleteReq) (res *testcategory.DeleteRes, err error) {
|
||||
err = service.SysTestCategory().Delete(ctx, &req.TestCategoryDeleteInp)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新测试分类状态
|
||||
func (c *cTestCategory) Status(ctx context.Context, req *testcategory.StatusReq) (res *testcategory.StatusRes, err error) {
|
||||
err = service.SysTestCategory().Status(ctx, &req.TestCategoryStatusInp)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user