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


Golang log.Println函数代码示例

本文整理汇总了Golang中go2o/src/core/infrastructure/log.Println函数的典型用法代码示例。如果您正苦于以下问题:Golang Println函数的具体用法?Golang Println怎么用?Golang Println使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: SmartConfirmOrder

func (this *Shopping) SmartConfirmOrder(order shopping.IOrder) error {
	var err error
	v := order.GetValue()
	log.Printf("[ AUTO][OrderSetup]:%s - Confirm \n", v.OrderNo)
	var shop partner.IShop

	if biShops == nil {
		biShops = this._partner.GetBusinessInShops()
	}

	if len(biShops) == 1 {
		shop = biShops[0]
	} else {
		shop, err = this.SmartChoiceShop(v.DeliverAddress)
		if err != nil {
			log.Println(err)
			order.Suspend("智能分配门店失败!原因:" + err.Error())
			return err
		}
	}

	if shop != nil {

		sv := shop.GetValue()
		order.SetShop(shop.GetDomainId())
		err = order.Confirm()
		//err = order.Process()

		order.AppendLog(enum.ORDER_LOG_SETUP, false, fmt.Sprintf(
			"自动分配门店:%s,电话:%s", sv.Name, sv.Phone))
	}
	return err
}
开发者ID:zoe527,项目名称:go2o,代码行数:33,代码来源:shopping.go

示例2: OrderAutoSetup

// 自动设置订单
func (this *Shopping) OrderAutoSetup(f func(error)) {
	var orders []*shopping.ValueOrder
	var err error

	shopLocker.Lock()
	defer func() {
		shopLocker.Unlock()
	}()
	biShops = nil
	log.Println("[SETUP] start auto setup")

	saleConf := this._partner.GetSaleConf()
	if saleConf.AutoSetupOrder == 1 {
		orders, err = this._rep.GetWaitingSetupOrders(this._partnerId)
		if err != nil {
			f(err)
			return
		}

		dt := time.Now()
		for _, v := range orders {
			this.setupOrder(v, &saleConf, dt, f)
		}
	}
}
开发者ID:zoe527,项目名称:go2o,代码行数:26,代码来源:shopping.go

示例3: OrderAutoSetup

// 自动设置订单
func (this *Shopping) OrderAutoSetup(f func(error)) {
	var orders []*shopping.ValueOrder
	var err error

	log.Println("[SETUP] start auto setup")

	saleConf := this._partner.GetSaleConf()
	if saleConf.AutoSetupOrder == 1 {
		ctx := infrastructure.GetApp()
		orders, err = this._rep.GetWaitingSetupOrders(this._partnerId)
		if err != nil {
			f(err)
			return
		}

		dt := time.Now()
		for _, v := range orders {
			this.setupOrder(ctx, v, &saleConf, dt, f)
		}
	}
}
开发者ID:heofonum,项目名称:go2o,代码行数:22,代码来源:shopping.go

示例4: setupOrder

func (this *Shopping) setupOrder(ctx gof.App, v *shopping.ValueOrder,
	conf *partner.SaleConf, t time.Time, f func(error)) {
	var err error
	order := this.CreateOrder(v, nil)
	dur := time.Duration(t.Unix()-v.CreateTime) * time.Second

	if v.PaymentOpt == enum.PAY_ONLINE {
		if v.IsPaid == 0 && dur > time.Hour*order_timeout_hour {
			order.Cancel("超时未付款,系统取消")
			if ctx.Debug() {
				ctx.Log().Printf("[ AUTO][OrderSetup]:%s - Payment Timeout\n", v.OrderNo)
			}
		}
	} else if v.PaymentOpt == enum.PAY_OFFLINE {
		switch v.Status + 1 {
		case enum.ORDER_CONFIRMED:
			if dur > time.Minute*order_confirm_minute {
				err = order.Confirm()
				if ctx.Debug() {
					ctx.Log().Printf("[ AUTO][OrderSetup]:%s - Confirm \n", v.OrderNo)
				}

				shop, err := this.SmartChoiceShop(v.DeliverAddress)
				if err != nil {
					log.Println(err)
					order.Suspend("智能分配门店失败!原因:" + err.Error())
				} else {
					sv := shop.GetValue()
					order.SetShop(shop.GetDomainId())
					order.AppendLog(enum.ORDER_LOG_SETUP, false, fmt.Sprintf(
						"自动分配门店:%s,电话:%s", sv.Name, sv.Phone))
				}
			}
		case enum.ORDER_PROCESSING:
			if dur > time.Minute*order_process_minute {
				err = order.Process()
				if ctx.Debug() {
					ctx.Log().Printf("[ AUTO][OrderSetup]:%s - Processing \n", v.OrderNo)
				}
			}

		case enum.ORDER_SENDING:
			if dur > time.Minute*order_sending_minute {
				err = order.Deliver()
				if ctx.Debug() {
					ctx.Log().Printf("[ AUTO][OrderSetup]:%s - Sending \n", v.OrderNo)
				}
			}
		case enum.ORDER_RECEIVED:
			if dur > time.Hour*order_receive_hour {
				err = order.SignReceived()
				if ctx.Debug() {
					ctx.Log().Printf("[ AUTO][OrderSetup]:%s - Received \n", v.OrderNo)
				}
			}
		case enum.ORDER_COMPLETED:
			if dur > time.Hour*order_complete_hour {
				err = order.Complete()
				if ctx.Debug() {
					ctx.Log().Printf("[ AUTO][OrderSetup]:%s - Complete \n", v.OrderNo)
				}
			}
		}
	}

	if err != nil {
		f(err)
	}
}
开发者ID:heofonum,项目名称:go2o,代码行数:69,代码来源:shopping.go

