当前位置: 首页 > news >正文

北京专门做网站的企业网络推广的方法有哪些

北京专门做网站的,企业网络推广的方法有哪些,网站做竞价优化,c2g的代表性电商平台一、项目介绍 线上论坛 相关技术:SpringBootSpringMvcMybatisMysqlSwagger项目简介:本项目是一个功能丰富的线上论坛,用户可编辑、发布、删除帖子,并评论、点赞。帖子按版块分类,方便查找。同时,用户可以…

一、项目介绍

线上论坛

  • 相关技术:SpringBoot+SpringMvc+Mybatis+Mysql+Swagger
  • 项目简介:本项目是一个功能丰富的线上论坛,用户可编辑、发布、删除帖子,并评论、点赞。帖子按版块分类,方便查找。同时,用户可以修改和展示个人信息,还能发送私信与其他用户交流。
  • 项目描述
  1.   采用前后端分离架构,通过JSON格式传输数据,基于SpringBoot和Mybatis框架构建。
  2.   设计统一的数据返回格式,全局处理错误信息,提升用户体验。
  3.   利用@ControllerAdvice和@ExceptionHandler实现全局异常处理,确保系统稳定性。
  4.   使用HandlerInterceptor拦截器实现用户登录校验,并采用MD5算法对密码进行加密存储。
  5.   集成Swagger自动生成API测试接口,方便开发者进行测试和调试。
  6.   利用Mybatis Generator自动生成常用的增删改查方法,提高开发效率。

二、项目实现效果

  部分页面展示:

帖子页面(首页显示所有帖子,切换版块则显示对应帖子):

用户个人信息展示页面(包含用户发布的帖子):

个人信息修改页面:

帖子详情页面(下方为评论):

用户之间私信:

 部分功能说明:

页面上方 :帖子搜索功能并未实现,月亮按钮为可切换夜间模式,铃铛按钮为用户私信功能。

个人中心:其中头像修改功能并未实现。


三、项目具体实现

1.软件生命周期

  一个软件的生命周期可以划分为

  • 可行性研究
  • 需求分析
  • 概要设计
  • 详细设计
  • 编码实现
  • 测试
  • 使用及维护
  • 退役

2.项目需求分析

  1. 用户 注册(设置用户名,昵称,密码,且需要同意隐私条款才可注册)、登录、退出登录 的功能。
  2. 个人中心可修改个人信息(包括 昵称,邮箱地址,电话号码,个人简介)和修改密码(需确认原密码)。
  3. 用户信息页:显示用户信息(昵称,发帖数,邮箱,注册时间,个人简介)及该用户发布的帖子(各个帖子显示其 标题 ,作者 ,发布时间,阅读量,点赞数,评论数),帖子按发布时间倒序排列,用户访问其他用户主页时可发送私信。
  4. 帖子列表页:首页显示所有帖子(各个帖子显示其 标题 ,作者 ,发布时间,阅读量,点赞数,评论数),切换版块则显示对应版块帖子,并且统计该版块下所有帖子数量,帖子按发布时间倒序排列。
  5. 查看全文:显示帖子信息(标题,正文,作者,发布时间,阅读量,点赞数,评论数),并且可点赞,评论帖子(下方评论按时间倒序排列),以及给作者发私信,若查看本人帖子,则还有修改,删除帖子功能。
  6. 添加,修改,删除帖子功能(除了标题,正文外,还要选择帖子版块)。
  7. 私信功能:显示信息状态(未读,已读,已回复),且无法给自己发送私信。
  8. 评论,点赞帖子功能。
  9. 页面可切换为白天,夜间显示。
  10. 用户权限限制:访问所有页面均要登录(未登录无法访问,强制跳转至登录页面)。

3.设计

设计数据库存储 用户,帖子,帖子评论,用户私信,帖子版块 信息。

其中用户信息表结构:

4.编码实现

4.1项目构建及相关配置

  基于SpringBoot和Mybatis框架构建项目,及MySQL,MyBatis等相关配置...

4.2创建实体类(依据数据库中表结构)

例如:


