- PreCreateAct
This commit is contained in:
@@ -14,6 +14,54 @@ type ActController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// @Title 预创建活动
|
||||
// @Description 预创建活动
|
||||
// @Param token header string true "认证token"
|
||||
// @Param name formData string true "活动名,必须唯一(所以名子上最好带上日期)"
|
||||
// @Param type formData int true "活动类型,3:直降,4:秒杀(美团当前不支持秒杀)"
|
||||
// @Param vendorIDs formData string true "厂商ID,当前只支持,京东:0,京西(用于记录活动信息):99"
|
||||
// @Param beginAt formData string true "开始日期"
|
||||
// @Param endAt formData string true "结束日期"
|
||||
// @Param pricePercentage formData int true "活动价格比例"
|
||||
// @Param advertising formData string true "广告语"
|
||||
// @Param actStoreSkuList formData string true "活动门店商品信息"
|
||||
// @Param limitDaily formData int false "是否按日0-不限,>0限购单数(秒杀需填)"
|
||||
// @Param limitUser formData int false "是否用户限购0-不限,1-限购"
|
||||
// @Param limitCount formData int false "限购件数 0-不限,如账号限购、设备限购有一个为1,则限购件数必须大于0的整数"
|
||||
// @Param remark formData string false "备注"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /PreCreateAct [post]
|
||||
func (c *ActController) PreCreateAct() {
|
||||
c.callPreCreateAct(func(params *tActPreCreateActParams) (retVal interface{}, errCode string, err error) {
|
||||
var (
|
||||
vendorIDs []int
|
||||
actStoreSkuList []*act.ActStoreSkuParam
|
||||
)
|
||||
timeList, err := jxutils.BatchStr2Time(params.BeginAt, params.EndAt)
|
||||
if err == nil {
|
||||
if err = jxutils.Strings2Objs(params.VendorIDs, &vendorIDs, params.ActStoreSkuList, &actStoreSkuList); err == nil {
|
||||
actObj := &model.Act{
|
||||
Name: params.Name,
|
||||
Type: params.Type,
|
||||
LimitUser: params.LimitUser,
|
||||
LimitDaily: params.LimitDaily,
|
||||
LimitCount: params.LimitCount,
|
||||
// Source:,
|
||||
CreateType: model.ActCreateTypeAPI,
|
||||
PricePercentage: params.PricePercentage,
|
||||
BeginAt: timeList[0],
|
||||
EndAt: timeList[1],
|
||||
Advertising: params.Advertising,
|
||||
Remark: params.Remark,
|
||||
}
|
||||
retVal, err = act.PreCreateAct(params.Ctx, actObj, vendorIDs, nil, actStoreSkuList)
|
||||
}
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 创建活动
|
||||
// @Description 创建活动
|
||||
// @Param token header string true "认证token"
|
||||
|
||||
Reference in New Issue
Block a user