Procházet zdrojové kódy

feat: add game over time

张延森 před 3 roky
rodič
revize
92a6aed0ec

+ 1
- 1
deploy/bootstrap Zobrazit soubor

@@ -2,4 +2,4 @@
2 2
 #
3 3
 #
4 4
 
5
-java -jar ./roundabout-0.0.4.jar
5
+java -jar ./roundabout-0.0.5.jar

+ 1
- 1
deploy/s.yml Zobrazit soubor

@@ -15,7 +15,7 @@ services:
15 15
         name: roundabout-func
16 16
         description: 'Roundabout h5'
17 17
         ossBucket: yz-serverless
18
-        ossKey: honghe/roundabout-0.0.4.zip
18
+        ossKey: honghe/roundabout-0.0.5.zip
19 19
         handler: 'com.yunzhi.roundabout.Application::main'
20 20
         memorySize: 1024
21 21
         timeout: 30

+ 1
- 1
pom.xml Zobrazit soubor

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.yunzhi</groupId>
12 12
 	<artifactId>roundabout</artifactId>
13
-	<version>0.0.4</version>
13
+	<version>0.0.5</version>
14 14
 	<name>roundabout</name>
15 15
 	<description>华侨城-摩天轮</description>
16 16
 	<properties>

+ 13
- 0
src/main/java/com/yunzhi/roundabout/controller/TaPersonController.java Zobrazit soubor

@@ -143,6 +143,13 @@ public class TaPersonController extends BaseController {
143 143
     @RequestMapping(value="/wx/game/start",method= RequestMethod.POST)
144 144
     @ApiOperation(value="游戏开始", notes = "游戏开始", httpMethod = "POST", response = ResponseBean.class)
145 145
     public ResponseBean gameStart(HttpServletRequest request) throws Exception{
146
+        LocalDateTime gameEndTime = iTaPersonService.getGameEndTime();
147
+        if (LocalDateTime.now().isAfter(gameEndTime)) {
148
+            // 游戏继续, 但是不会被计入成绩
149
+            return ResponseBean.success(null);
150
+        }
151
+
152
+
146 153
         TaPerson taPerson = currentPerson(request);
147 154
         long startTime = System.currentTimeMillis();
148 155
 
@@ -157,6 +164,12 @@ public class TaPersonController extends BaseController {
157 164
     @RequestMapping(value="/wx/game/over",method= RequestMethod.POST)
158 165
     @ApiOperation(value="游戏结束", notes = "游戏结束", httpMethod = "POST", response = ResponseBean.class)
159 166
     public ResponseBean gameOver(HttpServletRequest request) throws Exception{
167
+        LocalDateTime gameEndTime = iTaPersonService.getGameEndTime();
168
+        if (LocalDateTime.now().isAfter(gameEndTime)) {
169
+            // 游戏继续, 但是不会被计入成绩
170
+            return ResponseBean.success(null);
171
+        }
172
+
160 173
         TaPerson taPerson = currentPerson(request);
161 174
         Long startTime = Long.parseLong(taPerson.getLastStart());
162 175
         if (startTime == null) {

+ 2
- 0
src/main/java/com/yunzhi/roundabout/mapper/TaPersonMapper.java Zobrazit soubor

@@ -23,4 +23,6 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
23 23
     IPage<TaPerson> getPageBy(IPage<TaPerson> pg, @Param("start") LocalDateTime start, @Param("end")  LocalDateTime end);
24 24
 
25 25
     List<TaPerson> getListBy(@Param("start") LocalDateTime start, @Param("end") LocalDateTime end);
26
+
27
+    String getGameEndTime();
26 28
 }

+ 2
- 0
src/main/java/com/yunzhi/roundabout/service/ITaPersonService.java Zobrazit soubor

@@ -26,4 +26,6 @@ public interface ITaPersonService extends IService<TaPerson> {
26 26
     IPage<TaPerson> getPageBy(IPage<TaPerson> pg, LocalDateTime start, LocalDateTime end);
27 27
 
28 28
     List<TaPerson> getListBy(LocalDateTime start, LocalDateTime end);
29
+
30
+    LocalDateTime getGameEndTime();
29 31
 }

+ 7
- 0
src/main/java/com/yunzhi/roundabout/service/impl/TaPersonServiceImpl.java Zobrazit soubor

@@ -3,6 +3,7 @@ package com.yunzhi.roundabout.service.impl;
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
5 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6
+import com.yunzhi.roundabout.common.DateUtils;
6 7
 import com.yunzhi.roundabout.entity.TaPerson;
7 8
 import com.yunzhi.roundabout.mapper.TaPersonMapper;
8 9
 import com.yunzhi.roundabout.service.ITaPersonService;
@@ -70,4 +71,10 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
70 71
     public List<TaPerson> getListBy(LocalDateTime start, LocalDateTime end) {
71 72
         return baseMapper.getListBy(start, end);
72 73
     }
74
+
75
+    @Override
76
+    public LocalDateTime getGameEndTime() {
77
+        String dtStr = baseMapper.getGameEndTime();
78
+        return DateUtils.from(dtStr + "+0800", "yyyy-MM-dd HH:mm:ssX");
79
+    }
73 80
 }

+ 8
- 0
src/main/resources/mapper/TaPersonMapper.xml Zobrazit soubor

@@ -21,4 +21,12 @@
21 21
     <select id="getListBy" resultType="com.yunzhi.roundabout.entity.TaPerson">
22 22
         <include refid="listSQL"></include>
23 23
     </select>
24
+    <select id="getGameEndTime" resultType="java.lang.String">
25
+        SELECT
26
+            t.param_value
27
+        FROM
28
+            `sys_param_setting` t
29
+        WHERE
30
+            t.param__code = 'game_end_date'
31
+    </select>
24 32
 </mapper>