|
@@ -18,6 +18,17 @@ import (
|
|
|
|
|
|
type UserController struct {
|
|
type UserController struct {
|
|
beego.Controller
|
|
beego.Controller
|
|
|
|
+ Admin_r Account.Admin // 登陆的用户
|
|
|
|
+ T_pid int // 公司id
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (c *UserController) Prepare() {
|
|
|
|
+ c.Admin_r = lib.Admin_r
|
|
|
|
+ T_pid := c.Admin_r.T_pid
|
|
|
|
+ if T_pid == 0 {
|
|
|
|
+ T_pid, _ = strconv.Atoi(c.Ctx.Request.Header.Get("T_pid"))
|
|
|
|
+ }
|
|
|
|
+ c.T_pid = T_pid
|
|
}
|
|
}
|
|
|
|
|
|
// 获取微信二维码 ( 扫描后 ,Nats 自动绑定在 Admin->T_wx )
|
|
// 获取微信二维码 ( 扫描后 ,Nats 自动绑定在 Admin->T_wx )
|
|
@@ -40,18 +51,10 @@ func (c *UserController) User_WxQRCode() {
|
|
|
|
|
|
// 公司管理
|
|
// 公司管理
|
|
func (c *UserController) Company_Tree() {
|
|
func (c *UserController) Company_Tree() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
var r_jsons lib.R_JSONS
|
|
var r_jsons lib.R_JSONS
|
|
|
|
|
|
T_name := c.GetString("T_name")
|
|
T_name := c.GetString("T_name")
|
|
- r_jsons.Data, r_jsons.Num = Account.Read_Company_Tree(admin_r, T_name)
|
|
|
|
|
|
+ r_jsons.Data, r_jsons.Num = Account.Read_Company_Tree(c.Admin_r, T_name)
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -81,15 +84,6 @@ func (c *UserController) Company_List() {
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) Company_Add() {
|
|
func (c *UserController) Company_Add() {
|
|
-
|
|
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
T_mid, _ := c.GetInt("T_mid")
|
|
T_mid, _ := c.GetInt("T_mid")
|
|
T_name := c.GetString("T_name")
|
|
T_name := c.GetString("T_name")
|
|
|
|
|
|
@@ -106,7 +100,7 @@ func (c *UserController) Company_Add() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "公司管理", "添加", var_)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "公司管理", "添加", var_)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: id}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: id}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
@@ -114,13 +108,6 @@ func (c *UserController) Company_Add() {
|
|
|
|
|
|
func (c *UserController) Company_Edit() {
|
|
func (c *UserController) Company_Edit() {
|
|
|
|
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
Id, Id_err := c.GetInt("Id")
|
|
Id, Id_err := c.GetInt("Id")
|
|
if Id_err != nil {
|
|
if Id_err != nil {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id Err!"}
|
|
@@ -152,7 +139,7 @@ func (c *UserController) Company_Edit() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "公司管理", "修改", Company_r)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "公司管理", "修改", Company_r)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
@@ -160,13 +147,6 @@ func (c *UserController) Company_Edit() {
|
|
|
|
|
|
func (c *UserController) Company_Del() {
|
|
func (c *UserController) Company_Del() {
|
|
|
|
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
Id, Id_err := c.GetInt("Id")
|
|
Id, Id_err := c.GetInt("Id")
|
|
if Id_err != nil {
|
|
if Id_err != nil {
|
|
c.Data["json"] = lib.JSONS{Code: 204, Msg: "Id Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 204, Msg: "Id Err!"}
|
|
@@ -188,7 +168,7 @@ func (c *UserController) Company_Del() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "公司管理", "删除", Company_r)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "公司管理", "删除", Company_r)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
@@ -198,13 +178,6 @@ func (c *UserController) Company_Del() {
|
|
|
|
|
|
// 用户管理
|
|
// 用户管理
|
|
func (c *UserController) User_List() {
|
|
func (c *UserController) User_List() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
|
|
|
|
var r_jsons lib.R_JSONS
|
|
var r_jsons lib.R_JSONS
|
|
|
|
|
|
@@ -237,14 +210,6 @@ func (c *UserController) User_List() {
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) User_Get() {
|
|
func (c *UserController) User_Get() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
T_uuid := c.GetString("T_uuid")
|
|
T_uuid := c.GetString("T_uuid")
|
|
if len(T_uuid) < 8 {
|
|
if len(T_uuid) < 8 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
@@ -264,14 +229,6 @@ func (c *UserController) User_Get() {
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) User_Info() {
|
|
func (c *UserController) User_Info() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
type User_ struct {
|
|
type User_ struct {
|
|
User Account.Admin_R
|
|
User Account.Admin_R
|
|
//Power Account.Power // 权限
|
|
//Power Account.Power // 权限
|
|
@@ -280,7 +237,7 @@ func (c *UserController) User_Info() {
|
|
}
|
|
}
|
|
|
|
|
|
Admin_r := User_{}
|
|
Admin_r := User_{}
|
|
- Admin_r.User = Account.AdminToAdmin_R(admin_r)
|
|
|
|
|
|
+ Admin_r.User = Account.AdminToAdmin_R(c.Admin_r)
|
|
//Admin_r.Power, _ = Account.Read_Power_ById(admin_r.T_power)
|
|
//Admin_r.Power, _ = Account.Read_Power_ById(admin_r.T_power)
|
|
//Admin_r.Menu = Account.Read_Menu_Tree(Power.T_menu, T_pid)
|
|
//Admin_r.Menu = Account.Read_Menu_Tree(Power.T_menu, T_pid)
|
|
|
|
|
|
@@ -290,14 +247,7 @@ func (c *UserController) User_Info() {
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) User_Post() {
|
|
func (c *UserController) User_Post() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ admin_r := c.Admin_r
|
|
T_name := c.GetString("T_name")
|
|
T_name := c.GetString("T_name")
|
|
T_pass := c.GetString("T_pass")
|
|
T_pass := c.GetString("T_pass")
|
|
T_phone := c.GetString("T_phone")
|
|
T_phone := c.GetString("T_phone")
|
|
@@ -331,7 +281,7 @@ func (c *UserController) User_Post() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
admin_r.T_pass = "******"
|
|
admin_r.T_pass = "******"
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "用户管理", "修改个人信息", admin_r)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "用户管理", "修改个人信息", admin_r)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
@@ -339,14 +289,6 @@ func (c *UserController) User_Post() {
|
|
|
|
|
|
func (c *UserController) User_Add() {
|
|
func (c *UserController) User_Add() {
|
|
|
|
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
T_power, _ := c.GetInt("T_power")
|
|
T_power, _ := c.GetInt("T_power")
|
|
T_pid, _ := c.GetInt("T_pid")
|
|
T_pid, _ := c.GetInt("T_pid")
|
|
T_name := c.GetString("T_name")
|
|
T_name := c.GetString("T_name")
|
|
@@ -394,7 +336,7 @@ func (c *UserController) User_Add() {
|
|
}
|
|
}
|
|
|
|
|
|
var_.T_pass = "******"
|
|
var_.T_pass = "******"
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "用户管理", "添加", var_)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "用户管理", "添加", var_)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
@@ -402,13 +344,6 @@ func (c *UserController) User_Add() {
|
|
|
|
|
|
func (c *UserController) User_Edit() {
|
|
func (c *UserController) User_Edit() {
|
|
|
|
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
T_uuid := c.GetString("T_uuid")
|
|
T_uuid := c.GetString("T_uuid")
|
|
if len(T_uuid) < 8 {
|
|
if len(T_uuid) < 8 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
@@ -461,21 +396,13 @@ func (c *UserController) User_Edit() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
r.T_pass = "******"
|
|
r.T_pass = "******"
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "用户管理", "编辑", r)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "用户管理", "编辑", r)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) User_Del() {
|
|
func (c *UserController) User_Del() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
T_uuid := c.GetString("T_uuid")
|
|
T_uuid := c.GetString("T_uuid")
|
|
if len(T_uuid) <= 0 {
|
|
if len(T_uuid) <= 0 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
@@ -494,7 +421,7 @@ func (c *UserController) User_Del() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "用户管理", "删除", T_uuid)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "用户管理", "删除", T_uuid)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
@@ -504,12 +431,7 @@ func (c *UserController) User_Del() {
|
|
// 管理员
|
|
// 管理员
|
|
func (c *UserController) User_Home() {
|
|
func (c *UserController) User_Home() {
|
|
// 验证登录
|
|
// 验证登录
|
|
- 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
|
|
|
|
- }
|
|
|
|
|
|
+ admin_r := c.Admin_r
|
|
|
|
|
|
type Info struct {
|
|
type Info struct {
|
|
T_name string // 姓名
|
|
T_name string // 姓名
|
|
@@ -549,14 +471,6 @@ func (c *UserController) User_Home() {
|
|
|
|
|
|
// 内部用户管理
|
|
// 内部用户管理
|
|
func (c *UserController) Admin_List() {
|
|
func (c *UserController) Admin_List() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
var r_jsons lib.R_JSONS
|
|
var r_jsons lib.R_JSONS
|
|
|
|
|
|
page, _ := c.GetInt("page")
|
|
page, _ := c.GetInt("page")
|
|
@@ -582,14 +496,6 @@ func (c *UserController) Admin_List() {
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) Admin_Get() {
|
|
func (c *UserController) Admin_Get() {
|
|
- // 验证登录
|
|
|
|
- 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_uuid := c.GetString("T_uuid")
|
|
T_uuid := c.GetString("T_uuid")
|
|
if len(T_uuid) < 8 {
|
|
if len(T_uuid) < 8 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
@@ -609,15 +515,6 @@ func (c *UserController) Admin_Get() {
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) Admin_Add() {
|
|
func (c *UserController) Admin_Add() {
|
|
-
|
|
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
T_power, _ := c.GetInt("T_power")
|
|
T_power, _ := c.GetInt("T_power")
|
|
T_name := c.GetString("T_name")
|
|
T_name := c.GetString("T_name")
|
|
T_user := c.GetString("T_user")
|
|
T_user := c.GetString("T_user")
|
|
@@ -660,21 +557,13 @@ func (c *UserController) Admin_Add() {
|
|
}
|
|
}
|
|
|
|
|
|
var_.T_pass = "******"
|
|
var_.T_pass = "******"
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "用户管理", "添加", var_)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "用户管理", "添加", var_)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) Admin_Edit() {
|
|
func (c *UserController) Admin_Edit() {
|
|
-
|
|
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
T_uuid := c.GetString("T_uuid")
|
|
T_uuid := c.GetString("T_uuid")
|
|
if len(T_uuid) < 8 {
|
|
if len(T_uuid) < 8 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
@@ -727,21 +616,13 @@ func (c *UserController) Admin_Edit() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
r.T_pass = "********"
|
|
r.T_pass = "********"
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "用户管理", "编辑", r)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "用户管理", "编辑", r)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) Admin_Del() {
|
|
func (c *UserController) Admin_Del() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
T_uuid := c.GetString("T_uuid")
|
|
T_uuid := c.GetString("T_uuid")
|
|
if len(T_uuid) <= 0 {
|
|
if len(T_uuid) <= 0 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
@@ -760,7 +641,7 @@ func (c *UserController) Admin_Del() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "用户管理", "删除", T_uuid)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "用户管理", "删除", T_uuid)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
@@ -769,14 +650,6 @@ func (c *UserController) Admin_Del() {
|
|
|
|
|
|
// 报警通知的用户列表
|
|
// 报警通知的用户列表
|
|
func (c *UserController) User_Notice_List() {
|
|
func (c *UserController) User_Notice_List() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
type R_JSONS struct {
|
|
type R_JSONS struct {
|
|
//必须的大写开头
|
|
//必须的大写开头
|
|
AdminList []Account.Admin_R
|
|
AdminList []Account.Admin_R
|
|
@@ -785,15 +658,16 @@ func (c *UserController) User_Notice_List() {
|
|
|
|
|
|
var r_jsons R_JSONS
|
|
var r_jsons R_JSONS
|
|
|
|
|
|
- T_pid := admin_r.T_pid
|
|
|
|
- if T_pid == 0 {
|
|
|
|
- T_pid, _ = strconv.Atoi(c.Ctx.Request.Header.Get("T_pid"))
|
|
|
|
|
|
+ if c.T_pid == 0 {
|
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_pid Err!"}
|
|
|
|
+ c.ServeJSON()
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
|
|
// 绑定公司id的内部用户列表
|
|
// 绑定公司id的内部用户列表
|
|
- r_jsons.AdminList = Account.Read_Admin_List_T_pids(T_pid)
|
|
|
|
|
|
+ r_jsons.AdminList = Account.Read_Admin_List_T_pids(c.T_pid)
|
|
// 绑定公司id的公司用户列表
|
|
// 绑定公司id的公司用户列表
|
|
- r_jsons.UserList = Account.Read_Admin_List_T_pid(T_pid)
|
|
|
|
|
|
+ r_jsons.UserList = Account.Read_Admin_List_T_pid(c.T_pid)
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -841,14 +715,6 @@ func (c *UserController) AdminCompanyBind_List() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
func (c *UserController) AdminCompanyBind_Add() {
|
|
func (c *UserController) AdminCompanyBind_Add() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
T_uuid := c.GetString("T_uuid")
|
|
T_uuid := c.GetString("T_uuid")
|
|
if len(T_uuid) < 8 {
|
|
if len(T_uuid) < 8 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
@@ -880,20 +746,12 @@ func (c *UserController) AdminCompanyBind_Add() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs(admin_r.T_uuid, "内部用户管理", "公司绑定添加", T_uuid+"-"+strconv.Itoa(T_pid))
|
|
|
|
|
|
+ System.Add_UserLogs(c.Admin_r.T_uuid, "内部用户管理", "公司绑定添加", T_uuid+"-"+strconv.Itoa(T_pid))
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
func (c *UserController) AdminCompanyBind_Del() {
|
|
func (c *UserController) AdminCompanyBind_Del() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
T_uuid := c.GetString("T_uuid")
|
|
T_uuid := c.GetString("T_uuid")
|
|
if len(T_uuid) < 8 {
|
|
if len(T_uuid) < 8 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_uuid Err!"}
|
|
@@ -925,7 +783,7 @@ func (c *UserController) AdminCompanyBind_Del() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs(admin_r.T_uuid, "内部用户管理", "公司绑定删除", T_uuid+"-"+strconv.Itoa(T_pid))
|
|
|
|
|
|
+ System.Add_UserLogs(c.Admin_r.T_uuid, "内部用户管理", "公司绑定删除", T_uuid+"-"+strconv.Itoa(T_pid))
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
@@ -933,14 +791,6 @@ func (c *UserController) AdminCompanyBind_Del() {
|
|
|
|
|
|
// 权限管理
|
|
// 权限管理
|
|
func (c *UserController) Power_List() {
|
|
func (c *UserController) Power_List() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
var r_jsons lib.R_JSONS
|
|
var r_jsons lib.R_JSONS
|
|
|
|
|
|
page, _ := c.GetInt("page")
|
|
page, _ := c.GetInt("page")
|
|
@@ -966,15 +816,7 @@ func (c *UserController) Power_List() {
|
|
|
|
|
|
// 权限管理
|
|
// 权限管理
|
|
func (c *UserController) Power_List_All() {
|
|
func (c *UserController) Power_List_All() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- r, err := Account.Read_Power_ById(admin_r.T_power)
|
|
|
|
|
|
+ r, err := Account.Read_Power_ById(c.Admin_r.T_power)
|
|
if err != nil {
|
|
if err != nil {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id Err!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -991,13 +833,6 @@ func (c *UserController) Power_List_All() {
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) Power_Get() {
|
|
func (c *UserController) Power_Get() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
type Data struct {
|
|
type Data struct {
|
|
Power Account.Power_
|
|
Power Account.Power_
|
|
Menu []Account.Menu
|
|
Menu []Account.Menu
|
|
@@ -1060,14 +895,6 @@ func (c *UserController) Power_Get() {
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) Power_Add() {
|
|
func (c *UserController) Power_Add() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
T_name := c.GetString("T_name")
|
|
T_name := c.GetString("T_name")
|
|
T_select := c.GetString("T_select")
|
|
T_select := c.GetString("T_select")
|
|
T_warning := c.GetString("T_warning")
|
|
T_warning := c.GetString("T_warning")
|
|
@@ -1088,20 +915,13 @@ func (c *UserController) Power_Add() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "权限管理", "添加", var_)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "权限管理", "添加", var_)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) Power_Edit() {
|
|
func (c *UserController) Power_Edit() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
Id, Id_err := c.GetInt("T_id")
|
|
Id, Id_err := c.GetInt("T_id")
|
|
if Id_err != nil || Id == 0 {
|
|
if Id_err != nil || Id == 0 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id Err!"}
|
|
@@ -1143,20 +963,13 @@ func (c *UserController) Power_Edit() {
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- System.Add_UserLogs_T(admin_r.T_uuid, "权限管理", "修改", r)
|
|
|
|
|
|
+ System.Add_UserLogs_T(c.Admin_r.T_uuid, "权限管理", "修改", r)
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (c *UserController) Power_Del() {
|
|
func (c *UserController) Power_Del() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
id, id_err := c.GetInt("T_id")
|
|
id, id_err := c.GetInt("T_id")
|
|
if id_err != nil || id == 0 {
|
|
if id_err != nil || id == 0 {
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id Err!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id Err!"}
|
|
@@ -1177,7 +990,7 @@ func (c *UserController) Power_Del() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- System.Add_UserLogs(admin_r.T_uuid, "权限管理", "删除", strconv.Itoa(id))
|
|
|
|
|
|
+ System.Add_UserLogs(c.Admin_r.T_uuid, "权限管理", "删除", strconv.Itoa(id))
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
@@ -1185,28 +998,15 @@ func (c *UserController) Power_Del() {
|
|
|
|
|
|
// 菜单列表
|
|
// 菜单列表
|
|
func (c *UserController) User_Menu_List() {
|
|
func (c *UserController) User_Menu_List() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- T_pid := admin_r.T_pid
|
|
|
|
- if T_pid == 0 {
|
|
|
|
- T_pid, _ = strconv.Atoi(c.Ctx.Request.Header.Get("T_pid"))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
var r_jsons lib.R_JSONS
|
|
var r_jsons lib.R_JSONS
|
|
- power, err := Account.Read_Power_ById(admin_r.T_power)
|
|
|
|
|
|
+ power, err := Account.Read_Power_ById(c.Admin_r.T_power)
|
|
if err != nil {
|
|
if err != nil {
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "获取菜单失败"}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "获取菜单失败"}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- r_jsons.Data = Account.Read_Menu_Bind_List(power.T_menu, T_pid)
|
|
|
|
|
|
+ r_jsons.Data = Account.Read_Menu_Bind_List(power.T_menu, c.T_pid)
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
@@ -1215,14 +1015,6 @@ func (c *UserController) User_Menu_List() {
|
|
|
|
|
|
// 权限菜单列表
|
|
// 权限菜单列表
|
|
func (c *UserController) Menu_List_All() {
|
|
func (c *UserController) Menu_List_All() {
|
|
- // 验证登录
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
var r_jsons lib.R_JSONS
|
|
var r_jsons lib.R_JSONS
|
|
|
|
|
|
r_jsons.Data, _ = Account.Read_Menu_List_All()
|
|
r_jsons.Data, _ = Account.Read_Menu_List_All()
|