Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
05df11bd7f
26
model/gmodel/fs_feishu_config_gen.go
Normal file
26
model/gmodel/fs_feishu_config_gen.go
Normal file
|
@ -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"}
|
||||||
|
}
|
2
model/gmodel/fs_feishu_config_logic.go
Normal file
2
model/gmodel/fs_feishu_config_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
|
@ -15,6 +15,7 @@ type FsUserMaterial struct {
|
||||||
ResourceUrl *string `gorm:"default:'';" json:"resource_url"` //
|
ResourceUrl *string `gorm:"default:'';" json:"resource_url"` //
|
||||||
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
|
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
|
||||||
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // 上传时间
|
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 {
|
type FsUserMaterialModel struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
|
@ -49,6 +49,7 @@ type AllModelsGen struct {
|
||||||
FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃)
|
FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃)
|
||||||
FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp
|
FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp
|
||||||
FsFaq *FsFaqModel // fs_faq 常见问题
|
FsFaq *FsFaqModel // fs_faq 常见问题
|
||||||
|
FsFeishuConfig *FsFeishuConfigModel // fs_feishu_config 飞书app配置表
|
||||||
FsFont *FsFontModel // fs_font 字体配置
|
FsFont *FsFontModel // fs_font 字体配置
|
||||||
FsGerent *FsGerentModel // fs_gerent 管理员表
|
FsGerent *FsGerentModel // fs_gerent 管理员表
|
||||||
FsGuest *FsGuestModel // fs_guest 游客表
|
FsGuest *FsGuestModel // fs_guest 游客表
|
||||||
|
@ -167,6 +168,7 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||||
FsFactoryProduct: NewFsFactoryProductModel(gdb),
|
FsFactoryProduct: NewFsFactoryProductModel(gdb),
|
||||||
FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb),
|
FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb),
|
||||||
FsFaq: NewFsFaqModel(gdb),
|
FsFaq: NewFsFaqModel(gdb),
|
||||||
|
FsFeishuConfig: NewFsFeishuConfigModel(gdb),
|
||||||
FsFont: NewFsFontModel(gdb),
|
FsFont: NewFsFontModel(gdb),
|
||||||
FsGerent: NewFsGerentModel(gdb),
|
FsGerent: NewFsGerentModel(gdb),
|
||||||
FsGuest: NewFsGuestModel(gdb),
|
FsGuest: NewFsGuestModel(gdb),
|
||||||
|
|
|
@ -68,6 +68,29 @@ func (l *UserLogoDataSetLogic) UserLogoDataSet(req *types.UserLogoDataSetReq, us
|
||||||
return resp.SetStatus(basic.CodeApiErr)
|
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
|
var userMaterialMetadata []byte
|
||||||
if logoData.Metadata == nil {
|
if logoData.Metadata == nil {
|
||||||
var resultStr string
|
var resultStr string
|
||||||
|
@ -101,6 +124,7 @@ func (l *UserLogoDataSetLogic) UserLogoDataSet(req *types.UserLogoDataSetReq, us
|
||||||
ResourceUrl: logoData.ResourceUrl,
|
ResourceUrl: logoData.ResourceUrl,
|
||||||
Metadata: &userMaterialMetadata,
|
Metadata: &userMaterialMetadata,
|
||||||
Ctime: &nowTime,
|
Ctime: &nowTime,
|
||||||
|
LogoId: &req.LogoDataId,
|
||||||
}
|
}
|
||||||
resCreate := l.svcCtx.MysqlConn.Create(&materialInfo)
|
resCreate := l.svcCtx.MysqlConn.Create(&materialInfo)
|
||||||
err = resCreate.Error
|
err = resCreate.Error
|
||||||
|
|
Loading…
Reference in New Issue
Block a user