RIceWqy 2 years ago
parent d5c365d226
commit 27ce1433ff

@ -0,0 +1,215 @@
{
"id": 1416,
"type": "normal",
"title": "多规格123123",
"subtitle": "多规格",
"weigh": 0,
"category_ids": "46",
"image": "https://demo.shopro.top/uploads/20230821/00e97b4723771626fb44bdbf56d35a73.jpg",
"images": [
"https://demo.shopro.top/uploads/20230823/170a1630b9b3124e28feacd95646b453.png",
"https://demo.shopro.top/uploads/20230823/16f27aeea875d3ff395786ad48f2e38b.png",
"https://demo.shopro.top/uploads/20230821/00e97b4723771626fb44bdbf56d35a73.jpg"
],
"params": null,
"content": "\u003cp\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230821/00e97b4723771626fb44bdbf56d35a73.jpg\" style=\"width: 612px;\"\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230821/da48a8a2595d0efd619984ebd7e22bd9.jpg\" style=\"width: 612px;\"\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230819/8659310afe6e0f2680457c26da4f6d3d.jpg\" style=\"width: 612px;\"\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230819/655d7da134ea4669625007c65f934931.jpg\" style=\"width: 612px;\"\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230819/a6a57d00022b06e5b412dcfc6df06f1d.jpg\" style=\"width: 612px;\"\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230819/8a477ec231722200e268c722f87d95a3.jpg\" style=\"width: 612px;\"\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230818/18889719294b8c8bef913a3bbcc73e60.png\" style=\"width: 612px;\"\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230817/5aea7892240b08ee32e3b47c8b210053.png\" style=\"width: 500px;\"\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230816/f0238ed4eef0068f18f03699c4b8979c.png\" style=\"width: 612px;\"\u003e\u003cimg src=\"https://demo.shopro.top/uploads/20230815/f68d107a4c703780c900c049a65cd47c.jpeg\" style=\"width: 612px;\"\u003e\u003cbr\u003e\u003c/p\u003e",
"price": "11.00",
"original_price": "22.00",
"is_sku": 1,
"likes": 0,
"views": 623,
"sales": 0,
"show_sales": 0,
"total_sales": 4,
"service_ids": "28",
"dispatch_type": "express",
"dispatch_ids": "23",
"deletetime": null,
"activity": {
"id": 0,
"title": "",
"type": "",
"richtext_id": 0,
"richtext_title": "",
"starttime": 0,
"endtime": 0,
"rules": {
"activity_auto_close": "",
"fictitious_num": "",
"is_alone": "",
"is_fictitious": "",
"limit_buy": "",
"order_auto_close": "",
"team_card": "",
"team_num": "",
"valid_time": ""
},
"status_code": ""
},
"activity_type": "",
"buyers": null,
"sku_price": [
{
"id": 2365,
"goods_sku_ids": [
1676,
1679
],
"goods_id": 1416,
"weigh": 0,
"image": "https://demo.shopro.top/uploads/20230819/8659310afe6e0f2680457c26da4f6d3d.jpg",
"stock": 1,
"stock_warning": null,
"sales": 0,
"sn": "",
"weight": 0,
"price": "1.00",
"goods_sku_text": "红色,xl",
"status": "up",
"groupon_price": "",
"activity_type": "",
"activity_id": 0,
"item_goods_sku_price": {
"id": 0,
"activity_id": 0,
"sku_price_id": 0,
"goods_id": 0,
"stock": 0,
"sales": 0,
"price": "",
"status": ""
},
"goods_sku_id_arr": [
"1676",
"1679"
]
},
{
"id": 2366,
"goods_sku_ids": [
1677,
1679
],
"goods_id": 1416,
"weigh": 0,
"image": "",
"stock": 1,
"stock_warning": null,
"sales": 0,
"sn": "",
"weight": 0,
"price": "2.00",
"goods_sku_text": "绿色,xl",
"status": "up",
"groupon_price": "",
"activity_type": "",
"activity_id": 0,
"item_goods_sku_price": {
"id": 0,
"activity_id": 0,
"sku_price_id": 0,
"goods_id": 0,
"stock": 0,
"sales": 0,
"price": "",
"status": ""
},
"goods_sku_id_arr": [
"1677",
"1679"
]
},
{
"id": 2367,
"goods_sku_ids": [
1676,
1680
],
"goods_id": 1416,
"weigh": 0,
"image": "",
"stock": 1,
"stock_warning": null,
"sales": 0,
"sn": "",
"weight": 0,
"price": "3.00",
"goods_sku_text": "红色,m",
"status": "up",
"groupon_price": "",
"activity_type": "",
"activity_id": 0,
"item_goods_sku_price": {
"id": 0,
"activity_id": 0,
"sku_price_id": 0,
"goods_id": 0,
"stock": 0,
"sales": 0,
"price": "",
"status": ""
},
"goods_sku_id_arr": [
"1676",
"1680"
]
},
{
"id": 2368,
"goods_sku_ids": [
1677,
1680
],
"goods_id": 1416,
"weigh": 0,
"image": "",
"stock": 1,
"stock_warning": null,
"sales": 0,
"sn": "",
"weight": 0,
"price": "4.00",
"goods_sku_text": "绿色,m",
"status": "up",
"groupon_price": "",
"activity_type": "",
"activity_id": 0,
"item_goods_sku_price": {
"id": 0,
"activity_id": 0,
"sku_price_id": 0,
"goods_id": 0,
"stock": 0,
"sales": 0,
"price": "",
"status": ""
},
"goods_sku_id_arr": [
"1677",
"1680"
]
}
],
"stock": 1,
"activity_discounts": [
"",
""
],
"activity_discounts_types": "",
"activity_discounts_tags": [],
"favorite": null,
"dispatch_type_arr": [
"express"
],
"service": [
{
"id": 28,
"name": "免费包邮",
"image": "https://demo.shopro.top/uploads/20230710/f7f6bf60f2898f583bbe09acd221d9f1.png",
"description": "123"
}
],
"sku": null,
"coupons": null,
"groupon_price": ""
}

