1
This commit is contained in:
@@ -9,8 +9,8 @@ import (
|
||||
const (
|
||||
ActTypeAll = -1
|
||||
ActSkuFake = 0 // 假活动,只用于存储活动结算信息
|
||||
ActSkuDirectDown = 3 // 直降
|
||||
ActSkuSecKill = 4 // 秒杀
|
||||
ActSkuDirectDown = 3 // 直降(折扣)
|
||||
ActSkuSecKill = 4 // 秒杀(爆品)
|
||||
ActSkuDiscount = 5 // 折扣
|
||||
|
||||
ActDiscountTypePrice = 1 //折扣类型是最低价
|
||||
@@ -262,24 +262,24 @@ func (*StoreSkuAct) TableUnique() [][]string {
|
||||
|
||||
type ActMtwmVendor struct {
|
||||
ModelIDCULD
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"`
|
||||
SkuID int `orm:"column(sku_id);index" json:"skuID"`
|
||||
VendorStoreID string `orm:"column(vendor_store_id)" json:"vendorStoreID"`
|
||||
BeginAt time.Time `json:"beginAt"` //活动时间
|
||||
EndAt time.Time `json:"endAt"`
|
||||
ActType int `json:"actType"` //活动类型 (折扣,秒杀)
|
||||
SkuName string `json:"skuName"` //商品名
|
||||
OriginPrice float64 `json:"originPrice"`
|
||||
ActPrice float64 `json:"actPrice"`
|
||||
DiscountCoefficient float64 `json:"discountCoefficient"` //折扣系数
|
||||
Status int `json:"status"` //活动当前的状态,参考值:0-已过期;1-已生效;2-待生效
|
||||
ItemID string `orm:"column(item_id)" json:"itemID"`
|
||||
OrderLimit int `json:"orderLimit"` //每单限购
|
||||
DayLimit int `json:"dayLimit"` //当日活动库存
|
||||
Period string `json:"period"` //生效时段
|
||||
WeeksTime string `json:"weeksTime"` //生效活动周期
|
||||
SettingType int `json:"settingType"` //活动开展类型,参考值:0-按折扣系数开展活动;1-按折扣价格开展活动。
|
||||
StoreName string `orm:"-" json:"storeName"`
|
||||
StoreID int `orm:"column(store_id)" json:"storeID"` // 门店id
|
||||
SkuID int `orm:"column(sku_id);index" json:"skuID"` // 商品id
|
||||
VendorStoreID string `orm:"column(vendor_store_id)" json:"vendorStoreID"` // 平台门店id
|
||||
BeginAt time.Time `json:"beginAt"` //活动时间
|
||||
EndAt time.Time `json:"endAt"` //结束时间
|
||||
ActType int `json:"actType"` //活动类型 (4 折扣,3秒杀)
|
||||
SkuName string `json:"skuName"` //商品名
|
||||
OriginPrice float64 `json:"originPrice"` //商品原价,单位元。
|
||||
ActPrice float64 `json:"actPrice"` //活动价
|
||||
DiscountCoefficient float64 `json:"discountCoefficient"` //折扣系数
|
||||
Status int `json:"status"` //活动当前的状态,参考值:0-已过期;1-已生效;2-待生效
|
||||
ItemID string `orm:"column(item_id)" json:"itemID"` //活动id
|
||||
OrderLimit int `json:"orderLimit"` //每单限购
|
||||
DayLimit int `json:"dayLimit"` //当日活动库存
|
||||
Period string `json:"period"` //生效时段
|
||||
WeeksTime string `json:"weeksTime"` //生效活动周期
|
||||
SettingType int `json:"settingType"` //活动开展类型,参考值:0-按折扣系数开展活动;1-按折扣价格开展活动。
|
||||
StoreName string `orm:"-" json:"storeName"` // 门店名称
|
||||
}
|
||||
|
||||
func (*ActMtwmVendor) TableIndex() [][]string {
|
||||
|
||||
@@ -708,7 +708,7 @@ func GetActMtwmVendorPage(db *DaoDB, storeIDs, skuIDs []int, keyword string, beg
|
||||
acts []*model.ActMtwmVendor
|
||||
)
|
||||
sql := `
|
||||
SELECT SQL_CALC_FOUND_ROWS a.store_id, a.vendor_store_id, b.name store_name, a.act_type
|
||||
SELECT SQL_CALC_FOUND_ROWS b.name store_name ,a.*
|
||||
FROM act_mtwm_vendor a
|
||||
LEFT JOIN store b ON a.store_id = b.id
|
||||
`
|
||||
@@ -741,7 +741,7 @@ func GetActMtwmVendorPage(db *DaoDB, storeIDs, skuIDs []int, keyword string, beg
|
||||
GROUP BY 1, 2, 3, 4
|
||||
LIMIT ? OFFSET ?
|
||||
`
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
sqlParams = append(sqlParams, pageSize, (offset-1)*pageSize)
|
||||
txDB, _ := Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -757,6 +757,33 @@ func GetActMtwmVendorPage(db *DaoDB, storeIDs, skuIDs []int, keyword string, beg
|
||||
return page, err
|
||||
}
|
||||
|
||||
// GetDontHaveSku 获取不存在此商品活动的门店
|
||||
func GetDontHaveSku(db *DaoDB, storeIds []int, offSet, pageSize int) (interface{}, error) {
|
||||
var parma []interface{}
|
||||
sql := `
|
||||
SELECT a.store_id,b.name store_name FROM act_mtwm_vendor a
|
||||
LEFT JOIN store b ON a.store_id = b.id
|
||||
WHERE 1=1
|
||||
`
|
||||
type SkuAct struct {
|
||||
StoreId int `json:"store_id"`
|
||||
StoreName string `json:"store_name"`
|
||||
}
|
||||
|
||||
if len(storeIds) != 0 {
|
||||
sql += "AND a.store_id NOT IN (" + GenQuestionMarks(len(storeIds)) + ")"
|
||||
parma = append(parma, storeIds)
|
||||
}
|
||||
|
||||
sql += ` GROUP BY a.store_id LIMIT ? OFFSET ? `
|
||||
parma = append(parma, pageSize, (offSet-1)*pageSize)
|
||||
var result []*SkuAct
|
||||
if err := GetRows(db, &result, sql, parma); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func GetActMtwmVendorSkuPage(db *DaoDB, storeID int, keyword string, actType, offset, pageSize int) (page *model.PagedInfo, err error) {
|
||||
var (
|
||||
acts []*model.ActMtwmVendor
|
||||
@@ -777,7 +804,7 @@ func GetActMtwmVendorSkuPage(db *DaoDB, storeID int, keyword string, actType, of
|
||||
sql += `
|
||||
LIMIT ? OFFSET ?
|
||||
`
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
sqlParams = append(sqlParams, (offset-1)*pageSize, pageSize)
|
||||
txDB, _ := Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
|
||||
Reference in New Issue
Block a user