基于SpringBoot的阳光线上交友系统源码和论文

基于SpringBoot的线上交友系统设计与实现
本文介绍了使用SpringBoot、MVC和LayUI构建的阳光线上交友系统,包括功能如用户登录、好友添加、数据库管理等,以及Shiro的安全框架应用。

基于SpringBoot的阳光线上交友系统的设计与实现

随着科学技术和人类生活质量的不断发展,计算机技术已经应用到多个领域中,成为许多行业的经营工具。在当今时代,人们不仅需要生活物质上的满足,更渴望精神心理上的满足。但是,由于人们常常为了生活去奔波, 时间来人事更多的朋友,解释更多的同道中人,阳光线上交友系统应运而生。本系统可以为用户随机刷新新朋友,并且可以进行添加好友,如果对方同意,你们就可以深入了解对方,甚至成为良师益友。用户可以在无聊的时候登录该系统,快速交识新朋友。

本系统采用MVC设计模式进行开发,前端通过LayUI开源框架进行开发,后端利用SpringBoot框架进行开发,数据库采用MySQL,通过MyBatis将实体类与数据库表进行映射,安全框架采用Shiro,整体采用前后端分离。

本系统分为六大模块:登录模块、个人信息维护模块、寻找好友模块、我的地盘模块、我的钱包模块、充值人员模块。

【554】基于SpringBoot的阳光线上交友系统源码和论文

关键词:线上交友;SpringBoot;Shiro

Design and Implementation of Sunshine Online Make Friends System Based on SpringBoot

Abstract

With the continuous development of science and technology and the quality of human life, computer technology has been applied to many fields and has become a management tool for many industries。 In today's era, people not only need material satisfaction in life, but also long for spiritual and psychological satisfaction。 However, because people often run around for life, and have time to recruit more friends and explain more like-minded people, the Sunshine Online Dating System came into being。 This system can randomly refresh new friends for users, and can add friends。 If the other party agrees, you can get to know each other deeply, and even become a good teacher and friend。 Users can log into the system when they are bored and make new friends quickly。

The system adopts the MVC design pattern for development, the front-end is developed through the LayUI open source framework, the back-end is developed using the SpringBoot framework, the database adopts MySQL, the entity classes and database tables are mapped through MyBatis, the security framework adopts Shiro, and the overall front-end and back-end separation is adopted.

This system is divided into six modules: login module, personal information maintenance module, friend finding module, my site module, my wallet module, and recharge personnel module.

Keywords: Make Friends;SpringBoot;Shiro

package com.zh.yangguang.web;

import com.zh.yangguang.mapper.UserMapper;
import com.zh.yangguang.pojo.Friend;
import com.zh.yangguang.pojo.User;
import com.zh.yangguang.pojo.UserDetail;
import com.zh.yangguang.server.*;
import com.zh.yangguang.utile.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.util.WebUtils;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;