@Data
public class User {private Long id;private String username;@JsonIgnore //不参与Json序列化private String password;private String nickname;private String phoneNum;private String email;private Byte gender;@JsonIgnore //不参与Json序列化private String salt;@JsonInclude(JsonInclude.Include.ALWAYS) // 不论任何情况都参与JSON序列化private String avatarUrl;private Integer articleCount;private Byte isAdmin;private String remark;private Byte state;@JsonIgnore //不参与Json序列化private Byte deleteState;private Date createTime;private Date updateTime;}

4.3数据库持久层(涉及到增删改查)

例如:

@Mapper
public interface ArticleMapper {int insert(Article row);int insertSelective(Article row);Article selectByPrimaryKey(Long id);int updateByPrimaryKeySelective(Article row);int updateByPrimaryKeyWithBLOBs(Article row);int updateByPrimaryKey(Article row);/*** 显示首页列表* @return*/List<Article> selectAll ();/*** 显示版块列表* @param boardId* @return*/List<Article> selectAllByBoardId(Long boardId);/*** 帖子详情* @param id* @return*/Article selectDetailById(Long id);/*** 根据用户id查询对应用户帖子列表* @param userId* @return*/List<Article> selectByUserId (Long userId);}

4.4统一前后端数据交互对象

/*** Created with IntelliJ IDEA.* Description:统一的前后端交互对象* User: 林* Date: 2024-02-29* Time: 19:39*/
public class AppResult<T> {@JsonInclude(JsonInclude.Include.ALWAYS) // 不论任何情况都参与JSON序列化private long code;@JsonInclude(JsonInclude.Include.ALWAYS) // 不论任何情况都参与JSON序列化private String message;@JsonInclude(JsonInclude.Include.ALWAYS) // 不论任何情况都参与JSON序列化private T data;//泛型public AppResult(long code, String message, T data) {this.code = code;this.message = message;this.data = data;}public AppResult(long code, String message) {this(code,message,null);}public long getCode() {return code;}public void setCode(long code) {this.code = code;}public String getMessage() {return message;}public void setMessage(String message) {this.message = message;}public T getData() {return data;}public void setData(T data) {this.data = data;}//提供一些常用的静态方法/*** 成功*///不需要返回数据public static AppResult success(){return  new AppResult(ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMessage());}//不需要返回数据,自定义描述信息public static AppResult success(String message){return  new AppResult(ResultCode.SUCCESS.getCode(),message);}//有数据public static <T> AppResult<T> success(T data){return new AppResult(ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMessage(),data);}//有数据,自定义描述信息public static <T> AppResult<T> success(String message,T data){return new AppResult(ResultCode.SUCCESS.getCode(),message,data);}/*** 失败*/public static AppResult failed(){return new AppResult(ResultCode.FAILED.getCode(),ResultCode.FAILED.getMessage());}//自定义描述信息public static AppResult failed(String message){return new AppResult(ResultCode.FAILED.getCode(),message);}//直接接收一个状态码对象,因为失败原因有多个public static AppResult failed(ResultCode resultCode){return new AppResult(resultCode.getCode(),resultCode.getMessage());}
}

4.5全局统一异常处理

  使用@ControllerAdvice配和@ExceptionHandler实现全局异常处理:


/*** Created with IntelliJ IDEA.* Description:全局统一异常处理* User: 林* Date: 2024-03-01* Time: 15:57*/
@Slf4j
@ControllerAdvice
public class GlobalExceptionHandler {//处理自定义的异常@ResponseBody@ExceptionHandler(ApplicationException.class)public AppResult applicationExceptionHandler (ApplicationException e) {// 打印异常信息e.printStackTrace(); // 上生产之前要删除,生产环境使用日志记录的// 打印日志log.error(e.getMessage());if (e.getErrorResult() != null) {return e.getErrorResult();}// 非空校验if (e.getMessage() == null || e.getMessage().equals("")) {return AppResult.failed(ResultCode.ERROR_SERVICES);}// 返回具体的异常信息return AppResult.failed(e.getMessage());}//处理非自定义的异常@ResponseBody@ExceptionHandler(Exception.class)public AppResult exceptionHandler (Exception e) {// 打印异常信息e.printStackTrace();// 打印日志log.error(e.getMessage());// 非空校验if (e.getMessage() == null || e.getMessage().equals("")) {return AppResult.failed(ResultCode.ERROR_SERVICES);}// 返回异常信息return AppResult.failed(e.getMessage());}
}

4.6注册、登录、退出登录

利用MD5对密码进行加密存储:

public class MD5Util {/*** 对字符串进行MD5加密* @param str 明文* @return 密文*/public static String md5 (String str) {return DigestUtils.md5Hex(str);}/*** 对用户密码进行加密* @param str 密码明文* @param salt 扰动字符,盐值* @return 密文*/public static String md5Salt (String str, String salt) {return md5(md5(str) + salt);//将原密码加密,拼上盐值,再一起加密成密文}
}

4.7修改个人信息

