Esempio n. 1
0
func (this *goodsC) Create(ctx *web.Context) {
	partnerId := this.GetPartnerId(ctx)
	shopChks := cache.GetShopCheckboxs(partnerId, "")
	cateOpts := cache.GetDropOptionsOfCategory(partnerId)

	ctx.App.Template().Execute(ctx.ResponseWriter, gof.TemplateDataMap{
		"shop_chk":  template.HTML(shopChks),
		"cate_opts": template.HTML(cateOpts),
	},
		"views/partner/goods/create_goods.html")
}
Esempio n. 2
0
func (this *goodsC) Create(ctx *web.Context) {
	partnerId := this.GetPartnerId(ctx)
	shopChks := cache.GetShopCheckboxs(partnerId, "")
	cateOpts := cache.GetDropOptionsOfCategory(partnerId)

	e := &sale.ValueItem{
		Image: ctx.App.Config().GetString(variable.NoPicPath),
	}
	js, _ := json.Marshal(e)

	ctx.App.Template().Execute(ctx.Response, gof.TemplateDataMap{
		"entity":    template.JS(js),
		"shop_chk":  template.HTML(shopChks),
		"cate_opts": template.HTML(cateOpts),
	},
		"views/partner/goods/create_goods.html")
}
Esempio n. 3
0
func (this *goodsC) Edit(ctx *web.Context) {
	partnerId := this.GetPartnerId(ctx)
	r, w := ctx.Request, ctx.Response
	var e *sale.ValueItem
	id, _ := strconv.Atoi(r.URL.Query().Get("item_id"))
	e = dps.SaleService.GetValueItem(partnerId, id)
	if e == nil {
		w.Write([]byte("商品不存在"))
		return
	}
	js, _ := json.Marshal(e)

	shopChks := cache.GetShopCheckboxs(partnerId, e.ApplySubs)
	cateOpts := cache.GetDropOptionsOfCategory(partnerId)

	ctx.App.Template().Execute(w,
		gof.TemplateDataMap{
			"entity":    template.JS(js),
			"shop_chk":  template.HTML(shopChks),
			"cate_opts": template.HTML(cateOpts),
		},
		"views/partner/goods/update_goods.html")
}