操作日志查询增加错误,关键字,同步错误返回显示平台名

This commit is contained in:
苏尹岚
2020-02-03 11:49:14 +08:00
parent daabd0ed3f
commit 4439135bbd
14 changed files with 108 additions and 67 deletions

View File

@@ -26,7 +26,7 @@ type SyncErrResult struct {
SkuID int `json:"商品ID"`
CategoryName string `json:"分类名"`
StoreID int `json:"门店ID"`
VendorID int `json:"平台ID"`
VendorName string `json:"平台"`
VendorSkuID string `json:"平台商品ID"`
NameID int `json:"商品nameID"`
VendorPrice int64 `json:"平台价"`
@@ -77,7 +77,7 @@ var (
"商品ID",
"分类名",
"门店ID",
"平台ID",
"平台",
"平台商品ID",
"商品nameID",
"平台价",
@@ -243,7 +243,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
_, err = dao.UpdateEntity(db2, storeMap, model.FieldSyncStatus)
resultList = append(resultList, 1)
} else {
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, storeMap.VendorID, "同步门店")
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "同步门店")
}
return resultList, err
}, loopMapInfo.StoreMapList)
@@ -255,7 +255,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
} else {
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, storeMap.VendorID, "同步门店")
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "同步门店")
}
if err == nil {
resultList = []interface{}{1}
@@ -646,6 +646,9 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, parentTask tasksch.I
func buildSetFinishHook(task tasksch.ITask, ctx *jxcontext.Context) {
task.SetFinishHook(func(task tasksch.ITask) {
if len(task.GetFailedList()) == 0 {
return
}
var noticeMsg = "您此次的同步任务错误详情返回如下: \n"
if ctx.GetUserName() != "jxadmin" {
if len(task.GetFailedList()) > 10 {
@@ -660,11 +663,13 @@ func buildSetFinishHook(task tasksch.ITask, ctx *jxcontext.Context) {
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, authInfo.UserID, "同步错误返回", noticeMsg)
}
} else {
downloadURL, _, _ := WirteToExcelBySyncFailed(task)
user, err := dao.GetUserByID(dao.GetDB(), "mobile", "18160030913")
noticeMsg += fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL)
if user != nil && err == nil {
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "同步错误返回", noticeMsg)
if time.Now().Hour() >= 20 && time.Now().Hour() < 7 {
downloadURL, _, _ := WirteToExcelBySyncFailed(task)
user, err := dao.GetUserByID(dao.GetDB(), "mobile", "18160030913")
noticeMsg += fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL)
if user != nil && err == nil {
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, user.UserID, "同步错误返回", noticeMsg)
}
}
}
})
@@ -683,7 +688,7 @@ func buildErrMsgJson(task tasksch.ITask) (resultL []*SyncErrResult) {
SkuID: 0,
StoreID: vv.StoreID,
CategoryName: vv.CategoryName,
VendorID: vv.VendoreID,
VendorName: vv.VendoreName,
VendorSkuID: "",
NameID: 0,
VendorPrice: 0,