京东商城同步修改,关注可售修改

This commit is contained in:
苏尹岚
2020-05-18 18:13:11 +08:00
parent 434c803377
commit 4a15e4fc96
5 changed files with 87 additions and 29 deletions

View File

@@ -3,6 +3,7 @@ package jdshop
import (
"encoding/base64"
"encoding/json"
"strings"
"git.rosy.net.cn/baseapi/platformapi/jdshopapi"
"git.rosy.net.cn/baseapi/utils"
@@ -15,6 +16,18 @@ import (
)
func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (storeDetail *dao.StoreDetail, err error) {
result, err := api.JdShopAPI.NewInfoList(utils.Str2Int64(vendorStoreID))
storeDetail.VendorStoreID = vendorStoreID
storeDetail.Status = JdsStatus2jxStatus(result.StoreStatus)
result2, err := api.JdShopAPI.QueryEntityStore(utils.Str2Int64(vendorStoreID))
storeDetail.ID = utils.Str2Int(result2.ExStoreID)
storeDetail.Name = result2.StoreName
storeDetail.Address = result2.Address
storeDetail.Tel1 = result2.Phone
storeDetail.DistrictCode = result2.AddrCode
zbs := strings.Split(result2.Coordinate, ",")
storeDetail.Lat = jxutils.StandardCoordinate2Int(utils.Str2Float64(zbs[0]))
storeDetail.Lng = jxutils.StandardCoordinate2Int(utils.Str2Float64(zbs[1]))
return storeDetail, err
}
@@ -80,6 +93,11 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
}
func (p *PurchaseHandler) DeleteStore(db *dao.DaoDB, storeID int, userName string) (err error) {
// store, err := dao.GetStoreDetail(db, storeID, model.VendorIDJDShop)
// if err != nil {
// return err
// }
// err = api.JdShopAPI.DeleteStoresByID(utils.Str2Int64(store.VendorStoreID))
return err
}
@@ -130,3 +148,14 @@ func jxStatus2JdsStatus(status int) (result int) {
}
return result
}
func JdsStatus2jxStatus(status int) (result int) {
if status == jdshopapi.JdsStoreStatusOnline {
result = model.StoreStatusOpened
} else if status == jdshopapi.JdsStoreStatusRest {
result = model.StoreStatusClosed
} else {
result = model.StoreStatusDisabled
}
return result
}