示例5: Complete

// 完成订单
func (this *Order) Complete() error {
	now := time.Now().Unix()
	v := this._value
	m := this._memberRep.GetMember(v.MemberId)
	if m == nil {
		return member.ErrNoSuchMember
	}
	var err error
	var ptl partner.IPartner
	ptl, err = this._partnerRep.GetPartner(v.PartnerId)
	if err != nil {
		log.Println("供应商异常!", v.PartnerId)
		log.PrintErr(err)
		return err
	}

	pv := ptl.GetValue()
	if pv.ExpiresTime < time.Now().Unix() {
		return errors.New("您的账户已经过期!")
	}

	// 增加经验
	if EXP_BIT == 0 {
		fv := infrastructure.GetApp().Config().GetFloat(variable.EXP_BIT)
		if fv <= 0 {
			panic("[WANNING]:Exp_bit not set!")
		}
		EXP_BIT = float32(fv)
	}
	if err = m.AddExp(int(v.Fee * EXP_BIT)); err != nil {
		return err
	}

	// 更新账户
	updateAccountForOrder(m, this)

	//******* 返现到账户  ************
	var back_fee float32
	saleConf := ptl.GetSaleConf()
	if saleConf.CashBackPercent > 0 {
		back_fee = v.Fee * saleConf.CashBackPercent

		//将此次消费记入会员账户
		this.updateShoppingMemberBackFee(ptl, m,
			back_fee*saleConf.CashBackMemberPercent, now)

		//todo: 增加阶梯的返积分,比如订单满30送100积分
		backIntegral := int(v.Fee)*saleConf.IntegralBackNum +
			saleConf.IntegralBackExtra

		// 赠送积分
		if backIntegral != 0 {
			err = m.AddIntegral(v.PartnerId, enum.INTEGRAL_TYPE_ORDER,
				backIntegral, fmt.Sprintf("订单返积分%d个", backIntegral))
			if err != nil {
				return err
			}
		}
	}

	this._value.Status = enum.ORDER_COMPLETED
	this._value.IsSuspend = 0
	this._value.UpdateTime = now

	_, err = this.Save()

	if err == nil {
		err = this.AppendLog(enum.ORDER_LOG_SETUP, false, "订单已完成")
		// 处理返现促销
		this.handleCashBackPromotions(ptl, m)
		// 三级返现
		if back_fee > 0 {
			this.backFor3R(ptl, m, back_fee, now)
		}
	}
	return err
}
开发者ID:AlwaysOnline,项目名称:go2o,代码行数:78,代码来源:order.go

示例6: Complete

// 完成订单
func (this *Order) Complete() error {
	now := time.Now().Unix()
	v := this._value
	m, err := this._memberRep.GetMember(v.MemberId)
	if err == nil {
		var ptl partner.IPartner
		ptl, err = this._partnerRep.GetPartner(v.PartnerId)
		if err != nil {
			log.Println("供应商异常!", v.PartnerId)
			log.PrintErr(err)
			return err
		}

		pv := ptl.GetValue()
		if pv.ExpiresTime < time.Now().Unix() {
			return errors.New("您的账户已经过期!")
		}

		//返现比例
		saleConf := ptl.GetSaleConf()
		back_fee := v.Fee * saleConf.CashBackPercent

		//将此次消费记入会员账户
		this.updateShoppingMemberAccount(ptl, m,
			back_fee*saleConf.CashBackMemberPercent, now)

		//todo: 增加阶梯的返积分,比如订单满30送100积分
		backIntegral := int(v.Fee)*saleConf.IntegralBackNum +
			saleConf.IntegralBackExtra

		//判断是否满足升级条件
		if backIntegral != 0 {
			err = m.AddIntegral(v.PartnerId, enum.INTEGRAL_TYPE_ORDER,
				backIntegral, fmt.Sprintf("订单返积分%d个", backIntegral))
			if err != nil {
				return err
			}
		}

		// 增加经验
		if EXP_BIT == 0 {
			fv := infrastructure.GetApp().
				Config().GetFloat(variable.EXP_BIT)
			EXP_BIT = float32(fv)
		}

		if EXP_BIT == 0 {
			log.Println("[WANNING]:Exp_bit not set!")
		}

		err = m.AddExp(int(v.Fee * EXP_BIT))
		if err != nil {
			return err
		}

		// 三级返现
		this.backFor3R(ptl, m, back_fee, now)

		this._value.Status = enum.ORDER_COMPLETED
		this._value.IsSuspend = 0
		this._value.UpdateTime = now

		_, err := this.Save()

		if err == nil {
			err = this.AppendLog(enum.ORDER_LOG_SETUP, false, "订单已完成")
		}
	}
	return err
}
开发者ID:keenhanzheng,项目名称:go2o,代码行数:71,代码来源:order.go


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