  先查询到之前的用户信息,再修改(修改密码则要还检验原密码)。

4.8用户主页信息

查询操作:根据用户id查询用户信息和用户所发布的帖子(按发布时间倒序排列)。

4.9帖子列表

查询操作:首页查询所有帖子,切换版块则查询对应版块帖子(按发布时间倒序排列)。

4.10查看全文

查询加修改操作:查询帖子,更新阅读量+1。

4.11添加、修改、删除帖子

增加,修改,删除操作:这些操作声明为事务

 /*** 创建帖子* @param article*/@Transactional//事务void  create (Article article);

4.12私信功能

发送,回复私信:增加操作。

信息查看和信息状态更新(涉及到查询,修改操作):用户点开私信列表(查询所有收到的私信),有新的消息,则该消息此时状态为未读。点开该消息(查询该消息详情),则状态为已读(修改操作,修改消息状态)。回复该消息,则该消息状态为已回复(修改操作,修改消息状态)。

public interface IMessageService {/*** 创建一个私信,用于发送给其他用户* @param message*/void create (Message message);/*** 根据用户id统计未读的信息* @param receiveUserId* @return*/Integer selectUnreadCount(Long receiveUserId);/*** 据id查询用户接收的私信列表,包括发送者信息和私信内容* @param receiveUserId* @return*/List<Message> selectByReceiveUserId (Long receiveUserId);/*** 根据id更新私信状态* @param id* @param state*/void updateStateById(Long id, Byte state);/*** 根据id查找私信* @param id* @return*/Message selectById(Long id);/*** 回复私信* @param repliedId* @param message*/@Transactionalvoid reply (Long repliedId, Message message);
}

4.13评论,点赞帖子

  评论帖子:增加操作...

  点赞帖子:修改操作,+1.

4.14白天,夜间效果

前端实现...

4.15用户权限限制

使用HandlerInterceptor拦截器实现用户登录校验:


/*** Created with IntelliJ IDEA.* Description:登录拦截器* User: 林* Date: 2024-03-05* Time: 22:13*/
@Component
public class LoginInterceptor implements HandlerInterceptor {@Value("${lin-forum.login.url}")private String defaultURL;//对拦截的内容做前置处理@Overridepublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {//获取sessionHttpSession session=request.getSession(false);//判断sessionif(session!=null && session.getAttribute(USER_SESSION)!=null){//用户已经登录return true;}//还未登录,重定向到登录页面//校验url地址是否以/开头if(!defaultURL.startsWith("/")){defaultURL="/"+defaultURL;}response.sendRedirect(defaultURL);return false;}
}

四、项目代码(gitee地址)

