- 根据京东回调存储京东到家活动信息至本地
This commit is contained in:
@@ -19,6 +19,7 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
ActStatusNA = 0 // 未知
|
||||
ActStatusCreated = 1 // 需同步
|
||||
ActStatusCanceled = 2 // 需同步
|
||||
ActStatusEnded = 3 // 不需要同步,根据活动时间自动刷新的
|
||||
@@ -33,6 +34,13 @@ var (
|
||||
ActSkuDirectDown: "直降",
|
||||
ActSkuSecKill: "秒杀",
|
||||
}
|
||||
|
||||
ActStatusName = map[int]string{
|
||||
ActStatusNA: "未知",
|
||||
ActStatusCreated: "正常",
|
||||
ActStatusCanceled: "取消",
|
||||
ActStatusEnded: "结束",
|
||||
}
|
||||
)
|
||||
|
||||
type Act struct {
|
||||
@@ -75,6 +83,7 @@ type ActMap struct {
|
||||
func (*ActMap) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"ActID", "VendorID", "DeletedAt"},
|
||||
[]string{"VendorActID", "VendorID", "DeletedAt"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -189,11 +189,6 @@ var (
|
||||
AfsAppealTypeReturnAndRefund: "退货退款",
|
||||
AfsAppealTypeNewGoods: "重发商品",
|
||||
}
|
||||
ActStatusName = map[int]string{
|
||||
ActStatusCreated: "正常",
|
||||
ActStatusCanceled: "取消",
|
||||
ActStatusEnded: "结束",
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -83,6 +83,13 @@ type MissingStoreSkuInfo struct {
|
||||
RefPrice int
|
||||
}
|
||||
|
||||
type StoreSkuBindWithVendorInfo struct {
|
||||
model.StoreSkuBind
|
||||
|
||||
VendorStoreID string `orm:"column(vendor_store_id)"`
|
||||
VendorSkuID string `orm:"column(vendor_sku_id)"`
|
||||
}
|
||||
|
||||
// 单门店模式厂商适用
|
||||
// 从store_sku_bind中,得到所有依赖的商家分类信息
|
||||
func GetSkusCategories(db *DaoDB, vendorID, storeID int, skuIDs []int, level int) (cats []*SkuStoreCatInfo, err error) {
|
||||
@@ -393,6 +400,35 @@ func GetStoresSkusInfo(db *DaoDB, storeIDs, skuIDs []int) (storeSkuList []*model
|
||||
return storeSkuList, err
|
||||
}
|
||||
|
||||
// vendorID, vendorStoreIDs和vendorSkuIDs都是必须参数
|
||||
func GetStoresSkusInfoByVendorInfo(db *DaoDB, vendorID int, vendorStoreIDs, vendorSkuIDs []string) (storeSkuList []*StoreSkuBindWithVendorInfo, err error) {
|
||||
sql := `
|
||||
SELECT t1.*,
|
||||
%s.%s_id vendor_sku_id, t2.vendor_store_id
|
||||
FROM store_sku_bind t1
|
||||
JOIN store_map t2 ON t2.store_id = t1.store_id AND t2.vendor_id = ? AND t2.deleted_at = ?
|
||||
JOIN sku t3 ON t3.id = t1.sku_id
|
||||
WHERE t1.deleted_at = ? AND t2.vendor_store_id IN (` + GenQuestionMarks(len(vendorStoreIDs)) + `)
|
||||
AND %s.%s_id IN (` + GenQuestionMarks(len(vendorSkuIDs)) + `)`
|
||||
sqlParams := []interface{}{
|
||||
vendorID,
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
vendorStoreIDs,
|
||||
vendorSkuIDs,
|
||||
}
|
||||
|
||||
isSingleStorePF := model.MultiStoresVendorMap[vendorID] != 1
|
||||
tableName := "t1"
|
||||
if !isSingleStorePF {
|
||||
tableName = "t3"
|
||||
}
|
||||
fieldPrefix := ConvertDBFieldPrefix(model.VendorNames[vendorID])
|
||||
sql = fmt.Sprintf(sql, tableName, fieldPrefix, tableName, fieldPrefix)
|
||||
err = GetRows(db, &storeSkuList, sql, sqlParams...)
|
||||
return storeSkuList, err
|
||||
}
|
||||
|
||||
func GetMissingStoreSkuFromOrder(db *DaoDB, storeIDs []int, fromTime time.Time) (storeSkuList []*MissingStoreSkuInfo, err error) {
|
||||
if time.Now().Sub(fromTime) > 24*time.Hour*60 {
|
||||
return nil, fmt.Errorf("GetMissingStoreSkuFromOrder,时间超过60天")
|
||||
|
||||
Reference in New Issue
Block a user