diff --git a/business/model/api_config.go b/business/model/api_config.go index d72dd4cab..d08dfe206 100644 --- a/business/model/api_config.go +++ b/business/model/api_config.go @@ -31,6 +31,7 @@ const ( VendorIDMTPS = 102 // 美团配送 VendorIDFengNiao = 103 // 蜂鸟配送 VendorIDDYPS = 104 // 抖音配送 + VendorIDUUPT = 105 //uu跑腿 VendorJXFakeWL = 300 // 京西假物流 VendorIDJDWL = 401 // 京东物流 VendorIDTotalWl = 402 // (综合物流[京东,圆通,申通....]) diff --git a/business/partner/delivery/uupt/waybill.go b/business/partner/delivery/uupt/waybill.go index 5fa9baafd..7b9eb2b98 100644 --- a/business/partner/delivery/uupt/waybill.go +++ b/business/partner/delivery/uupt/waybill.go @@ -1,5 +1,14 @@ package uupt +import ( + "git.rosy.net.cn/baseapi/platformapi/mtpsapi" + "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/business/partner" + "git.rosy.net.cn/jx-callback/globals/api" +) + const ( //errCode 错误码说明 ErrorParameter1 = -101 //参数格式校验错误 @@ -76,5 +85,59 @@ type DeliveryHandler struct { } func init() { - //if api. + if api.UuAPI != nil { + curDeliveryHandler = new(DeliveryHandler) + partner.RegisterDeliveryPlatform(curDeliveryHandler, true) + } +} + +func (d DeliveryHandler) GetVendorID() int { + return model.VendorIDUUPT +} + +func (d DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (vendorStoreID string, status int, err error) { + //TODO implement me + panic("implement me") +} + +func (d DeliveryHandler) GetStore(ctx *jxcontext.Context, storeID int, vendorStoreID string) (storeDetail *dao.StoreDetail2, err error) { + //TODO implement me + panic("implement me") +} + +func (d DeliveryHandler) IsErrStoreNotExist(err error) bool { + //TODO implement me + panic("implement me") +} + +func (d DeliveryHandler) IsErrStoreExist(err error) bool { + //TODO implement me + panic("implement me") +} + +func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee int64) (bill *model.Waybill, err error) { + //TODO implement me + panic("implement me") +} + +func (d DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int, cancelReason string) (err error) { + //if err = api.UuAPI.CancelOrder(bill.VendorWaybillID, uuptapi.CancelReasonNormal); err != nil { + // + //} + return nil +} + +func (d DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo *partner.WaybillFeeInfo, err error) { + //TODO implement me + panic("implement me") +} + +func (d DeliveryHandler) ComplaintRider(bill *model.Waybill, resonID int, resonContent string) (err error) { + //TODO implement me + panic("implement me") +} + +func (d DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeisongId string) (rider *mtpsapi.RiderInfo, err error) { + //TODO implement me + panic("implement me") } diff --git a/conf/app.conf b/conf/app.conf index f45d085ba..578a5cb17 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -200,6 +200,11 @@ fnCode = "uDEyAmTbrfS2qjYbgi20Jm" fnMerchantId= "51658" fnCallbackURL = "http://callback.jxc4.com/fn/msg" +#uu跑腿 +uuAppID="55c4542ae60e4d348edcfc93b06dd302" +uuAppKey="76b362c06b1b4baa9e47bab6387a5356" +uuOpenID="8d8464e7c9354c1e88a3f5afa2a7922e" + weixinAppID = "wxbf235770edaabc5c" weixinSecret = "ba32b269a068a5b72486a0beafd171e8" weixinToken = "17_roSCZgkCxhRnyFVtei0KdfHwdGP8PmLzJFhCieka4_X4_d-lgfaTxF6oIS6FE5lkgLbrtstSsO6HyDNHKsHJmpB8YOtJYN4sO-AezdWLF78M2phL0K8xCRjB9YE9-Ci64GCqS50o6LcVqux8ORVbACAFIM" @@ -338,9 +343,10 @@ fnCode = "uDEyAmTbrfS2qjYbgi20Jm" fnMerchantId= "51658" fnCallbackURL = "http://callback.jxc4.com/fn/msg" -uuPtAppID="55c4542ae60e4d348edcfc93b06dd302" -uuPtAppKey="76b362c06b1b4baa9e47bab6387a5356" -uuPtOpenId="8d8464e7c9354c1e88a3f5afa2a7922e" +#uu跑腿 +uuAppID="55c4542ae60e4d348edcfc93b06dd302" +uuAppKey="76b362c06b1b4baa9e47bab6387a5356" +uuOpenID="8d8464e7c9354c1e88a3f5afa2a7922e" jxPrintAppID = "1000" @@ -450,6 +456,10 @@ fnAppSecret = "a8248088-a742-4c33-a0db-03aeae00ca7d" fnMerchantId = "51658" fnCode = "uDEyAmTbrfS2qjYbgi20Jm" fnCallbackURL = "http://callback-jxgy.jxc4.com/fn/msg" +#uu跑腿 +uuAppID="55c4542ae60e4d348edcfc93b06dd302" +uuAppKey="76b362c06b1b4baa9e47bab6387a5356" +uuOpenID="8d8464e7c9354c1e88a3f5afa2a7922e" jxPrintAppID = "1000" jxPrintAppKey = "rfBd56ti2SMtYvSg" @@ -644,7 +654,10 @@ fnAppSecret = "c1e6c280-e618-4103-9d0a-673bc54fb22e" fnCode = "uDEyAmTbrfS2qjYbgi20Jm" fnMerchantId= "51658" fnCallbackURL = "http://callback.jxc4.com/fn/msg" - +#uu跑腿 +uuAppID="55c4542ae60e4d348edcfc93b06dd302" +uuAppKey="76b362c06b1b4baa9e47bab6387a5356" +uuOpenID="8d8464e7c9354c1e88a3f5afa2a7922e" jxPrintAppID = "1000" jxPrintAppKey = "rfBd56ti2SMtYvSg" diff --git a/controllers/dyps_callback.go b/controllers/dyps_callback.go deleted file mode 100644 index bd15e50af..000000000 --- a/controllers/dyps_callback.go +++ /dev/null @@ -1,32 +0,0 @@ -package controllers - -import ( - "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api" - "git.rosy.net.cn/jx-callback/globals/api" - "github.com/astaxie/beego/server/web" - "net/http" - "strings" -) - -type DYPSController struct { - web.Controller -} - -//抖音运力配送 回调 -func (d *DYPSController) CallbackDYPSDeliveryMsg() { - resp, byteList := api.TiktokStore.EventSignChange(d.Ctx.Request) - if resp.Code != 0 { - d.Data["json"] = resp - d.ServeJSON() - return - } - if strings.Contains(string(byteList), "\"msg_id\":\"0\"") { - d.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackSuccessCode, Msg: tiktok_api.CallbackSuccess} - d.ServeJSON() - return - } - - if d.Ctx.Input.Method() == http.MethodPost { - //msg,callbaskResponse:=api.TiktokStore. - } -} diff --git a/controllers/uupt_callback.go b/controllers/uupt_callback.go new file mode 100644 index 000000000..7ded7193f --- /dev/null +++ b/controllers/uupt_callback.go @@ -0,0 +1,30 @@ +package controllers + +import ( + "git.rosy.net.cn/baseapi/platformapi/uuptapi" + "git.rosy.net.cn/jx-callback/globals/api" + "github.com/astaxie/beego/server/web" + "net/http" +) + +type UuPtController struct { + web.Controller +} + +//运单状态回调 +func (c *UuPtController) UuWaybillCallback() { + if c.Ctx.Input.Method() == http.MethodPost { + resp, callbackResponse := api.UuAPI.WaybillCallback(c.Ctx.Request) + if callbackResponse.ReturnCode == uuptapi.ReturnFail { + c.Data["code"] = callbackResponse + c.ServeJSON() + return + } + + //callbackResponse=uuptapi. + c.Data["code"] = callbackResponse + c.ServeJSON() + } else { + c.Abort("404") + } +} diff --git a/globals/api/api.go b/globals/api/api.go index 82017b979..26966e111 100644 --- a/globals/api/api.go +++ b/globals/api/api.go @@ -7,6 +7,7 @@ import ( "git.rosy.net.cn/baseapi/platformapi/qywxapi" "git.rosy.net.cn/baseapi/platformapi/tiktok" tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api" + "git.rosy.net.cn/baseapi/platformapi/uuptapi" "time" @@ -86,8 +87,8 @@ var ( WxpayAPI *wxpayapi.API // 微信支付API TLpayAPI *tonglianpayapi.API //通联收银宝api FnAPI *fnpsapi.API //蜂鸟配送api - - YinBaoAPI *yinbaoapi.API //银豹平台api + UuAPI *uuptapi.API //uu跑腿api + YinBaoAPI *yinbaoapi.API //银豹平台api WeixinPageAPI *weixinapi.API // 用户微信扫码登录 @@ -296,6 +297,7 @@ func Init() { } FnAPI = fnpsapi.New(beego.AppConfig.DefaultString("fnAppID", ""), beego.AppConfig.DefaultString("fnAppSecret", ""), beego.AppConfig.DefaultString("fnMerchantId", ""), beego.AppConfig.DefaultString("fnCode", "")) + UuAPI = uuptapi.New(beego.AppConfig.DefaultString("uuAppID", ""), beego.AppConfig.DefaultString("uuAppKey", ""), beego.AppConfig.DefaultString("uuOpenID", "")) FeieAPI = feieapi.New(beego.AppConfig.DefaultString("feieUser", ""), beego.AppConfig.DefaultString("feieKey", "")) XiaoWMAPI = xiaowmapi.New(beego.AppConfig.DefaultInt("xiaoWMAppID", 0), beego.AppConfig.DefaultString("xiaoWMAppKey", "")) YilianyunAPI = yilianyunapi.New(beego.AppConfig.DefaultString("yilianyunClientID", ""), beego.AppConfig.DefaultString("yilianyunClientSecret", ""))