|
@@ -673,7 +673,7 @@ func (c *DeviceController) Device_v2_List() {
|
|
|
}
|
|
|
|
|
|
if len(c.GetString("User_uuid")) > 1 {
|
|
|
- s_, user_r := Admin.Read_Admin_ByAdmin_uuid(c.GetString("Admin_uuid"))
|
|
|
+ s_, user_r := Admin.Read_Admin_ByAdmin_uuid(c.GetString("User_uuid"))
|
|
|
if s_ != nil {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Admin_uuid Err!"}
|
|
|
c.ServeJSON()
|
|
@@ -1271,6 +1271,12 @@ func (c *DeviceController) DeviceSensor_v2_Parameter_Pu() {
|
|
|
T_en, _ := c.GetInt("T_en")
|
|
|
T_free, _ := c.GetInt("T_free")
|
|
|
|
|
|
+ T_enprel, _ := c.GetInt("T_enprel")
|
|
|
+ T_tprel, _ := c.GetFloat("T_tprel")
|
|
|
+ T_tpreu, _ := c.GetFloat("T_tpreu")
|
|
|
+ T_hprel, _ := c.GetFloat("T_hprel")
|
|
|
+ T_hpreu, _ := c.GetFloat("T_hpreu")
|
|
|
+
|
|
|
// 权限 过滤
|
|
|
Admin_Power_, _ := Admin.Read_AdminPower_ById(admin_r.Admin_power)
|
|
|
if Admin_Power_.Power_DeviceSensor_Parameter_e == 0 {
|
|
@@ -1304,6 +1310,12 @@ func (c *DeviceController) DeviceSensor_v2_Parameter_Pu() {
|
|
|
T_en: T_en,
|
|
|
T_free: T_free,
|
|
|
|
|
|
+ T_enprel: T_enprel,
|
|
|
+ T_tprel: float32(T_tprel),
|
|
|
+ T_tpreu: float32(T_tpreu),
|
|
|
+ T_hprel: float32(T_hprel),
|
|
|
+ T_hpreu: float32(T_hpreu),
|
|
|
+
|
|
|
T_uuid: admin_r.Admin_uuid,
|
|
|
T_SendState: 0,
|
|
|
T_State: 2,
|
|
@@ -1526,6 +1538,7 @@ func (c *DeviceController) V2_DeviceWarning_List() {
|
|
|
T_title := c.GetString("T_title")
|
|
|
Time_start := c.GetString("Time_start")
|
|
|
Time_end := c.GetString("Time_end")
|
|
|
+ T_handle, _ := c.GetInt("T_handle")
|
|
|
|
|
|
//r_jsons.DeviceWarningclass = Device.Read_DeviceWarningList_All_1()
|
|
|
//T_Title := ""
|
|
@@ -1533,7 +1546,7 @@ func (c *DeviceController) V2_DeviceWarning_List() {
|
|
|
// T_Title = Device.Read_DeviceWarningList_ById(Class_1).T_name
|
|
|
//}
|
|
|
|
|
|
- r_jsons.Data, r_jsons.Num = Device.Read_DeviceWarning(admin_r, T_sn, T_id, T_title, Time_start, Time_end, page, page_z)
|
|
|
+ r_jsons.Data, r_jsons.Num = Device.Read_DeviceWarning(admin_r, T_sn, T_id, T_title, T_handle, Time_start, Time_end, page, page_z)
|
|
|
r_jsons.Page = page
|
|
|
r_jsons.Page_size = int(math.Ceil(float64(r_jsons.Num) / float64(page_z)))
|
|
|
|
|
@@ -1652,8 +1665,9 @@ func (c *DeviceController) V2_DeviceWarning_Data_Excel() {
|
|
|
T_title := c.GetString("T_title")
|
|
|
Time_start := c.GetString("Time_start")
|
|
|
Time_end := c.GetString("Time_end")
|
|
|
+ T_handle, _ := c.GetInt("T_handle")
|
|
|
|
|
|
- Device_data, _ := Device.Read_DeviceWarning(admin_r, T_sn, T_id, T_title, Time_start, Time_end, 0, 9999)
|
|
|
+ Device_data, _ := Device.Read_DeviceWarning(admin_r, T_sn, T_id, T_title, T_handle, Time_start, Time_end, 0, 9999)
|
|
|
|
|
|
f := excelize.NewFile() // 设置单元格的值
|
|
|
// 这里设置表头
|
|
@@ -2399,15 +2413,16 @@ func (c *DeviceController) V2_Class_Get() {
|
|
|
r_jsons.T_Notice_mailbox = T.T_Notice_mailbox
|
|
|
r_jsons.T_Notice_mechanism = T.T_Notice_mechanism
|
|
|
|
|
|
- T_calss_id_str, _ := NatsServer.Wx_GenerateQRCode("-|" + lib.AesEncryptCBC(strconv.Itoa(T.Id), "0123456789012345") + "|- @宝智达 微信公众号通知")
|
|
|
- if len(T_calss_id_str) > 0 {
|
|
|
- r_jsons.T_QRCode = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + T_calss_id_str
|
|
|
- }
|
|
|
-
|
|
|
- T_calss_id_str, _ = NatsServer.Wx_GenerateQRCode2("-|" + lib.AesEncryptCBC(strconv.Itoa(T.Id), "0123456789012345") + "|- @宝智达 微信公众号通知")
|
|
|
- if len(T_calss_id_str) > 0 {
|
|
|
- r_jsons.T_QRCode2 = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + T_calss_id_str
|
|
|
- }
|
|
|
+ // 测试环境!!!!!!!!!!!!!!!!!!!
|
|
|
+ //T_calss_id_str, _ := NatsServer.Wx_GenerateQRCode("-|" + lib.AesEncryptCBC(strconv.Itoa(T.Id), "0123456789012345") + "|- @宝智达 微信公众号通知")
|
|
|
+ //if len(T_calss_id_str) > 0 {
|
|
|
+ // r_jsons.T_QRCode = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + T_calss_id_str
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //T_calss_id_str, _ = NatsServer.Wx_GenerateQRCode2("-|" + lib.AesEncryptCBC(strconv.Itoa(T.Id), "0123456789012345") + "|- @宝智达 微信公众号通知")
|
|
|
+ //if len(T_calss_id_str) > 0 {
|
|
|
+ // r_jsons.T_QRCode2 = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + T_calss_id_str
|
|
|
+ //}
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
|
c.ServeJSON()
|
|
@@ -2481,10 +2496,15 @@ func (c *DeviceController) V2_Class_Add() {
|
|
|
System.Add_UserLogs_T(admin_r.Admin_uuid, "分类管理", "分类添加", t_c)
|
|
|
|
|
|
// 同步分类
|
|
|
- DataList, _ := Admin.Read_v2_Admin_List(admin_r.Id, "", 0, 9999)
|
|
|
- for _, v := range DataList {
|
|
|
- V2_Class_Syn(admin_r, v)
|
|
|
- }
|
|
|
+ go func() {
|
|
|
+ DataList, _ := Admin.Read_v2_Admin_List(admin_r.Id, "", 0, 9999)
|
|
|
+ for _, v := range DataList {
|
|
|
+ if v.Admin_power > 6 {
|
|
|
+ V2_Class_Syn(admin_r, v)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }()
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
@@ -2522,23 +2542,42 @@ func (c *DeviceController) V2_Class_Edit() {
|
|
|
}
|
|
|
|
|
|
R_DeviceClass.Id = Id
|
|
|
- R_DeviceClass.T_name = T_name
|
|
|
- R_DeviceClass.T_Notice_wx = T_Notice_wx
|
|
|
- R_DeviceClass.T_Notice_wx2 = T_Notice_wx2
|
|
|
- R_DeviceClass.T_Notice_phone = T_Notice_phone
|
|
|
- R_DeviceClass.T_Notice_message = T_Notice_message
|
|
|
- R_DeviceClass.T_Notice_mailbox = T_Notice_mailbox
|
|
|
- R_DeviceClass.T_Notice_mechanism = T_Notice_mechanism
|
|
|
+ if len(T_name) > 0 {
|
|
|
+ R_DeviceClass.T_name = T_name
|
|
|
+ }
|
|
|
+ if len(T_Notice_wx) > 0 {
|
|
|
+ R_DeviceClass.T_Notice_wx = T_Notice_wx
|
|
|
+ }
|
|
|
+ if len(T_Notice_wx2) > 0 {
|
|
|
+ R_DeviceClass.T_Notice_wx2 = T_Notice_wx2
|
|
|
+ }
|
|
|
+ if len(T_Notice_phone) > 0 {
|
|
|
+ R_DeviceClass.T_Notice_phone = T_Notice_phone
|
|
|
+ }
|
|
|
+ if len(T_Notice_message) > 0 {
|
|
|
+ R_DeviceClass.T_Notice_message = T_Notice_message
|
|
|
+ }
|
|
|
+ if len(T_Notice_mailbox) > 0 {
|
|
|
+ R_DeviceClass.T_Notice_mailbox = T_Notice_mailbox
|
|
|
+ }
|
|
|
+ if len(T_Notice_mechanism) > 0 {
|
|
|
+ R_DeviceClass.T_Notice_mechanism = T_Notice_mechanism
|
|
|
+ }
|
|
|
|
|
|
Device.Update_Class(R_DeviceClass, "T_name", "T_Notice_wx", "T_Notice_wx2", "T_Notice_phone", "T_Notice_message", "T_Notice_mailbox", "T_Notice_mechanism")
|
|
|
|
|
|
System.Add_UserLogs_T(admin_r.Admin_uuid, "设备管理", "分类操作", R_DeviceClass)
|
|
|
|
|
|
// 同步分类
|
|
|
- DataList, _ := Admin.Read_v2_Admin_List(admin_r.Id, "", 0, 9999)
|
|
|
- for _, v := range DataList {
|
|
|
- V2_Class_Syn(admin_r, v)
|
|
|
- }
|
|
|
+ go func() {
|
|
|
+ DataList, _ := Admin.Read_v2_Admin_List(admin_r.Id, "", 0, 9999)
|
|
|
+ for _, v := range DataList {
|
|
|
+ if v.Admin_power > 6 {
|
|
|
+ V2_Class_Syn(admin_r, v)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }()
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
@@ -2624,10 +2663,15 @@ func (c *DeviceController) V2_Class_Del() {
|
|
|
System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "删除分类操作", strconv.Itoa(id))
|
|
|
|
|
|
// 同步分类
|
|
|
- DataList, _ := Admin.Read_v2_Admin_List(admin_r.Id, "", 0, 9999)
|
|
|
- for _, v := range DataList {
|
|
|
- V2_Class_Syn(admin_r, v)
|
|
|
- }
|
|
|
+ go func() {
|
|
|
+ DataList, _ := Admin.Read_v2_Admin_List(admin_r.Id, "", 0, 9999)
|
|
|
+ for _, v := range DataList {
|
|
|
+ if v.Admin_power > 6 {
|
|
|
+ V2_Class_Syn(admin_r, v)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }()
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
@@ -2704,19 +2748,6 @@ func (c *DeviceController) DeviceClass_Syn() {
|
|
|
}
|
|
|
|
|
|
func V2_Class_Syn(admin_r Admin.Admin, user_r Admin.Admin) {
|
|
|
- //验证登录
|
|
|
- //b_, admin_r := 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
|
|
|
- //}
|
|
|
- //s_, user_r := Admin.Read_Admin_ByAdmin_uuid(c.GetString("T_uuid"))
|
|
|
- //if s_ != nil {
|
|
|
- // c.Data["json"] = lib.JSONS{Code: 202, Msg: "Admin_uuid Err!"}
|
|
|
- // c.ServeJSON()
|
|
|
- // return
|
|
|
- //}
|
|
|
|
|
|
// 先全部 清掉
|
|
|
Device.Device_Bind_ALL_Del(user_r)
|
|
@@ -2763,7 +2794,6 @@ func V2_Class_Syn(admin_r Admin.Admin, user_r Admin.Admin) {
|
|
|
T_Bind := Device.Device_Bind_Add(v_c.T_sn, user_r)
|
|
|
Device.DeviceSensor_T_Bind_ALL(v_c.T_sn, T_Bind)
|
|
|
}
|
|
|
- //
|
|
|
}
|
|
|
System.Add_UserLogs(admin_r.Admin_uuid, "设备管理", "同步分类操作", "->"+user_r.Admin_uuid)
|
|
|
|
|
@@ -2877,6 +2907,24 @@ func (c *DeviceController) DeviceSensor_v2_List() {
|
|
|
T_sn := c.GetString("T_sn")
|
|
|
Name := c.GetString("T_name") // 包含 T_name、T_sn
|
|
|
T_calss_id, _ := c.GetInt("T_calssid")
|
|
|
+ T_give, T_give_err := c.GetInt("T_give") //0 :丢弃 1:正常 空:所有
|
|
|
+ if T_give_err != nil {
|
|
|
+ T_give = -1
|
|
|
+ }
|
|
|
+ T_datashow, T_datashow_err := c.GetInt("T_datashow") //空:正常显示 1:强制显示 屏蔽数据展示
|
|
|
+ if T_datashow_err != nil {
|
|
|
+ T_datashow = -1
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(c.GetString("User_uuid")) > 1 {
|
|
|
+ s_, user_r := Admin.Read_Admin_ByAdmin_uuid(c.GetString("User_uuid"))
|
|
|
+ if s_ != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "Admin_uuid Err!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ admin_r = user_r
|
|
|
+ }
|
|
|
|
|
|
if T_calss_id > 0 {
|
|
|
R_DeviceClass, err := Device.Read_Class_ById(T_calss_id)
|
|
@@ -2892,7 +2940,7 @@ func (c *DeviceController) DeviceSensor_v2_List() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- r_jsons.Data, r_jsons.Num = Device.Read_DeviceSensor_v2_List(admin_r, T_sn, Name, T_calss_id, page, page_z)
|
|
|
+ r_jsons.Data, r_jsons.Num = Device.Read_DeviceSensor_v2_List(admin_r, T_sn, Name, T_calss_id, T_give, T_datashow, page, page_z)
|
|
|
r_jsons.Page = page
|
|
|
r_jsons.Page_size = int(math.Ceil(float64(r_jsons.Num) / float64(page_z)))
|
|
|
|
|
@@ -2989,6 +3037,17 @@ func (c *DeviceController) V2_ClassBind_Add() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
+ // 同步分类
|
|
|
+ go func() {
|
|
|
+ DataList, _ := Admin.Read_v2_Admin_List(admin_r.Id, "", 0, 9999)
|
|
|
+ for _, v := range DataList {
|
|
|
+ if v.Admin_power > 6 {
|
|
|
+ V2_Class_Syn(admin_r, v)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
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))
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
@@ -3096,6 +3155,17 @@ func (c *DeviceController) V2_ClassBind_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))
|
|
|
|
|
|
+ // 同步分类
|
|
|
+ go func() {
|
|
|
+ DataList, _ := Admin.Read_v2_Admin_List(admin_r.Id, "", 0, 9999)
|
|
|
+ for _, v := range DataList {
|
|
|
+ if v.Admin_power > 6 {
|
|
|
+ V2_Class_Syn(admin_r, v)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
|
return
|