sync: soul-api 接口逻辑 | 原因: 后端接口逻辑修改

This commit is contained in:
卡若
2026-03-08 16:39:17 +08:00
parent 6629086487
commit fbcd7445bb

View File

@@ -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})
}