代码规范过滤,移除冗余代码,替换掉不推荐的包

This commit is contained in:
孟帅
2023-05-30 12:09:40 +08:00
parent c8a808fcfd
commit b2ef3487d3
74 changed files with 564 additions and 741 deletions

View File

@@ -61,7 +61,7 @@ func (c *cMonitor) OnlineList(ctx context.Context, req *monitor.OnlineListReq) (
return
}
for conn, _ := range c.wsManager.GetClients() {
for conn := range c.wsManager.GetClients() {
if conn.SendClose || conn.User == nil {
continue
}

View File

@@ -143,11 +143,11 @@ func (c *cNotice) Letter(ctx context.Context, req *notice.EditLetterReq) (res *n
func (c *cNotice) UpRead(ctx context.Context, req *notice.UpReadReq) (res *notice.UpReadRes, err error) {
var in adminin.NoticeUpReadInp
if err = gconv.Scan(req, &in); err != nil {
return nil, err
return
}
err = service.AdminNotice().UpRead(ctx, in)
return res, nil
return
}
// PullMessages 拉取未读消息列表

View File

@@ -44,7 +44,7 @@ func (c *cCronGroup) Edit(ctx context.Context, req *cron.GroupEditReq) (res *cro
}
err = service.SysCronGroup().Edit(ctx, in)
return res, nil
return
}
// MaxSort 最大排序
@@ -103,7 +103,7 @@ func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res
}
err = service.SysCronGroup().Status(ctx, in)
return res, nil
return
}
// Select 选项

View File

@@ -49,7 +49,6 @@ type MonitorHead struct {
// RunInfo 运行信息
func (c *cMonitor) RunInfo(client *websocket.Client, req *websocket.WRequest) {
var (
data = g.Map{}
meta = service.AdminMonitor().GetMeta(client.Context())
mHost, _ = host.Info()
pwd, _ = os.Getwd()
@@ -58,7 +57,7 @@ func (c *cMonitor) RunInfo(client *websocket.Client, req *websocket.WRequest) {
runtime.ReadMemStats(&gm)
data = g.Map{
data := g.Map{
// 服务器信息
"hostname": mHost.Hostname,
"os": mHost.OS,
@@ -107,7 +106,6 @@ func (c *cMonitor) Trends(client *websocket.Client, req *websocket.WRequest) {
mDisk, diskErr = disk.Usage("/")
mProcess, ProcessErr = process.Pids()
mLoadAvg = new(model.LoadAvgStats)
data = g.Map{}
monitorHeads []MonitorHead
nets []NetC
meta = service.AdminMonitor().GetMeta(client.Context())
@@ -193,11 +191,9 @@ func (c *cMonitor) Trends(client *websocket.Client, req *websocket.WRequest) {
})
}
data = g.Map{
websocket.SendSuccess(client, req.Event, g.Map{
"head": monitorHeads,
"load": meta.LoadAvg,
"net": nets,
}
websocket.SendSuccess(client, req.Event, data)
})
}