合并请求

This commit is contained in:
qidongsheng
2020-06-29 09:27:12 +08:00
16 changed files with 973 additions and 825 deletions

View File

@@ -194,6 +194,7 @@ var (
"18328080405": "18328080405",
"17380734342": "17380734342",
"15208271238": "15208271238",
"18583684218": "18583684218",
}
)

View File

@@ -713,12 +713,14 @@ func buildSetFinishHook(task tasksch.ITask, ctx *jxcontext.Context) {
globals.SugarLogger.Debugf("同步错误发送钉钉消息失败, authinfo [%v] , [%v]", *authInfo, err)
}
} else {
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)
if len(task.GetFailedList()) > 1 {
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)
}
}
}
}
@@ -1235,9 +1237,12 @@ func SyncSkuExperfixAndWatermark(ctx *jxcontext.Context) (err error) {
for _, v := range skuIDs {
OnUpdateThing(ctx, db, nil, int64(v), model.ThingTypeSku)
}
CurVendorSync.SyncSkus(ctx, db, nil, skuIDs, true, true, ctx.GetUserName())
// CurVendorSync.SyncSkus(ctx, db, nil, skuIDs, true, true, ctx.GetUserName())
} else {
CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{skuExinfo.VendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true)
if len(skuIDs) > 0 {
SetStoreSkuSyncStatus2(db, nil, []int{skuExinfo.VendorID}, skuIDs, model.SyncFlagModifiedMask)
}
// CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{skuExinfo.VendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true)
}
return retVal, err
}, skuExinfos)

View File

@@ -390,10 +390,13 @@ func doDailyWork2() {
func doDailyWork() {
globals.SugarLogger.Debug("doDailyWork")
//同步商品额外前缀和水印图(打标记)
cms.SyncSkuExperfixAndWatermark(jxcontext.AdminCtx)
dao.SetStoresMapSyncStatus(dao.GetDB(), nil, nil, model.SyncFlagStoreStatus)
cms.CurVendorSync.SyncStore2(jxcontext.AdminCtx, dao.GetDB(), nil, nil, true, true)
// syncStoreSku()
syncStoreSku()
InitEx()
cms.SyncStoresCourierInfo(jxcontext.AdminCtx, nil, false, true)
netprinter.RebindAllPrinters(jxcontext.AdminCtx, false, true)
@@ -419,8 +422,6 @@ func doDailyWork() {
orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -3).Format("20060102"), time.Now().Format("20060102"))
//同步上架京东商城待售商品
cms.RefreshJdsSkusStatus(jxcontext.AdminCtx)
//同步商品额外前缀和水印图
cms.SyncSkuExperfixAndWatermark(jxcontext.AdminCtx)
}
func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {

View File

@@ -1560,28 +1560,29 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
// }
//京东商城街道name
// var stores []*model.Store
// sql := `
// SELECT b.*
// FROM store_map a, store b
// WHERE a.store_id = b.id
// AND a.vendor_store_id = '' AND a.vendor_id = 5 AND a.deleted_at = ?
// AND b.deleted_at = ?
// `
// sqlParams := []interface{}{utils.DefaultTimeValue, utils.DefaultTimeValue}
// err = dao.GetRows(db, &stores, sql, sqlParams)
// for _, v := range stores {
// result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat))
// if result["regeocode"] != nil {
// street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
// if street != "" {
// storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJDShop}, []int{v.ID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "")
// storeMap := storeMaps[0]
// storeMap.JdsStreetName = street
// dao.UpdateEntity(db, storeMap, "JdsStreetName")
// }
// }
// }
var stores []*model.Store
var db = dao.GetDB()
sql := `
SELECT b.*
FROM store_map a, store b
WHERE a.store_id = b.id
AND a.vendor_store_id = '' AND a.vendor_id = 5 AND a.deleted_at = ?
AND b.deleted_at = ?
`
sqlParams := []interface{}{utils.DefaultTimeValue, utils.DefaultTimeValue}
err = dao.GetRows(db, &stores, sql, sqlParams)
for _, v := range stores {
result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat))
if result["regeocode"] != nil {
street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
if street != "" {
storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJDShop}, []int{v.ID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "")
storeMap := storeMaps[0]
storeMap.JdsStreetName = street
dao.UpdateEntity(db, storeMap, "JdsStreetName")
}
}
}
// var stores []*model.Store
// sql := `