当前位置: 首页>>代码示例>>Golang>>正文


Golang IShopping.BuildOrder方法代码示例

本文整理汇总了Golang中go2o/src/core/domain/interface/shopping.IShopping.BuildOrder方法的典型用法代码示例。如果您正苦于以下问题:Golang IShopping.BuildOrder方法的具体用法?Golang IShopping.BuildOrder怎么用?Golang IShopping.BuildOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在go2o/src/core/domain/interface/shopping.IShopping的用法示例。


在下文中一共展示了IShopping.BuildOrder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: BuildOrder

func (this *shoppingService) BuildOrder(partnerId int, memberId int,
	cartKey string, couponCode string) (map[string]interface{}, error) {
	var sp shopping.IShopping = this._rep.GetShopping(partnerId)
	order, _, err := sp.BuildOrder(memberId, couponCode)
	if err != nil {
		return nil, err
	}

	v := order.GetValue()
	buf := bytes.NewBufferString("")

	for _, v := range order.GetCoupons() {
		buf.WriteString(v.GetDescribe())
		buf.WriteString("\n")
	}

	var data map[string]interface{}
	data = make(map[string]interface{})
	if couponCode != "" {
		if v.CouponFee == 0 {
			data["result"] = v.CouponFee != 0
			data["message"] = "优惠券无效"
		} else {
			// 成功应用优惠券
			data["totalFee"] = v.TotalFee
			data["fee"] = v.Fee
			data["payFee"] = v.PayFee
			data["discountFee"] = v.DiscountFee
			data["couponFee"] = v.CouponFee
			data["couponDescribe"] = buf.String()
		}
	} else {
		// 取消优惠券
		data["totalFee"] = v.TotalFee
		data["fee"] = v.Fee
		data["payFee"] = v.PayFee
		data["discountFee"] = v.DiscountFee
	}
	return data, err
}
开发者ID:henrylee2cn,项目名称:go2o,代码行数:40,代码来源:shopping_service.go

示例2: BuildOrder

func (this *shoppingService) BuildOrder(partnerId int, memberId int,
	cartKey string, couponCode string) (shopping.IOrder, shopping.ICart, error) {
	var sp shopping.IShopping = this._rep.GetShopping(partnerId)
	return sp.BuildOrder(memberId, couponCode)
}
开发者ID:honj51,项目名称:go2o,代码行数:5,代码来源:shopping_service.go


注:本文中的go2o/src/core/domain/interface/shopping.IShopping.BuildOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。