From 69137f366c920637542c075592afb60bbffd83e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E7=8A=80=E9=BA=9F?= Date: Thu, 27 Aug 2026 00:33:52 +0800 Subject: [PATCH] =?UTF-8?q?CHG:=20house=20=E6=88=90=E4=BA=A4=E8=AE=B0?= =?UTF-8?q?=E5=BD=95(transaction)=E6=A8=A1=E5=9D=97=EF=BC=9Aapi/service/co?= =?UTF-8?q?ntroller=20=E5=85=A8=E9=93=BE=E8=B7=AF=20+=20cmd=20=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=20+=20dto=20=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .workbuddy/memory/CHANGELOG.md | 1 + api/house/transaction/transaction.go | 33 ++++++++++++++++++++++++++++ internal/cmd/cmd.go | 2 ++ internal/model/dto/house.go | 6 +++++ 4 files changed, 42 insertions(+) create mode 100644 api/house/transaction/transaction.go diff --git a/.workbuddy/memory/CHANGELOG.md b/.workbuddy/memory/CHANGELOG.md index ce6eb18..90e84fb 100644 --- a/.workbuddy/memory/CHANGELOG.md +++ b/.workbuddy/memory/CHANGELOG.md @@ -1,6 +1,7 @@ # service.xpcool.com 变更记录 > 倒序:最新在上。格式:YYYY-MM-DD | 类型 | 摘要 +2026-08-27 | CHG | 看房成交模块:api/house/transaction + service/house/transaction + controller/house/transaction 实现成交记录 list 接口(/api/service/admin/house/transaction/list,全 POST 分页,关联小区名,按成交日期倒序),dto 加 HouseTransactionVO,cmd.go 注册;012_house_transaction_menu.sql 权限种子(house:data:transaction id=941 挂数据明细 94);go build 通过 2026-08-26 | CFG | 新增 Gitea act_runner 自动部署:.gitea/workflows/deploy.yml(push main/dev → 下载 Go1.23 工具链 npmmirror + GOPROXY goproxy.cn → CGO=0 linux/amd64 交叉编译 → 组装 main+manifest/config(config.yaml+config.prod.yaml)+resource+deploy/Dockerfile → docker build 重建容器 127.0.0.1:10100(xpcool-net,GF_GCFG_ENV=prod,DB_DSN/JWT_SECRET 走 Gitea Actions secrets)→ curl /api.json 冒烟);deploy/Dockerfile 仓库内维护;DB 结构变更不自动 DDL,需手动导 manifest/sql 2026-08-26 | FIX | 本地登录 no rows 修复:根因=本地库 service_xpcool_com 的 admin_user 空表(本地/服务器库两套,此前仅改服务器);补 super_admin 角色 + 导入 009_admin_account_v2.sql(须 --default-character-set=utf8mb4 否则中文 Data too long)→ 本地 xxcool/xxCool@2026 登录成功(subject=3);同时服务器废弃 webhook 方案已删除(deploy-webhook.service/webhook.py/secrets.env/deploy.sh),自动部署改走 Gitea act_runner + .gitea/workflows(仓库内尚未配置,待补) 2026-08-26 | CHG | 看房 house 模块后端落地:010_house_tables.sql 建 9 表(community/building/listing/price_snapshot/transaction/facility/community_facility/school_district/preference)+ 011_house_menu.sql 菜单/权限种子(超管 role_id=1 绑定);gf gen dao 生成 dao/entity/do;实现 api/house/{community,listing,dashboard} + controller/house + service/house(管理 CRUD + 看板聚合,全 POST 动作式,前缀 /api/service/admin/house,含多平台软关联 match_group_id、笋盘/低可信标记);cmd.go 注册 housectl + 3 个 RegisterService;go build 通过。坑①gf CLI 为 com.lib.gf.v2 分支,gen dao 产物 import 需 sed 回 github.com/gogf/gf/v2(18 文件);②mysql 客户端须 --default-character-set=utf8mb4 否则中文 COMMENT/INSERT 乱码;③TINYINT 字段 comment 含 0/1 被 gf 映射 bool(status 三值改 INT);hack/config.yaml 的 link+tables 已指向本地库 diff --git a/api/house/transaction/transaction.go b/api/house/transaction/transaction.go new file mode 100644 index 0000000..be2ce1f --- /dev/null +++ b/api/house/transaction/transaction.go @@ -0,0 +1,33 @@ +// Package house_transaction 定义成交记录查询接口,路由前缀 /house。 +package house_transaction + +import "github.com/gogf/gf/v2/frame/g" + +// TransactionItem 一条成交记录。 +type TransactionItem struct { + Id uint64 `json:"id"` + CommunityId uint64 `json:"communityId"` + CommunityName string `json:"communityName"` + Layout string `json:"layout"` + Area float64 `json:"area"` + DealPrice float64 `json:"dealPrice"` + DealUnitPrice float64 `json:"dealUnitPrice"` + ListDays int `json:"listDays"` + DealDate string `json:"dealDate"` + Source string `json:"source"` +} + +// TransactionListReq 分页查询成交记录。 +type TransactionListReq struct { + g.Meta `path:"/house/transaction/list" method:"post" tags:"Admin/House/Transaction" summary:"成交记录列表"` + Page int `json:"page" d:"1" v:"min:1"` + Size int `json:"size" d:"10" v:"min:1|max:100"` + Region string `json:"region"` + Keyword string `json:"keyword"` // 匹配小区名/户型 +} + +// TransactionListRes 是 TransactionListReq 的响应。 +type TransactionListRes struct { + List []*TransactionItem `json:"list"` + Total int `json:"total"` +} diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index b8b6947..fa7a495 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -27,6 +27,7 @@ import ( housecommunity "service.xpcool.com/internal/service/house/community" housedashboard "service.xpcool.com/internal/service/house/dashboard" houselisting "service.xpcool.com/internal/service/house/listing" + housetransaction "service.xpcool.com/internal/service/house/transaction" ) // injectEnv 手动把关键环境变量写入配置系统。 @@ -66,6 +67,7 @@ var ( housecommunity.RegisterCommunity(housecommunity.NewCommunity()) houselisting.RegisterListing(houselisting.NewListing()) housedashboard.RegisterDashboard(housedashboard.NewDashboard()) + housetransaction.RegisterTransaction(housetransaction.NewTransaction()) s.Group("/api/service/open", func(group *ghttp.RouterGroup) { group.Middleware(middleware.Recover, middleware.CORS, ghttp.MiddlewareHandlerResponse) group.Bind(openctl.New()) // Open tools API for frontends, no auth required. diff --git a/internal/model/dto/house.go b/internal/model/dto/house.go index 62ff091..c8f0234 100644 --- a/internal/model/dto/house.go +++ b/internal/model/dto/house.go @@ -73,6 +73,12 @@ type HouseListingVO struct { CommunityName string `json:"communityName" orm:"community_name"` } +// HouseTransactionVO 成交记录查询结果(内嵌实体 + 关联小区名)。 +type HouseTransactionVO struct { + entity.HouseTransaction + CommunityName string `json:"communityName" orm:"community_name"` +} + // DashboardOverview 看板统计概览。 type DashboardOverview struct { CommunityCount int