本文整理汇总了Golang中go2o/src/core/domain/interface/sale.ValueItem类的典型用法代码示例。如果您正苦于以下问题:Golang ValueItem类的具体用法?Golang ValueItem怎么用?Golang ValueItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueItem类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetValue
func (this *Item) SetValue(v *sale.ValueItem) error {
if v.Id == this._value.Id {
v.CreateTime = this._value.CreateTime
v.GoodsNo = this._value.GoodsNo
this._value = v
}
this._value.UpdateTime = time.Now().Unix()
return nil
}
示例2: CreateItem
func (this *Sale) CreateItem(v *sale.ValueItem) sale.IItem {
if v.CreateTime == 0 {
v.CreateTime = time.Now().Unix()
}
if v.UpdateTime == 0 {
v.UpdateTime = v.CreateTime
}
//todo: 判断category
return newItem(this, v, this._saleRep, this._saleTagRep, this._goodsRep, this._promRep)
}
示例3: SaveItem_post
func (this *goodsC) SaveItem_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.Response
var result gof.Message
r.ParseForm()
e := sale.ValueItem{}
web.ParseFormToEntity(r.Form, &e)
e.State = 1 //todo: 暂时使用
id, err := dps.SaleService.SaveItem(partnerId, &e)
if err != nil {
result = gof.Message{Result: true, Message: err.Error()}
} else {
result = gof.Message{Result: true, Message: "", Data: id}
}
w.Write(result.Marshal())
}
示例4: SaveItem_post
func (this *goodsC) SaveItem_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r := ctx.Request
var result gof.Message
r.ParseForm()
e := sale.ValueItem{}
web.ParseFormToEntity(r.Form, &e)
e.State = 1 //todo: 暂时使用
id, err := dps.SaleService.SaveItem(partnerId, &e)
if err != nil {
result.Message = err.Error()
} else {
result.Result = true
result.Data = id
}
ctx.Response.JsonOutput(result)
}
示例5: Edit
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
}
e.Description = ""
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")
}
示例6: SaveItem
// 保存产品
func (this *saleService) SaveItem(partnerId int, v *sale.ValueItem) (int, error) {
sl := this._rep.GetSale(partnerId)
var pro sale.IItem
if v.Id > 0 {
pro = sl.GetItem(v.Id)
if pro == nil {
return 0, errors.New("产品不存在")
}
// 修改货品时,不会修改详情
v.Description = pro.GetValue().Description
if err := pro.SetValue(v); err != nil {
return 0, err
}
} else {
pro = sl.CreateItem(v)
}
return pro.Save()
}