|
@@ -312,6 +312,8 @@ func (c *DeviceController) DeviceWarning_Data_Excel() {
|
|
|
Time_start := c.GetString("Time_start")
|
|
|
Time_end := c.GetString("Time_end")
|
|
|
T_handle, _ := c.GetInt("T_handle")
|
|
|
+
|
|
|
+ T_admin, _ := c.GetInt("T_admin")
|
|
|
T_history, _ := c.GetInt("T_history")
|
|
|
tpCount := Warning.Read_WarningType_Count()
|
|
|
var tpList []string
|
|
@@ -323,10 +325,19 @@ func (c *DeviceController) DeviceWarning_Data_Excel() {
|
|
|
}
|
|
|
} else {
|
|
|
power, _ := Account.Read_Power_ById(c.Admin_r.T_power)
|
|
|
- tpList = lib.SplitStringIds(power.T_warning, "W")
|
|
|
+ if power.T_warning != "*" {
|
|
|
+ tpList = lib.SplitStringIds(power.T_warning, "W")
|
|
|
+ }
|
|
|
}
|
|
|
countRedisKey := fmt.Sprintf("Warning_Count_%d_%s_%s_%s_%s_%d_%d_%d", c.T_pid, T_name, T_tp, Time_start, Time_end, T_handle, 0, T_history)
|
|
|
|
|
|
+ bindSN, err := Account.Read_UserDevice_List(*c.Admin_r)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "查询失败!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
var T_year, T_month string
|
|
|
if T_history == 1 {
|
|
|
date, err := time.Parse("2006-01-02 15:04:05", Time_start)
|
|
@@ -338,14 +349,17 @@ func (c *DeviceController) DeviceWarning_Data_Excel() {
|
|
|
T_year, T_month = date.Format("2006"), date.Format("01")
|
|
|
}
|
|
|
|
|
|
- bindSN, err := Account.Read_UserDevice_List(*c.Admin_r)
|
|
|
- if err != nil {
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "查询失败!"}
|
|
|
- c.ServeJSON()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
var Device_data []Warning.Warning_R
|
|
|
+ // 管理员界面
|
|
|
+ if T_admin == 1 {
|
|
|
+ if T_history == 1 {
|
|
|
+ // 获取备份
|
|
|
+ Device_data, _ = Warning.Read_Admin_Warning_Backups(*c.Admin_r, T_year, T_month, tpList, T_name, T_handle, Time_start, Time_end, 0, 9999, countRedisKey)
|
|
|
+ } else {
|
|
|
+ // 获取最新
|
|
|
+ Device_data, _ = Warning.Read_Admin_Warning_List(*c.Admin_r, tpList, T_name, T_handle, Time_start, Time_end, 0, 9999, countRedisKey)
|
|
|
+ }
|
|
|
+ }
|
|
|
if T_history == 1 {
|
|
|
// 获取备份
|
|
|
Device_data, _ = Warning.Read_Warning_Backups(c.T_pid, bindSN, T_year, T_month, tpList, T_name, T_handle, Time_start, Time_end, 0, 9999, countRedisKey)
|