1
This commit is contained in:
@@ -2216,21 +2216,24 @@ func updateCourierStores(ctx *jxcontext.Context, storeID int) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UpdateStoreName() error {
|
func UpdateStoreName() error {
|
||||||
var db = dao.GetDB()
|
var (
|
||||||
|
db = dao.GetDB()
|
||||||
|
context = jxcontext.AdminCtx
|
||||||
|
)
|
||||||
|
|
||||||
sql := ` SELECT * FROM store_courier_map WHERE vendor_id IN (?,?,?,?) AND deleted_at = ?`
|
sql := ` SELECT * FROM store_courier_map WHERE vendor_id IN (?,?,?,?) AND deleted_at = ?`
|
||||||
courierList := make([]*model.StoreCourierMap, 0, 0)
|
courierList := make([]*model.StoreCourierMap, 0, 0)
|
||||||
if err := dao.GetRows(db, &courierList, sql, []interface{}{model.VendorIDMTPS, model.VendorIDFengNiao, model.VendorIDDada, model.VendorIDUUPT, utils.DefaultTimeValue}...); err != nil {
|
if err := dao.GetRows(db, &courierList, sql, []interface{}{model.VendorIDMTPS, model.VendorIDFengNiao, model.VendorIDDada, model.VendorIDUUPT, utils.DefaultTimeValue}...); err != nil {
|
||||||
globals.SugarLogger.Debugf("query Order err := %v", err)
|
globals.SugarLogger.Debugf("query Order err := %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("====================len : %d", len(courierList))
|
|
||||||
|
|
||||||
for i := 0; i < len(courierList); i++ {
|
for i := 0; i < len(courierList); i++ {
|
||||||
storeDetail, _ := dao.GetStoreDetail2(db, courierList[i].StoreID, courierList[i].VendorStoreID, courierList[i].VendorID)
|
storeDetail, _ := dao.GetStoreDetail2(db, courierList[i].StoreID, courierList[i].VendorStoreID, courierList[i].VendorID)
|
||||||
formalizeStore4Courier(storeDetail)
|
formalizeStore4Courier(storeDetail)
|
||||||
if handlerInfo := partner.GetDeliveryPlatformFromVendorID(storeDetail.VendorID); handlerInfo != nil {
|
if handlerInfo := partner.GetDeliveryPlatformFromVendorID(storeDetail.VendorID); handlerInfo != nil {
|
||||||
if updateHandler, _ := handlerInfo.Handler.(partner.IDeliveryUpdateStoreHandler); updateHandler != nil {
|
if updateHandler, _ := handlerInfo.Handler.(partner.IDeliveryUpdateStoreHandler); updateHandler != nil {
|
||||||
if err := updateHandler.UpdateStoreName(storeDetail.VendorStoreID, storeDetail.Name); err != nil {
|
if err := updateHandler.UpdateStore(context, storeDetail); err != nil {
|
||||||
globals.SugarLogger.Debugf("err := %v,storeID : %s,storeName :%s , vendorId : %d", err, storeDetail.VendorStoreID, storeDetail.Name, storeDetail.VendorID)
|
globals.SugarLogger.Debugf("err := %v,storeID : %s,storeName :%s , vendorId : %d", err, storeDetail.VendorStoreID, storeDetail.Name, storeDetail.VendorID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,12 +188,6 @@ func (c *DeliveryHandler) callbackMsg2Waybill(msg *dadaapi.CallbackMsg) (retVal
|
|||||||
}
|
}
|
||||||
|
|
||||||
func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.ShopInfo) {
|
func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.ShopInfo) {
|
||||||
// 获取品牌名称
|
|
||||||
brandInfo, err := dao.GetBrands(dao.GetDB(), "", storeDetail.BrandID, "", false, "")
|
|
||||||
if err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
lng := jxutils.IntCoordinate2Standard(storeDetail.Lng)
|
lng := jxutils.IntCoordinate2Standard(storeDetail.Lng)
|
||||||
lat := jxutils.IntCoordinate2Standard(storeDetail.Lat)
|
lat := jxutils.IntCoordinate2Standard(storeDetail.Lat)
|
||||||
cityName := storeDetail.CityName
|
cityName := storeDetail.CityName
|
||||||
@@ -209,7 +203,7 @@ func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.Shop
|
|||||||
}
|
}
|
||||||
shopInfo = &dadaapi.ShopInfo{
|
shopInfo = &dadaapi.ShopInfo{
|
||||||
OriginShopID: storeDetail.VendorStoreID,
|
OriginShopID: storeDetail.VendorStoreID,
|
||||||
StationName: brandInfo[0].Name + "-" + storeDetail.Name,
|
StationName: storeDetail.Name,
|
||||||
Business: dadaapi.BusinessTypeConvStore, // 故意设置成这个的
|
Business: dadaapi.BusinessTypeConvStore, // 故意设置成这个的
|
||||||
CityName: cityName,
|
CityName: cityName,
|
||||||
AreaName: districtName,
|
AreaName: districtName,
|
||||||
@@ -624,10 +618,3 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
|||||||
}
|
}
|
||||||
return vendorPrice, nil
|
return vendorPrice, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeliveryHandler) UpdateStoreName(storeId, name string) (err error) {
|
|
||||||
return api.DadaAPI.ShopUpdate(&dadaapi.ShopInfo{
|
|
||||||
StationName: name,
|
|
||||||
OriginShopID: storeId,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -109,12 +109,6 @@ func (c *DeliveryHandler) IsErrStoreNotExist(err error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
|
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
|
||||||
// 获取品牌名称
|
|
||||||
brandInfo, err := dao.GetBrands(dao.GetDB(), "", storeDetail.BrandID, "", false, "")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取蜂鸟门店id
|
// 获取蜂鸟门店id
|
||||||
fnStore, err := api.FnAPI.GetStore(storeDetail.VendorStoreID)
|
fnStore, err := api.FnAPI.GetStore(storeDetail.VendorStoreID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -139,7 +133,7 @@ func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.S
|
|||||||
BusinessLicencePicHash: storeDetail.Licence,
|
BusinessLicencePicHash: storeDetail.Licence,
|
||||||
}
|
}
|
||||||
if storeDetail.Name != fnStore.Name {
|
if storeDetail.Name != fnStore.Name {
|
||||||
updateStore.HeadShopName = brandInfo[0].Name + "-" + storeDetail.Name
|
updateStore.HeadShopName = storeDetail.Name
|
||||||
updateStore.BranchShopName = storeDetail.Name
|
updateStore.BranchShopName = storeDetail.Name
|
||||||
}
|
}
|
||||||
if updateStore.OwnerName == "" {
|
if updateStore.OwnerName == "" {
|
||||||
|
|||||||
@@ -473,38 +473,3 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
|||||||
}
|
}
|
||||||
return vendorPrice, nil
|
return vendorPrice, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeliveryHandler) UpdateStoreName(storeId, name string) (err error) {
|
|
||||||
// 获取蜂鸟门店id
|
|
||||||
fnStore, err := api.FnAPI.GetStore(storeId)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
updateStore := &fnpsapi.UpdateStoreParam{
|
|
||||||
ChainStoreID: fnStore.ChainStoreID,
|
|
||||||
ContactPhone: fnStore.ContactPhone,
|
|
||||||
Address: fnStore.Address,
|
|
||||||
Longitude: fnStore.Longitude,
|
|
||||||
Latitude: fnStore.Latitude,
|
|
||||||
PositionSource: 3,
|
|
||||||
OutShopCode: fnStore.OutShopCode,
|
|
||||||
CategoryID: utils.Int2Str(fnStore.CategoryID),
|
|
||||||
OwnerName: fnStore.OwnerName,
|
|
||||||
OwnerIDNum: fnStore.OwnerIDNum,
|
|
||||||
HandheldLicencePicHash: "暂不需要(手持身份证、营业执照图片)",
|
|
||||||
OwnerIDPicFrontHash: "暂不需要(省份证正)",
|
|
||||||
OwnerIDPicBackHash: "暂不需要(身份证反)",
|
|
||||||
CreditCode: fnStore.CreditCode,
|
|
||||||
}
|
|
||||||
updateStore.HeadShopName = name
|
|
||||||
updateStore.BranchShopName = name
|
|
||||||
if updateStore.OwnerName == "" {
|
|
||||||
updateStore.OwnerName = "石锋"
|
|
||||||
}
|
|
||||||
if updateStore.OwnerIDNum == "" {
|
|
||||||
updateStore.OwnerIDNum = "610126198012230014"
|
|
||||||
}
|
|
||||||
|
|
||||||
return api.FnAPI.UpdateStore(updateStore)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -169,7 +169,6 @@ func (c *DeliveryHandler) IsErrStoreExist(err error) bool {
|
|||||||
|
|
||||||
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
|
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
|
||||||
if globals.EnableStoreWrite {
|
if globals.EnableStoreWrite {
|
||||||
// err = api.MtpsAPI.PagePoiUpdate(storeDetail.VendorStoreID, storeDetail.PayeeName, storeDetail.Tel1, fakeContactEmail)
|
|
||||||
shopInfo := &mtpsapi.ShopInfo{
|
shopInfo := &mtpsapi.ShopInfo{
|
||||||
ShopID: utils.Int2Str(storeDetail.ID),
|
ShopID: utils.Int2Str(storeDetail.ID),
|
||||||
ContactName: storeDetail.PayeeName,
|
ContactName: storeDetail.PayeeName,
|
||||||
@@ -177,18 +176,9 @@ func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.S
|
|||||||
ShopAddress: storeDetail.Address,
|
ShopAddress: storeDetail.Address,
|
||||||
ShopLat: storeDetail.Lat,
|
ShopLat: storeDetail.Lat,
|
||||||
ShopLng: storeDetail.Lng,
|
ShopLng: storeDetail.Lng,
|
||||||
|
ShopName: storeDetail.Name,
|
||||||
}
|
}
|
||||||
_, err = api.MtpsAPI.ShopUpdate(shopInfo)
|
_, err = api.MtpsAPI.ShopUpdate(shopInfo)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 美团配送,修改门店名称
|
|
||||||
func (c *DeliveryHandler) UpdateStoreName(storeId, name string) (err error) {
|
|
||||||
shopInfo := &mtpsapi.ShopInfo{
|
|
||||||
ShopID: storeId,
|
|
||||||
ShopName: name,
|
|
||||||
}
|
|
||||||
_, err = api.MtpsAPI.ShopUpdate(shopInfo)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ type IDeliveryPlatformHandler interface {
|
|||||||
|
|
||||||
type IDeliveryUpdateStoreHandler interface {
|
type IDeliveryUpdateStoreHandler interface {
|
||||||
UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error)
|
UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error)
|
||||||
UpdateStoreName(storeId, name string) (err error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeliveryPlatformHandlerInfo struct {
|
type DeliveryPlatformHandlerInfo struct {
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ func pay4OrderByKs(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
|||||||
VendorID: order.VendorID,
|
VendorID: order.VendorID,
|
||||||
Status: 0,
|
Status: 0,
|
||||||
PayCreatedAt: time.Now(),
|
PayCreatedAt: time.Now(),
|
||||||
PrepayID: prePayInfo.OrderInfoToken,
|
PrepayID: prePayInfo.OrderNo,
|
||||||
CodeURL: prePayInfo.OrderNo, // 抖音支付token
|
CodeURL: prePayInfo.OrderInfoToken, // 抖音支付token
|
||||||
TotalFee: int(order.ActualPayPrice),
|
TotalFee: int(order.ActualPayPrice),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user