aa
This commit is contained in:
@@ -3,6 +3,7 @@ package controllers
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/jx/localjx"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
@@ -287,15 +288,37 @@ func (c *JxOrderController) TestDefend() {
|
||||
|
||||
// @Title 查询优惠券
|
||||
// @Description 查询优惠券
|
||||
// @Param token header string true "认证token"
|
||||
// @Param couponType query int false "优惠券类型,1为商品总额满减,2为运费优惠"
|
||||
// @Param keyword query string false "关键字"
|
||||
// @Param token header string true "认证token"
|
||||
// @Param couponType query int false "优惠券类型,1为商品总额满减,2为运费优惠"
|
||||
// @Param couponStatuss query string false "优惠券状态,0为正常可使用,-1为已过期, -2为还没开始"
|
||||
// @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) {
|
||||
retVal, err = localjx.GetCoupons(params.Ctx, params.CouponType, params.Keyword)
|
||||
var statuss []int
|
||||
if err = jxutils.Strings2Objs(params.CouponStatuss, &statuss); err == nil {
|
||||
retVal, err = localjx.GetCoupons(params.Ctx, params.CouponType, statuss, params.Keyword)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
// @Title 添加优惠券
|
||||
// @Description 添加优惠券
|
||||
// @Param token header string true "认证token"
|
||||
// @Param payload formData string true "优惠券类型 payload"
|
||||
// @Param count formData int true "优惠券数量,默认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{}
|
||||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), coupons); err == nil {
|
||||
err = localjx.AddCoupons(params.Ctx, coupons, params.Count)
|
||||
}
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user