|
@@ -490,7 +490,8 @@ func (c *TaskController) Logs_List() {
|
|
|
func (c *TaskController) DeviceData_JPGState() {
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
- jpg, is := Device.Redis_DeviceDataJPG_Get(T_task_id)
|
|
|
+ T_remark := c.GetString("T_remark")
|
|
|
+ jpg, is := Device.Redis_DeviceDataJPG_Get(T_task_id + T_remark)
|
|
|
if !is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "暂无图片正在生成"}
|
|
|
c.ServeJSON()
|
|
@@ -521,6 +522,7 @@ func (c *TaskController) DeviceData_JPG() {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ T_remark := c.GetString("T_remark")
|
|
|
|
|
|
TemperatureMin, _ := c.GetFloat("TemperatureMin") // 最低温度
|
|
|
TemperatureMax, _ := c.GetFloat("TemperatureMax") // 最高温度
|
|
@@ -544,17 +546,17 @@ func (c *TaskController) DeviceData_JPG() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- deviceClassList, _ := Device.Read_DeviceClassList_OrderList(Task_r.T_class, "", 0, 9999)
|
|
|
+ deviceClassList, _ := Device.Read_DeviceClassList_OrderList(Task_r.T_class, "", T_remark, 0, 9999)
|
|
|
if !is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_class 错误!"}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- Device.Redis_DeviceDataJPG_Del(T_task_id)
|
|
|
+ Device.Redis_DeviceDataJPG_Del(T_task_id + T_remark)
|
|
|
|
|
|
// 生成图片
|
|
|
- go DeviceDataJPG(StartTime, EndTime, T_task_id, deviceClassList, TemperatureMin, TemperatureMax)
|
|
|
+ go DeviceDataJPG(StartTime, EndTime, T_task_id, T_remark, deviceClassList, TemperatureMin, TemperatureMax)
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
@@ -562,8 +564,8 @@ func (c *TaskController) DeviceData_JPG() {
|
|
|
}
|
|
|
|
|
|
// 存档生成图片
|
|
|
-func DeviceDataJPG(StartTime, EndTime, T_task_id string, deviceList []Device.DeviceClassList, TemperatureMin, TemperatureMax float64) {
|
|
|
- Device.Redis_DeviceDataJPG_Set(T_task_id, Device.DeviceDataJPG{
|
|
|
+func DeviceDataJPG(StartTime, EndTime, T_task_id, T_remark string, deviceList []Device.DeviceClassList, TemperatureMin, TemperatureMax float64) {
|
|
|
+ Device.Redis_DeviceDataJPG_Set(T_task_id+T_remark, Device.DeviceDataJPG{
|
|
|
State: 1,
|
|
|
Msg: "图片生成中",
|
|
|
Url: "",
|
|
@@ -676,7 +678,7 @@ func DeviceDataJPG(StartTime, EndTime, T_task_id string, deviceList []Device.Dev
|
|
|
filename := "jpg" + time.Now().Format("20060102150405")
|
|
|
// 保存文件
|
|
|
if err := p.Save(10*vg.Inch, 4*vg.Inch, "ofile/"+filename+".jpg"); err != nil {
|
|
|
- Device.Redis_DeviceDataJPG_Set(T_task_id, Device.DeviceDataJPG{
|
|
|
+ Device.Redis_DeviceDataJPG_Set(T_task_id+T_remark, Device.DeviceDataJPG{
|
|
|
State: 3,
|
|
|
Msg: "图片生成失败",
|
|
|
Url: url,
|
|
@@ -685,7 +687,7 @@ func DeviceDataJPG(StartTime, EndTime, T_task_id string, deviceList []Device.Dev
|
|
|
return
|
|
|
}
|
|
|
if !lib.Pload_qiniu("ofile/"+filename+".jpg", "ofile/"+filename+".jpg") {
|
|
|
- Device.Redis_DeviceDataJPG_Set(T_task_id, Device.DeviceDataJPG{
|
|
|
+ Device.Redis_DeviceDataJPG_Set(T_task_id+T_remark, Device.DeviceDataJPG{
|
|
|
State: 3,
|
|
|
Msg: "图片上传七牛云失败",
|
|
|
Url: url,
|
|
@@ -699,7 +701,7 @@ func DeviceDataJPG(StartTime, EndTime, T_task_id string, deviceList []Device.Dev
|
|
|
msg = "图片生成成功"
|
|
|
url = "https://bzdcoldverifyoss.baozhida.cn/" + "ofile/" + filename + ".jpg"
|
|
|
|
|
|
- Device.Redis_DeviceDataJPG_Set(T_task_id, Device.DeviceDataJPG{
|
|
|
+ Device.Redis_DeviceDataJPG_Set(T_task_id+T_remark, Device.DeviceDataJPG{
|
|
|
State: state,
|
|
|
Msg: msg,
|
|
|
Url: url,
|