460 lines
31 KiB
Go
460 lines
31 KiB
Go
package fnpsapi
|
||
|
||
import (
|
||
"git.rosy.net.cn/baseapi/platformapi"
|
||
"net/http"
|
||
"sync"
|
||
)
|
||
|
||
const (
|
||
TokenURL = "https://open-anubis.ele.me/anubis-webapi/openapi/token" // 正式环境
|
||
ApiURL = "https://open-anubis.ele.me/anubis-webapi/v3/invoke" // 正式环境
|
||
RefreshTokenUrl = "https://open-anubis.ele.me/anubis-webapi/openapi/refreshToken" // 正式环境刷新token
|
||
//TokenURL = "https://exam-anubis.ele.me/anubis-webapi/openapi/token" // 沙箱环境
|
||
//ApiURL = "https://exam-anubis.ele.me/anubis-webapi/v3/invoke" // 沙箱环境
|
||
RequestPost = "POST"
|
||
RequestGet = "GET"
|
||
)
|
||
|
||
// 注册请求api
|
||
type API struct {
|
||
grantType string `json:"grant_type"`
|
||
code string `json:"code"`
|
||
appID string `json:"app_id"`
|
||
merchantId string `json:"merchant_id"`
|
||
signature string `json:"signature"`
|
||
timestamp int64 `json:"timestamp"`
|
||
accessToken string `json:"access_token"`
|
||
refreshToken string `json:"refresh_token"`
|
||
appSecret string `json:"app_secret"`
|
||
version string `json:"version"`
|
||
locker sync.RWMutex
|
||
client *http.Client
|
||
config *platformapi.APIConfig
|
||
}
|
||
|
||
// 请求基础结构体
|
||
type BaseInfo struct {
|
||
AccessToken string `json:"access_token"` //凭证token
|
||
Signature string `json:"signature"`
|
||
MerchantID string `json:"merchant_id"` //商户id
|
||
Version string `json:"version"` // 版本固定1.0
|
||
AppID string `json:"app_id"` //应用id
|
||
Timestamp int64 `json:"timestamp"` // 当前时间戳
|
||
}
|
||
|
||
//#region 获取授权token
|
||
|
||
// 获取token
|
||
type TokenInfo struct {
|
||
Sign string `json:"sign"` //返回值签名,详见开放平台侧返回值签名算法
|
||
Code string `json:"code"` //错误码,详见开放平台侧错误码映射表
|
||
Msg string `json:"msg"` //错误信息
|
||
BusinessData string `json:"business_data"` // string
|
||
BusinessDataObj *BusinessData // BusinessData 对象
|
||
}
|
||
|
||
type BusinessData struct {
|
||
AppID string `json:"app_id"` //应用id
|
||
MerchantID string `json:"merchant_id"` //商户id
|
||
AccessToken string `json:"access_token"` //凭证token
|
||
RefreshToken string `json:"refresh_token"` //刷新token
|
||
ExpireIn int64 `json:"expire_in"` //access_token剩余有效时间,单位:秒,默认有效期是一年
|
||
ReExpireIn int64 `json:"re_expire_in"` //refresh_token剩余有效时间
|
||
}
|
||
|
||
//#endregion
|
||
|
||
//<---------------------------------------------------门店--------------------------------------------------------------------------------------->
|
||
//#region 获取蜂鸟门店信息
|
||
|
||
// 获取单个门店查询
|
||
type GetOneStoreParam struct {
|
||
BaseInfo
|
||
BusinessData string `json:"business_data"` // 门店基础数据
|
||
}
|
||
|
||
// 获取单个门店基础参数(请求)
|
||
type GetOneStore struct {
|
||
MerchantID string `json:"merchant_id"` // 商户id
|
||
OutShopCode string `json:"out_shop_code"` // 外部门店编码
|
||
ChainStoreId string `json:"chain_store_id,omitempty"` // 门店id
|
||
|
||
}
|
||
|
||
// 获取单个门店(返回)
|
||
type GetOneStoreRespData struct {
|
||
Address string `json:"address"` // 门店地址
|
||
BranchName string `json:"branch_name"` // 门店分店名
|
||
CategoryID int `json:"category_id"` // 门店类目
|
||
ChainStoreID int `json:"chain_store_id"` // 蜂鸟门店id,创建接口返回的id
|
||
ChainstoreType int `json:"chainstore_type"` // 门店类型 1-正式门店;2-测试门店
|
||
ChainstoreTypeDesc string `json:"chainstore_type_desc"` // 门店类型描述
|
||
ContactPhone string `json:"contact_phone"` // 门店联系方式
|
||
CreditCode string `json:"credit_code"` // 统一社会信用代码
|
||
Latitude float64 `json:"latitude"` // 门店纬度[0,90]
|
||
Longitude float64 `json:"longitude"` // 门店经度[0,180]
|
||
MerchantID int `json:"merchant_id"` // 所属商户id
|
||
ModifyStatus int `json:"modify_status"` // 0-无修改,10-资料修改审核中,20-审核通过,30-a审核驳回
|
||
ModifyStatusDesc string `json:"modify_status_desc"` // 门店修改状态描述
|
||
Name string `json:"name"` // 门店主店名
|
||
OutShopCode string `json:"out_shop_code"` // 外部门店编码
|
||
OwnerIDNum string `json:"owner_id_num"` // 门店拥有人身份证号
|
||
OwnerName string `json:"owner_name"` // 门店拥有人姓名
|
||
PositionSource int `json:"position_source"` // 经纬度来源 坐标属性(1:腾讯地图, 2:百度地图, 3:高德地图),蜂鸟建议使用高德地图
|
||
PositionSourceDesc string `json:"position_source_desc"` // 经纬度来源说明
|
||
SettlementAccountID int `json:"settlement_account_id"` // 门店结算账号id
|
||
SettlementMode int `json:"settlement_mode"` // 门店结算方式 1:实时结算; 2:账期结算;
|
||
SettlementModeDesc string `json:"settlement_mode_desc"` // 结算说明?
|
||
Status int `json:"status"` // 0-上架审核中,20-正常(已上架),30-上架审核失败,40-已冻结,50-已下架
|
||
StatusDesc string `json:"status_desc"` // 门店认证状态描述
|
||
}
|
||
|
||
// 更新蜂鸟门店信息
|
||
type UpdateStoreParam struct {
|
||
// 必填
|
||
ChainStoreID int `json:"chain_store_id"` // 蜂鸟门店id,创建接口返回的id
|
||
HeadShopName string `json:"head_shop_name"` // 门店主店名
|
||
ContactPhone string `json:"contact_phone"` // 门店联系方式
|
||
Address string `json:"address"` // 门店地址
|
||
Longitude float64 `json:"longitude"` // 纬度
|
||
Latitude float64 `json:"latitude"` // 门店纬度
|
||
PositionSource int `json:"position_source"` // 经纬度来源 坐标属性:高德地图:3;目前只支持高德地图坐标
|
||
OutShopCode string `json:"out_shop_code"` // 外部门店编码
|
||
CategoryID string `json:"category_id"` // 门店类目
|
||
OwnerName string `json:"owner_name"` // 门店主店名
|
||
OwnerIDNum string `json:"owner_id_num"` // 门店拥有人身份证号
|
||
HandheldLicencePicHash string `json:"handheld_licence_pic_hash"` // 门店拥有人手持身份证、营业执照图片
|
||
OwnerIDPicFrontHash string `json:"owner_id_pic_front_hash"` // 身份证正面
|
||
OwnerIDPicBackHash string `json:"owner_id_pic_back_hash"` // 身份证反面
|
||
CreditCode string `json:"credit_code"` // 统一社会信用代码
|
||
BusinessLicencePicHash string `json:"business_licence_pic_hash"` // 营业执照图片
|
||
|
||
// 选填
|
||
BranchShopName string `json:"branch_shop_name"` // 门店主店名
|
||
ChainstoreType int `json:"chainstore_type"`
|
||
FoodLicensePicHash string `json:"food_license_pic_hash"` // 食品安全执照图片
|
||
SecondMedicalEquipmentLicensePicHash string `json:"second_medical_equipment_license_pic_hash"` // 第二类医疗器械类目必传
|
||
MedicalInstitutionLicensePicHash string `json:"medical_institution_license_pic_hash"` // 医疗机构必传
|
||
MedicalEquipmentLicensePicHash string `json:"medical_equipment_license_pic_hash"` // 经营医疗器械必传
|
||
MedicineLicensePicHash string `json:"medicine_license_pic_hash"` // 药品经营许可证
|
||
TabacooLicensePicHash string `json:"tabacoo_license_pic_hash"` // 烟草经营许可证图片
|
||
}
|
||
|
||
// 创建门店基础数据
|
||
type CreateStoreBaseInfo struct {
|
||
// 必填
|
||
HeadShopName string `json:"head_shop_name"` // 门店主店名
|
||
ContactPhone string `json:"contact_phone"` // 门店联系方式
|
||
Address string `json:"address"` // 门店地址
|
||
Longitude float64 `json:"longitude"` // 门店经度(0-18)
|
||
Latitude float64 `json:"latitude"` // 门店纬度(0-90)
|
||
PositionSource int `json:"position_source"` // 经纬度来源只支持高德(默认值3)
|
||
OutShopCode string `json:"out_shop_code"` // 外部门店编码
|
||
CategoryID string `json:"category_id"` // 门店类目
|
||
OwnerName string `json:"owner_name"` // 门店拥有人姓名
|
||
OwnerIDNum string `json:"owner_id_num"` // 门店拥有人身份证号
|
||
HandheldLicencePicHash string `json:"handheld_licence_pic_hash"` // 门店拥有人手持身份证、营业执照图片
|
||
OwnerIDPicFrontHash string `json:"owner_id_pic_front_hash"` // 身份证正面
|
||
OwnerIDPicBackHash string `json:"owner_id_pic_back_hash"` // 身份证反面
|
||
CreditCode string `json:"credit_code"` // 统一社会信用代码
|
||
BusinessLicencePicHash string `json:"business_licence_pic_hash"` // 营业执照图片
|
||
|
||
// 非必填
|
||
BranchShopName string `json:"branch_shop_name"` // 门店分店名
|
||
ChainstoreType int `json:"chainstore_type"` // 门店类型 1:正式门店;2:测试门店;默认为1
|
||
SettlementModel string `json:"settlement_model"` // 1:实时结算; 2:账期结算;默认为1,若为账期结算,需额外传入结算账号id
|
||
SettlementAccountID string `json:"settlement_account_id"` // 门店结算账号id
|
||
|
||
// 经营类目包含食品必传
|
||
FoodLicensePicHash string `json:"food_license_pic_hash"` // 食品安全执照图片(食品经营必传)
|
||
SecondMedicalEquipmentLicensePicHash string `json:"second_medical_equipment_license_pic_hash"` // 第二类医疗器械类目必传
|
||
MedicalInstitutionLicensePicHash string `json:"medical_institution_license_pic_hash"` // 医疗机构必传
|
||
MedicalEquipmentLicensePicHash string `json:"medical_equipment_license_pic_hash"` // 经营医疗器械必传
|
||
MedicineLicensePicHash string `json:"medicine_license_pic_hash"` // 药品经营许可证
|
||
TabacooLicensePicHash string `json:"tabacoo_license_pic_hash"` // 烟草经营许可证图片
|
||
|
||
}
|
||
|
||
//#endregion
|
||
|
||
// <--------------------------------------------------订单------------------------------------------------------------------->
|
||
//#region 预请求获取订单
|
||
type PreCreateOrder struct {
|
||
// 必填参数
|
||
PartnerOrderCode string `json:"partner_order_code"` // 外部订单号
|
||
OrderType int `json:"order_type"` // 订单类型(1:即时单,3:预约单)
|
||
PositionSource int `json:"position_source"` // 经纬度来源
|
||
ReceiverAddress string `json:"receiver_address"` // 收货人地址 文字描述
|
||
ReceiverLongitude float64 `json:"receiver_longitude"` // 收货人经度
|
||
ReceiverLatitude float64 `json:"receiver_latitude"` // 收货人纬度
|
||
GoodsTotalAmountCent int64 `json:"goods_total_amount_cent"` // 订单商品总金额(分)
|
||
GoodsActualAmountCent int64 `json:"goods_actual_amount_cent"` // 订单商品客户实际支付金额
|
||
GoodsWeight float64 `json:"goods_weight"` // 订单总重量(kg)
|
||
GoodsCount int `json:"goods_count"` // 货物件数
|
||
GoodsItemList []*GoodsItemsList // 货物列表
|
||
|
||
// 非必填参数
|
||
TransportLongitude float64 `json:"transport_longitude,omitempty"` // 取货经度
|
||
TransportLatitude float64 `json:"transport_latitude,omitempty"` // 取货纬度
|
||
TransportTel string `json:"transport_tel,omitempty"` // 取货点联系人电话
|
||
OutShopCode string `json:"out_shop_code,omitempty"` // 外部门店id 当使用门店发单 out_shop_code和chain_store_id必填1个
|
||
ChainStoreID string `json:"chain_store_id"` // 门店id
|
||
OrderSource string `json:"order_source,omitempty"` // 饿百订单传109 商户订单来源(如饿了么、美团等)手发单/未知来源: 0 或不传 美团: 2 口碑: 4 饿了么: 6支付宝: 7 饿百: 8
|
||
//ServiceGoodsId int64 `json:"service_goods_id"` // 服务商品id(不传)
|
||
//BaseGoodsId int64 `json:"base_goods_id"` // 基础商品id
|
||
RequireReceiveTime string `json:"require_receive_time"` // 需要送达时间 预约单如(需要送达时间 – 推单时间) < 60min
|
||
OrderAddTime int64 `json:"order_add_time,omitempty"` // 下单时间毫秒
|
||
UseCoupon int `json:"use_coupon,omitempty"` // 是否使用优惠券 0:不使用, 1:使用 默认使用
|
||
ExpectFetchTime int64 `json:"expect_fetch_time,omitempty"` // 预计出餐时间(毫秒) (预约单该字段必填)建议和商务合同里约定的承诺出货时长保持一致,否则影响考核结算
|
||
TransportAddress string `json:"transport_address"` // 取货点地址描述
|
||
OrderTipAmountCent int64 `json:"order_tip_amount_cent,omitempty"` // 取货点地址描述
|
||
//OrderRemark string `json:"order_remark"`
|
||
//FetchCode string `json:"fetch_code"`
|
||
//WriteOffCode string `json:"write_off_code"`
|
||
//CustomerExtTel string `json:"customer_ext_tel"`
|
||
}
|
||
|
||
// 货物明细
|
||
type GoodsItemsList struct {
|
||
ItemName string `json:"item_name"` // 商品名字
|
||
ItemQuantity int `json:"item_quantity"` // 商品数量
|
||
ItemAmountCent int64 `json:"item_amount_cent"` // 商品原价分
|
||
ItemActualAmountCent int64 `json:"item_actual_amount_cent"` // 商品实际支付金额,必须是乘以数量后的金额,否则影响售后环节的赔付标准
|
||
|
||
// 非必填
|
||
ItemId string `json:"item_id"` // 商品编号
|
||
ItemSize int `json:"item_size"` // 商品尺寸 1:小, 2:中, 3:大
|
||
ItemRemark string `json:"item_remark"` // 品备注(不超过255个字符)
|
||
}
|
||
|
||
// 蜂鸟请求预下单返回值
|
||
type PreCreateOrderResp struct {
|
||
Distance int64 `json:"distance"` //配送距离
|
||
CityId int64 `json:"city_id"` // 城市id
|
||
Time int64 `json:"time"` // 预询时间戳
|
||
GoodsInfos []*GoodsInfos `json:"goods_infos"` // 服务商品明细
|
||
}
|
||
|
||
// 预下单商品服务明细
|
||
type GoodsInfos struct {
|
||
ServiceGoodsId int64 `json:"service_goods_id"` // 服务商品id
|
||
BaseGoodsId int64 `json:"base_goods_id"` // 基础商品id
|
||
IsValid int `json:"is_valid"` // 是否可用0不可,1可
|
||
DisableReason string `json:"disable_reason"` // 不可用原因描述
|
||
PredictDeliveryTime int64 `json:"predict_delivery_time"` // 预计送达时间戳
|
||
PredictDeliveryMinutes int `json:"predict_delivery_minutes"` // 预计送达时长分钟
|
||
CanAddTip int `json:"can_add_tip"` // 服务商品是否支持加小费0否1是
|
||
Slogan string `json:"slogan"` // 商品介绍
|
||
TotalDeliveryAmountCent int64 `json:"total_delivery_amount_cent"` // 原始配送费总价格(含入参小费金额) 分
|
||
ActualDeliveryAmountCent int64 `json:"actual_delivery_amount_cent"` // 优惠后配送费总价格(含入参小费金额) 入单实际价格 关注这一个字段就行!!!
|
||
PriceDetail *PriceOpenapiDetail `json:"price_detail"` // 加价说明
|
||
WarehouseId int64 `json:"warehouse_id"` // 优惠券记录id
|
||
TIndexid string `json:"t_indexid"` // 预询标识 入单时需传入,标识本次预询
|
||
}
|
||
|
||
// 订单加价说明
|
||
type PriceOpenapiDetail struct {
|
||
StartPriceCent int `json:"start_price_cent"` // 起送价 分
|
||
DistancePriceCent int `json:"distance_price_cent"` // 距离加价
|
||
WeightPriceCent int `json:"weight_price_cent"` // 重量加价
|
||
TimePeriodSurchargeCent int `json:"time_period_surcharge_cent"` // 时段加价
|
||
TemporarySurchargeCent int `json:"temporary_surcharge_cent"` // 临时加价
|
||
CategorySurchargeCent int `json:"category_surcharge_cent"` // 品类加价
|
||
OrderPriceSurchargeCent int `json:"order_price_surcharge_cent"` // 客单价加价
|
||
PressureSurchargeCent int `json:"pressure_surcharge_cent"` // 运力紧张加价
|
||
RiverCrossingSurchargeCent int `json:"river_crossing_surcharge_cent"` // 跨江单加价
|
||
}
|
||
|
||
//#endregion
|
||
|
||
//#region 正式下单(订单查询,骑手查询,账户查询)
|
||
|
||
// 创建订单
|
||
type CreateOrderReqParam struct {
|
||
// 必传参数
|
||
PartnerOrderCode string `json:"partner_order_code,omitempty"` // 外部订单号
|
||
OrderType int `json:"order_type,omitempty"` // 订单类型(1:即时单,3:预约单)
|
||
PositionSource int `json:"position_source,omitempty"` // 坐标经纬度来源(1:腾讯地 图, 2:百度地图, 3:高德地图)蜂鸟建议使用高德地图
|
||
ReceiverAddress string `json:"receiver_address,omitempty"` // 收货人地址 文字描述
|
||
ReceiverLongitude float64 `json:"receiver_longitude,omitempty"` // 收货人经度
|
||
ReceiverLatitude float64 `json:"receiver_latitude,omitempty"` // 收货人纬度
|
||
GoodsTotalAmountCent int64 `json:"goods_total_amount_cent,omitempty"` // 订单商品总金额(分)
|
||
GoodsActualAmountCent int64 `json:"goods_actual_amount_cent,omitempty"` // 订单商品客户实际支付金额
|
||
GoodsWeight float64 `json:"goods_weight,omitempty"` // 订单总重量(kg)
|
||
GoodsCount int `json:"goods_count,omitempty"` // 货物件数
|
||
GoodsItemList []*GoodsItemsList `json:"goods_item_list,omitempty"` // 货物明细
|
||
ReceiverName string `json:"receiver_name,omitempty"` // 收货人姓名
|
||
ReceiverPrimaryPhone string `json:"receiver_primary_phone,omitempty"` // 只支持手机号,400开头电话,座机号码以及95013开头、长度13位的虚拟电话
|
||
OutShopCode string `json:"out_shop_code,omitempty"` // 外部门店id 当使用门店发单 out_shop_code和chain_store_id必填1个
|
||
ChainStoreId string `json:"chain_store_id,omitempty"` // 门店id
|
||
|
||
// 选传参数
|
||
TransportLongitude float64 `json:"transport_longitude,omitempty"` // 取货经度
|
||
TransportLatitude float64 `json:"transport_latitude,omitempty"` // 取货纬度
|
||
TransportTel string `json:"transport_tel,omitempty"` // 取货点联系人电话
|
||
OrderSource string `json:"order_source,omitempty"` // 饿百订单传109 商户订单来源(如饿了么、美团等)手发单/未知来源: 0 或不传 美团: 2 口碑: 4 饿了么: 6支付宝: 7 饿百: 8
|
||
ServiceGoodsId int64 `json:"service_goods_id,omitempty"` // 服务商品id 校验预询配送费价格时 必传
|
||
BaseGoodsId int64 `json:"base_goods_id,omitempty"` // 基础商品id 校验预询配送费价格时 必传
|
||
RequireReceiveTime int64 `json:"require_receive_time,omitempty"` // 需要送达时间 需要送达时间(毫秒); 订单类型为预约单时必传,如(需要送达时间 – 推单时间)< 60min,则蜂鸟配送开放平台自动将订单类型置为即时单 ,反之则置为预约单
|
||
OrderAddTime int64 `json:"order_add_time,omitempty"` // 下单时间毫秒
|
||
UseCoupon int `json:"use_coupon,omitempty"` // 是否使用优惠券 0:不使用, 1:使用 默认使用
|
||
ExpectFetchTime int64 `json:"expect_fetch_time,omitempty"` // 预计出餐时间(毫秒) (预约单该字段必填)建议和商务合同里约定的承诺出货时长保持一致,否则影响考核结算
|
||
TransportAddress string `json:"transport_address,omitempty"` // 取货点地址描述
|
||
OrderTipAmountCent int64 `json:"order_tip_amount_cent,omitempty"` // 取货点地址描述
|
||
SerialNumber string `json:"serial_number,omitempty"` // 商家订单流水号, 方便配送骑手 到店取货, 支持数字,字母及#等常见字符. 建议填写。长度<=6。
|
||
OrderSourceOrderId string `json:"order_source_order_id,omitempty"` // 订单来源的 单号
|
||
ReceiverSecondPhone string `json:"receiver_second_phone,omitempty"` // 收货人备用联系方式
|
||
CustomerExtTel string `json:"customer_ext_tel,omitempty"` // 分机号
|
||
OrderRemark string `json:"order_remark,omitempty"` // 用户备注
|
||
PreCreateOrderTIndexId string `json:"pre_create_order_t_index_id,omitempty"` // 预询后下单标识 为null不校验配送费价格直接 入单 不为null强校验配送费价格 与入参价格不一致拒绝入单
|
||
WarehouseId int64 `json:"warehouse_id,omitempty"` // 优惠券id
|
||
ActualDeliveryAmountCent int64 `json:"actual_delivery_amount_cent,omitempty"` // 优惠后配送费总价格(含入参小费金额) 入单实际价格 取自预下单接口出参同名字段!!!不为null则校验配送费价格,不一致拒绝入单 (含入参小费)校验预询配送费价格时 必传
|
||
WriteOffCode string `json:"write_off_code,omitempty"` // 销码(贵品服务必填)骑手和商户交互 签贵品履约才生效
|
||
CancelCode string `json:"cancel_code,omitempty"` // 取消码(贵品服务必填)
|
||
FetchCode string `json:"fetch_code,omitempty"` // 取餐码 骑手和用户交互
|
||
}
|
||
|
||
// 创建订单返回值
|
||
type CreateOrderRes struct {
|
||
OrderId int64 `json:"order_id"` // 运单id
|
||
}
|
||
|
||
// 查询余额getAmount
|
||
type GetBalanceAmountRes struct {
|
||
BalanceAmountCent int64 `json:"balance_amount_cent"` // 账户余额 分
|
||
FrozenBalanceAmountCent int64 `json:"frozen_balance_amount_cent"` // 账户冻结余额 分
|
||
BalanceStatus int `json:"balance_status"` // 账户状态 1 正常 2 冻结
|
||
}
|
||
|
||
// 查询订单详情接口 getOrderDetail
|
||
type GetOrderDetailReq struct {
|
||
OrderId string `json:"order_id"` // 订单号 订单号和外部订单号必填1个
|
||
PartnerOrderCode string `json:"partner_order_code"` // 外部订单号
|
||
}
|
||
|
||
// 查询订单详情接口返回值
|
||
type GetOrderDetailRes struct {
|
||
OrderId int64 `json:"order_id"` // 订单id
|
||
TrackingId int64 `json:"tracking_id"` // 运单id
|
||
PartnerOrderCode string `json:"partner_order_code"` // 外部订单号
|
||
SerialNumber string `json:"serial_number"` // 商家订单流水号, 方便配送骑手 到店取货, 支持数字,字母及#等常见字符. 建议填写。长度<=6。
|
||
OrderStatus int `json:"order_status"` // 订单生成0,运单生成成功1,20:骑手接单,80:骑手到店,2:配送中,3:已完成,4:已取消,5:配送异常
|
||
CarrierDriverId string `json:"carrier_driver_id"` // 配送员id
|
||
CarrierDriverName string `json:"carrier_driver_name"` // 配送员姓名
|
||
CarrierDriverPhone string `json:"carrier_driver_phone"` // 配送员电话
|
||
EstimateArriveTime int64 `json:"estimate_arrive_time"` // 预计送达时间(毫秒)
|
||
OvertimeCompensationCostCent int64 `json:"overtime_compensation_cost_cent"` // 时效赔付
|
||
IfCanAddTip int `json:"if_can_add_tip"` // 是否支持添加调度费 1可以,0不可以
|
||
OrderTipAmountCent int64 `json:"order_tip_amount_cent"` // 订单当前小费总金额 分
|
||
DeliveryFetchPhotos []interface{} `json:"delivery_fetch_photos"` // 骑手取货照片地址
|
||
OrderTotalAmountCent int64 `json:"order_total_amount_cent"` // 原始配送费金额(分)
|
||
OrderActualAmountCent int64 `json:"order_actual_amount_cent"` // 订单实际配送支付总金额关注这个字段即可(分)
|
||
PriceDetail *PriceOpenapiDetail `json:"price_detail"` // 配送费价格明细
|
||
AbnormalCode string `json:"abnormal_code"` // 运单异常原因code
|
||
AbnormalDesc string `json:"abnormal_desc"` // 运单异常原因描述
|
||
EventLogDetails []*OrderNodeInfo `json:"event_log_details"` // 运单事件节点信息
|
||
ComplaintId int64 `json:"complaint_id"` // 投诉编号
|
||
ComplaintReasonDesc string `json:"complaint_reason_desc"` // 投诉原因描述
|
||
ComplaintStatus int `json:"complaint_status"` // 投诉状态 1待处理, 2成功,3失败
|
||
ClaimId int64 `json:"claim_id"` // 索赔id
|
||
ClaimReasonDesc string `json:"claim_reason_desc"` // 索赔原因描述
|
||
ClaimStatus int `json:"claim_status"` // 索赔状态 1待处理, 2成功,3失败
|
||
Temperature string `json:"temperature"` // 骑手体温
|
||
OrderDistance float64 `json:"order_distance"` // 配送距离(米)
|
||
}
|
||
|
||
// 点单详情信息,订单结点信息
|
||
type OrderNodeInfo struct {
|
||
OrderStatus int `json:"order_status"` // 订单状态
|
||
OccurTime int64 `json:"occur_time"` // 时间结点
|
||
CarrierDriverName string `json:"carrier_driver_name"` // 配送员姓名
|
||
CarrierDriverPhone string `json:"carrier_driver_phone"` // 配送电话
|
||
}
|
||
|
||
// getKnightInfo 查询骑手信息接口,参数 GetOrderDetailReq
|
||
type GetKnightInfoRes struct {
|
||
CarrierDriverId string `json:"carrier_driver_id"` // 配送员id
|
||
CarrierDriverName string `json:"carrier_driver_name"` // 配送员姓名
|
||
CarrierDriverPhone string `json:"carrier_driver_phone"` // 配送员电话
|
||
CarrierDriverLongitude string `json:"carrier_driver_longitude"` // 骑手坐标
|
||
CarrierDriverLatitude string `json:"carrier_driver_latitude"` // 骑手坐标
|
||
}
|
||
|
||
//#endregion
|
||
|
||
//#region 加小费接口
|
||
|
||
//追加小费,订单小费总金额为每次累加
|
||
//注:不是所有订单都支持加小费,受合同服务 & 接单运力 & 当时订单状态等多个因素影响。 订单详情接口有返回是否可加小费字段。
|
||
//另:联调环境使用加小费接口 需先使用联调工具->订单状态回调:把订单状态改为1,否则订单状态会不支持加小费
|
||
// 添加小费
|
||
type AddTipRes struct {
|
||
OrderId string `json:"order_id"` // 订单号 订单号和外部订单号必填1个
|
||
PartnerOrderCode string `json:"partner_order_code"` // 外部订单号
|
||
AddTipAmountCent int64 `json:"add_tip_amount_cent"` // 小费金额分(必填)
|
||
ThirdIndexId int64 `json:"third_index_id"` // 本次加小费唯一标识 每个订单内 不可重复, 会用来做幂等,相同third_index_id的后续请求会被忽略
|
||
}
|
||
|
||
// 业务出参 "business_data": "{\"result\":true}"
|
||
//#endregion
|
||
|
||
//#region 取消接口
|
||
|
||
// getCancelReasonList 获取可用取消原因列表接口 参数:GetOrderDetailReq
|
||
|
||
// getCancelReasonListRes 取消接口返回值
|
||
type GetCancelReasonListRes struct {
|
||
CancelReasonList []*struct {
|
||
OrderCancelCode int `json:"order_cancel_code"` // 取消原因code
|
||
OrderCancelDesc int `json:"order_cancel_desc"` // 取消原因描述
|
||
}
|
||
}
|
||
|
||
// preCancelOrder 预取消订单接口
|
||
type PreCancelOrderReq struct {
|
||
GetOrderDetailReq
|
||
OrderCancelCode int64 `json:"order_cancel_code"` // 从可用取消原因列表接口返回结果选择(必填)
|
||
}
|
||
|
||
// cancelOrder 正式取消订单接口
|
||
type CancelOrderReq struct {
|
||
GetOrderDetailReq
|
||
OrderCancelCode int64 `json:"order_cancel_code"` // 从可用取消原因列表接口返回结果选择(必填)
|
||
OrderCancelRole int `json:"order_cancel_role"` // 1商户取消, 2 用户取消(必填)
|
||
ActualCancelCostCent int64 `json:"actual_cancel_cost_cent"` // 单位分 取消实际需扣金额,从预取消接口拿(非必填)
|
||
OrderCancelOtherReason string `json:"order_cancel_other_reason"` // 取消原因补充 20字以内(非必填)
|
||
}
|
||
|
||
//#endregion
|
||
|
||
//#region 投诉订单
|
||
|
||
// complaintOrder投诉订单
|
||
type ComplaintOrderReq struct {
|
||
GetOrderDetailReq
|
||
OrderComplaintCode int `json:"order_complaint_code"` // 投诉编码 230:其他, 150:未保持餐品完整, 160:服务态度恶劣, 190:额外索取费用,170:诱导收货人或商户退单, 140:提前点击送达,210:虚假标记异常, 220:少餐错餐,200:虚假配送, 130:未进行配送(必填)
|
||
OrderComplaintDesc string `json:"order_complaint_desc"` // 投诉原因描述(否)
|
||
}
|
||
|
||
// claimOrder 索赔订单
|
||
type ClaimOrderRes struct {
|
||
GetOrderDetailReq
|
||
OrderClaimCode int `json:"order_claim_code"` // 索赔编码150: 未保持餐品完整,160: 服务态度恶劣, 170: 诱导收货人或商户退单,210:虚假标记异常, 130: 骑手接单后未完成配送,320:少餐错餐, 190:额外索取费用,140:提前点击送达, 200:骑手点击配送成功,实际未配送
|
||
OrderClaimDesc string `json:"order_claim_desc"` // 投诉原因描述
|
||
OrderClaimPriceCent int64 `json:"order_claim_price_cent"` // 索赔金额 分
|
||
OrderClaimSku []*OrderClaimSkuDto `json:"order_claim_sku"` // 索赔明细
|
||
}
|
||
|
||
// 索赔明细
|
||
type OrderClaimSkuDto struct {
|
||
ClaimSkuName string `json:"claim_sku_name"` // 索赔商品名称
|
||
ClaimSkuGoodsCount string `json:"claim_sku_goods_count"` // 索赔商品数量
|
||
ClaimSkuPriceCent string `json:"claim_sku_price_cent"` // 索赔商品实际单价 分
|
||
ClaimSkuTotalPriceCent string `json:"claim_sku_total_price_cent"` // 索赔商品实际总价 分
|
||
}
|
||
|
||
//#endregion
|
||
|
||
//#endregion
|