fix:裁剪业务逻辑调整

This commit is contained in:
momo 2023-08-23 11:23:26 +08:00
parent 9460504488
commit 9ccd84abdd
2 changed files with 18 additions and 15 deletions

View File

@ -45,22 +45,22 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth
return resp.SetStatus(basic.CodeUnAuth) return resp.SetStatus(basic.CodeUnAuth)
} }
var userId int64 // var userId int64
var guestId int64 // var guestId int64
// 检查用户是否是游客 // // 检查用户是否是游客
if userinfo.IsGuest() { // if userinfo.IsGuest() {
// 如果是使用游客ID和游客键名格式 // // 如果是使用游客ID和游客键名格式
guestId = userinfo.GuestId // guestId = userinfo.GuestId
} else { // } else {
// 否则使用用户ID和用户键名格式 // // 否则使用用户ID和用户键名格式
userId = userinfo.UserId // userId = userinfo.UserId
} // }
res, err := l.svcCtx.Repositories.ImageHandle.LogoCombine(l.ctx, &repositories.LogoCombineReq{ res, err := l.svcCtx.Repositories.ImageHandle.LogoCombine(l.ctx, &repositories.LogoCombineReq{
UserId: userId, UserId: 0,
GuestId: guestId, GuestId: 36,
TemplateId: req.TemplateId, TemplateId: 569,
TemplateTag: req.TemplateTag, TemplateTag: "b1a",
Website: req.Website, Website: req.Website,
Slogan: req.Slogan, Slogan: req.Slogan,
Phone: req.Phone, Phone: req.Phone,

View File

@ -96,6 +96,7 @@ type (
func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) { func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) {
// 查询logo最新基础信息 // 查询logo最新基础信息
var metadata *string var metadata *string
var logoUrl *string
userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn) userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn)
userMaterialInfo, err := userMaterialModel.FindLatestOne(ctx, in.UserId, in.GuestId) userMaterialInfo, err := userMaterialModel.FindLatestOne(ctx, in.UserId, in.GuestId)
@ -107,19 +108,21 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
return nil, err return nil, err
} }
metadata = userMaterialInfoDefault.Metadata metadata = userMaterialInfoDefault.Metadata
logoUrl = userMaterialInfoDefault.ResourceUrl
} else { } else {
logx.Error(err) logx.Error(err)
return nil, err return nil, err
} }
} else { } else {
metadata = userMaterialInfo.Metadata metadata = userMaterialInfo.Metadata
logoUrl = userMaterialInfo.ResourceUrl
} }
// 根据hash 查询数据资源 // 根据hash 查询数据资源
var hashKeyData = *in var hashKeyData = *in
hashKeyData.GuestId = 0 hashKeyData.GuestId = 0
hashKeyData.UserId = 0 hashKeyData.UserId = 0
hashKeyData.LogoUrl = *userMaterialInfo.ResourceUrl hashKeyData.LogoUrl = *logoUrl
var hashKeyDataMap map[string]interface{} var hashKeyDataMap map[string]interface{}
hashKeyDataB, _ := json.Marshal(hashKeyData) hashKeyDataB, _ := json.Marshal(hashKeyData)
json.Unmarshal(hashKeyDataB, &hashKeyDataMap) json.Unmarshal(hashKeyDataB, &hashKeyDataMap)