@Controller
public class UserDetailController {
    @Autowired
    private UserDetailService userDetailService;
    @Autowired
    private AreaService areaService;
    @Autowired
    private UserService userService;
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private FriendService friendService;
    @Autowired
    private RechargeService rechargeService;
    @RequestMapping("/uploadImage")
    @ResponseBody
    public ResultUtil uploadImage(MultipartFile file, HttpServletRequest req) throws IOException {
        String filename=System.currentTimeMillis()+file.getOriginalFilename();
        String path = WebUtils.getRealPath(req.getSession().getServletContext(),
                "/image/");

        File f=new File(path+ filename);
        if( !f.getParentFile().exists()) {
            // 如果目标文件所在的目录不存在,则创建父目录
            f.getParentFile().mkdirs();
        }
        file.transferTo(f);
        ResultUtil r=ResultUtil.ok();
        r.setData(filename);
        return r;
    }
    @RequestMapping("initUserDetail")
    @ResponseBody
    public ResultUtil insertUserDetail(UserDetail userDetail, HttpServletRequest req){

        User u=(User)req.getSession().getAttribute("loginUser");
        userDetail.setUpdId(u.getId());
        userDetail.setUpdTime(new Date());

        req.getSession().setAttribute("loginUserDetail",userDetail);
        req.getSession().setAttribute("adr1",areaService.findById(userDetail.getAdr1()));
        req.getSession().setAttribute("adr2",areaService.findById(userDetail.getAdr2()));
        req.getSession().setAttribute("adr",areaService.findById(userDetail.getAdr()));
        if(u.getStatus()!=-1){
            userDetailService.updUserDetail(userDetail);
            return ResultUtil.ok("修改");
        }else{
            int n=userDetailService.insertUserDetail(userDetail);
            userService.setStatusToOne(u.getId());
            User user=userMapper.selectByPrimaryKey(userDetail.getId());
            req.getSession().setAttribute("loginUser",user);
            return ResultUtil.ok("跳转");
        }

    }
    @RequestMapping("getuserList")
    @ResponseBody
    public ResultUtil getuserList(String content,Integer adr1,Integer sex,Integer adr2,Integer adr3,String page,String limit,HttpServletRequest req){

        Integer adr;
        if(adr3!=null){
            adr=adr3;
        }
        else if(adr2!=null){
            adr=adr2/100;
        }
        else if(adr3!=null){
            adr=adr2/10000;
        }else{
            adr=null;
        }
        req.setAttribute("content",content);
        List<User> list=userDetailService.findAll(content,adr,sex,(Integer.parseInt(page)-1)*Integer.parseInt(limit), Integer.parseInt(limit));
        Integer n=userDetailService.UserCount(content,adr,sex);
        ResultUtil ru=new ResultUtil().ok();
        ru.setData(list);
        ru.setCount(n);
        return ru;
    }
    @RequestMapping("updsome")
    @ResponseBody
    public ResultUtil updsome(UserDetail userDetail){
        int n= userDetailService.updsome(userDetail);
        if(n>0){
            return ResultUtil.ok();
        }else{
            return ResultUtil.error();
        }
    }
    @RequestMapping("addfrient")
    @ResponseBody
    public ResultUtil addfrient(String id,HttpServletRequest req){
        User u=(User)req.getSession().getAttribute("loginUser");
        List<Friend> list=friendService.findFriendByTowId(id,u.getId());
        if(list.size()>0){
            return ResultUtil.error("你已申请过,或你们已经是好友");
        }
        User user=userMapper.findUserByUsername(u.getUsername());
        UserDetail userDetail=userDetailService.findByID(user.getId());
        if(user.getMoney()<0.2){
            return ResultUtil.error("余额不足");
        }else{
            rechargeService.addRecharge(user.getId(),userDetail.getPickname(),-0.2);
            userService.loseTwoMoney(user.getId());
            friendService.addfriend(user.getId(),id);
            return ResultUtil.ok();
        }
    }
    @RequestMapping("getrandomList")
    @ResponseBody
    public ResultUtil getrandomList(HttpServletRequest req){
        User user=(User)req.getSession().getAttribute("loginUser");
        List<UserDetail> list=userDetailService.findNotSelf(user.getId());
        int count=list.size();
        Random r=new Random();
        List<UserDetail> l=new ArrayList();
        for(int i=0;i<5;i++){
            l.add(list.get(r.nextInt(count)));
        }
        ResultUtil ru=new ResultUtil().ok();
        ru.setData(l);
        ru.setCount(5);
        return ru;
    }


    @RequestMapping("/userdetailinfo")
    public String touserdetailinfo(HttpServletRequest req){
        return "user/userDetail";
    }
    @RequestMapping("editUser")
    public String editUser(String id ,HttpServletRequest req){
        req.setAttribute("user",userDetailService.findByID(id));
        return "user/editUser";
    }
    @RequestMapping("randomfriend")
    public String randomuser(HttpServletRequest req){
        return "user/randomUser";
    }


}
package com.zh.yangguang.web;

import com.zh.yangguang.mapper.UserMapper;
import com.zh.yangguang.pojo.Recharge;
import com.zh.yangguang.pojo.User;
import com.zh.yangguang.pojo.UserDetail;
import com.zh.yangguang.server.RechargeService;
import com.zh.yangguang.server.UserDetailService;
import com.zh.yangguang.server.UserService;
import com.zh.yangguang.utile.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

@Controller
public class RachargeController {

    @Autowired
    private RechargeService rechargeService;
    @Autowired
    private UserMapper userMapper;

    @RequestMapping("getrechargelist")
    @ResponseBody
    private ResultUtil rechargelist(String content, Integer type, String page, String limit, HttpServletRequest req){
        User user=(User)req.getSession().getAttribute("loginUser");
        String id=null;
        if("2".equals(user.getType())){
            id=user.getId();
        }
        List<Recharge> list=rechargeService.rechargelist(id,content,type,(Integer.parseInt(page)-1)*Integer.parseInt(limit), Integer.parseInt(limit));
        int n=rechargeService.rechargelistCount(id,content,type);
        ResultUtil ru=new ResultUtil().ok();
        ru.setData(list);
        ru.setCount(n);
        return ru;
    }
    @RequestMapping("addmoney")
    @ResponseBody
    private ResultUtil addmoney(Recharge recharge){
        User user=userMapper.findUserByUsername(recharge.getUsername());
        if(user==null){
            return ResultUtil.error("用户不存在");
        }
        recharge.setId(user.getId());
        recharge.setTime(new Date());
        recharge.setStatus(1);
        rechargeService.addmoney(recharge);
        userMapper.addmoney(user.getId(),recharge.getMoney());
        return ResultUtil.ok();
    }
    @RequestMapping("delRecharge")
    @ResponseBody
    public ResultUtil delRecharge(String id){
        return rechargeService.delRecharge(id);
    }


