- adjust package structure.

This commit is contained in:
gazebo
2018-06-20 15:53:08 +08:00
parent 9ca830c240
commit 157d36c47f
9 changed files with 139 additions and 124 deletions

View File

@@ -9,7 +9,7 @@ import (
"git.rosy.net.cn/baseapi/platform/mtpsapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jd/models"
"go.uber.org/zap"
"git.rosy.net.cn/jx-callback/globals"
)
const (
@@ -75,13 +75,12 @@ const (
)
type FreshFoodAPI struct {
baseURL string
sugarLogger *zap.SugaredLogger
client *http.Client
baseURL string
client *http.Client
}
func NewFreshFoodAPI(baseURL string, sugarredLogger *zap.SugaredLogger) *FreshFoodAPI {
return &FreshFoodAPI{baseURL, sugarredLogger, &http.Client{Timeout: time.Second * 5}}
func NewFreshFoodAPI(baseURL string) *FreshFoodAPI {
return &FreshFoodAPI{baseURL, &http.Client{Timeout: time.Second * 5}}
}
func (f *FreshFoodAPI) AccessFreshFood(apiStr string, params url.Values) error {
@@ -90,14 +89,14 @@ func (f *FreshFoodAPI) AccessFreshFood(apiStr string, params url.Values) error {
for i := 0; i < retryCount; i++ {
// _, err := f.client.PostForm(fullURL, params)
err = error(nil)
f.sugarLogger.Debug(fullURL)
f.sugarLogger.Debug(params)
globals.SugarLogger.Debug(fullURL)
globals.SugarLogger.Debug(params)
if err == nil {
break
}
}
if err != nil {
f.sugarLogger.Warnf("Call %s error:%v", fullURL, err)
globals.SugarLogger.Warnf("Call %s error:%v", fullURL, err)
}
return err
}