Browse Source

update:添加公司逻辑,删除Device.T_type,文件上传

zoie 2 years ago
parent
commit
12c56088fb

+ 71 - 16
Nats/NatsServer/NatsQiniu.go

@@ -3,8 +3,12 @@ package NatsServer
 import (
 	"Cold_Api/controllers/lib"
 	"Cold_Api/logs"
+	"context"
 	"fmt"
+	"github.com/qiniu/go-sdk/v7/auth/qbox"
+	"github.com/qiniu/go-sdk/v7/storage"
 	"github.com/vmihailenco/msgpack/v5"
+	"strings"
 	"time"
 )
 
@@ -34,27 +38,78 @@ func Qiniu_UploadToken(T_suffix string, T_MimeLimit string) (string, bool) {
 	return string(msg.Data), false
 }
 
+//func Qiniu_UploadFile(localFile string, name string) (string, bool) {
+//	logs.Println("Nats =>", lib.FuncName(), localFile, name)
+//	type Qiniu_UploadFile struct {
+//		File string
+//		Name string
+//	}
+//	RR := Qiniu_UploadFile{File: localFile, Name: name}
+//	println(":", RR.File)
+//	b, err := msgpack.Marshal(&RR)
+//	if err != nil {
+//		panic(err)
+//	}
+//
+//	// 请求-响应, 向 test3 发布一个 `help me` 请求数据,设置超时间3秒,如果有多个响应,只接收第一个收到的消息
+//	msg, err := lib.Nats.Request("Qiniu_UploadFile", b, 3*time.Second)
+//	if err != nil {
+//		fmt.Println(err)
+//	} else {
+//		fmt.Printf("Qiniu_UploadFile : %s\n", string(msg.Data))
+//		return string(msg.Data), true
+//	}
+//
+//	return string(msg.Data), false
+//}
+
 func Qiniu_UploadFile(localFile string, name string) (string, bool) {
-	logs.Println("Nats =>", lib.FuncName(), localFile, name)
-	type Qiniu_UploadFile struct {
-		File string
-		Name string
-	}
-	RR := Qiniu_UploadFile{File: localFile, Name: name}
-	println(":", RR.File)
-	b, err := msgpack.Marshal(&RR)
+	logs.Println("Qiniu_UploadFile =>", localFile, name)
+
+	// 获取 七牛云的 配置信息
+	msg, err := lib.Nats.Request("Qiniu_Token", []byte(""), 3*time.Second)
 	if err != nil {
-		panic(err)
+		return string(msg.Data), false
 	}
+	fmt.Printf("Qiniu_Token : %s\n", string(msg.Data))
+	Qiniu_cs := strings.Split(string(msg.Data), "|")
+	Qiniu_AccessKey := Qiniu_cs[0]
+	Qiniu_SecretKey := Qiniu_cs[1]
+	Qiniu_BUCKET := Qiniu_cs[2]
+	Qiniu_Url := Qiniu_cs[3]
 
-	// 请求-响应, 向 test3 发布一个 `help me` 请求数据,设置超时间3秒,如果有多个响应,只接收第一个收到的消息
-	msg, err := lib.Nats.Request("Qiniu_UploadFile", b, 3*time.Second)
+	// 开始上传 七牛云
+	Qiniu := qbox.NewMac(Qiniu_AccessKey, Qiniu_SecretKey)
+	// 自定义返回值结构体
+	type MyPutRet struct {
+		Key    string
+		Hash   string
+		Fsize  int
+		Bucket string
+		Name   string
+	}
+	//key := "your file save key"
+	// 使用 returnBody 自定义回复格式
+	putPolicy := storage.PutPolicy{
+		Scope:      Qiniu_BUCKET,
+		ReturnBody: `{"key":"$(key)","hash":"$(etag)","fsize":$(fsize),"bucket":"$(bucket)","name":"$(x:name)"}`,
+	}
+	//mac := qbox.NewMac(conf.Qiniu_AccessKey, conf.Qiniu_SecretKey)
+	upToken := putPolicy.UploadToken(Qiniu)
+	cfg := storage.Config{}
+	formUploader := storage.NewFormUploader(&cfg)
+	ret := MyPutRet{}
+	putExtra := storage.PutExtra{
+		Params: map[string]string{
+			"x:name": "github logo",
+		},
+	}
+	err = formUploader.PutFile(context.Background(), &ret, upToken, name, localFile, &putExtra)
 	if err != nil {
-		fmt.Println(err)
-	} else {
-		fmt.Printf("Qiniu_UploadFile : %s\n", string(msg.Data))
-		return string(msg.Data), true
+		logs.Println("七牛云", "上传文件失败"+localFile, err.Error())
+		return "", false
 	}
+	fmt.Println(ret.Bucket, ret.Key, ret.Fsize, ret.Hash, ret.Name)
+	return Qiniu_Url + name, true
 
-	return string(msg.Data), false
 }

+ 1 - 1
conf/app.conf

@@ -10,7 +10,7 @@ copyrequestbody = true
 # AdminAddr = "localhost"
 # AdminPort = 8088
 
-version = "/v3"
+Version = "/v3"
 
 # Nats
 NatsServer_Url = "127.0.0.1:43422"

+ 1 - 1
controllers/Data.go

@@ -82,7 +82,7 @@ func (c *DataController) Device_Sensor_List() {
 	}
 
 	T_sn := c.GetString("T_sn")
