Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
@@ -1486,7 +1486,6 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
|
|||||||
userName := ctx.GetUserName()
|
userName := ctx.GetUserName()
|
||||||
storeMap.StoreID = storeID
|
storeMap.StoreID = storeID
|
||||||
storeMap.VendorID = vendorID
|
storeMap.VendorID = vendorID
|
||||||
globals.SugarLogger.Debugf("vendorID1111111111111111===============%d", vendorID)
|
|
||||||
storeMap.VendorOrgCode = vendorOrgCode
|
storeMap.VendorOrgCode = vendorOrgCode
|
||||||
storeMap.Status = model.StoreStatusOpened
|
storeMap.Status = model.StoreStatusOpened
|
||||||
storeMap.DeliveryType = model.StoreDeliveryTypeByStore
|
storeMap.DeliveryType = model.StoreDeliveryTypeByStore
|
||||||
|
|||||||
@@ -1724,7 +1724,6 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
flag, _ := doStoreSkuAudit(ctx, storeIDs, skuBindInfos)
|
flag, _ := doStoreSkuAudit(ctx, storeIDs, skuBindInfos)
|
||||||
globals.SugarLogger.Debugf("===================flag %v", flag)
|
|
||||||
if !flag {
|
if !flag {
|
||||||
var num int64
|
var num int64
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
@@ -1734,7 +1733,6 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku
|
|||||||
}
|
}
|
||||||
isAsync = asyncStoreSkuOpFilter(ctx, isAsync)
|
isAsync = asyncStoreSkuOpFilter(ctx, isAsync)
|
||||||
num = int64(len(skuIDs))
|
num = int64(len(skuIDs))
|
||||||
globals.SugarLogger.Debugf("===================num %d", num)
|
|
||||||
if num > 0 {
|
if num > 0 {
|
||||||
hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, causeFlag, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError)
|
hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, causeFlag, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError)
|
||||||
}
|
}
|
||||||
@@ -6619,14 +6617,22 @@ func SyncTiktokMainIdToLocal(ctx *jxcontext.Context, param *tiktok_store.MainSku
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
db := dao.GetDB()
|
||||||
for _, code := range codes {
|
for _, code := range codes {
|
||||||
result, err := tiktok_store.QueryAllMainSkuList(code.VendorOrgCode, param)
|
result, err := tiktok_store.QueryAllMainSkuList(code.VendorOrgCode, param)
|
||||||
globals.SugarLogger.Debugf("=====%s", utils.Format4Output(result, false))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return OnCreateThing2Tiktok(ctx, dao.GetDB(), code.VendorOrgCode, result, model.ThingTypeSku, model.SyncFlagNewMask, false)
|
|
||||||
|
// 删除当前时间段数据
|
||||||
|
jxutils.CallMsgHandlerAsync(func() {
|
||||||
|
if err := DeleteThingByData(ctx, db, code.VendorOrgCode, utils.Timestamp2Time(param.StartTime), utils.Timestamp2Time(param.EndTime)); err != nil {
|
||||||
|
globals.SugarLogger.Error("删除需要同步的数据 := %s", err.Error())
|
||||||
|
}
|
||||||
|
if err := OnCreateThing2Tiktok(ctx, db, code.VendorOrgCode, result, model.ThingTypeSku, model.SyncFlagNewMask, false); err != nil {
|
||||||
|
globals.SugarLogger.Error("初始他抖音平台主订单已经子订单id信息错误:= %s", err.Error())
|
||||||
|
}
|
||||||
|
}, "")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,7 +309,6 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
|
|||||||
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "删除门店")
|
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "删除门店")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
globals.SugarLogger.Debugf("进入UpdateStore,storeMap.StoreID====%d, userName=========%s", storeMap.StoreID, userName)
|
|
||||||
if err = handler.UpdateStore(db, storeMap.StoreID, userName); err == nil {
|
if err = handler.UpdateStore(db, storeMap.StoreID, userName); err == nil {
|
||||||
resultList = append(resultList, 1)
|
resultList = append(resultList, 1)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -399,6 +399,12 @@ func onUpdateThing(ctx *jxcontext.Context, db *dao.DaoDB, vendorInfoList []*mode
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DeleteThingByData(ctx *jxcontext.Context, db *dao.DaoDB, appOrgCode string, startTime time.Time, endTime time.Time) error {
|
||||||
|
sql := ` DELETE FROM thing_map WHERE vendor_org_code = ? AND created_at >= ? AND created_at < ? `
|
||||||
|
_, err := dao.ExecuteSQL(db, sql, []interface{}{appOrgCode, startTime, endTime})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func OnUpdateThing(ctx *jxcontext.Context, db *dao.DaoDB, vendorInfoList []*model.VendorOrgCode, thingID int64, thingType int8) (err error) {
|
func OnUpdateThing(ctx *jxcontext.Context, db *dao.DaoDB, vendorInfoList []*model.VendorOrgCode, thingID int64, thingType int8) (err error) {
|
||||||
return onUpdateThing(ctx, db, vendorInfoList, thingID, thingType, model.SyncFlagModifiedMask)
|
return onUpdateThing(ctx, db, vendorInfoList, thingID, thingType, model.SyncFlagModifiedMask)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -699,7 +699,6 @@ func ScheduleTimerFunc(name string, handler func(), timeList []string) {
|
|||||||
nextTime := jxutils.GetNextTimeFromList(now, timeList)
|
nextTime := jxutils.GetNextTimeFromList(now, timeList)
|
||||||
duration := nextTime.Sub(now) + 1*time.Second
|
duration := nextTime.Sub(now) + 1*time.Second
|
||||||
utils.AfterFuncWithRecover(duration, func() {
|
utils.AfterFuncWithRecover(duration, func() {
|
||||||
globals.SugarLogger.Debugf("循环时间序列=====%s", duration)
|
|
||||||
handler()
|
handler()
|
||||||
ScheduleTimerFunc(name, handler, timeList)
|
ScheduleTimerFunc(name, handler, timeList)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -687,6 +687,8 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo
|
|||||||
sql = fmt.Sprintf(sql, fmtParams...)
|
sql = fmt.Sprintf(sql, fmtParams...)
|
||||||
sql += " ORDER BY t1.price"
|
sql += " ORDER BY t1.price"
|
||||||
|
|
||||||
|
globals.SugarLogger.Debugf("=======sql := %s", sql)
|
||||||
|
globals.SugarLogger.Debugf("=====param := %s", utils.Format4Output(sqlParams, false))
|
||||||
if err = GetRows(db, &skus, sql, sqlParams...); err != nil {
|
if err = GetRows(db, &skus, sql, sqlParams...); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (c *PurchaseHandler) OnOrderMsg(a *jdapi.API, msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
|
func (c *PurchaseHandler) OnOrderMsg(a *jdapi.API, msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
|
||||||
globals.SugarLogger.Debug("===================京东订单 := %s", utils.Format4Output(msg, false))
|
|
||||||
primaryID := msg.BillID
|
primaryID := msg.BillID
|
||||||
primaryID += utils.Int64ToStr(time.Now().Unix())
|
primaryID += utils.Int64ToStr(time.Now().Unix())
|
||||||
jxutils.CallMsgHandler(func() {
|
jxutils.CallMsgHandler(func() {
|
||||||
@@ -204,10 +203,8 @@ func (c *PurchaseHandler) getOrder(a *jdapi.API, orderID string) (order *model.G
|
|||||||
switch taskIndex {
|
switch taskIndex {
|
||||||
case 0:
|
case 0:
|
||||||
orderMap, err = a.QuerySingleOrder(orderID)
|
orderMap, err = a.QuerySingleOrder(orderID)
|
||||||
globals.SugarLogger.Debugf("===========================new order order Mao%s", utils.Format4Output(orderMap, false))
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
order = c.Map2Order(orderMap)
|
order = c.Map2Order(orderMap)
|
||||||
globals.SugarLogger.Debugf("===========================new really order Mao%s", utils.Format4Output(order, false))
|
|
||||||
if configs, err := dao.QueryConfigs(dao.GetDB(), "jdStorePageCookie", model.ConfigTypeCookie, ""); err == nil {
|
if configs, err := dao.QueryConfigs(dao.GetDB(), "jdStorePageCookie", model.ConfigTypeCookie, ""); err == nil {
|
||||||
//a.SetJdCookie(configs[0].Value)
|
//a.SetJdCookie(configs[0].Value)
|
||||||
a.SetCookieWithStr(configs[0].Value)
|
a.SetCookieWithStr(configs[0].Value)
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ func (p *PurchaseHandler) getStatusFromVendorStatus(vendorStatus int64) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *model.GoodsOrder) {
|
func (c *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *model.GoodsOrder) {
|
||||||
globals.SugarLogger.Debugf("Map2Order=====:%s", utils.Format4Output(orderData, false))
|
|
||||||
order, _, _ = c.getOrder(orderData["VendorOrgCode"].(string), orderData["vendorOrderID"].(string), "")
|
order, _, _ = c.getOrder(orderData["VendorOrgCode"].(string), orderData["vendorOrderID"].(string), "")
|
||||||
return order
|
return order
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -460,7 +460,6 @@ func CreateFreightTemplate(storeCode int) (int64, error) {
|
|||||||
param.Columns = nil
|
param.Columns = nil
|
||||||
param.Template.TemplateName += "固定运费模板"
|
param.Template.TemplateName += "固定运费模板"
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("param.Template.TemplateName===============%s", param.Template.TemplateName)
|
|
||||||
resp, err := getAPI(storeDetail.VendorOrgCode, storeCode, storeDetail.VendorStoreID).FreightTemplateCreate(param)
|
resp, err := getAPI(storeDetail.VendorOrgCode, storeCode, storeDetail.VendorStoreID).FreightTemplateCreate(param)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
@@ -507,10 +506,8 @@ func UpdateFreightTemplate(storeCode int) error {
|
|||||||
param.Columns = nil
|
param.Columns = nil
|
||||||
param.Template.TemplateName += "固定运费模板"
|
param.Template.TemplateName += "固定运费模板"
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("param.Template.TemplateName=============%s", param.Template.TemplateName)
|
|
||||||
_, err = getAPI(storeDetail.VendorOrgCode, storeCode, storeDetail.VendorStoreID).FreightTemplateUpdate(param)
|
_, err = getAPI(storeDetail.VendorOrgCode, storeCode, storeDetail.VendorStoreID).FreightTemplateUpdate(param)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
globals.SugarLogger.Debugf("err==================%v", err)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -530,9 +530,13 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
{InfoType: "weight", InfoUnit: localSku.SpecUnit, InfoValue: fmt.Sprintf("%f", localSku.SpecQuality)},
|
{InfoType: "weight", InfoUnit: localSku.SpecUnit, InfoValue: fmt.Sprintf("%f", localSku.SpecQuality)},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
sku.StockNum = localSku.Stock
|
stock := 0
|
||||||
|
if localSku.Stock == 0 {
|
||||||
|
stock = 9999
|
||||||
|
}
|
||||||
|
sku.StockNum = stock
|
||||||
sku.SkuType = 1
|
sku.SkuType = 1
|
||||||
sku.StockNumMap = map[string]int64{storeId: int64(localSku.Stock)}
|
sku.StockNumMap = map[string]int64{storeId: int64(stock)}
|
||||||
skuSize = append(skuSize, sku)
|
skuSize = append(skuSize, sku)
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
@@ -552,9 +556,13 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
{InfoType: "weight", InfoUnit: localSku.SpecUnit, InfoValue: fmt.Sprintf("%f", localSku.SpecQuality)},
|
{InfoType: "weight", InfoUnit: localSku.SpecUnit, InfoValue: fmt.Sprintf("%f", localSku.SpecQuality)},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
sku.StockNum = localSku.Stock
|
stock := 0
|
||||||
|
if localSku.Stock == 0 {
|
||||||
|
stock = 9999
|
||||||
|
}
|
||||||
|
sku.StockNum = stock
|
||||||
sku.SkuType = 1
|
sku.SkuType = 1
|
||||||
sku.StockNumMap = map[string]int64{storeId: int64(localSku.Stock)}
|
sku.StockNumMap = map[string]int64{storeId: int64(stock)}
|
||||||
skuSize = append(skuSize, sku)
|
skuSize = append(skuSize, sku)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -578,10 +586,14 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
{InfoType: "weight", InfoUnit: localSku.SpecUnit, InfoValue: fmt.Sprintf("%f", localSku.SpecQuality)},
|
{InfoType: "weight", InfoUnit: localSku.SpecUnit, InfoValue: fmt.Sprintf("%f", localSku.SpecQuality)},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
sku.StockNum = localSku.Stock
|
stock := 0
|
||||||
|
if localSku.Stock == 0 {
|
||||||
|
stock = 9999
|
||||||
|
}
|
||||||
|
sku.StockNum = stock
|
||||||
sku.StockNum = 0
|
sku.StockNum = 0
|
||||||
sku.SkuType = 1
|
sku.SkuType = 1
|
||||||
sku.StockNumMap = map[string]int64{storeId: int64(localSku.Stock)}
|
sku.StockNumMap = map[string]int64{storeId: int64(stock)}
|
||||||
skuSize = append(skuSize, sku)
|
skuSize = append(skuSize, sku)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,12 +95,10 @@ func BindStoreWarehouse(VendorOrgCode, outWarehouseID string, storeIDs int64) er
|
|||||||
|
|
||||||
// /warehouse/getWarehouseByStore 门店id获取绑定仓库详情包括电子围栏
|
// /warehouse/getWarehouseByStore 门店id获取绑定仓库详情包括电子围栏
|
||||||
func GetWarehouseByStore(appOrgCode string, storeID int64) (map[int64][]warehouse_getWarehouseByStore_response.WarehouseInfoMapItem, error) {
|
func GetWarehouseByStore(appOrgCode string, storeID int64) (map[int64][]warehouse_getWarehouseByStore_response.WarehouseInfoMapItem, error) {
|
||||||
globals.SugarLogger.Debugf("appOrgCode====%s,storeID=====%d", appOrgCode, storeID)
|
|
||||||
info, err := getAPI(appOrgCode, 0, "").GetWarehouseByStore(storeID)
|
info, err := getAPI(appOrgCode, 0, "").GetWarehouseByStore(storeID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("err===================== %v", err)
|
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/tiktok_store"
|
"git.rosy.net.cn/jx-callback/business/partner/purchase/tiktok_store"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
"github.com/astaxie/beego/server/web"
|
"github.com/astaxie/beego/server/web"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -22,7 +21,6 @@ func (t *TiktokController) CallbackTiktokOrderMsg() {
|
|||||||
t.ServeJSON()
|
t.ServeJSON()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("订单消息-------------------%s", string(byteList))
|
|
||||||
if strings.Contains(string(byteList), "\"msg_id\":\"0\"") {
|
if strings.Contains(string(byteList), "\"msg_id\":\"0\"") {
|
||||||
t.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackSuccessCode, Msg: tiktok_api.CallbackSuccess}
|
t.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackSuccessCode, Msg: tiktok_api.CallbackSuccess}
|
||||||
t.ServeJSON()
|
t.ServeJSON()
|
||||||
|
|||||||
Reference in New Issue
Block a user