This commit is contained in:
laodaming 2023-07-26 16:00:19 +08:00
parent 36aad6a088
commit 88a59bbdea
5 changed files with 46 additions and 1 deletions

View File

@ -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"` // 第三方支付编号

View File

@ -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"}
}

View File

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

View File

@ -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),

View File

@ -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{}