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



    前言

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


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

    一、背景及意义

    选题背景

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

    选题目的

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

    系统目标

    采用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

    部分页面截图展示

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

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

    部分代码展示

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

    @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);
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200

    游戏装备服务层

    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);
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    游戏装备数据持久层

    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);
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17

    四、源码获取

    请添加图片描述

    点击此处转到源码地址

  • 相关阅读:
    Python 读写 Excel 文件
    MapReduce编程:join操作和聚合操作
    C#:计算机视觉与OpenCV 的目标
    leetcode 698. 划分为k个相等的子集-状态压缩+记忆搜索的一步步实现
    JavaWeb-Filter和Listener
    两种动态代理比较(补充),进程通信方式总结
    Spring Framework 6.0 框架
    LVS-DR模式 +keepalived
    XML 中转义的特殊字符
    基于.Net开发的数据库导入导出的开源项目
  • 原文地址:https://blog.csdn.net/rej177/article/details/124916149