计算机毕业设计——网络游戏虚拟交易平台的设计与实现


前言

本文的大概内容:
近年随着互联网游戏迅猛发展,游戏用户也在不断增长,网络游戏参与者耗费了大量的时间、精力、金钱、智慧和技艺,获得虚拟财物,如游戏中虚拟“装备”、“ 元神”、“武器” 等等,而这些虚拟物品也具有了它的自身价值,随之就产生了虚拟物品交易活动,在游戏中买卖虚拟物品已经远远不能满足玩家的需求,虚拟物品网上交易已经为众玩家所共识,其特点在于买卖双方在交易过程中方便、快捷、安全,并且很好的解决了玩家异地交易所带来的不便,虚拟物品交易系统已经成为网络游戏的重要组成部分。


提示:以下是本篇文章正文内容,下面案例可供参考

一、背景及意义

选题背景

随着网络技术的飞速发展,越来越多的人感受到了网络带给人们的便捷与乐趣,越来越多的人喜欢通过网络游戏来愉悦心身,他们把网络游戏融入了自己的生活,他们在这个世界里娱乐、付出的同时也想要从这个世界中索取,于是有了需求和购买,便有了物品的等价交换,而虚拟世界中的虚拟物品也就有了自己的价值,网络游戏中的虚拟物品交易也便随之而来。对于目前虚拟物品交易市场的混乱现象,如何为广大网游玩家提供一个安全便捷的交易平台是本课题所研究的重点。

选题目的

此题的目的是为了方便人们的需求,让人们在玩游戏时有更好的游戏体验让玩家可以从虚拟社会中得到现实社会真正的实惠,同时,由于交易是在虚拟的环境下进行,这便给诈骗等一系列犯罪活动留下了契机。为了能使广大网游爱好者能够随心所欲的进行虚拟物品交易,建立一个可靠高效的交易平台显得日趋重要。玩家会觉得他们在虚拟社会中的努力得到了认可和证明。这种虚拟物品交易系统是目前网络游戏的研发重点。

系统目标

采用Spring Boot框架完成一个游戏虚拟交易平台,通过本平台可以买卖各种游戏账号或者游戏币等等,也可以发布自己出售的游戏币或游戏账号,顾客可以在线浏览和购买各种游戏道具。

二、总体设计

主要功能

(1)系统实现用户,管理员的登录注册。
(2)装备管理(游戏装备的增加,删除,查找,修改)
(3)游戏账号管理(玩家出售自己的游戏币或游戏账号)
(4)退钱管理(充值错误申请退款等)
(5)查询管理(游戏名称查询,游戏价格查询,商品编号查询)
(6)用户管理(用户初始密码的设置,密码的修改)
(7)用户可以卖,可以买,然后被管理员管理,管理员有权限取消交易

运行环境

(1)操作系统:windows 7/10/11或者 Mac OS
(2)数据库:MySQL5.7版本及以上,越高越好
(3)开发环境: IntelliJ IDEA 2018.3.4 x64,Eclipse,Myeclipse都可以。推荐IDEA;
(4)服务器:apsche-tomcat-9.0.10
(5)浏览器:qq浏览器或win10自带浏览器或者其他浏览器都可以

三、使用说明

本系统的数据库后缀是【.nb3】不同与一般的【.sql】,需要在 Navicat 上面新建一个数据库,然后把数据备份进去
管理员登陆:http://localhost:8088/admin/login
用户登陆:http://localhost:8088/login

部分页面截图展示

用户登录模块实现
在这里插入图片描述
用户对售卖装备管理功能模块实现
在这里插入图片描述
用户对游戏账号管理功能模块实现
在这里插入图片描述
用户对游戏装备管理功能模块实现
在这里插入图片描述

扫描二维码关注公众号,回复: 14174827 查看本文章

管理员登录模块实现
在这里插入图片描述
管理员对用户账号管理功能模块实现
在这里插入图片描述
管理员对游戏类型管理功能模块实现
在这里插入图片描述
管理员对游戏账号管理功能模块实现
在这里插入图片描述
管理员对游戏装备管理功能模块实现
在这里插入图片描述
交易列表功能模块实现
在这里插入图片描述

部分代码展示

代码如下(示例):
游戏装备控制层

@Controller
public class GameEquipController {
    
    
    @Autowired
    private GameEquipService gameEquipService;
    @Autowired
    private GameService gameService;
    @Autowired
    private GameAccountService gameAccountService;

