Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop

This commit is contained in:
richboo111
2024-01-12 16:58:24 +08:00
8 changed files with 95 additions and 26 deletions

View File

@@ -1854,8 +1854,11 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
// dao.UpdateEntity(db, storeDetail, "Address")
// // 添加同步
valid["address"] = payload["address"].(string)
//syncStatus |= model.SyncFlagStoreName
syncStatus |= model.SyncFlagStoreName
address = payload["address"].(string)
// 这个字段暂存美团门店地址
storeMap.YbStorePrefix = address
dao.UpdateEntity(db, storeMap, "YbStorePrefix")
}
if err == nil {
@@ -1920,7 +1923,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
}
if isUpdateStoreNeedSync(valid) { // 同步修改门店已经配送门店
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName) // address原来的userName 因为storeMap无法保存address,所以美团暂时使用该参数代替
//updateCourierStores(ctx, storeID)
}

View File

@@ -6692,23 +6692,11 @@ func BatchSetRestockingPrice(ctx *jxcontext.Context, preData map[string][]mtwmap
}
// BatchSetMTBoxPrice 批量修改美团包装费为0
//func BatchSetMTBoxPrice(jxStoreId []int) error {
// var db = dao.GetDB()
// for _, v := range jxStoreId {
// storeDetail, err := dao.GetStoreDetail(db, v, model.VendorIDMTWM, "")
// if err != nil {
// return err
// }
//
// storeSkuList, err := dao.GetStoresSkusInfo(db, []int{v}, nil)
// if err != nil {
// return err
// }
//
// }
//
// utils.CallFuncAsync(func() {
//
// })
// return nil
//}
func BatchSetMTBoxPrice(ctx *jxcontext.Context, jxStoreId []int) error {
var db = dao.GetDB()
for _, v := range jxStoreId {
mtwm.UpdateBoxPrice(ctx, db, v)
}
return nil
}

View File

