aa
This commit is contained in:
@@ -1840,78 +1840,58 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
|||||||
// tasksch.HandleTask(task, nil, true).Run()
|
// tasksch.HandleTask(task, nil, true).Run()
|
||||||
// task.GetID()
|
// task.GetID()
|
||||||
//删京东会员价
|
//删京东会员价
|
||||||
// var (
|
|
||||||
// db = dao.GetDB()
|
|
||||||
// vendorThingIDs []int64
|
|
||||||
// )
|
|
||||||
// storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406")
|
|
||||||
// things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"})
|
|
||||||
// thingIDmap := make(map[int64]string)
|
|
||||||
|
|
||||||
// for _, v := range things {
|
|
||||||
// if v.VendorThingID != "" {
|
|
||||||
// vendorThingIDs = append(vendorThingIDs, utils.Str2Int64(v.VendorThingID))
|
|
||||||
// thingIDmap[utils.Str2Int64(v.VendorThingID)] = utils.Int64ToStr(v.ThingID)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
|
||||||
// func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
|
||||||
// storeMap := batchItemList[0].(*model.StoreMap)
|
|
||||||
// FreeBatchInfo("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []int64) (result interface{}, successCount int, err error) {
|
|
||||||
// api := jd.GetAPI("320406")
|
|
||||||
// priceInfo, _ := api.GetStationInfoList(storeMap.VendorStoreID, batchedStoreSkuList)
|
|
||||||
// var list []*jdapi.SkuIdEntity
|
|
||||||
// for _, vv := range priceInfo {
|
|
||||||
// if vv.VipPrice != 0 {
|
|
||||||
// list = append(list, &jdapi.SkuIdEntity{
|
|
||||||
// OutSkuId: thingIDmap[vv.SkuID],
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if len(list) > 0 {
|
|
||||||
// err = api.DelVipPrice(utils.Int2Str(storeMap.StoreID), list)
|
|
||||||
// }
|
|
||||||
// return result, 0, err
|
|
||||||
// }, ctx, task, vendorThingIDs, 50, true)
|
|
||||||
// return retVal, err
|
|
||||||
// }, storeMaps)
|
|
||||||
// tasksch.HandleTask(task, nil, true).Run()
|
|
||||||
// _, err = task.GetResult(0)
|
|
||||||
//京东账号更新
|
|
||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
|
vendorThingIDs []int64
|
||||||
)
|
)
|
||||||
if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil {
|
storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406")
|
||||||
api.JdAPI.SetCookieWithStr(configs[0].Value)
|
things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"})
|
||||||
result, _ := api.JdAPI.GetJdAppInfo()
|
thingIDmap := make(map[int64]string)
|
||||||
if result != nil {
|
|
||||||
if vocs, _ := dao.GetVendorOrgCode(db, model.VendorIDJD, result.OrgCode, model.VendorOrgTypePlatform); len(vocs) > 0 {
|
for _, v := range things {
|
||||||
vocs[0].AppKey = result.AppKey
|
if v.VendorThingID != "" {
|
||||||
vocs[0].AppSecret = result.AppSecret
|
vendorThingIDs = append(vendorThingIDs, utils.Str2Int64(v.VendorThingID))
|
||||||
dao.UpdateEntity(db, vocs[0], "AppKey", "AppSecret")
|
thingIDmap[utils.Str2Int64(v.VendorThingID)] = utils.Int64ToStr(v.ThingID)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
|
||||||
|
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
|
storeMap := batchItemList[0].(*model.StoreMap)
|
||||||
|
FreeBatchInfo("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []int64) (result interface{}, successCount int, err error) {
|
||||||
|
api := jd.GetAPI("320406")
|
||||||
|
priceInfo, _ := api.GetStationInfoList(storeMap.VendorStoreID, batchedStoreSkuList)
|
||||||
|
var list []*jdapi.SkuIdEntity
|
||||||
|
for _, vv := range priceInfo {
|
||||||
|
if vv.VipPrice != 0 {
|
||||||
|
list = append(list, &jdapi.SkuIdEntity{
|
||||||
|
OutSkuId: thingIDmap[vv.SkuID],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(list) > 0 {
|
||||||
|
err = api.DelVipPrice(utils.Int2Str(storeMap.StoreID), list)
|
||||||
|
}
|
||||||
|
return result, 0, err
|
||||||
|
}, ctx, task, vendorThingIDs, 50, true)
|
||||||
|
return retVal, err
|
||||||
|
}, storeMaps)
|
||||||
|
tasksch.HandleTask(task, nil, true).Run()
|
||||||
|
_, err = task.GetResult(0)
|
||||||
|
//京东账号更新
|
||||||
// var (
|
// var (
|
||||||
// db = dao.GetDB()
|
// db = dao.GetDB()
|
||||||
// users []*model.User
|
|
||||||
// )
|
// )
|
||||||
// sql := `
|
// if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil {
|
||||||
// SELECT DISTINCT a.* FROM user a
|
// api.JdAPI.SetCookieWithStr(configs[0].Value)
|
||||||
// LEFT JOIN auth_bind b ON a.user_id2 = b.auth_id
|
// result, _ := api.JdAPI.GetJdAppInfo()
|
||||||
// WHERE name IN (
|
// if result != nil {
|
||||||
// SELECT name FROM user WHERE deleted_at = '1970-01-01 00:00:00' GROUP BY name HAVING COUNT(*) > 1 )
|
// if vocs, _ := dao.GetVendorOrgCode(db, model.VendorIDJD, result.OrgCode, model.VendorOrgTypePlatform); len(vocs) > 0 {
|
||||||
// AND a.mobile is null AND a.user_id <> b.user_id
|
// vocs[0].AppKey = result.AppKey
|
||||||
// ORDER BY a.name
|
// vocs[0].AppSecret = result.AppSecret
|
||||||
// `
|
// dao.UpdateEntity(db, vocs[0], "AppKey", "AppSecret")
|
||||||
// dao.GetRows(db, &users, sql, nil)
|
// }
|
||||||
// for _, v := range users {
|
|
||||||
// tokens, _ := api.Cacher.Keys(v.UserID)
|
|
||||||
// for _, vv := range tokens {
|
|
||||||
// api.Cacher.Del(vv)
|
|
||||||
// }
|
// }
|
||||||
// dao.DeleteEntity(db, v)
|
|
||||||
// }
|
// }
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user