@ -0,0 +1,226 @@
{
"id": 1416,
"type": "normal",
"title": "多规格",
"subtitle": "多规格",
"weigh": 0,
"category_ids": "46",
"image": "https://demo.shopro.top/uploads/20230821/00e97b4723771626fb44bdbf56d35a73.jpg",
"images": [
"https://demo.shopro.top/uploads/20230823/170a1630b9b3124e28feacd95646b453.png",
"https://demo.shopro.top/uploads/20230823/16f27aeea875d3ff395786ad48f2e38b.png",
"https://demo.shopro.top/uploads/20230821/00e97b4723771626fb44bdbf56d35a73.jpg"
],
"params": [],
"content": "<p><img src=\"https://demo.shopro.top/uploads/20230821/00e97b4723771626fb44bdbf56d35a73.jpg\" style=\"width: 612px;\"><img src=\"https://demo.shopro.top/uploads/20230821/da48a8a2595d0efd619984ebd7e22bd9.jpg\" style=\"width: 612px;\"><img src=\"https://demo.shopro.top/uploads/20230819/8659310afe6e0f2680457c26da4f6d3d.jpg\" style=\"width: 612px;\"><img src=\"https://demo.shopro.top/uploads/20230819/655d7da134ea4669625007c65f934931.jpg\" style=\"width: 612px;\"><img src=\"https://demo.shopro.top/uploads/20230819/a6a57d00022b06e5b412dcfc6df06f1d.jpg\" style=\"width: 612px;\"><img src=\"https://demo.shopro.top/uploads/20230819/8a477ec231722200e268c722f87d95a3.jpg\" style=\"width: 612px;\"><img src=\"https://demo.shopro.top/uploads/20230818/18889719294b8c8bef913a3bbcc73e60.png\" style=\"width: 612px;\"><img src=\"https://demo.shopro.top/uploads/20230817/5aea7892240b08ee32e3b47c8b210053.png\" style=\"width: 500px;\"><img src=\"https://demo.shopro.top/uploads/20230816/f0238ed4eef0068f18f03699c4b8979c.png\" style=\"width: 612px;\"><img src=\"https://demo.shopro.top/uploads/20230815/f68d107a4c703780c900c049a65cd47c.jpeg\" style=\"width: 612px;\"><br></p>",
"price": "11",
"original_price": "22.00",
"is_sku": 1,
"likes": 0,
"views": 631,
"sales": 0,
"show_sales": 0,
"service_ids": "28",
"dispatch_type": "express",
"dispatch_ids": "23",
"deletetime": null,
"activity": null,
"activity_type": null,
"buyers": [],
"sku_price": [
{
"id": 2365,
"goods_sku_ids": "1676,1679",
"goods_id": 1416,
"weigh": 0,
"image": "https://demo.shopro.top/uploads/20230819/8659310afe6e0f2680457c26da4f6d3d.jpg",
"stock": 1,
"stock_warning": null,
"sales": 0,
"sn": "",
"weight": 0,
"price": "1.00",
"goods_sku_text": "红色,xl",
"status": "up",
"goods_sku_id_arr": [
"1676",
"1679"
]
},
{
"id": 2366,
"goods_sku_ids": "1677,1679",
"goods_id": 1416,
"weigh": 0,
"image": "",
"stock": 1,
"stock_warning": null,
"sales": 0,
"sn": "",
"weight": 0,
"price": "2.00",
"goods_sku_text": "绿色,xl",
"status": "up",
"goods_sku_id_arr": [
"1677",
"1679"
]
},
{
"id": 2367,
"goods_sku_ids": "1676,1680",
"goods_id": 1416,
"weigh": 0,
"image": "",
"stock": 1,
"stock_warning": null,
"sales": 0,
"sn": "",
"weight": 0,
"price": "3.00",
"goods_sku_text": "红色,m",
"status": "up",
"goods_sku_id_arr": [
"1676",
"1680"
]
},
{
"id": 2368,
"goods_sku_ids": "1677,1680",
"goods_id": 1416,
"weigh": 0,
"image": "",
"stock": 1,
"stock_warning": null,
"sales": 0,
"sn": "",
"weight": 0,
"price": "4.00",
"goods_sku_text": "绿色,m",
"status": "up",
"goods_sku_id_arr": [
"1677",
"1680"
]
}
],
"stock": 4,
"activity_discounts": [],
"activity_discounts_types": "",
"activity_discounts_tags": [],
"favorite": null,
"dispatch_type_arr": [
"express"
],
"service": [
{
"id": 28,
"name": "免费包邮",
"image": "https://demo.shopro.top/uploads/20230710/f7f6bf60f2898f583bbe09acd221d9f1.png",
"description": "123"
}
],
"sku": [
{
"id": 1675,
"name": "颜色",
"pid": 0,
"goods_id": 1416,
"weigh": 0,
"content": [
{
"id": 1676,
"name": "红色",
"pid": 1675,
"goods_id": 1416,
"weigh": 0
},
{
"id": 1677,
"name": "绿色",
"pid": 1675,
"goods_id": 1416,
"weigh": 0
}
]
},
{
"id": 1678,
"name": "尺码",
"pid": 0,
"goods_id": 1416,
"weigh": 0,
"content": [
{
"id": 1679,
"name": "xl",
"pid": 1678,
"goods_id": 1416,
"weigh": 0
},
{
"id": 1680,
"name": "m",
"pid": 1678,
"goods_id": 1416,
"weigh": 0
}
]
}
],
"coupons": [
{
"id": 35,
"name": "新人优惠券",
"type": "cash",
"goods_ids": "0",
"amount": "10.00",
"enough": "100.00",
"stock": 999760,
"limit": 1,
"gettime": {
"start": 1665849600,
"end": 1732896000
},
"usetime": {
"start": 1732896000,
"end": 1764345600
},
"description": "新人可领asdfasd",
"usetimestart": 1732896000,
"usetimeend": 1764345600,
"gettimestart": 1665849600,
"gettimeend": 1732896000,
"status_code": "can_get",
"status_name": "可以领取",
"user_coupons": []
},
{
"id": 83,
"name": "111",
"type": "cash",
"goods_ids": "0",
"amount": "5.00",
"enough": "10.00",
"stock": 99992,
"limit": 1,
"gettime": {
"start": 1699200000,
"end": 1703520000
},
"usetime": {
"start": 1699200000,
"end": 1703692800
},
"description": "1",
"usetimestart": 1699200000,
"usetimeend": 1703692800,
"gettimestart": 1699200000,
"gettimeend": 1703520000,
"status_code": "can_get",
"status_name": "可以领取",
"user_coupons": []
}
]
}

