This commit is contained in:
邹宗楠
2023-07-14 16:01:20 +08:00
parent f27844567a
commit 0e1cd858d5
10 changed files with 245 additions and 64 deletions

View File

@@ -2030,27 +2030,27 @@ func RrefreshMtwmVendorAct(ctx *jxcontext.Context) (err error) {
if len(actList) > 0 {
for _, act := range actList {
if act.Status > 0 {
if checkActStoreSkuExist(db, storeMap.StoreID, utils.Str2Int(act.AppFoodCode), model.VendorIDMTWM, utils.Timestamp2Time(act.StartTime), utils.Timestamp2Time(act.EndTime)) {
actVendor := &model.ActMtwmVendor{
StoreID: storeMap.StoreID,
SkuID: utils.Str2Int(act.AppFoodCode),
VendorStoreID: storeMap.VendorStoreID,
ActType: v,
BeginAt: utils.Timestamp2Time(act.StartTime),
EndAt: utils.Timestamp2Time(act.EndTime),
SkuName: act.Name,
OriginPrice: act.OriginalPrice,
ActPrice: act.ActPrice,
DiscountCoefficient: act.DiscountCoefficient,
Status: act.Status,
ItemID: utils.Int64ToStr(act.ItemID),
OrderLimit: act.OrderLimit,
Period: act.Period,
WeeksTime: act.WeeksTime,
SettingType: act.SettingType,
}
dao.CreateEntity(db, actVendor)
//if checkActStoreSkuExist(db, storeMap.StoreID, utils.Str2Int(act.AppFoodCode), model.VendorIDMTWM, utils.Timestamp2Time(act.StartTime), utils.Timestamp2Time(act.EndTime)) {
actVendor := &model.ActMtwmVendor{
StoreID: storeMap.StoreID,
SkuID: utils.Str2Int(act.AppFoodCode),
VendorStoreID: storeMap.VendorStoreID,
ActType: v,
BeginAt: utils.Timestamp2Time(act.StartTime),
EndAt: utils.Timestamp2Time(act.EndTime),
SkuName: act.Name,
OriginPrice: act.OriginalPrice,
ActPrice: act.ActPrice,
DiscountCoefficient: act.DiscountCoefficient,
Status: act.Status,
ItemID: utils.Int64ToStr(act.ItemID),
OrderLimit: act.OrderLimit,
Period: act.Period,
WeeksTime: act.WeeksTime,
SettingType: act.SettingType,
}
dao.CreateEntity(db, actVendor)
//}
}
}
}
@@ -2161,10 +2161,30 @@ func RrefreshEbaiVendorAct(ctx *jxcontext.Context) (err error) {
return err
}
// GetActMtwmVendor 查询美团平台活动
func GetActMtwmVendor(ctx *jxcontext.Context, storeIDs, skuIDs []int, keyword, beginAt, endAt string, actType, offset, pageSize int) (page *model.PagedInfo, err error) {
return dao.GetActMtwmVendorPage(dao.GetDB(), storeIDs, skuIDs, keyword, utils.Str2Time(beginAt), utils.Str2Time(endAt), actType, offset, pageSize)
}
// GetStoreNotHaveSku 根据输入的商品id判断,那些门店没有参数该活动
func GetStoreNotHaveSku(skuId int, offSet, pageSize int) (interface{}, error) {
var (
db = dao.GetDB()
)
haveActSku, err := dao.GetActMtwmVendorPage(db, nil, []int{skuId}, "", time.Time{}, time.Time{}, 0, 0, 2000)
if err != nil {
return nil, err
}
// 拥有此商品的门店
storeIds := make([]int, 0, 0)
for _, v := range haveActSku.Data.([]*model.ActMtwmVendor) {
storeIds = append(storeIds, v.StoreID)
}
return dao.GetDontHaveSku(db, storeIds, offSet, pageSize)
}
func GetActMtwmVendorSku(ctx *jxcontext.Context, storeID int, keyword string, actType, offset, pageSize int) (page *model.PagedInfo, err error) {
return dao.GetActMtwmVendorSkuPage(dao.GetDB(), storeID, keyword, actType, offset, pageSize)
}