Exemple #1
0
  @Override
  protected void service(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    // 封装
    TUser sessionUser = WebUtil.getUserFromSession(request);
    IUserService userService = new UserServiceImpl();

    /** 获取用户钱包 */
    TUser user = userService.getUserById(sessionUser);

    ResponseEntity.println(response, new UserPurse(String.valueOf(user.getUserPurse())));
  }
  @Override
  protected void service(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    // 封装
    TUserBank userBank = (TUserBank) BeanUtil.populate(request, TUserBank.class);
    TUser sessionUser = (TUser) WebUtil.getUserFromSession(request);
    IUserService userService = new UserServiceImpl();

    userBank.setUserId(sessionUser.getUserId());

    // 保存绑定的银行卡
    int bankId = userService.saveUserBank(userBank);
    ResponseEntity.println(response, new BankEntity(bankId));
  }