aa
This commit is contained in:
@@ -643,7 +643,13 @@ func CreateAct(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOr
|
|||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOrgCode string, actStoreSku []*ActStoreSkuParam) (err error) {
|
func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorID int, vendorOrgCode string, actStoreSku []*ActStoreSkuParam) (err error) {
|
||||||
|
if vendorID != model.VendorIDMTWM {
|
||||||
|
return fmt.Errorf("此接口只支持美团使用!")
|
||||||
|
}
|
||||||
|
if act.Type != model.ActSkuDirectDown {
|
||||||
|
return fmt.Errorf("此接口只支持创建直降!")
|
||||||
|
}
|
||||||
setActDefault(act)
|
setActDefault(act)
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
txDB, _ := dao.Begin(db)
|
txDB, _ := dao.Begin(db)
|
||||||
@@ -659,7 +665,18 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
|||||||
dao.Rollback(db, txDB)
|
dao.Rollback(db, txDB)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
actMap := &model.ActMap{
|
||||||
|
ActID: act.ID,
|
||||||
|
VendorID: vendorID,
|
||||||
|
VendorOrgCode: vendorOrgCode,
|
||||||
|
}
|
||||||
|
dao.WrapAddIDCULDEntity(actMap, ctx.GetUserName())
|
||||||
|
err = dao.CreateEntityTx(txDB, actMap)
|
||||||
|
if err != nil {
|
||||||
|
dao.Rollback(db, txDB)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dao.Commit(db, txDB)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func (s *StoreManager) OnStoreStatusChanged(vendorStoreID string, vendorID int,
|
|||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, vendorStoreID, vendorID, "")
|
storeDetail, err := dao.GetStoreDetailByVendorStoreID(db, vendorStoreID, vendorID, "")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if storeDetail.IsSync == model.NO || storeDetail.Status == model.StoreStatusDisabled {
|
if storeDetail.IsSync == model.NO || storeDetail.Status == model.StoreStatusDisabled || storeDetail.Status == model.StoreStatusHaveRest {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var storeKV, storeMapKV map[string]interface{}
|
var storeKV, storeMapKV map[string]interface{}
|
||||||
|
|||||||
@@ -126,9 +126,9 @@ func (c *ActController) CreateAct() {
|
|||||||
// @Description 美团按顺序创建活动
|
// @Description 美团按顺序创建活动
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param name formData string true "活动名,必须唯一(所以名子上最好带上日期)"
|
// @Param name formData string true "活动名,必须唯一(所以名子上最好带上日期)"
|
||||||
// @Param type formData int true "活动类型,3:直降,4:秒杀(美团当前不支持秒杀),5:折扣(京西)"
|
// @Param type formData int true "活动类型,3:直降"
|
||||||
// @Param vendorIDs formData string true "厂商ID,当前只支持,京东:0,京西(用于记录活动信息):99"
|
// @Param vendorID formData int true "厂商ID,当前只支持,美团"
|
||||||
// @Param vendorOrgCode formData string false "厂商内组织代码"
|
// @Param vendorOrgCode formData string true "厂商内组织代码"
|
||||||
// @Param beginAt formData string true "开始日期"
|
// @Param beginAt formData string true "开始日期"
|
||||||
// @Param endAt formData string true "结束日期"
|
// @Param endAt formData string true "结束日期"
|
||||||
// @Param pricePercentage formData int true "活动价格比例"
|
// @Param pricePercentage formData int true "活动价格比例"
|
||||||
@@ -140,12 +140,11 @@ func (c *ActController) CreateAct() {
|
|||||||
func (c *ActController) CreateActForMtByOrder() {
|
func (c *ActController) CreateActForMtByOrder() {
|
||||||
c.callCreateActForMtByOrder(func(params *tActCreateActForMtByOrderParams) (retVal interface{}, errCode string, err error) {
|
c.callCreateActForMtByOrder(func(params *tActCreateActForMtByOrderParams) (retVal interface{}, errCode string, err error) {
|
||||||
var (
|
var (
|
||||||
vendorIDs []int
|
|
||||||
actStoreSkuList []*act.ActStoreSkuParam
|
actStoreSkuList []*act.ActStoreSkuParam
|
||||||
)
|
)
|
||||||
timeList, err := jxutils.BatchStr2Time(params.BeginAt, params.EndAt)
|
timeList, err := jxutils.BatchStr2Time(params.BeginAt, params.EndAt)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDs, params.ActStoreSkuList, &actStoreSkuList); err == nil {
|
if err = jxutils.Strings2Objs(params.ActStoreSkuList, &actStoreSkuList); err == nil {
|
||||||
actObj := &model.Act{
|
actObj := &model.Act{
|
||||||
Name: params.Name,
|
Name: params.Name,
|
||||||
Type: params.Type,
|
Type: params.Type,
|
||||||
@@ -156,7 +155,7 @@ func (c *ActController) CreateActForMtByOrder() {
|
|||||||
Advertising: params.Advertising,
|
Advertising: params.Advertising,
|
||||||
}
|
}
|
||||||
//retVal, err = act.CreateAct(params.Ctx, actObj, vendorIDs, params.VendorOrgCode, nil, actStoreSkuList, params.IsAsync)
|
//retVal, err = act.CreateAct(params.Ctx, actObj, vendorIDs, params.VendorOrgCode, nil, actStoreSkuList, params.IsAsync)
|
||||||
err = act.CreateActForMtByOrder(params.Ctx, actObj, vendorIDs, params.VendorOrgCode, actStoreSkuList)
|
err = act.CreateActForMtByOrder(params.Ctx, actObj, params.VendorID, params.VendorOrgCode, actStoreSkuList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
|
|||||||
Reference in New Issue
Block a user