Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson 2023-10-20 11:42:03 +08:00
commit cd4ca1c1e0
28 changed files with 632 additions and 642 deletions

View File

@ -0,0 +1,18 @@
package gmodel
import (
"gorm.io/gorm"
)
// fs_logo_preprocess
type FsLogoPreprocess struct {
RestaurantName *string `gorm:"index;default:'';" json:"restaurant_name"` // 餐厅名字
}
type FsLogoPreprocessModel struct {
db *gorm.DB
name string
}
func NewFsLogoPreprocessModel(db *gorm.DB) *FsLogoPreprocessModel {
return &FsLogoPreprocessModel{db: db, name: "fs_logo_preprocess"}
}

View File

@ -0,0 +1,2 @@
package gmodel
// TODO: 使用model的属性做你想做的

View File

@ -0,0 +1,23 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_product_history_template 模板历史表
type FsProductHistoryTemplate struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
TemplateId *int64 `gorm:"index;default:0;" json:"template_id"` // 模板id
TemplateInfo *string `gorm:"default:'';" json:"template_info"` //
RelativePublicTemplateId *int64 `gorm:"default:0;" json:"relative_public_template_id"` // 变更之前关联的公共模板id仅供查看
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
}
type FsProductHistoryTemplateModel struct {
db *gorm.DB
name string
}
func NewFsProductHistoryTemplateModel(db *gorm.DB) *FsProductHistoryTemplateModel {
return &FsProductHistoryTemplateModel{db: db, name: "fs_product_history_template"}
}

View File

@ -0,0 +1,2 @@
package gmodel
// TODO: 使用model的属性做你想做的

View File

