美团/京东/淘宝联盟适配器(选品/搜索/转链,未配置 key 优雅降级), CPS 四表五层骨架,方案驱动推荐零新增 LLM(发型/买同款/到店试穿/场合), 定时同步 + 点击日志 + 最近优惠;outfit_plan 容错迁移 occasion 列; Dockerfile 补 mesa/nodejs 运行时。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package controller
|
||
|
||
import (
|
||
"context"
|
||
|
||
"slogan-agent/common"
|
||
"slogan-agent/styleagent/model/dto"
|
||
"slogan-agent/styleagent/service"
|
||
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
)
|
||
|
||
// cps 共享 struct:/cps/* 簇的 6 个 handler 分文件挂在同一个类型上(组前缀路由零变更)
|
||
type cps struct{}
|
||
|
||
var Cps = new(cps)
|
||
|
||
// ProductList 选品池分页列表
|
||
func (c *cps) ProductList(ctx context.Context, req *dto.CpsProductListReq) (res *dto.CpsProductListRes, err error) {
|
||
list, hasMore, err := service.CpsProductService.ListByCategory(ctx, req.Source, req.CategoryCode, req.City, req.Page, 0)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
return &dto.CpsProductListRes{List: list, HasMore: hasMore}, nil
|
||
}
|
||
|
||
// ProductLink 商品转链(记录点击日志)
|
||
func (c *cps) ProductLink(ctx context.Context, req *dto.CpsProductLinkReq) (res *dto.CpsProductLinkRes, err error) {
|
||
r := g.RequestFromCtx(ctx)
|
||
link, err := service.CpsProductService.ClickLink(ctx, common.GetUserId(r), req.ProductId, req.Scene, req.PlanId, r.GetClientIp())
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
return &dto.CpsProductLinkRes{Deeplink: link}, nil
|
||
}
|