From a875e13e55382a784df30cd24737e9cbfa969ffe Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Tue, 7 Nov 2023 14:13:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=AE=BE=E7=BD=AElogo=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E4=B8=BA=E7=94=A8=E6=88=B7=E8=87=AA=E5=B7=B1=E7=B4=A0?= =?UTF-8?q?=E6=9D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/gmodel/fs_feishu_config_gen.go | 26 +++++++++++++++++++ model/gmodel/fs_feishu_config_logic.go | 2 ++ model/gmodel/fs_preprocess_logo_gen.go | 2 +- model/gmodel/fs_user_material_gen.go | 1 + model/gmodel/var_gen.go | 2 ++ .../internal/logic/userlogodatasetlogic.go | 23 ++++++++++++++++ 6 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 model/gmodel/fs_feishu_config_gen.go create mode 100644 model/gmodel/fs_feishu_config_logic.go diff --git a/model/gmodel/fs_feishu_config_gen.go b/model/gmodel/fs_feishu_config_gen.go new file mode 100644 index 00000000..9999e675 --- /dev/null +++ b/model/gmodel/fs_feishu_config_gen.go @@ -0,0 +1,26 @@ +package gmodel + +import ( + "gorm.io/gorm" + "time" +) + +// fs_feishu_config 飞书app配置表 +type FsFeishuConfig struct { + Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID + AppId *string `gorm:"default:'';" json:"app_id"` // + AppName *string `gorm:"default:'';" json:"app_name"` // 项目名称 + AppSecret *string `gorm:"default:'';" json:"app_secret"` // app密钥 + EncryptKey *string `gorm:"default:'';" json:"encrypt_key"` // + VerificationToken *string `gorm:"default:'';" json:"verification_token"` // + Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // + Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` // +} +type FsFeishuConfigModel struct { + db *gorm.DB + name string +} + +func NewFsFeishuConfigModel(db *gorm.DB) *FsFeishuConfigModel { + return &FsFeishuConfigModel{db: db, name: "fs_feishu_config"} +} diff --git a/model/gmodel/fs_feishu_config_logic.go b/model/gmodel/fs_feishu_config_logic.go new file mode 100644 index 00000000..e68225aa --- /dev/null +++ b/model/gmodel/fs_feishu_config_logic.go @@ -0,0 +1,2 @@ +package gmodel +// TODO: 使用model的属性做你想做的 \ No newline at end of file diff --git a/model/gmodel/fs_preprocess_logo_gen.go b/model/gmodel/fs_preprocess_logo_gen.go index 792df0d5..a20254cd 100644 --- a/model/gmodel/fs_preprocess_logo_gen.go +++ b/model/gmodel/fs_preprocess_logo_gen.go @@ -21,9 +21,9 @@ type FsPreprocessLogo struct { IsBranch *int64 `gorm:"default:0;" json:"is_branch"` // 是否分店 Metadata *[]byte `gorm:"default:'';" json:"metadata"` // Source *string `gorm:"index;default:'';" json:"source"` // + IsDel *int64 `gorm:"index;default:0;" json:"is_del"` // 是否删除 Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` // - IsDel *int64 `gorm:"index;default:0;" json:"is_del"` // 是否删除 } type FsPreprocessLogoModel struct { db *gorm.DB diff --git a/model/gmodel/fs_user_material_gen.go b/model/gmodel/fs_user_material_gen.go index ca102d24..5477f26c 100644 --- a/model/gmodel/fs_user_material_gen.go +++ b/model/gmodel/fs_user_material_gen.go @@ -15,6 +15,7 @@ type FsUserMaterial struct { ResourceUrl *string `gorm:"default:'';" json:"resource_url"` // Metadata *[]byte `gorm:"default:'';" json:"metadata"` // Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // 上传时间 + LogoId *int64 `gorm:"index;default:0;" json:"logo_id"` // logo库ID } type FsUserMaterialModel struct { db *gorm.DB diff --git a/model/gmodel/var_gen.go b/model/gmodel/var_gen.go index c5d4df3b..b702a514 100644 --- a/model/gmodel/var_gen.go +++ b/model/gmodel/var_gen.go @@ -49,6 +49,7 @@ type AllModelsGen struct { FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃) FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp FsFaq *FsFaqModel // fs_faq 常见问题 + FsFeishuConfig *FsFeishuConfigModel // fs_feishu_config 飞书app配置表 FsFont *FsFontModel // fs_font 字体配置 FsGerent *FsGerentModel // fs_gerent 管理员表 FsGuest *FsGuestModel // fs_guest 游客表 @@ -167,6 +168,7 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen { FsFactoryProduct: NewFsFactoryProductModel(gdb), FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb), FsFaq: NewFsFaqModel(gdb), + FsFeishuConfig: NewFsFeishuConfigModel(gdb), FsFont: NewFsFontModel(gdb), FsGerent: NewFsGerentModel(gdb), FsGuest: NewFsGuestModel(gdb), diff --git a/server/home-user-auth/internal/logic/userlogodatasetlogic.go b/server/home-user-auth/internal/logic/userlogodatasetlogic.go index 80680ae4..8a95fc36 100644 --- a/server/home-user-auth/internal/logic/userlogodatasetlogic.go +++ b/server/home-user-auth/internal/logic/userlogodatasetlogic.go @@ -68,6 +68,29 @@ func (l *UserLogoDataSetLogic) UserLogoDataSet(req *types.UserLogoDataSetReq, us return resp.SetStatus(basic.CodeApiErr) } + var materialInfoOld gmodel.FsUserMaterial + result1 := l.svcCtx.MysqlConn.Model(&gmodel.FsUserMaterial{}).Where("logo_id = ?", req.LogoDataId).Take(&materialInfoOld) + err = result1.Error + if err != nil { + if !errors.Is(err, gorm.ErrRecordNotFound) { + logc.Errorf(l.ctx, "FsUserMaterial logoData find err:%+v", err) + return resp.SetStatus(basic.CodeApiErr) + } + } else { + // 返回成功的响应和上传URL + return resp.SetStatus(basic.CodeOK, map[string]interface{}{ + "id": materialInfoOld.Id, + "module": materialInfoOld.Module, + "user_id": materialInfoOld.UserId, + "guest_id": materialInfoOld.GuestId, + "resource_id": materialInfoOld.ResourceId, + "resource_url": materialInfoOld.ResourceUrl, + "metadata": materialInfoOld.Metadata, + "ctime": materialInfoOld.Ctime, + "resource_info": nil, + }) + } + var userMaterialMetadata []byte if logoData.Metadata == nil { var resultStr string