    @RequestMapping("gameEquip")
    public String gameEquip(Model model){
    
    
        Subject subject = SecurityUtils.getSubject();
        if(subject.hasRole(SystemConstant.ROLE_ID_ADMIN)){
    
    
            Admin admin = (Admin) subject.getPrincipals().getPrimaryPrincipal();
            model.addAttribute("loginName", admin.getAccount());
            model.addAttribute("role",SystemConstant.ROLE_ID_ADMIN);
        }
        if(subject.hasRole(SystemConstant.ROLE_ID_USER)){
    
    
            User user = (User) subject.getPrincipals().getPrimaryPrincipal();
            model.addAttribute("loginName", user.getName());
            model.addAttribute("role",SystemConstant.ROLE_ID_USER);
        }
        return "gameEquip.html";
    }

    @RequestMapping("toAddGameEquip")
    public String toAddGameEquip(Model model){
    
    
        Subject subject = SecurityUtils.getSubject();
        if(subject.hasRole(SystemConstant.ROLE_ID_ADMIN)){
    
    
            Admin admin = (Admin) subject.getPrincipals().getPrimaryPrincipal();
            model.addAttribute("loginName", admin.getAccount());
            model.addAttribute("role",SystemConstant.ROLE_ID_ADMIN);
        }

        String userId = "";
        if(subject.hasRole(SystemConstant.ROLE_ID_USER)){
    
    
            User user = (User) subject.getPrincipals().getPrimaryPrincipal();
            userId = user.getId();
        }
        if(subject.hasRole(SystemConstant.ROLE_ID_USER)){
    
    
            User user = (User) subject.getPrincipals().getPrimaryPrincipal();
            model.addAttribute("loginName", user.getName());
            model.addAttribute("role",SystemConstant.ROLE_ID_USER);
        }
        List<Game> gameList = gameService.getGameListByPage("", "CONVERT(name using gbk)", "asc", "0", "0");
        model.addAttribute("gameList",gameList);

        List<GameAccount> accountList = gameAccountService.getGameAccountListByPage("", userId, "", "CONVERT(game_acc_name using gbk)", "asc", "0", "0");
        model.addAttribute("accountList",accountList);
        return "addGameEquip.html";
    }

    @RequestMapping("toEditGameEquip")
    public String toEditGameEquip(Model model, String id){
    
    
        Subject subject = SecurityUtils.getSubject();
        if(subject.hasRole(SystemConstant.ROLE_ID_ADMIN)){
    
    
            Admin admin = (Admin) subject.getPrincipals().getPrimaryPrincipal();
            model.addAttribute("loginName", admin.getAccount());
            model.addAttribute("role",SystemConstant.ROLE_ID_ADMIN);
        }
        if(subject.hasRole(SystemConstant.ROLE_ID_USER)){
    
    
            User user = (User) subject.getPrincipals().getPrimaryPrincipal();
            model.addAttribute("loginName", user.getName());
            model.addAttribute("role",SystemConstant.ROLE_ID_USER);
        }
        GameEquip gameEquip = gameEquipService.selectByPrimaryKey(id);
        model.addAttribute("gameEquip",gameEquip);
        String userId = "";
        if(subject.hasRole(SystemConstant.ROLE_ID_USER)){
    
    
            User user = (User) subject.getPrincipals().getPrimaryPrincipal();
            userId = user.getId();
        }
        List<Game> gameList = gameService.getGameListByPage("", "CONVERT(name using gbk)", "asc", "0", "0");
        model.addAttribute("gameList",gameList);

        List<GameAccount> accountList = gameAccountService.getGameAccountListByPage("", userId, "", "CONVERT(game_acc_name using gbk)", "asc", "0", "0");
        model.addAttribute("accountList",accountList);
        return "editGameEquip.html";
    }

    @ResponseBody
    @RequestMapping("/getGameEquipList")
    public JSONObject getGameEquipList(
            String searchName,
            String orderColum,
            String orderType,
            String page,
            String limit
    ){
    
    
        try{
    
    
            Map<String, String> columnMap = new HashMap<String, String>();
            columnMap.put("name", "CONVERT(name using gbk)");
            columnMap.put("addTime", "add_time");
            orderColum = columnMap.get(orderColum);
            Subject subject = SecurityUtils.getSubject();
            String userId = "";
            if(subject.hasRole(SystemConstant.ROLE_ID_USER)){
    
    
                User user = (User) subject.getPrincipals().getPrimaryPrincipal();
                userId = user.getId();
            }
            List<GameEquip> adminList = gameEquipService.getGameEquipListByPage(searchName, userId, "",  orderColum, orderType, page, limit);
            int count = gameEquipService.getGameEquipCount(searchName, userId, "");
            return CommonUtil.returnSuccessHasCount(count, JSON.toJSON(adminList));
        }catch (Exception e){
    
    
            e.printStackTrace();
            return null;
        }
    }

