本文整理匯總了Golang中github.com/ctripcorp/nephele/imgws/models.Config.GetGroups方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.GetGroups方法的具體用法?Golang Config.GetGroups怎麽用?Golang Config.GetGroups使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ctripcorp/nephele/imgws/models.Config
的用法示例。
在下文中一共展示了Config.GetGroups方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Upload
func (this *FdfsStorage) Upload(bts []byte, fileExt string) (string, util.Error) {
if e := this.initFdfsClient(); e.Err != nil {
return "", e
}
config := models.Config{Cat: this.Cat}
groups, e := config.GetGroups()
if e.Err != nil {
return "", e
}
if uploadcount == 99999999 {
uploadcount = 0
}
i := uploadcount % len(groups)
uploadcount = 0
g := groups[i]
var result util.Error = util.Error{}
if this.Cat != nil {
tran := this.Cat.NewTransaction(CATTITLE, "Fdfs.Upload")
util.LogEvent(this.Cat, "Size", util.GetImageSizeDistribution(len(bts)), map[string]string{"size": strconv.Itoa(len(bts))})
defer func() {
if result.Err != nil && result.IsNormal {
tran.SetStatus(result.Err)
} else {
tran.SetStatus("0")
}
tran.Complete()
}()
}
path, err := fdfsClient.UploadByBuffer(g, bts, fileExt)
if err != nil {
util.LogErrorEvent(this.Cat, ERRORTYPE_FDFSUPLOADERR, err.Error())
result = util.Error{IsNormal: false, Err: err, Type: ERRORTYPE_FDFSUPLOADERR}
return "", result
}
return path, result
}