diff --git a/business/model/order.go b/business/model/order.go index 4aa756e16..1c7a3eb95 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -413,6 +413,8 @@ type Coupons struct { ModelIDCULD CouponType int `json:"couponType"` //优惠券类型 ,1为总额满减, 2为运费优惠, + Name string `json:"name"` //优惠券名字 + Desc string `json:"desc"` //优惠券详情描述 BeginAt time.Time `json:"beginAt"` //开始时间 EndAt time.Time `json:"endAt"` //到期时间 UpperLimit int `json:"upperLimit"` //满多少 diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 9e0823353..56dfa9112 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -2148,3 +2148,11 @@ func GetMyPriceDefendOrders(ctx *jxcontext.Context, fromTime, toTime string) (pr priceDefendOrders, err = dao.GetPriceDefendOrder(db, "", nil, nil, nil, 0, -1, -1, -1, userID, utils.Str2Time(fromTime), utils.Str2Time(toTime), true) return priceDefendOrders, err } + +func GetCoupons(ctx *jxcontext.Context, couponType int, keyword string) (coupons []*model.Coupons, err error) { + // var ( + // db = dao.GetDB() + // ) + // coupons, err = dao.GetCoupons(db, couponType, keyword) + return coupons, err +} diff --git a/controllers/jx_order2.go b/controllers/jx_order2.go index ffe35c94e..0a99ba116 100644 --- a/controllers/jx_order2.go +++ b/controllers/jx_order2.go @@ -284,3 +284,18 @@ func (c *JxOrderController) TestDefend() { return retVal, "", err }) } + +// @Title 查询优惠券 +// @Description 查询优惠券 +// @Param token header string true "认证token" +// @Param couponType query int false "优惠券类型,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) + return retVal, "", err + }) +}