This commit is contained in:
suyl
2021-06-07 11:33:26 +08:00
parent bd72b79987
commit 9f37c3de71

View File

@@ -4,7 +4,7 @@ import (
"bytes"
"context"
"fmt"
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
"regexp"
"strings"
"time"
@@ -1925,57 +1925,35 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
// }
//}
var (
db = dao.GetDB()
goods []*model.GoodsOrder
db = dao.GetDB()
)
sql := `
SELECT * FROM goods_order WHERE IF(jx_store_id = 0, store_id, jx_store_id) IN (
100115,
100123,
100135,
100140,
100471,
101036,
101039,
101942,
102383,
102630,
102671,
102736,
102740,
102996,
103205,
103408,
666677,
667234,
667272,
667278,
667281,
667284,
667292,
667297,
667304,
667308,
667312,
667332,
667540,
668125,
668131,
668144,
668150,
668152,
668159,
668183,
668185
) AND order_created_at > '2021-05-29 17:00:00' AND order_created_at < '2021-05-31 14:20:00' AND status = 110
`
dao.GetRows(db, &goods, sql, nil)
for _, v := range goods {
skus, _ := dao.GetSimpleOrderSkus(db, v.VendorOrderID, nil)
for _, vv := range skus {
orderman.RefreshOrderSkuInfo(jxcontext.AdminCtx, v.VendorOrderID, v.VendorID, vv.SkuID)
}
}
courierStoreList, _ := dao.GetStoreCourierList(db, []int{800106}, []int{model.VendorIDMTPS}, model.StoreStatusAll, model.StoreAuditStatusAll)
task := tasksch.NewParallelTask("uuuuuu", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
courierStore := batchItemList[0].(*model.StoreCourierMap)
storeDetail, _ := dao.GetStoreDetail(db, courierStore.StoreID, model.VendorIDJX, "")
result, _ := api.MtpsAPI.GetStoreInfoByID(utils.Str2Int(courierStore.VendorStoreID))
name := fmt.Sprintf("%s-%s-%s", globals.StoreName, storeDetail.CityName, storeDetail.Name)
if result != nil {
if result.PoiName != name {
shopInfo := &mtpsapi.ShopInfo{
ShopID: utils.Int2Str(storeDetail.ID),
ShopName: name,
}
api.MtpsAPI.ShopUpdate(shopInfo)
}
if result.OpenType != courierStore.VendorStatus {
courierStore.VendorStatus = result.OpenType
dao.UpdateEntity(db, courierStore, "VendorStatus")
}
} else {
courierStore.VendorStatus = 0
dao.UpdateEntity(db, courierStore, "VendorStatus")
}
return retVal, err
}, courierStoreList)
tasksch.HandleTask(task, nil, true).Run()
task.GetID()
return err
}