    @ResponseBody
    @RequestMapping("/delGameEquip")
    public JSONObject delGameEquip(
            String id
    ){
    
    
        GameEquip game = gameEquipService.selectByPrimaryKey(id);
        game.setDeleteFlag(SystemConstant.DELETE_FLAG_1);
        gameEquipService.updateByPrimaryKeySelective(game);
        return CommonUtil.returnSuccess(null);
    }

    @ResponseBody
    @RequestMapping("/addGameEquip")
    public JSONObject addGameEquip(
            String gameId,
            String gameName,
            String gameAccName,
            String gameAccId,
            String price,
            String gamePwd
    ){
    
    
        GameEquip game = new GameEquip();
        Subject subject = SecurityUtils.getSubject();
        if(subject.hasRole(SystemConstant.ROLE_ID_USER)){
    
    
            User user = (User) subject.getPrincipals().getPrimaryPrincipal();
            game.setUserId(user.getId());
            game.setUserName(user.getName());
        }
        game.setGameId(gameId);
        game.setGameName(gameName);
        game.setGameAccName(gameAccName);
        game.setPrice(price);
        game.setGamePwd(gamePwd);
        game.setGameAccId(gameAccId);
        game.setStatus(SystemConstant.GAME_ACCOUNT_STATUS_ADD);
        game.setId(UUID.randomUUID().toString());
        game.setAddTime(new Date());
        game.setDeleteFlag(SystemConstant.DELETE_FLAG_0);
        gameEquipService.insertSelective(game);
        return CommonUtil.returnSuccess(null);
    }

    @ResponseBody
    @RequestMapping("/editGameEquip")
    public JSONObject editGameEquip(
            String id,
            String userId,
            String userName,
            String gameId,
            String gameName,
            String gameAccName,
            String price,
            String gamePwd,
            String status
    ){
    
    
        GameEquip game = new GameEquip();
        game.setId(id);

        if(!StringUtils.isEmpty(userId)){
    
    
            game.setUserId(userId);
        }

        if(!StringUtils.isEmpty(userName)){
    
    
            game.setUserName(userName);
        }
        if(!StringUtils.isEmpty(gameId)){
    
    
            game.setGameId(gameId);
        }
        if(!StringUtils.isEmpty(gameName)){
    
    
            game.setGameName(gameName);
        }

        if(!StringUtils.isEmpty(gameAccName)){
    
    
            game.setGameAccName(gameAccName);
        }

        if(!StringUtils.isEmpty(price)){
    
    
            game.setPrice(price);
        }

        if(!StringUtils.isEmpty(gamePwd)){
    
    
            game.setGamePwd(gamePwd);
        }

        if(!StringUtils.isEmpty(status)){
    
    
            game.setStatus(status);
        }
        gameEquipService.updateByPrimaryKeySelective(game);
        return CommonUtil.returnSuccess(null);
    }
}

游戏装备服务层

public interface GameEquipService {
    
    
    int deleteByPrimaryKey(String id);

    int insert(GameEquip record);

    int insertSelective(GameEquip record);

    GameEquip selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(GameEquip record);

    int updateByPrimaryKey(GameEquip record);

    List<GameEquip> getGameEquipListByPage(String searchName, String userId, String status, String orderColumn, String orderType, String page, String limit);

    int getGameEquipCount(String searchName, String userId, String status);
}

游戏装备数据持久层

public interface GameEquipMapper {
    
    
    int deleteByPrimaryKey(String id);

    int insert(GameEquip record);

    int insertSelective(GameEquip record);

    GameEquip selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(GameEquip record);

    int updateByPrimaryKey(GameEquip record);

    List<GameEquip> getGameEquipListByPage(String searchName, String userId, String status, String orderColumn, String orderType, int page, int limit);

    int getGameEquipCount(String searchName, String userId, String status);
}

四、源码获取

请添加图片描述

点击此处转到源码地址

猜你喜欢

转载自blog.csdn.net/rej177/article/details/124916149