File diff suppressed because it is too large Load Diff

@ -8,3 +8,5 @@ import _ "src/module/skuPrice"
import _ "src/module/activity"
import _ "src/module/itemGoodsSkuPrice"
import _ "src/module/good_category_re"
import _ "src/module/sku"
import _ "src/module/address"

@ -0,0 +1,34 @@
package address
func (Address) TableName() string {
return "address"
}
func (Area) TableName() string {
return "area"
}
// Address 表示用户的地址信息
type Address struct {
ID int64 `json:"id"` // 地址的唯一标识符
IsDefault string `json:"is_default"` // 是否为默认地址1表示是0表示否
UserID int64 `json:"user_id"` // 关联用户的ID
Consignee string `json:"consignee"` // 收货人姓名
Phone string `json:"phone"` // 联系电话
ProvinceName string `json:"province_name"` // 省份名称
CityName string `json:"city_name"` // 城市名称
AreaName string `json:"area_name"` // 区域名称
Address string `json:"address"` // 详细地址
ProvinceID int64 `json:"province_id"` // 省份ID
CityID int64 `json:"city_id"` // 城市ID
AreaID int64 `json:"area_id"` // 区域ID
Latitude float64 `json:"latitude"` // 纬度
Longitude float64 `json:"longitude"` // 经度
}
// Area 表示地区信息
type Area struct {
Value int64 `json:"value"` // 地区值
Label string `json:"label"` // 地区标签
PID int64 `json:"pid"` // 上级地区的值
Level int64 `json:"level"` // 地区级别
}

