fix:重构合图模块
This commit is contained in:
@@ -43,11 +43,14 @@ type (
|
||||
/* logo合图 */
|
||||
type (
|
||||
LogoCombineReq struct {
|
||||
ResourceKey string `json:"resource_key"`
|
||||
TemplateId int64 `json:"template_id"`
|
||||
CombineParam string `json:"combine_param"`
|
||||
UserId int64 `json:"user_id"`
|
||||
GuestId int64 `json:"guest_id"`
|
||||
UserId int64 `json:"user_id"`
|
||||
GuestId int64 `json:"guest_id"`
|
||||
TemplateId int64 `json:"template_id"`
|
||||
TemplateTag string `json:"resource_key"`
|
||||
Website string `form:"website,optional"` // 合图参数
|
||||
Slogan string `form:"slogan,optional"` // 合图参数
|
||||
Address string `form:"address,optional"` // 合图参数
|
||||
Phone string `form:"phone,optional"` // 合图参数
|
||||
}
|
||||
LogoCombineRes struct {
|
||||
ResourceId string
|
||||
@@ -58,7 +61,8 @@ type (
|
||||
|
||||
func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq) (*LogoCombineRes, error) {
|
||||
// 根据hash 查询数据资源
|
||||
var resourceId string = hash.JsonHashKey(in.ResourceKey)
|
||||
var resourceId string = hash.JsonHashKey(in)
|
||||
|
||||
resourceModel := gmodel.NewFsResourceModel(l.MysqlConn)
|
||||
resourceInfo, err := resourceModel.FindOneById(ctx, resourceId)
|
||||
if err == nil && resourceInfo.ResourceId != "" {
|
||||
@@ -111,8 +115,23 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq
|
||||
moduleDataMap["groupOptions"] = groupOptions
|
||||
moduleDataMap["materialList"] = materialList
|
||||
|
||||
// 查询logo最新基础信息
|
||||
userMaterialModel := gmodel.NewFsUserMaterialModel(l.MysqlConn)
|
||||
userMaterialInfo, err := userMaterialModel.FindLatestOne(ctx, in.UserId, in.GuestId)
|
||||
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var combineParam map[string]interface{}
|
||||
json.Unmarshal([]byte(in.CombineParam), &combineParam)
|
||||
json.Unmarshal([]byte(*userMaterialInfo.Metadata), &combineParam)
|
||||
combineParam["template_tagid"] = in.TemplateTag
|
||||
combineParam["website"] = in.Website
|
||||
combineParam["slogan"] = in.Slogan
|
||||
combineParam["phone"] = in.Phone
|
||||
combineParam["address"] = in.Address
|
||||
|
||||
var postMap = make(map[string]interface{}, 2)
|
||||
postMap["module_data"] = moduleDataMap
|
||||
postMap["param_data"] = combineParam
|
||||
|
||||
Reference in New Issue
Block a user