  forum · new林/项目 - 码云 - 开源中国 (gitee.com)

(服务器过期了,没部署...)


文章转载自:
http://circumfusion.jjpk.cn
http://jettison.jjpk.cn
http://serapis.jjpk.cn
http://cursely.jjpk.cn
http://somnambulate.jjpk.cn
http://acaleph.jjpk.cn
http://cercarial.jjpk.cn
http://areography.jjpk.cn
http://methoxychlor.jjpk.cn
http://concubinal.jjpk.cn
http://yob.jjpk.cn
http://revocable.jjpk.cn
http://corrade.jjpk.cn
http://premortuary.jjpk.cn
http://araneid.jjpk.cn
http://reb.jjpk.cn
http://tollie.jjpk.cn
http://nyctinasty.jjpk.cn
http://reval.jjpk.cn
http://capsomere.jjpk.cn
http://preventative.jjpk.cn
http://mbabane.jjpk.cn
http://fuci.jjpk.cn
http://herman.jjpk.cn
http://dissertation.jjpk.cn
http://fascicular.jjpk.cn
http://contrariant.jjpk.cn
http://torun.jjpk.cn
http://hearer.jjpk.cn
http://distichous.jjpk.cn
http://seaworthy.jjpk.cn
http://overcare.jjpk.cn
http://windrow.jjpk.cn
http://inductor.jjpk.cn
http://jingoist.jjpk.cn
http://spellican.jjpk.cn
http://risker.jjpk.cn
http://nablus.jjpk.cn
http://azulejo.jjpk.cn
http://equalarea.jjpk.cn
http://allotheism.jjpk.cn
http://testacean.jjpk.cn
http://rehospitalization.jjpk.cn
http://nuzzer.jjpk.cn
http://oeec.jjpk.cn
http://bcom.jjpk.cn
http://fazenda.jjpk.cn
http://complicate.jjpk.cn
http://caulocarpous.jjpk.cn
http://pizzazz.jjpk.cn
http://grayness.jjpk.cn
http://hypophyseal.jjpk.cn
http://unciform.jjpk.cn
http://cdi.jjpk.cn
http://back.jjpk.cn
http://johnstown.jjpk.cn
http://mamaguy.jjpk.cn
http://folklike.jjpk.cn
http://contestant.jjpk.cn
http://americanization.jjpk.cn
http://ninth.jjpk.cn
http://aeneous.jjpk.cn
http://koord.jjpk.cn
http://pettily.jjpk.cn
http://anemogram.jjpk.cn
http://beautiful.jjpk.cn
http://hyperactivity.jjpk.cn
http://yardstick.jjpk.cn
http://gerundial.jjpk.cn
http://geode.jjpk.cn
http://poxvirus.jjpk.cn
http://coccidia.jjpk.cn
http://navy.jjpk.cn
http://haggai.jjpk.cn
http://hypothesis.jjpk.cn
http://impartation.jjpk.cn
http://repress.jjpk.cn
http://megalopteran.jjpk.cn
http://romola.jjpk.cn
http://conventicle.jjpk.cn
http://polyandry.jjpk.cn
http://unhandy.jjpk.cn
http://neuralgiform.jjpk.cn
http://taraxacum.jjpk.cn
http://threnodist.jjpk.cn
http://overpaid.jjpk.cn
http://weaponization.jjpk.cn
http://invigorating.jjpk.cn
http://amygdale.jjpk.cn
http://solicitation.jjpk.cn
http://louvred.jjpk.cn
http://misfeasor.jjpk.cn
http://lukan.jjpk.cn
http://methylmercury.jjpk.cn
http://notum.jjpk.cn
http://kumiss.jjpk.cn
http://aerodyne.jjpk.cn
http://quatercentennial.jjpk.cn
http://prodigally.jjpk.cn
http://fount.jjpk.cn
http://www.dt0577.cn/news/85010.html

相关文章:

  • 动态网站项目实训教程任务3怎么做游戏推广员拉人犯法吗
  • 网络创业有哪些项目可以做seo积分系统
  • 仿各个网站的问题合肥品牌seo
  • 公司网站主要功能seo顾问服务 乐云践新专家
  • 怎样做网站优化排名seo zac
  • iframe框架做网站北京外包seo公司
  • 建设投资平台网站合肥seo优化
  • 做网站公司关键词品牌策略包括哪些内容
  • 做自己的优惠券网站精准营销的案例
  • 做的网站怎样适配手机报个计算机培训班多少钱
  • 国外做各种趣味实验的网站百度地图导航2021最新版
  • 在网站上做教学直播平台多少钱宝鸡seo
  • 游戏开发指南东莞关键词排名快速优化
  • 网站公告弹窗源码外贸快车
  • 做竞赛的平台或网站学seo建网站
  • 做网站自学线下推广渠道有哪些方式
  • 动态网站建设包括哪些方向优化公司治理结构
  • 大型网站建设公司 北京站长工具网站测速
  • wordpress建站系统广告制作
  • 莱芜网站建设排行百度收录查询方法
  • 电脑做系统教学网站免费代理上网网站
  • 各种类型网站建设seo企业顾问
  • 网站建设公司专业公司哪家好怎么写网站
  • 对政府网站一体化服务建设的需求网站建设公司哪个好呀
  • 网站开发 需求文档网站的优化策略方案
  • 网站开发 犯法购物网站大全
  • 成都装修公司十大排名网页seo优化
  • 急求聊城网站建设网站数据分析
  • 哪家做网站比较好俄罗斯搜索引擎推广
  • 中园建设银行官方网站百度seo官方网站