@ -4,27 +4,29 @@ import (
"gorm.io/gorm"
)
// fs_product_template_v2 产品-模型-模板表
// fs_product_template_v2 产品-模型- 模板表
type FsProductTemplateV2 struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID
ModelId *int64 `gorm:"default:0;" json:"model_id"` // 模型ID
Title *string `gorm:"default:'';" json:"title"` // 模板sku,预留字段
Name *string `gorm:"default:'';" json:"name"` // 名称
CoverImg *string `gorm:"default:'';" json:"cover_img"` // 模板背景图
TemplateInfo *string `gorm:"default:'';" json:"template_info"` // 模板详情
MaterialImg *string `gorm:"default:'';" json:"material_img"` // 合成好的贴图
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序
LogoWidth *int64 `gorm:"default:0;" json:"logo_width"` // logo图最大宽度
LogoHeight *int64 `gorm:"default:0;" json:"logo_height"` // logo图最大高度
IsPublic *int64 `gorm:"default:0;" json:"is_public"` // 是否可公用1:可以0不可以
Status *int64 `gorm:"default:0;" json:"status"` // 状态1正常 2异常
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
TemplateTag *string `gorm:"default:'';" json:"template_tag"` //
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除 1删除
SwitchInfo *string `gorm:"default:'';" json:"switch_info"` // 开关信息
Version *int64 `gorm:"default:0;" json:"version"` // 默认1
ElementModelId *int64 `gorm:"default:0;" json:"element_model_id"` // 云渲染对应模型id
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID
ModelId *int64 `gorm:"default:0;" json:"model_id"` // 模型ID
Title *string `gorm:"default:'';" json:"title"` // 模板sku,预留字段
Name *string `gorm:"default:'';" json:"name"` // 名称
CoverImg *string `gorm:"default:'';" json:"cover_img"` // 模板背景图
TemplateInfo *string `gorm:"default:'';" json:"template_info"` // 模板详情
MaterialImg *string `gorm:"default:'';" json:"material_img"` // 合成好的贴图
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序
LogoWidth *int64 `gorm:"default:0;" json:"logo_width"` // logo图最大宽度
LogoHeight *int64 `gorm:"default:0;" json:"logo_height"` // logo图最大高度
IsPublic *int64 `gorm:"default:0;" json:"is_public"` // 是否可公用1:可以0不可以,仅供模型关联)
IsPublicTemplate *int64 `gorm:"default:0;" json:"is_public_template"` // 是否是公共模板0非1是(仅针对模板之间)
RelativePublicTemplateId *int64 `gorm:"default:0;" json:"relative_public_template_id"` // 模板间关联的公共模板id
Status *int64 `gorm:"default:0;" json:"status"` // 状态1正常 2异常
TemplateTag *string `gorm:"default:'';" json:"template_tag"` //
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除 1删除
SwitchInfo *string `gorm:"default:'';" json:"switch_info"` // 开关信息
Version *int64 `gorm:"default:0;" json:"version"` // 默认1
ElementModelId *int64 `gorm:"default:0;" json:"element_model_id"` // 云渲染对应模型id
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
}
type FsProductTemplateV2Model struct {
db *gorm.DB

View File

@ -35,16 +35,17 @@ type FsShoppingCartData struct {
// 购物车快照数据结构
type CartSnapshot struct {
Logo string `json:"logo"` //logo地址
CombineImage string `json:"combine_image"` //刀版图地址
RenderImage string `json:"render_image"` //渲染结果图
TemplateInfo TemplateInfo `json:"template_info"` //模板数据
ModelInfo ModelInfo `json:"model_info"` //模型的数据
FittingInfo FittingInfo `json:"fitting_info"` //配件信息
SizeInfo SizeInfo `json:"size_info"` //尺寸基本信息
ProductInfo ProductInfo `json:"product_info"` //产品基本信息(只记录不要使用)
UserDiyInformation UserDiyInformation `json:"user_diy_information"` //用户diy数据
LightInfo LightInfo `json:"light_info"` //灯光数据
Logo string `json:"logo"` //logo地址
LogoMaterialMetadata interface{} `json:"logo_material_metadata"` //logo素材信息
CombineImage string `json:"combine_image"` //刀版图地址
RenderImage string `json:"render_image"` //渲染结果图
TemplateInfo TemplateInfo `json:"template_info"` //模板数据
ModelInfo ModelInfo `json:"model_info"` //模型的数据
FittingInfo FittingInfo `json:"fitting_info"` //配件信息
SizeInfo SizeInfo `json:"size_info"` //尺寸基本信息
ProductInfo ProductInfo `json:"product_info"` //产品基本信息(只记录不要使用)
UserDiyInformation UserDiyInformation `json:"user_diy_information"` //用户diy数据
LightInfo LightInfo `json:"light_info"` //灯光数据
}
type ProductInfo struct {
ProductName string `json:"product_name"`

View File

@ -4,227 +4,229 @@ import "gorm.io/gorm"
// AllModelsGen 所有Model集合,修改单行,只要不改字段名,不会根据新的内容修改,需要修改的话手动删除
type AllModelsGen struct {
CasbinRule *CasbinRuleModel // casbin_rule 后台--权限规则表
FsAddress *FsAddressModel // fs_address 用户地址表
FsAdminApi *FsAdminApiModel // fs_admin_api 后台--接口表
FsAdminDepartment *FsAdminDepartmentModel // fs_admin_department 后台--部门表
FsAdminMenu *FsAdminMenuModel // fs_admin_menu 后台--菜单表
FsAdminRole *FsAdminRoleModel // fs_admin_role 后台--角色表
FsAdminRoleApi *FsAdminRoleApiModel // fs_admin_role_api 后台--角色接口表
FsAdminUser *FsAdminUserModel // fs_admin_user 后台--管理员表
FsAuthAssignment *FsAuthAssignmentModel // fs_auth_assignment 用户角色和权限信息
FsAuthItem *FsAuthItemModel // fs_auth_item 用户角色和权限信息
FsAuthItemChild *FsAuthItemChildModel // fs_auth_item_child 角色和权限关系表
FsAuthRule *FsAuthRuleModel // fs_auth_rule 规则表
FsBackendUser *FsBackendUserModel // fs_backend_user 管理员表
FsCanteenProduct *FsCanteenProductModel // fs_canteen_product 餐厅类别产品对应表
FsCanteenType *FsCanteenTypeModel // fs_canteen_type 餐厅类型表
FsCard *FsCardModel // fs_card 卡号表
FsCardGroup *FsCardGroupModel // fs_card_group 卡号分组表
FsCart *FsCartModel // fs_cart 购物车
FsChangeCode *FsChangeCodeModel // fs_change_code 忘记密码code表
FsCloudDeliverEveryTmpOld *FsCloudDeliverEveryTmpOldModel // fs_cloud_deliver_every_tmp_old
FsCloudDeliverTmpOld *FsCloudDeliverTmpOldModel // fs_cloud_deliver_tmp_old
FsCloudOld *FsCloudOldModel // fs_cloud_old 云仓表
FsCloudPickUpDetailOld *FsCloudPickUpDetailOldModel // fs_cloud_pick_up_detail_old 云仓提货单-详情
FsCloudPickUpOld *FsCloudPickUpOldModel // fs_cloud_pick_up_old 云仓提货单
FsCloudReceiveEveryOld *FsCloudReceiveEveryOldModel // fs_cloud_receive_every_old
FsCloudReceiveOld *FsCloudReceiveOldModel // fs_cloud_receive_old 云仓接收工厂总单
FsCloudRenderLogOld *FsCloudRenderLogOldModel // fs_cloud_render_log_old 云渲染日志表
FsCloudStorage *FsCloudStorageModel // fs_cloud_storage 仓库的基本信息, 只做映射
FsCloudStorageStock *FsCloudStorageStockModel // fs_cloud_storage_stock
FsCloudUserApplyBackOld *FsCloudUserApplyBackOldModel // fs_cloud_user_apply_back_old 该表废弃
FsContact *FsContactModel // fs_contact 该表暂未使用
FsContactService *FsContactServiceModel // fs_contact_service
FsCoupon *FsCouponModel // fs_coupon 代金券(暂未使用)
FsDeliver *FsDeliverModel // fs_deliver 发货表 云仓 直发 通用(已废弃)
FsDeliverEvery *FsDeliverEveryModel // fs_deliver_every 发货详细表(已废弃)
FsDepartment *FsDepartmentModel // fs_department 部门表
FsEmailLogs *FsEmailLogsModel // fs_email_logs 邮件日志表
FsEmailTemplate *FsEmailTemplateModel // fs_email_template 邮件模板表(暂未使用)
FsFactory *FsFactoryModel // fs_factory 该表废弃
FsFactoryDeliver *FsFactoryDeliverModel // fs_factory_deliver 工厂发货主表(废弃)
FsFactoryDeliverEvery *FsFactoryDeliverEveryModel // fs_factory_deliver_every 该表废弃
FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃)
FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp
FsFaq *FsFaqModel // fs_faq 常见问题
FsFont *FsFontModel // fs_font 字体配置
FsGerent *FsGerentModel // fs_gerent 管理员表
FsGuest *FsGuestModel // fs_guest 游客表
FsLog *FsLogModel // fs_log 日志表
FsLogoCartoon *FsLogoCartoonModel // fs_logo_cartoon logo底图表
FsMapLibrary *FsMapLibraryModel // fs_map_library 贴图库
FsMenu *FsMenuModel // fs_menu 后台菜单
FsMerchantCategory *FsMerchantCategoryModel // fs_merchant_category 商户类型表
FsMigration *FsMigrationModel // fs_migration 版本库
FsOrder *FsOrderModel // fs_order 订单表
FsOrderAffiliateOld *FsOrderAffiliateOldModel // fs_order_affiliate_old 订单附属表-流程控制时间等
FsOrderDetailOld *FsOrderDetailOldModel // fs_order_detail_old 订单详细表
FsOrderDetailTemplateOld *FsOrderDetailTemplateOldModel // fs_order_detail_template_old 订单模板详细表
FsOrderOld *FsOrderOldModel // fs_order_old
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 产品表
FsProductCollection *FsProductCollectionModel // fs_product_collection 产品收藏表
FsProductCopy1 *FsProductCopy1Model // fs_product_copy1 产品表
FsProductDesign *FsProductDesignModel // fs_product_design 产品设计表
FsProductDesignGather *FsProductDesignGatherModel // fs_product_design_gather
FsProductModel3d *FsProductModel3dModel // fs_product_model3d 产品模型表
FsProductModel3dLight *FsProductModel3dLightModel // fs_product_model3d_light 模型-灯光组表
FsProductOption *FsProductOptionModel // fs_product_option 产品选项表(已废弃)
FsProductPrice *FsProductPriceModel // fs_product_price 阶梯价格表
FsProductRenderDesign *FsProductRenderDesignModel // fs_product_render_design
FsProductScene *FsProductSceneModel // fs_product_scene 产品场景表
FsProductSize *FsProductSizeModel // fs_product_size 产品尺寸表
FsProductTagProp *FsProductTagPropModel // fs_product_tag_prop 产品标签相关属性表
FsProductTemplate *FsProductTemplateModel // fs_product_template 产品模板表(已废弃)
FsProductTemplateBasemap *FsProductTemplateBasemapModel // fs_product_template_basemap 模板底图表
FsProductTemplateElement *FsProductTemplateElementModel // fs_product_template_element 云渲染配置表
FsProductTemplateElement22 *FsProductTemplateElement22Model // fs_product_template_element_22
FsProductTemplateTags *FsProductTemplateTagsModel // fs_product_template_tags 模板标签表
FsProductTemplateV2 *FsProductTemplateV2Model // fs_product_template_v2 产品-模型-模板表
FsProductV2Tmp *FsProductV2TmpModel // fs_product_v2_tmp 产品表
FsQrcode *FsQrcodeModel // fs_qrcode
FsQrcodeLog *FsQrcodeLogModel // fs_qrcode_log 二维码扫描日志
FsQrcodeSet *FsQrcodeSetModel // fs_qrcode_set 二维码边框配置表
FsQrcodeUser *FsQrcodeUserModel // fs_qrcode_user 二维码-用户名表
FsQuotation *FsQuotationModel // fs_quotation 报价单信息表
FsQuotationPrice *FsQuotationPriceModel // fs_quotation_price 报价单价格表
FsQuotationProduct *FsQuotationProductModel // fs_quotation_product 报价单产品表
FsQuotationRemarkTemplate *FsQuotationRemarkTemplateModel // fs_quotation_remark_template 报价单备注模板
FsQuotationSaler *FsQuotationSalerModel // fs_quotation_saler 报价单业务员表
FsQuotationSizeLayout *FsQuotationSizeLayoutModel // fs_quotation_size_layout 产品尺寸排版表
FsRefundReason *FsRefundReasonModel // fs_refund_reason
FsResource *FsResourceModel // fs_resource 资源表
FsShoppingCart *FsShoppingCartModel // fs_shopping_cart 新版购物车表
FsStandardLogo *FsStandardLogoModel // fs_standard_logo 标准logo
FsTags *FsTagsModel // fs_tags 产品分类表
FsToolLogs *FsToolLogsModel // fs_tool_logs 3d设计工具日志表
FsToolTemplate *FsToolTemplateModel // fs_tool_template 设计工具模板(废弃)
FsToolUser *FsToolUserModel // fs_tool_user 3d设计工具用户表
FsTrade *FsTradeModel // fs_trade
FsUser *FsUserModel // fs_user 用户表
FsUserDesign *FsUserDesignModel // fs_user_design 废弃表
FsUserInfo *FsUserInfoModel // fs_user_info 用户信息表
FsUserMaterial *FsUserMaterialModel // fs_user_material 用户素材表
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
CasbinRule *CasbinRuleModel // casbin_rule 后台--权限规则表
FsAddress *FsAddressModel // fs_address 用户地址表
FsAdminApi *FsAdminApiModel // fs_admin_api 后台--接口表
FsAdminDepartment *FsAdminDepartmentModel // fs_admin_department 后台--部门表
FsAdminMenu *FsAdminMenuModel // fs_admin_menu 后台--菜单表
FsAdminRole *FsAdminRoleModel // fs_admin_role 后台--角色表
FsAdminRoleApi *FsAdminRoleApiModel // fs_admin_role_api 后台--角色接口表
FsAdminUser *FsAdminUserModel // fs_admin_user 后台--管理员表
FsAuthAssignment *FsAuthAssignmentModel // fs_auth_assignment 用户角色和权限信息
FsAuthItem *FsAuthItemModel // fs_auth_item 用户角色和权限信息
FsAuthItemChild *FsAuthItemChildModel // fs_auth_item_child 角色和权限关系表
FsAuthRule *FsAuthRuleModel // fs_auth_rule 规则表
FsBackendUser *FsBackendUserModel // fs_backend_user 管理员表
FsCanteenProduct *FsCanteenProductModel // fs_canteen_product 餐厅类别产品对应表
FsCanteenType *FsCanteenTypeModel // fs_canteen_type 餐厅类型表
FsCard *FsCardModel // fs_card 卡号表
FsCardGroup *FsCardGroupModel // fs_card_group 卡号分组表
FsCart *FsCartModel // fs_cart 购物车
FsChangeCode *FsChangeCodeModel // fs_change_code 忘记密码code表
FsCloudDeliverEveryTmpOld *FsCloudDeliverEveryTmpOldModel // fs_cloud_deliver_every_tmp_old
FsCloudDeliverTmpOld *FsCloudDeliverTmpOldModel // fs_cloud_deliver_tmp_old
FsCloudOld *FsCloudOldModel // fs_cloud_old 云仓表
FsCloudPickUpDetailOld *FsCloudPickUpDetailOldModel // fs_cloud_pick_up_detail_old 云仓提货单-详情
FsCloudPickUpOld *FsCloudPickUpOldModel // fs_cloud_pick_up_old 云仓提货单
FsCloudReceiveEveryOld *FsCloudReceiveEveryOldModel // fs_cloud_receive_every_old
FsCloudReceiveOld *FsCloudReceiveOldModel // fs_cloud_receive_old 云仓接收工厂总单
FsCloudRenderLogOld *FsCloudRenderLogOldModel // fs_cloud_render_log_old 云渲染日志表
FsCloudStorage *FsCloudStorageModel // fs_cloud_storage 仓库的基本信息, 只做映射
FsCloudStorageStock *FsCloudStorageStockModel // fs_cloud_storage_stock
FsCloudUserApplyBackOld *FsCloudUserApplyBackOldModel // fs_cloud_user_apply_back_old 该表废弃
FsContact *FsContactModel // fs_contact 该表暂未使用
FsContactService *FsContactServiceModel // fs_contact_service
FsCoupon *FsCouponModel // fs_coupon 代金券(暂未使用)
FsDeliver *FsDeliverModel // fs_deliver 发货表 云仓 直发 通用(已废弃)
FsDeliverEvery *FsDeliverEveryModel // fs_deliver_every 发货详细表(已废弃)
FsDepartment *FsDepartmentModel // fs_department 部门表
FsEmailLogs *FsEmailLogsModel // fs_email_logs 邮件日志表
FsEmailTemplate *FsEmailTemplateModel // fs_email_template 邮件模板表(暂未使用)
FsFactory *FsFactoryModel // fs_factory 该表废弃
FsFactoryDeliver *FsFactoryDeliverModel // fs_factory_deliver 工厂发货主表(废弃)
FsFactoryDeliverEvery *FsFactoryDeliverEveryModel // fs_factory_deliver_every 该表废弃
FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃)
FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp
FsFaq *FsFaqModel // fs_faq 常见问题
FsFont *FsFontModel // fs_font 字体配置
FsGerent *FsGerentModel // fs_gerent 管理员表
FsGuest *FsGuestModel // fs_guest 游客表
FsLog *FsLogModel // fs_log 日志表
FsLogoCartoon *FsLogoCartoonModel // fs_logo_cartoon logo底图表
FsLogoPreprocess *FsLogoPreprocessModel // fs_logo_preprocess
FsMapLibrary *FsMapLibraryModel // fs_map_library 贴图库
FsMenu *FsMenuModel // fs_menu 后台菜单
FsMerchantCategory *FsMerchantCategoryModel // fs_merchant_category 商户类型表
FsMigration *FsMigrationModel // fs_migration 版本库
FsOrder *FsOrderModel // fs_order 订单表
FsOrderAffiliateOld *FsOrderAffiliateOldModel // fs_order_affiliate_old 订单附属表-流程控制时间等
FsOrderDetailOld *FsOrderDetailOldModel // fs_order_detail_old 订单详细表
FsOrderDetailTemplateOld *FsOrderDetailTemplateOldModel // fs_order_detail_template_old 订单模板详细表
FsOrderOld *FsOrderOldModel // fs_order_old
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 产品表
FsProductCollection *FsProductCollectionModel // fs_product_collection 产品收藏表
FsProductCopy1 *FsProductCopy1Model // fs_product_copy1 产品表
FsProductDesign *FsProductDesignModel // fs_product_design 产品设计表
FsProductDesignGather *FsProductDesignGatherModel // fs_product_design_gather
FsProductHistoryTemplate *FsProductHistoryTemplateModel // fs_product_history_template 模板历史表
FsProductModel3d *FsProductModel3dModel // fs_product_model3d 产品模型表
FsProductModel3dLight *FsProductModel3dLightModel // fs_product_model3d_light 模型-灯光组表
FsProductOption *FsProductOptionModel // fs_product_option 产品选项表(已废弃)
FsProductPrice *FsProductPriceModel // fs_product_price 阶梯价格表
FsProductRenderDesign *FsProductRenderDesignModel // fs_product_render_design
FsProductScene *FsProductSceneModel // fs_product_scene 产品场景表
FsProductSize *FsProductSizeModel // fs_product_size 产品尺寸表
FsProductTagProp *FsProductTagPropModel // fs_product_tag_prop 产品标签相关属性表
FsProductTemplate *FsProductTemplateModel // fs_product_template 产品模板表(已废弃)
FsProductTemplateBasemap *FsProductTemplateBasemapModel // fs_product_template_basemap 模板底图表
FsProductTemplateElement *FsProductTemplateElementModel // fs_product_template_element 云渲染配置表
FsProductTemplateTags *FsProductTemplateTagsModel // fs_product_template_tags 模板标签表
FsProductTemplateV2 *FsProductTemplateV2Model // fs_product_template_v2 产品-模型-模板表
FsProductV2Tmp *FsProductV2TmpModel // fs_product_v2_tmp 产品表
FsQrcode *FsQrcodeModel // fs_qrcode
FsQrcodeLog *FsQrcodeLogModel // fs_qrcode_log 二维码扫描日志
FsQrcodeSet *FsQrcodeSetModel // fs_qrcode_set 二维码边框配置表
FsQrcodeUser *FsQrcodeUserModel // fs_qrcode_user 二维码-用户名表
FsQuotation *FsQuotationModel // fs_quotation 报价单信息表
FsQuotationPrice *FsQuotationPriceModel // fs_quotation_price 报价单价格表
FsQuotationProduct *FsQuotationProductModel // fs_quotation_product 报价单产品表
FsQuotationRemarkTemplate *FsQuotationRemarkTemplateModel // fs_quotation_remark_template 报价单备注模板
FsQuotationSaler *FsQuotationSalerModel // fs_quotation_saler 报价单业务员表
FsQuotationSizeLayout *FsQuotationSizeLayoutModel // fs_quotation_size_layout 产品尺寸排版表
FsRefundReason *FsRefundReasonModel // fs_refund_reason
FsResource *FsResourceModel // fs_resource 资源表
FsShoppingCart *FsShoppingCartModel // fs_shopping_cart 新版购物车表
FsStandardLogo *FsStandardLogoModel // fs_standard_logo 标准logo
FsTags *FsTagsModel // fs_tags 产品分类表
FsToolLogs *FsToolLogsModel // fs_tool_logs 3d设计工具日志表
FsToolTemplate *FsToolTemplateModel // fs_tool_template 设计工具模板(废弃)
FsToolUser *FsToolUserModel // fs_tool_user 3d设计工具用户表
FsTrade *FsTradeModel // fs_trade
FsUser *FsUserModel // fs_user 用户表
FsUserDesign *FsUserDesignModel // fs_user_design 废弃表
FsUserInfo *FsUserInfoModel // fs_user_info 用户信息表
FsUserMaterial *FsUserMaterialModel // fs_user_material 用户素材表
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
}
func NewAllModels(gdb *gorm.DB) *AllModelsGen {
models := &AllModelsGen{
CasbinRule: NewCasbinRuleModel(gdb),
FsAddress: NewFsAddressModel(gdb),
FsAdminApi: NewFsAdminApiModel(gdb),
FsAdminDepartment: NewFsAdminDepartmentModel(gdb),
FsAdminMenu: NewFsAdminMenuModel(gdb),
FsAdminRole: NewFsAdminRoleModel(gdb),
FsAdminRoleApi: NewFsAdminRoleApiModel(gdb),
FsAdminUser: NewFsAdminUserModel(gdb),
FsAuthAssignment: NewFsAuthAssignmentModel(gdb),
FsAuthItem: NewFsAuthItemModel(gdb),
FsAuthItemChild: NewFsAuthItemChildModel(gdb),
FsAuthRule: NewFsAuthRuleModel(gdb),
FsBackendUser: NewFsBackendUserModel(gdb),
FsCanteenProduct: NewFsCanteenProductModel(gdb),
FsCanteenType: NewFsCanteenTypeModel(gdb),
FsCard: NewFsCardModel(gdb),
FsCardGroup: NewFsCardGroupModel(gdb),
FsCart: NewFsCartModel(gdb),
FsChangeCode: NewFsChangeCodeModel(gdb),
FsCloudDeliverEveryTmpOld: NewFsCloudDeliverEveryTmpOldModel(gdb),
FsCloudDeliverTmpOld: NewFsCloudDeliverTmpOldModel(gdb),
FsCloudOld: NewFsCloudOldModel(gdb),
FsCloudPickUpDetailOld: NewFsCloudPickUpDetailOldModel(gdb),
FsCloudPickUpOld: NewFsCloudPickUpOldModel(gdb),
FsCloudReceiveEveryOld: NewFsCloudReceiveEveryOldModel(gdb),
FsCloudReceiveOld: NewFsCloudReceiveOldModel(gdb),
FsCloudRenderLogOld: NewFsCloudRenderLogOldModel(gdb),
FsCloudStorage: NewFsCloudStorageModel(gdb),
FsCloudStorageStock: NewFsCloudStorageStockModel(gdb),
FsCloudUserApplyBackOld: NewFsCloudUserApplyBackOldModel(gdb),
FsContact: NewFsContactModel(gdb),
FsContactService: NewFsContactServiceModel(gdb),
FsCoupon: NewFsCouponModel(gdb),
FsDeliver: NewFsDeliverModel(gdb),
FsDeliverEvery: NewFsDeliverEveryModel(gdb),
FsDepartment: NewFsDepartmentModel(gdb),
FsEmailLogs: NewFsEmailLogsModel(gdb),
FsEmailTemplate: NewFsEmailTemplateModel(gdb),
FsFactory: NewFsFactoryModel(gdb),
FsFactoryDeliver: NewFsFactoryDeliverModel(gdb),
FsFactoryDeliverEvery: NewFsFactoryDeliverEveryModel(gdb),
FsFactoryProduct: NewFsFactoryProductModel(gdb),
FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb),
FsFaq: NewFsFaqModel(gdb),
FsFont: NewFsFontModel(gdb),
FsGerent: NewFsGerentModel(gdb),
FsGuest: NewFsGuestModel(gdb),
FsLog: NewFsLogModel(gdb),
FsLogoCartoon: NewFsLogoCartoonModel(gdb),
FsMapLibrary: NewFsMapLibraryModel(gdb),
FsMenu: NewFsMenuModel(gdb),
FsMerchantCategory: NewFsMerchantCategoryModel(gdb),
FsMigration: NewFsMigrationModel(gdb),
FsOrder: NewFsOrderModel(gdb),
FsOrderAffiliateOld: NewFsOrderAffiliateOldModel(gdb),
FsOrderDetailOld: NewFsOrderDetailOldModel(gdb),
FsOrderDetailTemplateOld: NewFsOrderDetailTemplateOldModel(gdb),
FsOrderOld: NewFsOrderOldModel(gdb),
FsOrderRemarkOld: NewFsOrderRemarkOldModel(gdb),
FsOrderTrade: NewFsOrderTradeModel(gdb),
FsOrderTradeEvent: NewFsOrderTradeEventModel(gdb),
FsPay: NewFsPayModel(gdb),
FsPayEvent: NewFsPayEventModel(gdb),
FsProduct: NewFsProductModel(gdb),
FsProductCollection: NewFsProductCollectionModel(gdb),
FsProductCopy1: NewFsProductCopy1Model(gdb),
FsProductDesign: NewFsProductDesignModel(gdb),
FsProductDesignGather: NewFsProductDesignGatherModel(gdb),
FsProductModel3d: NewFsProductModel3dModel(gdb),
FsProductModel3dLight: NewFsProductModel3dLightModel(gdb),
FsProductOption: NewFsProductOptionModel(gdb),
FsProductPrice: NewFsProductPriceModel(gdb),
FsProductRenderDesign: NewFsProductRenderDesignModel(gdb),
FsProductScene: NewFsProductSceneModel(gdb),
FsProductSize: NewFsProductSizeModel(gdb),
FsProductTagProp: NewFsProductTagPropModel(gdb),
FsProductTemplate: NewFsProductTemplateModel(gdb),
FsProductTemplateBasemap: NewFsProductTemplateBasemapModel(gdb),
FsProductTemplateElement: NewFsProductTemplateElementModel(gdb),
FsProductTemplateElement22: NewFsProductTemplateElement22Model(gdb),
FsProductTemplateTags: NewFsProductTemplateTagsModel(gdb),
FsProductTemplateV2: NewFsProductTemplateV2Model(gdb),
FsProductV2Tmp: NewFsProductV2TmpModel(gdb),
FsQrcode: NewFsQrcodeModel(gdb),
FsQrcodeLog: NewFsQrcodeLogModel(gdb),
FsQrcodeSet: NewFsQrcodeSetModel(gdb),
FsQrcodeUser: NewFsQrcodeUserModel(gdb),
FsQuotation: NewFsQuotationModel(gdb),
FsQuotationPrice: NewFsQuotationPriceModel(gdb),
FsQuotationProduct: NewFsQuotationProductModel(gdb),
FsQuotationRemarkTemplate: NewFsQuotationRemarkTemplateModel(gdb),
FsQuotationSaler: NewFsQuotationSalerModel(gdb),
FsQuotationSizeLayout: NewFsQuotationSizeLayoutModel(gdb),
FsRefundReason: NewFsRefundReasonModel(gdb),
FsResource: NewFsResourceModel(gdb),
FsShoppingCart: NewFsShoppingCartModel(gdb),
FsStandardLogo: NewFsStandardLogoModel(gdb),
FsTags: NewFsTagsModel(gdb),
FsToolLogs: NewFsToolLogsModel(gdb),
FsToolTemplate: NewFsToolTemplateModel(gdb),
FsToolUser: NewFsToolUserModel(gdb),
FsTrade: NewFsTradeModel(gdb),
FsUser: NewFsUserModel(gdb),
FsUserDesign: NewFsUserDesignModel(gdb),
FsUserInfo: NewFsUserInfoModel(gdb),
FsUserMaterial: NewFsUserMaterialModel(gdb),
FsUserStock: NewFsUserStockModel(gdb),
FsWebSet: NewFsWebSetModel(gdb),
CasbinRule: NewCasbinRuleModel(gdb),
FsAddress: NewFsAddressModel(gdb),
FsAdminApi: NewFsAdminApiModel(gdb),
FsAdminDepartment: NewFsAdminDepartmentModel(gdb),
FsAdminMenu: NewFsAdminMenuModel(gdb),
FsAdminRole: NewFsAdminRoleModel(gdb),
FsAdminRoleApi: NewFsAdminRoleApiModel(gdb),
FsAdminUser: NewFsAdminUserModel(gdb),
FsAuthAssignment: NewFsAuthAssignmentModel(gdb),
FsAuthItem: NewFsAuthItemModel(gdb),
FsAuthItemChild: NewFsAuthItemChildModel(gdb),
FsAuthRule: NewFsAuthRuleModel(gdb),
FsBackendUser: NewFsBackendUserModel(gdb),
FsCanteenProduct: NewFsCanteenProductModel(gdb),
FsCanteenType: NewFsCanteenTypeModel(gdb),
FsCard: NewFsCardModel(gdb),
FsCardGroup: NewFsCardGroupModel(gdb),
FsCart: NewFsCartModel(gdb),
FsChangeCode: NewFsChangeCodeModel(gdb),
FsCloudDeliverEveryTmpOld: NewFsCloudDeliverEveryTmpOldModel(gdb),
FsCloudDeliverTmpOld: NewFsCloudDeliverTmpOldModel(gdb),
FsCloudOld: NewFsCloudOldModel(gdb),
FsCloudPickUpDetailOld: NewFsCloudPickUpDetailOldModel(gdb),
FsCloudPickUpOld: NewFsCloudPickUpOldModel(gdb),
FsCloudReceiveEveryOld: NewFsCloudReceiveEveryOldModel(gdb),
FsCloudReceiveOld: NewFsCloudReceiveOldModel(gdb),
FsCloudRenderLogOld: NewFsCloudRenderLogOldModel(gdb),
FsCloudStorage: NewFsCloudStorageModel(gdb),
FsCloudStorageStock: NewFsCloudStorageStockModel(gdb),
FsCloudUserApplyBackOld: NewFsCloudUserApplyBackOldModel(gdb),
FsContact: NewFsContactModel(gdb),
FsContactService: NewFsContactServiceModel(gdb),
FsCoupon: NewFsCouponModel(gdb),
FsDeliver: NewFsDeliverModel(gdb),
FsDeliverEvery: NewFsDeliverEveryModel(gdb),
FsDepartment: NewFsDepartmentModel(gdb),
FsEmailLogs: NewFsEmailLogsModel(gdb),
FsEmailTemplate: NewFsEmailTemplateModel(gdb),
FsFactory: NewFsFactoryModel(gdb),
FsFactoryDeliver: NewFsFactoryDeliverModel(gdb),
FsFactoryDeliverEvery: NewFsFactoryDeliverEveryModel(gdb),
FsFactoryProduct: NewFsFactoryProductModel(gdb),
FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb),
FsFaq: NewFsFaqModel(gdb),
FsFont: NewFsFontModel(gdb),
FsGerent: NewFsGerentModel(gdb),
FsGuest: NewFsGuestModel(gdb),
FsLog: NewFsLogModel(gdb),
FsLogoCartoon: NewFsLogoCartoonModel(gdb),
FsLogoPreprocess: NewFsLogoPreprocessModel(gdb),
FsMapLibrary: NewFsMapLibraryModel(gdb),
FsMenu: NewFsMenuModel(gdb),
FsMerchantCategory: NewFsMerchantCategoryModel(gdb),
FsMigration: NewFsMigrationModel(gdb),
FsOrder: NewFsOrderModel(gdb),
FsOrderAffiliateOld: NewFsOrderAffiliateOldModel(gdb),
FsOrderDetailOld: NewFsOrderDetailOldModel(gdb),
FsOrderDetailTemplateOld: NewFsOrderDetailTemplateOldModel(gdb),
FsOrderOld: NewFsOrderOldModel(gdb),
FsOrderRemarkOld: NewFsOrderRemarkOldModel(gdb),
FsOrderTrade: NewFsOrderTradeModel(gdb),
FsOrderTradeEvent: NewFsOrderTradeEventModel(gdb),
FsPay: NewFsPayModel(gdb),
FsPayEvent: NewFsPayEventModel(gdb),
FsProduct: NewFsProductModel(gdb),
FsProductCollection: NewFsProductCollectionModel(gdb),
FsProductCopy1: NewFsProductCopy1Model(gdb),
FsProductDesign: NewFsProductDesignModel(gdb),
FsProductDesignGather: NewFsProductDesignGatherModel(gdb),
FsProductHistoryTemplate: NewFsProductHistoryTemplateModel(gdb),
FsProductModel3d: NewFsProductModel3dModel(gdb),
FsProductModel3dLight: NewFsProductModel3dLightModel(gdb),
FsProductOption: NewFsProductOptionModel(gdb),
FsProductPrice: NewFsProductPriceModel(gdb),
FsProductRenderDesign: NewFsProductRenderDesignModel(gdb),
FsProductScene: NewFsProductSceneModel(gdb),
FsProductSize: NewFsProductSizeModel(gdb),
FsProductTagProp: NewFsProductTagPropModel(gdb),
FsProductTemplate: NewFsProductTemplateModel(gdb),
FsProductTemplateBasemap: NewFsProductTemplateBasemapModel(gdb),
FsProductTemplateElement: NewFsProductTemplateElementModel(gdb),
FsProductTemplateTags: NewFsProductTemplateTagsModel(gdb),
FsProductTemplateV2: NewFsProductTemplateV2Model(gdb),
FsProductV2Tmp: NewFsProductV2TmpModel(gdb),
FsQrcode: NewFsQrcodeModel(gdb),
FsQrcodeLog: NewFsQrcodeLogModel(gdb),
FsQrcodeSet: NewFsQrcodeSetModel(gdb),
FsQrcodeUser: NewFsQrcodeUserModel(gdb),
FsQuotation: NewFsQuotationModel(gdb),
FsQuotationPrice: NewFsQuotationPriceModel(gdb),
FsQuotationProduct: NewFsQuotationProductModel(gdb),
FsQuotationRemarkTemplate: NewFsQuotationRemarkTemplateModel(gdb),
FsQuotationSaler: NewFsQuotationSalerModel(gdb),
FsQuotationSizeLayout: NewFsQuotationSizeLayoutModel(gdb),
FsRefundReason: NewFsRefundReasonModel(gdb),
FsResource: NewFsResourceModel(gdb),
FsShoppingCart: NewFsShoppingCartModel(gdb),
FsStandardLogo: NewFsStandardLogoModel(gdb),
FsTags: NewFsTagsModel(gdb),
FsToolLogs: NewFsToolLogsModel(gdb),
FsToolTemplate: NewFsToolTemplateModel(gdb),
FsToolUser: NewFsToolUserModel(gdb),
FsTrade: NewFsTradeModel(gdb),
FsUser: NewFsUserModel(gdb),
FsUserDesign: NewFsUserDesignModel(gdb),
FsUserInfo: NewFsUserInfoModel(gdb),
FsUserMaterial: NewFsUserMaterialModel(gdb),
FsUserStock: NewFsUserStockModel(gdb),
FsWebSet: NewFsWebSetModel(gdb),
}
return models
}

