- refactor AccessAPINoPage.
- product related api added.
This commit is contained in:
@@ -1,12 +1,43 @@
|
||||
package jdapi
|
||||
|
||||
// todo 没有删除门店的方法?
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
KeyStationName = "stationName"
|
||||
KeyOutSystemId = "outSystemId"
|
||||
KeyPhone = "phone"
|
||||
KeyMobile = "mobile"
|
||||
KeyCity = "city"
|
||||
KeyCounty = "county"
|
||||
KeyStationAddress = "stationAddress"
|
||||
KeyOperator = "operator"
|
||||
KeyServiceTimeStart1 = "serviceTimeStart1"
|
||||
KeyServiceTimeEnd1 = "serviceTimeEnd1"
|
||||
KeyServiceTimeStart2 = "serviceTimeStart2"
|
||||
KeyServiceTimeEnd2 = "serviceTimeEnd2"
|
||||
KeyLng = "lng"
|
||||
KeyLat = "lat"
|
||||
KeyDeliveryRangeType = "deliveryRangeType"
|
||||
KeyCoordinateType = "coordinateType"
|
||||
KeyDeliveryRangeRadius = "deliveryRangeRadius"
|
||||
KeyCoordinatePoints = "coordinatePoints"
|
||||
KeyCloseStatus = "closeStatus"
|
||||
KeyStoreNotice = "storeNotice"
|
||||
KeyStandByPhone = "standByPhone"
|
||||
)
|
||||
|
||||
type CreateShopResult struct {
|
||||
DeliveryRangeType int `json:"deliveryRangeType"`
|
||||
CoordinatePoints string `json:"coordinatePoints"`
|
||||
}
|
||||
|
||||
// 获取门店编码列表接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=138426aa19b54c48ae8464af1ca3b681
|
||||
func (a API) GetStationsByVenderId() ([]string, error) {
|
||||
result, err := a.AccessAPINoPage("store/getStationsByVenderId", nil, nil, nil)
|
||||
func (a *API) GetStationsByVenderId() ([]string, error) {
|
||||
result, err := a.AccessAPINoPage("store/getStationsByVenderId", nil, nil, nil, nil)
|
||||
if err == nil {
|
||||
result2 := result.([]interface{})
|
||||
retVal := make([]string, len(result2))
|
||||
@@ -18,59 +49,95 @@ func (a API) GetStationsByVenderId() ([]string, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 新增不带资质的门店信息接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=93acef27c3aa4d8286d5c8c26b493629
|
||||
func (a *API) CreateStore(stationName, phone string, city, county int, stationAddress, userName string, serviceTimeStart1, serviceTimeEnd1 int, lng, lat float64, deliveryRangeType, coordinateType int, standByPhone string, addParams map[string]interface{}) (*CreateShopResult, error) {
|
||||
params := map[string]interface{}{
|
||||
KeyStationName: stationName,
|
||||
KeyPhone: phone,
|
||||
KeyCity: city,
|
||||
KeyCounty: county,
|
||||
KeyStationAddress: stationAddress,
|
||||
KeyOperator: utils.GetAPIOperator(userName),
|
||||
KeyServiceTimeStart1: serviceTimeStart1,
|
||||
KeyServiceTimeEnd2: serviceTimeEnd1,
|
||||
KeyLng: lng,
|
||||
KeyLat: lat,
|
||||
KeyDeliveryRangeType: deliveryRangeType,
|
||||
KeyCoordinateType: coordinateType,
|
||||
KeyStandByPhone: standByPhone,
|
||||
}
|
||||
result, err := a.AccessAPINoPage("store/createStore", utils.MergeMaps(params, addParams), nil, nil, nil)
|
||||
if err == nil {
|
||||
result2 := result.(map[string]interface{})
|
||||
retVal := &CreateShopResult{
|
||||
DeliveryRangeType: int(utils.MustInterface2Int64(result2["deliveryRangeType"])),
|
||||
CoordinatePoints: utils.Interface2String(result2["coordinatePoints"]),
|
||||
}
|
||||
return retVal, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 根据到家门店编码查询门店基本信息接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=4c48e347027146d5a103e851055cb1a7
|
||||
func (a API) GetStoreInfoByStationNo(storeNo string) (map[string]interface{}, error) {
|
||||
result, err := a.AccessAPINoPage("storeapi/getStoreInfoByStationNo", utils.Params2Map("StoreNo", storeNo), nil, nil)
|
||||
func (a *API) GetStoreInfoByStationNo(storeNo string) (map[string]interface{}, error) {
|
||||
result, err := a.AccessAPINoPage("storeapi/getStoreInfoByStationNo", utils.Params2Map("StoreNo", storeNo), nil, nil, nil)
|
||||
if err == nil {
|
||||
return result.(map[string]interface{}), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 修改门店基础信息接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=2600369a456446f0921e918f3d15e96a
|
||||
func (a API) UpdateStoreInfo4Open(storeNo, operator string, addParams map[string]interface{}) (string, error) {
|
||||
func (a *API) UpdateStoreInfo4Open(storeNo, userName string, addParams map[string]interface{}) (string, error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"stationNo": storeNo,
|
||||
"operator": operator,
|
||||
"operator": utils.GetAPIOperator(userName),
|
||||
}
|
||||
for k, v := range addParams {
|
||||
jdParams[k] = v
|
||||
}
|
||||
result, err := a.AccessAPINoPage("store/updateStoreInfo4Open", jdParams, nil, nil)
|
||||
result, err := a.AccessAPINoPage("store/updateStoreInfo4Open", jdParams, nil, nil, nil)
|
||||
if err == nil {
|
||||
return result.(string), nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
func (a API) GetCommentByOrderId(orderId int64) (map[string]interface{}, error) {
|
||||
// 根据订单号查询商家门店评价信息接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=bd23397725bb4e74b69e2f2fa1c88d43
|
||||
func (a *API) GetCommentByOrderId(orderId int64) (map[string]interface{}, error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"orderId": orderId,
|
||||
}
|
||||
result, err := a.AccessAPINoPage("commentOutApi/getCommentByOrderId", jdParams, nil, nil)
|
||||
result, err := a.AccessAPINoPage("commentOutApi/getCommentByOrderId", jdParams, nil, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.(map[string]interface{}), nil
|
||||
}
|
||||
|
||||
// 商家门店评价信息回复接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=ea0b466a7fa8489b813e8b197efca2d4?
|
||||
func (a API) OrgReplyComment(orderID int64, storeID, content, replayPin string) (string, error) {
|
||||
func (a *API) OrgReplyComment(orderID int64, storeID, content, replayPin string) (string, error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"orderId": orderID,
|
||||
"storeId": storeID,
|
||||
"content": content,
|
||||
"replyPin": replayPin,
|
||||
}
|
||||
result, err := a.AccessAPINoPage("commentOutApi/orgReplyComment", jdParams, nil, nil)
|
||||
result, err := a.AccessAPINoPage("commentOutApi/orgReplyComment", jdParams, nil, nil, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return result.(string), nil
|
||||
}
|
||||
|
||||
// 根据到家门店编码修改商家自动接单接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=5df446bb5ff14413965b8d702718dc48
|
||||
func (a API) UpdateStoreConfig4Open(stationNo string, isAutoOrder bool) (bool, error) {
|
||||
func (a *API) UpdateStoreConfig4Open(stationNo string, isAutoOrder bool) (bool, error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"stationNo": stationNo,
|
||||
}
|
||||
@@ -80,7 +147,7 @@ func (a API) UpdateStoreConfig4Open(stationNo string, isAutoOrder bool) (bool, e
|
||||
} else {
|
||||
jdParams["isAutoOrder"] = 1
|
||||
}
|
||||
result, err := a.AccessAPINoPage("store/updateStoreConfig4Open", jdParams, nil, nil)
|
||||
result, err := a.AccessAPINoPage("store/updateStoreConfig4Open", jdParams, nil, nil, nil)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user