This commit is contained in:
Alex-larget
2026-03-24 15:44:08 +08:00
parent 346e8ab057
commit 28ad08da84
62 changed files with 814 additions and 840 deletions

View File

@@ -6,6 +6,7 @@ import (
"math"
"net/http"
"os"
"strings"
"time"
"soul-api/internal/config"
@@ -88,14 +89,20 @@ func WithdrawPost(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"success": false, "message": "用户未绑定微信"})
return
}
// 与小程序 referral 一致:须填写资料中的微信号,便于运营到账核对(不再用 openid 顶替)
if user.WechatID == nil || strings.TrimSpace(*user.WechatID) == "" {
c.JSON(http.StatusOK, gin.H{
"success": false,
"needBindWechat": true,
"message": "请先到设置页绑定微信号后再提现,便于到账核对",
})
return
}
withdrawID := generateWithdrawID()
status := "pending"
// 根据 user_id 已查到的用户信息,填充提现表所需字段;仅写入表中存在的列,避免 remark 等列不存在报错
wechatID := user.WechatID
if (wechatID == nil || *wechatID == "") && user.OpenID != nil && *user.OpenID != "" {
wechatID = user.OpenID
}
withdrawal := model.Withdrawal{
ID: withdrawID,
UserID: req.UserID,