1、新增营销管理模块相关接口;

This commit is contained in:
chenlin 2024-11-26 19:04:36 +08:00
parent 5418dab8c5
commit 45543566ef
8 changed files with 1785 additions and 3 deletions

View File

@ -0,0 +1,170 @@
package market
import (
"errors"
"github.com/gin-gonic/gin"
model "go-admin/app/admin/models"
"go-admin/logger"
"go-admin/tools"
"go-admin/tools/app"
"net/http"
)
// ErpMarketingCouponList 优惠券列表
// @Summary 优惠券列表
// @Tags 营销管理V1.4.4
// @Produce json
// @Accept json
// @Param request body models.ErpMarketingCouponListReq true "优惠券列表模型"
// @Success 200 {object} models.ErpMarketingCouponListResp
// @Router /api/v1/marketing/coupon/list [post]
func ErpMarketingCouponList(c *gin.Context) {
req := &model.ErpMarketingCouponListReq{}
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
}
resp, err := req.List()
if err != nil {
logger.Error("ErpMarketingCouponList err:", logger.Field("err", err))
app.Error(c, http.StatusInternalServerError, err, "获取失败"+err.Error())
return
}
app.OK(c, resp, "OK")
return
}
// ErpMarketingCouponCreate 新增优惠券
// @Summary 新增优惠券
// @Tags 营销管理V1.4.4
// @Produce json
// @Accept json
// @Param request body models.ErpMarketingCouponCreateReq true "新增优惠券模型"
// @Success 200 {object} app.Response
// @Router /api/v1/marketing/coupon/create [post]
func ErpMarketingCouponCreate(c *gin.Context) {
var req = new(model.ErpMarketingCouponCreateReq)
if err := c.ShouldBindJSON(&req); err != nil {
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
app.Error(c, http.StatusBadRequest, err, "参数错误:"+err.Error())
return
}
err := tools.Validate(req) //必填参数校验
if err != nil {
app.Error(c, http.StatusBadRequest, err, "参数错误:缺少必填参数")
return
}
if !model.IsExistingCategoryByNumber(req.CategoryNumber) {
app.Error(c, http.StatusBadRequest, errors.New("未查询到该分类编号"), "未查询到该分类编号")
return
}
err = model.CreateErpMarketingCoupon(req)
if err != nil {
logger.Error("CreateErpMarketingCoupon err:", logger.Field("err", err))
app.Error(c, http.StatusInternalServerError, err, err.Error())
return
}
app.OK(c, nil, "新增成功")
return
}
// ErpMarketingCouponEdit 编辑优惠券
// @Summary 编辑优惠券
// @Tags 营销管理V1.4.4
// @Produce json
// @Accept json
// @Param request body models.ErpMarketingCouponEditReq true "编辑优惠券模型"
// @Success 200 {object} app.Response
// @Router /api/v1/marketing/coupon/edit [post]
func ErpMarketingCouponEdit(c *gin.Context) {
var req = new(model.ErpMarketingCouponEditReq)
if err := c.ShouldBindJSON(&req); err != nil {
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
app.Error(c, http.StatusBadRequest, err, "参数错误:"+err.Error())
return
}
err := tools.Validate(req) //必填参数校验
if err != nil {
app.Error(c, http.StatusBadRequest, err, "参数错误:缺少必填参数")
return
}
err = model.EditErpMarketingCoupon(req)
if err != nil {
logger.Error("EditErpMarketingCoupon err:", logger.Field("err", err))
app.Error(c, http.StatusInternalServerError, err, err.Error())
return
}
app.OK(c, nil, "编辑成功")
return
}
// ErpMarketingCouponDelete 删除优惠券
// @Summary 删除优惠券
// @Tags 营销管理V1.4.4
// @Produce json
// @Accept json
// @Param request body models.ErpMarketingCouponDeleteReq true "删除优惠券模型"
// @Success 200 {object} app.Response
// @Router /api/v1/marketing/coupon/delete [post]
func ErpMarketingCouponDelete(c *gin.Context) {
var req = new(model.ErpMarketingCouponDeleteReq)
if err := c.ShouldBindJSON(&req); err != nil {
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
app.Error(c, http.StatusBadRequest, err, "参数错误:"+err.Error())
return
}
err := tools.Validate(req) //必填参数校验
if err != nil {
app.Error(c, http.StatusBadRequest, err, "参数错误优惠券id为空")
return
}
err = model.DeleteErpMarketingCoupon(req)
if err != nil {
logger.Error("DeleteErpMarketingCoupon err:", logger.Field("err", err))
app.Error(c, http.StatusInternalServerError, err, err.Error())
return
}
app.OK(c, nil, "删除成功")
return
}
// ErpMarketingCouponStart 启动优惠券发放
// @Summary 启动优惠券发放
// @Tags 营销管理V1.4.4
// @Produce json
// @Accept json
// @Param request body models.ErpMarketingCouponStartReq true "启动优惠券发放模型"
// @Success 200 {object} app.Response
// @Router /api/v1/marketing/coupon/start [post]
func ErpMarketingCouponStart(c *gin.Context) {
app.OK(c, nil, "启动成功")
return
}
// ErpMarketingCouponData 优惠券数据
// @Summary 优惠券数据
// @Tags 营销管理V1.4.4
// @Produce json
// @Accept json
// @Param request body models.ErpMarketingCouponDataReq true "优惠券数据模型"
// @Success 200 {object} models.ErpMarketingCouponDataResp
// @Router /api/v1/marketing/coupon/data [post]
func ErpMarketingCouponData(c *gin.Context) {
app.OK(c, nil, "OK")
return
}