View File

@ -22,11 +22,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/product/get_model_by_pid",
Handler: GetModelByPidHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/product/get_price_by_pid",
Handler: GetPriceByPidHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/product/get_product_step_price",

View File

@ -1,165 +0,0 @@
package logic
import (
"errors"
"fmt"
"fusenapi/model/gmodel"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/utils/format"
"fusenapi/utils/step_price"
"sort"
"strings"
"gorm.io/gorm"
"context"
"fusenapi/server/product/internal/svc"
"fusenapi/server/product/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type GetPriceByPidLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewGetPriceByPidLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPriceByPidLogic {
return &GetPriceByPidLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *GetPriceByPidLogic) GetPriceByPid(req *types.GetPriceByPidReq, userinfo *auth.UserInfo) (resp *basic.Response) {
req.Pid = strings.Trim(req.Pid, " ")
if req.Pid == "" {
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "err param:pid is empty")
}
//获取产品信息(只是获取id)
productInfo, err := l.svcCtx.AllModels.FsProduct.FindOneBySn(l.ctx, req.Pid, "id")
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "the product is not exists")
}
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product info")
}
//查询产品价格
priceList, err := l.svcCtx.AllModels.FsProductPrice.GetPriceListByProductIds(l.ctx, []int64{productInfo.Id})
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get price list")
}
if len(priceList) == 0 {
return resp.SetStatusWithMessage(basic.CodeOK, "success:price list is empty")
}
//处理价格信息
mapRsp := make(map[string]*types.GetPriceByPidRsp)
for _, priceInfo := range priceList {
stepNumSlice, err := format.StrSlicToIntSlice(strings.Split(*priceInfo.StepNum, ","))
if err != nil {
return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("failed to parse step num,price_id=%d", priceInfo.Id))
}
stepPriceSlice, err := format.StrSlicToIntSlice(strings.Split(*priceInfo.StepPrice, ","))
if err != nil {
return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("failed to parse step price,id = %d", priceInfo.Id))
}
if len(stepPriceSlice) == 0 || len(stepNumSlice) == 0 {
return resp.SetStatusWithMessage(basic.CodeServiceErr, "number of step num or step price is zero")
}
lenStepNum := len(stepNumSlice)
itemList := make([]types.PriceItem, 0, 10)
tmpMinBuyNum := *priceInfo.MinBuyNum
for tmpMinBuyNum < (int64(stepNumSlice[lenStepNum-1]) + 5) {
itemList = append(itemList, types.PriceItem{
Num: tmpMinBuyNum,
TotalNum: tmpMinBuyNum * (*priceInfo.EachBoxNum),
Price: step_price.GetCentStepPrice(int(tmpMinBuyNum), stepNumSlice, stepPriceSlice),
})
tmpMinBuyNum++
}
//组装阶梯数量范围价格
stepRange := l.dealWithStepRange(stepNumSlice, stepPriceSlice, priceInfo)
//排序(必须放在其他逻辑之后)
sort.Ints(stepPriceSlice)
minPrice := float64(stepPriceSlice[0]) / 100
maxPrice := float64(stepPriceSlice[len(stepPriceSlice)-1]) / 100
mapKey := l.getSizePriceMapKey(*priceInfo.SizeId)
mapRsp[mapKey] = &types.GetPriceByPidRsp{
Items: itemList,
MinPrice: minPrice,
MaxPrice: maxPrice,
StepRange: stepRange,
}
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", mapRsp)
}
// 组装阶梯价格范围
func (l *GetPriceByPidLogic) dealWithStepRange(stepNumSlice, stepPriceSlice []int, priceInfo gmodel.FsProductPrice) []types.StepRange {
//要求写死不影响前端展示
return []types.StepRange{
{
Begin: 1000,
End: 2999,
Price: 0.23,
},
{
Begin: 3000,
End: 4999,
Price: 0.2,
},
{
Begin: 5000,
End: -1,
Price: 0.1,
},
}
//下面是正常的
lenStepNum := len(stepNumSlice)
lenStepPrice := len(stepPriceSlice)
stepListRsp := make([]types.StepRange, 0, lenStepNum)
//只有一个阶梯价格
if lenStepPrice == 1 {
stepListRsp = append(stepListRsp, types.StepRange{
Begin: *priceInfo.MinBuyNum * (*priceInfo.EachBoxNum),
End: -1,
Price: float64(stepPriceSlice[0]) / 100,
})
return stepListRsp
}
begin := int64(0)
end := int64(0)
for numKey, stepNum := range stepNumSlice {
//先取最后一个
tmpPrice := float64(stepPriceSlice[lenStepPrice-1]) / 100
//如果同下标下面有价格
if numKey < lenStepPrice {
tmpPrice = float64(stepPriceSlice[numKey]) / 100
}
begin = int64(stepNum) * (*priceInfo.EachBoxNum)
//不是最后一个
if numKey < lenStepNum-1 {
nextBegin := int64(stepNumSlice[numKey+1]) * (*priceInfo.EachBoxNum)
end = nextBegin - 1
} else {
end = -1
}
stepListRsp = append(stepListRsp, types.StepRange{
Begin: begin,
End: end,
Price: tmpPrice,
})
}
return stepListRsp
}
// 获取mapKey
func (l *GetPriceByPidLogic) getSizePriceMapKey(sizeId int64) string {
return fmt.Sprintf("_%d", sizeId)
}

View File

@ -339,7 +339,7 @@ func (l *GetProductDetailLogic) getRenderDefaultSize(productId int64, templateTa
// 获取对应模板标签颜色信息
func (l *GetProductDetailLogic) GetTemplateTagColor(req *types.GetProductDetailReq, userinfo *auth.UserInfo) (resp types.TemplateTagColorInfo, err error) {
if req.SelectColorIndex < 0 {
if req.SelectedColorIndex < 0 {
return types.TemplateTagColorInfo{}, errors.New("param selected_color_index is invalid")
}
//根据logo查询素材资源
@ -387,7 +387,7 @@ func (l *GetProductDetailLogic) GetTemplateTagColor(req *types.GetProductDetailR
if !ok {
return types.TemplateTagColorInfo{}, errors.New("the template tag is not found from this logo material`s metadata")
}
if req.SelectColorIndex >= len(colors) {
if req.SelectedColorIndex >= len(colors) {
return types.TemplateTagColorInfo{}, errors.New("select color index is out of range !!")
}
var templateTagGroups interface{}
@ -399,7 +399,7 @@ func (l *GetProductDetailLogic) GetTemplateTagColor(req *types.GetProductDetailR
}
return types.TemplateTagColorInfo{
Colors: colors,
SelectedColorIndex: req.SelectColorIndex,
SelectedColorIndex: req.SelectedColorIndex,
TemplateTagGroups: templateTagGroups,
}, nil
}

View File

@ -8,7 +8,6 @@ import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/utils/format"
"fusenapi/utils/image"
"fusenapi/utils/s3url_to_s3id"
"gorm.io/gorm"
"strings"
@ -36,11 +35,10 @@ func NewGetRecommandProductListLogic(ctx context.Context, svcCtx *svc.ServiceCon
}
func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRecommandProductListReq, userinfo *auth.UserInfo) (resp *basic.Response) {
req.Num = 4 //写死4个
if req.Size > 0 {
req.Size = int32(image.GetCurrentSize(uint32(req.Size)))
if req.Num > 100 || req.Num < 0 {
req.Num = 4
}
productInfo, err := l.svcCtx.AllModels.FsProduct.FindOneBySn(l.ctx, req.Sn)
productInfo, err := l.svcCtx.AllModels.FsProduct.FindOne(l.ctx, req.ProductId)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "detail`s product is not found")
@ -62,6 +60,10 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get recommend product list")
}
//超过了截取
if len(recommendProductList) > int(req.Num) {
recommendProductList = recommendProductList[:req.Num]
}
}
//资源id集合
resourceIds := make([]string, 0, 50)
@ -92,6 +94,32 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
recommendProductList = append(recommendProductList, v)
}
}
//获取商品可选配件
productOptionalPartList, err := l.svcCtx.AllModels.FsProductModel3d.GetGroupPartListByProductIds(l.ctx, productIds)
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product part list")
}
//存储有配件的map
mapProductHaveOptionFitting := make(map[int64]struct{})
for _, partList := range productOptionalPartList {
partList.PartList = strings.Trim(partList.PartList, " ")
partList.PartList = strings.Trim(partList.PartList, ",")
if partList.PartList == "" {
continue
}
mapProductHaveOptionFitting[partList.ProductId] = struct{}{}
}
//获取产品尺寸数量
productSizeCountList, err := l.svcCtx.AllModels.FsProductSize.GetGroupProductSizeByStatus(l.ctx, productIds, 1)
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get ")
}
mapProductSizeCount := make(map[int64]int64)
for _, v := range productSizeCountList {
mapProductSizeCount[v.ProductId] = v.Num
}
//获取产品最低价
mapProductMinPrice := make(map[int64]int64)
modelList, err := l.svcCtx.AllModels.FsProductModel3d.GetAllByProductIdsTags(l.ctx, []int64{productInfo.Id}, []int{constants.TAG_MODEL, constants.TAG_PARTS}, "id,size_id,product_id,price,tag,part_id,step_price")
@ -144,20 +172,30 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
if minVal, ok := mapProductMinPrice[v.Id]; ok {
minPrice = minVal
}
sizeCount := int64(0)
if sc, ok := mapProductSizeCount[v.Id]; ok {
sizeCount = sc
}
haveOptionalFitting := false
if _, ok := mapProductHaveOptionFitting[v.Id]; ok {
haveOptionalFitting = true
}
item := types.GetRecommandProductListRsp{
Id: v.Id,
Sn: *v.Sn,
Title: *v.Title,
TitleCn: *v.TitleCn,
Cover: *v.Cover,
CoverMetadata: mapResourceMetadata[*v.Cover],
CoverImg: *v.CoverImg,
CoverImgMetadata: mapResourceMetadata[*v.CoverImg],
CoverDefault: []types.CoverDefaultItem{},
Intro: *v.Intro,
Recommend: recommend,
MinPrice: minPrice,
IsCustomization: *v.IsCustomization,
Id: v.Id,
Sn: *v.Sn,
Title: *v.Title,
TitleCn: *v.TitleCn,
Cover: *v.Cover,
CoverMetadata: mapResourceMetadata[*v.Cover],
CoverImg: *v.CoverImg,
CoverImgMetadata: mapResourceMetadata[*v.CoverImg],
CoverDefault: []types.CoverDefaultItem{},
Intro: *v.Intro,
Recommend: recommend,
MinPrice: minPrice,
IsCustomization: *v.IsCustomization,
SizeCount: sizeCount,
HaveOptionalFitting: haveOptionalFitting,
}
if _, ok := mapTagProp[productInfo.Id]; ok {
item.CoverDefault = mapTagProp[productInfo.Id]

View File

@ -6,25 +6,26 @@ import (
)
type GetRecommandProductListReq struct {
Size int32 `form:"size,optional"`
Num int64 `form:"num,optional"`
Sn string `form:"sn"`
Num int64 `form:"num,optional"`
ProductId int64 `form:"product_id"`
}
type GetRecommandProductListRsp struct {
Id int64 `json:"id"`
Sn string `json:"sn"`
Title string `json:"title"`
TitleCn string `json:"title_cn"`
Cover string `json:"cover"`
CoverMetadata interface{} `json:"cover_metadata"`
CoverImg string `json:"cover_img"`
CoverImgMetadata interface{} `json:"cover_img_metadata"`
CoverDefault []CoverDefaultItem `json:"cover_default"`
Intro string `json:"intro"`
Recommend bool `json:"recommend"`
MinPrice int64 `json:"min_price"`
IsCustomization int64 `json:"is_customization"`
Id int64 `json:"id"`
Sn string `json:"sn"`
Title string `json:"title"`
TitleCn string `json:"title_cn"`
Cover string `json:"cover"`
CoverMetadata interface{} `json:"cover_metadata"`
CoverImg string `json:"cover_img"`
CoverImgMetadata interface{} `json:"cover_img_metadata"`
CoverDefault []CoverDefaultItem `json:"cover_default"`
Intro string `json:"intro"`
Recommend bool `json:"recommend"`
MinPrice int64 `json:"min_price"`
IsCustomization int64 `json:"is_customization"`
SizeCount int64 `json:"size_count"`
HaveOptionalFitting bool `json:"have_optional_fitting"`
}
type GetTagProductListReq struct {
@ -73,29 +74,6 @@ type GetModelByPidReq struct {
Pid string `form:"pid"` //实际上是产品sn
}
type GetPriceByPidReq struct {
Pid string `form:"pid"`
}
type GetPriceByPidRsp struct {
Items []PriceItem `json:"items"`
MinPrice float64 `json:"min_price"`
MaxPrice float64 `json:"max_price"`
StepRange []StepRange `json:"step_range"`
}
type StepRange struct {
Begin int64 `json:"begin"`
End int64 `json:"end"`
Price float64 `json:"price"`
}
type PriceItem struct {
Num int64 `json:"num"`
TotalNum int64 `json:"total_num"`
Price int64 `json:"price"`
}
type GetProductStepPriceReq struct {
ProductId int64 `form:"product_id"`
}
@ -192,10 +170,10 @@ type HomePageRecommendProductListRsp struct {
}
type GetProductDetailReq struct {
ProductId int64 `form:"product_id"` //产品id
TemplateTag string `form:"template_tag"` //模板标签
SelectColorIndex int `form:"select_color_index"` //模板标签颜色索引
Logo string `form:"logo"` //logo地址
ProductId int64 `form:"product_id"` //产品id
TemplateTag string `form:"template_tag"` //模板标签
SelectedColorIndex int `form:"selected_color_index"` //模板标签颜色索引
Logo string `form:"logo"` //logo地址
}
type GetProductDetailRsp struct {

View File

@ -6,27 +6,27 @@ import (
"fusenapi/utils/basic"
"fusenapi/server/product/internal/logic"
"fusenapi/server/product/internal/svc"
"fusenapi/server/product/internal/types"
"fusenapi/server/shopping-cart/internal/logic"
"fusenapi/server/shopping-cart/internal/svc"
"fusenapi/server/shopping-cart/internal/types"
)
func GetPriceByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func GetCartNumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetPriceByPidReq
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewGetPriceByPidLogic(r.Context(), svcCtx)
l := logic.NewGetCartNumLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.GetPriceByPid(&req, userinfo)
resp := l.GetCartNum(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)

View File

@ -32,6 +32,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/shopping-cart/calculate_cart_price",
Handler: CalculateCartPriceHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/shopping-cart/get_cart_num",
Handler: GetCartNumHandler(serverCtx),
},
},
)
}

View File

@ -12,6 +12,7 @@ import (
"fusenapi/utils/basic"
"fusenapi/utils/file"
"fusenapi/utils/hash"
"fusenapi/utils/s3url_to_s3id"
"gorm.io/gorm"
"strings"
"time"
@ -54,6 +55,20 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
if cartCount >= 100 {
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "sorry,the count of your carts can`t greater than 100")
}
logoResourceId := s3url_to_s3id.GetS3ResourceIdFormUrl(req.Logo)
//获取用户素材信息
userMaterialInfo, err := l.svcCtx.AllModels.FsUserMaterial.FindOneByLogoResourceId(l.ctx, logoResourceId)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusAddMessage(basic.CodeDbRecordNotFoundErr, "the user logo material info is not found")
}
logx.Error(err)
return resp.SetStatusAddMessage(basic.CodeDbSqlErr, "failed to get user logo material info")
}
var logoMaterialMetadata interface{}
if userMaterialInfo.Metadata != nil && len(*userMaterialInfo.Metadata) != 0 {
_ = json.Unmarshal(*userMaterialInfo.Metadata, &logoMaterialMetadata)
}
//不是传路径则就是传base64
if !strings.Contains(req.RenderImage, "https://") {
//上传base64文件
@ -206,9 +221,10 @@ func (l *AddToCartLogic) AddToCart(req *types.AddToCartReq, userinfo *auth.UserI
sizeKeyInfo.Capacity = *sizeInfo.Capacity
//快照数据
snapshot := gmodel.CartSnapshot{
Logo: req.Logo,
CombineImage: req.CombineImage,
RenderImage: req.RenderImage,
Logo: req.Logo,
LogoMaterialMetadata: logoMaterialMetadata,
CombineImage: req.CombineImage,
RenderImage: req.RenderImage,
TemplateInfo: gmodel.TemplateInfo{
TemplateJson: templateJson,
TemplateTag: templateTag,
@ -268,7 +284,7 @@ func (l *AddToCartLogic) AddToCartParamVerify(req *types.AddToCartReq) error {
return errors.New("product_id is required")
}
if req.SizeId <= 0 {
return errors.New("product size is required")
return errors.New("product size id is required")
}
if req.PurchaseQuantity <= 0 {
return errors.New("purchase quantity can not less than 0 or equal 0")
@ -280,6 +296,9 @@ func (l *AddToCartLogic) AddToCartParamVerify(req *types.AddToCartReq) error {
if req.SelectColorIndex < 0 {
return errors.New("invalid select color index")
}
if req.Logo == "" {
return errors.New("logo is required")
}
return nil
}

View File

@ -0,0 +1,50 @@
package logic
import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/shopping-cart/internal/svc"
"fusenapi/server/shopping-cart/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type GetCartNumLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewGetCartNumLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCartNumLogic {
return &GetCartNumLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *GetCartNumLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *GetCartNumLogic) GetCartNum(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
if !userinfo.IsUser() {
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in")
}
count, err := l.svcCtx.AllModels.FsShoppingCart.CountUserCart(l.ctx, userinfo.UserId)
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get cart num")
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetCartNumRsp{
TotalCount: count,
})
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *GetCartNumLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -114,6 +114,10 @@ type CalculateResultItem struct {
TotalPrice string `json:"total_price"` //总价
}
type GetCartNumRsp struct {
TotalCount int64 `json:"total_count"`
}
type Request struct {
}

View File

@ -118,14 +118,18 @@ func (l *DataTransferLogic) DataTransfer(req *types.DataTransferReq, w http.Resp
case 2:
token = strings.Trim(tokenSlice[0], " ")
debugToken = strings.Trim(tokenSlice[1], " ")
r.Header.Set("Debug-Token", debugToken)
default:
logx.Error("invalid ws token:", tokens)
return
}
r.Header.Set("Authorization", "Bearer "+token)
if token != "empty_token" && token != "" {
r.Header.Set("Authorization", "Bearer "+token)
}
if debugToken != "empty_debug_token" && debugToken != "" {
r.Header.Set("Debug-Token", debugToken)
}
//设置Sec-Websocket-Protocol
upgrader.Subprotocols = []string{tokens}
upgrader.Subprotocols = strings.Split(tokens, ",")
}
//判断下是否火狐浏览器(获取浏览器第一条消息返回有收不到的bug需要延迟1秒)
userAgent := r.Header.Get("User-Agent")
@ -178,7 +182,10 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
uniqueId, err := l.getUniqueId(userInfo, userAgent, 10)
if err != nil {
//发送获取唯一标识失败的消息
l.sendGetUniqueIdErrResponse(conn)
if isFirefoxBrowser {
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
}
l.sendGetUniqueIdErrResponse(conn, userInfo.Debug)
return wsConnectItem{}, err
}
//传入绑定的wid判断是否可重用
@ -239,6 +246,13 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
},
debug: userInfo.Debug,
}
//********强制开启debug 后面删掉
e := int64(1700359131)
ws.debug = &auth.Debug{
Exp: &e,
IsCache: 1,
IsAllTemplateTag: 0,
}
//保存连接
mapConnPool.Store(uniqueId, ws)
//非白板用户需要为这个用户建立map索引便于通过用户查询
@ -246,17 +260,12 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use
if isFirefoxBrowser {
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
}
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, websocket_data.ConnectSuccessMsg{Wid: uniqueId, Debug: ws.debug != nil}))
ws.sendToOutChan(ws.respondDataFormat(constants.WEBSOCKET_CONNECT_SUCCESS, websocket_data.ConnectSuccessMsg{Wid: uniqueId}))
//发送累加统计连接数
increaseWebsocketConnectCount()
return ws, nil
}
// 获取websocket发送到前端使用的数据传输类型debug开启是文本否则是二进制
func getWebsocketBaseTransferDataFormat() int {
return websocket.TextMessage
}
// 获取唯一id
func (l *DataTransferLogic) getUniqueId(userInfo *auth.UserInfo, userAgent string, retryTimes int) (uniqueId string, err error) {
if retryTimes < 0 {
@ -294,36 +303,6 @@ func (l *DataTransferLogic) checkAuth(r *http.Request) (isAuth bool, userInfo *a
return true, userInfo
}
// 鉴权失败通知
func (l *DataTransferLogic) unAuthResponse(conn *websocket.Conn, isFirefoxBrowser bool, errMessage string) {
rsp := websocket_data.DataTransferData{
T: constants.WEBSOCKET_UNAUTH,
D: websocket_data.ConnectUnAuth{Message: errMessage},
}
b, _ := json.Marshal(rsp)
if isFirefoxBrowser {
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
}
//先发一条正常信息
_ = conn.WriteMessage(getWebsocketBaseTransferDataFormat(), b)
//发送关闭信息
_ = conn.WriteMessage(websocket.CloseMessage, nil)
}
// 获取唯一标识失败通知
func (l *DataTransferLogic) sendGetUniqueIdErrResponse(conn *websocket.Conn) {
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
rsp := websocket_data.DataTransferData{
T: constants.WEBSOCKET_CONNECT_ERR,
D: websocket_data.ConnectErrMsg{Message: "err to gen unique id "},
}
b, _ := json.Marshal(rsp)
//先发一条正常信息
_ = conn.WriteMessage(getWebsocketBaseTransferDataFormat(), b)
//发送关闭信息
_ = conn.WriteMessage(websocket.CloseMessage, nil)
}
// 心跳检测
func (w *wsConnectItem) heartbeat() {
tick := time.Tick(time.Second * 5)
@ -465,8 +444,9 @@ func (w *wsConnectItem) sendToInChan(data []byte) {
// 格式化为websocket标准返回格式
func (w *wsConnectItem) respondDataFormat(msgType constants.Websocket, data interface{}) []byte {
d := websocket_data.DataTransferData{
T: msgType,
D: data,
T: msgType,
D: data,
Debug: w.debug != nil,
}
b, _ := json.Marshal(d)
return b

View File

@ -1,8 +1,46 @@
package logic
import "fusenapi/constants"
import (
"encoding/json"
"fusenapi/constants"
"fusenapi/utils/auth"
"fusenapi/utils/websocket_data"
"github.com/gorilla/websocket"
"time"
)
// 入口数据格式错误
// 获取唯一标识失败通知
func (l *DataTransferLogic) sendGetUniqueIdErrResponse(conn *websocket.Conn, debug *auth.Debug) {
rsp := websocket_data.DataTransferData{
T: constants.WEBSOCKET_CONNECT_ERR,
D: websocket_data.ConnectErrMsg{Message: "err to gen unique id "},
Debug: debug != nil,
}
b, _ := json.Marshal(rsp)
//先发一条正常信息
_ = conn.WriteMessage(websocket.TextMessage, b)
//发送关闭信息
_ = conn.WriteMessage(websocket.CloseMessage, nil)
}
// 鉴权失败通知
func (l *DataTransferLogic) unAuthResponse(conn *websocket.Conn, isFirefoxBrowser bool, errMessage string) {
rsp := websocket_data.DataTransferData{
T: constants.WEBSOCKET_UNAUTH,
D: websocket_data.ConnectUnAuth{Message: errMessage},
Debug: false,
}
b, _ := json.Marshal(rsp)
if isFirefoxBrowser {
time.Sleep(time.Second * 1) //兼容下火狐(直接发回去收不到第一条消息:有待研究)
}
//先发一条正常信息
_ = conn.WriteMessage(websocket.TextMessage, b)
//发送关闭信息
_ = conn.WriteMessage(websocket.CloseMessage, nil)
}
// 通用入口数据格式错误
func (w *wsConnectItem) incomeDataFormatErrResponse(data interface{}) {
if w.debug == nil {
return

View File

@ -0,0 +1,63 @@
package logic
import (
"fmt"
"fusenapi/constants"
"fusenapi/utils/auth"
"fusenapi/utils/websocket_data"
)
// *******************************合图相关begin******************************
// 发送合图完毕阶段通知消息
func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId, combineImage string, sizeId, modelId, templateId int64, debugData *auth.DebugData) {
if w.debug == nil {
return
}
combineTakesTime := "cache"
uploadCombineImageTakesTime := "cache"
if debugData.DiffTimeLogoCombine > 0 {
combineTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeLogoCombine)
}
if debugData.DiffTimeUploadFile > 0 {
uploadCombineImageTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeUploadFile)
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{
RenderId: renderId,
RequestId: requestId,
CombineImage: combineImage,
SizeId: sizeId,
ModelId: modelId,
TemplateId: templateId,
CombineProcessTime: websocket_data.CombineProcessTime{
CombineTakesTime: combineTakesTime,
UploadCombineImageTakesTime: uploadCombineImageTakesTime,
},
}))
}
// 发送组装unity需要的数据完毕消息
func (w *wsConnectItem) sendAssembleRenderDataStepResponseMessage(renderId string, requestId string) {
if w.debug == nil {
return
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ASSEMBLE_RENDER_DATA, websocket_data.ToUnityRspMsg{RenderId: renderId, RequestId: requestId}))
}
// 发送组装数据到unity完毕阶段通知消息
func (w *wsConnectItem) sendRenderDataToUnityStepResponseMessage(renderId string, requestId string) {
if w.debug == nil {
return
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SEND_DATA_TO_UNITY, websocket_data.AssembleRenderDataRspMsg{RenderId: renderId, RequestId: requestId}))
}
// 发送渲染最终结果数据到前端
func (w *wsConnectItem) sendRenderResultData(data websocket_data.RenderImageRspMsg) {
//没开启debug
if w.debug == nil {
data.RenderProcessTime = websocket_data.RenderProcessTime{}
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, data))
}
// *******************************合图相关end******************************

