Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop

This commit is contained in:
邹宗楠
2022-11-17 10:31:18 +08:00
3 changed files with 6 additions and 19 deletions

View File

@@ -6642,11 +6642,9 @@ func SyncTiktokMainIdToLocal(ctx *jxcontext.Context, param *tiktok_store.MainSku
func BatchSetRestockingPrice(ctx *jxcontext.Context, preData map[string][]mtwmapi.SpuData) error {
var params []*mtwmapi.SpuData
for k, v := range preData {
//获取京西平台storeID
if storeID, vendorOrgCode, err := dao.GetCodeAndIDByMeiTuan(k); err != nil {
if storeID, err := dao.GetCodeAndIDByMeiTuan(k); err != nil {
return errors.New(fmt.Sprintf("获取京西本地门店ID失败:%v 请重试", err))
} else {
globals.SugarLogger.Debugf("检查数据storeID=%d vendorOrgCode=%s", storeID, vendorOrgCode)
for _, i := range v {
param := &mtwmapi.SpuData{
AppSpuCode: i.AppSpuCode,
@@ -6655,9 +6653,6 @@ func BatchSetRestockingPrice(ctx *jxcontext.Context, preData map[string][]mtwmap
}
params = append(params, param)
}
if len(params) > 0 {
globals.SugarLogger.Debugf("params=========%s %s %s", params[0].AppSpuCode, params[0].PurchasePrice, params[0].SkuID)
}
if err := mtwm.BatchSetRestockingPrice(ctx, storeID, k, params); err != nil {
return err
}

View File

@@ -3,6 +3,7 @@ package dao
import (
"errors"
"fmt"
"git.rosy.net.cn/jx-callback/globals"
"sort"
"strings"
"time"
@@ -1632,7 +1633,8 @@ func InsertIntoFreightTemplate(storeID int, vendorStoreID string, templateID, wa
}
//只获取美团平台的京西storeID
func GetCodeAndIDByMeiTuan(vendorStoreID string) (storeID int, vendorOrgCode string, err error) {
err = GetRow(GetDB(), &storeID, "SELECT s.store_id,s.vendor_org_code FROM store_map s WHERE s.vendor_store_id = ? AND s.vendor_id = ? ", vendorStoreID, model.VendorIDMTWM)
return storeID, vendorStoreID, err
func GetCodeAndIDByMeiTuan(vendorStoreID string) (storeID int, err error) {
err = GetRow(GetDB(), &storeID, "SELECT s.store_id FROM store_map s WHERE s.vendor_store_id = ? AND s.vendor_id = ? ", vendorStoreID, model.VendorIDMTWM)
globals.SugarLogger.Debugf("GetCodeAndIDByMeiTuan storeID===========%d", storeID)
return storeID, err
}

View File

@@ -9,7 +9,6 @@ import (
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/business/partner/purchase/tiktok_store"
"git.rosy.net.cn/jx-callback/globals"
"github.com/astaxie/beego/server/web"
)
@@ -824,17 +823,8 @@ func (c *SkuController) SyncTiktokMainSkuToLocalSku() {
func (c *SkuController) BatchSetRestockingPrice() {
c.callBatchSetRestockingPrice(func(params *tSkuBatchSetRestockingPriceParams) (interface{}, string, error) {
payload := make(map[string][]mtwmapi.SpuData)
payload2 := make(map[string]interface{})
if err := utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
globals.SugarLogger.Debugf("payload============%v", payload)
err = cms.BatchSetRestockingPrice(params.Ctx, payload)
} else {
if err := utils.UnmarshalUseNumber([]byte(params.Payload), &payload2); err != nil {
return nil, "", err
} else {
globals.SugarLogger.Debugf("payload2============%v", payload2)
}
//return nil, "", err
}
return nil, "", nil
})