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


Golang log.PrintErr函数代码示例

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


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

示例1: QueryPartnerIdByHost

// 根据主机查询商户编号
func (this *PartnerQuery) QueryPartnerIdByHost(host string) int {
	//  $ 获取合作商ID
	// $ hostname : 域名
	// *.wdian.net  二级域名
	// www.dc1.com  顶级域名

	var partnerId int
	var err error

	reg := getHostRegexp()
	if reg.MatchString(host) {
		matches := reg.FindAllStringSubmatch(host, 1)
		usr := matches[0][1]
		err = this.Connector.ExecScalar(`SELECT id FROM pt_partner WHERE usr=?`, &partnerId, usr)
	} else {
		err = this.Connector.ExecScalar(
			`SELECT id FROM pt_partner INNER JOIN pt_siteconf
					 ON pt_siteconf.partner_id = pt_partner.id
					 WHERE host=?`, &partnerId, host)
	}

	if err != nil {
		log.PrintErr(err)
	}
	return partnerId
}
开发者ID:xianmau,项目名称:go2o,代码行数:27,代码来源:partner_query.go

示例2: GetPartnerMajorHost

// 获取商户的域名
func (this *partnerService) GetPartnerMajorHost(partnerId int) string {
	pt, err := this._partnerRep.GetPartner(partnerId)
	if err != nil {
		log.PrintErr(err)
	}
	return pt.GetMajorHost()
}
开发者ID:jacobxk,项目名称:go2o,代码行数:8,代码来源:partner_service.go

示例3: DeleteShop

func (this *partnerService) DeleteShop(partnerId, shopId int) error {
	pt, err := this._partnerRep.GetPartner(partnerId)
	if err != nil {
		log.PrintErr(err)
	}
	return pt.DeleteShop(shopId)
}
开发者ID:jacobxk,项目名称:go2o,代码行数:7,代码来源:partner_service.go

示例4: GetCategories

func (this *saleRep) GetCategories(partnerId int) []*sale.ValueCategory {
	var e []*sale.ValueCategory = []*sale.ValueCategory{}
	err := this.Connector.GetOrm().Select(&e, "partner_id=? ORDER BY id ASC", partnerId)
	if err != nil {
		log.PrintErr(err)
	}
	return e
}
开发者ID:jacobxk,项目名称:go2o,代码行数:8,代码来源:sale_rep.go

示例5: GetShopValueById

func (this *partnerService) GetShopValueById(partnerId, shopId int) *partner.ValueShop {
	pt, err := this._partnerRep.GetPartner(partnerId)
	if err != nil {
		log.PrintErr(err)
	}
	v := pt.GetShop(shopId).GetValue()
	return &v
}
开发者ID:jacobxk,项目名称:go2o,代码行数:8,代码来源:partner_service.go

示例6: GetSiteConf

func (this *partnerService) GetSiteConf(partnerId int) *partner.SiteConf {
	pt, err := this._partnerRep.GetPartner(partnerId)
	if err != nil {
		log.PrintErr(err)
	}
	conf := pt.GetSiteConf()
	return &conf
}
开发者ID:jacobxk,项目名称:go2o,代码行数:8,代码来源:partner_service.go

示例7: GetGoodsSnapshot

// 获取指定的商品快照
func (this *saleRep) GetGoodsSnapshot(id int) *sale.GoodsSnapshot {
	var e *sale.GoodsSnapshot = new(sale.GoodsSnapshot)
	err := this.Connector.GetOrm().Get(id, e)
	if err != nil {
		log.PrintErr(err)
		e = nil
	}
	return e
}
开发者ID:jacobxk,项目名称:go2o,代码行数:10,代码来源:sale_rep.go

示例8: GetCouponBinds

func (this *promotionRep) GetCouponBinds(couponId int) []promotion.ValueCouponBind {
	var arr []promotion.ValueCouponBind = []promotion.ValueCouponBind{}
	err := this.Connector.GetOrm().SelectByQuery(arr,
		"SELECT * FROM pm_coupon_bind WHERE coupon_id = ?", couponId)
	if err != nil {
		log.PrintErr(err)
	}
	return arr
}
开发者ID:jacobxk,项目名称:go2o,代码行数:9,代码来源:promotion_rep.go

示例9: GetGoodsSnapshotByKey

