张延森 4 years ago
parent
commit
e7668f2952

+ 7
- 3
src/main/java/com/yunzhi/demo/common/JWTUtils.java View File

23
 @Slf4j
23
 @Slf4j
24
 public class JWTUtils {
24
 public class JWTUtils {
25
 
25
 
26
-    // 过期时间 5 分钟
27
-    public static final long EXPIRE_TIME = 5 * 60;
26
+    // 过期时间 10 分钟
27
+    public static final long EXPIRE_TIME = 10 * 60;
28
 
28
 
29
     // 私钥
29
     // 私钥
30
     static final SecretKey SECRET_KEY = Keys.hmacShaKeyFor(Base64.getEncoder().encode("Yansen is so handsome. He is a good man. Everyone like him !!!".getBytes()));
30
     static final SecretKey SECRET_KEY = Keys.hmacShaKeyFor(Base64.getEncoder().encode("Yansen is so handsome. He is a good man. Everyone like him !!!".getBytes()));
43
         Date exp = datePair[1];
43
         Date exp = datePair[1];
44
 
44
 
45
         if (null != claims.get("exp")) {
45
         if (null != claims.get("exp")) {
46
-            exp = (Date) claims.get("exp");
46
+            Integer milliSecond = (Integer) claims.get("exp");
47
+            int oneMinute = 1 * 60 * 1000;
48
+            if (milliSecond - exp.getTime() > oneMinute) {
49
+                exp.setTime(milliSecond);
50
+            }
47
         }
51
         }
48
 
52
 
49
         return Jwts.builder().setIssuer(claims.get("userId").toString()).setIssuedAt(iat).setExpiration(exp).addClaims(claims).signWith(SECRET_KEY).compact();
53
         return Jwts.builder().setIssuer(claims.get("userId").toString()).setIssuedAt(iat).setExpiration(exp).addClaims(claims).signWith(SECRET_KEY).compact();

+ 11
- 0
src/main/java/com/yunzhi/demo/common/MathUtils.java View File

1
+package com.yunzhi.demo.common;
2
+
3
+import java.util.Random;
4
+
5
+public class MathUtils {
6
+
7
+    public static Integer getRand(int min, int max) {
8
+        Random random = new Random();
9
+        return random.nextInt(max) % (max - min + 1) + min;
10
+    }
11
+}

+ 16
- 1
src/main/java/com/yunzhi/demo/common/ResponseBean.java View File

1
 package com.yunzhi.demo.common;
1
 package com.yunzhi.demo.common;
2
 
2
 
3
 import java.io.Serializable;
3
 import java.io.Serializable;
4
+import java.util.Map;
4
 
5
 
5
 /**
6
 /**
6
  * 接口统一状态返回BEAN.
7
  * 接口统一状态返回BEAN.
19
     private int code;
20
     private int code;
20
     private String message;
21
     private String message;
21
     private T data;
22
     private T data;
23
+    private String token;
22
 
24
 
23
-    public ResponseBean() {
25
+    /**
26
+     * 禁止外部 new
27
+     */
28
+    private ResponseBean() {
24
         code = ResponseBean.CODE_SUCCESS;
29
         code = ResponseBean.CODE_SUCCESS;
25
     }
30
     }
26
 
31
 
28
         ResponseBean responseBean = new ResponseBean();
33
         ResponseBean responseBean = new ResponseBean();
29
         responseBean.code = ResponseBean.CODE_SUCCESS;
34
         responseBean.code = ResponseBean.CODE_SUCCESS;
30
         responseBean.data = data;
35
         responseBean.data = data;
36
+        responseBean.token = getContextToken();
31
 
37
 
32
         if (null != msgs && msgs.length > 0) {
38
         if (null != msgs && msgs.length > 0) {
33
             responseBean.message = msgs[0];
39
             responseBean.message = msgs[0];
36
         return responseBean;
42
         return responseBean;
37
     }
43
     }
38
 
44
 
45
+    private static String getContextToken() {
46
+        Map<String, Object> tokenParam = CurrentContext.getTokenParam();
47
+        return null != tokenParam ? (String) tokenParam.get("token") : null;
48
+    }
49
+
39
     public static <T> ResponseBean error(String msg, int code, T ...datas) {
50
     public static <T> ResponseBean error(String msg, int code, T ...datas) {
40
         ResponseBean responseBean = new ResponseBean();
51
         ResponseBean responseBean = new ResponseBean();
41
         responseBean.code = code;
52
         responseBean.code = code;
59
     public T getData() {
70
     public T getData() {
60
         return data;
71
         return data;
61
     }
72
     }
73
+
74
+    public String getToken() {
75
+        return token;
76
+    }
62
     
77
     
63
     @Override
78
     @Override
64
     public String toString() {
79
     public String toString() {

+ 7
- 6
src/main/java/com/yunzhi/demo/controller/SysConfigController.java View File

12
 import org.slf4j.Logger;
12
 import org.slf4j.Logger;
13
 import org.slf4j.LoggerFactory;
13
 import org.slf4j.LoggerFactory;
14
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.beans.factory.annotation.Autowired;
15
-import org.springframework.web.bind.annotation.PathVariable;
16
-import org.springframework.web.bind.annotation.RequestBody;
17
-import org.springframework.web.bind.annotation.RequestMapping;
18
-import org.springframework.web.bind.annotation.RequestMethod;
19
-import org.springframework.web.bind.annotation.RequestParam;
15
+import org.springframework.web.bind.annotation.*;
20
 import com.yunzhi.demo.service.ISysConfigService;
16
 import com.yunzhi.demo.service.ISysConfigService;
21
 import com.yunzhi.demo.entity.SysConfig;
17
 import com.yunzhi.demo.entity.SysConfig;
22
-import org.springframework.web.bind.annotation.RestController;
23
 
18
 
24
 /**
19
 /**
25
  * <p>
20
  * <p>
92
             return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
87
             return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
93
         }
88
         }
94
     }
89
     }
90
+
91
+    @GetMapping("/admin/sys-config/value")
92
+    public ResponseBean getValueByCode(@RequestParam String code) throws Exception {
93
+        String val = iSysConfigService.getValByCode(code);
94
+        return ResponseBean.success(val);
95
+    }
95
 }
96
 }

+ 17
- 13
src/main/java/com/yunzhi/demo/controller/TaPostController.java View File

3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
-import com.yunzhi.demo.common.BaseController;
7
-import com.yunzhi.demo.common.Constants;
8
-import com.yunzhi.demo.common.ResponseBean;
9
-import com.yunzhi.demo.common.StringUtils;
6
+import com.yunzhi.demo.common.*;
10
 import com.yunzhi.demo.entity.*;
7
 import com.yunzhi.demo.entity.*;
11
 import com.yunzhi.demo.service.*;
8
 import com.yunzhi.demo.service.*;
12
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.Api;
13
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiOperation;
14
 import io.swagger.annotations.ApiParam;
11
 import io.swagger.annotations.ApiParam;
12
+import io.swagger.models.auth.In;
15
 import org.slf4j.Logger;
13
 import org.slf4j.Logger;
16
 import org.slf4j.LoggerFactory;
14
 import org.slf4j.LoggerFactory;
17
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.beans.factory.annotation.Autowired;
181
         // 分享信息
179
         // 分享信息
182
         TaShareSetting taShareSetting = iTaShareSettingService.getSettingBy(Constants.RESOURCE_TYPE_POST, id);
180
         TaShareSetting taShareSetting = iTaShareSettingService.getSettingBy(Constants.RESOURCE_TYPE_POST, id);
183
         if (!"admin".equals(client)) {
181
         if (!"admin".equals(client)) {
184
-            if (Constants.STATUS_NORMAL.equals(taShareSetting.getStatus())) {
182
+            if (null != taShareSetting && Constants.STATUS_NORMAL.equals(taShareSetting.getStatus())) {
185
                 taPost.setShareSetting(taShareSetting);
183
                 taPost.setShareSetting(taShareSetting);
186
             }
184
             }
187
         } else {
185
         } else {
189
         }
187
         }
190
 
188
 
191
         // 获取试题
189
         // 获取试题
192
-        List<TaPostTest> postTestList = new ArrayList<>();
193
-        if ("admin".equals(client)) {
194
-            postTestList = iTaPostTestService.getListByPostId(id);
195
-        } else {
190
+        List<TaPostTest> postTestList = iTaPostTestService.getListByPostId(id);
191
+        taPost.setPostTestList(postTestList);
192
+
193
+        // 小程序端
194
+        if (!"admin".equals(client)) {
196
             // 当前人员是否收藏过
195
             // 当前人员是否收藏过
197
             TaPerson taPerson = getCurrentPerson();
196
             TaPerson taPerson = getCurrentPerson();
198
             boolean saved = iTaPostSaveService.checkSaved(taPerson.getPersonId(), id);
197
             boolean saved = iTaPostSaveService.checkSaved(taPerson.getPersonId(), id);
201
             // 埋点数据
200
             // 埋点数据
202
             iTaPostDataService.recordBy(id, taPerson);
201
             iTaPostDataService.recordBy(id, taPerson);
203
 
202
 
203
+            iTaPostTestService.getListByPostId(id);
204
+
204
             // 随机取题目
205
             // 随机取题目
205
-            if (null != taPost.getAnswerNum() && taPost.getAnswerNum() > 0) {
206
+            List<TaPostTest> testList = new ArrayList<>();
207
+            if (null != taPost.getAnswerNum() && postTestList.size() >= taPost.getAnswerNum()) {
206
                 for (int i = 0; i < taPost.getAnswerNum(); i++) {
208
                 for (int i = 0; i < taPost.getAnswerNum(); i++) {
207
-                    TaPostTest taPostTest = iTaPostTestService.getRandRowBy(id);
209
+                    int rand = MathUtils.getRand(0, postTestList.size());
210
+                    TaPostTest taPostTest = postTestList.get(rand);
211
+                    postTestList.remove(rand);
208
                     taPostTest.setCorrectAnswers(null);
212
                     taPostTest.setCorrectAnswers(null);
209
-                    postTestList.add(taPostTest);
213
+                    testList.add(taPostTest);
210
                 }
214
                 }
211
             }
215
             }
216
+            taPost.setPostTestList(testList);
212
         }
217
         }
213
-        taPost.setPostTestList(postTestList);
214
 
218
 
215
         return ResponseBean.success(taPost);
219
         return ResponseBean.success(taPost);
216
     }
220
     }

+ 3
- 1
src/main/java/com/yunzhi/demo/controller/TaPostTestController.java View File

1
 package com.yunzhi.demo.controller;
1
 package com.yunzhi.demo.controller;
2
 
2
 
3
+import com.alibaba.fastjson.JSONObject;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
48
     ITaPointsLogService iTaPointsLogService;
49
     ITaPointsLogService iTaPointsLogService;
49
 
50
 
50
     @PostMapping("/ma/answer-test")
51
     @PostMapping("/ma/answer-test")
51
-    public ResponseBean answerPostTest(@ApiParam("答题内容") @RequestBody List<TaPostTest> postTestList) throws Exception {
52
+    public ResponseBean answerPostTest(@ApiParam("答题内容") @RequestBody String paramStr) throws Exception {
53
+        List<TaPostTest> postTestList = JSONObject.parseArray(paramStr, TaPostTest.class);
52
         if (null == postTestList || postTestList.size() == 0) {
54
         if (null == postTestList || postTestList.size() == 0) {
53
             throw new Exception("未发现答题内容");
55
             throw new Exception("未发现答题内容");
54
         }
56
         }

+ 13
- 7
src/main/java/com/yunzhi/demo/controller/TaTestLogController.java View File

4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.yunzhi.demo.common.BaseController;
6
 import com.yunzhi.demo.common.BaseController;
7
+import com.yunzhi.demo.common.Constants;
7
 import com.yunzhi.demo.common.ResponseBean;
8
 import com.yunzhi.demo.common.ResponseBean;
9
+import com.yunzhi.demo.entity.TaPerson;
8
 import io.swagger.annotations.Api;
10
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.ApiOperation;
11
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiParam;
12
 import io.swagger.annotations.ApiParam;
46
      * @param pageSize
48
      * @param pageSize
47
      * @return
49
      * @return
48
      */
50
      */
49
-    @RequestMapping(value="/taTestLog",method= RequestMethod.GET)
51
+    @RequestMapping(value="/ma/test-log",method= RequestMethod.GET)
50
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
52
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
     public ResponseBean taTestLogList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
53
     public ResponseBean taTestLogList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
54
+                                      @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
55
+        TaPerson taPerson = getCurrentPerson();
53
 
56
 
54
-		    IPage<TaTestLog> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaTestLog> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
57
+        IPage<TaTestLog> pg = new Page<>(pageNum, pageSize);
58
+        QueryWrapper<TaTestLog> queryWrapper = new QueryWrapper<>();
59
+        queryWrapper.eq("person_id", taPerson.getPersonId());
60
+        queryWrapper.eq("status", Constants.STATUS_NORMAL);
61
+        queryWrapper.orderByDesc("create_date");
57
 
62
 
58
-            IPage<TaTestLog> result = iTaTestLogService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
63
+        IPage<TaTestLog> result = iTaTestLogService.page(pg, queryWrapper);
64
+        return ResponseBean.success(result);
60
     }
65
     }
61
 
66
 
62
     /**
67
     /**
72
 
77
 
73
         IPage<TaTestLog> pg = new Page<>(pageNum, pageSize);
78
         IPage<TaTestLog> pg = new Page<>(pageNum, pageSize);
74
         QueryWrapper<TaTestLog> queryWrapper = new QueryWrapper<>();
79
         QueryWrapper<TaTestLog> queryWrapper = new QueryWrapper<>();
80
+        queryWrapper.gt("status", Constants.STATUS_DELETED);
75
         queryWrapper.orderByDesc("create_date");
81
         queryWrapper.orderByDesc("create_date");
76
 
82
 
77
         IPage<TaTestLog> result = iTaTestLogService.page(pg, queryWrapper);
83
         IPage<TaTestLog> result = iTaTestLogService.page(pg, queryWrapper);

+ 2
- 2
src/main/java/com/yunzhi/demo/controller/WxMaController.java View File

79
 
79
 
80
         taPerson.setAvatar(userInfo.getAvatarUrl());
80
         taPerson.setAvatar(userInfo.getAvatarUrl());
81
         taPerson.setNickName(userInfo.getNickName());
81
         taPerson.setNickName(userInfo.getNickName());
82
-        taPerson.setSex("1".equals(userInfo.getGender()) ? 1 : 2);
82
+        taPerson.setSex(Integer.parseInt(userInfo.getGender()));
83
 
83
 
84
         iTaPersonService.updateById(taPerson);
84
         iTaPersonService.updateById(taPerson);
85
 
85
 
89
     @ApiOperation(value="授权手机", notes = "授权手机", httpMethod = "PUT", response = TaPerson.class)
89
     @ApiOperation(value="授权手机", notes = "授权手机", httpMethod = "PUT", response = TaPerson.class)
90
     @PutMapping("/auth-phone")
90
     @PutMapping("/auth-phone")
91
     public ResponseBean updateUserPhone(@ApiParam("授权手机的参数") @RequestBody WxMaAuthParam params) throws Exception {
91
     public ResponseBean updateUserPhone(@ApiParam("授权手机的参数") @RequestBody WxMaAuthParam params) throws Exception {
92
-        checkAuthParams(params);
92
+//        checkAuthParams(params);
93
 
93
 
94
         // 解密
94
         // 解密
95
         WxMaPhoneNumberInfo phoneNoInfo = wxUtils.getService().getUserService().getPhoneNoInfo(params.getSessionKey(), params.getEncryptedData(), params.getIv());
95
         WxMaPhoneNumberInfo phoneNoInfo = wxUtils.getService().getUserService().getPhoneNoInfo(params.getSessionKey(), params.getEncryptedData(), params.getIv());

+ 5
- 7
src/main/java/com/yunzhi/demo/interceptor/PermissionInterceptor.java View File

37
 
37
 
38
         try {
38
         try {
39
             Map<String, Object> tokenMap = JWTUtils.decode(jws);
39
             Map<String, Object> tokenMap = JWTUtils.decode(jws);
40
+
41
+            // 基于原始 token 构造新的 token
42
+            String newToken = JWTUtils.refresh(jws);
43
+            tokenMap.put("token", newToken);
44
+
40
             CurrentContext.setTokenParam(tokenMap);
45
             CurrentContext.setTokenParam(tokenMap);
41
         } catch (Exception e) {
46
         } catch (Exception e) {
42
             log.error("鉴权失败: {}", e.getMessage());
47
             log.error("鉴权失败: {}", e.getMessage());
47
         return true;
52
         return true;
48
     }
53
     }
49
 
54
 
50
-    @Override
51
-    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object obj, ModelAndView mv) throws Exception {
52
-        // 刷新 TOKEN
53
-        String jws = JWTUtils.getToken(request);
54
-        JWTUtils.refresh(jws, response);
55
-    }
56
-
57
     private void responseTokenError(HttpServletResponse response, String error) throws IOException {
55
     private void responseTokenError(HttpServletResponse response, String error) throws IOException {
58
         response.addHeader("Content-type", "application/json");
56
         response.addHeader("Content-type", "application/json");
59
         response.getOutputStream().write(
57
         response.getOutputStream().write(

+ 1
- 0
src/main/java/com/yunzhi/demo/mapper/SysConfigMapper.java View File

15
 @Mapper
15
 @Mapper
16
 public interface SysConfigMapper extends BaseMapper<SysConfig> {
16
 public interface SysConfigMapper extends BaseMapper<SysConfig> {
17
 
17
 
18
+    String getValueOf(String paramCode);
18
 }
19
 }

+ 1
- 0
src/main/java/com/yunzhi/demo/service/ISysConfigService.java View File

13
  */
13
  */
14
 public interface ISysConfigService extends IService<SysConfig> {
14
 public interface ISysConfigService extends IService<SysConfig> {
15
 
15
 
16
+    String getValByCode(String code);
16
 }
17
 }

+ 8
- 0
src/main/java/com/yunzhi/demo/service/impl/SysConfigServiceImpl.java View File

4
 import com.yunzhi.demo.mapper.SysConfigMapper;
4
 import com.yunzhi.demo.mapper.SysConfigMapper;
5
 import com.yunzhi.demo.service.ISysConfigService;
5
 import com.yunzhi.demo.service.ISysConfigService;
6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
8
 import org.springframework.stereotype.Service;
8
 
9
 
9
 /**
10
 /**
17
 @Service
18
 @Service
18
 public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {
19
 public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService {
19
 
20
 
21
+    @Autowired
22
+    SysConfigMapper sysConfigMapper;
23
+
24
+    @Override
25
+    public String getValByCode(String code) {
26
+        return sysConfigMapper.getValueOf(code);
27
+    }
20
 }
28
 }

+ 8
- 4
src/main/java/com/yunzhi/demo/service/impl/TaPointsLogServiceImpl.java View File

3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.yunzhi.demo.common.Constants;
4
 import com.yunzhi.demo.common.Constants;
5
 import com.yunzhi.demo.common.StringUtils;
5
 import com.yunzhi.demo.common.StringUtils;
6
+import com.yunzhi.demo.entity.SysConfig;
6
 import com.yunzhi.demo.entity.TaPerson;
7
 import com.yunzhi.demo.entity.TaPerson;
7
 import com.yunzhi.demo.entity.TaPointsLog;
8
 import com.yunzhi.demo.entity.TaPointsLog;
8
 import com.yunzhi.demo.entity.TaPost;
9
 import com.yunzhi.demo.entity.TaPost;
10
+import com.yunzhi.demo.mapper.SysConfigMapper;
9
 import com.yunzhi.demo.mapper.TaPersonDataMapper;
11
 import com.yunzhi.demo.mapper.TaPersonDataMapper;
10
 import com.yunzhi.demo.mapper.TaPointsLogMapper;
12
 import com.yunzhi.demo.mapper.TaPointsLogMapper;
11
 import com.yunzhi.demo.service.ITaPointsLogService;
13
 import com.yunzhi.demo.service.ITaPointsLogService;
30
     @Autowired
32
     @Autowired
31
     TaPersonDataMapper taPersonDataMapper;
33
     TaPersonDataMapper taPersonDataMapper;
32
 
34
 
35
+    @Autowired
36
+    SysConfigMapper sysConfigMapper;
37
+
33
     @Async
38
     @Async
34
     @Override
39
     @Override
35
     public void sendPoints(TaPost taPost, TaPerson taPerson) {
40
     public void sendPoints(TaPost taPost, TaPerson taPerson) {
50
         }
55
         }
51
 
56
 
52
         // 查询积分-学分转换规则
57
         // 查询积分-学分转换规则
53
-        // TODO 此处需要查询系统参数
54
-        String ratio = "1";
58
+        String ratio = sysConfigMapper.getValueOf(Constants.SYS_PARAM_POINT_CREDIT_RATIO);
55
         String creditNum = points.toString();
59
         String creditNum = points.toString();
56
 
60
 
57
         taPointsLog = new TaPointsLog();
61
         taPointsLog = new TaPointsLog();
80
         }
84
         }
81
     }
85
     }
82
 
86
 
83
-    private TaPointsLog getByPersonPost(String personId, String postId) {
87
+    private TaPointsLog getByPersonPost(String personId, String targetId) {
84
         QueryWrapper<TaPointsLog> queryWrapper = new QueryWrapper<TaPointsLog>()
88
         QueryWrapper<TaPointsLog> queryWrapper = new QueryWrapper<TaPointsLog>()
85
                 .eq("person_id", personId)
89
                 .eq("person_id", personId)
86
-                .eq("post_id", postId)
90
+                .eq("target_id", targetId)
87
                 .eq("status", Constants.STATUS_NORMAL);
91
                 .eq("status", Constants.STATUS_NORMAL);
88
 
92
 
89
         return getOne(queryWrapper);
93
         return getOne(queryWrapper);

+ 8
- 0
src/main/resources/mapper/SysConfigMapper.xml View File

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.yunzhi.demo.mapper.SysConfigMapper">
3
 <mapper namespace="com.yunzhi.demo.mapper.SysConfigMapper">
4
 
4
 
5
+    <select id="getValueOf" resultType="java.lang.String">
6
+        SELECT
7
+            t.`value`
8
+        FROM
9
+            `sys_config` t
10
+        WHERE
11
+            t.`code` = #{paramCode}
12
+    </select>
5
 </mapper>
13
 </mapper>