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)
}
var userId int64
var guestId int64
// var userId int64
// var guestId int64
// 检查用户是否是游客
if userinfo.IsGuest() {
// 如果是使用游客ID和游客键名格式
guestId = userinfo.GuestId
} else {
// 否则使用用户ID和用户键名格式
userId = userinfo.UserId
}
// // 检查用户是否是游客
// if userinfo.IsGuest() {
// // 如果是使用游客ID和游客键名格式
// guestId = userinfo.GuestId
// } else {
// // 否则使用用户ID和用户键名格式
// userId = userinfo.UserId
// }
res, err := l.svcCtx.Repositories.ImageHandle.LogoCombine(l.ctx, &repositories.LogoCombineReq{
UserId: userId,
GuestId: guestId,
TemplateId: req.TemplateId,
TemplateTag: req.TemplateTag,
UserId: 0,
GuestId: 36,
TemplateId: 569,
TemplateTag: "b1a",
Website: req.Website,
Slogan: req.Slogan,
Phone: req.Phone,

View File

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