diff --git a/src/main/java/io/linfeng/Applications.java b/src/main/java/io/linfeng/Applications.java index b7427cd..16bd355 100644 --- a/src/main/java/io/linfeng/Applications.java +++ b/src/main/java/io/linfeng/Applications.java @@ -35,7 +35,8 @@ public class Applications { log.info("\n----------------------------------------------------------------\n\t" + "林风社交论坛开源版 '{}' 运行成功! 访问连接:\n\t" + "Swagger文档: \t\thttp://{}:{}/doc.html\n\t" + - "数据库监控: \t\thttp://{}:{}/druid\n" + + "数据库监控: \t\thttp://{}:{}/druid\n\t" + + "此开源版禁止商业使用,详情查看: \thttps://net.linfeng.tech/version/version.html\n" + "----------------------------------------------------------------", env.getProperty("spring.application.name"), InetAddress.getLocalHost().getHostAddress(), diff --git a/src/main/java/io/linfeng/common/utils/IPUtil.java b/src/main/java/io/linfeng/common/utils/IPUtil.java deleted file mode 100644 index 2c24024..0000000 --- a/src/main/java/io/linfeng/common/utils/IPUtil.java +++ /dev/null @@ -1,61 +0,0 @@ -package io.linfeng.common.utils; - -import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; - -import javax.servlet.http.HttpServletRequest; -import java.net.InetAddress; -import java.net.UnknownHostException; - -/** - * IP查询工具类 - * @author linfeng - * @date 2022/2/7 19:18 - */ -public class IPUtil { - - - private static final String UNKNOWN = "unknown"; - // IP归属地查询 - public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp?ip=%s&json=true"; - /** - * 获取ip地址 - */ - public static String getIp(HttpServletRequest request) { - String ip = request.getHeader("x-forwarded-for"); - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); - } - String comma = ","; - String localhost = "127.0.0.1"; - if (ip.contains(comma)) { - ip = ip.split(",")[0]; - } - if (localhost.equals(ip)) { - // 获取本机真正的ip地址 - try { - ip = InetAddress.getLocalHost().getHostAddress(); - } catch (UnknownHostException e) { - e.printStackTrace(); - } - } - return ip; - } - - /** - * 根据ip获取详细地址 - */ - public static String getCityInfo(String ip) { - String api = String.format(IP_URL,ip); - JSONObject object = JSONUtil.parseObj(HttpUtil.get(api)); - return object.get("addr", String.class); - } - -} diff --git a/src/main/java/io/linfeng/common/utils/IPUtils.java b/src/main/java/io/linfeng/common/utils/IPUtils.java index b54e870..36bd0fb 100644 --- a/src/main/java/io/linfeng/common/utils/IPUtils.java +++ b/src/main/java/io/linfeng/common/utils/IPUtils.java @@ -1,4 +1,3 @@ - package io.linfeng.common.utils; import com.alibaba.druid.util.StringUtils; @@ -43,13 +42,6 @@ public class IPUtils { logger.error("IPUtils ERROR ", e); } -// //使用代理,则获取第一个IP地址 -// if(StringUtils.isEmpty(ip) && ip.length() > 15) { -// if(ip.indexOf(",") > 0) { -// ip = ip.substring(0, ip.indexOf(",")); -// } -// } - return ip; } diff --git a/src/main/java/io/linfeng/common/utils/MapUtils.java b/src/main/java/io/linfeng/common/utils/MapUtils.java index 9cde135..4b19068 100644 --- a/src/main/java/io/linfeng/common/utils/MapUtils.java +++ b/src/main/java/io/linfeng/common/utils/MapUtils.java @@ -1,4 +1,3 @@ - package io.linfeng.common.utils; import java.util.HashMap; diff --git a/src/main/java/io/linfeng/common/utils/ShiroUtils.java b/src/main/java/io/linfeng/common/utils/ShiroUtils.java deleted file mode 100644 index 38eec60..0000000 --- a/src/main/java/io/linfeng/common/utils/ShiroUtils.java +++ /dev/null @@ -1,53 +0,0 @@ - -package io.linfeng.common.utils; - -import io.linfeng.common.exception.LinfengException; -import io.linfeng.modules.sys.entity.SysUserEntity; -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.session.Session; -import org.apache.shiro.subject.Subject; - -/** - * Shiro工具类 - * - */ -public class ShiroUtils { - - public static Session getSession() { - return SecurityUtils.getSubject().getSession(); - } - - public static Subject getSubject() { - return SecurityUtils.getSubject(); - } - - public static SysUserEntity getUserEntity() { - return (SysUserEntity)SecurityUtils.getSubject().getPrincipal(); - } - - public static Long getUserId() { - return getUserEntity().getUserId(); - } - - public static void setSessionAttribute(Object key, Object value) { - getSession().setAttribute(key, value); - } - - public static Object getSessionAttribute(Object key) { - return getSession().getAttribute(key); - } - - public static boolean isLogin() { - return SecurityUtils.getSubject().getPrincipal() != null; - } - - public static String getKaptcha(String key) { - Object kaptcha = getSessionAttribute(key); - if(kaptcha == null){ - throw new LinfengException("验证码已失效"); - } - getSession().removeAttribute(key); - return kaptcha.toString(); - } - -} diff --git a/src/main/java/io/linfeng/modules/app/dao/PostFabulousDao.java b/src/main/java/io/linfeng/modules/app/dao/PostFabulousDao.java deleted file mode 100644 index affd3ee..0000000 --- a/src/main/java/io/linfeng/modules/app/dao/PostFabulousDao.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * ----------------------------------- - * 林风社交论坛开源版本请务必保留此注释头信息 - * 开源地址: https://gitee.com/virus010101/linfeng-community - * 演示站点: https://www.linfeng.tech - * 可正常分享和学习源码,不得用于非法牟利! - * 商业版购买联系技术客服 QQ: 3582996245 - * Copyright (c) 2021-2023 linfeng all rights reserved. - * 版权所有 ,侵权必究! - * ----------------------------------- - */ -package io.linfeng.modules.app.dao; - -import io.linfeng.modules.app.entity.PostFabulousEntity; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** - * - * - * @author linfeng - * @email 3582996245@qq.com - * @date 2022-01-24 20:49:32 - */ -@Mapper -public interface PostFabulousDao extends BaseMapper { - -} diff --git a/src/main/java/io/linfeng/modules/app/dao/UserDao.java b/src/main/java/io/linfeng/modules/app/dao/UserDao.java deleted file mode 100644 index a7184d8..0000000 --- a/src/main/java/io/linfeng/modules/app/dao/UserDao.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * ----------------------------------- - * 林风社交论坛开源版本请务必保留此注释头信息 - * 开源地址: https://gitee.com/virus010101/linfeng-community - * 演示站点: https://www.linfeng.tech - * 可正常分享和学习源码,不得专卖或非法牟利! - * 商业版购买联系技术客服 QQ: 3582996245 - * Copyright (c) 2021-2023 linfeng all rights reserved. - * 版权所有 ,侵权必究! - * ----------------------------------- - */ -package io.linfeng.modules.app.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import io.linfeng.modules.app.entity.UserEntity; -import org.apache.ibatis.annotations.Mapper; - -/** - * 用户 - * - */ -@Mapper -public interface UserDao extends BaseMapper { - -} diff --git a/src/main/java/io/linfeng/modules/app/entity/PostFabulousEntity.java b/src/main/java/io/linfeng/modules/app/entity/PostFabulousEntity.java deleted file mode 100644 index b4b9e07..0000000 --- a/src/main/java/io/linfeng/modules/app/entity/PostFabulousEntity.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * ----------------------------------- - * 林风社交论坛开源版本请务必保留此注释头信息 - * 开源地址: https://gitee.com/virus010101/linfeng-community - * 演示站点:https://www.linfeng.tech - * 可正常分享和学习源码,不得用于非法牟利! - * 商业版购买联系技术客服 QQ: 3582996245 - * Copyright (c) 2021-2023 linfeng all rights reserved. - * 版权所有,侵权必究! - * ----------------------------------- - */ -package io.linfeng.modules.app.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; - -import java.io.Serializable; -import java.util.Date; -import lombok.Data; - -/** - * - * - * @author linfeng - * @email 3582996245@qq.com - * @date 2022-01-24 20:49:32 - */ -@Data -@TableName("lf_post_fabulous") -public class PostFabulousEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId - private Integer id; - /** - * 用户id - */ - private Integer uid; - /** - * 帖子id - */ - private Integer postId; - -} diff --git a/src/main/java/io/linfeng/modules/app/entity/TopicAdminEntity.java b/src/main/java/io/linfeng/modules/app/entity/TopicAdminEntity.java deleted file mode 100644 index d2edd1b..0000000 --- a/src/main/java/io/linfeng/modules/app/entity/TopicAdminEntity.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * ----------------------------------- - * 林风社交论坛开源版本请务必保留此注释头信息 - * 开源地址: https://gitee.com/virus010101/linfeng-community - * 演示站点:https://www.linfeng.tech - * 可正常分享和学习源码,不得用于非法牟利! - * 商业版购买联系技术客服 QQ: 3582996245 - * Copyright (c) 2021-2023 linfeng all rights reserved. - * 版权所有,侵权必究! - * ----------------------------------- - */ -package io.linfeng.modules.app.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; - -import java.io.Serializable; -import java.util.Date; -import lombok.Data; - -/** - * - * - * @author linfeng - * @email 3582996245@qq.com - * @date 2022-01-23 20:33:29 - */ -@Data -@TableName("lf_topic_admin") -public class TopicAdminEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId - private Integer id; - /** - * 圈子id - */ - private Integer topicId; - /** - * 用户id - */ - private Integer uid; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/src/main/java/io/linfeng/modules/app/entity/TopicTopEntity.java b/src/main/java/io/linfeng/modules/app/entity/TopicTopEntity.java deleted file mode 100644 index e17cc21..0000000 --- a/src/main/java/io/linfeng/modules/app/entity/TopicTopEntity.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * ----------------------------------- - * 林风社交论坛开源版本请务必保留此注释头信息 - * 开源地址: https://gitee.com/virus010101/linfeng-community - * 演示站点:https://www.linfeng.tech - * 可正常分享和学习源码,不得用于非法牟利! - * 商业版购买联系技术客服 QQ: 3582996245 - * Copyright (c) 2021-2023 linfeng all rights reserved. - * 版权所有,侵权必究! - * ----------------------------------- - */ -package io.linfeng.modules.app.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; - -import java.io.Serializable; -import java.util.Date; -import lombok.Data; - -/** - * - * - * @author linfeng - * @email 3582996245@qq.com - * @date 2022-01-23 20:33:29 - */ -@Data -@TableName("lf_topic_top") -public class TopicTopEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * id - */ - @TableId - private Integer id; - /** - * 圈子id - */ - private Integer topicId; - /** - * 内容id - */ - private Integer postId; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/src/main/java/io/linfeng/modules/app/entity/UserEntity.java b/src/main/java/io/linfeng/modules/app/entity/UserEntity.java deleted file mode 100644 index d955506..0000000 --- a/src/main/java/io/linfeng/modules/app/entity/UserEntity.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * ----------------------------------- - * 林风社交论坛开源版本请务必保留此注释头信息 - * 开源地址: https://gitee.com/virus010101/linfeng-community - * 演示站点:https://www.linfeng.tech - * 可正常分享和学习源码,不得用于非法牟利! - * 商业版购买联系技术客服 QQ: 3582996245 - * Copyright (c) 2021-2023 linfeng all rights reserved. - * 版权所有,侵权必究! - * ----------------------------------- - */ -package io.linfeng.modules.app.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - - -/** - * 用户 - * - */ -@Data -@TableName("tb_user") -public class UserEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 用户ID - */ - @TableId - private Long userId; - /** - * 用户名 - */ - private String username; - /** - * 手机号 - */ - private String mobile; - /** - * 密码 - */ - private String password; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/src/main/java/io/linfeng/modules/app/service/PostFabulousService.java b/src/main/java/io/linfeng/modules/app/service/PostFabulousService.java deleted file mode 100644 index 95209f6..0000000 --- a/src/main/java/io/linfeng/modules/app/service/PostFabulousService.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * ----------------------------------- - * 林风社交论坛开源版本请务必保留此注释头信息 - * 开源地址: https://gitee.com/virus010101/linfeng-community - * 可正常分享和学习源码,不得用于非法牟利! - * 商业版购买联系技术客服 QQ: 3582996245 - * Copyright (c) 2021-2023 linfeng all rights reserved. - * 演示站点:https://www.linfeng.tech - * 版权所有,侵权必究! - * ----------------------------------- - */ -package io.linfeng.modules.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import io.linfeng.common.utils.PageUtils; -import io.linfeng.modules.app.entity.PostFabulousEntity; - -import java.util.Map; - -/** - * - * - * @author linfeng - * @email 3582996245@qq.com - * @date 2022-01-24 20:49:32 - */ -public interface PostFabulousService extends IService { - - PageUtils queryPage(Map params); - - Boolean isThumb(Integer uid, Integer id); -} - diff --git a/src/main/java/io/linfeng/modules/app/service/impl/PostFabulousServiceImpl.java b/src/main/java/io/linfeng/modules/app/service/impl/PostFabulousServiceImpl.java deleted file mode 100644 index 4c71ceb..0000000 --- a/src/main/java/io/linfeng/modules/app/service/impl/PostFabulousServiceImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * ----------------------------------- - * 林风社交论坛开源版本请务必保留此注释头信息 - * 开源地址: https://gitee.com/virus010101/linfeng-community - * 可正常分享和学习源码,不得用于非法牟利! - * 商业版购买联系技术客服 QQ: 3582996245 - * Copyright (c) 2021-2023 linfeng all rights reserved. - * 演示站点:https://www.linfeng.tech - * 版权所有,侵权必究! - * ----------------------------------- - */ -package io.linfeng.modules.app.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import org.springframework.stereotype.Service; -import java.util.Map; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import io.linfeng.common.utils.PageUtils; -import io.linfeng.common.utils.Query; - -import io.linfeng.modules.app.dao.PostFabulousDao; -import io.linfeng.modules.app.entity.PostFabulousEntity; -import io.linfeng.modules.app.service.PostFabulousService; - - -@Service("postFabulousService") -public class PostFabulousServiceImpl extends ServiceImpl implements PostFabulousService { - - @Override - public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper<>() - ); - - return new PageUtils(page); - } - - @Override - public Boolean isThumb(Integer uid, Integer id) { - PostFabulousEntity entity = baseMapper.selectOne( - new LambdaQueryWrapper() - .eq(PostFabulousEntity::getPostId, id) - .eq(PostFabulousEntity::getUid, uid)); - return entity != null; - } - -} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index da951ef..6ff69d0 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -88,7 +88,7 @@ linfeng: #文件大小限制 oss: # 文件大小用户端和后台管理端 单位M - max-size: 30 + max-size: 10 admin-max-size: 5 # 是否开启短信验证码 diff --git a/src/main/resources/mapper/app/PostFabulousDao.xml b/src/main/resources/mapper/app/PostFabulousDao.xml deleted file mode 100644 index 776987b..0000000 --- a/src/main/resources/mapper/app/PostFabulousDao.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/app/UserDao.xml b/src/main/resources/mapper/app/UserDao.xml deleted file mode 100644 index 2a0ce16..0000000 --- a/src/main/resources/mapper/app/UserDao.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file