Exemplo n.º 1
0
// 验证销售设置
func (this *Partner) verifySaleConf(v *partner.SaleConf) {
	if v.OrderTimeOutMinute <= 0 {
		v.OrderTimeOutMinute = 1440 // 一天
	}

	if v.OrderConfirmAfterMinute <= 0 {
		v.OrderConfirmAfterMinute = 60 // 一小时后自动确认
	}

	if v.OrderTimeOutReceiveHour <= 0 {
		v.OrderTimeOutReceiveHour = 7 * 24 // 7天后自动确认
	}
}
Exemplo n.º 2
0
func (this *partnerRep) SaveSaleConf(partnerId int, v *partner.SaleConf) error {
	defer this.renew(v.PartnerId)
	var err error
	if v.PartnerId > 0 {
		_, _, err = this.Connector.GetOrm().Save(v.PartnerId, v)
	} else {
		v.PartnerId = partnerId
		_, _, err = this.Connector.GetOrm().Save(nil, v)
	}
	return err
}
Exemplo n.º 3
0
func (this *configC) SaleConf_post(ctx *web.Context) {
	partnerId := this.GetPartnerId(ctx)
	r, w := ctx.Request, ctx.ResponseWriter
	var result gof.Message
	r.ParseForm()

	e := partner.SaleConf{}
	web.ParseFormToEntity(r.Form, &e)

	e.PartnerId = partnerId

	err := dps.PartnerService.SaveSaleConf(partnerId, &e)

	if err != nil {
		result = gof.Message{Result: false, Message: err.Error()}
	} else {
		result = gof.Message{Result: true, Message: ""}
	}
	w.Write(result.Marshal())
}