Example #1
0
// 获取无图片地址
func GetNoPicPath() string {
	if len(_noPicUrl) == 0 {
		ctx := infrastructure.GetApp()
		_noPicUrl = ctx.Config().GetString(variable.NoPicPath)
	}
	return _noPicUrl
}
Example #2
0
func getHostRegexp() *regexp.Regexp {
	if commHostRegexp == nil {
		commHostRegexp = regexp.MustCompile("([^\\.]+)." +
			infrastructure.GetApp().Config().GetString(variable.ServerDomain))
	}
	return commHostRegexp
}
Example #3
0
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))
	}
}
Example #4
0
func (this *ShopQuery) getHostRegexp() *regexp.Regexp {
	if this.commHostRegexp == nil {
		this.commHostRegexp = regexp.MustCompile("([^\\.]+)." +
			infrastructure.GetApp().Config().GetString(variable.ServerDomain))
	}
	return this.commHostRegexp
}
Example #5
0
// 获取商户的域名
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
}
Example #6
0
// 获取资源地址
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
}
Example #7
0
func Printf(s string, v ...interface{}) {
	if infrastructure.DebugMode {
		infrastructure.GetApp().Log().Printf(s, v...)
	}
}