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

This commit is contained in:
richboo111
2023-08-30 15:06:25 +08:00
20 changed files with 356 additions and 65 deletions

View File

@@ -1122,7 +1122,9 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
defer func() {
dao.Rollback(db, txDB)
}()
if num, err = dao.UpdateEntityLogically(db, store, valid, userName, nil); err == nil && num == 1 {
num, err = dao.UpdateEntityLogically(db, store, valid, userName, nil)
if err == nil && num == 1 {
if isUpdateStoreNeedSync(valid) {
dummy := &model.StoreMap{}
kv := make(map[string]interface{})
@@ -1790,6 +1792,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
// }
syncStatus |= model.SyncFlagStoreName
}
//增加同步到抖店厂商的同步标志
DDFlag := false
errList := errlist.ErrList{}
@@ -1833,6 +1836,22 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
}
}
// 增加门店地址修改同步
storeDetail, err := dao.GetStoreBaseByVendorStoreID(storeMap.VendorStoreID, storeMap.VendorID)
address := ""
if err != nil || storeDetail == nil {
return 0, fmt.Errorf("基础门店信息异常,请联系管理员")
}
if storeDetail != nil && payload["address"].(string) != storeDetail.Address {
// 修改门店地址
storeDetail.Address = payload["address"].(string)
dao.UpdateEntity(db, storeDetail, "Address")
// 添加同步
valid["address"] = payload["address"].(string)
syncStatus |= model.SyncFlagStoreName
address = payload["address"].(string)
}
if err == nil {
if len(valid) > 0 {
txDB, _ := dao.Begin(db)
@@ -1843,6 +1862,10 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
}
}()
if address != "" {
delete(valid, "address")
}
// storeMap 不包含address参数
if isStoreMapNeedSync(vendorID, valid) { // 对于store vendor map只有Status改变才需要同步到厂商
num, err = dao.UpdateEntityLogicallyAndUpdateSyncStatus(db, storeMap, valid, userName, map[string]interface{}{
model.FieldStoreID: storeID,
@@ -1856,6 +1879,7 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
//"VendorOrgCode": vendorOrgCode,
})
}
if err != nil {
dao.Rollback(db, txDB)
return 0, err
@@ -1884,7 +1908,8 @@ func UpdateStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendor
}
}
dao.Commit(db, txDB)
if isStoreMapNeedSync(vendorID, valid) {
if isStoreMapNeedSync(vendorID, valid) || address != "" {
_, err = CurVendorSync.SyncStore(ctx, db, vendorID, storeID, false, userName)
}

View File

@@ -497,7 +497,13 @@ func GetStoreList4User(ctx *jxcontext.Context, mobileNum, userID string) (storeL
storeIDs = append(storeIDs, v.StoreID)
}
}
if len(storeIDs) == model.NO && len(shortRoleNameList) == model.NO {
return nil, nil
}
storeList, err = dao.GetStoreListByMobileOrStoreIDs(dao.GetDB(), mobileNum, shortRoleNameList, storeIDs)
return storeList, err
}
@@ -513,8 +519,8 @@ func GetMyStoreListNew(ctx *jxcontext.Context, version string) (storesInfo inter
}
}
mobile, userID := ctx.GetMobileAndUserID()
if mobile == "" {
return nil, "", fmt.Errorf("不能得到用户手机号")
if mobile == "" || userID == "" || userID == "null" || userID == "NULL" {
return nil, "", fmt.Errorf("不能得到用户手机号,%s,%s", userID, mobile)
}
var storeList []*dao.StoreWithCityName
if storeList, err = GetStoreList4User(ctx, mobile, userID); err == nil && len(storeList) > 0 {

View File

@@ -181,7 +181,7 @@ func Init() {
// 每五分钟轮询一次推送骑手信息坐标给美团
ScheduleTimerFuncByInterval(func() {
delivery.GetOrderRiderInfoToPlatform("", 0)
}, 10*time.Second, 4*time.Minute)
}, 10*time.Second, 5*time.Minute)
//每天晚上23:00更新抖店 审核状态
ScheduleTimerFunc("UpdateStorePoiStatus", func() {
@@ -206,7 +206,10 @@ func Init() {
ScheduleTimerFunc("UpdateTaoTotalMoney", func() {
orderman.UpdateTaoSettleInfo()
}, []string{
"18:10:00",
"18:30:00",
"06:30:00",
"00:30:00",
"12:30:00",
})
// 每分钟轮询一次,推送骑手信息