refactor(ECR-001): 接入 ESS 并完成结构对齐 Phase A–E
绑定 ESS 双轨治理,拆分超大 H5 页与 Go 引擎,抽出 membership 服务, 并将 star/fortune 重命名为 outlook(JSON 双写兼容);同时修复 /psy API 代理与首页 + 菜单层级。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,13 +8,15 @@ import (
|
||||
"github.com/google/uuid"
|
||||
|
||||
"github.com/yuxingu/digital-psychology/apps/api/internal/middleware"
|
||||
"github.com/yuxingu/digital-psychology/apps/api/internal/service/membership"
|
||||
"github.com/yuxingu/digital-psychology/apps/api/internal/service/report"
|
||||
"github.com/yuxingu/digital-psychology/apps/api/pkg/response"
|
||||
)
|
||||
|
||||
// ReportHandler exposes portrait reports and commerce mock.
|
||||
type ReportHandler struct {
|
||||
Svc *report.Service
|
||||
Svc *report.Service
|
||||
Membership *membership.Service
|
||||
}
|
||||
|
||||
// Register mounts report/commerce routes.
|
||||
@@ -200,7 +202,7 @@ func (h *ReportHandler) GetMembership(c *gin.Context) {
|
||||
response.Fail(c, http.StatusUnauthorized, 40100, "unauthorized")
|
||||
return
|
||||
}
|
||||
me, err := h.Svc.GetMembership(c.Request.Context(), userID)
|
||||
me, err := h.Membership.Get(c.Request.Context(), userID)
|
||||
if err != nil {
|
||||
response.Fail(c, http.StatusInternalServerError, 50000, err.Error())
|
||||
return
|
||||
@@ -233,7 +235,7 @@ func (h *ReportHandler) CreateOrder(c *gin.Context) {
|
||||
}
|
||||
rid = &id
|
||||
}
|
||||
oid, err := h.Svc.CreateOrder(c.Request.Context(), userID, report.CreateOrderInput{
|
||||
oid, err := h.Membership.CreateOrder(c.Request.Context(), userID, membership.CreateOrderInput{
|
||||
Kind: req.Kind, Plan: req.Plan, ReportID: rid,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -255,7 +257,7 @@ func (h *ReportHandler) PayMock(c *gin.Context) {
|
||||
response.Fail(c, http.StatusBadRequest, 10000, "invalid id")
|
||||
return
|
||||
}
|
||||
if err := h.Svc.PayMock(c.Request.Context(), userID, oid); err != nil {
|
||||
if err := h.Membership.PayMock(c.Request.Context(), userID, oid); err != nil {
|
||||
response.Fail(c, http.StatusBadRequest, 30004, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user