View File

@ -6,11 +6,8 @@ import (
"context"
"encoding/json"
"errors"
"fmt"
"fusenapi/constants"
"fusenapi/model/gmodel"
"fusenapi/service/repositories"
"fusenapi/utils/auth"
"fusenapi/utils/curl"
"fusenapi/utils/hash"
"fusenapi/utils/websocket_data"
@ -146,7 +143,7 @@ func (w *wsConnectItem) consumeRenderImageData() {
// 执行渲染任务
func (w *wsConnectItem) renderImage(renderImageData websocket_data.RenderImageReqMsg) {
if !strings.Contains(renderImageData.RenderData.Logo, "storage.fusenpack.com") {
if !strings.Contains(renderImageData.RenderData.Logo, "fusen") {
w.renderErrResponse(renderImageData.RenderId, renderImageData.RequestId, renderImageData.RenderData.TemplateTag, "", "非法的logo", renderImageData.RenderData.ProductId, w.userId, w.guestId, 0, 0, 0, 0)
return
}
@ -465,52 +462,3 @@ func (w *wsConnectItem) genRenderTaskId(combineImage string, renderImageData web
}
return hash.JsonHashKey(hashMap)
}
// ****************************下面的发送消息的*********************************
// 发送合图完毕阶段通知消息
func (w *wsConnectItem) sendCombineImageStepResponseMessage(renderId, requestId, combineImage string, sizeId, modelId, templateId int64, debugData *auth.DebugData) {
if w.debug == nil {
return
}
combineTakesTime := "cache"
uploadCombineImageTakesTime := "cache"
if debugData.DiffTimeLogoCombine > 0 {
combineTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeLogoCombine)
}
if debugData.DiffTimeUploadFile > 0 {
uploadCombineImageTakesTime = fmt.Sprintf("%dms", debugData.DiffTimeUploadFile)
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_COMBINE_IMAGE, websocket_data.CombineImageRspMsg{
RenderId: renderId,
RequestId: requestId,
CombineImage: combineImage,
SizeId: sizeId,
ModelId: modelId,
TemplateId: templateId,
CombineProcessTime: websocket_data.CombineProcessTime{
CombineTakesTime: combineTakesTime,
UploadCombineImageTakesTime: uploadCombineImageTakesTime,
},
}))
}
// 发送组装unity需要的数据完毕消息
func (w *wsConnectItem) sendAssembleRenderDataStepResponseMessage(renderId string, requestId string) {
if w.debug == nil {
return
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ASSEMBLE_RENDER_DATA, websocket_data.ToUnityRspMsg{RenderId: renderId, RequestId: requestId}))
}
// 发送组装数据到unity完毕阶段通知消息
func (w *wsConnectItem) sendRenderDataToUnityStepResponseMessage(renderId string, requestId string) {
if w.debug == nil {
return
}
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_SEND_DATA_TO_UNITY, websocket_data.AssembleRenderDataRspMsg{RenderId: renderId, RequestId: requestId}))
}
// 发送渲染最终结果数据到前端
func (w *wsConnectItem) sendRenderResultData(data websocket_data.RenderImageRspMsg) {
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_RENDER_IMAGE, data))
}

