1
This commit is contained in:
@@ -4,9 +4,9 @@ import (
|
||||
"encoding/json"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/topsdk/ability304"
|
||||
"git.rosy.net.cn/topsdk/ability304/request"
|
||||
"topsdk"
|
||||
"topsdk/ability304"
|
||||
"topsdk/ability304/request"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -20,7 +20,9 @@ func NewTaoVegetable(appKey, appSecret, serverUrl string) API {
|
||||
}
|
||||
|
||||
type API struct {
|
||||
client topsdk.TopClient
|
||||
client topsdk.TopClient
|
||||
token string
|
||||
refreshToken string
|
||||
}
|
||||
|
||||
func (a API) GetStoreToken(code, uuId string) (*StoreTokenInfo, error) {
|
||||
|
||||
@@ -3,13 +3,12 @@ package tao_vegetable
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"topsdk/ability587"
|
||||
"topsdk/ability587/domain"
|
||||
"topsdk/ability587/request"
|
||||
"git.rosy.net.cn/topsdk/ability587"
|
||||
"git.rosy.net.cn/topsdk/ability587/domain"
|
||||
"git.rosy.net.cn/topsdk/ability587/request"
|
||||
)
|
||||
|
||||
func (a API) GetStoreCategoryInfo(code string) (*CategoryInfo, error) {
|
||||
a.client.ServerUrl = "https://eco.taobao.com/router/rest/alibaba.wdk.sku.category.query"
|
||||
storeCategory := ability587.NewAbility587(&a.client)
|
||||
resp, err := storeCategory.AlibabaWdkSkuCategoryQuery(&request.AlibabaWdkSkuCategoryQueryRequest{Param: &domain.AlibabaWdkSkuCategoryQueryCategoryDo{Code: &code}}, "")
|
||||
if err != nil {
|
||||
|
||||
@@ -1,20 +1,66 @@
|
||||
package tao_vegetable
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/topsdk/ability585"
|
||||
"git.rosy.net.cn/topsdk/ability585/domain"
|
||||
"git.rosy.net.cn/topsdk/ability585/request"
|
||||
)
|
||||
|
||||
// AddStoreSku 新增门店商品
|
||||
func (a API) AddStoreSku(param *request.AlibabaWdkSkuAddRequest) (*[]domain.AlibabaWdkSkuAddApiResult, error) {
|
||||
client := ability585.NewAbility585(&a.client)
|
||||
|
||||
data, err := client.AlibabaWdkSkuAdd(param, a.token)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(err, false))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if data.Result.ErrCode != nil {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
return nil, fmt.Errorf(*data.Result.ErrMsg)
|
||||
}
|
||||
|
||||
return data.Result.Models, nil
|
||||
}
|
||||
|
||||
// UpdateStoreSku 更新门店商品
|
||||
func (a API) UpdateStoreSku(param *request.AlibabaWdkSkuUpdateRequest) (*[]domain.AlibabaWdkSkuUpdateApiResult, error) {
|
||||
client := ability585.NewAbility585(&a.client)
|
||||
|
||||
data, err := client.AlibabaWdkSkuUpdate(param, a.token)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(err, false))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if data.Result.ErrCode != nil {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
return nil, fmt.Errorf(*data.Result.ErrMsg)
|
||||
}
|
||||
|
||||
return data.Result.Models, nil
|
||||
}
|
||||
|
||||
// QueryStoreSKu 查询门店商品
|
||||
func (a API) QueryStoreSKu(param *request.AlibabaWdkSkuQueryRequest) (*[]domain.AlibabaWdkSkuQueryApiResult, error) {
|
||||
client := ability585.NewAbility585(&a.client)
|
||||
|
||||
data, err := client.AlibabaWdkSkuQuery(param, a.token)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(err, false))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if data.Result.ErrCode != nil {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
return nil, fmt.Errorf(*data.Result.ErrMsg)
|
||||
}
|
||||
|
||||
return data.Result.Models, nil
|
||||
}
|
||||
|
||||
//func (a API) QueryStoreDetailsList() {
|
||||
// a.client.ServerUrl = "qimen.taobao.qimen.pos.store.get"
|
||||
// storeCategory := ability587.NewAbility587(&a.client)
|
||||
// resp, err := storeCategory.AlibabaWdkSkuCategoryQuery(&request.AlibabaWdkSkuCategoryQueryRequest{Param: &domain.AlibabaWdkSkuCategoryQueryCategoryDo{Code: &code}}, "")
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// if resp.Result.ErrMsg != nil {
|
||||
// return nil, fmt.Errorf("requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrMsg)
|
||||
// }
|
||||
// var info *CategoryInfo
|
||||
// if err := json.Unmarshal([]byte(*resp.Result.Model), &info); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// return info, nil
|
||||
//}
|
||||
|
||||
@@ -4,10 +4,10 @@ import (
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/topsdk/ability587/domain"
|
||||
"git.rosy.net.cn/topsdk/ability587/request"
|
||||
"go.uber.org/zap"
|
||||
"testing"
|
||||
"topsdk/ability587/domain"
|
||||
"topsdk/ability587/request"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
27
platformapi/tao_vegetable/upload_img.go
Normal file
27
platformapi/tao_vegetable/upload_img.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package tao_vegetable
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/topsdk/ability1475"
|
||||
"git.rosy.net.cn/topsdk/ability1475/request"
|
||||
)
|
||||
|
||||
// UploadImg 上传图片
|
||||
func (a API) UploadImg(param *request.AlibabaWdkPictureUploadRequest) (string, error) {
|
||||
client := ability1475.NewAbility1475(&a.client)
|
||||
|
||||
data, err := client.AlibabaWdkPictureUpload(param, a.token)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(err, false))
|
||||
return "", err
|
||||
}
|
||||
|
||||
if data.Result.ErrCode != nil {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
return "", fmt.Errorf(*data.Result.ErrMsg)
|
||||
}
|
||||
|
||||
return *data.Result.Model.FullUrl, nil
|
||||
}
|
||||
Reference in New Issue
Block a user