diff --git a/model/gmodel/fs_pay_gen.go b/model/gmodel/fs_pay_gen.go index 0ee65802..e30685b6 100644 --- a/model/gmodel/fs_pay_gen.go +++ b/model/gmodel/fs_pay_gen.go @@ -7,6 +7,7 @@ import ( // fs_pay 支付记录 type FsPay struct { Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // + PayNo *string `gorm:"default:'';" json:"pay_no"` // 支付编号 UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户id OrderNumber *string `gorm:"default:'';" json:"order_number"` // 订单编号 TradeNo *string `gorm:"index;default:'';" json:"trade_no"` // 第三方支付编号 diff --git a/model/gmodel/fs_resources_gen.go b/model/gmodel/fs_resources_gen.go new file mode 100644 index 00000000..432a8113 --- /dev/null +++ b/model/gmodel/fs_resources_gen.go @@ -0,0 +1,26 @@ +package gmodel + +import ( + "gorm.io/gorm" + "time" +) + +// fs_resources 资源表 +type FsResources struct { + ResourceId string `gorm:"primary_key;default:'';" json:"resource_id"` // 资源 ID + UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户 ID + GuestId *int64 `gorm:"index;default:0;" json:"guest_id"` // 访客 ID + ResourceType *string `gorm:"index;default:'';" json:"resource_type"` // 资源类型 + ResourceUrl *string `gorm:"default:'';" json:"resource_url"` // 资源 URL + UploadedAt *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"uploaded_at"` // 上传时间 + Metadata *string `gorm:"default:'';" json:"metadata"` // 元数据,json格式,存储图像分率 + MetaKey1 *string `gorm:"index;default:'';" json:"meta_key1"` // 需要关键信息查询的自定义属性1,可以动态增加 +} +type FsResourcesModel struct { + db *gorm.DB + name string +} + +func NewFsResourcesModel(db *gorm.DB) *FsResourcesModel { + return &FsResourcesModel{db: db, name: "fs_resources"} +} diff --git a/model/gmodel/fs_resources_logic.go b/model/gmodel/fs_resources_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_resources_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/var_gen.go b/model/gmodel/var_gen.go index a5916431..2fac48a5 100644 --- a/model/gmodel/var_gen.go +++ b/model/gmodel/var_gen.go @@ -79,6 +79,7 @@ type AllModelsGen struct { FsQuotationRemarkTemplate *FsQuotationRemarkTemplateModel // fs_quotation_remark_template 报价单备注模板 FsQuotationSaler *FsQuotationSalerModel // fs_quotation_saler 报价单业务员表 FsRefundReason *FsRefundReasonModel // fs_refund_reason + FsResources *FsResourcesModel // fs_resources 资源表 FsStandardLogo *FsStandardLogoModel // fs_standard_logo 标准logo FsTags *FsTagsModel // fs_tags 产品分类表 FsToolLogs *FsToolLogsModel // fs_tool_logs 3d设计工具日志表 @@ -169,6 +170,7 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen { FsQuotationRemarkTemplate: NewFsQuotationRemarkTemplateModel(gdb), FsQuotationSaler: NewFsQuotationSalerModel(gdb), FsRefundReason: NewFsRefundReasonModel(gdb), + FsResources: NewFsResourcesModel(gdb), FsStandardLogo: NewFsStandardLogoModel(gdb), FsTags: NewFsTagsModel(gdb), FsToolLogs: NewFsToolLogsModel(gdb), diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index 3df09209..29ad842a 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -1,12 +1,14 @@ package logic import ( + "bytes" "encoding/json" "fmt" "fusenapi/constants" "fusenapi/server/websocket/internal/types" "github.com/google/uuid" "github.com/gorilla/websocket" + "github.com/zeromicro/go-zero/rest/httpx" "net/http" "sync" "time" @@ -32,12 +34,24 @@ func NewDataTransferLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Data } var ( - //升级 + buffPool = sync.Pool{ + New: func() interface{} { + return bytes.Buffer{} + }, + } + //升级websocket upgrade = websocket.Upgrader{ + //握手超时时间15s + HandshakeTimeout: time.Second * 15, //允许跨域 CheckOrigin: func(r *http.Request) bool { return true }, + Error: func(w http.ResponseWriter, r *http.Request, status int, reason error) { + httpx.ErrorCtx(r.Context(), w, reason) + return + }, + WriteBufferPool: &buffPool, } //连接map池 mapConnPool = sync.Map{}