-	T_Class_id, _ := c.GetInt("T_class_id")
+	T_Class_id, _ := c.GetInt("T_calssid")
 	T_type, T_type_err := c.GetInt("T_type")
 	if T_type_err != nil {
 		T_type = -1

+ 13 - 15
controllers/Device.go

@@ -66,10 +66,9 @@ func (c *DeviceController) Device_List() {
 	Name := c.GetString("T_name")
 	T_online := c.GetString("T_online")
 	T_monitor := c.GetString("T_monitor")
-	T_type, _ := c.GetInt("T_type")
 
 	Product.Read_ProductType_All_Map()
-	r_jsons.Device_lite, r_jsons.Num = Device.Read_Device_List(c.Admin_r, c.T_pid, Name, T_monitor, T_online, T_type, page, page_z)
+	r_jsons.Device_lite, r_jsons.Num = Device.Read_Device_List(c.Admin_r, c.T_pid, Name, T_monitor, T_online, page, page_z)
 
 	r_jsons.Page = page
 	r_jsons.Page_size = int(math.Ceil(float64(r_jsons.Num) / float64(page_z)))
@@ -82,13 +81,11 @@ func (c *DeviceController) Device_List() {
 func (c *DeviceController) Device_Add() {
 	var err error
 	T_sn := c.GetString("T_sn")
-	T_type, _ := c.GetInt("T_type")
 	var_ := Device.Device{
 		T_pid:     c.T_pid,
 		T_sn:      T_sn,
-		T_type:    T_type,
-		T_monitor: 1,
-		T_State:   1,
+		T_monitor: 1, // 监控状态 已监控
+		T_State:   1, // 状态 正常
 	}
 	if len(T_sn) < 8 {
 		c.Data["json"] = lib.JSONS{Code: 303, Msg: "SN 太短 必须8个字符以上"}
@@ -119,7 +116,7 @@ func (c *DeviceController) Device_Add() {
 
 	System.Add_UserLogs_T(c.Admin_r.T_uuid, "设备管理", "设备添加", var_)
 
-	//MqttServer.Get_Device_Realtime(T_sn)  // 更新传感器 !!!
+	NatsServer.Read_DeviceParameter(T_sn) // 获取主机信息
 
 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
 	c.ServeJSON()
@@ -143,12 +140,6 @@ func (c *DeviceController) Device_Edit() {
 		Device_r.T_monitor = T_monitor
 		clos = append(clos, "T_monitor")
 	}
-	// 设备类型
-	T_type, T_type_err := c.GetInt("T_type")
-	if T_type_err == nil {
-		Device_r.T_type = T_type
-		clos = append(clos, "T_type")
-	}
 	// 温度显示
 	T_ist, T_ist_err := c.GetInt("T_ist")
 	if T_ist_err == nil {
@@ -484,6 +475,13 @@ func (c *DeviceController) DeviceSensor_Edit() {
 		return
 	}
 
+	// 数据视图3D视图订阅
+	if v, err := c.GetInt("T_type"); err == nil {
+		DeviceSensor.T_type = v
+		Device.Update_DeviceSensor(DeviceSensor, "T_type")
+		System.Add_UserLogs_T(c.Admin_r.T_uuid, "设备管理", "传感器 类型", "SN:"+Sn+" ["+strconv.Itoa(Id)+"]"+strconv.Itoa(v))
+	}
+
 	// 实时数据显示排序
 	if v, err := c.GetInt("T_sort"); err == nil {
 		DeviceSensor.T_sort = v
@@ -853,7 +851,7 @@ func (c *DeviceController) DeviceTask_List() {
 		return
 	}
 
-	r_jsons.Data, r_jsons.Num = Device.Read_DeviceTask_All(T_sn, Time_start, Time_end, page, page_z)
+	r_jsons.Data, r_jsons.Num = Device.Read_DeviceTask_List(T_sn, 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)))
 
@@ -1735,7 +1733,7 @@ func (c *DeviceController) NoticeBind_Del() {
 func (c *DeviceController) DeviceType_List_All() {
 	type R_JSONS struct {
 		//必须的大写开头
-		Data      []Device.DeviceType
+		Data      []Device.DeviceSensorType
 		Num       int64
 		Page      int
 		Page_size int

+ 0 - 8
controllers/Logs.go

@@ -15,14 +15,6 @@ type LogsController struct {
 
 // 列表 -
 func (c *LogsController) UserLogsClass() {
-	// 验证登录
-	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: System.Read_UserLogs_Class()}
 	c.ServeJSON()
 	return

+ 17 - 65
controllers/User.go

@@ -4,6 +4,7 @@ import (
 	"Cold_Api/Nats/NatsServer"
 	"Cold_Api/conf"
 	"Cold_Api/controllers/lib"
+	"Cold_Api/logs"
 	"Cold_Api/models"
 	"Cold_Api/models/Account"
 	"Cold_Api/models/System"
@@ -11,10 +12,8 @@ import (
 	"github.com/beego/beego/v2/adapter/orm"
 	beego "github.com/beego/beego/v2/server/web"
 	uuid "github.com/satori/go.uuid"
-	"log"
 	"math"
 	"strconv"
-	"strings"
 	"time"
 )
 
@@ -76,19 +75,8 @@ func (c *UserController) Company_Tree() {
 func (c *UserController) Company_List() {
 
 	var r_jsons lib.R_JSONS
-
-	page, _ := c.GetInt("page")
-	if page < 1 {
-		page = 1
-	}
-	page_z, _ := c.GetInt("page_z")
-	if page_z < 1 {
-		page_z = conf.Page_size
-	}
-
-	r_jsons.Data, r_jsons.Num = Account.Read_Company_List(page, page_z)
-	r_jsons.Page = page
-	r_jsons.Page_size = int(math.Ceil(float64(r_jsons.Num) / float64(page_z)))
+	T_name := c.GetString("T_name")
+	r_jsons.Data, r_jsons.Num = Account.Read_Company_List(T_name)
 
 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
 	c.ServeJSON()
@@ -112,29 +100,6 @@ func (c *UserController) Company_Add() {
 		return
 	}
 
-	var_.Id = int(id)
-	T_Path := strconv.Itoa(int(id)) + "/"
-	if var_.T_mid != 0 {
-		Company_r, err := Account.Read_Company_ById(T_mid)
-		if err != nil {
-			c.Data["json"] = lib.JSONS{Code: 301, Msg: "T_mid Err !"}
-			c.ServeJSON()
-			return
-		}
-		T_Path = Company_r.T_path + T_Path
-
-	} else {
-		T_Path = "/0/" + T_Path
-	}
-
-	var_.T_path = T_Path
-	is := Account.Update_Company(var_, "T_path")
-	if !is {
-		c.Data["json"] = lib.JSONS{Code: 202, Msg: "添加失败!"}
-		c.ServeJSON()
-		return
-	}
-
 	System.Add_UserLogs_T(c.Admin_r.T_uuid, "公司管理", "添加", var_)
 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: id}
 	c.ServeJSON()
@@ -726,14 +691,6 @@ func (c *UserController) AdminCompanyBind_List() {
 
 	var r_jsons lib.R_JSONS
 
-	page, _ := c.GetInt("page")
-	if page < 1 {
-		page = 1
-	}
-	page_z, _ := c.GetInt("page_z")
-	if page_z < 1 {
-		page_z = conf.Page_size
-	}
 	T_uuid := c.GetString("T_uuid")
 	if len(T_uuid) < 8 {
 		c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
@@ -748,14 +705,7 @@ func (c *UserController) AdminCompanyBind_List() {
 		return
 	}
 
-	var cnt int64
-	Company_lite, cnt := Account.Read_Company_List_ByT_pids(r.T_pids, page, page_z)
-
-	r_jsons.Data = Company_lite
-
-	r_jsons.Page = page
-	r_jsons.Page_size = int(math.Ceil(float64(r_jsons.Num) / float64(page_z)))
-	r_jsons.Num = cnt
+	r_jsons.Data = Account.Read_Company_List_ByT_pids(r.T_pids)
 
 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
 	c.ServeJSON()
@@ -781,13 +731,17 @@ func (c *UserController) AdminCompanyBind_Add() {
 		c.ServeJSON()
 		return
 	}
-	if strings.Contains(r.T_pids, "P"+strconv.Itoa(T_pid)+"|") {
-		c.Data["json"] = lib.JSONS{Code: 203, Msg: "重复绑定!"}
+
+	Company_r, err := Account.Read_Company_ById(T_pid)
+	if err != nil {
+		c.Data["json"] = lib.JSONS{Code: 204, Msg: "T_pid Err!"}
 		c.ServeJSON()
 		return
 	}
 
-	if err = Account.Add_Company_bind(r.Id, T_pid); err != nil {
+	T_pids := Account.ReadCompanyIds_T_path(Company_r.T_path)
+
+	if err = Account.Add_Company_bind(r, T_pids); err != nil {
 		c.Data["json"] = lib.JSONS{Code: 200, Msg: "公司绑定失败"}
 		c.ServeJSON()
 		return
@@ -813,18 +767,16 @@ func (c *UserController) AdminCompanyBind_Del() {
 	}
 
 	r, err := Account.Read_Admin_ByUuid(T_uuid)
+	Company_r, err := Account.Read_Company_ById(T_pid)
 	if err != nil {
-		c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
-		c.ServeJSON()
-		return
-	}
-	if !strings.Contains(r.T_pids, "P"+strconv.Itoa(T_pid)+"|") {
-		c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
+		c.Data["json"] = lib.JSONS{Code: 204, Msg: "T_pid Err!"}
 		c.ServeJSON()
 		return
 	}
 
-	if err = Account.Delete_Company_bind(r.Id, T_pid); err != nil {
+	T_pids := Account.ReadCompanyIds_T_path(Company_r.T_path)
+
+	if err = Account.Delete_Company_bind(r, T_pids); err != nil {
 		c.Data["json"] = lib.JSONS{Code: 200, Msg: "公司绑定失败"}
 		c.ServeJSON()
 		return
@@ -1057,7 +1009,7 @@ func (c *UserController) User_Menu_List() {
 		c.ServeJSON()
 		return
 	}
-	log.Println("菜单 pid 为:", c.T_pid)
+	logs.Println("登录用户 菜单 pid 为:", c.T_pid)
 	r_jsons.Data = Account.Read_Menu_Bind_List(power.Id, power.T_menu, c.T_pid)
 
 	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}

+ 1 - 0
logs/LogPrintln.go

@@ -13,6 +13,7 @@ var Test = true
 func init() {
 	logx = logs.NewLogger()
 	logx.SetLogger(logs.AdapterFile, `{"filename":"logs/logx/logx.log"}`)
+	logx.EnableFuncCallDepth(true)
 
 	if runtime.GOOS == "windows" {
 		Test = true

+ 22 - 24
models/Account/Admin.go

@@ -349,38 +349,38 @@ func Read_Admin_List_All() (AdminList []Admin_R) {
 	return AdminList
 }
 
-func Add_Company_bind(Admin_id, T_pid int) (err error) {
+func Add_Company_bind(Admin_r Admin, T_pids []int) (err error) {
 
 	o := orm.NewOrm()
-	v := Admin{Id: Admin_id}
-	T_Pid_bind := "P" + strconv.Itoa(T_pid) + "|"
-	if err = o.Read(&v, "Id"); err == nil {
-		v.T_pids = strings.Replace(v.T_pids, T_Pid_bind, "", -1)
-		v.T_pids = v.T_pids + T_Pid_bind
-
-		if num, err := o.Update(&v, "T_pids"); err == nil {
-			fmt.Println("Number of records updated in database:", num)
-			Redis_Admin_Set(v) // Redis 更新缓存
-			return err
-		}
+	for _, T_pid := range T_pids {
+		T_Pid_bind := "P" + strconv.Itoa(T_pid) + "|"
+		Admin_r.T_pids = strings.Replace(Admin_r.T_pids, T_Pid_bind, "", -1)
+		Admin_r.T_pids = Admin_r.T_pids + T_Pid_bind
+	}
+
+	if num, err := o.Update(&Admin_r, "T_pids"); err == nil {
+		fmt.Println("Number of records updated in database:", num)
+		Redis_Admin_Set(Admin_r) // Redis 更新缓存
+		return err
 	}
 
 	return err
 }
 
-func Delete_Company_bind(Admin_id, T_pid int) (err error) {
+func Delete_Company_bind(Admin_r Admin, T_pids []int) (err error) {
 
 	o := orm.NewOrm()
-	v := Admin{Id: Admin_id}
-	T_Pid_bind := "P" + strconv.Itoa(T_pid) + "|"
-	if err = o.Read(&v, "Id"); err == nil {
-		v.T_pids = strings.Replace(v.T_pids, T_Pid_bind, "", -1)
-		if num, err := o.Update(&v, "T_pids"); err == nil {
-			fmt.Println("Number of records updated in database:", num)
-			Redis_Admin_Set(v) // Redis 更新缓存
-			return err
-		}
+	for _, T_pid := range T_pids {
+		T_Pid_bind := "P" + strconv.Itoa(T_pid) + "|"
+		Admin_r.T_pids = strings.Replace(Admin_r.T_pids, T_Pid_bind, "", -1)
+	}
+
+	if num, err := o.Update(&Admin_r, "T_pids"); err == nil {
+		fmt.Println("Number of records updated in database:", num)
+		Redis_Admin_Set(Admin_r) // Redis 更新缓存
+		return err
 	}
+
 	return err
 
 }
@@ -400,8 +400,6 @@ func Delete_Company_bind_T_pids(o orm.Ormer, T_pid int) (err error) {
 	}
 
 	for _, v := range maps {
-		o := orm.NewOrm()
-		v := Admin{Id: v.Id}
 		if err = o.Read(&v, "Id"); err == nil {
 			v.T_pids = strings.Replace(v.T_pids, T_Pid_bind, "", -1)
 			if num, err := o.Update(&v, "T_pids"); err == nil {

+ 95 - 33
models/Account/Company.go

@@ -101,15 +101,37 @@ func Redis_Company_DelK(key string) (err error) {
 // ---------------- 特殊方法 -------------------
 
 // 添加
-func Add_Company(m Company) (id int64, err error) {
+func Add_Company(var_ Company) (id int64, err error) {
 	o := orm.NewOrm()
-	id, err = o.Insert(&m)
+	o.Begin()
+	id, err = o.Insert(&var_)
 	if err != nil {
-		fmt.Println(err)
+		o.Rollback()
+		return id, err
 	}
-	m.Id = int(id)
-	Redis_Company_Set(m)
+
+	T_Path := "/0/" + strconv.Itoa(int(id)) + "/"
+	if var_.T_mid != 0 {
+		Company_r, err := Read_Company_ById(var_.T_mid)
+		if err != nil {
+			o.Rollback()
+			return id, err
+		}
+		T_Path = Company_r.T_path + strconv.Itoa(int(id)) + "/"
+	}
+
+	var_.Id = int(id)
+	var_.T_path = T_Path
+	_, err = o.Update(&var_, "T_path")
+	if err != nil {
+		o.Rollback()
+		return id, err
+	}
+	o.Commit()
+
+	Redis_Company_Set(var_)
 	return id, err
+
 }
 
 // 修改
@@ -152,7 +174,7 @@ func Read_Company_ById(Id int) (r Company, e error) {
 }
 
 // 获取列表
-func Read_Company_Tree(admin_r Admin, Company_name string) (CompanyList []Company_R, cnt int64) {
+func Read_Company_Tree(admin_r Admin, T_name string) (CompanyList []Company_R, cnt int64) {
 
 	// 内部用户未绑定公司
 	if admin_r.T_pid > 0 || len(admin_r.T_pids) == 0 {
@@ -178,8 +200,8 @@ func Read_Company_Tree(admin_r Admin, Company_name string) (CompanyList []Compan
 		cond1 = cond1.And("Id__in", ReadCompanyIds_T_pids(T_pids))
 	}
 
-	if len(Company_name) > 0 {
-		cond1 = cond1.And("T_name__icontains", Company_name)
+	if len(T_name) > 0 {
+		cond1 = cond1.And("T_name__icontains", T_name)
 	}
 
 	qs.SetCond((*orm2.Condition)(cond1)).OrderBy("-Id").All(&maps)
@@ -243,14 +265,8 @@ func ReadCompanyIds_T_path(T_path string) (companyIds []int) {
 	return companyIds
 }
 
-func Read_Company_List(page, page_z int) (CompanyList []Company_R, cnt int64) {
+func Read_Company_List(T_name string) (CompanyList []Company_R, cnt int64) {
 
-	var offset int64
-	if page <= 1 {
-		offset = 0
-	} else {
-		offset = int64((page - 1) * page_z)
-	}
 	o := orm.NewOrm()
 	// 也可以直接使用 Model 结构体作为表名
 
@@ -260,12 +276,41 @@ func Read_Company_List(page, page_z int) (CompanyList []Company_R, cnt int64) {
 	cond := orm.NewCondition()
 	cond1 := cond.And("T_State", 1)
 
-	qs.Limit(page_z, offset).SetCond((*orm2.Condition)(cond1)).OrderBy("-Id").All(&maps)
+	if len(T_name) > 0 {
+		cond1 = cond1.And("T_name__icontains", T_name)
+	}
+
+	qs.SetCond((*orm2.Condition)(cond1)).OrderBy("-Id").All(&maps)
 	cnt, _ = qs.SetCond((*orm2.Condition)(cond1)).Count()
 
-	for _, v := range maps {
-		CompanyList = append(CompanyList, CompanyToCompany_R(v))
+	parentMap, flag := getCompanyParent(maps)
+	if flag {
+		for i := 0; i < len(maps); i++ {
+			if parentMap[maps[i].T_mid] {
+				continue
+			}
+			r := Company_R{
+				Id:       maps[i].Id,
+				T_mid:    maps[i].T_mid,
+				T_name:   maps[i].T_name,
+				Children: nil,
+			}
+			info := CompanyCall(maps, r)
+			CompanyList = append(CompanyList, info)
+		}
+	} else {
+		for i := 0; i < len(maps); i++ {
+			r := Company_R{
+				Id:       maps[i].Id,
+				T_mid:    maps[i].T_mid,
+				T_name:   maps[i].T_name,
+				Children: nil,
+			}
+			info := CompanyCall(maps, r)
+			CompanyList = append(CompanyList, info)
+		}
 	}
+
 	return CompanyList, cnt
 }
 
@@ -329,7 +374,7 @@ func Read_Company_List_All_ByT_name(T_name string) (maps []Company) {
 
 	qs := o.QueryTable(new(Company))
 	if len(T_name) > 0 {
-		qs.Filter("T_name", T_name).All(&maps)
+		qs.Filter("T_name__icontains", T_name).All(&maps)
 		return maps
 	}
 	qs.All(&maps)
@@ -337,20 +382,13 @@ func Read_Company_List_All_ByT_name(T_name string) (maps []Company) {
 }
 
 // 获取铜壶绑定的公司列表
-func Read_Company_List_ByT_pids(T_pids string, page int, page_z int) (Company_r []Company_R, cnt int64) {
+func Read_Company_List_ByT_pids(T_pids string) (CompanyList []Company_R) {
 
 	o := orm.NewOrm()
 	// 也可以直接使用 Model 结构体作为表名
 
 	qs := o.QueryTable(new(Company))
-	var offset int64
-	if page <= 1 {
-		offset = 0
-	} else {
-		offset = int64((page - 1) * page_z)
-	}
-
-	var r []Company
+	var maps []Company
 	cond := orm.NewCondition()
 	cond1 := cond.And("T_State", 1)
 	if len(T_pids) >= 0 {
@@ -358,11 +396,35 @@ func Read_Company_List_ByT_pids(T_pids string, page int, page_z int) (Company_r
 		cond1 = cond1.And("Id__in", list)
 	}
 
-	qs.Limit(page_z, offset).SetCond((*orm2.Condition)(cond1)).OrderBy("Id").All(&r)
-	cnt, _ = qs.SetCond((*orm2.Condition)(cond1)).Count()
+	qs.SetCond((*orm2.Condition)(cond1)).OrderBy("Id").All(&maps)
 
-	for _, v := range r {
-		Company_r = append(Company_r, CompanyToCompany_R(v))
+	parentMap, flag := getCompanyParent(maps)
+	if flag {
+		for i := 0; i < len(maps); i++ {
+			if parentMap[maps[i].T_mid] {
+				continue
+			}
+			r := Company_R{
+				Id:       maps[i].Id,
+				T_mid:    maps[i].T_mid,
+				T_name:   maps[i].T_name,
+				Children: nil,
+			}
+			info := CompanyCall(maps, r)
+			CompanyList = append(CompanyList, info)
+		}
+	} else {
+		for i := 0; i < len(maps); i++ {
+			r := Company_R{
+				Id:       maps[i].Id,
+				T_mid:    maps[i].T_mid,
+				T_name:   maps[i].T_name,
+				Children: nil,
+			}
+			info := CompanyCall(maps, r)
+			CompanyList = append(CompanyList, info)
+		}
 	}
-	return Company_r, cnt
+
+	return CompanyList
 }

+ 3 - 2
models/Account/Menu.go

@@ -21,6 +21,7 @@ type Menu struct {
 	T_icon       string `orm:"size(256);null"`      // 图标
 	T_sort       int    `orm:"size(11);default(0)"` // 排序 越小的越靠前,可以为负数
 	T_pid        int    `orm:"size(2);default(0)"`  // 1 进入公司后才能访问的菜单 0 公共菜单
+	T_State      int    `orm:"size(2);default(1)"`  // 0删除 1正常 2共有菜单
 	Children     []Menu `orm:"-"`
 }
 
@@ -214,7 +215,7 @@ func Read_Menu_Bind_List(Power_Id int, Bind_Menu string, T_pid int) (maps []Menu
 		return maps
 	}
 
-	cond = cond.And("Id__in", models.IntIdsDistinct(AllIds))
+	cond = cond.AndCond(cond.Or("Id__in", models.IntIdsDistinct(AllIds)).Or("T_State", 2))
 
 	qs.SetCond((*orm2.Condition)(cond)).OrderBy("T_sort", "Id").All(&maps)
 
@@ -257,7 +258,7 @@ func Read_Menu_List_All() (maps []Menu, menu_ids []int) {
 	// 也可以直接使用 Model 结构体作为表名
 
 	qs := o.QueryTable(new(Menu))
-	qs.OrderBy("Id", "-T_sort").All(&maps)
+	qs.Filter("T_State", 1).OrderBy("Id", "-T_sort").All(&maps)
 	for _, v := range maps {
 		menu_ids = append(menu_ids, v.Id)
 	}

+ 2 - 2
models/Company/CompanyClass.go

@@ -178,7 +178,7 @@ func Read_CompanyClass_List(T_pid int, T_name string, page int, page_z int) (r [
 		cond1 = cond1.And("T_pid", T_pid)
 	}
 	if len(T_name) > 0 {
-		cond1 = cond1.And("T_name", T_name)
+		cond1 = cond1.And("T_name__icontains", T_name)
 	}
 
 	qs.Limit(page_z, offset).SetCond((*orm2.Condition)(cond1)).OrderBy("-Id").All(&map_r)
@@ -205,7 +205,7 @@ func Read_CompanyClass_All(T_pid int, T_name string) (r []CompanyClass_R) {
 	cond1 := cond.And("T_State", 1).And("T_pid", T_pid)
 
 	if len(T_name) > 0 {
-		cond1 = cond1.And("T_name", T_name)
+		cond1 = cond1.And("T_name__icontains", T_name)
 	}
 
 	qs.SetCond((*orm2.Condition)(cond1)).OrderBy("-Id").All(&map_r)

+ 10 - 8
models/Company/CompanyNotice.go

@@ -34,14 +34,15 @@ type CompanyNotice struct {
 	UpdateTime time.Time `orm:"column(update_time);type(timestamp);null;auto_now"`     //auto_now 每次 model 保存时都会对时间自动更新
 }
 type CompanyNotice_R struct {
-	T_name             string `orm:"size(256);null"`  // 分类
-	T_Notice_wx        string `orm:"type(text);null"` //w微信公众号  appid/名字|
-	T_Notice_wx2       string `orm:"type(text);null"` //w微信公众号  appid/名字|
-	T_Notice_phone     string `orm:"type(text);null"` //p手机  1111111|
-	T_Notice_message   string `orm:"type(text);null"` //m短信   1111111|
-	T_Notice_mailbox   string `orm:"type(text);null"` //e邮箱    1111111|
-	T_Notice_bind      string `orm:"type(text);null"` // 绑定T_sn,Tid|
-	T_Notice_mechanism string `orm:"type(text);null"` // 报警机制
+	Id                 int
+	T_name             string // 分类
+	T_Notice_wx        string //w微信公众号  appid/名字|
+	T_Notice_wx2       string //w微信公众号  appid/名字|
+	T_Notice_phone     string //p手机  1111111|
+	T_Notice_message   string //m短信   1111111|
+	T_Notice_mailbox   string //e邮箱    1111111|
+	T_Notice_bind      string // 绑定T_sn,Tid|
+	T_Notice_mechanism string // 报警机制
 }
 
 func (t *CompanyNotice) TableName() string {
@@ -108,6 +109,7 @@ func Redis_CompanyNotice_DelK(key string) (err error) {
 
 // ---------------- 特殊方法 -------------------
 func CompanyNoticeToCompanyNotice_R(t CompanyNotice) (r CompanyNotice_R) {
+	r.Id = t.Id
 	r.T_name = t.T_name
 	r.T_Notice_wx = t.T_Notice_wx
 	r.T_Notice_wx2 = t.T_Notice_wx2

+ 10 - 17
models/Device/Device.go

@@ -18,20 +18,19 @@ import (
 
 // 设备
 type Device struct {
-	T_sn              string    `orm:"pk;size(256);null"`     // 设备序列号
-	T_pid             int       `orm:"index;size(256);null"`  // Account.Company 绑定公司
-	T_devName         string    `orm:"size(256);null"`        // 设备名称  20字
-	T_protocol        int       `orm:"size(2);default(1)"`    // 冷链通讯协议 1 :1.0协议   2 :2.0协议    3 :3.0协议
-	T_VerifyTime      time.Time `orm:"type(timestamp);null""` // 验证时间
-	T_CalibrationTime time.Time `orm:"type(timestamp);null"`  // 校准时间
-	T_PatrolTime      time.Time `orm:"type(timestamp);null"`  // 巡检时间
-	T_ist             int       `orm:"size(2);default(1)"`    // 温度   1开启   2关闭
-	T_ish             int       `orm:"size(2);default(1)"`    // 湿度   1开启   2关闭
+	T_sn              string    `orm:"pk;size(256);null"`    // 设备序列号
+	T_pid             int       `orm:"index;size(256);null"` // Account.Company 绑定公司
+	T_devName         string    `orm:"size(256);null"`       // 设备名称  20字
+	T_protocol        int       `orm:"size(2);default(1)"`   // 冷链通讯协议 1 :1.0协议   2 :2.0协议    3 :3.0协议
+	T_VerifyTime      time.Time `orm:"type(timestamp);null"` // 验证时间
+	T_CalibrationTime time.Time `orm:"type(timestamp);null"` // 校准时间
+	T_PatrolTime      time.Time `orm:"type(timestamp);null"` // 巡检时间
+	T_ist             int       `orm:"size(2);default(1)"`   // 温度   1开启   2关闭
+	T_ish             int       `orm:"size(2);default(1)"`   // 湿度   1开启   2关闭
 
 	// 设备同步参数
 	T_Dattery  int    `orm:"size(4);null"`             // 电量
 	T_Site     string `orm:"size(200);null"`           // GPS
-	T_type     int    `orm:"index;size(4);null"`       // Device.DeviceType  1库房   2移动  ......
 	T_monitor  int    `orm:"index;size(2);null"`       // 监控状态 0 未监控 1 监控  停止记录
 	T_online   int    `orm:"index;size(2);default(1)"` // 在线状态 0 未启用  1 在线  2 离线
 	T_online_s int    `orm:"index;size(2);default(0)"` // 在线状态-备用  0 未启用  1 在线  2 离线
@@ -60,7 +59,6 @@ type Device_R struct {
 	T_ish             int    // 湿度   1开启   2关闭
 	T_Dattery         int    // 电量
 	T_Site            string // GPS
-	T_type            int    // 1库房  2移动
 	T_give            int    // 屏蔽状态 0 屏蔽  1 正常
 	T_monitor         int    // 监控状态 0 未监控 1 监控 停止记录
 	T_online          int    // 在线状态 0 未启用  1 在线  2 离线
@@ -119,7 +117,6 @@ func DeviceToDevice_R(r Device) (t Device_R) {
 	t.T_ish = r.T_ish
 	t.T_Dattery = r.T_Dattery
 	t.T_Site = r.T_Site
-	t.T_type = r.T_type
 	t.T_monitor = r.T_monitor
 	t.T_online = r.T_online
 	t.T_online_s = r.T_online_s
@@ -232,7 +229,7 @@ func Update_Device(r Device, cols ...string) bool {
 }
 
 // 获取列表
-func Read_Device_List(admin Account.Admin, T_pid int, T_name string, T_monitor string, T_online string, T_type int, page int, page_z int) (r []Device_R, cnt int64) {
+func Read_Device_List(admin Account.Admin, T_pid int, T_name string, T_monitor string, T_online string, page int, page_z int) (r []Device_R, cnt int64) {
 
 	o := orm.NewOrm()
 	// 也可以直接使用 Model 结构体作为表名
@@ -263,10 +260,6 @@ func Read_Device_List(admin Account.Admin, T_pid int, T_name string, T_monitor s
 		}
 	}
 
-	if T_type > 0 {
-		cond1 = cond1.AndCond(cond.And("T_type", T_type))
-	}
-
 	//0 未启用  1 在线  2 离线
 	if T_online == "1" {
 		cond1 = cond1.AndCond(cond.And("T_online", 1))

+ 29 - 3
models/Device/DeviceData.go

@@ -34,7 +34,7 @@ type DeviceData_ struct {
 	T_sp   int       // 传感器参数id
 	T_t    float32   // 温度
 	T_rh   float32   // 湿度
-	T_Site string    // GPS
+	T_site string    // GPS
 	T_time time.Time // 采集时间
 }
 
@@ -44,7 +44,7 @@ type DeviceData_R struct {
 	T_name string  // 传感器名称
 	T_t    float32 // 温度
 	T_rh   float32 // 湿度
-	T_Site string  // GPS
+	T_site string  // GPS
 	T_tl   float32 // 温度下限
 	T_tu   float32 // 温度上限
 	T_rhl  float32 // 湿度下限
@@ -76,7 +76,7 @@ func DeviceData_ToDeviceData_R(r DeviceData_) (t DeviceData_R) {
 	t.T_id = r.T_id
 	t.T_t = r.T_t
 	t.T_rh = r.T_rh
-	t.T_Site = r.T_Site
+	t.T_site = r.T_site
 	t.T_time = r.T_time.Format("2006-01-02 15:04:05")
 	sp := Read_DeviceSensorParameter_Map_Get(r.T_sp)
 	t.T_name = sp.T_name
@@ -417,3 +417,29 @@ func Read_DeviceData_List_GROUP_BY_t_time(SN string, Time_start_ string, Time_en
 	o.Raw(sql).ValuesList(&maps_z)
 	return maps_z
 }
+
+func Read_DeviceData(T_sn string, T_id int) (t DeviceData_R) {
+	key := T_sn + "|" + strconv.Itoa(T_id)
+	if t, is := RedisDeviceData_Get(key); is {
+		return t
+	}
+
+	o := orm.NewOrm()
+	var maps []DeviceData_R
+	sql := "SELECT t_id,t_sp,t_t,t_rh,t_site,DATE_FORMAT(t_time,'%Y-%m-%d %H:%i:%s') AS t_time,t_time AS t_time1 FROM z_device_data_" + T_sn + " WHERE " + " t_id = " + strconv.Itoa(T_id) + " ORDER BY t_time1 DESC LIMIT 0,1"
+
+	fmt.Println(sql)
+	_, err := o.Raw(sql).QueryRows(&maps)
+
+	if err != nil {
+		return t
+	}
+
+	if len(maps) == 0 {
+		return t
+	}
+
+	RedisDeviceData_Set(key, maps[0])
+
+	return t
+}

+ 21 - 8
models/Device/DeviceSensor.go

@@ -29,11 +29,11 @@ type DeviceSensor struct {
 	T_datashow int    `orm:"index;size(2);default(1)"`   // 0 屏蔽数据展示  1 正常数据展示   (屏蔽后 数据展示无法看到,设备管理中 不受影响)
 	T_sort     int    `orm:"index;size(200);default(1)"` // 排序
 	T_3dview   string `orm:"size(256);null"`             // 3D 视图ID
+	T_type     int    `orm:"index;size(4);null"`         // Device.DeviceSensorType  1库房   2移动
 
 	// 设备同步参数
 	T_Dattery  int    `orm:"size(4);null"`             // 电量
 	T_Site     string `orm:"size(200);null"`           // GPS
-	T_type     int    `orm:"index;size(4);null"`       // Device.DeviceType  1库房   2移动
 	T_monitor  int    `orm:"index;size(2);null"`       // 监控状态 0 未监控 1 监控
 	T_online   int    `orm:"index;size(2);default(1)"` // 在线状态 0 未启用  1 在线  2 离线
 	T_online_s int    `orm:"index;size(2);default(0)"` // 在线状态-备用  0 未启用  1 在线  2 离线
@@ -87,6 +87,12 @@ type DeviceSensor_P struct {
 	T_RHlower *float32 //  湿度下限
 	T_RHupper *float32 //  湿度上限
 
+	T_enprel *int     //  是否启用预警 1开启  0 关闭
+	T_tprel  *float32 //  温度预警下限
+	T_tpreu  *float32 //  温度预警上限
+	T_hprel  *float32 //  湿度预警下限
+	T_hpreu  *float32 //  温度预警上限
+
 	T_en   *int // en:是否启用传感器,
 	T_free *int // free:监测点是否为闲置状态(空库,只监测不报警)
 
@@ -160,13 +166,21 @@ func DeviceSensorToDeviceSensor_R(DeviceSensor_ DeviceSensor) (DeviceSensor_r De
 
 	DeviceSensor_r.T_datashow = DeviceSensor_.T_datashow
 
+	DeviceSensor_r.T_Dattery = DeviceSensor_.T_Dattery
+	DeviceSensor_r.T_online = DeviceSensor_.T_online
+	DeviceSensor_r.T_monitor = DeviceSensor_.T_monitor
+	if DeviceSensor_.T_online == 2 && (DeviceSensor_.T_online_s == 0 || DeviceSensor_.T_online_s == 2) && DeviceSensor_.T_monitor == 1 {
+		DeviceSensor_r.T_monitor = 2
+	}
+
 	// 最新系统参数
 	DeviceSensor_r.T_DeviceSensorParameter, _ = Read_DeviceSensorParameter(DeviceSensor_.T_sn, DeviceSensor_.T_id)
 
 	// 最新数据
-	key_data := DeviceSensor_.T_sn + "|" + strconv.Itoa(DeviceSensor_.T_id)
+	//key_data := DeviceSensor_.T_sn + "|" + strconv.Itoa(DeviceSensor_.T_id)
+	//DeviceSensor_r.T_DeviceSensorData, _ = RedisDeviceData_Get(key_data)
 
-	DeviceSensor_r.T_DeviceSensorData, _ = RedisDeviceData_Get(key_data)
+	DeviceSensor_r.T_DeviceSensorData = Read_DeviceData(DeviceSensor_.T_sn, DeviceSensor_.T_id)
 	dsp := Read_DeviceSensorParameter_Map_Get(DeviceSensor_r.T_DeviceSensorData.T_sp)
 	DeviceSensor_r.T_DeviceSensorData.T_tl = dsp.T_Tlower
 	DeviceSensor_r.T_DeviceSensorData.T_tu = dsp.T_Tupper
@@ -646,7 +660,6 @@ func Update_Device_To_DeviceSensor(r_Device Device) bool {
 		// 设备同步参数
 		v.T_Dattery = r_Device.T_Dattery   // 电量
 		v.T_Site = r_Device.T_Site         // GPS
-		v.T_type = r_Device.T_type         // 1库房   2移动
 		v.T_monitor = r_Device.T_monitor   // 监控状态 0 未监控 1 监控
 		v.T_online = r_Device.T_online     // 在线状态 0 未启用  1 在线  2 离线
 		v.T_online_s = r_Device.T_online_s // 在线状态-备用  0 未启用  1 在线  2 离线
@@ -702,9 +715,9 @@ func Read_DeviceSensorManageList(admin_r Account.Admin, T_pid int, T_name string
 
 	// -------------
 	sql := "SELECT COUNT(ds.ID) FROM " + "device_sensor ds " +
-		"LEFT JOIN ( SELECT t_sn,t_id,t_en,t_free,t__tlower,t__tupper,t__r_hlower,t__r_hupper " +
+		"LEFT JOIN ( SELECT t_sn AS tsn,t_id AS tid,t_en " +
 		"FROM device_sensor_parameter WHERE id IN (SELECT MAX(id) FROM device_sensor_parameter GROUP BY t_sn,t_id)) AS dsp " +
-		"ON ds.t_sn = dsp.t_sn AND ds.t_id = dsp.t_id" + " WHERE " + sql_WHERE
+		"ON ds.t_sn = dsp.tsn AND ds.t_id = dsp.tid" + " WHERE " + sql_WHERE
 	fmt.Println(sql)
 	_, err := o.Raw(sql).ValuesList(&maps_z)
 	if err != nil {
@@ -715,9 +728,9 @@ func Read_DeviceSensorManageList(admin_r Account.Admin, T_pid int, T_name string
 	}
 	//fmt.Println("maps_z;",maps_z[0][0])
 	sql = "SELECT * FROM device_sensor ds " +
-		"LEFT JOIN ( SELECT t_sn,t_id,t_en,t_free,t__tlower,t__tupper,t__r_hlower,t__r_hupper " +
+		"LEFT JOIN ( SELECT t_sn AS tsn,t_id AS tid,t_en,t_free,t__tlower,t__tupper,t__r_hlower,t__r_hupper,t_enprel,t_tprel,t_tpreu,t_hprel,t_hpreu " +
 		"FROM device_sensor_parameter WHERE id IN (SELECT MAX(id) FROM device_sensor_parameter GROUP BY t_sn,t_id)) AS dsp " +
-		"ON ds.t_sn = dsp.t_sn AND ds.t_id = dsp.t_id " +
+		"ON ds.t_sn = dsp.tsn AND ds.t_id = dsp.tid " +
 		"WHERE " + sql_WHERE + sql_ORDER
 
 	if page_z != 9999 {

+ 6 - 6
models/Device/DeviceType.go → models/Device/DeviceSensorType.go

@@ -6,7 +6,7 @@ import (
 )
 
 // 设备类型: 1库房   2移动  。。。
-type DeviceType struct {
+type DeviceSensorType struct {
 	Id int `orm:"column(ID);size(11);auto;pk"`
 
 	T_name string `orm:"size(256);null"`     // 标题
@@ -16,20 +16,20 @@ type DeviceType struct {
 	T_State int `orm:"size(2);default(1)"` // 0 删除   1 正常
 }
 
-func (t *DeviceType) TableName() string {
-	return "device_type" // 数据库名称   // ************** 替换 FormulaList **************
+func (t *DeviceSensorType) TableName() string {
+	return "device_sensor_type" // 数据库名称   // ************** 替换 FormulaList **************
 }
 
 func init() {
 	//注册模型
-	orm.RegisterModel(new(DeviceType))
+	orm.RegisterModel(new(DeviceSensorType))
 }
 
-func Read_DeviceType_List_All() (r []DeviceType) {
+func Read_DeviceType_List_All() (r []DeviceSensorType) {
 
 	o := orm.NewOrm()
 	// 也可以直接使用 Model 结构体作为表名
-	qs := o.QueryTable(new(DeviceType))
+	qs := o.QueryTable(new(DeviceSensorType))
 	qs.Filter("T_State", 1).All(&r)
 
 	return r

+ 1 - 1
models/Device/DeviceTask.go

@@ -43,7 +43,7 @@ func Read_DeviceTask_All_Limit_1(T_sn string) (DeviceTask, bool) {
 }
 
 // 获取全部
-func Read_DeviceTask_All(T_sn string, Time_start string, Time_end string, page int, page_z int) (r_l []DeviceTask, cnt int64) {
+func Read_DeviceTask_List(T_sn string, Time_start string, Time_end string, page int, page_z int) (r_l []DeviceTask, cnt int64) {
 	o := orm.NewOrm()
 	qs := o.QueryTable(new(DeviceTask))
 	var offset int64

+ 1 - 1
models/System/UserLogs.go

@@ -75,7 +75,7 @@ func Read_UserLogs_ALL(Logs_uuid string, Logs_class string, page int, page_z int
 func Read_UserLogs_Class() (lists orm2.ParamsList) {
 	o := orm.NewOrm()
 	var pl_lists orm2.ParamsList
-	num, err := o.Raw("SELECT DISTINCT logs_class FROM UserLogs LIMIT 0,1000").ValuesFlat(&pl_lists)
+	num, err := o.Raw("SELECT DISTINCT logs_class FROM user_logs LIMIT 0,1000").ValuesFlat(&pl_lists)
 	if err == nil {
 		fmt.Println("user nums: ", num)
 	}

+ 1 - 0
models/Warning/Warning.go

@@ -24,6 +24,7 @@ type Warning struct {
 	T_DS_name string    `orm:"size(256);null"`              // 传感器名称
 	T_Remark  string    `orm:"type(text);null"`             // 采集内容
 	T_Ut      time.Time `orm:"index;type(timestamp);null;"` // 采集时间
+	T_fUt     time.Time `orm:"type(timestamp);null;"`       // 首次采集时间
 
 	T_Text string `orm:"type(text);null"` // 处理备注
 	T_Log  string `orm:"type(text);null"` // 通知日志

+ 6 - 6
routers/filter.go

@@ -3,9 +3,9 @@ package routers
 import (
 	"Cold_Api/conf"
 	"Cold_Api/controllers/lib"
+	"Cold_Api/logs"
 	"Cold_Api/models/Account"
 	"github.com/beego/beego/v2/server/web/context"
-	"log"
 	"strings"
 )
 
@@ -87,9 +87,9 @@ func T_pidFilter(ctx *context.Context) {
 		T_pid, _ = Account.Redis_Tokey_T_pid_Get(User_tokey)
 	}
 	// fixme 如果逻辑正常,不需要做pid验证
-	//if T_pid == 0 {
-	//	data := lib.JSONS{Code: 202, Msg: "T_pid Err!"}
-	//	ctx.Output.JSON(data, true, false)
-	//}
-	log.Println("T_pid", T_pid)
+	if T_pid == 0 {
+		data := lib.JSONS{Code: 202, Msg: "T_pid Err!"}
+		ctx.Output.JSON(data, true, false)
+	}
+	logs.Println("T_pid", T_pid)
 }

+ 4 - 0
routers/router.go

@@ -17,6 +17,10 @@ func init() {
 	beego.Router(version+"/System/LogsClass", &controllers.LogsController{}, "*:LogsClass") // 获取未读消息
 	beego.Router(version+"/System/LogsList", &controllers.LogsController{}, "*:LogsList")   // 获取未读消息
 
+	// 操作日志
+	beego.Router(version+"/System/UserLogsClass", &controllers.LogsController{}, "*:UserLogsClass") // 获取未读消息
+	beego.Router(version+"/System/UserLogsList", &controllers.LogsController{}, "*:UserLogsList")   // 获取未读消息
+
 	//初始化配置 不鉴权的URL和只鉴权登录的URL
 	InitSetFilterUrl()
 	//过滤器,拦截所有请求