This commit is contained in:
苏尹岚
2021-03-10 17:49:08 +08:00
parent acacc3b2de
commit 2364d4eae2
2 changed files with 25 additions and 11 deletions

View File

@@ -512,7 +512,7 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
}
}
// retVal = []*GetStoreManageStateResult{result}
// getStoreManageStateResult = append(getStoreManageStateResult, result)
getStoreManageStateResult = append(getStoreManageStateResult, result)
// return retVal, err
// }, storeIDsPage)
// tasksch.HandleTask(task, nil, true).Run()

View File

@@ -4,10 +4,13 @@ import (
"bytes"
"context"
"fmt"
"math"
"regexp"
"strings"
"time"
"git.rosy.net.cn/jx-callback/business/jxstore/report"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
"git.rosy.net.cn/jx-callback/business/partner/delivery"
"github.com/360EntSecGroup-Skylar/excelize"
@@ -1865,18 +1868,29 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
// }, storeMaps)
// tasksch.HandleTask(task, nil, true).Run()
// _, err = task.GetResult(0)
stores := []int{}
for i := 1; i < 26; i++ {
result, _ := api.JdShop2API.ShopList(i)
for _, v := range result.List {
if v.Kilometres == "" {
if err = api.JdShop2API.CreateGisFence(v.StoreID, "1"); err != nil {
stores = append(stores, v.StoreID)
var (
storeMaps []*model.StoreMap
db = dao.GetDB()
)
storeMaps, err = dao.GetStoresMapList(db, nil, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "")
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)
if storeMap.CoverArea == 0 {
handler := partner.GetPurchasePlatformFromVendorID(storeMap.VendorID)
if store, err := handler.ReadStore(ctx, storeMap.VendorOrgCode, storeMap.VendorStoreID); err == nil {
if storeMap.VendorID == model.VendorIDJD && store.DeliveryRangeType != model.DeliveryRangeTypePolygon {
storeMap.CoverArea = math.Pi * utils.Str2Float64WithDefault(store.DeliveryRange, 0) * utils.Str2Float64WithDefault(store.DeliveryRange, 0) / float64(10000)
} else {
storeMap.CoverArea = report.CalculateCoverArea(strings.Split(store.DeliveryRange, ";"), storeMap.VendorID)
}
dao.UpdateEntity(db, storeMap, "CoverArea")
}
}
}
}
fmt.Println("resultstores112", stores)
return retVal, err
}, storeMaps)
tasksch.HandleTask(task, nil, true).Run()
_, err = task.GetResult(0)
return err
}