diff --git a/app/hdl/hdl_add_friend.go b/app/hdl/hdl_add_friend.go index 5009681..9f79f07 100644 --- a/app/hdl/hdl_add_friend.go +++ b/app/hdl/hdl_add_friend.go @@ -605,16 +605,7 @@ func MyFansUserList(c *gin.Context) { limit := c.DefaultQuery("limit", "20") now := time.Now() - val, exists := c.Get("user") - if !exists { - e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) - return - } - user, ok := val.(*model.User) - if !ok { - e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) - return - } + user := svc.GetUser(c) energyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(db.Db) eggEnergyBasicSetting, err := energyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{ @@ -664,9 +655,9 @@ func MyFansUserList(c *gin.Context) { sql = "SELECT user.id AS uid, user.avatar AS avatar, user.nickname AS nickname, user_relate.invite_time AS invite_time " + "FROM `user_relate` " + "LEFT JOIN `user` ON user_relate.uid = user.id " + - "where user_relate.uid IN(%s)" + "where user_relate.uid IN(%s) and user_relate.parent_uid = %d" sql += " ORDER BY user_relate.invite_time DESC LIMIT %d, %d;" - sql = fmt.Sprintf(sql, strings.Join(userRelatesUids, ","), (utils.StrToInt64(page)-1)*utils.StrToInt64(limit), utils.StrToInt64(limit)) + sql = fmt.Sprintf(sql, strings.Join(userRelatesUids, ","), user.Id, (utils.StrToInt64(page)-1)*utils.StrToInt64(limit), utils.StrToInt64(limit)) results, err = db.QueryNativeString(db.Db, sql) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error())