This commit is contained in:
laodaming 2023-08-17 15:54:03 +08:00
parent 5bde276c6d
commit 784d8f2624
2 changed files with 1 additions and 6 deletions

View File

@ -58,9 +58,6 @@ func (m *FsUserMaterialModel) RowSelectBuilder(selectData []string) *gorm.DB {
// 获取最新记录
func (m *FsUserMaterialModel) FindLatestOne(ctx context.Context, userId int64, guestId int64) (resp FsUserMaterial, err error) {
if userId == 0 && guestId == 0 {
return FsUserMaterial{}, nil
}
db := m.db.WithContext(ctx).Model(&FsUserMaterial{}).
Where("`user_id` = ? and `guest_id` = ?", userId, guestId).
Order("id DESC")

View File

@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"errors"
"fmt"
"fusenapi/constants"
"fusenapi/service/repositories"
"fusenapi/utils/curl"
@ -83,7 +84,6 @@ func (w *wsConnectItem) consumeRenderCache(data []byte) {
logx.Error("invalid format of websocket render image message:template_tag")
return
}
logx.Info("##########################begin##############################")
//获取上传最近的logo
userMaterial, err := w.logic.svcCtx.AllModels.FsUserMaterial.FindLatestOne(w.logic.ctx, w.userId, w.guestId)
if err != nil {
@ -103,12 +103,10 @@ func (w *wsConnectItem) consumeRenderCache(data []byte) {
w.sendToOutChan(w.respondDataFormat(constants.WEBSOCKET_ERR_DATA_FORMAT, "failed to get default logo"))
return
}
logx.Info("素材:", userMaterialDefault)
renderImageData.RenderData.Logo = *userMaterialDefault.ResourceUrl
} else {
renderImageData.RenderData.Logo = *userMaterial.ResourceUrl
}
logx.Info("##########################end##############################")
//用户id赋值
renderImageData.RenderData.UserId = w.userId
renderImageData.RenderData.GuestId = w.guestId