|
@@ -4,6 +4,7 @@ import (
|
|
|
"Cold_GoodsOrder/Nats/NatsServer"
|
|
|
"Cold_GoodsOrder/conf"
|
|
|
"Cold_GoodsOrder/lib"
|
|
|
+ "Cold_GoodsOrder/models/Account"
|
|
|
"Cold_GoodsOrder/models/Device"
|
|
|
"Cold_GoodsOrder/models/Function"
|
|
|
"fmt"
|
|
@@ -23,13 +24,6 @@ type GoodsOrderController struct {
|
|
|
}
|
|
|
|
|
|
func (c *GoodsOrderController) GoodsOrder_List() {
|
|
|
- // 验证登录
|
|
|
- b_, admin_r := NatsServer.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 {
|
|
|
//必须的大写开头
|
|
|
Data []Function.GoodsOrderR
|
|
@@ -50,7 +44,7 @@ func (c *GoodsOrderController) GoodsOrder_List() {
|
|
|
page_z = conf.Page_size
|
|
|
}
|
|
|
|
|
|
- T_pid := admin_r.T_pid
|
|
|
+ T_pid := Account.User_r.T_pid
|
|
|
if T_pid == 0 {
|
|
|
T_pid, _ = c.GetInt("T_pid")
|
|
|
}
|
|
@@ -67,15 +61,9 @@ func (c *GoodsOrderController) GoodsOrder_List() {
|
|
|
return
|
|
|
}
|
|
|
func (c *GoodsOrderController) GoodsOrder_Get() {
|
|
|
- // 验证登录
|
|
|
- b_, admin_r := NatsServer.Verification(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
- if !b_ {
|
|
|
- c.Ctx.Redirect(302, "Login")
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
id, _ := c.GetInt("T_id")
|
|
|
- T_pid := admin_r.T_pid
|
|
|
+ T_pid := Account.User_r.T_pid
|
|
|
if T_pid == 0 {
|
|
|
T_pid, _ = c.GetInt("T_pid")
|
|
|
}
|
|
@@ -98,13 +86,6 @@ func (c *GoodsOrderController) GoodsOrder_Get() {
|
|
|
return
|
|
|
}
|
|
|
func (c *GoodsOrderController) GoodsOrder_Add() {
|
|
|
- // 验证登录
|
|
|
- b_, admin_r := NatsServer.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_orderid := c.GetString("T_orderid")
|
|
|
T_outorderid := c.GetString("T_outorderid")
|
|
@@ -120,7 +101,7 @@ func (c *GoodsOrderController) GoodsOrder_Add() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- T_pid := admin_r.T_pid
|
|
|
+ T_pid := Account.User_r.T_pid
|
|
|
if T_pid == 0 {
|
|
|
T_pid, _ = c.GetInt("T_pid")
|
|
|
}
|
|
@@ -152,24 +133,17 @@ func (c *GoodsOrderController) GoodsOrder_Add() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- NatsServer.AddUserLogs(admin_r.T_uuid, "订单系统", "添加", var_)
|
|
|
+ NatsServer.AddUserLogs(Account.User_r.T_uuid, "订单系统", "添加", var_)
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: id}
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
|
|
|
}
|
|
|
func (c *GoodsOrderController) GoodsOrder_Edit() {
|
|
|
- // 验证登录
|
|
|
- b_, admin_r := NatsServer.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, _ := c.GetInt("T_id")
|
|
|
|
|
|
- T_pid := admin_r.T_pid
|
|
|
+ T_pid := Account.User_r.T_pid
|
|
|
if T_pid == 0 {
|
|
|
T_pid, _ = c.GetInt("T_pid")
|
|
|
}
|
|
@@ -240,7 +214,7 @@ func (c *GoodsOrderController) GoodsOrder_Edit() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- NatsServer.AddUserLogs(admin_r.T_uuid, "订单系统", "修改", r)
|
|
|
+ NatsServer.AddUserLogs(Account.User_r.T_uuid, "订单系统", "修改", r)
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
@@ -249,16 +223,9 @@ func (c *GoodsOrderController) GoodsOrder_Edit() {
|
|
|
}
|
|
|
|
|
|
func (c *GoodsOrderController) GoodsOrder_Del() {
|
|
|
- // 验证登录
|
|
|
- b_, admin_r := NatsServer.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, _ := c.GetInt("T_id")
|
|
|
- T_pid := admin_r.T_pid
|
|
|
+ T_pid := Account.User_r.T_pid
|
|
|
if T_pid == 0 {
|
|
|
T_pid, _ = c.GetInt("T_pid")
|
|
|
}
|
|
@@ -280,7 +247,7 @@ func (c *GoodsOrderController) GoodsOrder_Del() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- NatsServer.AddUserLogs(admin_r.T_uuid, "订单系统", "删除", r)
|
|
|
+ NatsServer.AddUserLogs(Account.User_r.T_uuid, "订单系统", "删除", r)
|
|
|
|
|
|
c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
|
|
|
c.ServeJSON()
|
|
@@ -291,13 +258,6 @@ func (c *GoodsOrderController) GoodsOrder_Del() {
|
|
|
// 列表 - 接口
|
|
|
func (c *GoodsOrderController) GoodsOrder_PDF() {
|
|
|
var err error
|
|
|
- // 验证登录
|
|
|
- b_, user_r := NatsServer.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, _ := c.GetInt("T_id")
|
|
|
if Id == 0 {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id e!"}
|
|
@@ -360,10 +320,10 @@ func (c *GoodsOrderController) GoodsOrder_PDF() {
|
|
|
//use path
|
|
|
//pdf.Image("logo.png", 100, 50, &gopdf.Rect{W: 50, H: 50})
|
|
|
|
|
|
- textw, _ := pdf.MeasureTextWidth(user_r.T_name)
|
|
|
+ textw, _ := pdf.MeasureTextWidth(Account.User_r.T_name)
|
|
|
pdf.SetX((595 / 2) - (textw / 2))
|
|
|
pdf.SetY(40)
|
|
|
- pdf.Text(user_r.T_name)
|
|
|
+ pdf.Text(Account.User_r.T_name)
|
|
|
|
|
|
// 线
|
|
|
pdf.SetLineWidth(2)
|