fix: oauth aff

This commit is contained in:
CalciumIon
2024-11-18 18:52:14 +08:00
parent 6a42ccf00e
commit 7db703374c
5 changed files with 188 additions and 13 deletions

View File

@@ -237,7 +237,13 @@ func LinuxdoOAuth(c *gin.Context) {
user.Role = common.RoleCommonUser
user.Status = common.UserStatusEnabled
if err := user.Insert(0); err != nil {
affCode := session.Get("aff")
inviterId := 0
if affCode != nil {
inviterId, _ = model.GetUserIdByAffCode(affCode.(string))
}
if err := user.Insert(inviterId); err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": err.Error(),