瀏覽代碼

余额控制

xusonglin 5 年之前
父節點
當前提交
fc46a7fc3b

+ 0 - 1
src/main/java/com/jkcredit/invoice/hub/config/AjaxAuthenticationFailureHandler.java

@@ -17,7 +17,6 @@ public class AjaxAuthenticationFailureHandler implements AuthenticationFailureHa
 
     @Override
     public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException {
-        // todo
         /**
          * if (e instanceof UsernameNotFoundException || e instanceof BadCredentialsException) {
          *                 map.put("message","用户名或密码错误");

+ 3 - 2
src/main/java/com/jkcredit/invoice/hub/service/apiUser/ApiUserServiceImpl.java

@@ -37,14 +37,15 @@ public class ApiUserServiceImpl extends BaseService implements ApiUserService {
     public Integer validateUser(ApiRequestParam param) {
         // 无效用户
         UserPo userPo = userService.getUserByAppKey(param.getAppKey());
-
+        // TODO 余额控制需要测试
         if (userPo == null) {
             return ApiResponseCodeEnum.CODE_1000.getValue();
         } else if (!userPo.getAppSecret().equals(param.getAppSecret())) {
             return ApiResponseCodeEnum.CODE_1000.getValue();
         } else if (!ArrayUtils.contains(CommonConstant.CAR_FREE_API_ARGS, param.getApi())) {
             return ApiResponseCodeEnum.CODE_1080.getValue();
-        } else if (CommonUtil.parseDouble(userPo.getBalance()) / CommonUtil.parseDouble(userPo.getPrice()) < CommonUtil.parseDouble(userPo.getPrice())) {
+        } else if (CommonUtil.parseDouble(userPo.getBalance()) / CommonUtil.parseDouble(userPo.getPrice()) < CommonUtil.parseDouble(userPo.getPrice())
+                && (param.getApi().equals(CommonConstant.WAY_BILL_START) || param.getApi().equals(CommonConstant.WAY_BILL_HISTORY_START))) {
             return ApiResponseCodeEnum.CODE_1090.getValue();
         } else {
             JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(param.getData()));