1
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -5,7 +5,6 @@ import (
|
||||
"slogan-agent/common"
|
||||
"slogan-agent/styleagent/consts"
|
||||
"slogan-agent/styleagent/model/entity"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
@@ -34,12 +33,6 @@ func init() {
|
||||
if err != nil {
|
||||
g.Log().Warningf(ctx, "create avatar_model table failed: %v", err)
|
||||
}
|
||||
// 旧库补列(CREATE TABLE IF NOT EXISTS 不给已存在表加列,忽略 duplicate column 错误)
|
||||
if _, err := g.DB().Exec(ctx, "ALTER TABLE "+consts.TableNameAvatarModel+" ADD COLUMN frames_url TEXT NOT NULL DEFAULT ''"); err != nil {
|
||||
if !strings.Contains(err.Error(), "duplicate column") {
|
||||
g.Log().Warningf(ctx, "alter avatar_model add frames_url failed: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (d *avatarModelDao) Insert(ctx context.Context, data *entity.AvatarModel) (int64, error) {
|
||||
|
||||
@@ -22,7 +22,6 @@ type AvatarGetRes struct {
|
||||
BodyTemplateId int `json:"body_template_id"`
|
||||
SkinToneIndex int `json:"skin_tone_index"`
|
||||
GlbUrl string `json:"glb_url"`
|
||||
FramesUrl string `json:"frames_url"`
|
||||
BuildStatus string `json:"build_status"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ type AvatarModel struct {
|
||||
SkinToneIndex int `orm:"skin_tone_index" json:"skin_tone_index"`
|
||||
FaceTextureUrl string `orm:"face_texture_url" json:"face_texture_url"`
|
||||
GlbUrl string `orm:"glb_url" json:"glb_url"`
|
||||
FramesUrl string `orm:"frames_url" json:"frames_url"`
|
||||
BuildStatus string `orm:"build_status" json:"build_status"`
|
||||
Error string `orm:"error" json:"error"`
|
||||
ParamsSnapshot string `orm:"params_snapshot" json:"params_snapshot"`
|
||||
|
||||
@@ -67,7 +67,7 @@ func (s *avatarService) Build(ctx context.Context, userId int64) (*dto.AvatarBui
|
||||
}
|
||||
if err := dao.AvatarModel.Update(ctx, existing.Id, map[string]any{
|
||||
"face_template_id": 0, "body_template_id": 0, "skin_tone_index": 0,
|
||||
"glb_url": "", "frames_url": "",
|
||||
"glb_url": "",
|
||||
"build_status": consts.AvatarBuildProcessing, "error": "",
|
||||
"params_snapshot": snapshot,
|
||||
}); err != nil {
|
||||
@@ -202,7 +202,7 @@ func (s *avatarService) Get(ctx context.Context, userId int64) (*dto.AvatarGetRe
|
||||
}
|
||||
return &dto.AvatarGetRes{
|
||||
FaceTemplateId: a.FaceTemplateId, BodyTemplateId: a.BodyTemplateId,
|
||||
SkinToneIndex: a.SkinToneIndex, GlbUrl: a.GlbUrl, FramesUrl: a.FramesUrl,
|
||||
SkinToneIndex: a.SkinToneIndex, GlbUrl: a.GlbUrl,
|
||||
BuildStatus: a.BuildStatus, Error: a.Error,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user