1、新增优惠券详情接口;

This commit is contained in:
chenlin 2024-12-06 11:23:00 +08:00
parent a11bd9a91d
commit e942715617
6 changed files with 160 additions and 0 deletions

View File

@ -111,6 +111,41 @@ func ErpMarketingCouponEdit(c *gin.Context) {
return return
} }
// ErpMarketingCouponDetail 优惠券详情
// @Summary 优惠券详情
// @Tags 营销管理V1.4.4
// @Produce json
// @Accept json
// @Param request body models.ErpMarketingCouponDetailReq true "优惠券详情模型"
// @Success 200 {object} models.ErpCoupon
// @Router /api/v1/marketing/coupon/detail [post]
func ErpMarketingCouponDetail(c *gin.Context) {
req := &model.ErpMarketingCouponDetailReq{}
if err := c.ShouldBindJSON(&req); err != nil {
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误")
return
}
err := tools.Validate(req) //必填参数校验
if err != nil {
app.Error(c, http.StatusBadRequest, err, err.Error())
return
}
// 查询订单信息
var erpCoupon model.ErpCoupon
err = orm.Eloquent.Table("erp_coupon").Where("id=?", req.ErpCouponId).Find(&erpCoupon).Error
if err != nil {
logger.Error("query erp_coupon err:", logger.Field("err", err))
app.Error(c, http.StatusInternalServerError, err, err.Error())
return
}
app.OK(c, erpCoupon, "OK")
return
}
// ErpMarketingCouponDelete 删除优惠券 // ErpMarketingCouponDelete 删除优惠券
// @Summary 删除优惠券 // @Summary 删除优惠券
// @Tags 营销管理V1.4.4 // @Tags 营销管理V1.4.4

View File

@ -127,6 +127,11 @@ type ErpMarketingCouponEditReq struct {
Limit uint32 `json:"limit"` // 优惠券叠加限制 0-不限制1-仅限原价购买时使用 Limit uint32 `json:"limit"` // 优惠券叠加限制 0-不限制1-仅限原价购买时使用
} }
// ErpMarketingCouponDetailReq 优惠券详情入参
type ErpMarketingCouponDetailReq struct {
ErpCouponId uint32 `json:"erp_coupon_id" validate:"required"` // 优惠券id
}
// ErpMarketingCouponDeleteReq 删除优惠券入参 // ErpMarketingCouponDeleteReq 删除优惠券入参
type ErpMarketingCouponDeleteReq struct { type ErpMarketingCouponDeleteReq struct {
ErpCouponId uint32 `json:"erp_coupon_id" validate:"required"` // 优惠券id ErpCouponId uint32 `json:"erp_coupon_id" validate:"required"` // 优惠券id

View File

@ -13,6 +13,7 @@ func registerMarketingManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJ
r.POST("coupon/list", market.ErpMarketingCouponList) // 优惠券列表 r.POST("coupon/list", market.ErpMarketingCouponList) // 优惠券列表
r.POST("coupon/create", market.ErpMarketingCouponCreate) // 新增优惠券 r.POST("coupon/create", market.ErpMarketingCouponCreate) // 新增优惠券
r.POST("coupon/edit", market.ErpMarketingCouponEdit) // 编辑优惠券 r.POST("coupon/edit", market.ErpMarketingCouponEdit) // 编辑优惠券
r.POST("coupon/detail", market.ErpMarketingCouponDetail) // 优惠券详情
r.POST("coupon/delete", market.ErpMarketingCouponDelete) // 删除优惠券 r.POST("coupon/delete", market.ErpMarketingCouponDelete) // 删除优惠券
r.POST("coupon/start", market.ErpMarketingCouponStart) // 启动优惠券发放 r.POST("coupon/start", market.ErpMarketingCouponStart) // 启动优惠券发放
r.POST("coupon/data", market.ErpMarketingCouponData) // 优惠券数据 r.POST("coupon/data", market.ErpMarketingCouponData) // 优惠券数据

View File

@ -4381,6 +4381,39 @@ const docTemplate = `{
} }
} }
}, },
"/api/v1/marketing/coupon/detail": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "优惠券详情",
"parameters": [
{
"description": "优惠券详情模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponDetailReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ErpCoupon"
}
}
}
}
},
"/api/v1/marketing/coupon/edit": { "/api/v1/marketing/coupon/edit": {
"post": { "post": {
"consumes": [ "consumes": [
@ -9736,6 +9769,18 @@ const docTemplate = `{
} }
} }
}, },
"models.ErpMarketingCouponDetailReq": {
"type": "object",
"required": [
"erp_coupon_id"
],
"properties": {
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
}
}
},
"models.ErpMarketingCouponEditReq": { "models.ErpMarketingCouponEditReq": {
"type": "object", "type": "object",
"required": [ "required": [

View File

@ -4370,6 +4370,39 @@
} }
} }
}, },
"/api/v1/marketing/coupon/detail": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "优惠券详情",
"parameters": [
{
"description": "优惠券详情模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponDetailReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ErpCoupon"
}
}
}
}
},
"/api/v1/marketing/coupon/edit": { "/api/v1/marketing/coupon/edit": {
"post": { "post": {
"consumes": [ "consumes": [
@ -9725,6 +9758,18 @@
} }
} }
}, },
"models.ErpMarketingCouponDetailReq": {
"type": "object",
"required": [
"erp_coupon_id"
],
"properties": {
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
}
}
},
"models.ErpMarketingCouponEditReq": { "models.ErpMarketingCouponEditReq": {
"type": "object", "type": "object",
"required": [ "required": [

View File

@ -2255,6 +2255,14 @@ definitions:
required: required:
- erp_coupon_id - erp_coupon_id
type: object type: object
models.ErpMarketingCouponDetailReq:
properties:
erp_coupon_id:
description: 优惠券id
type: integer
required:
- erp_coupon_id
type: object
models.ErpMarketingCouponEditReq: models.ErpMarketingCouponEditReq:
properties: properties:
active_date: active_date:
@ -11709,6 +11717,27 @@ paths:
summary: 删除优惠券 summary: 删除优惠券
tags: tags:
- 营销管理V1.4.4 - 营销管理V1.4.4
/api/v1/marketing/coupon/detail:
post:
consumes:
- application/json
parameters:
- description: 优惠券详情模型
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.ErpMarketingCouponDetailReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.ErpCoupon'
summary: 优惠券详情
tags:
- 营销管理V1.4.4
/api/v1/marketing/coupon/edit: /api/v1/marketing/coupon/edit:
post: post:
consumes: consumes: