客户建议发送内容修改
This commit is contained in:
@@ -224,6 +224,36 @@ func SendMsg2Somebody(ctx *jxcontext.Context, mobileNum, verifyCode, msgType, ms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
|
//获取门店信息
|
||||||
|
var (
|
||||||
|
stores []*model.Store
|
||||||
|
order *model.GoodsOrder
|
||||||
|
storeName string
|
||||||
|
storeID int
|
||||||
|
vendorOrderID string
|
||||||
|
)
|
||||||
|
sql := `
|
||||||
|
SELECT * FROM store WHERE tel1 = ? OR tel2 = ?
|
||||||
|
`
|
||||||
|
sqlParams := []interface{}{mobileNum}
|
||||||
|
err = dao.GetRows(db, &stores, sql, sqlParams)
|
||||||
|
if len(stores) > 0 {
|
||||||
|
storeName = stores[0].Name
|
||||||
|
storeID = stores[0].ID
|
||||||
|
}
|
||||||
|
sql2 := `
|
||||||
|
SELECT *
|
||||||
|
FROM goods_order
|
||||||
|
WHERE IF(store_id <> '', store_id, jx_store_id) = ?
|
||||||
|
ORDER BY order_created_at DESC
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
sqlParams2 := []interface{}{}
|
||||||
|
err = dao.GetRow(db, &order, sql2, sqlParams2)
|
||||||
|
if order != nil {
|
||||||
|
vendorOrderID = order.VendorOrderID
|
||||||
|
}
|
||||||
|
msgContent = msgContent + " 门店名称:" + storeName + " 门店ID:" + utils.Int2Str(storeID) + " 最新订单号:" + vendorOrderID
|
||||||
for _, v := range receiveMsgUsersMap[msgType] {
|
for _, v := range receiveMsgUsersMap[msgType] {
|
||||||
user, err2 := dao.GetUserByID(db, "name", v)
|
user, err2 := dao.GetUserByID(db, "name", v)
|
||||||
if err2 == nil {
|
if err2 == nil {
|
||||||
|
|||||||
@@ -1083,3 +1083,53 @@ func syncStoreSkusFromYb(ctx *jxcontext.Context, storeID, vendorID int, vendorSt
|
|||||||
hint = taskSeq.GetID()
|
hint = taskSeq.GetID()
|
||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, vendorStoreID string, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
|
var (
|
||||||
|
db = dao.GetDB()
|
||||||
|
)
|
||||||
|
_, hint, err = v.LoopStoresMap2(ctx, nil, db, fmt.Sprintf("同步京东商城库存商品信息:%v", storeIDs), isAsync, true, []int{model.VendorIDJDShop}, storeIDs, false,
|
||||||
|
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (interface{}, error) {
|
||||||
|
loopMapInfo := batchItemList[0].(*LoopStoreMapInfo)
|
||||||
|
if handler := v.GetStoreHandler(loopMapInfo.VendorID); handler != nil {
|
||||||
|
parallelCount := 5
|
||||||
|
if model.MultiStoresVendorMap[loopMapInfo.VendorID] == 1 {
|
||||||
|
parallelCount = 2
|
||||||
|
}
|
||||||
|
loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]),
|
||||||
|
tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||||
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
|
storeMap := batchItemList[0].(*model.StoreMap)
|
||||||
|
if storeMap.Status > model.StoreStatusDisabled && storeMap.StoreID != model.JdShopMainStoreID && storeMap.SyncRule != 0 {
|
||||||
|
err = syncJdsStoresSkus(ctx, db, storeMap)
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}, loopMapInfo.StoreMapList)
|
||||||
|
t.AddChild(loopStoreTask).Run()
|
||||||
|
_, err = loopStoreTask.GetResult(0)
|
||||||
|
}
|
||||||
|
return nil, partner.AddVendorInfo2Err(err, loopMapInfo.VendorID)
|
||||||
|
}, isContinueWhenError)
|
||||||
|
return hint, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, storeMap *model.StoreMap) (err error) {
|
||||||
|
var (
|
||||||
|
mainSkusMap = make(map[int]*model.StoreSkuBind)
|
||||||
|
)
|
||||||
|
storeSkusMain, err := dao.GetStoresSkusInfo(db, []int{model.JdShopMainStoreID}, nil)
|
||||||
|
for _, v := range storeSkusMain {
|
||||||
|
mainSkusMap[v.SkuID] = v
|
||||||
|
}
|
||||||
|
storeSkus, err := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, nil)
|
||||||
|
for _, v := range storeSkus {
|
||||||
|
if mainSkusMap[v.SkuID] != nil {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if storeMap.SyncRule == 1 {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -350,16 +350,16 @@ func syncStoreSku() {
|
|||||||
errList.AddErr(err)
|
errList.AddErr(err)
|
||||||
case 1:
|
case 1:
|
||||||
//TODO 暂时不同步银豹(可能要从银豹到京西),2020-04-27
|
//TODO 暂时不同步银豹(可能要从银豹到京西),2020-04-27
|
||||||
errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, []int{1, 3}))
|
errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, []int{1, 3, 5}))
|
||||||
|
|
||||||
// errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, partner.GetSingleStoreVendorIDs()))
|
// errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, partner.GetSingleStoreVendorIDs()))
|
||||||
_, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{1, 3}, nil, false, true, cms.AmendPruneAll, false)
|
_, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{1, 3, 5}, nil, false, true, cms.AmendPruneAll, false)
|
||||||
|
|
||||||
// _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, partner.GetSingleStoreVendorIDs(), nil, false, true, cms.AmendPruneAll, false)
|
// _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, partner.GetSingleStoreVendorIDs(), nil, false, true, cms.AmendPruneAll, false)
|
||||||
errList.AddErr(err)
|
errList.AddErr(err)
|
||||||
|
|
||||||
SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID)
|
SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID)
|
||||||
taskID, err2 := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{1, 3}, nil, false, nil, nil, syncFlag, true, true)
|
taskID, err2 := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{1, 3, 5}, nil, false, nil, nil, syncFlag, true, true)
|
||||||
// taskID, err2 := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, partner.GetSingleStoreVendorIDs(), nil, false, nil, nil, syncFlag, true, true)
|
// taskID, err2 := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, partner.GetSingleStoreVendorIDs(), nil, false, nil, nil, syncFlag, true, true)
|
||||||
|
|
||||||
errList.AddErr(err2)
|
errList.AddErr(err2)
|
||||||
@@ -401,6 +401,8 @@ func doDailyWork() {
|
|||||||
cms.CurVendorSync.SyncStoreSkusFromYb(jxcontext.AdminCtx, nil, true, true)
|
cms.CurVendorSync.SyncStoreSkusFromYb(jxcontext.AdminCtx, nil, true, true)
|
||||||
//刷新京东商城订单结算价
|
//刷新京东商城订单结算价
|
||||||
orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -3).Format("20060102"), time.Now().Format("20060102"))
|
orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -3).Format("20060102"), time.Now().Format("20060102"))
|
||||||
|
//同步京东商城门店库存和商品
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
|
|||||||
@@ -423,6 +423,7 @@ type StoreMap struct {
|
|||||||
|
|
||||||
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
|
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
|
||||||
IsSync int8 `orm:"default(1)" json:"isSync"` // 是否同步
|
IsSync int8 `orm:"default(1)" json:"isSync"` // 是否同步
|
||||||
|
SyncRule int8 `orm:"default(0)" json:"syncRule"` //目前用于京东商城晚上的同步规则,0表示关闭,1表示小同步,2表示大同步
|
||||||
FakeOpenStart int16 `orm:"default(0)" json:"fakeOpenStart"` // 假开店开始
|
FakeOpenStart int16 `orm:"default(0)" json:"fakeOpenStart"` // 假开店开始
|
||||||
FakeOpenStop int16 `orm:"default(0)" json:"fakeOpenStop"` // 假开店结束
|
FakeOpenStop int16 `orm:"default(0)" json:"fakeOpenStop"` // 假开店结束
|
||||||
JdStoreLevel string `orm:"size(32)" json:"jdStoreLevel"` //京东门店等级
|
JdStoreLevel string `orm:"size(32)" json:"jdStoreLevel"` //京东门店等级
|
||||||
|
|||||||
Reference in New Issue
Block a user