    @RequestMapping("myrecharge")
    private String myrecharge(){
        return "recharge/rechargeList";
    }

    @RequestMapping("recharge")
    private String recharge(){
        return "recharge/recharge";
    }
    @RequestMapping("torecharge")
    private String torecharge(){
        return "recharge/torecharge";
    }


}

此版本适用用全新安装 如果你已经安装了本系统,则在用此次的版本覆盖的时候注意 1、请覆盖安装时不要将数据库覆盖,否则数据将会丢失!!!! 安装交友网站管理系统(Mslove)安装前,请保证以下条件: ·服务器支持ASP,FSO(文件可读写权限),部分需要支持xmlhttp组件、ADODB.STREAM组件,支持桌面数据库(专业版本用户需要支持SQLserver数据库) ·服务器脚本解释引擎:VBScript/5.6.8515或以上 ·客户端浏览器请使用IE5.5以上。 ·会员注册页面:Reg.asp,登陆页面:Login.asp ·详细安装说明请查看帮助文档或登陆官方站查询更多技术资料 本系统登陆用户名密码为:admin/123456 后台登陆地址为:admin_login.asp(默认),请登录时在后台修改。 关于数据库连接设置问题: 数据库路径请使用绝对目录,如/data/data.mdb这种格式,不能使用../data/data.mdb格式。 如果你的系统不在站点根目录下,请注意路径。 请修改conn.asp数据库路径访问IP数据库路径。用户下载后自行修改数据库文件名,如果由此造成的数据库别别人恶意下载,与本公司无关。 比如:本系统放在http://www.xmrxw.com/love目录下,那么数据库路径就为:/love/Data/Data.mdb。 Uploadfile,PreviewImage为上传目录。 2.首页js调用方法: 主程序文件js.asp,调用方式: [removed][removed] topnum为调用条数,Types为调用人气、最新、活动类别。jstest.asp是一个调用示例。 文件名称:数据库安全说明 本版本数据库中附带了防止下载相应的表,数据库中的nodownload表不能删除 1、将您网站交友数据库下载回本地(默认为data.mdb)。 2、将您的交友数据库命名为.asp后缀,如data.asp,接着修改conn.asp文件中的数据库连接地址,改好后将文件上传即可正常使用。 3、另外,备份数据库的地址也是一个很重要的问题,很多朋友都没修改默认的数据库目录名称(data_backup),所以在执行备份前后请一定要注意备份目录中是否用了默认数据库名备份! 以后如果想对数据库结构进行修改,只需要将数据库重新命名后缀为.mdb的就可以用了。 一.对于系统安装者 1.必须及时查看http://www.xmrxw.com或者后台系统更新通知,以便获得最新版本的程序,必须及时将自己的系统升级到最新的版本。 2.放置系统的主机要注意安全,一些重要的目录请管理员设置好权限,防止非 正常的访问。 3.上传程序前修改数据库名称,并修改conn.asp文件,防止非法下载,也可对 数据库加密后修改conn.asp文件,具体请看论坛相关文章 4.备份数据库名称必须更改,备份目录默认data_backup,具体说明请看后台说明。 5.如果发现系统有任何异常,请及时到http://www.xmrxw.com中联系作者。 6.上传完时应该立即登录后台修改后台目录,及后台登录地址,后台目录默认admin,登录地址默认admin_login.asp。 7. 上传目录UploadFile中四个文件夹不要删除,缩略图片目录PreviewImage。 二.对于系统管理员 1.定期更改数据库的名字并备份数据,提高系统安全系数。 2.如果系统做过备份,当下载了备份文件后注意及时删除主机上的备份文件。 3.定期修改自己的密码,不要在任何公共场所使用自己的密码进入系统。 4.在管理系统时,或者用管理员身份登陆时,尽量不要去访问其他任何站点,以防止cookie泄密。 5.不要使用少于8位的密码,密码中务必是数字、字母的组合,提高安全系数。 6.进入管理区,执行管理操作完毕后,注意要关闭全部的浏览器一次,以绝后患。 7.用自己的用户名密码登陆过系统的话,当你离开系统时,务必点退出,不要仅仅关闭浏览器。 8.定期维护系统,初始化用户资料,查看是否有异常的账号,及时处理多余的信息、上传文件。 9. 定期查看上传目录、及缩略目录中的文件。 三.对于系统使用者 1.定期修改自己的密码,不要在任何公共场所使用自己的密码进入系统。 2.不要使用少于8位的密码,密码中务必是数字、字母的组合,提高安全系数。 3.用自己的用户名密码登陆过系统的话,当你离开系统时,务必点退出,不要仅仅关闭浏览器。 4.发现密码被盗,应该立即通知管理员给与解决。 四.及时了解系统补丁 1. SP1补丁收集到2005-12-15,如何打补丁,请查看sp1目录下的readme.txt文件。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值