添加快递渠道
This commit is contained in:
27
business/q_bida/q_bida_server.go
Normal file
27
business/q_bida/q_bida_server.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package q_bida
|
||||
|
||||
import (
|
||||
"errors"
|
||||
bida "git.rosy.net.cn/baseapi/platformapi/q_bida"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
func QueryExpressPrice(param *bida.GetExpressPriceReq) ([]*bida.GetExpressPriceData, error) {
|
||||
if param.Weight <= 0 {
|
||||
return nil, errors.New("物品重量必须大于0")
|
||||
}
|
||||
fee, err := api.QBiDaAPI.GetExpressPrice(param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 渠道费每公斤加价两毛
|
||||
for _, v := range fee {
|
||||
if v.ChannelFee != 0 {
|
||||
addFee := v.ChannelFee + int64(param.Width*2)
|
||||
v.ChannelFee = addFee
|
||||
}
|
||||
}
|
||||
|
||||
return fee, nil
|
||||
}
|
||||
@@ -167,6 +167,10 @@ yinbaoAppID = "18C0E0867E467DBC26EFF5E957B02EC4"
|
||||
|
||||
aliUpcAppCode = "00a6eefba0204d3fa310ac0ee7a6fc54"
|
||||
|
||||
#QBIDA 账号
|
||||
QBiDaAccess = "18048531223"
|
||||
QBiDaPassword = "18080188338"
|
||||
|
||||
[rsm]
|
||||
EnableDocs = true
|
||||
|
||||
@@ -271,6 +275,10 @@ tbUnionAppSecret = "2c2bce02eab860d486f68aa59a0127d9"
|
||||
pddAppKey = "f9d95aaf5856485eabf39588f69a86de"
|
||||
pddAppSecret = "fa40c1fe356eebc1376ace1d2380ed44e553c602"
|
||||
|
||||
#QBIDA 账号
|
||||
QBiDaAccess = "18048531223"
|
||||
QBiDaPassword = "18080188338"
|
||||
|
||||
[print]
|
||||
httpport = 8088
|
||||
EnableDocs = false
|
||||
@@ -283,4 +291,7 @@ enableEbaiStoreWrite = true
|
||||
enableMtwmStoreWrite = true
|
||||
enableWscStoreWrite = true
|
||||
enableYbStoreWrite = true
|
||||
enableJdShopWrite = true
|
||||
enableJdShopWrite = true
|
||||
#QBIDA 账号
|
||||
QBiDaAccess = "18048531223"
|
||||
QBiDaPassword = "18080188338"
|
||||
51
controllers/q_bida.go
Normal file
51
controllers/q_bida.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
bida "git.rosy.net.cn/baseapi/platformapi/q_bida"
|
||||
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 false "管理员token"
|
||||
// @Param promiseTimeType formData int true "快递时效产品"
|
||||
// @Param deliveryType formData int true "产品类型"
|
||||
// @Param goodsValue formData int true "保价金额"
|
||||
// @Param receiveAddress formData string true "收件人地址"
|
||||
// @Param sendAddress formData string true "寄件人地址"
|
||||
// @Param type formData int true "快递公司"
|
||||
// @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
|
||||
})
|
||||
}
|
||||
|
||||
// 添加收货地址
|
||||
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdunionapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/pddapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/q_bida"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tbunionapi"
|
||||
"io/ioutil"
|
||||
|
||||
@@ -84,6 +85,9 @@ var (
|
||||
|
||||
Cacher cache.ICacher
|
||||
SMSClient *aliyunsmsclient.SmsClient
|
||||
|
||||
// QBiDaApi
|
||||
QBiDaAPI *q_bida.Api
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -161,4 +165,7 @@ func Init() {
|
||||
PushAPI = unipushapi.New(beego.AppConfig.DefaultString("pushAppID", ""), beego.AppConfig.DefaultString("pushAppKey", ""), beego.AppConfig.DefaultString("pushAppSecret", ""), beego.AppConfig.DefaultString("pushMasterSecret", ""))
|
||||
MtMemberAPI = mtmemberapi.New()
|
||||
SMSClient = aliyunsmsclient.New("http://dysmsapi.aliyuncs.com/")
|
||||
|
||||
// 初始化QBIDA
|
||||
QBiDaAPI = q_bida.NewQBiDa(beego.AppConfig.DefaultString("QBiDaAccess", ""), beego.AppConfig.DefaultString("QBiDaPassword", ""))
|
||||
}
|
||||
|
||||
@@ -1015,4 +1015,13 @@ func init() {
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
|
||||
// 快递运单
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:QBiDaExpressController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:QBiDaExpressController"],
|
||||
beego.ControllerComments{
|
||||
Method: "QueryExpressPrice",
|
||||
Router: "/QueryExpressPrice",
|
||||
AllowHTTPMethods: []string{"post"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
Params: nil})
|
||||
}
|
||||
|
||||
@@ -61,6 +61,12 @@ func init() {
|
||||
&controllers.UnionController{},
|
||||
),
|
||||
),
|
||||
// QBiDa
|
||||
web.NSNamespace("/express",
|
||||
web.NSInclude(
|
||||
&controllers.QBiDaExpressController{},
|
||||
),
|
||||
),
|
||||
)
|
||||
web.AddNamespace(ns)
|
||||
web.AutoRouter(&controllers.WXPayController{})
|
||||
|
||||
Reference in New Issue
Block a user