本文整理汇总了Golang中go2o/src/core/domain/interface/promotion.ValueCoupon类的典型用法代码示例。如果您正苦于以下问题:Golang ValueCoupon类的具体用法?Golang ValueCoupon怎么用?Golang ValueCoupon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueCoupon类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Save_coupon_post
// 保存优惠券
func (this *promC) Save_coupon_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r := ctx.Request
r.ParseForm()
var result gof.Message
e := promotion.ValuePromotion{}
web.ParseFormToEntity(r.Form, &e)
e2 := promotion.ValueCoupon{}
web.ParseFormToEntity(r.Form, &e2)
e.PartnerId = partnerId
e.TypeFlag = promotion.TypeFlagCoupon
const layout string = "2006-01-02 15:04:05"
bt, _ := time.Parse(layout, r.FormValue("BeginTime"))
ot, _ := time.Parse(layout, r.FormValue("OverTime"))
e2.BeginTime = bt.Unix()
e2.OverTime = ot.Unix()
id, err := dps.PromService.SaveCoupon(partnerId, &e, &e2)
if err != nil {
result.Message = err.Error()
} else {
result.Result = true
result.Data = id
}
ctx.Response.JsonOutput(result)
}
示例2: createCouponPromotion
func createCouponPromotion(p *Promotion) promotion.IPromotion {
var pv *promotion.ValueCoupon
if p.GetAggregateRootId() > 0 {
pv = p._promRep.GetValueCoupon(p.GetAggregateRootId())
}
if pv == nil {
pv = &promotion.ValueCoupon{
Id: p.GetAggregateRootId(),
CreateTime: time.Now().Unix(),
}
}
if p.GetAggregateRootId() <= 0 {
pv.Amount = pv.TotalAmount
}
return newCoupon(p, pv, p._promRep, p._memberRep)
}
示例3: SaveCoupon_post
func (this *promC) SaveCoupon_post(ctx *web.Context) {
partnerId := this.GetPartnerId(ctx)
r, w := ctx.Request, ctx.ResponseWriter
var result gof.Message
r.ParseForm()
var e promotion.ValueCoupon
web.ParseFormToEntity(r.Form, &e)
const layout string = "2006-01-02 15:04:05"
bt, _ := time.Parse(layout, r.FormValue("BeginTime"))
ot, _ := time.Parse(layout, r.FormValue("OverTime"))
e.BeginTime = bt.Unix()
e.OverTime = ot.Unix()
_, err := dps.PromService.SaveCoupon(partnerId, &e)
if err != nil {
result = gof.Message{Result: false, Message: err.Error()}
} else {
result = gof.Message{Result: true, Message: ""}
}
w.Write(result.Marshal())
}
示例4: CreateCoupon
func (this *Promotion) CreateCoupon(val *promotion.ValueCoupon) promotion.ICoupon {
val.PartnerId = this.GetAggregateRootId()
val.CreateTime = time.Now().Unix()
val.Amount = val.TotalAmount
return newCoupon(val, this.promRep, this.memberRep)
}