本文整理汇总了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
}
示例2: GetPartnerMajorHost
// 获取商户的域名
func (this *partnerService) GetPartnerMajorHost(partnerId int) string {
pt, err := this._partnerRep.GetPartner(partnerId)
if err != nil {
log.PrintErr(err)
}
return pt.GetMajorHost()
}
示例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)
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}