• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang log.PrintErr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Submit

// 提交订单,返回订单号。如有错误则返回
func (this *Order) Submit() (string, error) {
	if this.GetDomainId() != 0 {
		return "", errors.New("订单不允许重复提交!")
	}

	if this.cart == nil || len(this.cart.GetValue().Items) == 0 {
		return "", errors.New("购物车为空!")
	}

	v := this.value
	v.CreateTime = time.Now().Unix()
	v.UpdateTime = v.CreateTime
	v.ItemsInfo = this.cart.GetSummary()
	v.OrderNo = this._shopping.GetFreeOrderNo()

	// 应用优惠券
	var err error
	var t *promotion.ValueCouponTake
	var b *promotion.ValueCouponBind
	for _, c := range this.GetCoupons() {
		if c.CanTake() {
			t, err = c.GetTake(v.MemberId)
			if err == nil {
				err = c.ApplyTake(t.Id)
			}
		} else {
			b, err = c.GetBind(v.MemberId)
			if err == nil {
				err = c.UseCoupon(b.Id)
			}
		}
		if err != nil {
			log.PrintErr(err)
			err = errors.New("Code 105:优惠券使用失败")
			return "", err
		}
	}

	// 保存订单
	id, err := this.shoppingRep.SaveOrder(this._shopping.GetAggregateRootId(), v)
	v.Id = id
	if err == nil {
		var oc *shopping.OrderCoupon = new(shopping.OrderCoupon)
		for _, c := range this.GetCoupons() {
			oc.Clone(c, v.Id, v.Fee)
			// 绑定订单与优惠券
			this.shoppingRep.SaveOrderCouponBind(oc)
		}
	}

	return v.OrderNo, err
}
开发者ID:honj51,项目名称:go2o,代码行数:53,代码来源:order.go


示例17: GetShopsOfPartner

func (this *partnerService) GetShopsOfPartner(partnerId int) []*partner.ValueShop {
	pt, err := this._partnerRep.GetPartner(partnerId)
	if err != nil {
		log.PrintErr(err)
	}
	shops := pt.GetShops()
	sv := make([]*partner.ValueShop, len(shops))
	for i, v := range shops {
		vv := v.GetValue()
		sv[i] = &vv
	}
	return sv
}
开发者ID:jacobxk,项目名称:go2o,代码行数:13,代码来源:partner_service.go


示例18: GetCategory

func (this *saleRep) GetCategory(partnerId, id int) *sale.ValueCategory {
	var e *sale.ValueCategory = new(sale.ValueCategory)
	err := this.Connector.GetOrm().Get(id, e)
	if err != nil {
		log.PrintErr(err)
		return nil
	}

	if e.PartnerId != partnerId {
		return nil
	}

	return e
}
开发者ID:jacobxk,项目名称:go2o,代码行数:14,代码来源:sale_rep.go


示例19: Submit

// 提交订单,返回订单号。如有错误则返回
func (this *Order) Submit() (string, error) {
	if this.GetDomainId() != 0 {
		return "", errors.New("订单不允许重复提交!")
	}

	if this._cart == nil || len(this._cart.GetValue().Items) == 0 {
		return "", errors.New("购物车为空!")
	}

	v := this._value
	v.CreateTime = time.Now().Unix()
	v.UpdateTime = v.CreateTime
	v.ItemsInfo = this._cart.GetSummary()
	v.OrderNo = this._shopping.GetFreeOrderNo()

	// 应用优惠券
	var err error
	var t *promotion.ValueCouponTake
	var b *promotion.ValueCouponBind
	for _, c := range this.GetCoupons() {
		if c.CanTake() {
			t, err = c.GetTake(v.MemberId)
			if err == nil {
				err = c.ApplyTake(t.Id)
			}
		} else {
			b, err = c.GetBind(v.MemberId)
			if err == nil {
				err = c.UseCoupon(b.Id)
			}
		}
		if err != nil {
			log.PrintErr(err)
			err = errors.New("Code 105:优惠券使用失败")
			return "", err
		}
	}

	// 保存订单
	id, err := this.saveOrderOnSubmit()
	v.Id = id
	if err == nil {
		this.bindCouponOnSubmit()
		this._cart.Destroy() // 销毁购物车
	}
	return v.OrderNo, err
}
开发者ID:keenhanzheng,项目名称:go2o,代码行数:48,代码来源:order.go


示例20: GetOnShelvesGoodsByCategoryId

func (this *saleRep) GetOnShelvesGoodsByCategoryId(partnerId, categoryId, num int) (e []*sale.ValueGoods) {
	var sql string
	if num <= 0 {
		sql = fmt.Sprintf(`SELECT * FROM gs_goods INNER JOIN gs_category ON gs_goods.category_id=gs_category.id
		WHERE partner_id=%d AND gs_category.id=%d AND on_shelves=1`, partnerId, categoryId)
	} else {
		sql = fmt.Sprintf(`SELECT * FROM gs_goods INNER JOIN gs_category ON gs_goods.category_id=gs_category.id
		WHERE partner_id=%d AND gs_category.id=%d AND on_shelves=1 LIMIT 0,%d`, partnerId, categoryId, num)
	}

	e = []*sale.ValueGoods{}
	err := this.Connector.GetOrm().SelectByQuery(&e, sql)
	if err != nil {
		log.PrintErr(err)
		return nil
	}
	return e
}
开发者ID:honj51,项目名称:go2o,代码行数:18,代码来源:sale_rep.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang log.Println函数代码示例发布时间:2022-05-28
下一篇:
Golang format.GetGoodsImageUrl函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap