Files
jx-callback/controllers/q_bida.go
邹宗楠 f3d4a9e496 1
2022-06-27 17:15:45 +08:00

154 lines
6.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package controllers
import (
bida "git.rosy.net.cn/baseapi/platformapi/q_bida"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/model"
bidaServer "git.rosy.net.cn/jx-callback/business/q_bida"
"github.com/astaxie/beego/server/web"
)
type QBiDaExpressController struct {
web.Controller
}
// QueryExpressPrice 查询物流费
// @Title Q必达
// @Description 查询快递费
// @Param token header string true "管理员token"
// @Param promiseTimeType formData int false "快递时效产品"
// @Param deliveryType formData int false "产品类型"
// @Param goodsValue formData float64 false "保价金额"
// @Param receiveAddress formData string true "收件人地址"
// @Param sendAddress formData string true "寄件人地址"
// @Param type formData int false "快递公司"
// @Param weight formData int true "重量kg"
// @Param length formData int true "所有包裹累计长"
// @Param width formData int true "所有包裹累计宽"
// @Param height formData int true "所有包裹累计高"
// @Param sendPhone formData string true "寄件人手机号"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /QueryExpressPrice [post]
func (c *QBiDaExpressController) QueryExpressPrice() {
c.callQueryExpressPrice(func(params *tExpressQueryExpressPriceParams) (interface{}, string, error) {
param := &bida.GetExpressPriceReq{
PromiseTimeType: params.PromiseTimeType,
DeliveryType: params.DeliveryType,
GoodsValue: params.GoodsValue,
ReceiveAddress: params.ReceiveAddress,
SendAddress: params.SendAddress,
Type: params.Type,
Weight: params.Weight,
Length: params.Length,
Height: params.Height,
Width: params.Width,
SendPhone: params.SendPhone,
}
result, err := bidaServer.QueryExpressPrice(param)
return result, "", err
})
}
// CreateWayOrder 下单
// @Title Q必达
// @Description 下单
// @Param token header string true "管理员token"
// @Param promiseTimeType formData int true "快递时效产品"
// @Param deliveryType formData int true "产品类型"
// @Param goods formData string true "商品名称"
// @Param guaranteeValueAmount formData float64 false "保价金额"
// @Param weight formData int true "重量kg"
// @Param length formData int false "所有包裹累计长"
// @Param width formData int false "所有包裹累计宽"
// @Param height formData int false "所有包裹累计高"
// @Param orderSendTime formData string false "预约时间"
// @Param packageNum formData int true "包裹数量"
// @Param receiveAddress formData string true "收件人地址"
// @Param receiveName formData string true "收件人姓名"
// @Param receivePhone formData string true "收件人手机号"
// @Param remark formData string false "运单备注"
// @Param senderAddress formData string true "寄件人地址"
// @Param senderName formData string true "寄件人姓名"
// @Param senderPhone formData string true "寄件人手机号"
// @Param thirdPlatform formData int true "第三方平台"
// @Param type formData int true "快递公司"
// @Param receiveAddressId formData int64 true "收件人地址Id"
// @Param senderAddressId formData int64 true "寄件人地址Id"
// @Param channelType formData int true "渠道类型1-快递2-物流3-国际物流4-整车)"
// @Param images formData string false "物品图片多个用逗号隔开"
// @Param channelFee formData float64 true "渠道价"
// @Param bulk formData int false "泡比"
// @Param serviceCharge formData float64 false "服务费"
// @Param guarantFee formData float64 false "保价"
// @Param originalFee formData float64 false "原价"
// @Param increment formData float64 false "物流"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CreateWayOrder [post]
func (c *QBiDaExpressController) CreateWayOrder() {
c.callCreateWayOrder(func(params *tExpressCreateWayOrderParams) (interface{}, string, error) {
param := &model.MakeOrderParamReq{
PromiseTimeType: params.PromiseTimeType,
DeliveryType: params.DeliveryType,
Goods: params.Goods,
GuaranteeValueAmount: params.GuaranteeValueAmount,
Weight: params.Weight,
Length: params.Length,
Height: params.Height,
Width: params.Width,
OrderSendTime: params.OrderSendTime,
PackageNum: params.PackageNum,
ReceiveAddress: params.ReceiveAddress,
ReceiveName: params.ReceiveName,
ReceivePhone: params.ReceivePhone,
Remark: params.Remark,
SenderAddress: params.SenderAddress,
SenderName: params.SenderName,
SenderPhone: params.SenderPhone,
ThirdPlatform: params.ThirdPlatform,
Type: params.Type,
ReceiveAddressId: int64(params.ReceiveAddressId),
SenderAddressId: int64(params.SenderAddressId),
ChannelType: params.ChannelType,
Images: params.Images,
ChannelFee: params.ChannelFee,
Bulk: utils.Int2Float64(params.Bulk),
ServiceCharge: params.ServiceCharge,
GuarantFee: params.GuarantFee,
OriginalFee: params.OriginalFee,
Increment: params.Increment,
}
if err := bidaServer.CreateWayOrder(params.Ctx, param, params.Ctx.GetUserID()); err != nil {
return nil, "", err
}
return nil, "", nil
})
}
// CancelWayVendorOrder 取消运单
// @Title Q必达
// @Description 取消运单
// @Param token header string true "管理员token"
// @Param genre formData int true "1取消2关闭"
// @Param orderNo formData string true "订单编号"
// @Param type formData int true "快递公司"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /CancelWayVendorOrder [post]
func (c *QBiDaExpressController) CancelWayVendorOrder() {
c.callCancelWayVendorOrder(func(params *tExpressCancelWayVendorOrderParams) (interface{}, string, error) {
cancel := &bida.CancelOrderReq{
Genre: params.Genre,
OrderNo: params.OrderNo,
Type: params.Type,
}
if err := bidaServer.CancelWayOrder(cancel); err != nil {
return nil, "", err
}
return nil, "", nil
})
}