This commit is contained in:
Alex-larget
2026-03-17 18:22:06 +08:00
parent 88915276d1
commit f276595ad6
50 changed files with 2246 additions and 1223 deletions

View File

@@ -54,6 +54,8 @@ func WechatPhoneLogin(c *gin.Context) {
isNewUser := result.Error != nil
if isNewUser {
// 软删除后再次登录:旧记录 id=openid 仍存在,需用新 id 避免主键冲突
userID := "user_" + randomSuffix()
referralCode := "SOUL" + strings.ToUpper(openID[len(openID)-6:])
nickname := "微信用户" + openID[len(openID)-4:]
avatar := ""
@@ -67,7 +69,7 @@ func WechatPhoneLogin(c *gin.Context) {
phone = "+" + countryCode + " " + phoneNumber
}
user = model.User{
ID: openID,
ID: userID,
OpenID: &openID,
SessionKey: &sessionKey,
Nickname: &nickname,