11
This commit is contained in:
parent
5042971472
commit
be80525878
|
@ -142,3 +142,16 @@ func (m *FsUserMaterialModel) GetListByUser(ctx context.Context, userId, guestId
|
|||
Where(cond).Order("id DESC").Limit(limit).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (m *FsUserMaterialModel) FindOneByUserAndLogoUrl(ctx context.Context, userId, guestId int64, logoResourceId string) (resp *FsUserMaterial, err error) {
|
||||
var cond string
|
||||
if userId != 0 {
|
||||
cond = fmt.Sprintf("user_id = %d", userId)
|
||||
} else if guestId != 0 {
|
||||
cond = fmt.Sprintf("guest_id = %d", guestId)
|
||||
} else {
|
||||
cond = fmt.Sprintf("user_id = %d and guest_id = %d", userId, guestId)
|
||||
}
|
||||
err = m.db.WithContext(ctx).Model(&FsUserMaterial{}).Where("`resource_id` = ?", logoResourceId).
|
||||
Where(cond).Order("id DESC").Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
|
|
@ -17,6 +17,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
Path: "/api/product-template-tag/get_product_template_tags",
|
||||
Handler: GetProductTemplateTagsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/api/product-template-tag/get_template_tag_color",
|
||||
Handler: GetTemplateTagColorHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ func NewGetProductTemplateTagsLogic(ctx context.Context, svcCtx *svc.ServiceCont
|
|||
// func (l *GetProductTemplateTagsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
// }
|
||||
type logoSelect struct {
|
||||
type LogoSelect struct {
|
||||
LogoSelected struct {
|
||||
LogoSelectedId int `json:"logo_selected_id"`
|
||||
TemplateTagSelected struct {
|
||||
|
@ -83,7 +83,7 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
|||
mapSelectColor := make(map[string]int) //key是模板标签val是选中的索引
|
||||
if logoInfo.UserInfoMetadata != nil && *logoInfo.UserInfoMetadata != "" {
|
||||
//解析用户信息元数据
|
||||
var logoSelectInfo logoSelect
|
||||
var logoSelectInfo LogoSelect
|
||||
if err = json.Unmarshal([]byte(*logoInfo.UserInfoMetadata), &logoSelectInfo); err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeJsonErr, "failed to parse user info metadata")
|
||||
|
|
|
@ -20,6 +20,17 @@ type GetProductTemplateTagsRsp struct {
|
|||
SelectedColorIndex int `json:"selected_color_index"`
|
||||
}
|
||||
|
||||
type GetTemplateTagColorReq struct {
|
||||
Logo string `json:"logo"`
|
||||
TemplateTag string `json:"template_tag"`
|
||||
SelectedColorIndex int `json:"selected_color_index"`
|
||||
}
|
||||
|
||||
type GetTemplateTagColorRsp struct {
|
||||
Colors [][]string `json:"colors"`
|
||||
SelectedColorIndex int `json:"selected_color_index"`
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ service product-template-tag {
|
|||
//获取产品模板标签列表
|
||||
@handler GetProductTemplateTagsHandler
|
||||
get /api/product-template-tag/get_product_template_tags(GetProductTemplateTagsReq) returns (response);
|
||||
//根据模板标签跟logo还有选择颜色的索引获取颜色
|
||||
@handler GetTemplateTagColorHandler
|
||||
get /api/product-template-tag/get_template_tag_color(GetTemplateTagColorReq) returns (response);
|
||||
}
|
||||
|
||||
//获取产品模板标签列表
|
||||
|
@ -29,3 +32,13 @@ type GetProductTemplateTagsRsp {
|
|||
Colors [][]string `json:"colors"`
|
||||
SelectedColorIndex int `json:"selected_color_index"`
|
||||
}
|
||||
//根据模板标签跟logo还有选择颜色的索引获取颜色
|
||||
type GetTemplateTagColorReq {
|
||||
Logo string `json:"logo"`
|
||||
TemplateTag string `json:"template_tag"`
|
||||
SelectedColorIndex int `json:"selected_color_index"`
|
||||
}
|
||||
type GetTemplateTagColorRsp {
|
||||
Colors [][]string `json:"colors"`
|
||||
SelectedColorIndex int `json:"selected_color_index"`
|
||||
}
|
Loading…
Reference in New Issue
Block a user