View File

@ -16,9 +16,6 @@ service product {
//获取产品模型信息
@handler GetModelByPidHandler
get /api/product/get_model_by_pid(GetModelByPidReq) returns (response);
//获取产品阶梯价格列表(即将废弃)
@handler GetPriceByPidHandler
get /api/product/get_price_by_pid(GetPriceByPidReq) returns (response);
//获取产品阶梯价格信息
@handler GetProductStepPriceHandler
get /api/product/get_product_step_price(GetProductStepPriceReq) returns (response);
@ -53,24 +50,25 @@ service product {
//获取详情页推荐产品列表
type GetRecommandProductListReq {
Size int32 `form:"size,optional"`
Num int64 `form:"num,optional"`
Sn string `form:"sn"`
Num int64 `form:"num,optional"`
ProductId int64 `form:"product_id"`
}
type GetRecommandProductListRsp {
Id int64 `json:"id"`
Sn string `json:"sn"`
Title string `json:"title"`
TitleCn string `json:"title_cn"`
Cover string `json:"cover"`
CoverMetadata interface{} `json:"cover_metadata"`
CoverImg string `json:"cover_img"`
CoverImgMetadata interface{} `json:"cover_img_metadata"`
CoverDefault []CoverDefaultItem `json:"cover_default"`
Intro string `json:"intro"`
Recommend bool `json:"recommend"`
MinPrice int64 `json:"min_price"`
IsCustomization int64 `json:"is_customization"`
Id int64 `json:"id"`
Sn string `json:"sn"`
Title string `json:"title"`
TitleCn string `json:"title_cn"`
Cover string `json:"cover"`
CoverMetadata interface{} `json:"cover_metadata"`
CoverImg string `json:"cover_img"`
CoverImgMetadata interface{} `json:"cover_img_metadata"`
CoverDefault []CoverDefaultItem `json:"cover_default"`
Intro string `json:"intro"`
Recommend bool `json:"recommend"`
MinPrice int64 `json:"min_price"`
IsCustomization int64 `json:"is_customization"`
SizeCount int64 `json:"size_count"`
HaveOptionalFitting bool `json:"have_optional_fitting"`
}
//获取分类产品列表
type GetTagProductListReq {
@ -115,26 +113,6 @@ type CoverDefaultItem {
type GetModelByPidReq {
Pid string `form:"pid"` //实际上是产品sn
}
//获取产品阶梯价格
type GetPriceByPidReq {
Pid string `form:"pid"`
}
type GetPriceByPidRsp {
Items []PriceItem `json:"items"`
MinPrice float64 `json:"min_price"`
MaxPrice float64 `json:"max_price"`
StepRange []StepRange `json:"step_range"`
}
type StepRange {
Begin int64 `json:"begin"`
End int64 `json:"end"`
Price float64 `json:"price"`
}
type PriceItem {
Num int64 `json:"num"`
TotalNum int64 `json:"total_num"`
Price int64 `json:"price"`
}
//获取产品阶梯价格信息
type GetProductStepPriceReq {
ProductId int64 `form:"product_id"`
@ -228,10 +206,10 @@ type HomePageRecommendProductListRsp {
//获取产品详情(重构版)
type GetProductDetailReq {
ProductId int64 `form:"product_id"` //产品id
TemplateTag string `form:"template_tag"` //模板标签
SelectColorIndex int `form:"select_color_index"` //模板标签颜色索引
Logo string `form:"logo"` //logo地址
ProductId int64 `form:"product_id"` //产品id
TemplateTag string `form:"template_tag"` //模板标签
SelectedColorIndex int `form:"selected_color_index"` //模板标签颜色索引
Logo string `form:"logo"` //logo地址
}
type GetProductDetailRsp {
TemplateTagColorInfo TemplateTagColorInfo `json:"template_tag_color_info"` //标签颜色信息

View File

@ -21,6 +21,9 @@ service shopping-cart {
//计算购物车价格
@handler CalculateCartPriceHandler
post /api/shopping-cart/calculate_cart_price(CalculateCartPriceReq) returns (response);
//获取购物车数量
@handler GetCartNumHandler
get /api/shopping-cart/get_cart_num(request) returns (response);
}
//加入购物车
@ -122,4 +125,8 @@ type CalculateResultItem {
CartId int64 `json:"cart_id"` //购物车id
ItemPrice string `json:"item_price"` //单价
TotalPrice string `json:"total_price"` //总价
}
//获取购物车数量
type GetCartNumRsp {
TotalCount int64 `json:"total_count"`
}

View File

@ -93,6 +93,8 @@ func (l *defaultImageHandle) LogoInfoSet(ctx context.Context, in *LogoInfoSetReq
if in.Debug != nil && in.Debug.IsAllTemplateTag == 1 {
postMap["is_all_template"] = "1"
} else {
postMap["is_all_template"] = "0"
}
logc.Infof(ctx, "算法请求--LOGO基础信息--开始时间:%v", time.Now().UTC())

View File

@ -4,7 +4,7 @@ import "strings"
// 通过url解析资源id
func GetS3ResourceIdFormUrl(s3Url string) string {
if !strings.Contains(s3Url, "storage.fusenpack.com") {
if !strings.Contains(s3Url, "fusen") {
return ""
}
s := strings.Split(s3Url, "/")

View File

@ -1,9 +1,17 @@
package websocket_data
import "fusenapi/constants"
// websocket数据交互基本数据类型
type DataTransferData struct {
T constants.Websocket `json:"t"` //消息类型
D interface{} `json:"d"` //传递的消息
Debug bool `json:"debug"` //是否开启debug
}
// 基础连接成功返回
type ConnectSuccessMsg struct {
Wid string `json:"wid"` //websocket连接唯一标识
Debug bool `json:"debug"` //是否开启debug
Wid string `json:"wid"` //websocket连接唯一标识
}
// 连接失败

View File

@ -1,13 +1,5 @@
package websocket_data
import "fusenapi/constants"
// websocket数据交互基本数据类型
type DataTransferData struct {
T constants.Websocket `json:"t"` //消息类型
D interface{} `json:"d"` //传递的消息
}
// websocket接受要云渲染处理的数据
type RenderImageReqMsg struct {
RenderId string `json:"render_id"` //渲染id