fnps
This commit is contained in:
62
business/partner/delivery/fn/store.go
Normal file
62
business/partner/delivery/fn/store.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package fn
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/fnpsapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
func (c *DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (vendorStoreID string, status int, err error) {
|
||||
err = api.FnAPI.CreateStore(&fnpsapi.CreateStoreParam{
|
||||
ChainStoreCode: utils.Int2Str(storeDetail.ID),
|
||||
ChainStoreName: storeDetail.Name,
|
||||
ContactPhone: storeDetail.Tel1,
|
||||
Address: storeDetail.Address,
|
||||
PositionSource: 3,
|
||||
Longitude: utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lng)),
|
||||
Latitude: utils.Float64ToStr(jxutils.IntCoordinate2Standard(storeDetail.Lat)),
|
||||
})
|
||||
if err == nil {
|
||||
vendorStoreID = utils.Int2Str(storeDetail.ID)
|
||||
}
|
||||
return vendorStoreID, status, err
|
||||
}
|
||||
|
||||
func shopStatus2JX(status int) (jxStatus int) {
|
||||
if status == 1 {
|
||||
return 0
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) GetStore(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeDetail *dao.StoreDetail2, err error) {
|
||||
shopInfo, err := api.FnAPI.GetStore(storeID)
|
||||
if err == nil {
|
||||
storeDetail = &dao.StoreDetail2{
|
||||
Store: model.Store{
|
||||
Name: shopInfo.ChainStoreName,
|
||||
Tel1: shopInfo.ContactPhone,
|
||||
Address: shopInfo.Address,
|
||||
Lng: jxutils.StandardCoordinate2Int(utils.Str2Float64(shopInfo.Longitude)),
|
||||
Lat: jxutils.StandardCoordinate2Int(utils.Str2Float64(shopInfo.Latitude)),
|
||||
},
|
||||
VendorID: model.VendorIDFengNiao,
|
||||
VendorStoreID: shopInfo.ChainStoreCode,
|
||||
CourierStatus: shopStatus2JX(shopInfo.Status),
|
||||
}
|
||||
}
|
||||
return storeDetail, err
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) IsErrStoreExist(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) IsErrStoreNotExist(err error) bool {
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user