京东商城直辖市问题解决
This commit is contained in:
@@ -151,6 +151,14 @@ var (
|
|||||||
VendorIDEBAI: 0,
|
VendorIDEBAI: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZXCityCodeMap = map[int]string{
|
||||||
|
310100: "上海市",
|
||||||
|
110100: "北京市",
|
||||||
|
120100: "天津市",
|
||||||
|
440300: "深圳市",
|
||||||
|
500100: "重庆市",
|
||||||
|
}
|
||||||
|
|
||||||
PrinterVendorInfo = map[int][]string{
|
PrinterVendorInfo = map[int][]string{
|
||||||
VendorIDFeiE: []string{
|
VendorIDFeiE: []string{
|
||||||
VendorChineseNames[VendorIDFeiE],
|
VendorChineseNames[VendorIDFeiE],
|
||||||
|
|||||||
@@ -105,6 +105,31 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
|||||||
if createEntityStoreParam.AddCode == 0 {
|
if createEntityStoreParam.AddCode == 0 {
|
||||||
createEntityStoreParam.AddCode = store.JdCode
|
createEntityStoreParam.AddCode = store.JdCode
|
||||||
}
|
}
|
||||||
|
//证明这个店可能隶属直辖市
|
||||||
|
if model.ZXCityCodeMap[store.CityCode] != "" {
|
||||||
|
result1, _ := api.JdShopAPI.GetProvince()
|
||||||
|
for _, v := range result1 {
|
||||||
|
if v.AreaName == model.ZXCityCodeMap[store.CityCode] {
|
||||||
|
result2, _ := api.JdShopAPI.GetCity(v.AreaID)
|
||||||
|
for _, vv := range result2 {
|
||||||
|
if vv.AreaName == store.DistrictName {
|
||||||
|
result3, _ := api.JdShopAPI.GetCounty(vv.AreaID)
|
||||||
|
for _, vvv := range result3 {
|
||||||
|
result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat))
|
||||||
|
if result["regeocode"] != nil {
|
||||||
|
street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
|
||||||
|
if street != "" {
|
||||||
|
if street == vvv.AreaName {
|
||||||
|
createEntityStoreParam.AddCode = vvv.AreaID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
vendorStoreID, err = api.JdShopAPI.CreateEntityStore(createEntityStoreParam)
|
vendorStoreID, err = api.JdShopAPI.CreateEntityStore(createEntityStoreParam)
|
||||||
return vendorStoreID, err
|
return vendorStoreID, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user