@@ -62,7 +62,7 @@ type StoreDetail struct {
YbAppID string `orm:"column(yb_app_id)" json:"ybAppID"`
YbAppKey string `json:"ybAppKey"`
YbStorePrefix string `json:"ybStorePrefix"` //vendorID=14 暂存打包费
YbStorePrefix string `json:"ybStorePrefix"` //vendorID=14 暂存打包费 / vendorID = 1 暂存美团门店地址
MtwmToken string `json:"mtwmToken"` // 当vendor为美团时存储美团token,为抖店时存储抖店token,也储存淘鲜达token,其他品牌门店授权时appkey相同时token不相同
EbaiSupplierID string `json:"ebaiSupplierID"`

View File

@@ -632,7 +632,7 @@ func (c *PurchaseHandler) SelfDeliverDelivered(order *model.GoodsOrder, userName
riderInfo.ThirdCarrierOrderId = order.VendorOrderID
} else {
for _, v := range waybills {
if v.Status >= model.OrderStatusDelivering && v.Status <= model.OrderStatusFinished {
if v.Status != model.OrderStatusCanceled && v.Status != model.OrderStatusFinished && v.Status != model.OrderStatusEndEnd {
riderInfo.CourierName = v.CourierName
riderInfo.CourierPhone = v.CourierMobile
riderInfo.ThirdCarrierOrderId = v.VendorWaybillID

View File

@@ -263,8 +263,8 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
//TODO 美团暂时不用那个电话
phone := storeDetail.Tel1
params := map[string]interface{}{
"name": name, //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM),
"address": storeDetail.Address, // 美团好像地址也不能改的?
"name": name, //jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM),
// "address": storeDetail.Address, // 美团好像地址也不能改的?
"longitude": jxutils.IntCoordinate2Standard(int(remoteStoreInfo.Longitude)),
"latitude": jxutils.IntCoordinate2Standard(int(remoteStoreInfo.Latitude)),
"phone": phone,
@@ -275,6 +275,10 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
"third_tag_name": remoteStoreInfo.ThirdTagName,
"promotion_info": storeDetail.PromoteInfo,
}
if storeDetail.Address != storeDetail.YbStorePrefix && storeDetail.YbStorePrefix != "" {
params["address"] = storeDetail.YbStorePrefix
}
if globals.EnableMtwmStoreWrite {
errList.AddErr(mtapi.PoiSave(storeDetail.VendorStoreID, params))
}

View File

@@ -3,6 +3,7 @@ package mtwm
import (
"encoding/json"
"fmt"
"math"
"regexp"
"strings"
@@ -437,6 +438,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
// boxPirce = storeSku.LadderBoxPrice
//}
//skus[0]["ladder_box_price"] = jxutils.IntPrice2Standard(int64(boxPirce))
skus[0]["ladder_box_num"] = 0
skus[0]["ladder_box_price"] = 0
if foodData["tag_id"] != nil {
skus[0]["weight"] = storeSku.Weight // weight字段仅限服饰鞋帽、美妆、日用品、母婴、生鲜果蔬、生活超市下的便利店/超市门店品类的商家使用
}
@@ -895,3 +899,45 @@ func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorO
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
return "", err
}
func UpdateBoxPrice(ctx *jxcontext.Context, db *dao.DaoDB, storeId int) error {
storeDetail, err := dao.GetStoreDetail(db, storeId, model.VendorIDMTWM, "")
if err != nil {
return err
}
storeSkuList, err := dao.GetStoresSkusInfo(db, []int{storeId}, nil)
if err != nil {
return err
}
api := getAPI(storeDetail.VendorOrgCode, storeId, storeDetail.VendorStoreID)
foodDataList := make([]map[string]interface{}, 0)
for _, v := range storeSkuList {
if v.MtwmID != model.NO {
continue
}
foodDataList = append(foodDataList, map[string]interface{}{
"app_spu_code": utils.Int2Str(v.SkuID),
"skus": []map[string]interface{}{
{
"sku_id": utils.Int2Str(v.SkuID),
"ladder_box_num": "0",
"ladder_box_price": "0",
},
},
})
}
count := utils.Float64TwoInt(math.Ceil(float64(len(foodDataList)) / float64(50)))
for i := 1; i <= count; i++ {
if i == count {
_, _ = api.RetailBatchInitData(ctx.GetTrackInfo(), storeDetail.VendorStoreID, foodDataList[(i-1)*50:])
} else {
_, _ = api.RetailBatchInitData(ctx.GetTrackInfo(), storeDetail.VendorStoreID, foodDataList[(i-1)*50:i*50])
}
}
return nil
}

View File

@@ -885,6 +885,24 @@ func (c *SkuController) BatchSetRestockingPrice() {
})
}
// @Title 批量设置美团商品打包费为零
// @Description 批量设置美团商品打包费为零
// @Param token header string true "认证token"
// @Param storeIds formData string true "门店id列表"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /BatchSetBoxPrice [post]
func (c *SkuController) BatchSetBoxPrice() {
c.callBatchSetBoxPrice(func(params *tSkuBatchSetBoxPriceParams) (retVal interface{}, errCode string, err error) {
var stores []int
if err = jxutils.Strings2Objs(params.StoreIds, &stores); err != nil {
return retVal, "", err
}
err = cms.BatchSetMTBoxPrice(params.Ctx, stores)
return retVal, "", err
})
}
type CategoryList struct {
DdId string `json:"dd_id"`
Id int `json:"id"`

View File

@@ -2025,6 +2025,16 @@ func init() {
Filters: nil,
Params: nil})
// 修改门店美团包装费
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"],
web.ControllerComments{
Method: "BatchSetBoxPrice",
Router: `/BatchSetBoxPrice`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Filters: nil,
Params: nil})
// 修改抖店分类商品
web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"] = append(web.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:SkuController"],
web.ControllerComments{