|
@@ -38,7 +38,6 @@ func (c *CertificateController) List() {
|
|
|
T_layout_no := c.GetString("T_layout_no")
|
|
T_layout_no := c.GetString("T_layout_no")
|
|
|
Time_start := c.GetString("Time_start")
|
|
Time_start := c.GetString("Time_start")
|
|
|
Time_end := c.GetString("Time_end")
|
|
Time_end := c.GetString("Time_end")
|
|
|
- T_layout_no_sort, _ := c.GetInt("T_layout_no_sort") // 1 升序 2 降序
|
|
|
|
|
T_release_time_sort, _ := c.GetInt("T_release_time_sort") // 1 升序 2 降序
|
|
T_release_time_sort, _ := c.GetInt("T_release_time_sort") // 1 升序 2 降序
|
|
|
T_failure_time_sort, _ := c.GetInt("T_failure_time_sort") // 1 升序 2 降序
|
|
T_failure_time_sort, _ := c.GetInt("T_failure_time_sort") // 1 升序 2 降序
|
|
|
|
|
|
|
@@ -55,7 +54,7 @@ func (c *CertificateController) List() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var cnt int
|
|
var cnt int
|
|
|
- List, cnt := Certificate.Read_Certificate_List(T_sn, T_layout_no, Time_start, Time_end, T_layout_no_sort, T_release_time_sort, T_failure_time_sort, page, page_z)
|
|
|
|
|
|
|
+ List, cnt := Certificate.Read_Certificate_List(T_sn, T_layout_no, Time_start, Time_end, T_release_time_sort, T_failure_time_sort, page, page_z)
|
|
|
page_size := math.Ceil(float64(cnt) / float64(page_z))
|
|
page_size := math.Ceil(float64(cnt) / float64(page_z))
|
|
|
r_jsons.List = List
|
|
r_jsons.List = List
|
|
|
r_jsons.Page = page
|
|
r_jsons.Page = page
|
|
@@ -113,12 +112,10 @@ func (c *CertificateController) Add() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
T_sn := c.GetString("T_sn")
|
|
T_sn := c.GetString("T_sn")
|
|
|
- T_layout_no := c.GetString("T_layout_no")
|
|
|
|
|
|
|
|
|
|
var_ := Certificate.Certificate{
|
|
var_ := Certificate.Certificate{
|
|
|
- T_sn: T_sn,
|
|
|
|
|
- T_layout_no: T_layout_no,
|
|
|
|
|
- T_State: 1,
|
|
|
|
|
|
|
+ T_sn: T_sn,
|
|
|
|
|
+ T_State: 1,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if _, is := Certificate.Read_Certificate(T_sn); is {
|
|
if _, is := Certificate.Read_Certificate(T_sn); is {
|
|
@@ -126,11 +123,6 @@ func (c *CertificateController) Add() {
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- if _, is := Certificate.Read_Certificate_ByT_layout_no(T_layout_no); is {
|
|
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "布局编号重复!"}
|
|
|
|
|
- c.ServeJSON()
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
Id, is := Certificate.Add_Certificate(var_)
|
|
Id, is := Certificate.Add_Certificate(var_)
|
|
|
if !is {
|
|
if !is {
|
|
@@ -170,21 +162,14 @@ func (c *CertificateController) Edit() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
T_sn := c.GetString("T_sn")
|
|
T_sn := c.GetString("T_sn")
|
|
|
- T_layout_no := c.GetString("T_layout_no")
|
|
|
|
|
|
|
|
|
|
if _, is = Certificate.Read_Certificate(T_sn); is && r.T_sn != T_sn {
|
|
if _, is = Certificate.Read_Certificate(T_sn); is && r.T_sn != T_sn {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "设备编号重复!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "设备编号重复!"}
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- if _, is = Certificate.Read_Certificate_ByT_layout_no(T_layout_no); is && r.T_layout_no != T_layout_no {
|
|
|
|
|
- c.Data["json"] = lib.JSONS{Code: 202, Msg: "布局编号重复!"}
|
|
|
|
|
- c.ServeJSON()
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
r.T_sn = T_sn
|
|
r.T_sn = T_sn
|
|
|
- r.T_layout_no = T_layout_no
|
|
|
|
|
- is = Certificate.Update_Certificate(r, "T_sn", "T_layout_no")
|
|
|
|
|
|
|
+ is = Certificate.Update_Certificate(r, "T_sn")
|
|
|
if !is {
|
|
if !is {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "添加失败!"}
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "添加失败!"}
|
|
|
c.ServeJSON()
|
|
c.ServeJSON()
|