he2802 3 жил өмнө
parent
commit
8bcd7030ec

+ 3 - 3
zhongzheng-api/src/main/java/com/zhongzheng/controller/wx/WxLoginController.java

@@ -81,10 +81,10 @@ public class WxLoginController
     }
 
     @ApiOperation("刷新令牌")
-    @GetMapping("/refreshToken/{unionId}")
-    public AjaxResult refreshToken(@PathVariable("unionId") String unionId)
+    @GetMapping("/refreshToken/{userAccount}")
+    public AjaxResult refreshToken(@PathVariable("userAccount") String userAccount)
     {
-        String token = wxLoginService.refreshToken(unionId);
+        String token = wxLoginService.refreshToken(userAccount);
         Map<String,Object> map = new HashMap<>();
         map.put(Constants.TOKEN, token);
         return AjaxResult.success(map);

+ 3 - 3
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java

@@ -113,10 +113,10 @@ public class WxLoginService
         return map;
     }
 
-    public String refreshToken(String unionId) {
-        User user = iUserService.queryByUnionId(unionId);
+    public String refreshToken(String userAccount) {
+        User user = iUserService.queryByAccount(userAccount);
         if(user==null){
-            throw new CustomException("unionId不存在");
+            throw new CustomException("userAccount不存在");
         }
         user.setLastLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
         user.setLastLoginTime(DateUtils.getNowTime());

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.goods.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
@@ -279,6 +280,12 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
      */
     private void validEntityBeforeSave(Goods entity){
         //TODO 做一些数据校验,如唯一约束
+        if(entity.getStatus()==0&&entity.getGoodsStatus()==1){
+            throw new CustomException("无效商品不允许上架");
+        }
+        if((entity.getValidityEndTime()<DateUtils.getNowTime())&&entity.getGoodsStatus()==1){
+            throw new CustomException("过期商品不允许上架");
+        }
     }
 
     @Override