View File

@ -181,6 +181,20 @@ func IsExistingCategory(categoryName string) bool {
return count > 0
}
// IsExistingCategoryByNumber 查询分类资料中某个名称的分类是否存在
func IsExistingCategoryByNumber(number string) bool {
if number == "" {
return false
}
// 查询分类名称是否存在的逻辑
var count int64
orm.Eloquent.Debug().Model(&Category{}).
Where("number = ?", number).
Count(&count)
return count > 0
}
// GetSubcategoryIds 获取指定分类的所有子分类ID
func GetSubcategoryIds(categoryID uint32) ([]uint32, error) {
var subCategories []Category

View File

@ -0,0 +1,245 @@
package models
import (
"errors"
"fmt"
orm "go-admin/common/global"
"go-admin/logger"
"time"
)
const (
ErpCouponUnStarted = 1 // 未开始
ErpCouponSending = 2 // 发放中
ErpCouponInProgress = 3 // 进行中
ErpCouponFinished = 4 // 已结束
)
// ErpCoupon 营销管理-优惠券
type ErpCoupon struct {
Model
Name string `json:"name" gorm:"index"` // 优惠券名称
Remark string `json:"remark"` // 名称备注
Content string `json:"content"` // 优惠内容
CategoryNumber string `json:"category_number"` // 可以使用该优惠券的商品分类,如果为空则表示没限制
ActiveDate uint32 `json:"active_date"` // 有效期(天)
Amount float64 `json:"amount"` // 金额(元)
UserType uint32 `json:"user_type"` // 领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员
Limit uint32 `json:"limit"` // 优惠券叠加限制 0-不限制1-仅限原价购买时使用
State uint32 `json:"state" gorm:"index"` // 当前状态 1-未开始2-发放中3-进行中4-已结束
SendCount uint32 `json:"send_count"` // 已发放
UsedCount uint32 `json:"used_count"` // 已使用
TotalPayAmount float64 `json:"total_pay_amount"` // 支付金额(元)
PerCustomerAmount float64 `json:"per_customer_amount"` // 客单价(元)
}
// ErpMarketingCouponListReq 优惠券列表入参
type ErpMarketingCouponListReq struct {
Name string `json:"name" gorm:"index"` // 优惠券名称
State uint32 `json:"state" gorm:"index"` // 当前状态 1-未开始2-发放中3-进行中4-已结束
CreatedTimeStart string `json:"created_time_start"` // 创建开始时间
CreatedTimeEnd string `json:"created_time_end"` // 创建结束时间
PageIndex int `json:"pageIndex"` // 页码
PageSize int `json:"pageSize"` // 页面条数
IsExport uint32 `json:"is_export"` // 1-导出
}
// ErpMarketingCouponListResp 优惠券列表出参
type ErpMarketingCouponListResp struct {
List []ErpCoupon `json:"list"`
Total int `json:"total"` // 总条数
PageIndex int `json:"pageIndex"` // 页码
PageSize int `json:"pageSize"` // 页面条数
ExportUrl string `json:"export_url"` // 导出excel路径
}
// ErpMarketingCouponCreateReq 新增优惠券入参
type ErpMarketingCouponCreateReq struct {
Name string `json:"name" validate:"required"` // 优惠券名称
Remark string `json:"remark"` // 名称备注
Content string `json:"content"` // 优惠内容/使用说明
CategoryNumber string `json:"category_number" validate:"required"` // 可以使用该优惠券的商品分类编号,如果为空则表示没限制
ActiveDate uint32 `json:"active_date" validate:"required"` // 有效期(天)
Amount float64 `json:"amount" validate:"required"` // 金额(元)
UserType uint32 `json:"user_type" validate:"required"` // 领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员
Limit uint32 `json:"limit"` // 优惠券叠加限制 0-不限制1-仅限原价购买时使用
}
// ErpMarketingCouponEditReq 编辑优惠券入参
type ErpMarketingCouponEditReq struct {
ErpCouponId uint32 `json:"erp_coupon_id" validate:"required"` // 优惠券id
Name string `json:"name" validate:"required"` // 优惠券名称
Remark string `json:"remark"` // 名称备注
Content string `json:"content"` // 优惠内容/使用说明
CategoryNumber string `json:"category_number" validate:"required"` // 可以使用该优惠券的商品分类,如果为空则表示没限制
ActiveDate uint32 `json:"active_date" validate:"required"` // 有效期(天)
Amount float64 `json:"amount" validate:"required"` // 金额(元)
UserType uint32 `json:"user_type" validate:"required"` // 领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员
Limit uint32 `json:"limit"` // 优惠券叠加限制 0-不限制1-仅限原价购买时使用
}
// ErpMarketingCouponDeleteReq 删除优惠券入参
type ErpMarketingCouponDeleteReq struct {
ErpCouponId uint32 `json:"erp_coupon_id" binding:"required"` // 优惠券id
}
// ErpMarketingCouponStartReq 启动优惠券发放
type ErpMarketingCouponStartReq struct {
ErpCouponId uint32 `json:"erp_coupon_id" binding:"required"` // 优惠券id
}
// ErpMarketingCouponDataReq 优惠券数据入参
type ErpMarketingCouponDataReq struct {
ErpCouponId uint32 `json:"erp_coupon_id" binding:"required"` // 优惠券id
}
// ErpMarketingCouponDataResp 优惠券数据出参
type ErpMarketingCouponDataResp struct {
}
// List 查询优惠券列表
func (m *ErpMarketingCouponListReq) List() (*ErpMarketingCouponListResp, error) {
resp := &ErpMarketingCouponListResp{
PageIndex: m.PageIndex,
PageSize: m.PageSize,
}
page := m.PageIndex - 1
if page < 0 {
page = 0
}
if m.PageSize == 0 {
m.PageSize = 10
}
qs := orm.Eloquent.Table("erp_coupon")
if m.Name != "" {
qs = qs.Where("name = ?", m.Name)
}
if m.State != 0 {
qs = qs.Where("state = ?", m.State)
}
if m.CreatedTimeStart != "" {
parse, err := time.Parse(QueryTimeFormat, m.CreatedTimeStart)
if err != nil {
logger.Errorf("erpPurchaseOrderList err:", err)
return nil, err
}
qs = qs.Where("created_at > ?", parse)
}
if m.CreatedTimeEnd != "" {
parse, err := time.Parse(QueryTimeFormat, m.CreatedTimeEnd)
if err != nil {
logger.Errorf("erpPurchaseOrderList err:", err)
return nil, err
}
qs = qs.Where("created_at < ?", parse)
}
var count int64
err := qs.Count(&count).Error
if err != nil {
logger.Error("count err:", logger.Field("err", err))
return resp, err
}
resp.Total = int(count)
var couponList []ErpCoupon
err = qs.Order("id DESC").Offset(page * m.PageSize).Limit(m.PageSize).Find(&couponList).Error
if err != nil && err != RecordNotFound {
logger.Error("erp_coupon list err:", logger.Field("err", err))
return resp, err
}
resp.List = couponList
return resp, nil
}
// CreateErpMarketingCoupon 新增优惠券
func CreateErpMarketingCoupon(req *ErpMarketingCouponCreateReq) error {
erpCoupon := &ErpCoupon{
Name: req.Name,
Remark: req.Remark,
Content: req.Content,
CategoryNumber: req.CategoryNumber,
ActiveDate: req.ActiveDate,
Amount: req.Amount,
UserType: req.UserType,
Limit: req.Limit,
State: ErpCouponUnStarted,
}
err := orm.Eloquent.Create(erpCoupon).Error
if err != nil {
logger.Error("create purchase order err:", logger.Field("err", err))
return err
}
return nil
}
// EditErpMarketingCoupon 编辑优惠券
func EditErpMarketingCoupon(req *ErpMarketingCouponEditReq) error {
// 查询订单信息
var erpCoupon ErpCoupon
err := orm.Eloquent.Table("erp_coupon").Where("id=?", req.ErpCouponId).Find(&erpCoupon).Error
if err != nil {
logger.Error("purchase order err:", logger.Field("err", err))
return err
}
if erpCoupon.ID == 0 {
logger.Error("delete err, erpCoupon ID is:", logger.Field("erpCoupon.ID", req.ErpCouponId))
return errors.New(fmt.Sprintf("编辑失败:未查询到优惠券id[%d]", req.ErpCouponId))
}
// 1-更新优惠券信息
erpCoupon.Name = req.Name
erpCoupon.Remark = req.Remark
erpCoupon.Content = req.Content
erpCoupon.CategoryNumber = req.CategoryNumber
erpCoupon.ActiveDate = req.ActiveDate
erpCoupon.Amount = req.Amount
erpCoupon.UserType = req.UserType
erpCoupon.Limit = req.Limit
err = orm.Eloquent.Model(&ErpCoupon{}).Where("id = ?", req.ErpCouponId).
Omit("created_at").Save(erpCoupon).Error
if err != nil {
logger.Error("update erp_coupon err:", logger.Field("err", err))
return err
}
return nil
}
// DeleteErpMarketingCoupon 删除优惠券
func DeleteErpMarketingCoupon(req *ErpMarketingCouponDeleteReq) error {
// 查询订单信息
var erpCoupon ErpCoupon
err := orm.Eloquent.Table("erp_coupon").Where("id=?", req.ErpCouponId).Find(&erpCoupon).Error
if err != nil {
logger.Error("purchase order err:", logger.Field("err", err))
return err
}
if erpCoupon.ID == 0 {
logger.Error("delete err, erpCoupon ID is:", logger.Field("erpCoupon.ID", req.ErpCouponId))
return errors.New(fmt.Sprintf("删除失败:未查询到优惠券id[%d]", req.ErpCouponId))
}
// 仅未开始和已结束的订单可删除
if erpCoupon.State != ErpCouponUnStarted && erpCoupon.State != ErpCouponFinished {
logger.Error("delete err, erpCoupon.State is:", logger.Field("erpCoupon.State", erpCoupon.State))
return errors.New("删除失败:仅未开始和已结束的优惠券可删除")
}
// 删除优惠订单
err = orm.Eloquent.Delete(erpCoupon).Error
if err != nil {
logger.Error("erp_coupon delete err:", logger.Field("err", err))
return err
}
return nil
}

View File

@ -0,0 +1,19 @@
package router
import (
"github.com/gin-gonic/gin"
"go-admin/app/admin/apis/market"
"go-admin/app/admin/middleware"
jwt "go-admin/pkg/jwtauth"
)
func registerMarketingManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
r := v1.Group("/marketing").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
r.POST("coupon/list", market.ErpMarketingCouponList) // 优惠券列表
r.POST("coupon/create", market.ErpMarketingCouponCreate) // 新增优惠券
r.POST("coupon/edit", market.ErpMarketingCouponEdit) // 编辑优惠券
r.POST("coupon/delete", market.ErpMarketingCouponDelete) // 删除优惠券
r.POST("coupon/start", market.ErpMarketingCouponStart) // 启动优惠券发放
r.POST("coupon/data", market.ErpMarketingCouponData) // 优惠券数据
}

View File

@ -112,4 +112,6 @@ func examplesCheckRoleRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddle
registerErpPurchaseManageRouter(v1, authMiddleware)
// 决策中心
registerErpDecisionRouter(v1, authMiddleware)
// 营销管理
registerMarketingManageRouter(v1, authMiddleware)
}

View File

@ -3410,6 +3410,39 @@ const docTemplate = `{
}
},
"/api/v1/inventory/detail": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"库存管理"
],
"summary": "查询库存详情",
"parameters": [
{
"description": "查询库存详情模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpStockCommodityListReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ErpStockCommodityListResp"
}
}
}
}
},
"/api/v1/inventory/detail_new": {
"post": {
"consumes": [
"application/json"
@ -4249,6 +4282,204 @@ const docTemplate = `{
}
}
},
"/api/v1/marketing/coupon/create": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "新增优惠券",
"parameters": [
{
"description": "新增优惠券模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponCreateReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/marketing/coupon/data": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "优惠券数据",
"parameters": [
{
"description": "优惠券数据模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponDataReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponDataResp"
}
}
}
}
},
"/api/v1/marketing/coupon/delete": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "删除优惠券",
"parameters": [
{
"description": "删除优惠券模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponDeleteReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/marketing/coupon/edit": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "编辑优惠券",
"parameters": [
{
"description": "编辑优惠券模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponEditReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/marketing/coupon/list": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "优惠券列表",
"parameters": [
{
"description": "优惠券列表模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponListReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponListResp"
}
}
}
}
},
"/api/v1/marketing/coupon/start": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "启动优惠券发放",
"parameters": [
{
"description": "启动优惠券发放模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponStartReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/menu": {
"get": {
"security": [
@ -8605,7 +8836,7 @@ const docTemplate = `{
"type": "integer"
},
"purchase_type": {
"description": "0-全部,1-正常采购2-停止采购",
"description": "1-正常采购2-停止采购",
"type": "integer"
},
"serial_number": {
@ -8742,6 +8973,75 @@ const docTemplate = `{
}
}
},
"models.ErpCoupon": {
"type": "object",
"properties": {
"active_date": {
"description": "有效期(天)",
"type": "integer"
},
"amount": {
"description": "金额(元)",
"type": "number"
},
"category_number": {
"description": "可以使用该优惠券的商品分类,如果为空则表示没限制",
"type": "string"
},
"content": {
"description": "优惠内容",
"type": "string"
},
"createdAt": {
"description": "创建时间",
"type": "string"
},
"id": {
"description": "数据库记录编号",
"type": "integer"
},
"limit": {
"description": "优惠券叠加限制 0-不限制1-仅限原价购买时使用",
"type": "integer"
},
"name": {
"description": "优惠券名称",
"type": "string"
},
"per_customer_amount": {
"description": "客单价(元)",
"type": "number"
},
"remark": {
"description": "名称备注",
"type": "string"
},
"send_count": {
"description": "已发放",
"type": "integer"
},
"state": {
"description": "当前状态 1-未开始2-发放中3-进行中4-已结束",
"type": "integer"
},
"total_pay_amount": {
"description": "支付金额(元)",
"type": "number"
},
"updatedAt": {
"description": "更新时间",
"type": "string"
},
"used_count": {
"description": "已使用",
"type": "integer"
},
"user_type": {
"description": "领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员",
"type": "integer"
}
}
},
"models.ErpDecisionReportReq": {
"type": "object",
"properties": {
@ -9279,6 +9579,198 @@ const docTemplate = `{
}
}
},
"models.ErpMarketingCouponCreateReq": {
"type": "object",
"required": [
"active_date",
"amount",
"category_number",
"name",
"user_type"
],
"properties": {
"active_date": {
"description": "有效期(天)",
"type": "integer"
},
"amount": {
"description": "金额(元)",
"type": "number"
},
"category_number": {
"description": "可以使用该优惠券的商品分类编号,如果为空则表示没限制",
"type": "string"
},
"content": {
"description": "优惠内容/使用说明",
"type": "string"
},
"limit": {
"description": "优惠券叠加限制 0-不限制1-仅限原价购买时使用",
"type": "integer"
},
"name": {
"description": "优惠券名称",
"type": "string"
},
"remark": {
"description": "名称备注",
"type": "string"
},
"user_type": {
"description": "领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员",
"type": "integer"
}
}
},
"models.ErpMarketingCouponDataReq": {
"type": "object",
"required": [
"erp_coupon_id"
],
"properties": {
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
}
}
},
"models.ErpMarketingCouponDataResp": {
"type": "object"
},
"models.ErpMarketingCouponDeleteReq": {
"type": "object",
"required": [
"erp_coupon_id"
],
"properties": {
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
}
}
},
"models.ErpMarketingCouponEditReq": {
"type": "object",
"required": [
"active_date",
"amount",
"category_number",
"erp_coupon_id",
"name",
"user_type"
],
"properties": {
"active_date": {
"description": "有效期(天)",
"type": "integer"
},
"amount": {
"description": "金额(元)",
"type": "number"
},
"category_number": {
"description": "可以使用该优惠券的商品分类,如果为空则表示没限制",
"type": "string"
},
"content": {
"description": "优惠内容/使用说明",
"type": "string"
},
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
},
"limit": {
"description": "优惠券叠加限制 0-不限制1-仅限原价购买时使用",
"type": "integer"
},
"name": {
"description": "优惠券名称",
"type": "string"
},
"remark": {
"description": "名称备注",
"type": "string"
},
"user_type": {
"description": "领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员",
"type": "integer"
}
}
},
"models.ErpMarketingCouponListReq": {
"type": "object",
"properties": {
"created_time_end": {
"description": "创建结束时间",
"type": "string"
},
"created_time_start": {
"description": "创建开始时间",
"type": "string"
},
"is_export": {
"description": "1-导出",
"type": "integer"
},
"name": {
"description": "优惠券名称",
"type": "string"
},
"pageIndex": {
"description": "页码",
"type": "integer"
},
"pageSize": {
"description": "页面条数",
"type": "integer"
},
"state": {
"description": "当前状态 1-未开始2-发放中3-进行中4-已结束",
"type": "integer"
}
}
},
"models.ErpMarketingCouponListResp": {
"type": "object",
"properties": {
"export_url": {
"description": "导出excel路径",
"type": "string"
},
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/models.ErpCoupon"
}
},
"pageIndex": {
"description": "页码",
"type": "integer"
},
"pageSize": {
"description": "页面条数",
"type": "integer"
},
"total": {
"description": "总条数",
"type": "integer"
}
}
},
"models.ErpMarketingCouponStartReq": {
"type": "object",
"required": [
"erp_coupon_id"
],
"properties": {
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
}
}
},
"models.ErpOrder": {
"type": "object",
"properties": {
@ -13421,6 +13913,10 @@ const docTemplate = `{
"total": {
"description": "总条数/记录数",
"type": "integer"
},
"total_allot_amount": {
"description": "调拨金额",
"type": "number"
}
}
},

View File

@ -3399,6 +3399,39 @@
}
},
"/api/v1/inventory/detail": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"库存管理"
],
"summary": "查询库存详情",
"parameters": [
{
"description": "查询库存详情模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpStockCommodityListReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ErpStockCommodityListResp"
}
}
}
}
},
"/api/v1/inventory/detail_new": {
"post": {
"consumes": [
"application/json"
@ -4238,6 +4271,204 @@
}
}
},
"/api/v1/marketing/coupon/create": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "新增优惠券",
"parameters": [
{
"description": "新增优惠券模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponCreateReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/marketing/coupon/data": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "优惠券数据",
"parameters": [
{
"description": "优惠券数据模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponDataReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponDataResp"
}
}
}
}
},
"/api/v1/marketing/coupon/delete": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "删除优惠券",
"parameters": [
{
"description": "删除优惠券模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponDeleteReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/marketing/coupon/edit": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "编辑优惠券",
"parameters": [
{
"description": "编辑优惠券模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponEditReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/marketing/coupon/list": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "优惠券列表",
"parameters": [
{
"description": "优惠券列表模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponListReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponListResp"
}
}
}
}
},
"/api/v1/marketing/coupon/start": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"营销管理V1.4.4"
],
"summary": "启动优惠券发放",
"parameters": [
{
"description": "启动优惠券发放模型",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ErpMarketingCouponStartReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/app.Response"
}
}
}
}
},
"/api/v1/menu": {
"get": {
"security": [
@ -8594,7 +8825,7 @@
"type": "integer"
},
"purchase_type": {
"description": "0-全部,1-正常采购2-停止采购",
"description": "1-正常采购2-停止采购",
"type": "integer"
},
"serial_number": {
@ -8731,6 +8962,75 @@
}
}
},
"models.ErpCoupon": {
"type": "object",
"properties": {
"active_date": {
"description": "有效期(天)",
"type": "integer"
},
"amount": {
"description": "金额(元)",
"type": "number"
},
"category_number": {
"description": "可以使用该优惠券的商品分类,如果为空则表示没限制",
"type": "string"
},
"content": {
"description": "优惠内容",
"type": "string"
},
"createdAt": {
"description": "创建时间",
"type": "string"
},
"id": {
"description": "数据库记录编号",
"type": "integer"
},
"limit": {
"description": "优惠券叠加限制 0-不限制1-仅限原价购买时使用",
"type": "integer"
},
"name": {
"description": "优惠券名称",
"type": "string"
},
"per_customer_amount": {
"description": "客单价(元)",
"type": "number"
},
"remark": {
"description": "名称备注",
"type": "string"
},
"send_count": {
"description": "已发放",
"type": "integer"
},
"state": {
"description": "当前状态 1-未开始2-发放中3-进行中4-已结束",
"type": "integer"
},
"total_pay_amount": {
"description": "支付金额(元)",
"type": "number"
},
"updatedAt": {
"description": "更新时间",
"type": "string"
},
"used_count": {
"description": "已使用",
"type": "integer"
},
"user_type": {
"description": "领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员",
"type": "integer"
}
}
},
"models.ErpDecisionReportReq": {
"type": "object",
"properties": {
@ -9268,6 +9568,198 @@
}
}
},
"models.ErpMarketingCouponCreateReq": {
"type": "object",
"required": [
"active_date",
"amount",
"category_number",
"name",
"user_type"
],
"properties": {
"active_date": {
"description": "有效期(天)",
"type": "integer"
},
"amount": {
"description": "金额(元)",
"type": "number"
},
"category_number": {
"description": "可以使用该优惠券的商品分类编号,如果为空则表示没限制",
"type": "string"
},
"content": {
"description": "优惠内容/使用说明",
"type": "string"
},
"limit": {
"description": "优惠券叠加限制 0-不限制1-仅限原价购买时使用",
"type": "integer"
},
"name": {
"description": "优惠券名称",
"type": "string"
},
"remark": {
"description": "名称备注",
"type": "string"
},
"user_type": {
"description": "领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员",
"type": "integer"
}
}
},
"models.ErpMarketingCouponDataReq": {
"type": "object",
"required": [
"erp_coupon_id"
],
"properties": {
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
}
}
},
"models.ErpMarketingCouponDataResp": {
"type": "object"
},
"models.ErpMarketingCouponDeleteReq": {
"type": "object",
"required": [
"erp_coupon_id"
],
"properties": {
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
}
}
},
"models.ErpMarketingCouponEditReq": {
"type": "object",
"required": [
"active_date",
"amount",
"category_number",
"erp_coupon_id",
"name",
"user_type"
],
"properties": {
"active_date": {
"description": "有效期(天)",
"type": "integer"
},
"amount": {
"description": "金额(元)",
"type": "number"
},
"category_number": {
"description": "可以使用该优惠券的商品分类,如果为空则表示没限制",
"type": "string"
},
"content": {
"description": "优惠内容/使用说明",
"type": "string"
},
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
},
"limit": {
"description": "优惠券叠加限制 0-不限制1-仅限原价购买时使用",
"type": "integer"
},
"name": {
"description": "优惠券名称",
"type": "string"
},
"remark": {
"description": "名称备注",
"type": "string"
},
"user_type": {
"description": "领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员",
"type": "integer"
}
}
},
"models.ErpMarketingCouponListReq": {
"type": "object",
"properties": {
"created_time_end": {
"description": "创建结束时间",
"type": "string"
},
"created_time_start": {
"description": "创建开始时间",
"type": "string"
},
"is_export": {
"description": "1-导出",
"type": "integer"
},
"name": {
"description": "优惠券名称",
"type": "string"
},
"pageIndex": {
"description": "页码",
"type": "integer"
},
"pageSize": {
"description": "页面条数",
"type": "integer"
},
"state": {
"description": "当前状态 1-未开始2-发放中3-进行中4-已结束",
"type": "integer"
}
}
},
"models.ErpMarketingCouponListResp": {
"type": "object",
"properties": {
"export_url": {
"description": "导出excel路径",
"type": "string"
},
"list": {
"type": "array",
"items": {
"$ref": "#/definitions/models.ErpCoupon"
}
},
"pageIndex": {
"description": "页码",
"type": "integer"
},
"pageSize": {
"description": "页面条数",
"type": "integer"
},
"total": {
"description": "总条数",
"type": "integer"
}
}
},
"models.ErpMarketingCouponStartReq": {
"type": "object",
"required": [
"erp_coupon_id"
],
"properties": {
"erp_coupon_id": {
"description": "优惠券id",
"type": "integer"
}
}
},
"models.ErpOrder": {
"type": "object",
"properties": {
@ -13410,6 +13902,10 @@
"total": {
"description": "总条数/记录数",
"type": "integer"
},
"total_allot_amount": {
"description": "调拨金额",
"type": "number"
}
}
},

View File

@ -1621,7 +1621,7 @@ definitions:
description: 每页展示数据条数
type: integer
purchase_type:
description: 0-全部1-正常采购2-停止采购
description: 1-正常采购2-停止采购
type: integer
serial_number:
description: 商品编号
@ -1721,6 +1721,57 @@ definitions:
description: 门店名称
type: string
type: object
models.ErpCoupon:
properties:
active_date:
description: 有效期(天)
type: integer
amount:
description: 金额(元)
type: number
category_number:
description: 可以使用该优惠券的商品分类,如果为空则表示没限制
type: string
content:
description: 优惠内容
type: string
createdAt:
description: 创建时间
type: string
id:
description: 数据库记录编号
type: integer
limit:
description: 优惠券叠加限制 0-不限制1-仅限原价购买时使用
type: integer
name:
description: 优惠券名称
type: string
per_customer_amount:
description: 客单价(元)
type: number
remark:
description: 名称备注
type: string
send_count:
description: 已发放
type: integer
state:
description: 当前状态 1-未开始2-发放中3-进行中4-已结束
type: integer
total_pay_amount:
description: 支付金额(元)
type: number
updatedAt:
description: 更新时间
type: string
used_count:
description: 已使用
type: integer
user_type:
description: 领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员
type: integer
type: object
models.ErpDecisionReportReq:
properties:
category_id:
@ -2114,6 +2165,145 @@ definitions:
description: 更新时间
type: string
type: object
models.ErpMarketingCouponCreateReq:
properties:
active_date:
description: 有效期(天)
type: integer
amount:
description: 金额(元)
type: number
category_number:
description: 可以使用该优惠券的商品分类编号,如果为空则表示没限制
type: string
content:
description: 优惠内容/使用说明
type: string
limit:
description: 优惠券叠加限制 0-不限制1-仅限原价购买时使用
type: integer
name:
description: 优惠券名称
type: string
remark:
description: 名称备注
type: string
user_type:
description: 领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员
type: integer
required:
- active_date
- amount
- category_number
- name
- user_type
type: object
models.ErpMarketingCouponDataReq:
properties:
erp_coupon_id:
description: 优惠券id
type: integer
required:
- erp_coupon_id
type: object
models.ErpMarketingCouponDataResp:
type: object
models.ErpMarketingCouponDeleteReq:
properties:
erp_coupon_id:
description: 优惠券id
type: integer
required:
- erp_coupon_id
type: object
models.ErpMarketingCouponEditReq:
properties:
active_date:
description: 有效期(天)
type: integer
amount:
description: 金额(元)
type: number
category_number:
description: 可以使用该优惠券的商品分类,如果为空则表示没限制
type: string
content:
description: 优惠内容/使用说明
type: string
erp_coupon_id:
description: 优惠券id
type: integer
limit:
description: 优惠券叠加限制 0-不限制1-仅限原价购买时使用
type: integer
name:
description: 优惠券名称
type: string
remark:
description: 名称备注
type: string
user_type:
description: 领取人限制1-所有人 2-未付费用户 3-已付费用户 4-尊享会员
type: integer
required:
- active_date
- amount
- category_number
- erp_coupon_id
- name
- user_type
type: object
models.ErpMarketingCouponListReq:
properties:
created_time_end:
description: 创建结束时间
type: string
created_time_start:
description: 创建开始时间
type: string
is_export:
description: 1-导出
type: integer
name:
description: 优惠券名称
type: string
pageIndex:
description: 页码
type: integer
pageSize:
description: 页面条数
type: integer
state:
description: 当前状态 1-未开始2-发放中3-进行中4-已结束
type: integer
type: object
models.ErpMarketingCouponListResp:
properties:
export_url:
description: 导出excel路径
type: string
list:
items:
$ref: '#/definitions/models.ErpCoupon'
type: array
pageIndex:
description: 页码
type: integer
pageSize:
description: 页面条数
type: integer
total:
description: 总条数
type: integer
type: object
models.ErpMarketingCouponStartReq:
properties:
erp_coupon_id:
description: 优惠券id
type: integer
required:
- erp_coupon_id
type: object
models.ErpOrder:
properties:
audit_time:
@ -5117,6 +5307,9 @@ definitions:
total:
description: 总条数/记录数
type: integer
total_allot_amount:
description: 调拨金额
type: number
type: object
models.InventoryReportByAllotReq:
properties:
@ -10815,6 +11008,27 @@ paths:
tags:
- 库存管理
/api/v1/inventory/detail:
post:
consumes:
- application/json
parameters:
- description: 查询库存详情模型
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.ErpStockCommodityListReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.ErpStockCommodityListResp'
summary: 查询库存详情
tags:
- 库存管理
/api/v1/inventory/detail_new:
post:
consumes:
- application/json
@ -11348,6 +11562,132 @@ paths:
tags:
- 数据统计
- V1.2.0
/api/v1/marketing/coupon/create:
post:
consumes:
- application/json
parameters:
- description: 新增优惠券模型
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.ErpMarketingCouponCreateReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/app.Response'
summary: 新增优惠券
tags:
- 营销管理V1.4.4
/api/v1/marketing/coupon/data:
post:
consumes:
- application/json
parameters:
- description: 优惠券数据模型
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.ErpMarketingCouponDataReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.ErpMarketingCouponDataResp'
summary: 优惠券数据
tags:
- 营销管理V1.4.4
/api/v1/marketing/coupon/delete:
post:
consumes:
- application/json
parameters:
- description: 删除优惠券模型
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.ErpMarketingCouponDeleteReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/app.Response'
summary: 删除优惠券
tags:
- 营销管理V1.4.4
/api/v1/marketing/coupon/edit:
post:
consumes:
- application/json
parameters:
- description: 编辑优惠券模型
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.ErpMarketingCouponEditReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/app.Response'
summary: 编辑优惠券
tags:
- 营销管理V1.4.4
/api/v1/marketing/coupon/list:
post:
consumes:
- application/json
parameters:
- description: 优惠券列表模型
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.ErpMarketingCouponListReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.ErpMarketingCouponListResp'
summary: 优惠券列表
tags:
- 营销管理V1.4.4
/api/v1/marketing/coupon/start:
post:
consumes:
- application/json
parameters:
- description: 启动优惠券发放模型
in: body
name: request
required: true
schema:
$ref: '#/definitions/models.ErpMarketingCouponStartReq'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/app.Response'
summary: 启动优惠券发放
tags:
- 营销管理V1.4.4
/api/v1/menu:
get:
description: 获取JSON