提交 4c47a1f5 authored 作者: lihaixin's avatar lihaixin

更改结构体名称

上级 b1e3c5f2
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"errors" "errors"
) )
func (w *weimobConfig) RightsDetial(accessToken, rightsId string) (res RightsDetialRes, err error) { func (w *WeimobConfig) RightsDetial(accessToken, rightsId string) (res RightsDetialRes, err error) {
url := w.ApiUrl + "api/1_0/ec/rights/getRightsOrderDetail?accesstoken=" + accessToken url := w.ApiUrl + "api/1_0/ec/rights/getRightsOrderDetail?accesstoken=" + accessToken
query := map[string]interface{}{"id": rightsId} query := map[string]interface{}{"id": rightsId}
...@@ -19,7 +19,7 @@ func (w *weimobConfig) RightsDetial(accessToken, rightsId string) (res RightsDet ...@@ -19,7 +19,7 @@ func (w *weimobConfig) RightsDetial(accessToken, rightsId string) (res RightsDet
} }
//拒绝售后 //拒绝售后
func (w *weimobConfig) AfterSaleRefuse(accesstoken string, id int64, refusedReason string) (res string, err error) { func (w *WeimobConfig) AfterSaleRefuse(accesstoken string, id int64, refusedReason string) (res string, err error) {
if id <= 0 { if id <= 0 {
err = errors.New("售后id不能为空") err = errors.New("售后id不能为空")
return return
...@@ -42,7 +42,7 @@ func (w *weimobConfig) AfterSaleRefuse(accesstoken string, id int64, refusedReas ...@@ -42,7 +42,7 @@ func (w *weimobConfig) AfterSaleRefuse(accesstoken string, id int64, refusedReas
} }
//同意售后 //同意售后
func (w *weimobConfig) AfterSaleAgree(accesstoken string, id, rightsType int64) (res string, err error) { func (w *WeimobConfig) AfterSaleAgree(accesstoken string, id, rightsType int64) (res string, err error) {
if id <= 0 { if id <= 0 {
err = errors.New("售后id不能为空") err = errors.New("售后id不能为空")
return return
...@@ -65,7 +65,7 @@ func (w *weimobConfig) AfterSaleAgree(accesstoken string, id, rightsType int64) ...@@ -65,7 +65,7 @@ func (w *weimobConfig) AfterSaleAgree(accesstoken string, id, rightsType int64)
} }
//商家确认收货 a //商家确认收货 a
func (w *weimobConfig) ConfirmReceivedRightsGoods(accesstoken string, id int64) (res string, err error) { func (w *WeimobConfig) ConfirmReceivedRightsGoods(accesstoken string, id int64) (res string, err error) {
if id <= 0 { if id <= 0 {
err = errors.New("售后id不能为空") err = errors.New("售后id不能为空")
return return
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
) )
//获取授权店铺 //获取授权店铺
func (w *weimobConfig) GetShopRefreshToken(clientId, clientSecret, redirectUri, code string) (data *ShopAccessTokenRes, err error) { func (w *WeimobConfig) GetShopRefreshToken(clientId, clientSecret, redirectUri, code string) (data *ShopAccessTokenRes, err error) {
url := w.ApiUrl + "fuwu/b/oauth2/token?code=" + code + "&grant_type=authorization_code&client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirectUri url := w.ApiUrl + "fuwu/b/oauth2/token?code=" + code + "&grant_type=authorization_code&client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=" + redirectUri
res := w.DoPost(url, map[string]interface{}{}) res := w.DoPost(url, map[string]interface{}{})
err = json.Unmarshal([]byte(res), &data) err = json.Unmarshal([]byte(res), &data)
...@@ -13,7 +13,7 @@ func (w *weimobConfig) GetShopRefreshToken(clientId, clientSecret, redirectUri, ...@@ -13,7 +13,7 @@ func (w *weimobConfig) GetShopRefreshToken(clientId, clientSecret, redirectUri,
} }
//刷新店铺access_token接口 //刷新店铺access_token接口
func (w *weimobConfig) GetShopAccessToken(clientId, clientSecret, refreshToken string) (data *ShopAccessTokenRes, err error) { func (w *WeimobConfig) GetShopAccessToken(clientId, clientSecret, refreshToken string) (data *ShopAccessTokenRes, err error) {
url := w.ApiUrl + "fuwu/b/oauth2/token?grant_type=refresh_token&client_id=" + clientId + "&client_secret=" + clientSecret + "&refresh_token=" + refreshToken url := w.ApiUrl + "fuwu/b/oauth2/token?grant_type=refresh_token&client_id=" + clientId + "&client_secret=" + clientSecret + "&refresh_token=" + refreshToken
res := w.DoPost(url, map[string]interface{}{}) res := w.DoPost(url, map[string]interface{}{})
err = json.Unmarshal([]byte(res), &data) err = json.Unmarshal([]byte(res), &data)
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"encoding/json" "encoding/json"
) )
func (w *weimobConfig) GetSkuId(accesstoken string, outerSkuCode int, storeId string) (res *GetSkuIdRes, err error) { func (w *WeimobConfig) GetSkuId(accesstoken string, outerSkuCode int, storeId string) (res *GetSkuIdRes, err error) {
url := w.ApiUrl + "api/1_0/ec/singleProduct/queryProductListBySkuCode?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/singleProduct/queryProductListBySkuCode?accesstoken=" + accesstoken
data := w.DoPost(url, map[string]interface{}{"skuCode": outerSkuCode, "storeId": storeId}) data := w.DoPost(url, map[string]interface{}{"skuCode": outerSkuCode, "storeId": storeId})
...@@ -12,20 +12,20 @@ func (w *weimobConfig) GetSkuId(accesstoken string, outerSkuCode int, storeId st ...@@ -12,20 +12,20 @@ func (w *weimobConfig) GetSkuId(accesstoken string, outerSkuCode int, storeId st
return return
} }
func (w *weimobConfig) UpdatePrice(accesstoken string, req map[string]interface{}) (res *WeimobRes, err error) { func (w *WeimobConfig) UpdatePrice(accesstoken string, req map[string]interface{}) (res *WeimobRes, err error) {
url := w.ApiUrl + "api/1_0/ec/retailGoods/updatePrice?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/retailGoods/updatePrice?accesstoken=" + accesstoken
data := w.DoPost(url, req) data := w.DoPost(url, req)
err = json.Unmarshal([]byte(data), &res) err = json.Unmarshal([]byte(data), &res)
return return
} }
func (w *weimobConfig) UpdateStock(accesstoken string, req map[string]interface{}) (res *WeimobRes, err error) { func (w *WeimobConfig) UpdateStock(accesstoken string, req map[string]interface{}) (res *WeimobRes, err error) {
url := w.ApiUrl + "api/1_0/ec/goods/updateStock?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/goods/updateStock?accesstoken=" + accesstoken
data := w.DoPost(url, req) data := w.DoPost(url, req)
err = json.Unmarshal([]byte(data), &res) err = json.Unmarshal([]byte(data), &res)
return return
} }
func (w *weimobConfig) GoodsDetail(accesstoken, goodId string) (res *WeimobGoodsDetialResult, err error) { func (w *WeimobConfig) GoodsDetail(accesstoken, goodId string) (res *WeimobGoodsDetialResult, err error) {
url := w.ApiUrl + "api/1_0/ec/goods/queryGoodsDetail?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/goods/queryGoodsDetail?accesstoken=" + accesstoken
body, _ := json.Marshal(map[string]string{"goodsId": goodId}) body, _ := json.Marshal(map[string]string{"goodsId": goodId})
data := w.PostJSON(url, body) data := w.PostJSON(url, body)
...@@ -34,7 +34,7 @@ func (w *weimobConfig) GoodsDetail(accesstoken, goodId string) (res *WeimobGoods ...@@ -34,7 +34,7 @@ func (w *weimobConfig) GoodsDetail(accesstoken, goodId string) (res *WeimobGoods
} }
//查询模板 //查询模板
func (w *weimobConfig) FindFreightTemplateList(accesstoken string) (res *FindFreightTemplateListRes, err error) { func (w *WeimobConfig) FindFreightTemplateList(accesstoken string) (res *FindFreightTemplateListRes, err error) {
url := w.ApiUrl + "api/1_0/ec/goods/findFreightTemplateList?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/goods/findFreightTemplateList?accesstoken=" + accesstoken
data := w.DoPost(url, map[string]interface{}{}) data := w.DoPost(url, map[string]interface{}{})
err = json.Unmarshal([]byte(data), &res) err = json.Unmarshal([]byte(data), &res)
...@@ -42,7 +42,7 @@ func (w *weimobConfig) FindFreightTemplateList(accesstoken string) (res *FindFre ...@@ -42,7 +42,7 @@ func (w *weimobConfig) FindFreightTemplateList(accesstoken string) (res *FindFre
} }
//查询快递 //查询快递
func (w *weimobConfig) FindDeliveryTypeList(accesstoken string) (res *FindDeliveryTypeListRes, err error) { func (w *WeimobConfig) FindDeliveryTypeList(accesstoken string) (res *FindDeliveryTypeListRes, err error) {
url := w.ApiUrl + "api/1_0/ec/goods/findDeliveryTypeList?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/goods/findDeliveryTypeList?accesstoken=" + accesstoken
data := w.DoPost(url, map[string]interface{}{}) data := w.DoPost(url, map[string]interface{}{})
err = json.Unmarshal([]byte(data), &res) err = json.Unmarshal([]byte(data), &res)
...@@ -50,7 +50,7 @@ func (w *weimobConfig) FindDeliveryTypeList(accesstoken string) (res *FindDelive ...@@ -50,7 +50,7 @@ func (w *weimobConfig) FindDeliveryTypeList(accesstoken string) (res *FindDelive
} }
//查询sku //查询sku
func (w *weimobConfig) CategoryAttrInfo(accesstoken string, deliveryParams map[string]interface{}) (res *CategoryAttrInfoRes, err error) { func (w *WeimobConfig) CategoryAttrInfo(accesstoken string, deliveryParams map[string]interface{}) (res *CategoryAttrInfoRes, err error) {
url := w.ApiUrl + "api/1_0/ec/category/queryCategoryAttrInfo?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/category/queryCategoryAttrInfo?accesstoken=" + accesstoken
queryBody, err := json.Marshal(deliveryParams) queryBody, err := json.Marshal(deliveryParams)
if err != nil { if err != nil {
...@@ -62,7 +62,7 @@ func (w *weimobConfig) CategoryAttrInfo(accesstoken string, deliveryParams map[s ...@@ -62,7 +62,7 @@ func (w *weimobConfig) CategoryAttrInfo(accesstoken string, deliveryParams map[s
} }
//添加sku //添加sku
func (w *weimobConfig) AddAttributeName(accesstoken string, deliveryParams map[string]interface{}) (res *AddAttributeNameRes, err error) { func (w *WeimobConfig) AddAttributeName(accesstoken string, deliveryParams map[string]interface{}) (res *AddAttributeNameRes, err error) {
url := w.ApiUrl + "api/1_0/ec/category/addAttribute?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/category/addAttribute?accesstoken=" + accesstoken
body, err := json.Marshal(deliveryParams) body, err := json.Marshal(deliveryParams)
if err != nil { if err != nil {
...@@ -74,7 +74,7 @@ func (w *weimobConfig) AddAttributeName(accesstoken string, deliveryParams map[s ...@@ -74,7 +74,7 @@ func (w *weimobConfig) AddAttributeName(accesstoken string, deliveryParams map[s
} }
//添加sku值 //添加sku值
func (w *weimobConfig) AddAttributeValue(accesstoken string, deliveryParams map[string]interface{}) (res *AddAttributeValueRes, err error) { func (w *WeimobConfig) AddAttributeValue(accesstoken string, deliveryParams map[string]interface{}) (res *AddAttributeValueRes, err error) {
url := w.ApiUrl + "api/1_0/ec/category/addAttrValue?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/category/addAttrValue?accesstoken=" + accesstoken
body, err := json.Marshal(deliveryParams) body, err := json.Marshal(deliveryParams)
if err != nil { if err != nil {
...@@ -85,7 +85,7 @@ func (w *weimobConfig) AddAttributeValue(accesstoken string, deliveryParams map[ ...@@ -85,7 +85,7 @@ func (w *weimobConfig) AddAttributeValue(accesstoken string, deliveryParams map[
return return
} }
func (w *weimobConfig) Add(accesstoken string, good map[string]interface{}) (res *WeimobGoodsResult, err error) { func (w *WeimobConfig) Add(accesstoken string, good map[string]interface{}) (res *WeimobGoodsResult, err error) {
url := w.ApiUrl + "api/1_0/ec/goods/addGoods?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/goods/addGoods?accesstoken=" + accesstoken
body, err := json.Marshal(good) body, err := json.Marshal(good)
if err != nil { if err != nil {
...@@ -95,7 +95,7 @@ func (w *weimobConfig) Add(accesstoken string, good map[string]interface{}) (res ...@@ -95,7 +95,7 @@ func (w *weimobConfig) Add(accesstoken string, good map[string]interface{}) (res
err = json.Unmarshal([]byte(data), &res) err = json.Unmarshal([]byte(data), &res)
return return
} }
func (w *weimobConfig) Update(accesstoken string, good map[string]interface{}) (res *WeimobGoodsResult, err error) { func (w *WeimobConfig) Update(accesstoken string, good map[string]interface{}) (res *WeimobGoodsResult, err error) {
url := w.ApiUrl + "api/1_0/ec/goods/updateGoods?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/goods/updateGoods?accesstoken=" + accesstoken
body, err := json.Marshal(good) body, err := json.Marshal(good)
if err != nil { if err != nil {
...@@ -106,7 +106,7 @@ func (w *weimobConfig) Update(accesstoken string, good map[string]interface{}) ( ...@@ -106,7 +106,7 @@ func (w *weimobConfig) Update(accesstoken string, good map[string]interface{}) (
return return
} }
func (w *weimobConfig) Dels(accesstoken string, goodIds []int64) (res *WeimobGoodsDelResult, err error) { func (w *WeimobConfig) Dels(accesstoken string, goodIds []int64) (res *WeimobGoodsDelResult, err error) {
url := w.ApiUrl + "api/1_0/ec/goods/deleteGoods?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/goods/deleteGoods?accesstoken=" + accesstoken
body, _ := json.Marshal(map[string][]int64{"goodsIdList": goodIds}) body, _ := json.Marshal(map[string][]int64{"goodsIdList": goodIds})
data := w.PostJSON(url, body) data := w.PostJSON(url, body)
...@@ -114,13 +114,13 @@ func (w *weimobConfig) Dels(accesstoken string, goodIds []int64) (res *WeimobGoo ...@@ -114,13 +114,13 @@ func (w *weimobConfig) Dels(accesstoken string, goodIds []int64) (res *WeimobGoo
return return
} }
func (w *weimobConfig) CategoryTree(accesstoken string) (res *Result, err error) { func (w *WeimobConfig) CategoryTree(accesstoken string) (res *Result, err error) {
url := w.ApiUrl + "api/1_0/ec/category/queryCategoryTree?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/category/queryCategoryTree?accesstoken=" + accesstoken
data := w.DoPost(url, map[string]interface{}{}) data := w.DoPost(url, map[string]interface{}{})
err = json.Unmarshal([]byte(data), &res) err = json.Unmarshal([]byte(data), &res)
return return
} }
func (w *weimobConfig) ChildrenCategory(accesstoken string, categoryId int) (res *Result, err error) { func (w *WeimobConfig) ChildrenCategory(accesstoken string, categoryId int) (res *Result, err error) {
url := w.ApiUrl + "api/1_0/ec/category/queryChildrenCategory?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/category/queryChildrenCategory?accesstoken=" + accesstoken
body := map[string]interface{}{ body := map[string]interface{}{
"categoryId": categoryId, "categoryId": categoryId,
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"errors" "errors"
) )
func (w *weimobConfig) OrderDetial(accesstoken, orderNo string) (res *WeimodOrderDetialRes, err error) { func (w *WeimobConfig) OrderDetial(accesstoken, orderNo string) (res *WeimodOrderDetialRes, err error) {
if len(orderNo) <= 0 { if len(orderNo) <= 0 {
err = errors.New("订单号错误") err = errors.New("订单号错误")
return return
...@@ -21,7 +21,7 @@ func (w *weimobConfig) OrderDetial(accesstoken, orderNo string) (res *WeimodOrde ...@@ -21,7 +21,7 @@ func (w *weimobConfig) OrderDetial(accesstoken, orderNo string) (res *WeimodOrde
} }
//微店取消订单 //微店取消订单
func (w *weimobConfig) WeimobCancelOrder(accesstoken, orderNo, specificCancelReason, cancelReason string, cancelReasonId int) (res string, err error) { func (w *WeimobConfig) WeimobCancelOrder(accesstoken, orderNo, specificCancelReason, cancelReason string, cancelReasonId int) (res string, err error) {
if len(orderNo) <= 0 { if len(orderNo) <= 0 {
err = errors.New("订单号错误") err = errors.New("订单号错误")
return return
...@@ -49,7 +49,7 @@ func (w *weimobConfig) WeimobCancelOrder(accesstoken, orderNo, specificCancelRea ...@@ -49,7 +49,7 @@ func (w *weimobConfig) WeimobCancelOrder(accesstoken, orderNo, specificCancelRea
} }
//微店发货接口 //微店发货接口
func (w *weimobConfig) WeimobLogisticsAddMultiPack(accesstoken string, deliveryParams map[string]interface{}) (res string, err error) { func (w *WeimobConfig) WeimobLogisticsAddMultiPack(accesstoken string, deliveryParams map[string]interface{}) (res string, err error) {
url := w.ApiUrl + "api/1_0/ec/order/deliveryOrder?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/order/deliveryOrder?accesstoken=" + accesstoken
body, err := json.Marshal(deliveryParams) body, err := json.Marshal(deliveryParams)
if err != nil { if err != nil {
...@@ -59,7 +59,7 @@ func (w *weimobConfig) WeimobLogisticsAddMultiPack(accesstoken string, deliveryP ...@@ -59,7 +59,7 @@ func (w *weimobConfig) WeimobLogisticsAddMultiPack(accesstoken string, deliveryP
err = json.Unmarshal([]byte(data), &res) err = json.Unmarshal([]byte(data), &res)
return return
} }
func (w *weimobConfig) OrderList(accesstoken string, order *WeimodOrderListReq) (res *WeimodOrderListRes, err error) { func (w *WeimobConfig) OrderList(accesstoken string, order *WeimodOrderListReq) (res *WeimodOrderListRes, err error) {
url := w.ApiUrl + "api/1_0/ec/order/queryOrderList?accesstoken=" + accesstoken url := w.ApiUrl + "api/1_0/ec/order/queryOrderList?accesstoken=" + accesstoken
body, err := json.Marshal(order) body, err := json.Marshal(order)
if err != nil { if err != nil {
......
...@@ -7,18 +7,18 @@ import ( ...@@ -7,18 +7,18 @@ import (
"net/http" "net/http"
) )
type weimobConfig struct { type WeimobConfig struct {
ApiUrl string ApiUrl string
ServerName string ServerName string
} }
var Weimob = weimobConfig{ var Weimob = WeimobConfig{
" you ApiUrl", //无特殊情况为 "https://dopen.weimob.com/", " you ApiUrl", //无特殊情况为 "https://dopen.weimob.com/",
"you ServerName", //项目名 "you ServerName", //项目名
} }
//post json参数 //post json参数
func (w *weimobConfig) PostJSON(url string, data []byte) string { func (w *WeimobConfig) PostJSON(url string, data []byte) string {
req, err := http.NewRequest("POST", url, bytes.NewReader(data)) req, err := http.NewRequest("POST", url, bytes.NewReader(data))
if err != nil { if err != nil {
return "" return ""
...@@ -39,7 +39,7 @@ func (w *weimobConfig) PostJSON(url string, data []byte) string { ...@@ -39,7 +39,7 @@ func (w *weimobConfig) PostJSON(url string, data []byte) string {
} }
//Json post //Json post
func (w *weimobConfig) DoPost(url string, params map[string]interface{}) string { func (w *WeimobConfig) DoPost(url string, params map[string]interface{}) string {
data, errp := json.Marshal(params) data, errp := json.Marshal(params)
if errp != nil { if errp != nil {
// logs.Log("POST/PostJSON/ERR", "error", "参数json化错误:【%v】 ", errp) // logs.Log("POST/PostJSON/ERR", "error", "参数json化错误:【%v】 ", errp)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论