- 活动同步标志从int改回为int8,所有同步标志都是int8

This commit is contained in:
gazebo
2019-07-17 11:28:56 +08:00
parent 75d3411125
commit 6bb543f544
6 changed files with 19 additions and 16 deletions

View File

@@ -604,7 +604,7 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act
isDeleteAtLeastOne = true
}
if isDeleteAll || isDeleteAtLeastOne {
syncStatus := model.SyncFlagModifiedMask
syncStatus := int8(model.SyncFlagModifiedMask)
if isDeleteAll {
syncStatus = model.SyncFlagDeletedMask
}

View File

@@ -81,7 +81,7 @@ type ActMap struct {
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorActID string `orm:"column(vendor_act_id);size(48)" json:"vendorActID"`
SyncStatus int `orm:"default(2)" json:"syncStatus"`
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
Remark string `orm:"size(1024)" json:"remark"`
}
@@ -106,7 +106,7 @@ type Act2 struct {
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorActID string `orm:"column(vendor_act_id);size(48)" json:"vendorActID"`
SyncStatus int `orm:"default(2)" json:"syncStatus"`
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
}
func (a *Act2) GetRealActName() string {
@@ -157,7 +157,7 @@ type ActStoreSkuMap struct {
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorActID string `orm:"column(vendor_act_id);size(48)" json:"vendorActID"`
SyncStatus int `orm:"default(2)" json:"syncStatus"`
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
VendorPrice int64 `json:"vendorPrice"` // 创建活动时的平台价格
ActualActPrice int64 `orm:"" json:"actualActPrice"` // 单品级活动用,创建活动时商品的活动价格
}
@@ -182,7 +182,7 @@ type ActStoreSku2 struct {
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorActID string `orm:"column(vendor_act_id);size(48)" json:"vendorActID"`
SyncStatus int `orm:"default(2)" json:"syncStatus"`
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
ActualActPrice int64 `orm:"" json:"actualActPrice"` // 单品级活动用,创建活动时商品的活动价格
VendorStoreID string `orm:"column(vendor_store_id)" json:"vendorStoreID"`

View File

@@ -94,7 +94,10 @@ type StoreSkuBindWithVendorInfo struct {
// 从store_sku_bind中得到所有依赖的商家分类信息
func GetSkusCategories(db *DaoDB, vendorID, storeID int, skuIDs []int, level int) (cats []*SkuStoreCatInfo, err error) {
sql := `
SELECT DISTINCT t4.*, t5.id map_id, t5.%s_id vendor_cat_id, t5.%s_sync_status store_cat_sync_status, t4p.name parent_cat_name, t5p.id parent_map_id, t5p.%s_id parent_vendor_cat_id, t5p.%s_sync_status parent_cat_sync_status
SELECT DISTINCT t4.*,
t5.id map_id, t5.%s_id vendor_cat_id, t5.%s_sync_status store_cat_sync_status,
t4p.name parent_cat_name,
t5p.id parent_map_id, t5p.%s_id parent_vendor_cat_id, t5p.%s_sync_status parent_cat_sync_status
FROM store_sku_bind t1
JOIN sku t2 ON t1.sku_id = t2.id AND t2.deleted_at = ? AND t2.status = ?
JOIN sku_name t3 ON t2.name_id = t3.id AND t3.deleted_at = ? AND t3.status = ?

View File

@@ -83,27 +83,27 @@ const (
SyncFlagStoreAddress = 16
)
func IsSyncStatusNew(syncStatus int) bool {
func IsSyncStatusNew(syncStatus int8) bool {
return (syncStatus & SyncFlagNewMask) != 0
}
func IsSyncStatusDelete(syncStatus int) bool {
func IsSyncStatusDelete(syncStatus int8) bool {
return (syncStatus & SyncFlagDeletedMask) != 0
}
func IsSyncStatusUpdate(syncStatus int) bool {
func IsSyncStatusUpdate(syncStatus int8) bool {
return (syncStatus & SyncFlagModifiedMask) != 0
}
func IsSyncStatusNeedCreate(syncStatus int) bool {
func IsSyncStatusNeedCreate(syncStatus int8) bool {
return IsSyncStatusNew(syncStatus) && !IsSyncStatusDelete(syncStatus)
}
func IsSyncStatusNeedDelete(syncStatus int) bool {
func IsSyncStatusNeedDelete(syncStatus int8) bool {
return !IsSyncStatusNew(syncStatus) && IsSyncStatusDelete(syncStatus)
}
func IsSyncStatusNeedUpdate(syncStatus int) bool {
func IsSyncStatusNeedUpdate(syncStatus int8) bool {
return !IsSyncStatusNew(syncStatus) && !IsSyncStatusDelete(syncStatus) && IsSyncStatusUpdate(syncStatus)
}

View File

@@ -163,7 +163,7 @@ func AdjustPromotionSku(promotionType int, infoId int64, outInfoId string, skus
return skusResult, err
}
func storeSku2Jd(actStoreSku []*model.ActStoreSku2, handler func(syncStatus int) bool) (jdActStoreSku []*jdapi.PromotionSku) {
func storeSku2Jd(actStoreSku []*model.ActStoreSku2, handler func(syncStatus int8) bool) (jdActStoreSku []*jdapi.PromotionSku) {
for _, v := range actStoreSku {
if handler(v.SyncStatus) {
if v.VendorStoreID != "" && v.VendorSkuID != "" {

View File

@@ -23,7 +23,7 @@ func actOrderRules2Mtwm(actOrderRules []*model.ActOrderRule) (actDetails []*mtwm
return actDetails
}
func storeSku2ActData(act *model.Act2, actStoreSku []*model.ActStoreSku2, handler func(int) bool) (actData []*mtwmapi.RetailDiscountActData) {
func storeSku2ActData(act *model.Act2, actStoreSku []*model.ActStoreSku2, handler func(int8) bool) (actData []*mtwmapi.RetailDiscountActData) {
orderLimit := 1
if act.LimitCount > 0 {
orderLimit = act.LimitCount
@@ -54,7 +54,7 @@ func storeSku2ActData(act *model.Act2, actStoreSku []*model.ActStoreSku2, handle
return actData
}
func storeSku2ActData4Delete(actStoreSku []*model.ActStoreSku2, handler func(int) bool) (actIDList []string) {
func storeSku2ActData4Delete(actStoreSku []*model.ActStoreSku2, handler func(int8) bool) (actIDList []string) {
for _, v := range actStoreSku {
if handler == nil || handler(v.SyncStatus) {
if v.VendorActID != "" {
@@ -65,7 +65,7 @@ func storeSku2ActData4Delete(actStoreSku []*model.ActStoreSku2, handler func(int
return actIDList
}
func isCreateOrUpdate(syncStatus int) bool {
func isCreateOrUpdate(syncStatus int8) bool {
return model.IsSyncStatusNeedCreate(syncStatus) || model.IsSyncStatusNeedUpdate(syncStatus)
}