From c1991351cf194d3f12e92bfd82130c420b84e61b Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Fri, 15 Sep 2023 11:20:49 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A1=A8=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fs_cloud_deliver_every_tmp_old_gen.go | 23 ++++++++ .../fs_cloud_deliver_every_tmp_old_logic.go | 2 + model/gmodel/fs_cloud_deliver_tmp_old_gen.go | 28 ++++++++++ .../gmodel/fs_cloud_deliver_tmp_old_logic.go | 2 + model/gmodel/fs_cloud_old_gen.go | 20 +++++++ model/gmodel/fs_cloud_old_logic.go | 2 + .../gmodel/fs_cloud_pick_up_detail_old_gen.go | 23 ++++++++ .../fs_cloud_pick_up_detail_old_logic.go | 2 + model/gmodel/fs_cloud_pick_up_old_gen.go | 28 ++++++++++ model/gmodel/fs_cloud_pick_up_old_logic.go | 2 + .../gmodel/fs_cloud_receive_every_old_gen.go | 22 ++++++++ .../fs_cloud_receive_every_old_logic.go | 2 + model/gmodel/fs_cloud_receive_old_gen.go | 26 +++++++++ model/gmodel/fs_cloud_receive_old_logic.go | 2 + model/gmodel/fs_cloud_render_log_old_gen.go | 26 +++++++++ model/gmodel/fs_cloud_render_log_old_logic.go | 2 + .../fs_cloud_user_apply_back_old_gen.go | 25 +++++++++ .../fs_cloud_user_apply_back_old_logic.go | 2 + model/gmodel/fs_order_affiliate_old_gen.go | 27 ++++++++++ model/gmodel/fs_order_affiliate_old_logic.go | 2 + model/gmodel/fs_order_detail_old_gen.go | 41 ++++++++++++++ model/gmodel/fs_order_detail_old_logic.go | 2 + .../fs_order_detail_template_old_gen.go | 28 ++++++++++ .../fs_order_detail_template_old_logic.go | 2 + model/gmodel/fs_order_gen.go | 47 ++++------------ model/gmodel/fs_order_old_gen.go | 54 +++++++++++++++++++ model/gmodel/fs_order_old_logic.go | 2 + model/gmodel/fs_order_remark_old_gen.go | 22 ++++++++ model/gmodel/fs_order_remark_old_logic.go | 2 + model/gmodel/fs_order_trade_event_gen.go | 25 +++++++++ model/gmodel/fs_order_trade_event_logic.go | 2 + model/gmodel/fs_order_trade_gen.go | 36 +++++++++++++ model/gmodel/fs_order_trade_logic.go | 2 + model/gmodel/fs_shopping_cart_gen.go | 2 - model/gmodel/var_gen.go | 40 +++++++++++--- 35 files changed, 529 insertions(+), 46 deletions(-) create mode 100644 model/gmodel/fs_cloud_deliver_every_tmp_old_gen.go create mode 100644 model/gmodel/fs_cloud_deliver_every_tmp_old_logic.go create mode 100644 model/gmodel/fs_cloud_deliver_tmp_old_gen.go create mode 100644 model/gmodel/fs_cloud_deliver_tmp_old_logic.go create mode 100644 model/gmodel/fs_cloud_old_gen.go create mode 100644 model/gmodel/fs_cloud_old_logic.go create mode 100644 model/gmodel/fs_cloud_pick_up_detail_old_gen.go create mode 100644 model/gmodel/fs_cloud_pick_up_detail_old_logic.go create mode 100644 model/gmodel/fs_cloud_pick_up_old_gen.go create mode 100644 model/gmodel/fs_cloud_pick_up_old_logic.go create mode 100644 model/gmodel/fs_cloud_receive_every_old_gen.go create mode 100644 model/gmodel/fs_cloud_receive_every_old_logic.go create mode 100644 model/gmodel/fs_cloud_receive_old_gen.go create mode 100644 model/gmodel/fs_cloud_receive_old_logic.go create mode 100644 model/gmodel/fs_cloud_render_log_old_gen.go create mode 100644 model/gmodel/fs_cloud_render_log_old_logic.go create mode 100644 model/gmodel/fs_cloud_user_apply_back_old_gen.go create mode 100644 model/gmodel/fs_cloud_user_apply_back_old_logic.go create mode 100644 model/gmodel/fs_order_affiliate_old_gen.go create mode 100644 model/gmodel/fs_order_affiliate_old_logic.go create mode 100644 model/gmodel/fs_order_detail_old_gen.go create mode 100644 model/gmodel/fs_order_detail_old_logic.go create mode 100644 model/gmodel/fs_order_detail_template_old_gen.go create mode 100644 model/gmodel/fs_order_detail_template_old_logic.go create mode 100644 model/gmodel/fs_order_old_gen.go create mode 100644 model/gmodel/fs_order_old_logic.go create mode 100644 model/gmodel/fs_order_remark_old_gen.go create mode 100644 model/gmodel/fs_order_remark_old_logic.go create mode 100644 model/gmodel/fs_order_trade_event_gen.go create mode 100644 model/gmodel/fs_order_trade_event_logic.go create mode 100644 model/gmodel/fs_order_trade_gen.go create mode 100644 model/gmodel/fs_order_trade_logic.go diff --git a/model/gmodel/fs_cloud_deliver_every_tmp_old_gen.go b/model/gmodel/fs_cloud_deliver_every_tmp_old_gen.go new file mode 100644 index 00000000..3fd8ba80 --- /dev/null +++ b/model/gmodel/fs_cloud_deliver_every_tmp_old_gen.go @@ -0,0 +1,23 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_cloud_deliver_every_tmp_old +type FsCloudDeliverEveryTmpOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + AdminId *int64 `gorm:"default:0;" json:"admin_id"` // 管理员 + CloudId *int64 `gorm:"default:0;" json:"cloud_id"` // 云仓ID 暂且只有一个默认为 1 + OrderDetailTemplateSn *string `gorm:"default:'';" json:"order_detail_template_sn"` // + Num *int64 `gorm:"default:0;" json:"num"` // 发货数量 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 +} +type FsCloudDeliverEveryTmpOldModel struct { + db *gorm.DB + name string +} + +func NewFsCloudDeliverEveryTmpOldModel(db *gorm.DB) *FsCloudDeliverEveryTmpOldModel { + return &FsCloudDeliverEveryTmpOldModel{db: db, name: "fs_cloud_deliver_every_tmp_old"} +} diff --git a/model/gmodel/fs_cloud_deliver_every_tmp_old_logic.go b/model/gmodel/fs_cloud_deliver_every_tmp_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_cloud_deliver_every_tmp_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_cloud_deliver_tmp_old_gen.go b/model/gmodel/fs_cloud_deliver_tmp_old_gen.go new file mode 100644 index 00000000..a7711947 --- /dev/null +++ b/model/gmodel/fs_cloud_deliver_tmp_old_gen.go @@ -0,0 +1,28 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_cloud_deliver_tmp_old +type FsCloudDeliverTmpOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id + CloudId *int64 `gorm:"default:0;" json:"cloud_id"` // 云仓id + UserId *int64 `gorm:"default:0;" json:"user_id"` // 用户id + AdminId *int64 `gorm:"default:0;" json:"admin_id"` // 操作员id + DeliveryType *int64 `gorm:"default:1;" json:"delivery_type"` // 发货公司 之后配置,默认1 + Fee *int64 `gorm:"default:0;" json:"fee"` // 价格 + AddressId *int64 `gorm:"default:0;" json:"address_id"` // 地址 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 创建时间 + IsDeliver *int64 `gorm:"default:0;" json:"is_deliver"` // 0未发货,1已发货 + IsEnd *int64 `gorm:"default:0;" json:"is_end"` // 0未完成,1已完成 + DeliverId *int64 `gorm:"default:0;" json:"deliver_id"` // 发货总表id +} +type FsCloudDeliverTmpOldModel struct { + db *gorm.DB + name string +} + +func NewFsCloudDeliverTmpOldModel(db *gorm.DB) *FsCloudDeliverTmpOldModel { + return &FsCloudDeliverTmpOldModel{db: db, name: "fs_cloud_deliver_tmp_old"} +} diff --git a/model/gmodel/fs_cloud_deliver_tmp_old_logic.go b/model/gmodel/fs_cloud_deliver_tmp_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_cloud_deliver_tmp_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_cloud_old_gen.go b/model/gmodel/fs_cloud_old_gen.go new file mode 100644 index 00000000..8048d159 --- /dev/null +++ b/model/gmodel/fs_cloud_old_gen.go @@ -0,0 +1,20 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_cloud_old 云仓表 +type FsCloudOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id + Address *string `gorm:"default:'';" json:"address"` // 云仓地址 + Title *string `gorm:"default:'';" json:"title"` // 云仓名称 +} +type FsCloudOldModel struct { + db *gorm.DB + name string +} + +func NewFsCloudOldModel(db *gorm.DB) *FsCloudOldModel { + return &FsCloudOldModel{db: db, name: "fs_cloud_old"} +} diff --git a/model/gmodel/fs_cloud_old_logic.go b/model/gmodel/fs_cloud_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_cloud_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_cloud_pick_up_detail_old_gen.go b/model/gmodel/fs_cloud_pick_up_detail_old_gen.go new file mode 100644 index 00000000..c891ce19 --- /dev/null +++ b/model/gmodel/fs_cloud_pick_up_detail_old_gen.go @@ -0,0 +1,23 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_cloud_pick_up_detail_old 云仓提货单-详情 +type FsCloudPickUpDetailOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // Id + PickId *int64 `gorm:"index;default:0;" json:"pick_id"` // 提货单id + StockId *int64 `gorm:"default:0;" json:"stock_id"` // 用户云仓记录id + Num *int64 `gorm:"default:0;" json:"num"` // 提取数量 + Boxes *int64 `gorm:"default:0;" json:"boxes"` // 提取箱数 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 +} +type FsCloudPickUpDetailOldModel struct { + db *gorm.DB + name string +} + +func NewFsCloudPickUpDetailOldModel(db *gorm.DB) *FsCloudPickUpDetailOldModel { + return &FsCloudPickUpDetailOldModel{db: db, name: "fs_cloud_pick_up_detail_old"} +} diff --git a/model/gmodel/fs_cloud_pick_up_detail_old_logic.go b/model/gmodel/fs_cloud_pick_up_detail_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_cloud_pick_up_detail_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_cloud_pick_up_old_gen.go b/model/gmodel/fs_cloud_pick_up_old_gen.go new file mode 100644 index 00000000..68f2b758 --- /dev/null +++ b/model/gmodel/fs_cloud_pick_up_old_gen.go @@ -0,0 +1,28 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_cloud_pick_up_old 云仓提货单 +type FsCloudPickUpOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // Id + UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户id + TrackNum *string `gorm:"default:'';" json:"track_num"` // 运输号 + AddressId *int64 `gorm:"default:0;" json:"address_id"` // 地址id + AddressInfo *string `gorm:"default:'';" json:"address_info"` // 地址信息 json + Status *int64 `gorm:"default:0;" json:"status"` // 运输状态 1 draw 2shipping 3ups 4arrival + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 + ShippingTime *int64 `gorm:"default:0;" json:"shipping_time"` // 发货时间 + UpsTime *int64 `gorm:"default:0;" json:"ups_time"` // 提货时间 + ArrivalTime *int64 `gorm:"default:0;" json:"arrival_time"` // 到达时间 + UpsSn *string `gorm:"default:'';" json:"ups_sn"` // 运输单号 +} +type FsCloudPickUpOldModel struct { + db *gorm.DB + name string +} + +func NewFsCloudPickUpOldModel(db *gorm.DB) *FsCloudPickUpOldModel { + return &FsCloudPickUpOldModel{db: db, name: "fs_cloud_pick_up_old"} +} diff --git a/model/gmodel/fs_cloud_pick_up_old_logic.go b/model/gmodel/fs_cloud_pick_up_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_cloud_pick_up_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_cloud_receive_every_old_gen.go b/model/gmodel/fs_cloud_receive_every_old_gen.go new file mode 100644 index 00000000..436f9037 --- /dev/null +++ b/model/gmodel/fs_cloud_receive_every_old_gen.go @@ -0,0 +1,22 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_cloud_receive_every_old +type FsCloudReceiveEveryOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + DeliveryId *int64 `gorm:"index;default:0;" json:"delivery_id"` // 云仓收货单id + OrderDetailTemplateSn *string `gorm:"index;default:'';" json:"order_detail_template_sn"` // + Num *int64 `gorm:"default:0;" json:"num"` // 收到的数量 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 +} +type FsCloudReceiveEveryOldModel struct { + db *gorm.DB + name string +} + +func NewFsCloudReceiveEveryOldModel(db *gorm.DB) *FsCloudReceiveEveryOldModel { + return &FsCloudReceiveEveryOldModel{db: db, name: "fs_cloud_receive_every_old"} +} diff --git a/model/gmodel/fs_cloud_receive_every_old_logic.go b/model/gmodel/fs_cloud_receive_every_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_cloud_receive_every_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_cloud_receive_old_gen.go b/model/gmodel/fs_cloud_receive_old_gen.go new file mode 100644 index 00000000..224d29f6 --- /dev/null +++ b/model/gmodel/fs_cloud_receive_old_gen.go @@ -0,0 +1,26 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_cloud_receive_old 云仓接收工厂总单 +type FsCloudReceiveOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + CloudId *int64 `gorm:"index;default:0;" json:"cloud_id"` // 入库云仓id + AdminId *int64 `gorm:"index;default:0;" json:"admin_id"` // 操作员id + UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户id + OrderId *int64 `gorm:"index;default:0;" json:"order_id"` // 入库云仓的订单 + Fee *int64 `gorm:"default:0;" json:"fee"` // 运费 + Delivery *string `gorm:"default:'';" json:"delivery"` // + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 创建时间 + Status *int64 `gorm:"default:0;" json:"status"` // 0未收到 1收到 +} +type FsCloudReceiveOldModel struct { + db *gorm.DB + name string +} + +func NewFsCloudReceiveOldModel(db *gorm.DB) *FsCloudReceiveOldModel { + return &FsCloudReceiveOldModel{db: db, name: "fs_cloud_receive_old"} +} diff --git a/model/gmodel/fs_cloud_receive_old_logic.go b/model/gmodel/fs_cloud_receive_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_cloud_receive_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_cloud_render_log_old_gen.go b/model/gmodel/fs_cloud_render_log_old_gen.go new file mode 100644 index 00000000..3abb9c33 --- /dev/null +++ b/model/gmodel/fs_cloud_render_log_old_gen.go @@ -0,0 +1,26 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_cloud_render_log_old 云渲染日志表 +type FsCloudRenderLogOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID + UserId *int64 `gorm:"default:0;" json:"user_id"` // 用户id + PostData *string `gorm:"default:'';" json:"post_data"` // + PostUrl *string `gorm:"default:'';" json:"post_url"` // + Title *string `gorm:"index;default:'';" json:"title"` // + Time *int64 `gorm:"default:0;" json:"time"` // 所用时间 + Result *string `gorm:"default:'';" json:"result"` // + Tag *string `gorm:"index;default:'';" json:"tag"` // 标识 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 +} +type FsCloudRenderLogOldModel struct { + db *gorm.DB + name string +} + +func NewFsCloudRenderLogOldModel(db *gorm.DB) *FsCloudRenderLogOldModel { + return &FsCloudRenderLogOldModel{db: db, name: "fs_cloud_render_log_old"} +} diff --git a/model/gmodel/fs_cloud_render_log_old_logic.go b/model/gmodel/fs_cloud_render_log_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_cloud_render_log_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_cloud_user_apply_back_old_gen.go b/model/gmodel/fs_cloud_user_apply_back_old_gen.go new file mode 100644 index 00000000..9c7f2dd7 --- /dev/null +++ b/model/gmodel/fs_cloud_user_apply_back_old_gen.go @@ -0,0 +1,25 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_cloud_user_apply_back_old 该表废弃 +type FsCloudUserApplyBackOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + UserHash *string `gorm:"default:'';" json:"user_hash"` // + OrderDetailTemplateId *int64 `gorm:"default:0;" json:"order_detail_template_id"` // 详情modelID + Num *int64 `gorm:"default:0;" json:"num"` // 发货数量 + AddressTo *string `gorm:"default:'';" json:"address_to"` // 收获地址 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 + StorageFee *int64 `gorm:"default:0;" json:"storage_fee"` // 存储费用 + Status *int64 `gorm:"default:0;" json:"status"` // 状态位 是否已发货 是否处理 是否删除 是否推送 +} +type FsCloudUserApplyBackOldModel struct { + db *gorm.DB + name string +} + +func NewFsCloudUserApplyBackOldModel(db *gorm.DB) *FsCloudUserApplyBackOldModel { + return &FsCloudUserApplyBackOldModel{db: db, name: "fs_cloud_user_apply_back_old"} +} diff --git a/model/gmodel/fs_cloud_user_apply_back_old_logic.go b/model/gmodel/fs_cloud_user_apply_back_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_cloud_user_apply_back_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_order_affiliate_old_gen.go b/model/gmodel/fs_order_affiliate_old_gen.go new file mode 100644 index 00000000..4149fe3f --- /dev/null +++ b/model/gmodel/fs_order_affiliate_old_gen.go @@ -0,0 +1,27 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_order_affiliate_old 订单附属表-流程控制时间等 +type FsOrderAffiliateOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id + OrderId *int64 `gorm:"unique_key;default:0;" json:"order_id"` // 订单id + SureTime *int64 `gorm:"default:0;" json:"sure_time"` // 确认时间 + ProductTime *int64 `gorm:"default:0;" json:"product_time"` // 生产时间 + ProductEndtime *int64 `gorm:"default:0;" json:"product_endtime"` // 生成完成时间 + DeliverTime *int64 `gorm:"default:0;" json:"deliver_time"` // 发货时间 + UpsDeliverTime *int64 `gorm:"default:0;" json:"ups_deliver_time"` // ups发货时间 + UpsTime *int64 `gorm:"default:0;" json:"ups_time"` // UPS提货时间 + ArrivalTime *int64 `gorm:"default:0;" json:"arrival_time"` // 到达云仓的时间 + RecevieTime *int64 `gorm:"default:0;" json:"recevie_time"` // 云仓收货时间 +} +type FsOrderAffiliateOldModel struct { + db *gorm.DB + name string +} + +func NewFsOrderAffiliateOldModel(db *gorm.DB) *FsOrderAffiliateOldModel { + return &FsOrderAffiliateOldModel{db: db, name: "fs_order_affiliate_old"} +} diff --git a/model/gmodel/fs_order_affiliate_old_logic.go b/model/gmodel/fs_order_affiliate_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_order_affiliate_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_order_detail_old_gen.go b/model/gmodel/fs_order_detail_old_gen.go new file mode 100644 index 00000000..afc7c20f --- /dev/null +++ b/model/gmodel/fs_order_detail_old_gen.go @@ -0,0 +1,41 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_order_detail_old 订单详细表 +type FsOrderDetailOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + Sn *string `gorm:"unique_key;default:'';" json:"sn"` // 唯一编码 + OrderId *int64 `gorm:"index;default:0;" json:"order_id"` // 订单ID + UserId *int64 `gorm:"default:0;" json:"user_id"` // 用户ID + FactoryId *int64 `gorm:"default:0;" json:"factory_id"` // 工厂ID + OrderDetailTemplateId *int64 `gorm:"default:0;" json:"order_detail_template_id"` // 详情templateID + ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品ID + BuyNum *int64 `gorm:"default:0;" json:"buy_num"` // 购买数量 + PushNum *int64 `gorm:"default:0;" json:"push_num"` // 已发数量 + Amount *int64 `gorm:"default:0;" json:"amount"` // 单价 + Cover *string `gorm:"default:'';" json:"cover"` // 截图 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 + Status *int64 `gorm:"default:0;" json:"status"` // 状态位 是否推送到厂家 是否生产完成 是否发货完成 + OptionalId *int64 `gorm:"default:0;" json:"optional_id"` // 选项ID + OptionalTitle *string `gorm:"default:'';" json:"optional_title"` // 选项名称 + OptionPrice *int64 `gorm:"default:0;" json:"option_price"` // 配件价格 + IsTofactory *int64 `gorm:"default:0;" json:"is_tofactory"` // 是否推送到工厂 + IsProduct *int64 `gorm:"default:0;" json:"is_product"` // 是否生产中 + IsProductCompletion *int64 `gorm:"default:0;" json:"is_product_completion"` // 是否生产完成 + IsCloud *int64 `gorm:"default:0;" json:"is_cloud"` // 是否是云仓订单 + IsTocloud *int64 `gorm:"default:0;" json:"is_tocloud"` // 是否已发云仓(云仓单要发货到云仓,直接发到用户的不需要发到云仓) + IsDeliver *int64 `gorm:"default:0;" json:"is_deliver"` // 是否已发货 + IsEnd *int64 `gorm:"default:0;" json:"is_end"` // 是否完成订单(签收) + CartId *int64 `gorm:"index;default:0;" json:"cart_id"` // 购物车编号 +} +type FsOrderDetailOldModel struct { + db *gorm.DB + name string +} + +func NewFsOrderDetailOldModel(db *gorm.DB) *FsOrderDetailOldModel { + return &FsOrderDetailOldModel{db: db, name: "fs_order_detail_old"} +} diff --git a/model/gmodel/fs_order_detail_old_logic.go b/model/gmodel/fs_order_detail_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_order_detail_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_order_detail_template_old_gen.go b/model/gmodel/fs_order_detail_template_old_gen.go new file mode 100644 index 00000000..36f74646 --- /dev/null +++ b/model/gmodel/fs_order_detail_template_old_gen.go @@ -0,0 +1,28 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_order_detail_template_old 订单模板详细表 +type FsOrderDetailTemplateOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + Sn *string `gorm:"unique_key;default:'';" json:"sn"` // 唯一编码 + ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID + ModelId *int64 `gorm:"default:0;" json:"model_id"` // 模型ID + TemplateId *int64 `gorm:"index;default:0;" json:"template_id"` // 模板ID + MaterialId *int64 `gorm:"index;default:0;" json:"material_id"` // 材质id + SizeId *int64 `gorm:"index;default:0;" json:"size_id"` // 尺寸id + EachBoxNum *int64 `gorm:"default:0;" json:"each_box_num"` // 每一箱的个数 + EachBoxWeight *float64 `gorm:"default:0.00;" json:"each_box_weight"` // 每一箱的重量 单位KG + DesignId *int64 `gorm:"index;default:0;" json:"design_id"` // 设计ID + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 +} +type FsOrderDetailTemplateOldModel struct { + db *gorm.DB + name string +} + +func NewFsOrderDetailTemplateOldModel(db *gorm.DB) *FsOrderDetailTemplateOldModel { + return &FsOrderDetailTemplateOldModel{db: db, name: "fs_order_detail_template_old"} +} diff --git a/model/gmodel/fs_order_detail_template_old_logic.go b/model/gmodel/fs_order_detail_template_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_order_detail_template_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_order_gen.go b/model/gmodel/fs_order_gen.go index ab34b331..66bdd701 100644 --- a/model/gmodel/fs_order_gen.go +++ b/model/gmodel/fs_order_gen.go @@ -5,44 +5,17 @@ import ( "time" ) -// fs_order +// fs_order 订单表 type FsOrder struct { - Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // - Sn *string `gorm:"unique_key;default:'';" json:"sn"` // 订单编号 FS211224OL2XDKNP - UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户ID - SellerUserId *int64 `gorm:"default:0;" json:"seller_user_id"` // 销售员ID 0:自主下单 - TotalAmount *int64 `gorm:"default:0;" json:"total_amount"` // 总价 - PayedAmount *int64 `gorm:"default:0;" json:"payed_amount"` // 已支付金额 - PayMethod *int64 `gorm:"default:0;" json:"pay_method"` // 支付方式 1paypal 2strip - Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 - Utime *int64 `gorm:"default:0;" json:"utime"` // 更新时间 - Ptime *int64 `gorm:"default:0;" json:"ptime"` // 最后一次 支付时间(可能多次支付) - AddressId *int64 `gorm:"index;default:0;" json:"address_id"` // 地址ID或者云仓ID - DeliveryMethod *int64 `gorm:"default:0;" json:"delivery_method"` // 配送方式 1:直接发货到收获地址 2:云仓 - CustomerMark *string `gorm:"default:'';" json:"customer_mark"` // 客户备注 - Mark *string `gorm:"default:'';" json:"mark"` // 后台订单备注 - AddressInfo *string `gorm:"default:'';" json:"address_info"` // 详细地址信息JSON - IsSup *int64 `gorm:"default:0;" json:"is_sup"` // 0不是补货 1是补货 - Status *int64 `gorm:"default:0;" json:"status"` // 状态位(0:未支付,1:部分支付,2:支付完成,3:部分生产,4:部分生产完成,5:全部生产,6:全部生产完成,7:部分发货,8:发货完成,9:完成订单,10:取消订单,11:退款中,12:退款完成,13:订单已删除,14:订单已关闭) - IsPartPay *int64 `gorm:"default:0;" json:"is_part_pay"` // 是否部分支付(0:否,1:是) - IsPayCompleted *int64 `gorm:"default:0;" json:"is_pay_completed"` // 是否支付完成(0:否,1:是) - IsPartProduct *int64 `gorm:"default:0;" json:"is_part_product"` // 是否部分生产(0:否,1:是) - IsPartProductCompleted *int64 `gorm:"default:0;" json:"is_part_product_completed"` // 是否部分生产完成(0:否,1:是) - IsAllProduct *int64 `gorm:"default:0;" json:"is_all_product"` // 是否全部生产(0:否,1:是) - IsAllProductCompleted *int64 `gorm:"default:0;" json:"is_all_product_completed"` // 是否全部生产完成(0:否,1:是) - IsPartDelivery *int64 `gorm:"default:0;" json:"is_part_delivery"` // 是否部分发货(0:否,1:是) - IsDeliveryCompleted *int64 `gorm:"default:0;" json:"is_delivery_completed"` // 是否发货完成(0:否,1:是) - IsComplated *int64 `gorm:"default:0;" json:"is_complated"` // 是否完成订单(0:否,1:是) - IsCancel *int64 `gorm:"default:0;" json:"is_cancel"` // 是否取消订单(0:否,1:是) - IsRefunding *int64 `gorm:"default:0;" json:"is_refunding"` // 是否退款中(0:否,1:是) - IsRefunded *int64 `gorm:"default:0;" json:"is_refunded"` // 是否退款完成(0:否,1:是) - IsDeleted *int64 `gorm:"default:0;" json:"is_deleted"` // 是否删除(0:否,1:是) - RefundReasonId *int64 `gorm:"default:0;" json:"refund_reason_id"` // 取消订单原因ID - RefundReason *string `gorm:"default:'';" json:"refund_reason"` // 取消订单原因 - TsTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ts_time"` // - IsSure *int64 `gorm:"default:0;" json:"is_sure"` // 是否确认订单 1确认0未确认 - DeliverSn *string `gorm:"default:'';" json:"deliver_sn"` // 发货单号 - EmailTime *int64 `gorm:"default:0;" json:"email_time"` // 邮件发送时间 + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 订单ID + UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户ID + DeliveryMethod *int64 `gorm:"index;default:0;" json:"delivery_method"` // 物流类型 + OrderNo *string `gorm:"index;default:'';" json:"order_no"` // + OrderSource *string `gorm:"default:'';" json:"order_source"` // + Status *int64 `gorm:"index;default:0;" json:"status"` // 订单状态 + Metadata *[]byte `gorm:"default:'';" json:"metadata"` // + Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // + Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` // } type FsOrderModel struct { db *gorm.DB diff --git a/model/gmodel/fs_order_old_gen.go b/model/gmodel/fs_order_old_gen.go new file mode 100644 index 00000000..20e573ec --- /dev/null +++ b/model/gmodel/fs_order_old_gen.go @@ -0,0 +1,54 @@ +package gmodel + +import ( + "gorm.io/gorm" + "time" +) + +// fs_order_old +type FsOrderOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + Sn *string `gorm:"unique_key;default:'';" json:"sn"` // 订单编号 FS211224OL2XDKNP + UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户ID + SellerUserId *int64 `gorm:"default:0;" json:"seller_user_id"` // 销售员ID 0:自主下单 + TotalAmount *int64 `gorm:"default:0;" json:"total_amount"` // 总价 + PayedAmount *int64 `gorm:"default:0;" json:"payed_amount"` // 已支付金额 + PayMethod *int64 `gorm:"default:0;" json:"pay_method"` // 支付方式 1paypal 2strip + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 + Utime *int64 `gorm:"default:0;" json:"utime"` // 更新时间 + Ptime *int64 `gorm:"default:0;" json:"ptime"` // 最后一次 支付时间(可能多次支付) + AddressId *int64 `gorm:"index;default:0;" json:"address_id"` // 地址ID或者云仓ID + DeliveryMethod *int64 `gorm:"default:0;" json:"delivery_method"` // 配送方式 1:直接发货到收获地址 2:云仓 + CustomerMark *string `gorm:"default:'';" json:"customer_mark"` // 客户备注 + Mark *string `gorm:"default:'';" json:"mark"` // 后台订单备注 + AddressInfo *string `gorm:"default:'';" json:"address_info"` // 详细地址信息JSON + IsSup *int64 `gorm:"default:0;" json:"is_sup"` // 0不是补货 1是补货 + Status *int64 `gorm:"default:0;" json:"status"` // 状态位(0:未支付,1:部分支付,2:支付完成,3:部分生产,4:部分生产完成,5:全部生产,6:全部生产完成,7:部分发货,8:发货完成,9:完成订单,10:取消订单,11:退款中,12:退款完成,13:订单已删除,14:订单已关闭) + IsPartPay *int64 `gorm:"default:0;" json:"is_part_pay"` // 是否部分支付(0:否,1:是) + IsPayCompleted *int64 `gorm:"default:0;" json:"is_pay_completed"` // 是否支付完成(0:否,1:是) + IsPartProduct *int64 `gorm:"default:0;" json:"is_part_product"` // 是否部分生产(0:否,1:是) + IsPartProductCompleted *int64 `gorm:"default:0;" json:"is_part_product_completed"` // 是否部分生产完成(0:否,1:是) + IsAllProduct *int64 `gorm:"default:0;" json:"is_all_product"` // 是否全部生产(0:否,1:是) + IsAllProductCompleted *int64 `gorm:"default:0;" json:"is_all_product_completed"` // 是否全部生产完成(0:否,1:是) + IsPartDelivery *int64 `gorm:"default:0;" json:"is_part_delivery"` // 是否部分发货(0:否,1:是) + IsDeliveryCompleted *int64 `gorm:"default:0;" json:"is_delivery_completed"` // 是否发货完成(0:否,1:是) + IsComplated *int64 `gorm:"default:0;" json:"is_complated"` // 是否完成订单(0:否,1:是) + IsCancel *int64 `gorm:"default:0;" json:"is_cancel"` // 是否取消订单(0:否,1:是) + IsRefunding *int64 `gorm:"default:0;" json:"is_refunding"` // 是否退款中(0:否,1:是) + IsRefunded *int64 `gorm:"default:0;" json:"is_refunded"` // 是否退款完成(0:否,1:是) + IsDeleted *int64 `gorm:"default:0;" json:"is_deleted"` // 是否删除(0:否,1:是) + RefundReasonId *int64 `gorm:"default:0;" json:"refund_reason_id"` // 取消订单原因ID + RefundReason *string `gorm:"default:'';" json:"refund_reason"` // 取消订单原因 + TsTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ts_time"` // + IsSure *int64 `gorm:"default:0;" json:"is_sure"` // 是否确认订单 1确认0未确认 + DeliverSn *string `gorm:"default:'';" json:"deliver_sn"` // 发货单号 + EmailTime *int64 `gorm:"default:0;" json:"email_time"` // 邮件发送时间 +} +type FsOrderOldModel struct { + db *gorm.DB + name string +} + +func NewFsOrderOldModel(db *gorm.DB) *FsOrderOldModel { + return &FsOrderOldModel{db: db, name: "fs_order_old"} +} diff --git a/model/gmodel/fs_order_old_logic.go b/model/gmodel/fs_order_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_order_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_order_remark_old_gen.go b/model/gmodel/fs_order_remark_old_gen.go new file mode 100644 index 00000000..7c37fe76 --- /dev/null +++ b/model/gmodel/fs_order_remark_old_gen.go @@ -0,0 +1,22 @@ +package gmodel + +import ( + "gorm.io/gorm" +) + +// fs_order_remark_old 订单备注表 +type FsOrderRemarkOld struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id + OrderId *int64 `gorm:"index;default:0;" json:"order_id"` // 订单id + Remark *string `gorm:"default:'';" json:"remark"` // 订单备注 + AdminId *int64 `gorm:"default:0;" json:"admin_id"` // 后台操作人员 + Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间 +} +type FsOrderRemarkOldModel struct { + db *gorm.DB + name string +} + +func NewFsOrderRemarkOldModel(db *gorm.DB) *FsOrderRemarkOldModel { + return &FsOrderRemarkOldModel{db: db, name: "fs_order_remark_old"} +} diff --git a/model/gmodel/fs_order_remark_old_logic.go b/model/gmodel/fs_order_remark_old_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_order_remark_old_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_order_trade_event_gen.go b/model/gmodel/fs_order_trade_event_gen.go new file mode 100644 index 00000000..6fa748c8 --- /dev/null +++ b/model/gmodel/fs_order_trade_event_gen.go @@ -0,0 +1,25 @@ +package gmodel + +import ( + "gorm.io/gorm" + "time" +) + +// fs_order_trade_event 订单交易事件表 +type FsOrderTradeEvent struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 订单交易ID + PayMethod *int64 `gorm:"default:0;" json:"pay_method"` // 支付方式:1=stripe,2=paypal + EventId *string `gorm:"default:'';" json:"event_id"` // + EventType *string `gorm:"default:'';" json:"event_type"` // + EventData *[]byte `gorm:"default:'';" json:"event_data"` // + Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // + Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` // +} +type FsOrderTradeEventModel struct { + db *gorm.DB + name string +} + +func NewFsOrderTradeEventModel(db *gorm.DB) *FsOrderTradeEventModel { + return &FsOrderTradeEventModel{db: db, name: "fs_order_trade_event"} +} diff --git a/model/gmodel/fs_order_trade_event_logic.go b/model/gmodel/fs_order_trade_event_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_order_trade_event_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_order_trade_gen.go b/model/gmodel/fs_order_trade_gen.go new file mode 100644 index 00000000..01414724 --- /dev/null +++ b/model/gmodel/fs_order_trade_gen.go @@ -0,0 +1,36 @@ +package gmodel + +import ( + "gorm.io/gorm" + "time" +) + +// fs_order_trade 订单交易表 +type FsOrderTrade struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 订单交易ID + UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户ID + OrderNo *string `gorm:"default:'';" json:"order_no"` // + OrderSource *string `gorm:"default:'';" json:"order_source"` // + TradeNo *string `gorm:"index;default:'';" json:"trade_no"` // + PayAmount *int64 `gorm:"default:0;" json:"pay_amount"` // 支付金额 (分) + PayStatus *int64 `gorm:"default:0;" json:"pay_status"` // 支付状态:1=未成功,2=已成功 + PaymentMethod *int64 `gorm:"default:0;" json:"payment_method"` // 支付方式:1=stripe,2=paypal + PayStage *int64 `gorm:"default:0;" json:"pay_stage"` // 支付阶段:1=首付,2=尾款 + RefundStatus *int64 `gorm:"default:0;" json:"refund_status"` // 退款状态:1=未退款,2=已退款 + CardNo *string `gorm:"default:'';" json:"card_no"` // + CardBrand *string `gorm:"default:'';" json:"card_brand"` // + Country *string `gorm:"default:'';" json:"country"` // + Currency *string `gorm:"default:'';" json:"currency"` // + Metadata *[]byte `gorm:"default:'';" json:"metadata"` // + Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // + Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` // + PayTitle *string `gorm:"default:'';" json:"pay_title"` // +} +type FsOrderTradeModel struct { + db *gorm.DB + name string +} + +func NewFsOrderTradeModel(db *gorm.DB) *FsOrderTradeModel { + return &FsOrderTradeModel{db: db, name: "fs_order_trade"} +} diff --git a/model/gmodel/fs_order_trade_logic.go b/model/gmodel/fs_order_trade_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_order_trade_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_shopping_cart_gen.go b/model/gmodel/fs_shopping_cart_gen.go index 2997ec11..04996ad2 100644 --- a/model/gmodel/fs_shopping_cart_gen.go +++ b/model/gmodel/fs_shopping_cart_gen.go @@ -17,8 +17,6 @@ type FsShoppingCart struct { PurchaseQuantity *int64 `gorm:"default:0;" json:"purchase_quantity"` // 购买数量 Snapshot *string `gorm:"default:'';" json:"snapshot"` // IsHighlyCustomized *int64 `gorm:"default:0;" json:"is_highly_customized"` // 是否高度定制 0非 1是(针对客人高度定制只能后台增加如购物车) - Status *int64 `gorm:"default:0;" json:"status"` // 0未下单 1已下单 - IsEffective *int64 `gorm:"default:1;" json:"is_effective"` // 是否有效 0非 1是(针对对购物车下单,此前数据表更失效) Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` // } diff --git a/model/gmodel/var_gen.go b/model/gmodel/var_gen.go index 1d92c033..2637c166 100644 --- a/model/gmodel/var_gen.go +++ b/model/gmodel/var_gen.go @@ -24,14 +24,20 @@ type AllModelsGen struct { FsCart *FsCartModel // fs_cart 购物车 FsChangeCode *FsChangeCodeModel // fs_change_code 忘记密码code表 FsCloud *FsCloudModel // fs_cloud 云仓表 - FsCloudDeliverEveryTmp *FsCloudDeliverEveryTmpModel // fs_cloud_deliver_every_tmp - FsCloudDeliverTmp *FsCloudDeliverTmpModel // fs_cloud_deliver_tmp + FsCloudDeliverEveryTmpOld *FsCloudDeliverEveryTmpOldModel // fs_cloud_deliver_every_tmp_old + FsCloudDeliverTmpOld *FsCloudDeliverTmpOldModel // fs_cloud_deliver_tmp_old + FsCloudOld *FsCloudOldModel // fs_cloud_old 云仓表 FsCloudPickUp *FsCloudPickUpModel // fs_cloud_pick_up 云仓提货单 FsCloudPickUpDetail *FsCloudPickUpDetailModel // fs_cloud_pick_up_detail 云仓提货单-详情 + FsCloudPickUpDetailOld *FsCloudPickUpDetailOldModel // fs_cloud_pick_up_detail_old 云仓提货单-详情 + FsCloudPickUpOld *FsCloudPickUpOldModel // fs_cloud_pick_up_old 云仓提货单 FsCloudReceive *FsCloudReceiveModel // fs_cloud_receive 云仓接收工厂总单 - FsCloudReceiveEvery *FsCloudReceiveEveryModel // fs_cloud_receive_every + FsCloudReceiveEveryOld *FsCloudReceiveEveryOldModel // fs_cloud_receive_every_old + FsCloudReceiveOld *FsCloudReceiveOldModel // fs_cloud_receive_old 云仓接收工厂总单 FsCloudRenderLog *FsCloudRenderLogModel // fs_cloud_render_log 云渲染日志表 + FsCloudRenderLogOld *FsCloudRenderLogOldModel // fs_cloud_render_log_old 云渲染日志表 FsCloudUserApplyBack *FsCloudUserApplyBackModel // fs_cloud_user_apply_back 该表废弃 + FsCloudUserApplyBackOld *FsCloudUserApplyBackOldModel // fs_cloud_user_apply_back_old 该表废弃 FsContact *FsContactModel // fs_contact 该表暂未使用 FsContactService *FsContactServiceModel // fs_contact_service FsCoupon *FsCouponModel // fs_coupon 代金券(暂未使用) @@ -55,11 +61,18 @@ type AllModelsGen struct { FsMenu *FsMenuModel // fs_menu 后台菜单 FsMerchantCategory *FsMerchantCategoryModel // fs_merchant_category 商户类型表 FsMigration *FsMigrationModel // fs_migration 版本库 - FsOrder *FsOrderModel // fs_order + FsOrder *FsOrderModel // fs_order 订单表 FsOrderAffiliate *FsOrderAffiliateModel // fs_order_affiliate 订单附属表-流程控制时间等 + FsOrderAffiliateOld *FsOrderAffiliateOldModel // fs_order_affiliate_old 订单附属表-流程控制时间等 FsOrderDetail *FsOrderDetailModel // fs_order_detail 订单详细表 + FsOrderDetailOld *FsOrderDetailOldModel // fs_order_detail_old 订单详细表 FsOrderDetailTemplate *FsOrderDetailTemplateModel // fs_order_detail_template 订单模板详细表 + FsOrderDetailTemplateOld *FsOrderDetailTemplateOldModel // fs_order_detail_template_old 订单模板详细表 + FsOrderOld *FsOrderOldModel // fs_order_old FsOrderRemark *FsOrderRemarkModel // fs_order_remark 订单备注表 + FsOrderRemarkOld *FsOrderRemarkOldModel // fs_order_remark_old 订单备注表 + FsOrderTrade *FsOrderTradeModel // fs_order_trade 订单交易表 + FsOrderTradeEvent *FsOrderTradeEventModel // fs_order_trade_event 订单交易事件表 FsPay *FsPayModel // fs_pay 支付记录 FsPayEvent *FsPayEventModel // fs_pay_event 支付回调事件日志 FsProduct *FsProductModel // fs_product 产品表 @@ -131,14 +144,20 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen { FsCart: NewFsCartModel(gdb), FsChangeCode: NewFsChangeCodeModel(gdb), FsCloud: NewFsCloudModel(gdb), - FsCloudDeliverEveryTmp: NewFsCloudDeliverEveryTmpModel(gdb), - FsCloudDeliverTmp: NewFsCloudDeliverTmpModel(gdb), + FsCloudDeliverEveryTmpOld: NewFsCloudDeliverEveryTmpOldModel(gdb), + FsCloudDeliverTmpOld: NewFsCloudDeliverTmpOldModel(gdb), + FsCloudOld: NewFsCloudOldModel(gdb), FsCloudPickUp: NewFsCloudPickUpModel(gdb), FsCloudPickUpDetail: NewFsCloudPickUpDetailModel(gdb), + FsCloudPickUpDetailOld: NewFsCloudPickUpDetailOldModel(gdb), + FsCloudPickUpOld: NewFsCloudPickUpOldModel(gdb), FsCloudReceive: NewFsCloudReceiveModel(gdb), - FsCloudReceiveEvery: NewFsCloudReceiveEveryModel(gdb), + FsCloudReceiveEveryOld: NewFsCloudReceiveEveryOldModel(gdb), + FsCloudReceiveOld: NewFsCloudReceiveOldModel(gdb), FsCloudRenderLog: NewFsCloudRenderLogModel(gdb), + FsCloudRenderLogOld: NewFsCloudRenderLogOldModel(gdb), FsCloudUserApplyBack: NewFsCloudUserApplyBackModel(gdb), + FsCloudUserApplyBackOld: NewFsCloudUserApplyBackOldModel(gdb), FsContact: NewFsContactModel(gdb), FsContactService: NewFsContactServiceModel(gdb), FsCoupon: NewFsCouponModel(gdb), @@ -164,9 +183,16 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen { FsMigration: NewFsMigrationModel(gdb), FsOrder: NewFsOrderModel(gdb), FsOrderAffiliate: NewFsOrderAffiliateModel(gdb), + FsOrderAffiliateOld: NewFsOrderAffiliateOldModel(gdb), FsOrderDetail: NewFsOrderDetailModel(gdb), + FsOrderDetailOld: NewFsOrderDetailOldModel(gdb), FsOrderDetailTemplate: NewFsOrderDetailTemplateModel(gdb), + FsOrderDetailTemplateOld: NewFsOrderDetailTemplateOldModel(gdb), + FsOrderOld: NewFsOrderOldModel(gdb), FsOrderRemark: NewFsOrderRemarkModel(gdb), + FsOrderRemarkOld: NewFsOrderRemarkOldModel(gdb), + FsOrderTrade: NewFsOrderTradeModel(gdb), + FsOrderTradeEvent: NewFsOrderTradeEventModel(gdb), FsPay: NewFsPayModel(gdb), FsPayEvent: NewFsPayEventModel(gdb), FsProduct: NewFsProductModel(gdb), From b07473478bf8c36a182ca8dbbaf05d7b44e5e397 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 18 Sep 2023 11:45:29 +0800 Subject: [PATCH 2/8] fix --- .../internal/logic/getcartslogic.go | 91 ++++++++++++++----- server/shopping-cart/internal/types/types.go | 10 +- server_api/shopping-cart.api | 9 +- .../verify_shopping_cart_channged.go | 2 +- 4 files changed, 87 insertions(+), 25 deletions(-) diff --git a/server/shopping-cart/internal/logic/getcartslogic.go b/server/shopping-cart/internal/logic/getcartslogic.go index 0a52ba1e..2ed45ff5 100644 --- a/server/shopping-cart/internal/logic/getcartslogic.go +++ b/server/shopping-cart/internal/logic/getcartslogic.go @@ -2,6 +2,7 @@ package logic import ( "context" + "encoding/json" "errors" "fmt" "fusenapi/constants" @@ -9,6 +10,7 @@ import ( "fusenapi/utils/auth" "fusenapi/utils/basic" "fusenapi/utils/format" + "fusenapi/utils/s3url_to_s3id" "fusenapi/utils/shopping_cart" "fusenapi/utils/step_price" "math" @@ -39,6 +41,7 @@ func NewGetCartsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCarts // } func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo) (resp *basic.Response) { + userinfo.UserId = 39 if req.CurrentPage <= 0 { req.CurrentPage = constants.DEFAULT_PAGE } @@ -66,20 +69,22 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo }) } var ( - mapSize = make(map[int64]gmodel.FsProductSize) - mapModel = make(map[int64]gmodel.FsProductModel3d) - mapTemplate = make(map[int64]gmodel.FsProductTemplateV2) - mapSizePrice = make(map[string]gmodel.FsProductPrice) - mapProduct = make(map[int64]struct{}) + mapSize = make(map[int64]gmodel.FsProductSize) + mapModel = make(map[int64]gmodel.FsProductModel3d) + mapTemplate = make(map[int64]gmodel.FsProductTemplateV2) + mapSizePrice = make(map[string]gmodel.FsProductPrice) + mapProduct = make(map[int64]gmodel.FsProduct) + mapResourceMetadata = make(map[string]interface{}) ) //获取相关信息 err = l.GetRelationInfo(GetRelationInfoReq{ - Carts: carts, - MapSize: mapSize, - MapModel: mapModel, - MapTemplate: mapTemplate, - MapSizePrice: mapSizePrice, - MapProduct: mapProduct, + Carts: carts, + MapSize: mapSize, + MapModel: mapModel, + MapTemplate: mapTemplate, + MapSizePrice: mapSizePrice, + MapProduct: mapProduct, + MapResourceMetadata: mapResourceMetadata, }) if err != nil { return resp.SetStatusWithMessage(basic.CodeServiceErr, err.Error()) @@ -137,6 +142,10 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo stepQuantityList = append(stepQuantityList, tmpQuantity) tmpMinBuyNum++ } + sizeCapacity := snapShot.SizeInfo.Capacity + if sizeInfo, ok := mapSize[*cart.SizeId]; ok { + sizeCapacity = *sizeInfo.Capacity + } //根据数量获取阶梯价格中对应的价格 itemPrice := step_price.GetCentStepPrice(boxQuantity, stepNum, stepPrice) //如果有配件,单价也要加入配件价格 @@ -145,12 +154,34 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo itemPrice += *curFittingInfo.Price } } + fittingName := snapShot.FittingInfo.FittingName + if fittingInfo, ok := mapModel[*cart.FittingId]; ok { + fittingName = *fittingInfo.Name + } totalPrice := itemPrice * (*cart.PurchaseQuantity) + productCover := "" //产品封面图 + productName := snapShot.ProductInfo.ProductName + productSn := snapShot.ProductInfo.ProductSn + var productCoverMetadata interface{} + if productInfo, ok := mapProduct[*cart.ProductId]; ok { + productCover = *productInfo.Cover + productName = *productInfo.Title + productSn = *productInfo.Sn + if metadata, ok := mapResourceMetadata[*productInfo.Cover]; ok { + productCoverMetadata = metadata + } + } item := types.CartItem{ - ProductId: *cart.ProductId, + ProductInfo: types.ProductInfo{ + ProductId: *cart.ProductId, + ProductName: productName, + ProductSn: productSn, + ProductCover: productCover, + ProductCoverMetadata: productCoverMetadata, + }, SizeInfo: types.SizeInfo{ SizeId: *cart.SizeId, - Capacity: snapShot.SizeInfo.Capacity, + Capacity: sizeCapacity, Title: types.SizeTitle{ Cm: snapShot.SizeInfo.Cm, Inch: snapShot.SizeInfo.Inch, @@ -158,7 +189,7 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo }, FittingInfo: types.FittingInfo{ FittingId: *cart.FittingId, - FittingName: snapShot.FittingInfo.FittingName, + FittingName: fittingName, }, ItemPrice: fmt.Sprintf("%.3f", format.CentitoDollar(itemPrice)), TotalPrice: fmt.Sprintf("%.3f", format.CentitoDollar(totalPrice)), @@ -194,12 +225,13 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo // 获取相关信息 type GetRelationInfoReq struct { - Carts []gmodel.FsShoppingCart - MapSize map[int64]gmodel.FsProductSize - MapModel map[int64]gmodel.FsProductModel3d - MapTemplate map[int64]gmodel.FsProductTemplateV2 - MapSizePrice map[string]gmodel.FsProductPrice - MapProduct map[int64]struct{} + Carts []gmodel.FsShoppingCart + MapSize map[int64]gmodel.FsProductSize + MapModel map[int64]gmodel.FsProductModel3d + MapTemplate map[int64]gmodel.FsProductTemplateV2 + MapSizePrice map[string]gmodel.FsProductPrice + MapProduct map[int64]gmodel.FsProduct + MapResourceMetadata map[string]interface{} } func (l *GetCartsLogic) GetRelationInfo(req GetRelationInfoReq) error { @@ -215,13 +247,28 @@ func (l *GetCartsLogic) GetRelationInfo(req GetRelationInfoReq) error { productIds = append(productIds, *req.Carts[index].ProductId) } //获取产品集合 - productList, err := l.svcCtx.AllModels.FsProduct.GetProductListByIds(l.ctx, productIds, "", "id") + productList, err := l.svcCtx.AllModels.FsProduct.GetProductListByIds(l.ctx, productIds, "") if err != nil { logx.Error(err) return errors.New("failed to get product list") } + resourceIds := make([]string, 0, len(productList)) for _, v := range productList { - req.MapProduct[v.Id] = struct{}{} + req.MapProduct[v.Id] = v + resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*v.Cover)) + } + //根据resourceUrls找到对应的元数据 + resourceMetadataList, err := l.svcCtx.AllModels.FsResource.FindAllByResourceIds(l.ctx, resourceIds) + if err != nil { + logx.Error(err) + return errors.New("failed to get resource list") + } + for _, v := range resourceMetadataList { + var metadata interface{} + if v.Metadata != nil { + _ = json.Unmarshal(*v.Metadata, &metadata) + } + req.MapResourceMetadata[*v.ResourceUrl] = metadata } //获取尺寸列表 sizeList, err := l.svcCtx.AllModels.FsProductSize.GetAllByIds(l.ctx, sizeIds, "") diff --git a/server/shopping-cart/internal/types/types.go b/server/shopping-cart/internal/types/types.go index 231c717e..ec1ed92b 100644 --- a/server/shopping-cart/internal/types/types.go +++ b/server/shopping-cart/internal/types/types.go @@ -44,7 +44,7 @@ type GetCartsRsp struct { } type CartItem struct { - ProductId int64 `json:"product_id"` //产品id + ProductInfo ProductInfo `json:"product_info"` //产品信息 SizeInfo SizeInfo `json:"size_info"` //尺寸信息 FittingInfo FittingInfo `json:"fitting_info"` //配件信息 ItemPrice string `json:"item_price"` //单价 @@ -56,6 +56,14 @@ type CartItem struct { InvalidDescription string `json:"invalid_description"` //无效原因 } +type ProductInfo struct { + ProductId int64 `json:"product_id"` //产品id + ProductName string `json:"product_name"` + ProductSn string `json:"product_sn"` + ProductCover string `json:"product_cover"` //产品图 + ProductCoverMetadata interface{} `json:"product_cover_metadata"` //产品图元数据 +} + type SizeInfo struct { SizeId int64 `json:"size_id"` //尺寸id Capacity string `json:"capacity"` //尺寸名称 diff --git a/server_api/shopping-cart.api b/server_api/shopping-cart.api index 5c3da538..bd595d74 100644 --- a/server_api/shopping-cart.api +++ b/server_api/shopping-cart.api @@ -63,7 +63,7 @@ type GetCartsRsp { CartList []CartItem `json:"cart_list"` } type CartItem { - ProductId int64 `json:"product_id"` //产品id + ProductInfo ProductInfo `json:"product_info"` //产品信息 SizeInfo SizeInfo `json:"size_info"` //尺寸信息 FittingInfo FittingInfo `json:"fitting_info"` //配件信息 ItemPrice string `json:"item_price"` //单价 @@ -74,6 +74,13 @@ type CartItem { IsInvalid bool `json:"is_invalid"` //是否无效 InvalidDescription string `json:"invalid_description"` //无效原因 } +type ProductInfo { + ProductId int64 `json:"product_id"` //产品id + ProductName string `json:"product_name"` + ProductSn string `json:"product_sn"` + ProductCover string `json:"product_cover"` //产品图 + ProductCoverMetadata interface{} `json:"product_cover_metadata"` //产品图元数据 +} type SizeInfo { SizeId int64 `json:"size_id"` //尺寸id Capacity string `json:"capacity"` //尺寸名称 diff --git a/utils/shopping_cart/verify_shopping_cart_channged.go b/utils/shopping_cart/verify_shopping_cart_channged.go index 10315ffe..fc43c0fa 100644 --- a/utils/shopping_cart/verify_shopping_cart_channged.go +++ b/utils/shopping_cart/verify_shopping_cart_channged.go @@ -15,7 +15,7 @@ type VerifyShoppingCartSnapshotDataChangeReq struct { MapTemplate map[int64]gmodel.FsProductTemplateV2 MapCartChange map[int64]string MapSnapshot map[int64]CartSnapshot - MapProduct map[int64]struct{} + MapProduct map[int64]gmodel.FsProduct } func VerifyShoppingCartSnapshotDataChange(req VerifyShoppingCartSnapshotDataChangeReq) error { From 1a7ce5013e4f3558e0180b96ea20a98b94409565 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 18 Sep 2023 12:31:51 +0800 Subject: [PATCH 3/8] fix --- model/gmodel/fs_product_model3d_logic.go | 8 +- .../internal/logic/calculatecartpricelogic.go | 84 +++++++++++++++++-- .../internal/logic/getcartslogic.go | 9 +- server/shopping-cart/internal/types/types.go | 1 + server_api/shopping-cart.api | 1 + service/repositories/order.go | 3 +- 6 files changed, 90 insertions(+), 16 deletions(-) diff --git a/model/gmodel/fs_product_model3d_logic.go b/model/gmodel/fs_product_model3d_logic.go index 5ff31216..74ffe4e6 100755 --- a/model/gmodel/fs_product_model3d_logic.go +++ b/model/gmodel/fs_product_model3d_logic.go @@ -37,11 +37,15 @@ func (d *FsProductModel3dModel) GetAllByIdsWithoutStatus(ctx context.Context, id err = db.Find(&resp).Error return resp, err } -func (d *FsProductModel3dModel) GetAllByIdsTag(ctx context.Context, ids []int64, tag int64) (resp []FsProductModel3d, err error) { +func (d *FsProductModel3dModel) GetAllByIdsTag(ctx context.Context, ids []int64, tag int64, fields ...string) (resp []FsProductModel3d, err error) { if len(ids) == 0 { return } - err = d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`id` in (?) and `status` = ? and `tag` = ?", ids, 1, tag).Find(&resp).Error + db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`id` in (?) and `status` = ? and `tag` = ?", ids, 1, tag) + if len(fields) > 0 { + db = db.Select(fields[0]) + } + err = db.Find(&resp).Error return resp, err } diff --git a/server/shopping-cart/internal/logic/calculatecartpricelogic.go b/server/shopping-cart/internal/logic/calculatecartpricelogic.go index 0c35521d..3b68a93c 100644 --- a/server/shopping-cart/internal/logic/calculatecartpricelogic.go +++ b/server/shopping-cart/internal/logic/calculatecartpricelogic.go @@ -3,9 +3,14 @@ package logic import ( "context" "fmt" + "fusenapi/constants" "fusenapi/model/gmodel" "fusenapi/utils/auth" "fusenapi/utils/basic" + "fusenapi/utils/format" + "fusenapi/utils/step_price" + "math" + "strings" "fusenapi/server/shopping-cart/internal/svc" "fusenapi/server/shopping-cart/internal/types" @@ -32,6 +37,7 @@ func NewCalculateCartPriceLogic(ctx context.Context, svcCtx *svc.ServiceContext) // } func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPriceReq, userinfo *auth.UserInfo) (resp *basic.Response) { + userinfo.UserId = 39 if !userinfo.IsUser() { return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in") } @@ -39,13 +45,18 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri return resp.SetStatusWithMessage(basic.CodeOK, "success", types.CalculateCartPriceRsp{CalculateResultList: []types.CalculateResultItem{}}) } cartIds := make([]int64, 0, len(req.CalculateList)) + mapCalculateQuantity := make(map[int64]int64) for _, v := range req.CalculateList { cartIds = append(cartIds, v.CartId) + if v.PurchaseQuantity <= 0 { + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "purchase quantity must grater than 0") + } + mapCalculateQuantity[v.CartId] = v.PurchaseQuantity } //获取购物车列表 carts, _, err := l.svcCtx.AllModels.FsShoppingCart.GetAllCartsByParam(l.ctx, gmodel.GetAllCartsByParamReq{ Ids: cartIds, - Fields: "id,size_id,product_id", + Fields: "id,size_id,product_id,fitting_id", UserId: userinfo.UserId, Page: 1, Limit: len(cartIds), @@ -54,6 +65,9 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri logx.Error(err) return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get cart list") } + if len(carts) < len(req.CalculateList) { + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "please refresh page for the shopping cart has changed!!") + } sizeIds := make([]int64, 0, len(carts)) productIds := make([]int64, 0, len(carts)) fittingIds := make([]int64, 0, len(carts)) @@ -70,14 +84,68 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri logx.Error(err) return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get price list") } - mapPrice := make(map[string]int) - for k, v := range priceList { - mapPrice[fmt.Sprintf("%d_%d", *v.ProductId, *v.SizeId)] = k + mapPrice := make(map[string]gmodel.FsProductPrice) + for _, v := range priceList { + mapPrice[fmt.Sprintf("%d_%d", *v.ProductId, *v.SizeId)] = v } - //获取配件列表 - // todo 下周写 - /*fittingList, err := l.svcCtx.AllModels.FsProductModel3d.GetAllByIdsTag()*/ - return resp.SetStatus(basic.CodeOK) + //获取配件列表(只有id跟价格) + fittingList, err := l.svcCtx.AllModels.FsProductModel3d.GetAllByIdsTag(l.ctx, fittingIds, constants.TAG_PARTS, "id,price") + if err != nil { + logx.Error(err) + return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get fitting list") + } + mapFitting := make(map[int64]int64) + for _, v := range fittingList { + mapFitting[v.Id] = *v.Price + } + //开始计算价格 + calculateResultList := make([]types.CalculateResultItem, 0, len(req.CalculateList)) + sumPrice := int64(0) + for _, cart := range carts { + sizePrice, ok := mapPrice[fmt.Sprintf("%d_%d", *cart.ProductId, *cart.SizeId)] + if !ok { + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, fmt.Sprintf("there carts contain some one which have no price info:%d_%d", *cart.ProductId, *cart.SizeId)) + } + //阶梯数量切片 + stepNum, err := format.StrSlicToIntSlice(strings.Split(*sizePrice.StepNum, ",")) + if err != nil { + logx.Error(err) + return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("failed to parse step number:%d_%d", *cart.ProductId, *cart.SizeId)) + } + lenStepNum := len(stepNum) + //阶梯价格切片 + stepPrice, err := format.StrSlicToIntSlice(strings.Split(*sizePrice.StepPrice, ",")) + if err != nil { + logx.Error(err) + return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("failed to parse step price:%d_%d", *cart.ProductId, *cart.SizeId)) + } + lenStepPrice := len(stepPrice) + if lenStepPrice == 0 || lenStepNum == 0 { + return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("step price or step number is not set:%d_%d", *cart.ProductId, *cart.SizeId)) + } + //购买箱数 + boxQuantity := int(math.Ceil(float64(mapCalculateQuantity[cart.Id]) / float64(*sizePrice.EachBoxNum))) + //根据数量获取阶梯价格中对应的价格 + itemPrice := step_price.GetCentStepPrice(boxQuantity, stepNum, stepPrice) + //如果有配件,单价也要加入配件价格 + if *cart.FittingId > 0 { + if fittingPrice, ok := mapFitting[*cart.FittingId]; ok { + itemPrice += fittingPrice + } + } + //单个购物车总价 + totalPrice := itemPrice * mapCalculateQuantity[cart.Id] + calculateResultList = append(calculateResultList, types.CalculateResultItem{ + CartId: cart.Id, + ItemPrice: fmt.Sprintf("%.3f", format.CentitoDollar(itemPrice)), + TotalPrice: fmt.Sprintf("%.3f", format.CentitoDollar(totalPrice)), + }) + sumPrice += totalPrice + } + return resp.SetStatusWithMessage(basic.CodeOK, "success", types.CalculateCartPriceRsp{ + SumPrice: fmt.Sprintf("%.3f", format.CentitoDollar(sumPrice)), + CalculateResultList: calculateResultList, + }) } // 处理逻辑后 w,r 如:重定向, resp 必须重新处理 diff --git a/server/shopping-cart/internal/logic/getcartslogic.go b/server/shopping-cart/internal/logic/getcartslogic.go index 2ed45ff5..303716f4 100644 --- a/server/shopping-cart/internal/logic/getcartslogic.go +++ b/server/shopping-cart/internal/logic/getcartslogic.go @@ -41,7 +41,6 @@ func NewGetCartsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCarts // } func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo) (resp *basic.Response) { - userinfo.UserId = 39 if req.CurrentPage <= 0 { req.CurrentPage = constants.DEFAULT_PAGE } @@ -112,24 +111,24 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo snapShot := mapSnapshot[cart.Id] sizePrice, ok := mapSizePrice[fmt.Sprintf("%d_%d", *cart.ProductId, *cart.SizeId)] if !ok { - return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("the size`s price info is not exists:%d", *cart.SizeId)) + return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("the size`s price info is not exists:%d_%d", *cart.ProductId, *cart.SizeId)) } //阶梯数量切片 stepNum, err := format.StrSlicToIntSlice(strings.Split(*sizePrice.StepNum, ",")) if err != nil { logx.Error(err) - return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("failed to parse step number:%d", *cart.SizeId)) + return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("failed to parse step number:%d_%d", *cart.ProductId, *cart.SizeId)) } lenStepNum := len(stepNum) //阶梯价格切片 stepPrice, err := format.StrSlicToIntSlice(strings.Split(*sizePrice.StepPrice, ",")) if err != nil { logx.Error(err) - return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("failed to parse step price:%d", *cart.SizeId)) + return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("failed to parse step price:%d_%d", *cart.ProductId, *cart.SizeId)) } lenStepPrice := len(stepPrice) if lenStepPrice == 0 || lenStepNum == 0 { - return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("step price or step number is not set:%d ", *cart.SizeId)) + return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("step price or step number is not set:%d_%d ", *cart.ProductId, *cart.SizeId)) } //购买箱数 boxQuantity := int(math.Ceil(float64(*cart.PurchaseQuantity) / float64(*sizePrice.EachBoxNum))) diff --git a/server/shopping-cart/internal/types/types.go b/server/shopping-cart/internal/types/types.go index ec1ed92b..c8630940 100644 --- a/server/shopping-cart/internal/types/types.go +++ b/server/shopping-cart/internal/types/types.go @@ -98,6 +98,7 @@ type CalculateItem struct { } type CalculateCartPriceRsp struct { + SumPrice string `json:"sum_price"` CalculateResultList []CalculateResultItem `json:"calculate_result_list"` } diff --git a/server_api/shopping-cart.api b/server_api/shopping-cart.api index bd595d74..523e734f 100644 --- a/server_api/shopping-cart.api +++ b/server_api/shopping-cart.api @@ -111,6 +111,7 @@ type CalculateItem { PurchaseQuantity int64 `json:"purchase_quantity"` //数量 } type CalculateCartPriceRsp { + SumPrice string `json:"sum_price"` CalculateResultList []CalculateResultItem `json:"calculate_result_list"` } type CalculateResultItem { diff --git a/service/repositories/order.go b/service/repositories/order.go index b92668b8..02cbe08b 100644 --- a/service/repositories/order.go +++ b/service/repositories/order.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "fusenapi/model/gmodel" "fusenapi/utils/basic" "fusenapi/utils/shopping_cart" @@ -157,7 +158,7 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe // 商品总价 productTotalPrice := productPrice * *shoppingCart.PurchaseQuantity - + fmt.Println(productTotalPrice) // 存储订单商品 orderProductList = append(orderProductList, &gmodel.OrderProduct{}) } From 5e2760849c4eb188a1d90b97f81b0490f92734f4 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 18 Sep 2023 14:23:57 +0800 Subject: [PATCH 4/8] fix --- .../internal/logic/getproducttemplatetagslogic.go | 3 +++ server/product-template-tag/internal/types/types.go | 9 +++++---- server_api/product-template-tag.api | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go b/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go index 4a24ce61..c0384d90 100644 --- a/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go +++ b/server/product-template-tag/internal/logic/getproducttemplatetagslogic.go @@ -54,6 +54,7 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu logx.Error(err) return } + var colors interface{} if logoInfo.Metadata == nil || *logoInfo.Metadata == "" { // 返回固定模板A1a productTemplateTags, err = l.svcCtx.AllModels.FsProductTemplateTags.GetListByTagNames(l.ctx, []string{"A1"}, req.Limit, 1, "`id` DESC") @@ -68,6 +69,7 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu logx.Error(err) return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse user metadata") } + colors = metaData["colors"] var templateTagNameList []string b, _ := json.Marshal(metaData["template_tagid"]) if err = json.Unmarshal(b, &templateTagNameList); err != nil { @@ -106,6 +108,7 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu TemplateTag: *v.TemplateTag, Cover: *v.Cover, CoverMetadata: mapResourceMetadata[*v.Cover], + Colors: colors, }) } return resp.SetStatusWithMessage(basic.CodeOK, "success", list) diff --git a/server/product-template-tag/internal/types/types.go b/server/product-template-tag/internal/types/types.go index 6c7f6950..e81cb040 100644 --- a/server/product-template-tag/internal/types/types.go +++ b/server/product-template-tag/internal/types/types.go @@ -14,6 +14,7 @@ type GetProductTemplateTagsRsp struct { TemplateTag string `json:"template_tag"` Cover string `json:"cover"` CoverMetadata interface{} `json:"cover_metadata"` + Colors interface{} `json:"colors"` } type Request struct { @@ -39,10 +40,10 @@ type File struct { } type Meta struct { - TotalCount int64 `json:"totalCount"` - PageCount int64 `json:"pageCount"` - CurrentPage int `json:"currentPage"` - PerPage int `json:"perPage"` + TotalCount int64 `json:"total_count"` + PageCount int64 `json:"page_count"` + CurrentPage int `json:"current_page"` + PerPage int `json:"per_page"` } // Set 设置Response的Code和Message值 diff --git a/server_api/product-template-tag.api b/server_api/product-template-tag.api index bdc513b7..d663e109 100644 --- a/server_api/product-template-tag.api +++ b/server_api/product-template-tag.api @@ -24,4 +24,5 @@ type GetProductTemplateTagsRsp { TemplateTag string `json:"template_tag"` Cover string `json:"cover"` CoverMetadata interface{} `json:"cover_metadata"` + Colors interface{} `json:"colors"` } \ No newline at end of file From 43f394250820aeceabf4e033a2e140e906e417a8 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 18 Sep 2023 14:27:55 +0800 Subject: [PATCH 5/8] fix --- service/repositories/order.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/repositories/order.go b/service/repositories/order.go index b92668b8..02cbe08b 100644 --- a/service/repositories/order.go +++ b/service/repositories/order.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "fusenapi/model/gmodel" "fusenapi/utils/basic" "fusenapi/utils/shopping_cart" @@ -157,7 +158,7 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe // 商品总价 productTotalPrice := productPrice * *shoppingCart.PurchaseQuantity - + fmt.Println(productTotalPrice) // 存储订单商品 orderProductList = append(orderProductList, &gmodel.OrderProduct{}) } From 9476414e68226424afaff5a141f26e7da02603ab Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 18 Sep 2023 14:53:15 +0800 Subject: [PATCH 6/8] fix --- server/shopping-cart/internal/logic/calculatecartpricelogic.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/shopping-cart/internal/logic/calculatecartpricelogic.go b/server/shopping-cart/internal/logic/calculatecartpricelogic.go index 3b68a93c..8a9fe327 100644 --- a/server/shopping-cart/internal/logic/calculatecartpricelogic.go +++ b/server/shopping-cart/internal/logic/calculatecartpricelogic.go @@ -131,6 +131,8 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri if *cart.FittingId > 0 { if fittingPrice, ok := mapFitting[*cart.FittingId]; ok { itemPrice += fittingPrice + } else { + return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "cart contain some one witch lose fitting:%d", *cart.FittingId) } } //单个购物车总价 From ceec00c5286d365bdb3e9948a9589c80be7426ee Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 18 Sep 2023 15:18:55 +0800 Subject: [PATCH 7/8] fix --- .../shopping-cart/internal/logic/calculatecartpricelogic.go | 6 +++--- server/shopping-cart/internal/types/types.go | 2 +- server_api/shopping-cart.api | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/shopping-cart/internal/logic/calculatecartpricelogic.go b/server/shopping-cart/internal/logic/calculatecartpricelogic.go index 8a9fe327..25102872 100644 --- a/server/shopping-cart/internal/logic/calculatecartpricelogic.go +++ b/server/shopping-cart/internal/logic/calculatecartpricelogic.go @@ -100,7 +100,7 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri } //开始计算价格 calculateResultList := make([]types.CalculateResultItem, 0, len(req.CalculateList)) - sumPrice := int64(0) + subTotalPrice := int64(0) for _, cart := range carts { sizePrice, ok := mapPrice[fmt.Sprintf("%d_%d", *cart.ProductId, *cart.SizeId)] if !ok { @@ -142,10 +142,10 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri ItemPrice: fmt.Sprintf("%.3f", format.CentitoDollar(itemPrice)), TotalPrice: fmt.Sprintf("%.3f", format.CentitoDollar(totalPrice)), }) - sumPrice += totalPrice + subTotalPrice += totalPrice } return resp.SetStatusWithMessage(basic.CodeOK, "success", types.CalculateCartPriceRsp{ - SumPrice: fmt.Sprintf("%.3f", format.CentitoDollar(sumPrice)), + SubTotalPrice: fmt.Sprintf("%.3f", format.CentitoDollar(subTotalPrice)), CalculateResultList: calculateResultList, }) } diff --git a/server/shopping-cart/internal/types/types.go b/server/shopping-cart/internal/types/types.go index c8630940..1ed8b661 100644 --- a/server/shopping-cart/internal/types/types.go +++ b/server/shopping-cart/internal/types/types.go @@ -98,7 +98,7 @@ type CalculateItem struct { } type CalculateCartPriceRsp struct { - SumPrice string `json:"sum_price"` + SubTotalPrice string `json:"sub_total_price"` CalculateResultList []CalculateResultItem `json:"calculate_result_list"` } diff --git a/server_api/shopping-cart.api b/server_api/shopping-cart.api index 523e734f..216bdfe2 100644 --- a/server_api/shopping-cart.api +++ b/server_api/shopping-cart.api @@ -111,7 +111,7 @@ type CalculateItem { PurchaseQuantity int64 `json:"purchase_quantity"` //数量 } type CalculateCartPriceRsp { - SumPrice string `json:"sum_price"` + SubTotalPrice string `json:"sub_total_price"` CalculateResultList []CalculateResultItem `json:"calculate_result_list"` } type CalculateResultItem { From 990c7d335992af0649ee42c5c400c4608a63e80f Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 18 Sep 2023 15:19:42 +0800 Subject: [PATCH 8/8] fix --- server/shopping-cart/internal/logic/calculatecartpricelogic.go | 1 - 1 file changed, 1 deletion(-) diff --git a/server/shopping-cart/internal/logic/calculatecartpricelogic.go b/server/shopping-cart/internal/logic/calculatecartpricelogic.go index 25102872..ce0bfc13 100644 --- a/server/shopping-cart/internal/logic/calculatecartpricelogic.go +++ b/server/shopping-cart/internal/logic/calculatecartpricelogic.go @@ -37,7 +37,6 @@ func NewCalculateCartPriceLogic(ctx context.Context, svcCtx *svc.ServiceContext) // } func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPriceReq, userinfo *auth.UserInfo) (resp *basic.Response) { - userinfo.UserId = 39 if !userinfo.IsUser() { return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in") }