京东商城把订单尝试

This commit is contained in:
苏尹岚
2020-05-26 18:30:45 +08:00
parent 19777d7443
commit 7e2bdec1fc

View File

@@ -8,6 +8,8 @@ import (
"strings" "strings"
"time" "time"
"git.rosy.net.cn/baseapi/platformapi/jdshopapi"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
"git.rosy.net.cn/jx-callback/business/partner/delivery" "git.rosy.net.cn/jx-callback/business/partner/delivery"
"github.com/360EntSecGroup-Skylar/excelize" "github.com/360EntSecGroup-Skylar/excelize"
@@ -1498,7 +1500,7 @@ func addSku(outSkuId string, cagtegoryId int, shopCategories []int64, brandId in
} }
func UploadJdsImage(ctx *jxcontext.Context) (err error) { func UploadJdsImage(ctx *jxcontext.Context) (err error) {
db := dao.GetDB() // db := dao.GetDB()
// result1, _ := api.JdShopAPI.GetProvince() // result1, _ := api.JdShopAPI.GetProvince()
// for _, v := range result1 { // for _, v := range result1 {
// place1, _ := dao.GetPlaceByName(db, v.AreaName, 1, 0) // place1, _ := dao.GetPlaceByName(db, v.AreaName, 1, 0)
@@ -1583,31 +1585,35 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
// } // }
// } // }
var stores []*model.Store // var stores []*model.Store
sql := ` // sql := `
SELECT a.* // SELECT a.*
FROM store a // FROM store a
LEFT JOIN store_map b ON a.id = b.store_id AND b.vendor_id = 5 AND b.deleted_at = '1970-01-01 00:00:00' // LEFT JOIN store_map b ON a.id = b.store_id AND b.vendor_id = 5 AND b.deleted_at = '1970-01-01 00:00:00'
WHERE 1=1 // WHERE 1=1
AND (a.status = 1 OR a.status = 0) // AND (a.status = 1 OR a.status = 0)
AND b.id IS NULL // AND b.id IS NULL
AND a.deleted_at = '1970-01-01 00:00:00' // AND a.deleted_at = '1970-01-01 00:00:00'
` // `
err = dao.GetRows(db, &stores, sql, nil) // err = dao.GetRows(db, &stores, sql, nil)
for _, v := range stores { // for _, v := range stores {
storeMap := &model.StoreMap{ // storeMap := &model.StoreMap{
Status: 1, // Status: 1,
VendorID: model.VendorIDJDShop, // VendorID: model.VendorIDJDShop,
AutoPickup: 1, // AutoPickup: 1,
DeliveryCompetition: 1, // DeliveryCompetition: 1,
PricePercentage: 100, // PricePercentage: 100,
IsSync: 1, // IsSync: 1,
SyncRule: 1, // SyncRule: 1,
} // }
_, err = cms.AddStoreVendorMap(ctx, db, model.VendorIDJDShop, "", v.ID, storeMap) // _, err = cms.AddStoreVendorMap(ctx, db, model.VendorIDJDShop, "", v.ID, storeMap)
if err != nil { // if err != nil {
continue // continue
} // }
} // }
_, err = api.JdShopAPI.AllOrders(&jdshopapi.AllOrdersParam{
Current: 1,
PageSize: 10,
})
return err return err
} }