@ -0,0 +1,24 @@
package address
import (
"github.com/towgo/towgo/dao/ormDriver/xormDriver"
"github.com/towgo/towgo/towgo"
)
func init() {
xormDriver.Sync2(new(Address), new(Area))
towgo.NewCRUDJsonrpcAPI("/address", Address{}, []Address{}).RegAPI()
towgo.NewCRUDJsonrpcAPI("/area", Area{}, []Area{}).RegAPI()
//towgo.SetFunc("/area", AreaInfo)
}
type AreaResult struct {
AreaData [][][]Area `json:"areaData"`
CityData [][]Area `json:"cityData"`
ProvinceData []Area `json:"provinceData"`
}
/*func AreaInfo(rpc towgo.JsonRpcConnection) {
}
*/

@ -7,6 +7,7 @@ import (
coupon "src/module/coupon"
"src/module/good_category_re"
service "src/module/service"
"src/module/sku"
skuPrice "src/module/skuPrice"
"strconv"
"strings"
@ -51,7 +52,7 @@ type Goods struct {
Favorite interface{} `json:"favorite"` // 收藏
DispatchTypeArr []string `json:"dispatch_type_arr"` // 派送类型数组
Service []service.Service `json:"service" xorm:"-"` // 服务列表
SKU []string `json:"sku"` // SKU列表
SKU []sku.SKU `json:"sku" xorm:"-"` // SKU列表
Coupons []coupon.Coupon `json:"coupons" xorm:"-"` // 优惠券列表
GrouponPrice string `json:"groupon_price"` // 团购价
}
@ -61,8 +62,8 @@ type Param struct {
}
func (good *Goods) AfterQuery(session basedboperat.DbTransactionSession) error {
var skus []skuPrice.SKUPrice
var sku skuPrice.SKUPrice
var skuPrices []skuPrice.SKUPrice
var skuPrice skuPrice.SKUPrice
var list basedboperat.List
list.Limit = -1
list.Where = append(list.Where, basedboperat.Condition{
@ -70,12 +71,12 @@ func (good *Goods) AfterQuery(session basedboperat.DbTransactionSession) error {
Operator: "=",
Value: good.ID,
})
session.ListScan(&list, &sku, &skus) // 传递切片的指针
good.SKUPrice = skus
session.ListScan(&list, &skuPrice, &skuPrices) // 传递切片的指针
good.SKUPrice = skuPrices
if len(skus) > 0 {
if len(skuPrices) > 0 {
var a activity.Activity
for _, v := range skus {
for _, v := range skuPrices {
if v.ActivityId != 0 {
err := session.Get(&a, nil, "id = ?", v.ActivityId)
if err != nil {
@ -125,6 +126,23 @@ func (good *Goods) AfterQuery(session basedboperat.DbTransactionSession) error {
}
good.CategoryIds = result
var skus []sku.SKU
var skud sku.SKU
var listSku basedboperat.List
listSku.Limit = -1
listSku.Where = append(listSku.Where, basedboperat.Condition{
Field: "goods_id",
Operator: "=",
Value: good.ID,
})
listSku.Where = append(listSku.Where, basedboperat.Condition{
Field: "pid",
Operator: "=",
Value: 0,
})
session.ListScan(&listSku, &skud, &skus)
good.SKU = skus
/* var cs []coupon.Coupon
var c coupon.Coupon
var list2 basedboperat.List

@ -0,0 +1,104 @@
package order
func (Order) TableName() string {
return "order"
}
// Order 表示订单信息
type Order struct {
ID int64 `json:"id"` // 订单ID
Type string `json:"type"` // 订单类型
OrderSN string `json:"order_sn"` // 订单编号
UserID int64 `json:"user_id"` // 用户ID
ActivityType string `json:"activity_type"` // 活动类型
GoodsAmount string `json:"goods_amount"` // 商品金额
DispatchAmount string `json:"dispatch_amount"` // 配送费用
Phone string `json:"phone"` // 联系电话
Consignee string `json:"consignee"` // 收货人
ProvinceName string `json:"province_name"` // 省份名称
CityName string `json:"city_name"` // 城市名称
AreaName string `json:"area_name"` // 区域名称
Address string `json:"address"` // 收货地址
ProvinceID int64 `json:"province_id"` // 省份ID
CityID int64 `json:"city_id"` // 城市ID
AreaID int64 `json:"area_id"` // 区域ID
Status int64 `json:"status"` // 订单状态
InvoiceStatus string `json:"invoice_status"` // 发票状态
Memo string `json:"memo"` // 备注
Remark string `json:"remark"` // 备注
TotalAmount string `json:"total_amount"` // 订单总金额
ScoreAmount int64 `json:"score_amount"` // 积分金额
TotalFee string `json:"total_fee"` // 总费用
LastTotalFee string `json:"last_total_fee"` // 最终总费用
DiscountFee string `json:"discount_fee"` // 折扣金额
CouponFee string `json:"coupon_fee"` // 优惠券金额
ActivityDiscountMoney string `json:"activity_discount_money"` // 活动折扣金额
DispatchDiscountMoney string `json:"dispatch_discount_money"` // 配送折扣金额
PayFee string `json:"pay_fee"` // 支付费用
ScoreFee int64 `json:"score_fee"` // 积分费用
GoodsOriginalAmount string `json:"goods_original_amount"` // 商品原始金额
CouponsID int64 `json:"coupons_id"` // 优惠券ID
TransactionID string `json:"transaction_id"` // 交易ID
PaymentJSON string `json:"payment_json"` // 支付信息JSON
PayType string `json:"pay_type"` // 支付类型
Paytime int64 `json:"paytime"` // 支付时间
Ext string `json:"ext"` // 扩展信息
Platform string `json:"platform"` // 平台
Createtime int64 `json:"createtime"` // 创建时间
Item []OrderItem `json:"item"` // 订单项列表
StatusCode string `json:"status_code"` // 状态编码
StatusName string `json:"status_name"` // 状态名称
StatusDesc string `json:"status_desc"` // 状态描述
Btns []string `json:"btns"` // 按钮列表
ExtArr []ExtArr `json:"ext_arr"` // 扩展信息数组
}
type ExtArr struct {
BuyType string `json:"buy_type"`
GrouponId int64 `json:"groupon_id"`
ExpiredTime int64 `json:"expired_time"`
}
// OrderItem 表示订单项信息
type OrderItem struct {
ID int64 `json:"id"` // 订单项ID
UserID int64 `json:"user_id"` // 用户ID
OrderID int64 `json:"order_id"` // 订单ID
GoodsID int64 `json:"goods_id"` // 商品ID
GoodsType string `json:"goods_type"` // 商品类型
GoodsSkuPriceID int64 `json:"goods_sku_price_id"` // 商品SKU价格ID
ActivityID int64 `json:"activity_id"` // 活动ID
ActivityType string `json:"activity_type"` // 活动类型
ItemGoodsSkuPriceID int64 `json:"item_goods_sku_price_id"` // 订单项商品SKU价格ID
GoodsSkuText string `json:"goods_sku_text"` // 商品SKU文本
GoodsTitle string `json:"goods_title"` // 商品标题
GoodsImage string `json:"goods_image"` // 商品图片
GoodsOriginalPrice string `json:"goods_original_price"` // 商品原始价格
DiscountFee string `json:"discount_fee"` // 折扣金额
GoodsPrice string `json:"goods_price"` // 商品价格
GoodsNum int64 `json:"goods_num"` // 商品数量
GoodsWeight int64 `json:"goods_weight"` // 商品重量
PayPrice string `json:"pay_price"` // 支付价格
DispatchStatus int64 `json:"dispatch_status"` // 配送状态
DispatchFee string `json:"dispatch_fee"` // 配送费用
DispatchType string `json:"dispatch_type"` // 配送类型
DispatchID int64 `json:"dispatch_id"` // 配送ID
StoreID int64 `json:"store_id"` // 店铺ID
AftersaleStatus int64 `json:"aftersale_status"` // 售后状态
CommentStatus int64 `json:"comment_status"` // 评论状态
RefundStatus int64 `json:"refund_status"` // 退款状态
RefundFee string `json:"refund_fee"` // 退款费用
RefundMsg string `json:"refund_msg"` // 退款消息
ExpressName string `json:"express_name"` // 快递公司名称
ExpressCode string `json:"express_code"` // 快递公司代码
ExpressNo string `json:"express_no"` // 快递单号
Ext string `json:"ext"` // 扩展信息
Createtime int64 `json:"createtime"` // 创建时间
Updatetime int64 `json:"updatetime"` // 更新时间
StatusCode string `json:"status_code"` // 状态编码
StatusName string `json:"status_name"` // 状态名称
StatusDesc string `json:"status_desc"` // 状态描述
Btns []string `json:"btns"` // 按钮列表
ExtArr []ExtArr `json:"ext_arr"` // 扩展信息数组
StatusText string `json:"status_text"` // 状态文本
}

@ -0,0 +1,35 @@
package sku
import "github.com/towgo/towgo/dao/basedboperat"
func (SKU) TableName() string {
return "sku"
}
// SKU 表示SKU属性
type SKU struct {
ID int64 `json:"id"` // SKU的唯一标识符
Name string `json:"name"` // SKU的名称
PID int64 `json:"pid"` // 父ID表示SKU属性
GoodsID int64 `json:"goods_id"` // 关联商品的ID
Weigh int64 `json:"weigh"` // SKU的权重
Content []SKU `json:"content" xorm:"-"` // SKU内容列表
}
func (sku *SKU) AfterQuery(session basedboperat.DbTransactionSession) error {
var qSku SKU
var qSkus []SKU
var listSkus basedboperat.List
listSkus.Limit = -1
listSkus.Where = append(listSkus.Where, basedboperat.Condition{
Field: "pid",
Operator: "=",
Value: sku.ID,
})
session.ListScan(&listSkus, &qSku, &qSkus)
sku.Content = qSkus
return nil
}

@ -0,0 +1,12 @@
package sku
import (
"github.com/towgo/towgo/dao/ormDriver/xormDriver"
"github.com/towgo/towgo/towgo"
)
func init() {
xormDriver.Sync2(new(SKU))
towgo.NewCRUDJsonrpcAPI("/sku", SKU{}, []SKU{}).RegAPI()
}
Loading…
Cancel
Save