diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 0ca029b9f..93e6526e1 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -417,8 +417,6 @@ func ClearUserToken(userID string) { } } -///////////// - func createToken(user IUser, authBindInfo *AuthBindEx) (token string, tokenType int) { userID := TokenUserEmpty userName := authBindInfo.AuthID diff --git a/business/auth2/authprovider/defauther.go b/business/auth2/authprovider/defauther.go index 4450ce156..08e731180 100644 --- a/business/auth2/authprovider/defauther.go +++ b/business/auth2/authprovider/defauther.go @@ -80,9 +80,9 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu dao.UpdateEntity(db, authBind, "TypeID") } } else if dao.IsNoRowsError(err) { // 直接找不到,尝试unionID - if unionID != "" { // 且有unionID + if unionID != "" || openID != "" { // 且有unionID var authBindList []*model.AuthBind - if authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, "", unionID, nil); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式 + if authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, openID, unionID, nil); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式 authBind = authBindList[0] authBind.Type = curAuthType authBind.TypeID = curAuthTypeID diff --git a/business/auth2/authprovider/douyin/tiktop_mini.go b/business/auth2/authprovider/douyin/tiktop_mini.go new file mode 100644 index 000000000..9a225e975 --- /dev/null +++ b/business/auth2/authprovider/douyin/tiktop_mini.go @@ -0,0 +1,93 @@ +package douyin + +import ( + "errors" + "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" + + "git.rosy.net.cn/baseapi/platformapi/weixinapi" + "git.rosy.net.cn/jx-callback/business/auth2" + "git.rosy.net.cn/jx-callback/business/auth2/authprovider" + "git.rosy.net.cn/jx-callback/business/model" + "git.rosy.net.cn/jx-callback/globals" + "git.rosy.net.cn/jx-callback/globals/api" +) + +const ( + AuthTypeTiktokMini = "tiktokmini" // 抖音小程序 +) + +type TiktopMiniAuther struct { + authprovider.DefAuther +} + +var ( + ErrAuthTypeShouldBeMini = errors.New("当前操作要求是抖音小程序登录方式") +) + +var ( + AutherObjMini *TiktopMiniAuther +) + +func init() { + AutherObjMini = new(TiktopMiniAuther) + auth2.RegisterAuther(AuthTypeTiktokMini, AutherObjMini) +} + +func (a *TiktopMiniAuther) VerifySecret(dummy, code string) (authBindEx *auth2.AuthBindEx, err error) { + globals.SugarLogger.Debugf("toktok mini VerifySecret jsCode:%s", code) + + sessionInfo, err := api.TiktokApi.GetTiktokToken(code) + if err == nil { + if authBindEx, err = a.UnionFindAuthBind(AuthTypeTiktokMini, api.TiktokApi.GetAppID(), []string{AuthTypeTiktokMini}, sessionInfo.Data.OpenId, sessionInfo.Data.UnionId, sessionInfo); err == nil { + authBindEx.UserData = sessionInfo.Data + } + } + return authBindEx, err +} + +// 特殊接口 +func (a *TiktopMiniAuther) DecryptData(authInfo *auth2.AuthInfo, jsCode, encryptedData, iv string) (decryptedDataBase64 string, err error) { + globals.SugarLogger.Debugf("weixin mini DecryptData jsCode:%s, encryptedData:%s, iv:%s", jsCode, encryptedData, iv) + var sessionKey string + appID, jsCode := weixin.SplitJsCode(jsCode) + if jsCode != "" { + sessionInfo, err := getWxApp(appID).SNSCode2Session(jsCode) + if err == nil { + // if authBindEx, err := a.UnionFindAuthBind(AuthTypeMini, getWxApp(appID).GetAppID(), []string{AuthTypeMini}, sessionInfo.OpenID, "", nil); err == nil { + // if authBindEx.UserID != authInfo.GetID() { + // return "", fmt.Errorf("jsCode与token不匹配") + // } + // } else { + // return "", err + // } + sessionKey = sessionInfo.SessionKey + } else { + return "", err + } + } else { + if authInfo.AuthBindInfo.Type != AuthTypeTiktokMini { + // return "", ErrAuthTypeShouldBeMini + } + sessionKey = authInfo.AuthBindInfo.UserData.(string) + } + decryptedData, err := weixinapi.SNSDecodeMiniProgramData(encryptedData, sessionKey, iv) + if err != nil { + return "", err + } + return string(decryptedData), nil +} + +func (a *TiktopMiniAuther) GetUserType() (userType int8) { + return model.UserTypeStoreBoss +} + +func getWxApp(appID string) (miniApi *weixinapi.API) { + miniApi = api.WeixinMiniAPI + if len(appID) > 0 && appID == api.WeixinMiniAppID2 { + miniApi = api.WeixinMiniAPI2 + } + if len(appID) > 0 && appID == api.WeixinMiniAppIDsc { + miniApi = api.WeixinMiniAPIsc + } + return miniApi +} diff --git a/business/auth2/authprovider/weixin/weixin_mini.go b/business/auth2/authprovider/weixin/weixin_mini.go index b736d5d6b..a1bad5db2 100644 --- a/business/auth2/authprovider/weixin/weixin_mini.go +++ b/business/auth2/authprovider/weixin/weixin_mini.go @@ -94,6 +94,9 @@ func getWxApp(appID string) (miniApi *weixinapi.API) { if len(appID) > 0 && appID == api.WeixinMiniAppIDsc { miniApi = api.WeixinMiniAPIsc } + if len(appID) > 0 && appID == api.WeixinMiniPrintAppId { + miniApi = api.WeixinMiniAPIPrint + } return miniApi } diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 9384ff014..f058943b2 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -762,7 +762,7 @@ func getMapCenter(storeList []*StoreExt) (lng, lat float64) { lng = lng / float64(len(newStoreList)) lat = lat / float64(len(newStoreList)) // for _, store := range storeList { - // globals.SugarLogger.Debugf("store:%s, lng:%f, lat:%f", store.Name, store.FloatLng, store.FloatLat) + // globals.SugarLogger.Debugf("store:%s, lng:%, lat:%f", store.Name, store.FloatLng, store.FloatLat) // } // globals.SugarLogger.Debugf("lng:%f, lat:%f", lng, lat) return lng, lat diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index ffab0453e..b38a9bde4 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -2,6 +2,7 @@ package misc import ( "fmt" + "git.rosy.net.cn/jx-callback/business/partner/delivery" "sync" "time" @@ -386,6 +387,10 @@ func Init() { }, []string{ "20:00:00", }) + // 每五分钟轮询一次推送骑手信息坐标给美团 + ScheduleTimerFuncByInterval(func() { + delivery.GetOrderRiderInfoToPlatform("") + }, 10*time.Second, 5*time.Minute) } if configs, err := dao.QueryConfigs(dao.GetDB(), "ebaiStorePageCookie", model.ConfigTypeCookie, ""); err == nil { ebaiStorePageCookie = configs[0].Value diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index 547f68fd3..bcd032361 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -821,7 +821,7 @@ func GetOrders(db *DaoDB, ids []int64, isIncludeSku, isIncludeFake bool, fromDat DISTINCT t1.*, -- CAST(IF(t1.earning_price <> 0, t1.earning_price, IF(t1.shop_price <> 0 && t1.shop_price < t1.sale_price, t1.shop_price, t1.sale_price) * IF(t1.order_pay_percentage > 0, t1.order_pay_percentage, %d) / 100) AS SIGNED) earning_price, t2.status waybill_status, t2.courier_name, t2.courier_mobile, - t2.actual_fee, t2.desired_fee, t2.waybill_created_at, t2.waybill_finished_at, + t2.actual_fee, t2.desired_fee, t2.waybill_created_at, t2.waybill_finished_at,t2.vendor_waybill_id2, t5.pay_percentage, t5.old_pay_percentage, t5.market_man_phone, tu.name market_man_name, t5.operator_phone, t5.operator_phone2, t5.operator_phone3, tu1.name operator_name, tu2.name operator_name2, tu3.name operator_name3, t6.vendor_pay_percentage, diff --git a/business/model/order.go b/business/model/order.go index def9f8bbc..a5cdcfd29 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -134,18 +134,19 @@ type GoodsOrder struct { DeliveryType string `orm:"size(32)" json:"deliveryType"` // 订单配送方式,缺省是平台配送 CreateDeliveryType int `orm:"default(0)" json:"createDeliveryType"` //默认0系统发单,1为门店发单 - VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"` - WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"` // 表示当前承运商,-1表示还没有安排 - AdjustCount int8 `json:"adjustCount"` // 调整单(次数) - DeliveryFlag int8 `json:"deliveryFlag"` // 第1位为1表示禁止调度器调度三方配送 - DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的 - OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间) - OrderFinishedAt time.Time `orm:"type(datetime)" json:"orderFinishedAt"` - StatusTime time.Time `orm:"type(datetime)" json:"statusTime"` // last status time - PickDeadline time.Time `orm:"type(datetime);null" json:"pickDeadline"` - DeliveryFeeFrom *time.Time `orm:"type(datetime);null" json:"deliveryFeeFrom,omitempty"` // 三方配置费计算的开始基准时间 - ModelTimeInfo `json:"-"` - Flag int `json:"flag"` //非运单调整相关的其它状态 + VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"` + WaybillVendorID int `orm:"column(waybill_vendor_id)" json:"waybillVendorID"` // 表示当前承运商,-1表示还没有安排 + VendorWaybillId2 string `orm:"column(vendor_waybill_id2)" json:"vendorWaybillId2"` // 美团标志id + AdjustCount int8 `json:"adjustCount"` // 调整单(次数) + DeliveryFlag int8 `json:"deliveryFlag"` // 第1位为1表示禁止调度器调度三方配送 + DuplicatedCount int `json:"-"` // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的 + OrderCreatedAt time.Time `orm:"type(datetime);index" json:"orderCreatedAt"` // 这里记录的是订单生效时间,即用户支付完成(货到付款即为下单时间) + OrderFinishedAt time.Time `orm:"type(datetime)" json:"orderFinishedAt"` + StatusTime time.Time `orm:"type(datetime)" json:"statusTime"` // last status time + PickDeadline time.Time `orm:"type(datetime);null" json:"pickDeadline"` + DeliveryFeeFrom *time.Time `orm:"type(datetime);null" json:"deliveryFeeFrom,omitempty"` // 三方配置费计算的开始基准时间 + ModelTimeInfo `json:"-"` + Flag int `json:"flag"` //非运单调整相关的其它状态 InvoiceTitle string `orm:"size(64)" json:"invoiceTitle"` // 发票抬头 InvoiceTaxerID string `orm:"size(32);column(invoice_taxer_id)" json:"invoiceTaxerID"` // 发票纳税人识别码 diff --git a/business/partner/delivery/dada/waybill.go b/business/partner/delivery/dada/waybill.go index 8188fadcb..f1b0487a3 100644 --- a/business/partner/delivery/dada/waybill.go +++ b/business/partner/delivery/dada/waybill.go @@ -3,6 +3,7 @@ package dada import ( "errors" "fmt" + "git.rosy.net.cn/baseapi/platformapi/mtpsapi" "git.rosy.net.cn/baseapi/platformapi/dadaapi" "git.rosy.net.cn/baseapi/utils" @@ -83,6 +84,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaap } case dadaapi.OrderStatusDelivering: order.Status = model.WaybillStatusDelivering + delivery.GetOrderRiderInfoToPlatform(order.VendorOrderID) case dadaapi.OrderStatusFinished: order.Status = model.WaybillStatusDelivered case dadaapi.OrderStatusCanceled, dadaapi.OrderStatusExpired: @@ -422,3 +424,26 @@ func (c *DeliveryHandler) GetRidderPosition(ctx *jxcontext.Context, vendorOrgCod } return lng, lat, err } + +// 获取骑手信息(订单详情) +func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeisongId string) (rider *mtpsapi.RiderInfo, err error) { + order, err := api.DadaAPI.QueryOrderInfo(orderId) + if err != nil { + return nil, err + } + + if order.StatusCode != 3 { + return nil, errors.New("订单未分配骑手,或订单已经完成了") + } + + return &mtpsapi.RiderInfo{ + OrderId: "", + ThirdCarrierOrderId: orderId, + CourierName: order.TransporterName, + CourierPhone: order.TransporterPhone, + LogisticsProviderCode: string(mtpsapi.DaDaCode), + LogisticsStatus: order.StatusCode, + Latitude: order.TransporterLat, + Longitude: order.TransporterLng, + }, nil +} diff --git a/business/partner/delivery/delivery.go b/business/partner/delivery/delivery.go index 9fa7a9989..32adfb3ad 100644 --- a/business/partner/delivery/delivery.go +++ b/business/partner/delivery/delivery.go @@ -2,6 +2,7 @@ package delivery import ( "fmt" + "git.rosy.net.cn/baseapi/platformapi/mtpsapi" "math" "time" @@ -148,3 +149,73 @@ func OnWaybillCreated(waybill *model.Waybill) { model.VendorChineseNames[waybill.WaybillVendorID], waybill.VendorWaybillID, jxutils.IntPrice2StandardCurrencyString(deliveryFee), jxutils.IntPrice2StandardCurrencyString(alarmFee)) } } + +// 订单骑手信息推送:将获取到的三方配送订单,且订单状态为配送中的订单,将配送人员的信息返回给订单方 +// 该方法为定时任务,没五分钟推送一次订单消息,订单状态发生变化时 +//配送状态code,如下提供配送状态枚举值, +//以及各配送状态对应在C端(用户端)和B端(商家PC端)后台展示的配送状态信息。 +//未同步配送状态时(C端:商家已接单;B端:待发配送) +//0-配送单发往配送(C端:商家已接单;B端:待骑手接单) +//1-已创建配送包裹(C端:商家已接单;B端:待骑手接单) +//5-已分配骑手(C端:商家已接单;B端:已分配骑手) +//10-骑手已接单(C端:骑手正在赶往商家;B端:待骑手取货) +//15-骑手已到店(C端:骑手到店取货中;B端:骑手已到店) +//20-骑手已取货(C端:商品配送中/骑手正在送货;B端:骑手已取货) +//40-骑手已送达(C端:商品已送达;B端:骑手已送达) +//100-配送单已取消(C端:商家已接单;B端:配送已取消) +//注:若同步配送状态为“配送单已取消”,接口仍支持继续同步配送状态。 说明:商家如未上传此信息,则平台默认值为20(现已要求必传)。 +func GetOrderRiderInfoToPlatform(orderId string) { + params := make(map[string]interface{}, 0) + params["brandID"] = 0 + params["statuss"] = 20 + params["isDateFinish"] = false + params["isIncludeFake"] = true + params["mustInvoice"] = false + params["adjustCount"] = 0 + params["waybillVendorIDs"] = `[101,102,103]` + if orderId != "" { // 订单id会忽略其他参数 + params["keyword"] = orderId + } + //params["offset"] = 0 + //params["pageSize"] = 10000 + // 查询三天内一万条数据 + orders, _, err := dao.GetOrders(dao.GetDB(), nil, false, true, time.Now().Add(-24*3*time.Hour).Format("2006-01-02"), time.Now().Format("2006-01-02"), false, nil, false, "", params, 0, 10000) + if err != nil { + globals.SugarLogger.Errorf("GetOrder err :%v", err) + return + } + + for _, v := range orders { + var riderInfo *mtpsapi.RiderInfo + if handlerInfo := partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID); handlerInfo != nil { + riderInfo, err = handlerInfo.Handler.GetRiderInfo(v.VendorOrderID, utils.Str2Int64(v.VendorWaybillId2), v.VendorWaybillID) + if err != nil { + globals.SugarLogger.Errorf("Get Order waybill rider info err :%v", err) + continue + } + } + + // 目前只推送美团骑手信息 + switch v.VendorID { + case model.VendorIDMTWM: // 美团发单 + paramsMap := utils.Struct2Map(riderInfo, "", true) + if handler := partner.GetPurchaseOrderHandlerFromVendorID(v.VendorID); handler != nil { + if err := handler.GetOrderRider(v.VendorOrgCode, v.VendorOrderID, paramsMap); err != nil { + globals.SugarLogger.Errorf("Error pushing meituan rider information :%v", err) + } + } + case model.VendorIDELM: // 饿了么 + case model.VendorIDEBAI: // 饿百发单 + + case model.VendorIDJD: // 京东发单 + case model.VendorIDGD: // 美团发单 + case model.VendorIDYB: // 银豹发单 + case model.VendorIDJDShop: // 京东商城 + case model.VendorIDWSC: // 微盟微商城 + default: + globals.SugarLogger.Errorf("Order source error, non system order") + return + } + } + return +} diff --git a/business/partner/delivery/fn/waybill.go b/business/partner/delivery/fn/waybill.go index d87324311..420f775b2 100644 --- a/business/partner/delivery/fn/waybill.go +++ b/business/partner/delivery/fn/waybill.go @@ -2,6 +2,7 @@ package fn import ( "fmt" + "git.rosy.net.cn/baseapi/platformapi/mtpsapi" "git.rosy.net.cn/baseapi/utils" "strconv" "strings" @@ -234,6 +235,7 @@ func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify) (resp *fnpsapi.CallbackRespon order.Status = model.WaybillStatusCourierArrived case fnpsapi.OrderStatusDelivering: // 2 配送中 order.Status = model.WaybillStatusDelivering + delivery.GetOrderRiderInfoToPlatform(order.VendorOrderID) case fnpsapi.OrderStatusDelivered: // 3 已经送达 order.Status = model.WaybillStatusDelivered case fnpsapi.OrderStatusAcceptCacle: // 4取消订单 @@ -280,3 +282,29 @@ func GetDesiredFee(vendorOrderID string) (desiredFee int64) { } return desiredFee } + +// 获取骑手信息 +func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeisongId string) (rider *mtpsapi.RiderInfo, err error) { + // 获取订单状态 + order, err := api.FnAPI.QueryOrder(orderId) + if err != nil { + return nil, err + } + + // 获取骑手坐标 + knightInfo, err := api.FnAPI.GetKnightInfo(&fnpsapi.GetOrderDetailReq{PartnerOrderCode: orderId}) + if err != nil { + return nil, err + } + + return &mtpsapi.RiderInfo{ + OrderId: "", + ThirdCarrierOrderId: orderId, + CourierName: knightInfo.CarrierDriverName, + CourierPhone: knightInfo.CarrierDriverPhone, + LogisticsProviderCode: string(mtpsapi.FnPsCode), + LogisticsStatus: order.OrderStatus, // 默认正在配送中 + Latitude: knightInfo.CarrierDriverLatitude, + Longitude: knightInfo.CarrierDriverLongitude, + }, nil +} diff --git a/business/partner/delivery/jdeclp/waybill.go b/business/partner/delivery/jdeclp/waybill.go index 93be97288..f2c8a7386 100644 --- a/business/partner/delivery/jdeclp/waybill.go +++ b/business/partner/delivery/jdeclp/waybill.go @@ -2,6 +2,7 @@ package jdeclp import ( "fmt" + "git.rosy.net.cn/baseapi/platformapi/mtpsapi" "time" "git.rosy.net.cn/baseapi/platformapi/jdeclpapi" @@ -102,3 +103,7 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf func (c *DeliveryHandler) ComplaintRider(bill *model.Waybill, resonID int, resonContent string) (err error) { return err } + +func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeisongId string) (rider *mtpsapi.RiderInfo, err error) { + return nil, nil +} diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index 09e14ba4f..ceddad877 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -103,6 +103,7 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m order.Remark = order.CourierName + "," + order.CourierMobile case mtpsapi.OrderStatusPickedUp: order.Status = model.WaybillStatusDelivering + delivery.GetOrderRiderInfoToPlatform(order.VendorOrderID) case mtpsapi.OrderStatusDeliverred: order.Status = model.WaybillStatusDelivered case mtpsapi.OrderStatusCanceled: @@ -380,3 +381,23 @@ func (c *DeliveryHandler) GetRidderPosition(ctx *jxcontext.Context, vendorOrgCod } return lng, lat, err } + +// 获取骑手信息 美团配送 deliveryId,mtPeisongId这两参数美团专属 +func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeisongId string) (rider *mtpsapi.RiderInfo, err error) { + // 获取订单状态 + order, err := api.MtpsAPI.QueryOrderStatus(deliveryId, mtPeisongId) + if err != nil { + return nil, err + } + + return &mtpsapi.RiderInfo{ + OrderId: utils.Interface2String(order["mt_peisong_id"]), + ThirdCarrierOrderId: utils.Interface2String(order["order_id"]), + CourierName: utils.Interface2String(order["courier_name"]), + CourierPhone: utils.Interface2String(order["courier_phone"]), + LogisticsProviderCode: string(mtpsapi.MTPsCode), + LogisticsStatus: int(utils.MustInterface2Int64(order["status"])), // 默认正在配送中 + Latitude: utils.Interface2String(order["order_id"]), + Longitude: utils.Interface2String(order["order_id"]), + }, nil +} diff --git a/business/partner/partner_delivery.go b/business/partner/partner_delivery.go index 36a45b563..55e89d65e 100644 --- a/business/partner/partner_delivery.go +++ b/business/partner/partner_delivery.go @@ -2,7 +2,7 @@ package partner import ( "fmt" - + "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" @@ -40,6 +40,8 @@ type IDeliveryPlatformHandler interface { GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo *WaybillFeeInfo, err error) //投诉骑手 ComplaintRider(bill *model.Waybill, resonID int, resonContent string) (err error) + // 获取骑手信息 + GetRiderInfo(orderId string, deliveryId int64, mtPeisongId string) (rider *mtpsapi.RiderInfo, err error) } type IDeliveryUpdateStoreHandler interface { diff --git a/business/partner/partner_order.go b/business/partner/partner_order.go index 7167cd365..2f286621f 100644 --- a/business/partner/partner_order.go +++ b/business/partner/partner_order.go @@ -67,6 +67,8 @@ type IPurchasePlatformOrderHandler interface { GetOrderAfsInfo(ctx *jxcontext.Context, vendorOrderID, afsOrderID string) (orderAfsInfo *OrderAfsInfo, err error) //投诉骑手 ComplaintRider(vendorOrderId string, resonID int, resonContent string) (err error) + //推送订单骑手信息 + GetOrderRider(vendorOrgCode, vendorStoreID string, param map[string]interface{}) ( err error) } type IAddWaybillTip interface { diff --git a/business/partner/printer/feie/feie_test.go b/business/partner/printer/feie/feie_test.go index d4088eab6..fdbd92e29 100644 --- a/business/partner/printer/feie/feie_test.go +++ b/business/partner/printer/feie/feie_test.go @@ -26,7 +26,7 @@ func TestPrintMsg(t *testing.T) { t.Fatal(err) } - context := CurPrinterHandler.getOrderContent(order, "13412345678") + context := CurPrinterHandler.getOrderContent(order, "13412345678",nil) //context := CurPrinterHandler.getOrderContentBig(order, "13412345678") status, err := CurPrinterHandler.PrintMsg(jxcontext.AdminCtx, "218510310", "ztdpveyg", "test", context) t.Log(utils.Format4Output(status, false)) diff --git a/business/partner/purchase/ebai/ebai.go b/business/partner/purchase/ebai/ebai.go index 04d3de1ff..eb4a362e8 100644 --- a/business/partner/purchase/ebai/ebai.go +++ b/business/partner/purchase/ebai/ebai.go @@ -157,3 +157,7 @@ func (p *PurchaseHandler) GetVendorCategories(ctx *jxcontext.Context) (vendorCat vendorCats, err = p.getVendorCategories(1, 0) return vendorCats, err } + +func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, param map[string]interface{}) (err error) { + return nil +} diff --git a/business/partner/purchase/jd/jd.go b/business/partner/purchase/jd/jd.go index 3ebc866bc..e3719c437 100644 --- a/business/partner/purchase/jd/jd.go +++ b/business/partner/purchase/jd/jd.go @@ -179,3 +179,7 @@ func OnTokenChange(values url.Values) { } } + +func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, param map[string]interface{}) (err error) { + return nil +} diff --git a/business/partner/purchase/jdshop/jds.go b/business/partner/purchase/jdshop/jds.go index 0ae9c37b1..d4feda0bb 100644 --- a/business/partner/purchase/jdshop/jds.go +++ b/business/partner/purchase/jdshop/jds.go @@ -97,3 +97,7 @@ func (p *PurchaseHandler) GetVendorCategories(ctx *jxcontext.Context) (vendorCat } return vendorCats, err } + +func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, param map[string]interface{}) (err error) { + return nil +} diff --git a/business/partner/purchase/jx/jx.go b/business/partner/purchase/jx/jx.go index 24dc7beeb..d004b7b80 100644 --- a/business/partner/purchase/jx/jx.go +++ b/business/partner/purchase/jx/jx.go @@ -32,3 +32,8 @@ func (c *PurchaseHandler) GetVendorID() int { func (p *PurchaseHandler) UploadImg(ctx *jxcontext.Context, vendorOrgCode, imgURL string, imgData []byte, imgName string, imgType int) (imgHint string, err error) { return imgHint, err } + + +func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, param map[string]interface{}) (err error) { + return nil +} diff --git a/business/partner/purchase/mtwm/order.go b/business/partner/purchase/mtwm/order.go index f4ea675fd..11be187e1 100644 --- a/business/partner/purchase/mtwm/order.go +++ b/business/partner/purchase/mtwm/order.go @@ -93,6 +93,14 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode, vendorOrderID, vendorStoreID s return order, result, err } +func (p *PurchaseHandler) getOrderRider(vendorOrgCode, vendorStoreID string,param map[string]interface{}) ( err error) { + return getAPI(vendorOrgCode, 0, vendorStoreID).OrderStatusAndPsInfo(param) +} + +func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, param map[string]interface{}) ( err error) { + return p.getOrderRider(vendorOrgCode, vendorStoreID, param) +} + func (p *PurchaseHandler) GetOrder(vendorOrgCode, vendorOrderID, vendorStoreID string) (order *model.GoodsOrder, err error) { order, _, err = p.getOrder(vendorOrgCode, vendorOrderID, vendorStoreID) return order, err diff --git a/business/partner/purchase/yb/yb.go b/business/partner/purchase/yb/yb.go index 9c52f8b18..2f1824db8 100644 --- a/business/partner/purchase/yb/yb.go +++ b/business/partner/purchase/yb/yb.go @@ -41,3 +41,8 @@ func (p *PurchaseHandler) UploadImg(ctx *jxcontext.Context, vendorOrgCode, imgUR func (p *PurchaseHandler) GetVendorCategories(ctx *jxcontext.Context) (vendorCats []*model.SkuVendorCategory, err error) { return vendorCats, err } + +func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, param map[string]interface{}) (err error) { + return nil +} + diff --git a/conf/app.conf b/conf/app.conf index a4b610c5c..7fb8ad96c 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -196,11 +196,16 @@ weixinAppID = "wxbf235770edaabc5c" weixinSecret = "ba32b269a068a5b72486a0beafd171e8" weixinToken = "17_roSCZgkCxhRnyFVtei0KdfHwdGP8PmLzJFhCieka4_X4_d-lgfaTxF6oIS6FE5lkgLbrtstSsO6HyDNHKsHJmpB8YOtJYN4sO-AezdWLF78M2phL0K8xCRjB9YE9-Ci64GCqS50o6LcVqux8ORVbACAFIM" +weixinAppIdPrint = "wx2bfbc02e6251b71b" +weixinAppSecretPrint = "ff4128908947cfb71002f74599c0dbf9" + dbConnectStr = "root:WebServer@1@tcp(127.0.0.1:3306)/jxd_dev_0?charset=utf8mb4&loc=Local&parseTime=true" getWeixinTokenURL = "http://www.jxc4.com/v2/sys/GetWXToken" getYLYTokenURL = "http://www.jxc4.com/v2/sys/GetYLYToken" +tiktokAppKey = "ttaceeda5333d7a7ab01" +tiktokAppSecret = "58ad9aa661599411cfce52a50724c4b86d4421c7" [prod] EnableDocs = false @@ -265,6 +270,9 @@ weixinMiniSecret2 = "2a57228a716ce991a52739f0ff41111d" weixinMiniAppID3 = "wx18111a41fd17f24f" weixinMiniSecret3 = "c79ac6e1b2d6d7968e72a9658a8b6715" +weixinAppIdPrint = "wx2bfbc02e6251b71b" +weixinAppSecretPrint = "ff4128908947cfb71002f74599c0dbf9" + yinbaoAppKey = "682628966212343269" yinbaoAppID = "18C0E0867E467DBC26EFF5E957B02EC4" @@ -312,6 +320,9 @@ fnCallbackURL = "http://callback.jxc4.com/fn/msg" jxPrintAppID = "1000" jxPrintAppKey = "rfBd56ti2SMtYvSg" +tiktokAppKey = "ttaceeda5333d7a7ab01" +tiktokAppSecret = "58ad9aa661599411cfce52a50724c4b86d4421c7" + [jxgy] httpport = 8088 EnableDocs = false @@ -358,6 +369,9 @@ weixinMiniSecret = "11f3c380551c4683c149990b004d6df9" weixinMiniAppID2 = "wx4b5930c13f8b1170" weixinMiniSecret2 = "2a57228a716ce991a52739f0ff41111d" +weixinAppIdPrint = "wx2bfbc02e6251b71b" +weixinAppSecretPrint = "ff4128908947cfb71002f74599c0dbf9" + wxpayNotifyURL = "http://callback-jxgy.jxc4.com/wxpay/msg/" tonglianPayAppID = "00183083" @@ -403,7 +417,8 @@ jxPrintAppID = "1000" jxPrintAppKey = "rfBd56ti2SMtYvSg" storeName = "京西果园" - +tiktokAppKey = "ttaceeda5333d7a7ab01" +tiktokAppSecret = "58ad9aa661599411cfce52a50724c4b86d4421c7" [test] jdOrgCode = "82029" jdToken = "594ab45a-9a73-4a43-82b0-a64cbd55d883" @@ -531,6 +546,8 @@ weixinMiniAppID2 = "wx4b5930c13f8b1170" weixinMiniSecret2 = "2a57228a716ce991a52739f0ff41111d" weixinMiniAppID3 = "wx18111a41fd17f24f" weixinMiniSecret3 = "c79ac6e1b2d6d7968e72a9658a8b6715" +weixinAppIdPrint = "wx2bfbc02e6251b71b" +weixinAppSecretPrint = "ff4128908947cfb71002f74599c0dbf9" yinbaoAppKey = "682628966212343269" yinbaoAppID = "18C0E0867E467DBC26EFF5E957B02EC4" @@ -577,4 +594,7 @@ fnMerchantId= "51658" fnCallbackURL = "http://callback.jxc4.com/fn/msg" jxPrintAppID = "1000" -jxPrintAppKey = "rfBd56ti2SMtYvSg" \ No newline at end of file +jxPrintAppKey = "rfBd56ti2SMtYvSg" + +tiktokAppKey = "ttaceeda5333d7a7ab01" +tiktokAppSecret = "58ad9aa661599411cfce52a50724c4b86d4421c7" \ No newline at end of file diff --git a/globals/api/api.go b/globals/api/api.go index c498ebacf..c6e808fb7 100644 --- a/globals/api/api.go +++ b/globals/api/api.go @@ -3,6 +3,7 @@ package api import ( "git.rosy.net.cn/baseapi/platformapi/jxprintapi" "git.rosy.net.cn/baseapi/platformapi/qywxapi" + "git.rosy.net.cn/baseapi/platformapi/tiktok" "time" "git.rosy.net.cn/baseapi/platformapi/fnpsapi" @@ -63,22 +64,24 @@ var ( EbaiAPI *ebaiapi.API Ebai2API *ebaiapi.API - MtwmAPI *mtwmapi.API - Mtwm2API *mtwmapi.API - MtpsAPI *mtpsapi.API - DadaAPI *dadaapi.API - QywxAPI *qywxapi.API //企业微信 - WeixinAPI *weixinapi.API // 微信公众号 - WeixinMiniAPI *weixinapi.API // 小程序 - WeixinMiniAPI2 *weixinapi.API // 小程序2 - WeixinMiniAPIsc *weixinapi.API //小程序商超 - WeixinApp *weixinapi.API // app微信登录 - WeixinMiniAppID2 string - WeixinMiniAppID3 string - WeixinMiniAppIDsc string - WxpayAPI *wxpayapi.API // 微信支付API - TLpayAPI *tonglianpayapi.API //通联收银宝api - FnAPI *fnpsapi.API //蜂鸟配送api + MtwmAPI *mtwmapi.API + Mtwm2API *mtwmapi.API + MtpsAPI *mtpsapi.API + DadaAPI *dadaapi.API + QywxAPI *qywxapi.API //企业微信 + WeixinAPI *weixinapi.API // 微信公众号 + WeixinMiniAPI *weixinapi.API // 小程序 + WeixinMiniAPI2 *weixinapi.API // 小程序2 + WeixinMiniAPIsc *weixinapi.API //小程序商超 + WeixinMiniAPIPrint *weixinapi.API //小程序打印机 + WeixinApp *weixinapi.API // app微信登录 + WeixinMiniAppID2 string + WeixinMiniAppID3 string + WeixinMiniAppIDsc string + WeixinMiniPrintAppId string + WxpayAPI *wxpayapi.API // 微信支付API + TLpayAPI *tonglianpayapi.API //通联收银宝api + FnAPI *fnpsapi.API //蜂鸟配送api YinBaoAPI *yinbaoapi.API //银豹平台api @@ -106,6 +109,8 @@ var ( Cacher cache.ICacher SMSClient *aliyunsmsclient.SmsClient + + TiktokApi *tiktok.API ) func init() { @@ -249,6 +254,10 @@ func Init() { if WeixinMiniAppIDsc = beego.AppConfig.DefaultString("weixinMiniAppIDsc", ""); WeixinMiniAppIDsc != "" { WeixinMiniAPIsc = weixinapi.New(WeixinMiniAppIDsc, beego.AppConfig.DefaultString("weixinMiniSecretsc", "")) } + if WeixinMiniPrintAppId = beego.AppConfig.DefaultString("weixinAppIdPrint", ""); WeixinMiniPrintAppId != "" { + WeixinMiniAPIPrint = weixinapi.New(WeixinMiniPrintAppId, beego.AppConfig.DefaultString("weixinAppSecretPrint", "")) + } + if globals.WxpayNotifyURL != "" { // WxpayAPI = wxpayapi.New(beego.AppConfig.DefaultString("wxpayAppID"), beego.AppConfig.DefaultString("wxpayAppKey"), beego.AppConfig.DefaultString("wxpayAppMchID")) WxpayAPI = wxpayapi.NewWithCertificate(beego.AppConfig.DefaultString("wxpayAppID", ""), beego.AppConfig.DefaultString("wxpayAppKey", ""), beego.AppConfig.DefaultString("wxpayAppMchID", ""), @@ -285,4 +294,5 @@ func Init() { SMSClient = aliyunsmsclient.New("http://dysmsapi.aliyuncs.com/") QywxAPI = qywxapi.New(beego.AppConfig.DefaultString("qywxID", ""), beego.AppConfig.DefaultString("qywxSecret", ""), "") + TiktokApi = tiktok.New(beego.AppConfig.DefaultString("tiktokAppSecret", ""), beego.AppConfig.DefaultString("tiktokAppKey", "")) }