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

This commit is contained in:
laodaming 2023-08-22 15:44:03 +08:00
commit e1cf3097f5
7 changed files with 257 additions and 278 deletions

View File

@ -25,6 +25,7 @@ func InitMysql(sourceMysql string) *gorm.DB {
},
SkipDefaultTransaction: true,
})
if err != nil {
panic(err)
}

View File

@ -6,26 +6,17 @@ import (
// fs_product_template_element 云渲染配置表
type FsProductTemplateElement struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id
Title *string `gorm:"default:'';" json:"title"` // 产品模板名称
ModelId *int64 `gorm:"index;default:0;" json:"model_id"` // 产品模型id
Main *string `gorm:"default:'';" json:"main"` // 废弃
Second *string `gorm:"default:'';" json:"second"` // 废弃
Base *string `gorm:"default:'';" json:"base"` // base
Paper *string `gorm:"default:'';" json:"paper"` // 废弃
Spoon *string `gorm:"default:'';" json:"spoon"` // 废弃
Fork *string `gorm:"default:'';" json:"fork"` // 废弃
Toothpick *string `gorm:"default:'';" json:"toothpick"` // 废弃
Chopsticks *string `gorm:"default:'';" json:"chopsticks"` // 废弃
Shadow *string `gorm:"default:'';" json:"shadow"` // shadow
Cover *string `gorm:"default:'';" json:"cover"` // 废弃
Cover1 *string `gorm:"default:'';" json:"cover1"` // 废弃
Mode *string `gorm:"default:'';" json:"mode"` // 材质类型
Light *int64 `gorm:"default:0;" json:"light"` // 灯光组
Rotation *string `gorm:"default:'';" json:"rotation"` // 旋转
Scale *string `gorm:"default:'';" json:"scale"` // 缩放
ModelP *string `gorm:"default:'';" json:"model_p"` // 配件对应的云渲染贴图数据
Refletion *string `gorm:"default:'';" json:"refletion"` // 反射探头组
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id
Title *string `gorm:"default:'';" json:"title"` //
ModelId *int64 `gorm:"index;default:0;" json:"model_id"` // 产品模型id
Base *string `gorm:"default:'';" json:"base"` //
Shadow *string `gorm:"default:'';" json:"shadow"` //
Mode *string `gorm:"default:'';" json:"mode"` //
Light *int64 `gorm:"default:0;" json:"light"` // 灯光组
Rotation *string `gorm:"default:'';" json:"rotation"` //
Scale *string `gorm:"default:'';" json:"scale"` //
ModelP *string `gorm:"default:'';" json:"model_p"` //
Refletion *string `gorm:"default:'';" json:"refletion"` //
}
type FsProductTemplateElementModel struct {
db *gorm.DB

View File

@ -9,7 +9,7 @@ type FsTags struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
LevelPrefix *string `gorm:"default:'';" json:"level_prefix"` //
Title *string `gorm:"default:'';" json:"title"` // 标题
Level *int64 `gorm:"default:0;" json:"level"` // 层级、分类 1 => 二维码分类
Level *int64 `gorm:"default:0;" json:"level"` // 层级、分类 1 => 二维码分类 2网站分类 3,3d设计工具分类
ClickNum *int64 `gorm:"default:0;" json:"click_num"` // 点击次数
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序(从大到小)
CreateAt *int64 `gorm:"default:0;" json:"create_at"` // 创建时间

View File

@ -4,205 +4,199 @@ import "gorm.io/gorm"
// AllModelsGen 所有Model集合,修改单行,只要不改字段名,不会根据新的内容修改,需要修改的话手动删除
type AllModelsGen struct {
FsAddress *FsAddressModel // fs_address 用户地址表
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表
FsCloud *FsCloudModel // fs_cloud 云仓表
FsCloudDeliverEveryTmp *FsCloudDeliverEveryTmpModel // fs_cloud_deliver_every_tmp
FsCloudDeliverTmp *FsCloudDeliverTmpModel // fs_cloud_deliver_tmp
FsCloudPickUp *FsCloudPickUpModel // fs_cloud_pick_up 云仓提货单
FsCloudPickUpDetail *FsCloudPickUpDetailModel // fs_cloud_pick_up_detail 云仓提货单-详情
FsCloudReceive *FsCloudReceiveModel // fs_cloud_receive 云仓接收工厂总单
FsCloudReceiveEvery *FsCloudReceiveEveryModel // fs_cloud_receive_every
FsCloudRenderLog *FsCloudRenderLogModel // fs_cloud_render_log 云渲染日志表
FsCloudUserApplyBack *FsCloudUserApplyBackModel // fs_cloud_user_apply_back 该表废弃
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
FsOrderAffiliate *FsOrderAffiliateModel // fs_order_affiliate 订单附属表-流程控制时间等
FsOrderDetail *FsOrderDetailModel // fs_order_detail 订单详细表
FsOrderDetailTemplate *FsOrderDetailTemplateModel // fs_order_detail_template 订单模板详细表
FsOrderRemark *FsOrderRemarkModel // fs_order_remark 订单备注表
FsPay *FsPayModel // fs_pay 支付记录
FsPayEvent *FsPayEventModel // fs_pay_event 支付回调事件日志
FsProduct *FsProductModel // fs_product 产品表
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 云渲染配置表
FsProductTemplateElement0826 *FsProductTemplateElement0826Model // fs_product_template_element_0826
FsProductTemplateElement22 *FsProductTemplateElement22Model // fs_product_template_element_22
FsProductTemplateElementBackup1018 *FsProductTemplateElementBackup1018Model // fs_product_template_element_backup1018
FsProductTemplateElementKongde *FsProductTemplateElementKongdeModel // fs_product_template_element_kongde
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 资源表
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 网站配置表
FsAddress *FsAddressModel // fs_address 用户地址表
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表
FsCloud *FsCloudModel // fs_cloud 云仓表
FsCloudDeliverEveryTmp *FsCloudDeliverEveryTmpModel // fs_cloud_deliver_every_tmp
FsCloudDeliverTmp *FsCloudDeliverTmpModel // fs_cloud_deliver_tmp
FsCloudPickUp *FsCloudPickUpModel // fs_cloud_pick_up 云仓提货单
FsCloudPickUpDetail *FsCloudPickUpDetailModel // fs_cloud_pick_up_detail 云仓提货单-详情
FsCloudReceive *FsCloudReceiveModel // fs_cloud_receive 云仓接收工厂总单
FsCloudReceiveEvery *FsCloudReceiveEveryModel // fs_cloud_receive_every
FsCloudRenderLog *FsCloudRenderLogModel // fs_cloud_render_log 云渲染日志表
FsCloudUserApplyBack *FsCloudUserApplyBackModel // fs_cloud_user_apply_back 该表废弃
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
FsOrderAffiliate *FsOrderAffiliateModel // fs_order_affiliate 订单附属表-流程控制时间等
FsOrderDetail *FsOrderDetailModel // fs_order_detail 订单详细表
FsOrderDetailTemplate *FsOrderDetailTemplateModel // fs_order_detail_template 订单模板详细表
FsOrderRemark *FsOrderRemarkModel // fs_order_remark 订单备注表
FsPay *FsPayModel // fs_pay 支付记录
FsPayEvent *FsPayEventModel // fs_pay_event 支付回调事件日志
FsProduct *FsProductModel // fs_product 产品表
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 资源表
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{
FsAddress: NewFsAddressModel(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),
FsCloud: NewFsCloudModel(gdb),
FsCloudDeliverEveryTmp: NewFsCloudDeliverEveryTmpModel(gdb),
FsCloudDeliverTmp: NewFsCloudDeliverTmpModel(gdb),
FsCloudPickUp: NewFsCloudPickUpModel(gdb),
FsCloudPickUpDetail: NewFsCloudPickUpDetailModel(gdb),
FsCloudReceive: NewFsCloudReceiveModel(gdb),
FsCloudReceiveEvery: NewFsCloudReceiveEveryModel(gdb),
FsCloudRenderLog: NewFsCloudRenderLogModel(gdb),
FsCloudUserApplyBack: NewFsCloudUserApplyBackModel(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),
FsOrderAffiliate: NewFsOrderAffiliateModel(gdb),
FsOrderDetail: NewFsOrderDetailModel(gdb),
FsOrderDetailTemplate: NewFsOrderDetailTemplateModel(gdb),
FsOrderRemark: NewFsOrderRemarkModel(gdb),
FsPay: NewFsPayModel(gdb),
FsPayEvent: NewFsPayEventModel(gdb),
FsProduct: NewFsProductModel(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),
FsProductTemplateElement0826: NewFsProductTemplateElement0826Model(gdb),
FsProductTemplateElement22: NewFsProductTemplateElement22Model(gdb),
FsProductTemplateElementBackup1018: NewFsProductTemplateElementBackup1018Model(gdb),
FsProductTemplateElementKongde: NewFsProductTemplateElementKongdeModel(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),
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),
FsAddress: NewFsAddressModel(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),
FsCloud: NewFsCloudModel(gdb),
FsCloudDeliverEveryTmp: NewFsCloudDeliverEveryTmpModel(gdb),
FsCloudDeliverTmp: NewFsCloudDeliverTmpModel(gdb),
FsCloudPickUp: NewFsCloudPickUpModel(gdb),
FsCloudPickUpDetail: NewFsCloudPickUpDetailModel(gdb),
FsCloudReceive: NewFsCloudReceiveModel(gdb),
FsCloudReceiveEvery: NewFsCloudReceiveEveryModel(gdb),
FsCloudRenderLog: NewFsCloudRenderLogModel(gdb),
FsCloudUserApplyBack: NewFsCloudUserApplyBackModel(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),
FsOrderAffiliate: NewFsOrderAffiliateModel(gdb),
FsOrderDetail: NewFsOrderDetailModel(gdb),
FsOrderDetailTemplate: NewFsOrderDetailTemplateModel(gdb),
FsOrderRemark: NewFsOrderRemarkModel(gdb),
FsPay: NewFsPayModel(gdb),
FsPayEvent: NewFsPayEventModel(gdb),
FsProduct: NewFsProductModel(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),
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

@ -1,9 +0,0 @@
Name: assistant
Host: 0.0.0.0
Port: 9950
Timeout: 15000 #服务超时时间
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
Auth:
AccessSecret: fusen2023
AccessExpire: 2592000
RefreshAfter: 1592000

View File

@ -10,6 +10,9 @@ import (
)
func ParseJwtTokenHeader[T any](r *http.Request) (string, *T, error) {
//TODO:
var u T
return "", &u, nil
AuthKey := r.Header.Get("Authorization")
if AuthKey == "" {

View File

@ -3,7 +3,6 @@ package basic
import (
"errors"
"fusenapi/shared"
"fusenapi/utils/auth"
"net/http"
"reflect"
@ -11,7 +10,6 @@ import (
"github.com/golang-jwt/jwt"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"gorm.io/gorm"
)
var DefaultJwtSecret uint64 = 21321321321
@ -55,65 +53,66 @@ func NormalAfterLogic(w http.ResponseWriter, r *http.Request, resp *Response) {
func RequestParse(w http.ResponseWriter, r *http.Request, svcCtx any, LogicRequest any) (*auth.UserInfo, error) {
// log.Println(io.ReadAll(r.Body))
token, info, err := auth.ParseJwtTokenHeader[auth.UserInfo](r) //解析Token头, 和payload信息
if err != nil {
logx.Error(err)
return nil, err
}
// token, info, err := auth.ParseJwtTokenHeader[auth.UserInfo](r) //解析Token头, 和payload信息
var secret uint64 = 0
if info != nil {
// if err != nil {
// logx.Error(err)
// return nil, err
// }
if info.IsUser() {
// us, err := state.GetUserState(info.UserId) //获取缓存的用户状态
reflect.ValueOf(svcCtx)
// var secret uint64 = 0
// if info != nil {
ctxValue := reflect.ValueOf(svcCtx).FieldByName("MysqlConn")
gdb := ctxValue.Interface().(*gorm.DB)
// if info.IsUser() {
// // us, err := state.GetUserState(info.UserId) //获取缓存的用户状态
// reflect.ValueOf(svcCtx)
us, err := shared.GetUserState(info.UserId, gdb)
if err != nil {
logx.Error(err)
return nil, err
}
secret = us.PwdHash // 获取密码的hash做jwt, 便于重置密码的使用
// ctxValue := reflect.ValueOf(svcCtx).FieldByName("MysqlConn")
// gdb := ctxValue.Interface().(*gorm.DB)
} else if info.IsGuest() {
secret = DefaultJwtSecret //获取默认的hash
}
}
// us, err := shared.GetUserState(info.UserId, gdb)
// if err != nil {
// logx.Error(err)
// return nil, err
// }
// secret = us.PwdHash // 获取密码的hash做jwt, 便于重置密码的使用
var userinfo *auth.UserInfo
if secret != 0 {
claims, err := auth.ParseJwtTokenUint64Secret(token, secret)
// 如果解析JWT token出错,则返回未授权的JSON响应并记录错误消息
if err != nil {
httpx.OkJsonCtx(r.Context(), w, &Response{
Code: 401, // 返回401状态码,表示未授权
Message: "unauthorized", // 返回未授权信息
})
logx.Info("unauthorized:", err.Error()) // 记录错误日志
return nil, err
}
// } else if info.IsGuest() {
// secret = DefaultJwtSecret //获取默认的hash
// }
// }
if claims != nil {
// 从token中获取对应的用户信息
userinfo, err = auth.GetUserInfoFormMapClaims(claims)
// 如果获取用户信息出错,则返回未授权的JSON响应并记录错误消息
if err != nil {
httpx.OkJsonCtx(r.Context(), w, &Response{
Code: 401,
Message: "unauthorized",
})
logx.Info("unauthorized:", err.Error())
return nil, err
}
}
} else {
// 白板用户
userinfo = &auth.UserInfo{UserId: 0, GuestId: 0}
}
// var userinfo *auth.UserInfo
// if secret != 0 {
// claims, err := auth.ParseJwtTokenUint64Secret(token, secret)
// // 如果解析JWT token出错,则返回未授权的JSON响应并记录错误消息
// if err != nil {
// httpx.OkJsonCtx(r.Context(), w, &Response{
// Code: 401, // 返回401状态码,表示未授权
// Message: "unauthorized", // 返回未授权信息
// })
// logx.Info("unauthorized:", err.Error()) // 记录错误日志
// return nil, err
// }
// if claims != nil {
// // 从token中获取对应的用户信息
// userinfo, err = auth.GetUserInfoFormMapClaims(claims)
// // 如果获取用户信息出错,则返回未授权的JSON响应并记录错误消息
// if err != nil {
// httpx.OkJsonCtx(r.Context(), w, &Response{
// Code: 401,
// Message: "unauthorized",
// })
// logx.Info("unauthorized:", err.Error())
// return nil, err
// }
// }
// } else {
// // 白板用户
// userinfo = &auth.UserInfo{UserId: 0, GuestId: 0}
// }
var err error
// 如果端点有请求结构体则使用httpx.Parse方法从HTTP请求体中解析请求数据
if err = httpx.Parse(r, LogicRequest); err != nil {
httpx.OkJsonCtx(r.Context(), w, &Response{
@ -123,7 +122,7 @@ func RequestParse(w http.ResponseWriter, r *http.Request, svcCtx any, LogicReque
logx.Error(err)
return nil, err
}
userinfo := &auth.UserInfo{UserId: 39}
return userinfo, err
}