aa
This commit is contained in:
@@ -291,15 +291,16 @@ func (c *JxOrderController) TestDefend() {
|
||||
// @Param token header string true "认证token"
|
||||
// @Param couponType query int false "优惠券类型,1为商品总额满减,2为运费优惠"
|
||||
// @Param couponStatuss query string false "优惠券状态,0为正常可使用,-1为已过期, -2为还没开始"
|
||||
// @Param storeIDs query string false "门店IDs"
|
||||
// @Param keyword query string false "关键字"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetCoupons [get]
|
||||
func (c *JxOrderController) GetCoupons() {
|
||||
c.callGetCoupons(func(params *tJxorderGetCouponsParams) (retVal interface{}, errCode string, err error) {
|
||||
var statuss []int
|
||||
if err = jxutils.Strings2Objs(params.CouponStatuss, &statuss); err == nil {
|
||||
retVal, err = localjx.GetCoupons(params.Ctx, params.CouponType, statuss, params.Keyword)
|
||||
var statuss, storeIDs []int
|
||||
if err = jxutils.Strings2Objs(params.CouponStatuss, &statuss, params.StoreIDs, &storeIDs); err == nil {
|
||||
retVal, err = localjx.GetCoupons(params.Ctx, params.CouponType, statuss, storeIDs, params.Keyword)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
@@ -309,15 +310,19 @@ func (c *JxOrderController) GetCoupons() {
|
||||
// @Description 添加优惠券
|
||||
// @Param token header string true "认证token"
|
||||
// @Param payload formData string true "优惠券类型 payload"
|
||||
// @Param count formData int true "优惠券数量,默认1"
|
||||
// @Param storeIDs formData string false "门店IDs"
|
||||
// @Param count formData int false "优惠券数量,默认1"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /AddCoupons [post]
|
||||
func (c *JxOrderController) AddCoupons() {
|
||||
c.callAddCoupons(func(params *tJxorderAddCouponsParams) (retVal interface{}, errCode string, err error) {
|
||||
coupons := &model.Coupons{}
|
||||
var storeIDs []int
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), coupons); err == nil {
|
||||
err = localjx.AddCoupons(params.Ctx, coupons, params.Count)
|
||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
|
||||
err = localjx.AddCoupons(params.Ctx, coupons, params.Count, storeIDs)
|
||||
}
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user