From fbcd7445bb2095a62165e9f195f96b37146ed622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Sun, 8 Mar 2026 16:39:17 +0800 Subject: [PATCH] =?UTF-8?q?sync:=20soul-api=20=E6=8E=A5=E5=8F=A3=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20|=20=E5=8E=9F=E5=9B=A0:=20=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soul-api/internal/handler/match_records.go | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/soul-api/internal/handler/match_records.go b/soul-api/internal/handler/match_records.go index 6493a066..742674b1 100644 --- a/soul-api/internal/handler/match_records.go +++ b/soul-api/internal/handler/match_records.go @@ -155,3 +155,34 @@ func DBMatchPoolCounts(c *gin.Context) { }, }) } + +// DBMatchRecordInsertTest POST /api/db/match-records/test 插入测试匹配记录 +func DBMatchRecordInsertTest(c *gin.Context) { + var body struct { + MatchType string `json:"matchType"` + Phone string `json:"phone"` + WechatID string `json:"wechatId"` + } + _ = c.ShouldBindJSON(&body) + if body.MatchType == "" { + body.MatchType = "team" + } + if body.Phone == "" { + body.Phone = "13800000000" + } + db := database.DB() + rec := model.MatchRecord{ + ID: fmt.Sprintf("mr_test_%d", time.Now().UnixNano()), + UserID: "admin_test", + MatchType: body.MatchType, + Phone: &body.Phone, + } + if body.WechatID != "" { + rec.WechatID = &body.WechatID + } + if err := db.Create(&rec).Error; err != nil { + c.JSON(http.StatusOK, gin.H{"success": false, "message": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"success": true, "message": "测试记录已插入", "id": rec.ID}) +}