DeleteSkusFromAct添加可选参数types
This commit is contained in:
@@ -890,16 +890,15 @@ func RefreshPageActs(ctx *jxcontext.Context, vendorIDs []int, createdFrom time.T
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func DeleteSkusFromAct(ctx *jxcontext.Context, vendorID int, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
func DeleteSkusFromAct(ctx *jxcontext.Context, vendorID int, actTypes, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
db := dao.GetDB()
|
||||
actMap := make(map[int]*model.Act)
|
||||
for _, skuID := range skuIDs {
|
||||
pagedInfo, err2 := dao.QueryActs(db, 0, 0, -1, -1, "", vendorID, []int{model.ActStatusCreated}, []int{model.ActSkuDirectDown, model.ActSkuSecKill}, nil, 0, skuID, 0,
|
||||
pagedInfo, err2 := dao.QueryActs(db, 0, 0, -1, -1, "", vendorID, []int{model.ActStatusCreated}, actTypes, nil, 0, skuID, 0,
|
||||
utils.DefaultTimeValue, utils.DefaultTimeValue, time.Now().Add(-24*30*3*time.Hour), utils.DefaultTimeValue)
|
||||
if err = err2; err != nil {
|
||||
return "", err
|
||||
}
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(pagedInfo, false))
|
||||
for _, v := range pagedInfo.Data {
|
||||
actMap[v.Act.ID] = &v.Act
|
||||
}
|
||||
|
||||
@@ -287,6 +287,7 @@ func (c *ActController) RefreshPageActs() {
|
||||
// @Param token header string true "认证token"
|
||||
// @Param skuIDs query string true "skuID列表"
|
||||
// @Param vendorID query int true "厂商ID"
|
||||
// @Param types query string false "活动类型列表"
|
||||
// @Param isAsync query bool false "是否异步"
|
||||
// @Param isContinueWhenError query bool false "单个同步失败是否继续,缺省false"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
@@ -295,8 +296,9 @@ func (c *ActController) RefreshPageActs() {
|
||||
func (c *ActController) DeleteSkusFromAct() {
|
||||
c.callDeleteSkusFromAct(func(params *tActDeleteSkusFromActParams) (retVal interface{}, errCode string, err error) {
|
||||
var skuIDs []int
|
||||
if err = jxutils.Strings2Objs(params.SkuIDs, &skuIDs); err == nil {
|
||||
retVal, err = act.DeleteSkusFromAct(params.Ctx, params.VendorID, skuIDs, params.IsAsync, params.IsContinueWhenError)
|
||||
var types []int
|
||||
if err = jxutils.Strings2Objs(params.SkuIDs, &skuIDs, params.Types, &types); err == nil {
|
||||
retVal, err = act.DeleteSkusFromAct(params.Ctx, params.VendorID, types, skuIDs, params.IsAsync, params.IsContinueWhenError)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user