hotime/example/app/produce_product.go

47 lines
949 B
Go
Raw Normal View History

2021-12-11 15:53:47 +00:00
package app
import (
. "../../../hotime"
. "../../../hotime/common"
)
var produce_productCtr = Ctr{
"info": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
id := ObjToInt(that.Req.FormValue("id"))
sn := that.Req.FormValue("sn")
if id == 0 && sn == "" {
that.Display(3, "请求参数不足,请检查参数")
return
}
where := Map{}
if id != 0 {
where["id"] = id
} else {
where["sn"] = sn
}
re := that.Db.Get("produce_product",
Map{"[><]product": "product_spot_check.product_id=product.id",
"[><]produce": "product_spot_check.produce_id=produce.id",
},
"id,img,product_id,product.name AS product_name,admin_id,"+
"modify_time,state,rule,produce_id,produce.name AS produce_name", where)
if re == nil {
that.Display(4, "找不到对应信息")
return
}
that.Display(0, re)
},
}