Exemplo n.º 1
0
Arquivo: cart.go Projeto: honj51/go2o
//todo: partnerId 应去掉,可能在多个商家买东西
func newCart(partnerRep partner.IPartnerRep, memberRep member.IMemberRep, saleRep sale.ISaleRep,
	shoppingRep shopping.IShoppingRep, partnerId int, buyerId int) shopping.ICart {
	unix := time.Now().Unix()
	cartKey := domain.GenerateCartKey(unix, time.Now().Nanosecond())
	value := &shopping.ValueCart{
		CartKey:    cartKey,
		BuyerId:    buyerId,
		OrderNo:    "",
		IsBought:   0,
		ShopId:     0,
		DeliverId:  0,
		PaymentOpt: 1,
		DeliverOpt: 1,
		CreateTime: unix,
		UpdateTime: unix,
	}

	return &Cart{
		value:       value,
		partnerRep:  partnerRep,
		memberRep:   memberRep,
		partnerId:   partnerId,
		shoppingRep: shoppingRep,
		saleRep:     saleRep,
	}
}
Exemplo n.º 2
0
Arquivo: cart.go Projeto: sunxboy/go2o
//todo: partnerId 应去掉,可能在多个商家买东西
func newCart(partnerRep partner.IPartnerRep, memberRep member.IMemberRep, saleRep sale.ISaleRep,
	goodsRep sale.IGoodsRep, shoppingRep shopping.IShoppingRep, partnerId int, buyerId int) shopping.ICart {
	unix := time.Now().Unix()
	cartKey := domain.GenerateCartKey(unix, time.Now().Nanosecond())
	value := &shopping.ValueCart{
		CartKey:    cartKey,
		BuyerId:    buyerId,
		ShopId:     0,
		DeliverId:  0,
		PaymentOpt: 1,
		DeliverOpt: 1,
		CreateTime: unix,
		UpdateTime: unix,
		Items:      nil,
	}

	return (&Cart{
		_value:       value,
		_partnerRep:  partnerRep,
		_memberRep:   memberRep,
		_partnerId:   partnerId,
		_shoppingRep: shoppingRep,
		_saleRep:     saleRep,
		_goodsRep:    goodsRep,
	}).init()
}