Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -1478,6 +1478,11 @@ func GetStoreVendorMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, vend
|
||||
if vendorID != -1 {
|
||||
cond[model.FieldVendorID] = vendorID
|
||||
}
|
||||
if vendorID == model.VendorIDDD {
|
||||
if err1 := dao.GetEntitiesByKV(db, &storeMaps, cond, false); err1 == nil && len(storeMaps) > 0 {
|
||||
_ = tiktok_store.GetRemoteStoreSth(storeMaps[0].VendorOrgCode, storeMaps[0].VendorStoreID, storeID)
|
||||
}
|
||||
}
|
||||
return storeMaps, dao.GetEntitiesByKV(db, &storeMaps, cond, false)
|
||||
}
|
||||
|
||||
|
||||
@@ -1013,6 +1013,87 @@ func (p *PurchaseHandler) GetSkus(ctx *jxcontext.Context, vendorOrgCode string,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
type RemoteSth struct {
|
||||
YbAppID string `json:"ybAppID"` //自动运力设置 open/close
|
||||
YbStorePrefix string `json:"ybStorePrefix"` //限售模板即起送价
|
||||
DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` //在vendorID=14,存储满 x 包邮金额
|
||||
DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //在vendorID=14,存储打包费
|
||||
}
|
||||
|
||||
//获取抖音线上 自动运力设置,满减包邮金额,起送价(限售),打包费
|
||||
func GetRemoteStoreSth(vendorOrgCode, vendorStoreID string, storeID int) *RemoteSth {
|
||||
remoteSth := &RemoteSth{}
|
||||
a := getAPI(vendorOrgCode, 0, "")
|
||||
//获取自动运力设置
|
||||
autoInfo, err := a.GetStoreAutoCallRiderInfo(utils.Str2Int64(vendorStoreID))
|
||||
if err == nil {
|
||||
if autoInfo.ServiceStatus == tiktok_api.ServiceStatusOpen {
|
||||
remoteSth.YbAppID = tiktok_api.AutoCallRiderOpen
|
||||
} else {
|
||||
remoteSth.YbAppID = tiktok_api.AutoCallRiderClose
|
||||
}
|
||||
}
|
||||
//获取门店限售模板即起送价
|
||||
saleLimit, err := a.StoreQuerySaleLimitTemp(utils.Str2Int64(vendorStoreID))
|
||||
if err != nil {
|
||||
remoteSth.YbStorePrefix = "0"
|
||||
} else {
|
||||
saleDetail, err := a.GetSaleLimitDetail(&[]int64{saleLimit})
|
||||
if err != nil {
|
||||
remoteSth.YbStorePrefix = "0"
|
||||
} else {
|
||||
if len(saleDetail.TradeLimitTemplateList) > 0 && len(saleDetail.TradeLimitTemplateList[0].TradeLimitRuleList) > 0 {
|
||||
if saleDetail.TradeLimitTemplateList[0].TradeLimitRuleList[0].TradeLimitModel == tiktok_api.TradeLimitModelMoney {
|
||||
remoteSth.YbStorePrefix = utils.Int64ToStr(saleDetail.TradeLimitTemplateList[0].TradeLimitRuleList[0].TradeLimitPattern.Minimum)
|
||||
}
|
||||
} else {
|
||||
remoteSth.YbStorePrefix = "0"
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取满减包邮金额
|
||||
freightIDs, err := a.GetStoreFreight(utils.Str2Int64(vendorStoreID))
|
||||
if err != nil || len(freightIDs) == 0 || freightIDs[0] == 0 {
|
||||
remoteSth.DeliveryFeeDeductionSill = 0
|
||||
} else {
|
||||
freightDetail, err := a.GetStoreFreightDetail(freightIDs[0])
|
||||
if err == nil && len(freightDetail.Columns) > 0 {
|
||||
remoteSth.DeliveryFeeDeductionSill = int(freightDetail.Columns[0].OverAmount)
|
||||
} else {
|
||||
remoteSth.DeliveryFeeDeductionSill = 0
|
||||
}
|
||||
}
|
||||
//获取打包费
|
||||
packageFee, err := a.GetStorePackageFee(utils.Str2Int64(vendorStoreID))
|
||||
if err != nil {
|
||||
remoteSth.DeliveryFeeDeductionFee = 0
|
||||
} else {
|
||||
remoteSth.DeliveryFeeDeductionFee = int(packageFee)
|
||||
}
|
||||
//更新本地数据库
|
||||
/* remoteSth = &RemoteSth{
|
||||
DeliveryFeeDeductionFee: 9999,
|
||||
DeliveryFeeDeductionSill: 9999,
|
||||
YbStorePrefix: "test111",
|
||||
YbAppID: "test111",
|
||||
}*/
|
||||
var storeMaps []*model.StoreMap
|
||||
cond := map[string]interface{}{
|
||||
model.FieldStoreID: storeID,
|
||||
model.FieldVendorID: model.VendorIDDD,
|
||||
}
|
||||
if err1 := dao.GetEntitiesByKV(dao.GetDB(), &storeMaps, cond, false); err1 == nil {
|
||||
storeMaps[0].YbAppID = remoteSth.YbAppID
|
||||
storeMaps[0].YbStorePrefix = remoteSth.YbStorePrefix
|
||||
storeMaps[0].DeliveryFeeDeductionSill = remoteSth.DeliveryFeeDeductionSill
|
||||
storeMaps[0].DeliveryFeeDeductionFee = remoteSth.DeliveryFeeDeductionFee
|
||||
if _, err2 := dao.UpdateEntity(dao.GetDB(), storeMaps[0]); err2 != nil {
|
||||
globals.SugarLogger.Debug(err2)
|
||||
}
|
||||
}
|
||||
return remoteSth
|
||||
}
|
||||
|
||||
//以下为辅助函数
|
||||
|
||||
type RelInfo struct {
|
||||
|
||||
Reference in New Issue
Block a user