In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to build WeChat Mini Programs's activity management system. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
1. Players enter Mini Program, screen and check the activities suitable for participation, and select the activity to sign up for. The system automatically judges whether the registration is successful or not according to the "reputation value" of the registered users. After the end of the game, the players participating in the game at the same time can be evaluated. The evaluation determines the player's reputation value.
two。 Merchants create game activities to submit for review, after approval, wait for players to sign up, launch the game.
3. The administrator examines the game activities submitted by merchants and manages merchant accounts
Development environment:
Jdk 8
Intellij idea
Tomcat 8.5.40
Mysql 5.7
Wechat developer tools
Technology used in the back end:
Springboot2.1
Quartz
Thymeleaf
Alibaba connection pool
Swagger
Mybatis
Difficult train of thought
Different roles log in to display different menu pages
Customize the bottom navigation bar, display different tabbar for different identities, and display different navigation bars according to the role type set after login.
Activity status is associated with registration status
Add a scheduled task, judge and change the activity state according to the set activity time, query the registration records bound to the activity, and modify the corresponding status
Reputation value screening
Set the initial credit value, modify the credit value according to the evaluation, the number of applicants exceeds the number of participants, screen the players with high credit value to start the game, and the players with low credit value are out automatically.
Project screenshot
Home page
Player-activity list
Player-my event
Players-event details
Player-Evaluation
Player-personal Center
Store owner-create event
Store owner-event Management
Shop owner-personal center
Administrator-activity Audit
Administrator-account Management
Administrator-create a store
Swagger interface
Database configuration spring: datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver druid: url: jdbc:mysql://localhost:3306/board_game?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: root123 template configuration spring: thymeleaf: mode: HTML encoding: utf-8 Core Business Code
Activity module
@ ApiOperation (value = "New activity", response = AjaxResult.class) @ PostMapping ("/ add") public AjaxResult addSave (ActivityAddReq activityReq) {Store store=storeService.selectStoreByUserId (activityReq.getBoosId ()); / / query store id if (store==null) {return AjaxResult.error ("store does not exist");} Activity activity=new Activity (); BeanUtils.copyProperties (activityReq,activity); activity.setStatus (- 1) / / activity pending audit activity.setCityId (store.getCityId ()); / / obtain activity.setAddress (store.getAddress ()) of the city where the store is located; / / obtain the address of the store (activity.setBoosId (activityReq.getBoosId (); return toAjax (activityService.insertActivity (activity)) } @ ApiOperation (value = "audit activity", response = AjaxResult.class) @ PostMapping ("/ audit") public AjaxResult audit (ActivityAuditReq req) {Activity activity=new Activity (); activity.setId (req.getId ()); activity.setStatus (req.getStatus ()); / / set audit status return toAjax (activityService.updateActivity (activity));}
Activity registration module
@ ApiOperation (value = "activity registration", response = AjaxResult.class) @ PostMapping ("/ sign") public AjaxResult sign (SignUpReq signUpReq) {Activity activity= activityService.selectActivityById (signUpReq.getActivityId ()); if (activity==null) {return AjaxResult.error ("activity does not exist") } else if (! activity.getStatus (). Equals (0)) {/ / activity has not started before signing up-there is no need to judge the time, time can control the activity status return AjaxResult.error ("abnormal activity");} SignUp search=new SignUp (); search.setUserId (signUpReq.getUserId ()); search.setActivityId (signUpReq.getActivityId ()); List list=signUpService.selectSignUpList (search) If (list.size () > 0) {return AjaxResult.error ("you have already signed up for this activity, please repeat it");} SignUp signUp=new SignUp (); BeanUtils.copyProperties (signUpReq,signUp); signUp.setAddTime (DateUtils.getTime ()); signUp.setStatus (0); signUpService.insertSignUp (signUp); activity.setsNum (activity.getsNum () + 1); return toAjax (activityService.updateActivity (activity)) } @ ApiOperation (value = "cancel registration", response = AjaxResult.class) @ PostMapping ("/ cancelSign") public AjaxResult cancelSign (SignUpReq signUpReq) {Activity activity= activityService.selectActivityById (signUpReq.getActivityId ()); if (activity==null) {return AjaxResult.error ("activity does not exist");} SignUp search=new SignUp (); search.setUserId (signUpReq.getUserId ()); search.setActivityId (signUpReq.getActivityId ()); List list=signUpService.selectSignUpList (search) If (list.size () = = 0) {return AjaxResult.error ("you have not signed up for this activity and failed to cancel");} SignUp signUp=list.get (0); signUp.setStatus (3); signUpService.updateSignUpByAId (signUp); activity.setsNum (activity.getsNum ()-1); return toAjax (activityService.updateActivity (activity));}
Calculation of user reputation value after the end of the activity
/ / calculate @ ApiOperation (value = "end of the event-player comments", response = ActivityVo.class) @ PostMapping ("/ playComment") public AjaxResult playComment (CommentReq req) {try {GameUser gameUser=gameUserService.selectGameUserById (req.getUserId ()); if (gameUser==null) {return AjaxResult.error ("comment failed, reviewer information does not exist") } gameUser=gameUserService.selectGameUserById (req.getCommentId ()); if (gameUser==null) {return AjaxResult.error ("comment failed, comment information does not exist");} ActivityComment activityComment=new ActivityComment (); activityComment.setUserId (req.getUserId ()); activityComment.setActivityId (req.getActivityId ()); activityComment.setCommentId (req.getCommentId ()); List list=activityCommentService.selectActivityCommentList (activityComment) If (list.size () > 0) {return AjaxResult.error ("comment failed, already commented, please repeat comment");} BeanUtils.copyProperties (req,activityComment); activityComment.setCalculate (1); / / set to no activityCommentService.insertActivityComment (activityComment) / / add comment record / / deduction rule: if a player is given negative comments by > = 1 in a game, points will be deducted, 5 points will be deducted late, 10 points will be deducted for absence, 2 points will be deducted for non-compliance with the rules of the game, and 10 points will be deducted as a whole / / if the number of bad comments is more than 1, the cumulative comment value will be int reputationValue=gameUser.getReputation () / / original credit value / / late deduction 5 points if (req.getBelate () = = 1) {reputationValue=reputationValue-5;} else {reputationValue=reputationValue+5;} / / absence deduction 10 points if (req.getAbsent () = = 1) {reputationValue=reputationValue-10;} else {reputationValue=reputationValue+10 } / / deduct 2 points if (req.getAbsent () = = 1) {reputationValue=reputationValue-2;} else {reputationValue=reputationValue+2;} / / overall impression 1 point if (req.getAbsent () = = 1) {reputationValue=reputationValue-1;} else {reputationValue=reputationValue+1;} gameUser.setReputation (reputationValue) / / finally update the person's reputation value gameUserService.updateGameUser (gameUser); / / update the data return AjaxResult.success ("Evaluation success");} catch (Exception e) {e.printStackTrace (); return AjaxResult.error ("Evaluation failure, system exception");}}
Schedule tasks at the beginning and end of the activity, and filter out users with high reputation to enter the activity.
Public void activityTask () {List list = activityService.getListByNoEnd (); if (list.size () > 0) {for (Activity activity: list) {String startTime = activity.getStartTime (); / / start time String endTime = activity.getEndTime () / / end time if (activity.getStatus () = = 0) {/ / unstarted activities if (DateUtils.isGreater (startTime) & &! DateUtils.isGreater (endTime)) {/ / the number of applicants is greater than the number of participants. Then the activity starts normally if (activity.getsNum () > = activity.getpNum ()) {activity.setStatus (1) / / activityService.updateActivity (activity) has been started; / / players with higher creditworthiness have been screened out: List signUps=signUpService.getSignUpListByAId (activity.getId ()); for (int iTuno)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.