コード例 #1
0
ファイル: goods.go プロジェクト: yonglehou/go2o
// 获取无图片地址
func GetNoPicPath() string {
	if len(_noPicUrl) == 0 {
		ctx := infrastructure.GetApp()
		_noPicUrl = ctx.Config().GetString(variable.NoPicPath)
	}
	return _noPicUrl
}
コード例 #2
0
ファイル: merchant_query.go プロジェクト: yonglehou/go2o
func getHostRegexp() *regexp.Regexp {
	if commHostRegexp == nil {
		commHostRegexp = regexp.MustCompile("([^\\.]+)." +
			infrastructure.GetApp().Config().GetString(variable.ServerDomain))
	}
	return commHostRegexp
}
コード例 #3
0
ファイル: log.go プロジェクト: yonglehou/go2o
func Error(err error) {
	_, f, line, _ := runtime.Caller(1)
	if err != nil && infrastructure.DebugMode {
		infrastructure.GetApp().Log().Println(
			fmt.Sprintf("[ ERROR]:%s , File:%s line:%d", err.Error(), f, line))
	}
}
コード例 #4
0
ファイル: shop_query.go プロジェクト: yonglehou/go2o
func (this *ShopQuery) getHostRegexp() *regexp.Regexp {
	if this.commHostRegexp == nil {
		this.commHostRegexp = regexp.MustCompile("([^\\.]+)." +
			infrastructure.GetApp().Config().GetString(variable.ServerDomain))
	}
	return this.commHostRegexp
}
コード例 #5
0
ファイル: merchant.go プロジェクト: yonglehou/go2o
// 获取商户的域名
func (this *MerchantImpl) GetMajorHost() string {
	if len(this._host) == 0 {
		host := this._rep.GetMerchantMajorHost(this.GetAggregateRootId())
		if len(host) == 0 {
			host = fmt.Sprintf("%s.%s", this._value.Usr, infrastructure.GetApp().
				Config().GetString(variable.ServerDomain))
		}
		this._host = host
	}
	return this._host
}
コード例 #6
0
ファイル: goods.go プロジェクト: yonglehou/go2o
// 获取资源地址
func GetResUrl(image string) string {
	if !picCfgLoaded {
		ctx := infrastructure.GetApp()
		if len(imageServe) == 0 {
			imageServe = ctx.Config().GetString(variable.ImageServer)
		}

		if len(noPicUrl) == 0 {
			noPicUrl = imageServe + "/" + ctx.Config().GetString(variable.NoPicPath)
		}
		picCfgLoaded = true
	}

	if len(image) == 0 {
		return noPicUrl
	}

	if strings.HasPrefix(image, "http://") || strings.HasPrefix(image, "https://") {
		return image
	}
	return imageServe + "/" + image
}
コード例 #7
0
ファイル: log.go プロジェクト: yonglehou/go2o
func Printf(s string, v ...interface{}) {
	if infrastructure.DebugMode {
		infrastructure.GetApp().Log().Printf(s, v...)
	}
}