| 
					
				 | 
			
			
				@@ -12,7 +12,6 @@ import ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	beego "github.com/beego/beego/v2/server/web" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"github.com/xuri/excelize/v2" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"math" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	"os" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"strconv" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"strings" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"time" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -36,15 +35,17 @@ func (c *DeviceController) Device_html() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["Admin_Power"], _ = Admin.Read_AdminPower_ById(admin_r.Admin_power) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 模板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	type R_Device struct { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sn          string                // 设备序列号 KF开头,环境监测主机。 YD开头,温途监测主机 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_devName     string                //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sensor      int                   //  传感器数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_monitor      int                   //  监控状态 1 监控  0 未监控 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sn_yd      int                   //  湿度显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_give      int                      // 0 丢弃  1 正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sensor_list []Device.DeviceSensor //  传感器List 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_MSISDN     string                //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		UpdateTime time.Time //auto_now 每次 model 保存时都会对时间自动更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sn          string                  // 设备序列号 KF开头,环境监测主机。 YD开头,温途监测主机 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_devName     string                  //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sensor      int                     //  传感器数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_monitor     int                     //  监控状态 1 监控  0 未监控 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sn_yd       int                     //  湿度显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_give        int                     // 0 丢弃  1 正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_online      int                     //  在线状态 1 在线  0 离线 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_Dattery     int                     //电量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sensor_list []Device.DeviceSensor_R //  传感器List 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_MSISDN      string                  //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		UpdateTime    time.Time               //auto_now 每次 model 保存时都会对时间自动更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var Device_lite_r []R_Device 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -65,25 +66,25 @@ func (c *DeviceController) Device_html() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["T_sn"] = T_sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var cnt int64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device_lite, cnt := Device.Read_Device_ALL_bind_1(admin_r, page,0, T_sn, Name, Class_1,"") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device_lite, cnt := Device.Read_Device_ALL_bind_1(admin_r, page, 0, T_sn, Name, Class_1, "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	for _, v := range Device_lite { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device := R_Device{} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//  湿度显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if admin_r.Admin_rh == 0{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if admin_r.Admin_rh == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			r_Device.T_sn_yd = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			if strings.Contains(v.T_sn, "YD"){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if strings.Contains(v.T_sn, "YD") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				r_Device.T_sn_yd = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_sn = v.T_sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_MSISDN = v.T_MSISDN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_devName = v.T_devName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_give = v.T_give 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		r_Device.T_online = v.T_online 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		r_Device.T_monitor = v.T_monitor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		r_Device.T_Dattery = v.T_Dattery 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_sensor_list, r_Device.T_sensor = Device.Read_DeviceSensor_ByTsn(v.T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -150,9 +151,9 @@ func (c *DeviceController) Device_Parameter_html() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Sn := c.GetString("Sn") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	DeviceParameter_lite := Device.Read_DeviceParameter_SN(Sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if len(DeviceParameter_lite) > 0{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if len(DeviceParameter_lite) > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["DeviceParameter"] = DeviceParameter_lite[0] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	}else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Nats.Read_DeviceParameter(Sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["DeviceParameter_lite_z"] = len(DeviceParameter_lite) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -183,15 +184,14 @@ func (c *DeviceController) DeviceSensor_List_html() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	DeviceSensorParameter_list := Device.Read_DeviceSensorParameter_SN_T_id(Sn, Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["DeviceSensorParameter_lite"] = DeviceSensorParameter_list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["DeviceSensorParameter_T_SendState_0"] = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if (len(DeviceSensorParameter_list) > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if DeviceSensorParameter_list[0].T_SendState == 0{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if len(DeviceSensorParameter_list) > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if DeviceSensorParameter_list[0].T_SendState == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			c.Data["DeviceSensorParameter_T_SendState_0"] = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["Device"], _ = Device.Read_Device_ByT_sn(Sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.TplName = "Device/Device_Sensor-.html" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (c *DeviceController) Device_Parameter_Del_Device() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -206,17 +206,15 @@ func (c *DeviceController) Device_Parameter_Del_Device() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Sn := c.GetString("Sn") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Id, _ := c.GetInt("Id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs_T(admin_r.Admin_uuid,"设备管理", "传感器 删除操作", "SN:"+Sn+" ["+strconv.Itoa(Id)+"]") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs_T(admin_r.Admin_uuid, "设备管理", "传感器 删除操作", "SN:"+Sn+" ["+strconv.Itoa(Id)+"]") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//c.Data["Device_lite"] = Device.Read_DeviceParameter_SN(Sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.Delete_DeviceSensor_ById(Sn, Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Nats.Del_DeviceSensor(Device.DeviceSensor_Del{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sn:Sn,T_id:Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sn: Sn, T_id: Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "OK"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -233,13 +231,11 @@ func (c *DeviceController) Device_Parameter_Del() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Sn := c.GetString("Sn") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Id, _ := c.GetInt("Id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs_T(admin_r.Admin_uuid,"设备管理", "传感器 删除操作", "SN:"+Sn+" ["+strconv.Itoa(Id)+"]") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs_T(admin_r.Admin_uuid, "设备管理", "传感器 删除操作", "SN:"+Sn+" ["+strconv.Itoa(Id)+"]") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//c.Data["Device_lite"] = Device.Read_DeviceParameter_SN(Sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.Delete_DeviceSensor_ById(Sn, Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "OK"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -258,8 +254,7 @@ func (c *DeviceController) UpDeviceSensor_Tsort() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Id, _ := c.GetInt("Id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_sort, _ := c.GetInt("T_sort") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	DeviceSensor,is := Device.Read_DeviceSensor_ByT_sn(Sn, Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	DeviceSensor, is := Device.Read_DeviceSensor_ByT_sn(Sn, Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if !is { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 201, Msg: "信息错误!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -269,7 +264,7 @@ func (c *DeviceController) UpDeviceSensor_Tsort() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//c.Data["Device_lite"] = Device.Read_DeviceParameter_SN(Sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.Update_DeviceSensor(DeviceSensor, "T_sort") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs_T(admin_r.Admin_uuid,"设备管理", "传感器 排序操作", "SN:"+Sn+" ["+strconv.Itoa(Id)+"]"+strconv.Itoa(T_sort)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs_T(admin_r.Admin_uuid, "设备管理", "传感器 排序操作", "SN:"+Sn+" ["+strconv.Itoa(Id)+"]"+strconv.Itoa(T_sort)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "OK"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -287,8 +282,7 @@ func (c *DeviceController) UpDeviceSensor_T_datashow() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Id, _ := c.GetInt("Id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_datashow, _ := c.GetInt("T_datashow") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	DeviceSensor,is := Device.Read_DeviceSensor_ByT_sn(Sn, Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	DeviceSensor, is := Device.Read_DeviceSensor_ByT_sn(Sn, Id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if !is { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 201, Msg: "信息错误!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -298,7 +292,7 @@ func (c *DeviceController) UpDeviceSensor_T_datashow() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.Update_DeviceSensor(DeviceSensor, "T_datashow") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs_T(admin_r.Admin_uuid,"设备管理", "传感器 数据展示(0 屏蔽数据展示  1 正常数据展示)", "SN:"+Sn+" ["+strconv.Itoa(Id)+"]"+strconv.Itoa(T_datashow)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs_T(admin_r.Admin_uuid, "设备管理", "传感器 数据展示(0 屏蔽数据展示  1 正常数据展示)", "SN:"+Sn+" ["+strconv.Itoa(Id)+"]"+strconv.Itoa(T_datashow)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "OK"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -311,27 +305,27 @@ func (c *DeviceController) Device_Post() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var err error 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_sn := c.GetString("T_sn") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_MSISDN := c.GetString("T_MSISDN") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var_ := Device.Device{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sn:    T_sn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_MSISDN:    T_MSISDN, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_Bind:  "U" + strconv.Itoa(admin_r.Id) + "|", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_l_p:   0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_give:   1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_State: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if len(T_sn) < 8{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sn:      T_sn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_MSISDN:  T_MSISDN, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_Bind:    "U" + strconv.Itoa(admin_r.Id) + "|", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_l_p:     0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_give:    1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_monitor: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_State:   1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if len(T_sn) < 8 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 303, Msg: "SN 太短 必须8个字符以上"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if !(strings.Contains(T_sn, "KF") || strings.Contains(T_sn, "YD")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if !(strings.Contains(T_sn, "KF") || strings.Contains(T_sn, "YD")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 303, Msg: "必须包含 KF或YD!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -358,7 +352,7 @@ func (c *DeviceController) Device_Post() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs_T(admin_r.Admin_uuid,"设备管理", "设备添加", var_) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs_T(admin_r.Admin_uuid, "设备管理", "设备添加", var_) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//MqttServer.Get_Device_Realtime(T_sn)  // 更新传感器 !!! 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -376,7 +370,7 @@ func (c *DeviceController) Device_Del() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if admin_r.Admin_master != 1{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if admin_r.Admin_master != 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 201, Msg: "没有权限!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -385,16 +379,16 @@ func (c *DeviceController) Device_Del() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_sn := c.GetString("T_sn") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device_r,err := Device.Read_Device_ByT_sn(T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if err != nil{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device_r, err := Device.Read_Device_ByT_sn(T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if err != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 201, Msg: "T_sn Err!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.Delete_Device(Device_r) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	DeviceSensor_list,_ := Device.Read_DeviceSensor_ByTsn(Device_r.T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	for _,v := range DeviceSensor_list{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	DeviceSensor_list, _ := Device.Read_DeviceSensor_ByTsn(Device_r.T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	for _, v := range DeviceSensor_list { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Device.Delete_DeviceSensor_ById(Device_r.T_sn, v.T_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.DELETE_DeviceSensor(Device_r.T_sn) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -402,12 +396,13 @@ func (c *DeviceController) Device_Del() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.DELETE_DeviceParameter(Device_r.T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.DELETE_DeviceSensorParameter(Device_r.T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "设备删除", T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "设备删除", T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 设备弃用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (c *DeviceController) Device_Give() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 验证登录 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -417,7 +412,7 @@ func (c *DeviceController) Device_Give() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if admin_r.Admin_master != 1{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if admin_r.Admin_master != 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 201, Msg: "没有权限!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -426,20 +421,20 @@ func (c *DeviceController) Device_Give() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_sn := c.GetString("T_sn") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device_r,err := Device.Read_Device_ByT_sn(T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if err != nil{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device_r, err := Device.Read_Device_ByT_sn(T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if err != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 201, Msg: "T_sn Err!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if Device_r.T_give == 0{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if Device_r.T_give == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Device_r.T_give = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "设备开启", T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	}else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "设备开启", T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Device_r.T_give = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "设备弃用", T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "设备弃用", T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device.Update_Device(Device_r,"T_give") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device.Update_Device(Device_r, "T_give") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -459,12 +454,12 @@ func (c *DeviceController) Device_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 模板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	type R_Device struct { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sn          string                // 设备序列号 KF开头,环境监测主机。 YD开头,温途监测主机 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_devName     string                //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sensor      int                   //  传感器数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_monitor      int                   //  监控状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_give      int                  // 0 丢弃  1 正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sensor_list []Device.DeviceSensor //  传感器List 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sn          string                  // 设备序列号 KF开头,环境监测主机。 YD开头,温途监测主机 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_devName     string                  //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sensor      int                     //  传感器数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_monitor     int                     //  监控状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_give        int                     // 0 丢弃  1 正常 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sensor_list []Device.DeviceSensor_R //  传感器List 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		UpdateTime time.Time //auto_now 每次 model 保存时都会对时间自动更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -503,7 +498,7 @@ func (c *DeviceController) Device_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var cnt int64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device_lite, cnt := Device.Read_Device_ALL_bind_1(admin_r, page,0, T_sn, Name, Class_1,"") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device_lite, cnt := Device.Read_Device_ALL_bind_1(admin_r, page, 0, T_sn, Name, Class_1, "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	for _, v := range Device_lite { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device := R_Device{} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -511,6 +506,7 @@ func (c *DeviceController) Device_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_devName = v.T_devName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_sensor_list, r_Device.T_sensor = Device.Read_DeviceSensor_ByTsn(v.T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_give = v.T_give 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		r_Device.T_monitor = v.T_monitor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//监控状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//r_Device.T_monitor = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//if(strings.Contains(r_Device.T_sn, "YD")){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -693,12 +689,12 @@ func (c *DeviceController) Pu_DeviceParameter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_tempPre, _ := c.GetFloat("T_tempPre") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_humPre, _ := c.GetFloat("T_humPre") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_enwarning, _ := c.GetInt("T_enwarning") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_decTotal,_ := c.GetInt("T_decTotal") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_decTotal, _ := c.GetInt("T_decTotal") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_chDecTotal := c.GetString("T_chDecTotal") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_company := c.GetString("T_company") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_btname := c.GetString("T_btname") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_btserverID,_ := c.GetInt("T_btserverID") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_btchar,_ := c.GetInt("T_btchar") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_btserverID, _ := c.GetInt("T_btserverID") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_btchar, _ := c.GetInt("T_btchar") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device_r, err := Device.Read_Device_ByT_sn(T_SN) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if err != nil { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -707,7 +703,6 @@ func (c *DeviceController) Pu_DeviceParameter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Admin_Power_, _ := Admin.Read_AdminPower_ById(admin_r.Admin_power) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if Admin_Power_.Power_DeviceSensor_Compensate_e == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 202, Msg: "! U" + strconv.Itoa(admin_r.Id)} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -734,22 +729,22 @@ func (c *DeviceController) Pu_DeviceParameter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		T_chDecTotal:   T_chDecTotal, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		T_decTotal:     strconv.Itoa(T_decTotal), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		T_enwarning:    T_enwarning, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_company:    T_company, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_btname:    T_btname, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_btserverID:    strconv.Itoa(T_btserverID), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_btchar:    strconv.Itoa(T_btchar), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_company:      T_company, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_btname:       T_btname, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_btserverID:   strconv.Itoa(T_btserverID), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_btchar:       strconv.Itoa(T_btchar), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Deviceparameter,is :=Device.Add_DeviceParameter(Deviceparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Deviceparameter, is := Device.Add_DeviceParameter(Deviceparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if !is { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		c.Data["json"] = lib.JSONS{Code: 203, Msg: "Add_DeviceParameter ERR" } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		c.Data["json"] = lib.JSONS{Code: 203, Msg: "Add_DeviceParameter ERR"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs_T(admin_r.Admin_uuid,"设备管理", "设备参数操作", Deviceparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs_T(admin_r.Admin_uuid, "设备管理", "设备参数操作", Deviceparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Nats.Pu_DeviceParameter(Deviceparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device_r.T_devName = Deviceparameter.T_devName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device.Update_Device(Device_r,"T_devName") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device.Update_Device(Device_r, "T_devName") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -781,7 +776,7 @@ func (c *DeviceController) Pu_DeviceParameter_T_l_p() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device_r.T_l_p = T_l_p 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.Update_Device(Device_r, "T_l_p") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.DeviceSensor_T_l_p_ALL(T_SN, T_l_p) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "设备参数操作", "类型选择(1物流端   2药店端):"+string(T_l_p)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "设备参数操作", "类型选择(1物流端   2药店端):"+string(T_l_p)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 222, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -813,9 +808,9 @@ func (c *DeviceController) Pu_DeviceParameter_T_give() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device_r.T_give = T_give 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.Update_Device(Device_r, "T_give") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.DeviceSensor_t_give_ALL(T_SN, T_give) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "设备丢弃参数操作", "设备丢弃( 0 丢弃  1 正常):"+string(T_give)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "设备丢弃参数操作", "设备丢弃( 0 丢弃  1 正常):"+string(T_give)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	c.Data["json"] = lib.JSONS{Code: 222, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -885,14 +880,13 @@ func (c *DeviceController) Pu_DeviceParameter_Sensor() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_SN := c.GetString("T_SN") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_name := c.GetString("T_name") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_id,_ := c.GetInt("T_id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_Tlower,_ := c.GetFloat("T_Tlower") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_Tupper,_ := c.GetFloat("T_Tupper") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_RHlower,_ := c.GetFloat("T_RHlower") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_RHupper,_ := c.GetFloat("T_RHupper") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_en,_ := c.GetInt("T_en") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	T_free,_ := c.GetInt("T_free") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_id, _ := c.GetInt("T_id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_Tlower, _ := c.GetFloat("T_Tlower") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_Tupper, _ := c.GetFloat("T_Tupper") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_RHlower, _ := c.GetFloat("T_RHlower") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_RHupper, _ := c.GetFloat("T_RHupper") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_en, _ := c.GetInt("T_en") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_free, _ := c.GetInt("T_free") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 权限 过滤 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Admin_Power_, _ := Admin.Read_AdminPower_ById(admin_r.Admin_power) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -909,7 +903,7 @@ func (c *DeviceController) Pu_DeviceParameter_Sensor() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	DeviceSensor, is := Device.Read_DeviceSensor_ByT_sn(T_SN,T_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	DeviceSensor, is := Device.Read_DeviceSensor_ByT_sn(T_SN, T_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if !is { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 208, Msg: "T_sn T_id Err!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -931,7 +925,7 @@ func (c *DeviceController) Pu_DeviceParameter_Sensor() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		T_SendState: 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		T_State:     2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	dsp_id,is := Device.Add_DeviceSensorParameter(Devicesensorparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	dsp_id, is := Device.Add_DeviceSensorParameter(Devicesensorparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if !is { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 209, Msg: "添加失败!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -941,18 +935,18 @@ func (c *DeviceController) Pu_DeviceParameter_Sensor() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 更新名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	DeviceSensor.T_name = T_name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device.Update_DeviceSensor(DeviceSensor,"T_name") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device.Update_DeviceSensor(DeviceSensor, "T_name") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs_T(admin_r.Admin_uuid,"设备管理", "传感器参数操作", Devicesensorparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs_T(admin_r.Admin_uuid, "设备管理", "传感器参数操作", Devicesensorparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Nats.Pu_DeviceParameter_Sensor(Devicesensorparameter) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //func (c *DeviceController) Pu_DeviceParameter_Sensor_Cache() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //	// 验证登录 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1028,7 +1022,6 @@ func (c *DeviceController) DeviceWarning_List_html() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Time_start := c.GetString("Time_start") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Time_end := c.GetString("Time_end") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if len(Time_start) == 0 && len(Time_end) == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Time_start = time.Now().Format("2006-01-02") + " 00:00:00" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Time_end = time.Now().Format("2006-01-02") + " 23:59:59" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1044,14 +1037,14 @@ func (c *DeviceController) DeviceWarning_List_html() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var cnt int64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	DeviceWarning_List, cnt := Device.Read_DeviceWarning_1(admin_r, page,"", T_Name, Time_start, Time_end) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	DeviceWarning_List, cnt := Device.Read_DeviceWarning_1(admin_r, page, "", T_Name, Time_start, Time_end) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	for i, v := range DeviceWarning_List { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		DeviceWarning_List[i].T_State = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if strings.Contains(v.T_sn, "YD"){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			DeviceWarning_List[i].T_State = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//for i, v := range DeviceWarning_List { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//	DeviceWarning_List[i].T_State = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//	if strings.Contains(v.T_sn, "YD") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//		DeviceWarning_List[i].T_State = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["List"] = DeviceWarning_List 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	page_size := math.Ceil(float64(cnt) / float64(conf.Page_size)) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1075,12 +1068,12 @@ func (c *DeviceController) DeviceWarning_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	type R_JSONS struct { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//必须的大写开头 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		DeviceWarning      []Device.DeviceWarning 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		DeviceWarningclass []Device.DeviceWarningList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		Num                int 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		Page               int 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		Page_size          int 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		Pages              []lib.Page_T 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		DeviceWarning []Device.DeviceWarning 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//DeviceWarningclass []Device.DeviceWarningList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Num       int 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Page      int 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Page_size int 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Pages     []lib.Page_T 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var r_jsons R_JSONS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	page, _ := c.GetInt("page") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1096,14 +1089,14 @@ func (c *DeviceController) DeviceWarning_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Time_start := c.GetString("Time_start") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Time_end := c.GetString("Time_end") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	r_jsons.DeviceWarningclass = Device.Read_DeviceWarningList_All_1() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//r_jsons.DeviceWarningclass = Device.Read_DeviceWarningList_All_1() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//T_Title := "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//if Class_1 > 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//	T_Title = Device.Read_DeviceWarningList_ById(Class_1).T_name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var cnt int64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	r_jsons.DeviceWarning, cnt = Device.Read_DeviceWarning_1(admin_r, page,T_sn, T_Name, Time_start, Time_end) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	r_jsons.DeviceWarning, cnt = Device.Read_DeviceWarning_1(admin_r, page, T_sn, T_Name, Time_start, Time_end) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	page_size := math.Ceil(float64(cnt) / float64(conf.Page_size)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	r_jsons.Page = int(page) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1144,7 +1137,7 @@ func (c *DeviceController) DeviceWarning_Data_Excel() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//	T_Title = Device.Read_DeviceWarningList_ById(Class_1).T_name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device_data, _ := Device.Read_DeviceWarning_1(admin_r, 9999,"", T_Name, Time_start, Time_end) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device_data, _ := Device.Read_DeviceWarning_1(admin_r, 9999, "", T_Name, Time_start, Time_end) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	f := excelize.NewFile() // 设置单元格的值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 这里设置表头 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1193,17 +1186,17 @@ func (c *DeviceController) DeviceWarning_Data_Excel() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		fmt.Println(err) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	url,is := Nats.Qiniu_UploadFile(lib.GetCurrentDirectory()+"ofile/"+timeStr+".xlsx", "ofile/"+timeStr+".xlsx") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	url, is := Nats.Qiniu_UploadFile(lib.GetCurrentDirectory()+"ofile/"+timeStr+".xlsx", "ofile/"+timeStr+".xlsx") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if !is { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.Data["json"] = lib.JSONS{Code: 203, Msg: "oss!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//删除目录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	err := os.Remove("ofile/" + timeStr + ".xlsx") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	if err != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		fmt.Println(err) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//err := os.Remove("ofile/" + timeStr + ".xlsx") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//if err != nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//	fmt.Println(err) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	//} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: url} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1240,7 +1233,7 @@ func (c *DeviceController) DeviceWarning_Post() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.Update_DeviceWarning_ById(t_c) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "报警处理操作", strconv.Itoa(Id)+"->"+T_Text) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "报警处理操作", strconv.Itoa(Id)+"->"+T_Text) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1255,12 +1248,12 @@ func (c *DeviceController) DeviceWarning_Del() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Id, _ := c.GetInt("Id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	t_c := Device.DeviceWarning{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		Id:     Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Id: Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.Update_DeviceWarning_Delete(t_c) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "报警删除操作", strconv.Itoa(Id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "报警删除操作", strconv.Itoa(Id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1342,10 +1335,6 @@ func (c *DeviceController) DeviceBind_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		page_z = conf.Page_size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Class_1 := c.GetString("Class_1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Name := c.GetString("Name") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_sn := c.GetString("T_sn") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1360,7 +1349,7 @@ func (c *DeviceController) DeviceBind_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//c.Data["T_sn"] = T_sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var cnt int64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device_lite, cnt := Device.Read_Device_ALL_bind_1(admin_r, page,page_z, T_sn, Name, Class_1,T_monitor) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device_lite, cnt := Device.Read_Device_ALL_bind_1(admin_r, page, page_z, T_sn, Name, Class_1, T_monitor) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//for i, _ := range Device_lite { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//	//监控状态 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1410,15 +1399,15 @@ func (c *DeviceController) DeviceBind_Sensor_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 模板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	type R_DeviceSensor struct { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sn          string                // 设备序列号 KF开头,环境监测主机。 YD开头,温途监测主机 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_devName     string                //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sensor      int                   //  传感器数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_monitor      int                   //  监控状态 1 监控  0 未监控 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sn_yd      int                   //  湿度显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_battery      int                   // 电量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sensor_list []Device.DeviceSensor //  传感器List 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_MSISDN     string                //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		UpdateTime time.Time //auto_now 每次 model 保存时都会对时间自动更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sn          string                  // 设备序列号 KF开头,环境监测主机。 YD开头,温途监测主机 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_devName     string                  //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sensor      int                     //  传感器数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_monitor     int                     //  监控状态 1 监控  0 未监控 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sn_yd       int                     //  湿度显示 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_battery     int                     // 电量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sensor_list []Device.DeviceSensor_R //  传感器List 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_MSISDN      string                  //设备名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		UpdateTime    time.Time               //auto_now 每次 model 保存时都会对时间自动更新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	type R_JSONS struct { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1442,10 +1431,6 @@ func (c *DeviceController) DeviceBind_Sensor_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		page_z = conf.Page_size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Class_1 := c.GetString("Class_1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Name := c.GetString("Name") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_sn := c.GetString("T_sn") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1460,11 +1445,11 @@ func (c *DeviceController) DeviceBind_Sensor_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//c.Data["T_sn"] = T_sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var cnt int64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device_lite, cnt := Device.Read_Device_ALL_bind_1(admin_r, page,page_z, T_sn, Name, Class_1,T_monitor) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device_lite, cnt := Device.Read_Device_ALL_bind_1(admin_r, page, page_z, T_sn, Name, Class_1, T_monitor) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	for _, v := range Device_lite { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device := R_DeviceSensor{} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_sn_yd = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if strings.Contains(v.T_sn, "YD"){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if strings.Contains(v.T_sn, "YD") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			r_Device.T_sn_yd = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1474,7 +1459,6 @@ func (c *DeviceController) DeviceBind_Sensor_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_sensor_list, r_Device.T_sensor = Device.Read_DeviceSensor_ByTsn(v.T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_Device.T_monitor = v.T_monitor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// 电量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		DeviceSensorData, is := Device.Read_DeviceSensorData_ById_New(v.T_sn, 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if is { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1484,7 +1468,6 @@ func (c *DeviceController) DeviceBind_Sensor_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		r_jsons.Device_lite = append(r_jsons.Device_lite, r_Device) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	page_size := math.Ceil(float64(cnt) / float64(page_z)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	r_jsons.Page = page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	r_jsons.Page_size = int(page_size) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1536,9 +1519,9 @@ func (c *DeviceController) DeviceBind_Add_All() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		T_Bind := Device.Device_Bind_Add(v.T_sn, user_r) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		Device.DeviceSensor_T_Bind_ALL(v.T_sn,T_Bind) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Device.DeviceSensor_T_Bind_ALL(v.T_sn, T_Bind) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "设备绑定", v.T_sn+"+>"+c.GetString("Admin_uuid")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "设备绑定", v.T_sn+"+>"+c.GetString("Admin_uuid")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		num_x = num_x + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1583,9 +1566,9 @@ func (c *DeviceController) DeviceBind_Add() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 同步权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_Bind := Device.Device_Bind_Add(T_sn, user_r) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device.DeviceSensor_T_Bind_ALL(T_sn,T_Bind) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device.DeviceSensor_T_Bind_ALL(T_sn, T_Bind) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "设备绑定", T_sn+"+>"+c.GetString("Admin_uuid")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "设备绑定", T_sn+"+>"+c.GetString("Admin_uuid")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1627,9 +1610,9 @@ func (c *DeviceController) DeviceBind_Del() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 同步权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_Bind := Device.Device_Bind_Del(T_sn, user_r) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	Device.DeviceSensor_T_Bind_ALL(T_sn,T_Bind) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Device.DeviceSensor_T_Bind_ALL(T_sn, T_Bind) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "设备解除绑定", T_sn+"->"+c.GetString("Admin_uuid")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "设备解除绑定", T_sn+"->"+c.GetString("Admin_uuid")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1684,33 +1667,53 @@ func (c *DeviceController) DeviceClass_Post() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Id, _ := c.GetInt("Id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_name := c.GetString("T_name") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_Notice_wx := c.GetString("T_Notice_wx") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_Notice_wx2 := c.GetString("T_Notice_wx2") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_Notice_phone := c.GetString("T_Notice_phone") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_Notice_message := c.GetString("T_Notice_message") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_Notice_mailbox := c.GetString("T_Notice_mailbox") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_Notice_mechanism := c.GetString("T_Notice_mechanism") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	t_c := Device.DeviceClass{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		Id:               Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_name:           T_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_Notice_wx:      T_Notice_wx, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_Notice_phone:   T_Notice_phone, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_Notice_message: T_Notice_message, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_Notice_mailbox: T_Notice_mailbox, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Id:                 Id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_name:             T_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_Notice_wx:        T_Notice_wx, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_Notice_wx2:       T_Notice_wx2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_Notice_phone:     T_Notice_phone, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_Notice_message:   T_Notice_message, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_Notice_mailbox:   T_Notice_mailbox, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_Notice_mechanism: T_Notice_mechanism, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if Id == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		t_c.T_State = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		t_c.T_uuid = admin_r.Admin_uuid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		t_c.T_Notice_wx = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		t_c.T_Notice_wx2 = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		t_c.T_Notice_phone = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		t_c.T_Notice_message = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		t_c.T_Notice_mailbox = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		t_c.T_Notice_mechanism = Device.Read_DeviceWarningList_All_T_Notice_mechanism() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Device.Add_Class(t_c) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Device.Update_Class_ById(t_c) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs_T(admin_r.Admin_uuid,"设备管理", "分类操作", t_c) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs_T(admin_r.Admin_uuid, "设备管理", "分类操作", t_c) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func (c *DeviceController) DeviceWarningList_T_Tips() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	// 验证登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	b_, _ := lib.Verification(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if !b_ { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		c.Data["json"] = lib.JSONS{Code: 201, Msg: "User_tokey Err!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: Device.Read_DeviceWarningList_All_T_Notice_mechanism()} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (c *DeviceController) DeviceClass_Del() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 验证登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	b_, admin_r := lib.Verification(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey")) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1740,7 +1743,7 @@ func (c *DeviceController) DeviceClass_Del() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Device.DeviceSensor_Bind_Del(v.T_sn, v.T_id, id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "删除分类操作", strconv.Itoa(id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "删除分类操作", strconv.Itoa(id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1805,17 +1808,16 @@ func (c *DeviceController) DeviceClass_Syn() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//Device_r, _ := Device.Read_Device_ByT_sn(v_c.T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//Device.DeviceSensor_T_Bind_Add(v_c.T_sn, v_c.T_id, user_r) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			T_Bind := Device.Device_Bind_Add(v_c.T_sn, user_r) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			Device.DeviceSensor_T_Bind_ALL(v_c.T_sn,T_Bind) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Device.DeviceSensor_T_Bind_ALL(v_c.T_sn, T_Bind) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "同步分类操作", "->"+user_r.Admin_uuid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "同步分类操作", "->"+user_r.Admin_uuid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: num_x} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (c *DeviceController) DeviceClassBind_html_() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 验证登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	b_, _ := lib.Verification(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey")) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1933,7 +1935,7 @@ func (c *DeviceController) DeviceClassBind_Add() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.DeviceSensor_T_Calss_Add(T_sn, T_id, T_class_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "分类绑定操作", strconv.Itoa(T_class_id)+"+>"+T_sn+"-"+strconv.Itoa(T_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "分类绑定操作", strconv.Itoa(T_class_id)+"+>"+T_sn+"-"+strconv.Itoa(T_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1982,7 +1984,7 @@ func (c *DeviceController) DeviceClassBind_Del() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Device.DeviceSensor_Bind_Del(T_sn, T_id, T_class_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "分类删除绑定操作", strconv.Itoa(T_class_id)+"->"+T_sn+"-"+strconv.Itoa(T_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "分类删除绑定操作", strconv.Itoa(T_class_id)+"->"+T_sn+"-"+strconv.Itoa(T_id)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2016,8 +2018,6 @@ func (c *DeviceController) Get_DeviceClassId() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 任务列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (c *DeviceController) DeviceTask_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 验证登录 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2032,8 +2032,7 @@ func (c *DeviceController) DeviceTask_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Time_end := c.GetString("Time_end") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Time_start := c.GetString("Time_start") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	DeviceTask_lite, _ := Device.Read_DeviceTask_All_50(T_sn,Time_end,Time_start) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	DeviceTask_lite, _ := Device.Read_DeviceTask_All_50(T_sn, Time_end, Time_start) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: DeviceTask_lite} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2041,7 +2040,6 @@ func (c *DeviceController) DeviceTask_List() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 任务列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (c *DeviceController) DeviceTask_Post() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 验证登录 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2055,12 +2053,11 @@ func (c *DeviceController) DeviceTask_Post() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_sn := c.GetString("T_sn") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	T_task := c.GetString("T_task") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Nats.Set_DeviceTask(Device.Device_task{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_sn:T_sn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		T_task:T_task, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_sn:   T_sn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		T_task: T_task, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	System.Add_UserLogs(admin_r.Admin_uuid,"设备管理", "远程启停", T_sn+"-"+T_task) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "远程启停", T_sn+"-"+T_task) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	c.ServeJSON() 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2068,3 +2065,62 @@ func (c *DeviceController) DeviceTask_Post() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func (c *DeviceController) Get_DeviceClassId_QRCode() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	// 验证登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	b_, _ := lib.Verification(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if !b_ { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		c.Data["json"] = lib.JSONS{Code: 201, Msg: "User_tokey Err!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_calss_id := c.GetString("T_class_id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if len(T_calss_id) == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_calss_id Err!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_calss_id_str, _ := Nats.Wx_GenerateQRCode("-|" + lib.AesEncryptCBC(T_calss_id, "0123456789012345") + "|- @宝智达 微信公众号通知") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if len(T_calss_id_str) == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		c.Data["json"] = lib.JSONS{Code: 201, Msg: "Err!"} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	type Text struct { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		QR   string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Code string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_calss_id_str = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + T_calss_id_str 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Text_r := Text{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		QR:   T_calss_id_str, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Code: "请将本内容发送到 深圳市宝智达科技有限公司 微信公众号-|" + lib.AesEncryptCBC(T_calss_id, "0123456789012345") + "|- @宝智达 微信公众号通知    ", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: Text_r} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.ServeJSON() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 列表 - 设备日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func (c *DeviceController) DeviceLogs() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	page, _ := c.GetInt("page") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	println(page) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if page < 1 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		page = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	T_sn := c.GetString("T_sn") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.Data["T_sn"] = T_sn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	var cnt int64 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.Data["List"], cnt = System.Read_DeviceLogs_ALL(page, T_sn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	page_size := math.Ceil(float64(cnt) / float64(conf.Page_size)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.Data["Page"] = page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.Data["Page_size"] = page_size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.Data["Pages"] = lib.Func_page(int64(page), int64(page_size)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.Data["cnt"] = cnt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	c.TplName = "Device/DeviceLogs.html" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |