1.商城新增商品时增加收款账户选择;
2.商城订单列表增加时间筛选和excel导出功能;
This commit is contained in:
parent
5a30b6d1fb
commit
3641db246d
|
@ -13,6 +13,14 @@ import (
|
|||
"net/http"
|
||||
)
|
||||
|
||||
// GoodsCreate 新增商品
|
||||
// @Summary 新增商品
|
||||
// @Tags 商城管理
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.Goods true "新增商品模型"
|
||||
// @Success 200 {object} models.Goods
|
||||
// @Router /api/v1/mall/goods/create [post]
|
||||
func GoodsCreate(c *gin.Context) {
|
||||
goods := &models.Goods{}
|
||||
if c.ShouldBindJSON(goods) != nil {
|
||||
|
|
|
@ -38,7 +38,7 @@ func GoodsOrderList(c *gin.Context) {
|
|||
app.Error(c, http.StatusInternalServerError, errors.New("order list err"), "没有权限")
|
||||
return
|
||||
}
|
||||
orderList, totalCount, err := req.OrderList()
|
||||
orderList, exportUrl, totalCount, err := req.OrderList()
|
||||
if err != nil {
|
||||
logger.Errorf("err:%#v", err)
|
||||
msg := "获取订单列表失败"
|
||||
|
@ -50,7 +50,7 @@ func GoodsOrderList(c *gin.Context) {
|
|||
"list": orderList,
|
||||
"page_index": req.PageIdx,
|
||||
"page_size": req.PageSize,
|
||||
//"total_page": totalPage,
|
||||
"export_url": exportUrl,
|
||||
}
|
||||
app.OK(c, ret, "")
|
||||
}
|
||||
|
|
|
@ -6,10 +6,12 @@ import (
|
|||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/xuri/excelize/v2"
|
||||
utils "go-admin/app/admin/models/tools"
|
||||
orm "go-admin/common/global"
|
||||
"go-admin/logger"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/config"
|
||||
"gorm.io/gorm"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
@ -69,7 +71,8 @@ type Goods struct {
|
|||
PriceVm uint32 `json:"price_vm"` // 积分价格
|
||||
PriceRm uint32 `json:"price_rm"` // 人民币价格
|
||||
//Stock uint32 `json:"stock"` // 库存
|
||||
ShowDiscount int8 `json:"show_discount"` //是否展示折扣价
|
||||
ShowDiscount int8 `json:"show_discount"` // 是否展示折扣价
|
||||
GoodsAccountNum uint32 `json:"goods_account_num"` // 收款账户编号
|
||||
|
||||
GoodsCat *GoodsCat `json:"goods_cat" gorm:"-"`
|
||||
GoodsDiscount *GoodsDiscount `json:"goods_discount" gorm:"-"`
|
||||
|
@ -377,10 +380,13 @@ type GoodsOrderListReq struct {
|
|||
OrderId uint32 `json:"order_id"`
|
||||
GoodsId uint32 `json:"goods_id"` // 商品id
|
||||
RefundExpressNo string `json:"refund_express_no"` // 退货物流单号
|
||||
StartTime string `json:"start_time"` // 开始时间
|
||||
EndTime string `json:"end_time"` // 结束时间
|
||||
IsExport uint32 `json:"is_export"` // 1-导出
|
||||
//DeliveryStatus uint32 `json:"delivery_status"`
|
||||
}
|
||||
|
||||
func (m *GoodsOrderListReq) OrderList() ([]GoodsOrder, int64, error) {
|
||||
func (m *GoodsOrderListReq) OrderList() ([]GoodsOrder, string, int64, error) {
|
||||
page := m.PageIdx - 1
|
||||
if page < 0 {
|
||||
page = 0
|
||||
|
@ -409,21 +415,162 @@ func (m *GoodsOrderListReq) OrderList() ([]GoodsOrder, int64, error) {
|
|||
if m.GoodsId != 0 {
|
||||
qs = qs.Where("goods_id=?", m.GoodsId)
|
||||
}
|
||||
if m.StartTime != "" {
|
||||
parse, err := time.Parse(QueryTimeFormat, m.StartTime)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
}
|
||||
qs = qs.Where("created_at > ?", parse)
|
||||
}
|
||||
if m.EndTime != "" {
|
||||
parse, err := time.Parse(QueryTimeFormat, m.EndTime)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
}
|
||||
qs = qs.Where("created_at < ?", parse)
|
||||
}
|
||||
var count int64
|
||||
err := qs.Count(&count).Error
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
return nil, 0, err
|
||||
return nil, "", 0, err
|
||||
}
|
||||
//totalPage := int(count)/m.PageSize + 1
|
||||
|
||||
err = qs.Order("id DESC").Offset(page * m.PageSize).Limit(m.PageSize).Find(&list).Error
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
return nil, 0, err
|
||||
var exportUrl string
|
||||
if m.IsExport == 1 { // 导出excel
|
||||
err = qs.Order("id DESC").Find(&list).Error
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
return nil, "", 0, err
|
||||
}
|
||||
GoodsOrderListSetGoods(list)
|
||||
exportUrl, err = mallOrderListExport(list)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
return nil, "", 0, err
|
||||
}
|
||||
list = nil
|
||||
} else {
|
||||
err = qs.Order("id DESC").Offset(page * m.PageSize).Limit(m.PageSize).Find(&list).Error
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
return nil, "", 0, err
|
||||
}
|
||||
GoodsOrderListSetGoods(list)
|
||||
}
|
||||
GoodsOrderListSetGoods(list)
|
||||
return list, count, nil
|
||||
|
||||
return list, exportUrl, count, nil
|
||||
}
|
||||
|
||||
// mallOrderListExport 导出小程序商城订单数据
|
||||
func mallOrderListExport(list []GoodsOrder) (string, error) {
|
||||
file := excelize.NewFile()
|
||||
fSheet := "Sheet1"
|
||||
|
||||
url := config.ExportConfig.Url
|
||||
fileName := time.Now().Format(TimeFormat) + "商城订单" + ".xlsx"
|
||||
fmt.Println("url fileName:", url+fileName)
|
||||
|
||||
// 组合标题栏数据
|
||||
title := []interface{}{"订单ID", "用户ID", "商品", "商品数量", "消耗积分", "实付款", "会员折扣", "下单时间", "状态"}
|
||||
for i, _ := range title {
|
||||
cell, _ := excelize.CoordinatesToCellName(1+i, 1)
|
||||
err := file.SetCellValue(fSheet, cell, title[i])
|
||||
if err != nil {
|
||||
logger.Error("file set value err:", logger.Field("err", err))
|
||||
}
|
||||
}
|
||||
|
||||
var row1 []interface{}
|
||||
nExcelStartRow := 0
|
||||
for _, reportData := range list {
|
||||
var allotState string
|
||||
switch reportData.State {
|
||||
case GoodsOrderStateUnPay: // 待付款
|
||||
allotState = "待付款"
|
||||
case GoodsOrderStateOnDeliver: // 待发货
|
||||
allotState = "待发货"
|
||||
case GoodsOrderStateDelivered: // 已发货
|
||||
allotState = "已发货"
|
||||
case GoodsOrderStateReceived: // 已收货
|
||||
allotState = "已收货"
|
||||
case GoodsOrderStateCancel: // 已取消
|
||||
allotState = "已取消"
|
||||
case GoodsOrderStateOnRefund: // 退货中
|
||||
allotState = "退货中"
|
||||
case GoodsOrderStateRefunded: // 已退货
|
||||
allotState = "已退货"
|
||||
case GoodsOrderStateRefundedCancel: // 退货取消
|
||||
allotState = "退货取消"
|
||||
}
|
||||
|
||||
var discount string
|
||||
if reportData.Discount != 100 {
|
||||
discount = strconv.FormatFloat(float64(reportData.Discount/10), 'f', 1, 64)
|
||||
}
|
||||
var payRm string
|
||||
if reportData.Rm != 0 {
|
||||
payRm = strconv.FormatFloat(float64(reportData.Rm)/100, 'f', 2, 64)
|
||||
}
|
||||
var createdTime string
|
||||
createdTime = reportData.CreatedAt.Format(TimeFormat)
|
||||
|
||||
var goodsName string
|
||||
if reportData.Goods != nil {
|
||||
goodsName = reportData.Goods.Name
|
||||
}
|
||||
row1 = []interface{}{
|
||||
reportData.OrderId, // 订单ID
|
||||
reportData.Uid, // 用户ID
|
||||
goodsName, // 商品名称
|
||||
reportData.Quantity, // 商品数量
|
||||
reportData.Vm, // 消耗积分
|
||||
payRm, // 实付款
|
||||
discount, // 会员折扣
|
||||
createdTime, // 下单时间
|
||||
allotState, // 状态
|
||||
}
|
||||
|
||||
for j, _ := range row1 {
|
||||
cell, err := excelize.CoordinatesToCellName(1+j, nExcelStartRow+2)
|
||||
if err != nil {
|
||||
logger.Error("invalid cell coordinates", logger.Field("err", err))
|
||||
continue
|
||||
}
|
||||
err = file.SetCellValue(fSheet, cell, row1[j])
|
||||
if err != nil {
|
||||
logger.Error("file set value err:", logger.Field("err", err))
|
||||
}
|
||||
}
|
||||
nExcelStartRow++
|
||||
}
|
||||
|
||||
// 设置所有单元格的样式: 居中、加边框
|
||||
style, _ := file.NewStyle(`{"alignment":{"horizontal":"center","vertical":"center"},
|
||||
"border":[{"type":"left","color":"000000","style":1},
|
||||
{"type":"top","color":"000000","style":1},
|
||||
{"type":"right","color":"000000","style":1},
|
||||
{"type":"bottom","color":"000000","style":1}]}`)
|
||||
|
||||
//设置单元格高度
|
||||
file.SetRowHeight("Sheet1", 1, 20)
|
||||
|
||||
// 设置单元格大小
|
||||
file.SetColWidth("Sheet1", "A", "A", 15)
|
||||
file.SetColWidth("Sheet1", "B", "B", 15)
|
||||
file.SetColWidth("Sheet1", "C", "C", 23)
|
||||
file.SetColWidth("Sheet1", "H", "H", 23)
|
||||
|
||||
endRow := fmt.Sprintf("I"+"%d", nExcelStartRow+1)
|
||||
// 应用样式到整个表格
|
||||
_ = file.SetCellStyle("Sheet1", "A1", endRow, style)
|
||||
|
||||
fmt.Println("save fileName:", config.ExportConfig.Path+fileName)
|
||||
if err := file.SaveAs(config.ExportConfig.Path + fileName); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
return url + fileName, nil
|
||||
}
|
||||
|
||||
type GoodsOrderDetailReq struct {
|
||||
|
|
412
docs/docs.go
412
docs/docs.go
|
@ -4567,6 +4567,39 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/mall/goods/create": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"商城管理"
|
||||
],
|
||||
"summary": "新增商品",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "新增商品模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Goods"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Goods"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/mall/goods/order/list": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
|
@ -13621,7 +13654,10 @@ const docTemplate = `{
|
|||
},
|
||||
"home_category_id": {
|
||||
"description": "首页分类ID",
|
||||
"type": "integer"
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
|
@ -14078,9 +14114,337 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.Goods": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"attributes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.GoodsAttribute"
|
||||
}
|
||||
},
|
||||
"cat_id": {
|
||||
"description": "分类",
|
||||
"type": "integer"
|
||||
},
|
||||
"cat_sort": {
|
||||
"description": "分类排序",
|
||||
"type": "integer"
|
||||
},
|
||||
"combo": {
|
||||
"$ref": "#/definitions/models.GoodsAttributeCombo"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"deal_type": {
|
||||
"description": "1-积分兑换 2-购买 3-抵扣",
|
||||
"type": "integer"
|
||||
},
|
||||
"delivery_fee": {
|
||||
"description": "邮费",
|
||||
"type": "integer"
|
||||
},
|
||||
"detail": {
|
||||
"description": "详情, 富文本",
|
||||
"type": "string"
|
||||
},
|
||||
"discount_list": {
|
||||
"description": "折扣",
|
||||
"type": "string"
|
||||
},
|
||||
"goods_account_num": {
|
||||
"description": "收款账户编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"goods_cat": {
|
||||
"$ref": "#/definitions/models.GoodsCat"
|
||||
},
|
||||
"goods_discount": {
|
||||
"$ref": "#/definitions/models.GoodsDiscount"
|
||||
},
|
||||
"goods_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"images": {
|
||||
"description": "图片列表,用,隔开",
|
||||
"type": "string"
|
||||
},
|
||||
"main_image": {
|
||||
"description": "主图",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"price_original": {
|
||||
"description": "市场价",
|
||||
"type": "integer"
|
||||
},
|
||||
"price_rm": {
|
||||
"description": "人民币价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"price_vm": {
|
||||
"description": "积分价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"sale_status": {
|
||||
"description": "在售状态 1-在售 2-下架",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_no": {
|
||||
"description": "序列号",
|
||||
"type": "string"
|
||||
},
|
||||
"show_discount": {
|
||||
"description": "Stock uint32 ` + "`" + `json:\"stock\"` + "`" + ` // 库存",
|
||||
"type": "integer"
|
||||
},
|
||||
"sold_count": {
|
||||
"description": "已销售数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"sort": {
|
||||
"description": "商品排序",
|
||||
"type": "integer"
|
||||
},
|
||||
"spec_index": {
|
||||
"description": "1,3",
|
||||
"type": "string"
|
||||
},
|
||||
"spec_list": {
|
||||
"description": "属性json数据",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "标题",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
},
|
||||
"version_id": {
|
||||
"description": "乐观锁",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsAttribute": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cat_id": {
|
||||
"description": "分类",
|
||||
"type": "integer"
|
||||
},
|
||||
"combo": {
|
||||
"$ref": "#/definitions/models.GoodsAttributeCombo"
|
||||
},
|
||||
"combos": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.GoodsAttributeCombo"
|
||||
}
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"deal_type": {
|
||||
"description": "1-积分兑换 2-购买 3-抵扣",
|
||||
"type": "integer"
|
||||
},
|
||||
"goods_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"main_image": {
|
||||
"description": "主图",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"price_original": {
|
||||
"description": "PriceRm uint32 ` + "`" + `json:\"price_rm\"` + "`" + ` // 人民币价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_no": {
|
||||
"description": "序列号",
|
||||
"type": "string"
|
||||
},
|
||||
"sold_count": {
|
||||
"description": "已销售数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"sort": {
|
||||
"description": "排序",
|
||||
"type": "integer"
|
||||
},
|
||||
"spec_value_index": {
|
||||
"description": "1,3,5",
|
||||
"type": "string"
|
||||
},
|
||||
"spec_value_list": {
|
||||
"description": "属性json数据",
|
||||
"type": "string"
|
||||
},
|
||||
"spec_values": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.SpecValue"
|
||||
}
|
||||
},
|
||||
"stock": {
|
||||
"description": "库存",
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"description": "标题",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsAttributeCombo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cat_id": {
|
||||
"description": "分类",
|
||||
"type": "integer"
|
||||
},
|
||||
"combo_name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"goods_attribute_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"goods_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"main_image": {
|
||||
"description": "主图",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"price_rm": {
|
||||
"description": "人民币价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"price_vm": {
|
||||
"description": "积分价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_no": {
|
||||
"description": "序列号",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "标题",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsCat": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"level": {
|
||||
"description": "分类层级",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"pid": {
|
||||
"type": "integer"
|
||||
},
|
||||
"priority": {
|
||||
"description": "分类",
|
||||
"type": "string"
|
||||
},
|
||||
"sort": {
|
||||
"type": "integer"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-未使用 2-使用",
|
||||
"type": "integer"
|
||||
},
|
||||
"sub_cats": {
|
||||
"description": "子列表",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.GoodsCat"
|
||||
}
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsDiscount": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"black_gold": {
|
||||
"description": "黑金折扣",
|
||||
"type": "integer"
|
||||
},
|
||||
"gold": {
|
||||
"description": "黄金折扣",
|
||||
"type": "integer"
|
||||
},
|
||||
"platinum": {
|
||||
"description": "白金折扣",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsOrderListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"end_time": {
|
||||
"description": "结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"goods_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
|
@ -14098,6 +14462,10 @@ const docTemplate = `{
|
|||
"description": "退货物流单号",
|
||||
"type": "string"
|
||||
},
|
||||
"start_time": {
|
||||
"description": "开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -18044,6 +18412,48 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.SpecValue": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"sort": {
|
||||
"type": "integer"
|
||||
},
|
||||
"spec_display_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"spec_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"spec_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"spec_sort": {
|
||||
"type": "integer"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-未使用 2-使用",
|
||||
"type": "integer"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Store": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -4556,6 +4556,39 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/mall/goods/create": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"商城管理"
|
||||
],
|
||||
"summary": "新增商品",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "新增商品模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Goods"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Goods"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/mall/goods/order/list": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
|
@ -13610,7 +13643,10 @@
|
|||
},
|
||||
"home_category_id": {
|
||||
"description": "首页分类ID",
|
||||
"type": "integer"
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
|
@ -14067,9 +14103,337 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.Goods": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"attributes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.GoodsAttribute"
|
||||
}
|
||||
},
|
||||
"cat_id": {
|
||||
"description": "分类",
|
||||
"type": "integer"
|
||||
},
|
||||
"cat_sort": {
|
||||
"description": "分类排序",
|
||||
"type": "integer"
|
||||
},
|
||||
"combo": {
|
||||
"$ref": "#/definitions/models.GoodsAttributeCombo"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"deal_type": {
|
||||
"description": "1-积分兑换 2-购买 3-抵扣",
|
||||
"type": "integer"
|
||||
},
|
||||
"delivery_fee": {
|
||||
"description": "邮费",
|
||||
"type": "integer"
|
||||
},
|
||||
"detail": {
|
||||
"description": "详情, 富文本",
|
||||
"type": "string"
|
||||
},
|
||||
"discount_list": {
|
||||
"description": "折扣",
|
||||
"type": "string"
|
||||
},
|
||||
"goods_account_num": {
|
||||
"description": "收款账户编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"goods_cat": {
|
||||
"$ref": "#/definitions/models.GoodsCat"
|
||||
},
|
||||
"goods_discount": {
|
||||
"$ref": "#/definitions/models.GoodsDiscount"
|
||||
},
|
||||
"goods_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"images": {
|
||||
"description": "图片列表,用,隔开",
|
||||
"type": "string"
|
||||
},
|
||||
"main_image": {
|
||||
"description": "主图",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"price_original": {
|
||||
"description": "市场价",
|
||||
"type": "integer"
|
||||
},
|
||||
"price_rm": {
|
||||
"description": "人民币价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"price_vm": {
|
||||
"description": "积分价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"sale_status": {
|
||||
"description": "在售状态 1-在售 2-下架",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_no": {
|
||||
"description": "序列号",
|
||||
"type": "string"
|
||||
},
|
||||
"show_discount": {
|
||||
"description": "Stock uint32 `json:\"stock\"` // 库存",
|
||||
"type": "integer"
|
||||
},
|
||||
"sold_count": {
|
||||
"description": "已销售数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"sort": {
|
||||
"description": "商品排序",
|
||||
"type": "integer"
|
||||
},
|
||||
"spec_index": {
|
||||
"description": "1,3",
|
||||
"type": "string"
|
||||
},
|
||||
"spec_list": {
|
||||
"description": "属性json数据",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "标题",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
},
|
||||
"version_id": {
|
||||
"description": "乐观锁",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsAttribute": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cat_id": {
|
||||
"description": "分类",
|
||||
"type": "integer"
|
||||
},
|
||||
"combo": {
|
||||
"$ref": "#/definitions/models.GoodsAttributeCombo"
|
||||
},
|
||||
"combos": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.GoodsAttributeCombo"
|
||||
}
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"deal_type": {
|
||||
"description": "1-积分兑换 2-购买 3-抵扣",
|
||||
"type": "integer"
|
||||
},
|
||||
"goods_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"main_image": {
|
||||
"description": "主图",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"price_original": {
|
||||
"description": "PriceRm uint32 `json:\"price_rm\"` // 人民币价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_no": {
|
||||
"description": "序列号",
|
||||
"type": "string"
|
||||
},
|
||||
"sold_count": {
|
||||
"description": "已销售数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"sort": {
|
||||
"description": "排序",
|
||||
"type": "integer"
|
||||
},
|
||||
"spec_value_index": {
|
||||
"description": "1,3,5",
|
||||
"type": "string"
|
||||
},
|
||||
"spec_value_list": {
|
||||
"description": "属性json数据",
|
||||
"type": "string"
|
||||
},
|
||||
"spec_values": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.SpecValue"
|
||||
}
|
||||
},
|
||||
"stock": {
|
||||
"description": "库存",
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"description": "标题",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsAttributeCombo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cat_id": {
|
||||
"description": "分类",
|
||||
"type": "integer"
|
||||
},
|
||||
"combo_name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"goods_attribute_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"goods_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"main_image": {
|
||||
"description": "主图",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"price_rm": {
|
||||
"description": "人民币价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"price_vm": {
|
||||
"description": "积分价格",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_no": {
|
||||
"description": "序列号",
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"description": "标题",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsCat": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"level": {
|
||||
"description": "分类层级",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"description": "名称",
|
||||
"type": "string"
|
||||
},
|
||||
"pid": {
|
||||
"type": "integer"
|
||||
},
|
||||
"priority": {
|
||||
"description": "分类",
|
||||
"type": "string"
|
||||
},
|
||||
"sort": {
|
||||
"type": "integer"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-未使用 2-使用",
|
||||
"type": "integer"
|
||||
},
|
||||
"sub_cats": {
|
||||
"description": "子列表",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.GoodsCat"
|
||||
}
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsDiscount": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"black_gold": {
|
||||
"description": "黑金折扣",
|
||||
"type": "integer"
|
||||
},
|
||||
"gold": {
|
||||
"description": "黄金折扣",
|
||||
"type": "integer"
|
||||
},
|
||||
"platinum": {
|
||||
"description": "白金折扣",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.GoodsOrderListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"end_time": {
|
||||
"description": "结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"goods_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
|
@ -14087,6 +14451,10 @@
|
|||
"description": "退货物流单号",
|
||||
"type": "string"
|
||||
},
|
||||
"start_time": {
|
||||
"description": "开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
},
|
||||
|
@ -18033,6 +18401,48 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.SpecValue": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"sort": {
|
||||
"type": "integer"
|
||||
},
|
||||
"spec_display_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"spec_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"spec_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"spec_sort": {
|
||||
"type": "integer"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-未使用 2-使用",
|
||||
"type": "integer"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Store": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -4804,7 +4804,9 @@ definitions:
|
|||
type: string
|
||||
home_category_id:
|
||||
description: 首页分类ID
|
||||
type: integer
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
|
@ -5125,8 +5127,247 @@ definitions:
|
|||
description: 数据总条数
|
||||
type: integer
|
||||
type: object
|
||||
models.Goods:
|
||||
properties:
|
||||
attributes:
|
||||
items:
|
||||
$ref: '#/definitions/models.GoodsAttribute'
|
||||
type: array
|
||||
cat_id:
|
||||
description: 分类
|
||||
type: integer
|
||||
cat_sort:
|
||||
description: 分类排序
|
||||
type: integer
|
||||
combo:
|
||||
$ref: '#/definitions/models.GoodsAttributeCombo'
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
deal_type:
|
||||
description: 1-积分兑换 2-购买 3-抵扣
|
||||
type: integer
|
||||
delivery_fee:
|
||||
description: 邮费
|
||||
type: integer
|
||||
detail:
|
||||
description: 详情, 富文本
|
||||
type: string
|
||||
discount_list:
|
||||
description: 折扣
|
||||
type: string
|
||||
goods_account_num:
|
||||
description: 收款账户编号
|
||||
type: integer
|
||||
goods_cat:
|
||||
$ref: '#/definitions/models.GoodsCat'
|
||||
goods_discount:
|
||||
$ref: '#/definitions/models.GoodsDiscount'
|
||||
goods_id:
|
||||
type: integer
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
images:
|
||||
description: 图片列表,用,隔开
|
||||
type: string
|
||||
main_image:
|
||||
description: 主图
|
||||
type: string
|
||||
name:
|
||||
description: 名称
|
||||
type: string
|
||||
price_original:
|
||||
description: 市场价
|
||||
type: integer
|
||||
price_rm:
|
||||
description: 人民币价格
|
||||
type: integer
|
||||
price_vm:
|
||||
description: 积分价格
|
||||
type: integer
|
||||
sale_status:
|
||||
description: 在售状态 1-在售 2-下架
|
||||
type: integer
|
||||
serial_no:
|
||||
description: 序列号
|
||||
type: string
|
||||
show_discount:
|
||||
description: Stock uint32 `json:"stock"` // 库存
|
||||
type: integer
|
||||
sold_count:
|
||||
description: 已销售数量
|
||||
type: integer
|
||||
sort:
|
||||
description: 商品排序
|
||||
type: integer
|
||||
spec_index:
|
||||
description: 1,3
|
||||
type: string
|
||||
spec_list:
|
||||
description: 属性json数据
|
||||
type: string
|
||||
title:
|
||||
description: 标题
|
||||
type: string
|
||||
updatedAt:
|
||||
description: 更新时间
|
||||
type: string
|
||||
version_id:
|
||||
description: 乐观锁
|
||||
type: integer
|
||||
type: object
|
||||
models.GoodsAttribute:
|
||||
properties:
|
||||
cat_id:
|
||||
description: 分类
|
||||
type: integer
|
||||
combo:
|
||||
$ref: '#/definitions/models.GoodsAttributeCombo'
|
||||
combos:
|
||||
items:
|
||||
$ref: '#/definitions/models.GoodsAttributeCombo'
|
||||
type: array
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
deal_type:
|
||||
description: 1-积分兑换 2-购买 3-抵扣
|
||||
type: integer
|
||||
goods_id:
|
||||
type: integer
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
main_image:
|
||||
description: 主图
|
||||
type: string
|
||||
name:
|
||||
description: 名称
|
||||
type: string
|
||||
price_original:
|
||||
description: PriceRm uint32 `json:"price_rm"` //
|
||||
人民币价格
|
||||
type: integer
|
||||
serial_no:
|
||||
description: 序列号
|
||||
type: string
|
||||
sold_count:
|
||||
description: 已销售数量
|
||||
type: integer
|
||||
sort:
|
||||
description: 排序
|
||||
type: integer
|
||||
spec_value_index:
|
||||
description: 1,3,5
|
||||
type: string
|
||||
spec_value_list:
|
||||
description: 属性json数据
|
||||
type: string
|
||||
spec_values:
|
||||
items:
|
||||
$ref: '#/definitions/models.SpecValue'
|
||||
type: array
|
||||
stock:
|
||||
description: 库存
|
||||
type: integer
|
||||
title:
|
||||
description: 标题
|
||||
type: string
|
||||
updatedAt:
|
||||
description: 更新时间
|
||||
type: string
|
||||
type: object
|
||||
models.GoodsAttributeCombo:
|
||||
properties:
|
||||
cat_id:
|
||||
description: 分类
|
||||
type: integer
|
||||
combo_name:
|
||||
description: 名称
|
||||
type: string
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
goods_attribute_id:
|
||||
type: integer
|
||||
goods_id:
|
||||
type: integer
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
main_image:
|
||||
description: 主图
|
||||
type: string
|
||||
name:
|
||||
description: 名称
|
||||
type: string
|
||||
price_rm:
|
||||
description: 人民币价格
|
||||
type: integer
|
||||
price_vm:
|
||||
description: 积分价格
|
||||
type: integer
|
||||
serial_no:
|
||||
description: 序列号
|
||||
type: string
|
||||
title:
|
||||
description: 标题
|
||||
type: string
|
||||
updatedAt:
|
||||
description: 更新时间
|
||||
type: string
|
||||
type: object
|
||||
models.GoodsCat:
|
||||
properties:
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
level:
|
||||
description: 分类层级
|
||||
type: integer
|
||||
name:
|
||||
description: 名称
|
||||
type: string
|
||||
pid:
|
||||
type: integer
|
||||
priority:
|
||||
description: 分类
|
||||
type: string
|
||||
sort:
|
||||
type: integer
|
||||
state:
|
||||
description: 1-未使用 2-使用
|
||||
type: integer
|
||||
sub_cats:
|
||||
description: 子列表
|
||||
items:
|
||||
$ref: '#/definitions/models.GoodsCat'
|
||||
type: array
|
||||
updatedAt:
|
||||
description: 更新时间
|
||||
type: string
|
||||
type: object
|
||||
models.GoodsDiscount:
|
||||
properties:
|
||||
black_gold:
|
||||
description: 黑金折扣
|
||||
type: integer
|
||||
gold:
|
||||
description: 黄金折扣
|
||||
type: integer
|
||||
platinum:
|
||||
description: 白金折扣
|
||||
type: integer
|
||||
type: object
|
||||
models.GoodsOrderListReq:
|
||||
properties:
|
||||
end_time:
|
||||
description: 结束时间
|
||||
type: string
|
||||
goods_id:
|
||||
description: 商品id
|
||||
type: integer
|
||||
|
@ -5139,6 +5380,9 @@ definitions:
|
|||
refund_express_no:
|
||||
description: 退货物流单号
|
||||
type: string
|
||||
start_time:
|
||||
description: 开始时间
|
||||
type: string
|
||||
state:
|
||||
type: string
|
||||
uid:
|
||||
|
@ -7983,6 +8227,35 @@ definitions:
|
|||
user:
|
||||
$ref: '#/definitions/models.UserInfo'
|
||||
type: object
|
||||
models.SpecValue:
|
||||
properties:
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
display_value:
|
||||
type: string
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
sort:
|
||||
type: integer
|
||||
spec_display_name:
|
||||
type: string
|
||||
spec_id:
|
||||
type: integer
|
||||
spec_name:
|
||||
type: string
|
||||
spec_sort:
|
||||
type: integer
|
||||
state:
|
||||
description: 1-未使用 2-使用
|
||||
type: integer
|
||||
updatedAt:
|
||||
description: 更新时间
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
type: object
|
||||
models.Store:
|
||||
properties:
|
||||
address:
|
||||
|
@ -12262,6 +12535,27 @@ paths:
|
|||
summary: 登录日志列表
|
||||
tags:
|
||||
- system/日志
|
||||
/api/v1/mall/goods/create:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 新增商品模型
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.Goods'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.Goods'
|
||||
summary: 新增商品
|
||||
tags:
|
||||
- 商城管理
|
||||
/api/v1/mall/goods/order/list:
|
||||
post:
|
||||
consumes:
|
||||
|
|
Loading…
Reference in New Issue
Block a user