|
@@ -10,7 +10,6 @@ import (
|
|
|
"ColdP_server/models/Warning"
|
|
"ColdP_server/models/Warning"
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
- beego "github.com/beego/beego/v2/server/web"
|
|
|
|
|
"io"
|
|
"io"
|
|
|
"log"
|
|
"log"
|
|
|
"math"
|
|
"math"
|
|
@@ -18,6 +17,8 @@ import (
|
|
|
"strings"
|
|
"strings"
|
|
|
"sync"
|
|
"sync"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
+
|
|
|
|
|
+ beego "github.com/beego/beego/v2/server/web"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
// DeviceController 设备管理页面
|
|
// DeviceController 设备管理页面
|
|
@@ -253,7 +254,9 @@ func (c *DeviceController) ReadDeviation() {
|
|
|
|
|
|
|
|
// WriteDeviation 设置偏差值
|
|
// WriteDeviation 设置偏差值
|
|
|
func (c *DeviceController) WriteDeviation() {
|
|
func (c *DeviceController) WriteDeviation() {
|
|
|
- b_, _ := lib.Verification(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
|
|
|
+ b_, admin_r := lib.Verification(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
|
|
+ // 账号(T_name) 和 用户ID(T_id)。
|
|
|
|
|
+ logs.Println("WriteDeviation1 日志 - 账号: %s, 用户ID: %v", admin_r.T_name, admin_r.Id)
|
|
|
if !b_ {
|
|
if !b_ {
|
|
|
c.Data["json"] = lib.JSONS{Code: 201, Msg: "User_tokey Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 201, Msg: "User_tokey Err!"}
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -282,6 +285,8 @@ func (c *DeviceController) WriteDeviation() {
|
|
|
}
|
|
}
|
|
|
// 处理每个设备的数据
|
|
// 处理每个设备的数据
|
|
|
for _, v := range data {
|
|
for _, v := range data {
|
|
|
|
|
+ // 输出 账号 和 目标设备 SN
|
|
|
|
|
+ logs.Println("WriteDeviation2 日志 - 账号: %s,用户ID: %v 目标设备SN: %s", admin_r.T_name, admin_r.Id, v.Sn)
|
|
|
wg.Add(1)
|
|
wg.Add(1)
|
|
|
go func(v MqttServer.Deviation_Sub) {
|
|
go func(v MqttServer.Deviation_Sub) {
|
|
|
defer wg.Done()
|
|
defer wg.Done()
|