diff --git a/soul-api/internal/handler/ckb.go b/soul-api/internal/handler/ckb.go index cf322107..57d1db0e 100644 --- a/soul-api/internal/handler/ckb.go +++ b/soul-api/internal/handler/ckb.go @@ -85,6 +85,24 @@ func CKBJoin(c *gin.Context) { c.JSON(http.StatusBadRequest, gin.H{"success": false, "message": "无效的加入类型"}) return } + // 先写入 match_records(无论 CKB 是否成功,用户确实提交了表单) + if body.UserID != "" { + rec := model.MatchRecord{ + ID: fmt.Sprintf("mr_ckb_%d", time.Now().UnixNano()), + UserID: body.UserID, + MatchType: body.Type, + } + if body.Phone != "" { + rec.Phone = &body.Phone + } + if body.Wechat != "" { + rec.WechatID = &body.Wechat + } + if err := database.DB().Create(&rec).Error; err != nil { + fmt.Printf("[CKBJoin] 写入 match_records 失败: %v\n", err) + } + } + ts := time.Now().Unix() params := map[string]interface{}{ "timestamp": ts,