Пример #1
0
func (this *UserController) Update() {
	item := s.User
	oEntityDef, _ := itemDef.EntityDefMap[item]
	svcParams := this.GetFormValues(oEntityDef)
	if pwd, ok := svcParams[s.Password]; ok {
		if strings.EqualFold(pwd.(string), "*****") {
			delete(svcParams, s.Password)
		}
	}
	status, reason := svc.Update(item, svcParams)
	this.Data["json"] = &JsonResult{status, reason}
	this.ServeJson()
}
Пример #2
0
func (this *ProductController) Update() {
	item := s.Product
	oItemDef, _ := itemDef.EntityDefMap[item]
	svcParams, exParams := this.GetExFormValues(oItemDef)
	beego.Debug("ProductController.Update:", svcParams)
	suppliers, ok := exParams["supplierlist"]
	if !ok {
		this.JsonError(stat.Failed, "添加至少一个供应商!")
		return
	}
	sn := this.GetString(s.Sn)
	supplierMgr.UpdateSupplierRels(sn, suppliers.([]string))
	status, reason := svc.Update(item, svcParams)
	this.Data["json"] = &JsonResult{status, reason}
	this.ServeJson()
}
Пример #3
0
func (this *ItemController) Update() {
	beego.Debug("Update requestBody: ", this.Ctx.Input.RequestBody)
	beego.Debug("Update params:", this.Ctx.Input.Params)
	item, ok := this.Ctx.Input.Params[":hi"]
	if !ok {
		beego.Error(stat.ParamItemError)
		this.Data["json"] = JsonResult{stat.ParamItemError, stat.ParamItemError}
		this.ServeJson()
		return
	}
	oEntityDef, ok := itemDef.EntityDefMap[item]
	if !ok {
		beego.Error(fmt.Sprintf("Item %s not define", item))
		this.Data["json"] = JsonResult{stat.ItemNotDefine, stat.ItemNotDefine}
		this.ServeJson()
		return
	}
	svcParams := this.GetFormValues(oEntityDef)
	status, reason := svc.Update(item, svcParams)
	this.Data["json"] = &JsonResult{status, reason}
	this.ServeJson()
}