aa
This commit is contained in:
@@ -982,6 +982,20 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act
|
||||
return 0, err
|
||||
}
|
||||
|
||||
//if len(actMap) == 0 {
|
||||
//
|
||||
// return 0, fmt.Errorf("活动%d不存在或已被取消", actID)
|
||||
//}
|
||||
//errList := errlist.New()
|
||||
//for vendorID, act := range actMap {
|
||||
// if vendorID == model.VendorIDEBAI && act.CreateType != model.ActCreateTypeAPI {
|
||||
// errList.AddErr(fmt.Errorf("饿百平台不支持修改或取消网页活动"))
|
||||
// }
|
||||
//}
|
||||
//if errList.GetErrListAsOne() != nil {
|
||||
// return 0, errList.GetErrListAsOne()
|
||||
//}
|
||||
|
||||
actStoreSkuMap, err := dao.GetActStoreSkuVendorInfo(db, actID, nil, nil, nil)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@@ -2095,3 +2109,7 @@ func GetActMtwmVendor(ctx *jxcontext.Context, storeIDs, skuIDs []int, keyword, b
|
||||
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)
|
||||
}
|
||||
|
||||
func DeleteActStoreSkuVendor(ctx *jxcontext.Context, db *dao.DaoDB, actStoreSkuParam []*ActStoreSkuParam) (err error) {
|
||||
return fmt.Errorf("暂不支持直接取消平台活动,开发中……")
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package act
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/testinit"
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
|
||||
@@ -67,50 +64,50 @@ func TestCreateActOnAlpha(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateActOnDev(t *testing.T) {
|
||||
actStoreSkuList := []*ActStoreSkuParam{
|
||||
&ActStoreSkuParam{
|
||||
ActStoreSku: model.ActStoreSku{
|
||||
StoreID: 100884,
|
||||
SkuID: 22716,
|
||||
},
|
||||
},
|
||||
&ActStoreSkuParam{
|
||||
ActStoreSku: model.ActStoreSku{
|
||||
StoreID: 100884,
|
||||
SkuID: 22717,
|
||||
},
|
||||
},
|
||||
&ActStoreSkuParam{
|
||||
ActStoreSku: model.ActStoreSku{
|
||||
StoreID: 100920,
|
||||
SkuID: 22714,
|
||||
},
|
||||
},
|
||||
&ActStoreSkuParam{
|
||||
ActStoreSku: model.ActStoreSku{
|
||||
StoreID: 100920,
|
||||
SkuID: 22715,
|
||||
},
|
||||
},
|
||||
// &ActStoreSkuParam{
|
||||
// ActStoreSku: model.ActStoreSku{
|
||||
// StoreID: 100119,
|
||||
// SkuID: 26595,
|
||||
// },
|
||||
// },
|
||||
}
|
||||
//actStoreSkuList := []*ActStoreSkuParam{
|
||||
// &ActStoreSkuParam{
|
||||
// ActStoreSku: model.ActStoreSku{
|
||||
// StoreID: 100884,
|
||||
// SkuID: 22716,
|
||||
// },
|
||||
// },
|
||||
// &ActStoreSkuParam{
|
||||
// ActStoreSku: model.ActStoreSku{
|
||||
// StoreID: 100884,
|
||||
// SkuID: 22717,
|
||||
// },
|
||||
// },
|
||||
// &ActStoreSkuParam{
|
||||
// ActStoreSku: model.ActStoreSku{
|
||||
// StoreID: 100920,
|
||||
// SkuID: 22714,
|
||||
// },
|
||||
// },
|
||||
// &ActStoreSkuParam{
|
||||
// ActStoreSku: model.ActStoreSku{
|
||||
// StoreID: 100920,
|
||||
// SkuID: 22715,
|
||||
// },
|
||||
// },
|
||||
// // &ActStoreSkuParam{
|
||||
// // ActStoreSku: model.ActStoreSku{
|
||||
// // StoreID: 100119,
|
||||
// // SkuID: 26595,
|
||||
// // },
|
||||
// // },
|
||||
//}
|
||||
// t.Log(utils.Format4Output(actStoreSkuList, true))
|
||||
actID, err := CreateAct(jxcontext.AdminCtx, &model.Act{
|
||||
Name: "测试活动",
|
||||
PricePercentage: 80,
|
||||
Type: model.ActSkuDirectDown,
|
||||
BeginAt: time.Now().Add(-24 * time.Hour),
|
||||
EndAt: time.Now().Add(10 * 24 * time.Hour),
|
||||
}, []int{model.VendorIDJD, model.VendorIDMTWM /*, model.VendorIDEBAI*/}, nil, actStoreSkuList, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
globals.SugarLogger.Debug(actID)
|
||||
//actID, err := CreateAct(jxcontext.AdminCtx, &model.Act{
|
||||
// Name: "测试活动",
|
||||
// PricePercentage: 80,
|
||||
// Type: model.ActSkuDirectDown,
|
||||
// BeginAt: time.Now().Add(-24 * time.Hour),
|
||||
// EndAt: time.Now().Add(10 * 24 * time.Hour),
|
||||
//}, []int{model.VendorIDJD, model.VendorIDMTWM /*, model.VendorIDEBAI*/}, nil, actStoreSkuList, false)
|
||||
//if err != nil {
|
||||
// t.Fatal(err)
|
||||
//}
|
||||
//globals.SugarLogger.Debug(actID)
|
||||
}
|
||||
|
||||
func TestCancelAct(t *testing.T) {
|
||||
@@ -192,18 +189,18 @@ func TestSyncAct(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestForceUpdateVendorPrice(t *testing.T) {
|
||||
hint, err := ForceUpdateVendorPrice(jxcontext.AdminCtx, model.VendorIDJD, model.ActSkuDirectDown, []*ActStoreSkuParam{
|
||||
&ActStoreSkuParam{
|
||||
ActStoreSku: model.ActStoreSku{
|
||||
StoreID: 100118,
|
||||
SkuID: 22509,
|
||||
ActPrice: 9900,
|
||||
},
|
||||
VendorPrice: 19900,
|
||||
},
|
||||
}, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(hint)
|
||||
//hint, err := ForceUpdateVendorPrice(jxcontext.AdminCtx, model.VendorIDJD, model.ActSkuDirectDown, []*ActStoreSkuParam{
|
||||
// &ActStoreSkuParam{
|
||||
// ActStoreSku: model.ActStoreSku{
|
||||
// StoreID: 100118,
|
||||
// SkuID: 22509,
|
||||
// ActPrice: 9900,
|
||||
// },
|
||||
// VendorPrice: 19900,
|
||||
// },
|
||||
//}, false)
|
||||
//if err != nil {
|
||||
// t.Fatal(err)
|
||||
//}
|
||||
//t.Log(hint)
|
||||
}
|
||||
|
||||
@@ -246,6 +246,9 @@ func (c *PurchaseHandler) RefundOrder(ctx *jxcontext.Context, order *model.Goods
|
||||
// 发起部分退款
|
||||
func (c *PurchaseHandler) PartRefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, refundSkuList []*model.OrderSku, reason string) (err error) {
|
||||
if globals.EnableEbaiStoreWrite {
|
||||
if order.Status > model.OrderStatusEndBegin {
|
||||
return fmt.Errorf("饿百暂不支持售后退款!")
|
||||
}
|
||||
err = api.EbaiAPI.OrderPartRefund(order.VendorOrderID, orderSkus2AfsSkus(refundSkuList))
|
||||
}
|
||||
return err
|
||||
|
||||
@@ -288,8 +288,13 @@ func (c *ActController) UpdateActStoreSkuBind() {
|
||||
}
|
||||
}
|
||||
if len(actStoreSkuDeleteList) > 0 {
|
||||
if _, err = act.DeleteActStoreSkuBind(params.Ctx, db, params.ActID, actStoreSkuDeleteList); err != nil {
|
||||
return
|
||||
//可能是平台直接创建的活动,尝试直接取消一下
|
||||
if params.ActID < 1000 {
|
||||
act.DeleteActStoreSkuVendor(params.Ctx, db, actStoreSkuDeleteList)
|
||||
} else {
|
||||
if _, err = act.DeleteActStoreSkuBind(params.Ctx, db, params.ActID, actStoreSkuDeleteList); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user