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