forked from golang/hotime
书写前端接口
This commit is contained in:
parent
388bc5006d
commit
9ec597f26c
@ -14,6 +14,7 @@ var Project = Proj{
|
|||||||
"sms": Sms,
|
"sms": Sms,
|
||||||
"material": materialCtr,
|
"material": materialCtr,
|
||||||
"material_inout": material_inoutCtr,
|
"material_inout": material_inoutCtr,
|
||||||
|
"produce_product": produce_productCtr,
|
||||||
}
|
}
|
||||||
|
|
||||||
//生成随机码的4位随机数
|
//生成随机码的4位随机数
|
||||||
|
46
example/app/produce_product.go
Normal file
46
example/app/produce_product.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
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)
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user