API调用次数加上根据userID查
This commit is contained in:
+11
-5
@@ -134,13 +134,22 @@ public class UsersController {
|
|||||||
return json.toString();
|
return json.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object surplusCallCountAction() throws IllegalAccessException {
|
public Object surplusCallCountAction(ApiUserModel model) throws IllegalAccessException {
|
||||||
RestfulModelAndView mav = new RestfulModelAndView();
|
RestfulModelAndView mav = new RestfulModelAndView();
|
||||||
ActionContext context = ActionContext.getContext();
|
ActionContext context = ActionContext.getContext();
|
||||||
HttpServletRequest request = context.getRequest();
|
HttpServletRequest request = context.getRequest();
|
||||||
AuthenticationBean instance = (AuthenticationBean) request.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN);
|
AuthenticationBean instance = (AuthenticationBean) request.getAttribute(AuthenticationBean.ATTR_AUTHENTICATION_BEAN);
|
||||||
|
User user = null;
|
||||||
|
if (model.getUserId() != null && model.getUserId() > 0) {
|
||||||
|
user = userService.findById(model.getUserId());
|
||||||
|
}
|
||||||
if (null != instance) {
|
if (null != instance) {
|
||||||
User user = instance.user;
|
user = instance.user;
|
||||||
|
}
|
||||||
|
if (null == instance && user == null) {
|
||||||
|
mav.setModel(new BasicModel(HttpStatusCodeEnum.BAD_REQUEST_ERROR_KEY));
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
List<OpenResource> openResourceList = openResourceService.findAll();
|
List<OpenResource> openResourceList = openResourceService.findAll();
|
||||||
List<ApiMonitorInfo> list = new ArrayList<ApiMonitorInfo>();
|
List<ApiMonitorInfo> list = new ArrayList<ApiMonitorInfo>();
|
||||||
long id = user.getId();
|
long id = user.getId();
|
||||||
@@ -180,9 +189,6 @@ public class UsersController {
|
|||||||
BasicModel basicModel = new BasicModel(200, "ok");
|
BasicModel basicModel = new BasicModel(200, "ok");
|
||||||
basicModel.setResult(list);
|
basicModel.setResult(list);
|
||||||
mav.setModel(basicModel);
|
mav.setModel(basicModel);
|
||||||
} else {
|
|
||||||
mav.setModel(new BasicModel(HttpStatusCodeEnum.BAD_REQUEST_ERROR_KEY));
|
|
||||||
}
|
|
||||||
return mav;
|
return mav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user