// 根据Key获取商品快照
func (this *saleRep) GetGoodsSnapshotByKey(key string) *sale.GoodsSnapshot {
	var e *sale.GoodsSnapshot = new(sale.GoodsSnapshot)
	err := this.Connector.GetOrm().GetBy(e, "key=?", key)
	if err != nil {
		log.PrintErr(err)
		e = nil
	}
	return e
}
开发者ID:jacobxk,项目名称:go2o,代码行数:10,代码来源:sale_rep.go

示例10: GetLatestGoodsSnapshot

// 获取最新的商品快照
func (this *saleRep) GetLatestGoodsSnapshot(goodsId int) *sale.GoodsSnapshot {
	var e *sale.GoodsSnapshot = new(sale.GoodsSnapshot)
	err := this.Connector.GetOrm().GetBy(e, "goods_id=? ORDER BY id DESC", goodsId)
	if err != nil {
		log.PrintErr(err)
		e = nil
	}
	return e
}
开发者ID:honj51,项目名称:go2o,代码行数:10,代码来源:sale_rep.go

示例11: GetOrderByNo

func (this *Shopping) GetOrderByNo(orderNo string) (shopping.IOrder, error) {
	val, err := this._rep.GetOrderByNo(this._partnerId, orderNo)

	if err != nil {
		log.PrintErr(err)
		return nil, errors.New("订单不存在")
	}
	return this.CreateOrder(val, nil), err
}
开发者ID:heofonum,项目名称:go2o,代码行数:9,代码来源:shopping.go

示例12: GetCouponTakes

func (this *oldPromotionRep) GetCouponTakes(couponId int) []promotion.ValueCouponTake {
	var arr []promotion.ValueCouponTake = []promotion.ValueCouponTake{}

	err := this.Connector.GetOrm().SelectByQuery(&arr,
		"SELECT * FROM pm_coupon_take WHERE coupon_id =?", couponId)
	if err != nil {
		log.PrintErr(err)
	}

	return arr
}
开发者ID:linux-mac,项目名称:go2o,代码行数:11,代码来源:old_promotion_rep.go

示例13: GetValueShop

func (this *partnerRep) GetValueShop(partnerId, shopId int) *partner.ValueShop {
	var v *partner.ValueShop = new(partner.ValueShop)
	err := this.Connector.GetOrm().Get(shopId, v)
	if err == nil &&
		v.PartnerId == partnerId {
		return v
	} else {
		log.PrintErr(err)
	}
	return nil
}
开发者ID:kevinhuo88888,项目名称:go2o,代码行数:11,代码来源:partner_rep.go

示例14: BuildOrder

// 生成订单
func (this *Shopping) BuildOrder(memberId int, couponCode string) (shopping.IOrder, shopping.ICart, error) {
	order, m, cart, err := this.ParseShoppingCart(memberId)
	if err != nil {
		return order, cart, err
	}

	if len(couponCode) != 0 {
		var coupon promotion.ICouponPromotion
		var result bool
		var val = order.GetValue()
		cp := this._promRep.GetCouponByCode(
			this._partnerId, couponCode)

		// 如果优惠券不存在
		if cp == nil {
			log.PrintErr(err)
			return order, cart, errors.New("优惠券无效")
		}

		coupon = cp.(promotion.ICouponPromotion)
		result, err = coupon.CanUse(m, val.Fee)
		if result {
			if coupon.CanTake() {
				_, err = coupon.GetTake(memberId)
				//如果未占用,则占用
				if err != nil {
					err = coupon.Take(memberId)
				}
			} else {
				_, err = coupon.GetBind(memberId)
			}
			if err != nil {
				log.PrintErr(err)
				return order, cart, errors.New("优惠券无效")
			}
			err = order.ApplyCoupon(coupon) //应用优惠券
		}
	}

	return order, cart, err
}
开发者ID:heofonum,项目名称:go2o,代码行数:42,代码来源:shopping.go

示例15: GetShopsOfPartner

func (this *partnerRep) GetShopsOfPartner(partnerId int) []*partner.ValueShop {
	shops := []*partner.ValueShop{}
	err := this.Connector.GetOrm().SelectByQuery(&shops,
		"SELECT * FROM pt_shop WHERE partner_id=?", partnerId)

	if err != nil {
		log.PrintErr(err)
		return nil
	}

	return shops
}
开发者ID:kevinhuo88888,项目名称:go2o,代码行数:12,代码来源:partner_rep.go


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