Example #1
0
 public void updateUser() {
   init();
   String uid = request.getParameter("uid");
   String nicheng = request.getParameter("nicheng");
   String phone = request.getParameter("phone");
   String qqString = request.getParameter("qq");
   String zhifubao = request.getParameter("zhifubao");
   long id = Long.parseLong(uid);
   User user = uDao.getOneUser(id);
   user.setNicheng(nicheng);
   user.setPhone(phone);
   user.setQq(qqString);
   user.setZhifubao(zhifubao);
   boolean b = uDao.updateUser(user);
   if (b) {
     json.put("isok", true);
   } else {
     json.put("isok", false);
   }
   write();
   user = null;
 }
Example #2
0
  public void addUserP() {

    usermoney = new Usermoney();
    User user2 = null;
    init();
    if (!isPasswordOk(request.getParameter("password"))) {
      return;
    }
    imie = request.getParameter("mac");
    String phone = request.getParameter("phone");
    String initPoint = request.getParameter("point");
    String xh = request.getParameter("xh");
    long shangjia1 = getLongData("shangjia1");
    long shangjia2 = getLongData("shangjia2");
    long shangjia3 = getLongData("shangjia3");
    long shangjia4 = getLongData("shangjia4");
    long shangjia5 = getLongData("shangjia5");
    long point = 0;
    if (initPoint != null) {
      point = Long.parseLong(initPoint);
    }
    if (phone == null || "".equals(phone)) {
      phone = "无";
    }
    if (StringUtils.IsNull(imie)) {
      return;
    } else {
      user2 = uDao.isExit(imie);
      if (user2 == null) {
        user = new User();
        user.setPhone(phone);
        user.setMac(imie);
        user.setTime(new Timestamp(System.currentTimeMillis()));
        user.setXinghao(xh);
        if (imie.length() >= 7) {
          user.setNicheng("蝌蚪" + imie.substring(2, 7));
        } else {
          user.setNicheng("蝌蚪" + imie);
        }
        if (shangjia1 > 0) {
          tServer.updateTGUrlSize(shangjia1);
          user.setShangjia1(shangjia1);
          addHongBao(user.getShangjia1(), user.getNicheng());
          uDao.updateUserTgSize(shangjia1);
        }
        if (shangjia2 > 0) {
          user.setShangjia2(shangjia2);
          uDao.updateUserTgSize(shangjia2);
        }
        if (shangjia3 > 0) {
          user.setShangjia3(shangjia3);
          uDao.updateUserTgSize(shangjia3);
        }
        if (shangjia4 > 0) {
          user.setShangjia4(shangjia4);
          uDao.updateUserTgSize(shangjia4);
        }
        if (shangjia5 > 0) {
          user.setShangjia5(shangjia5);
          uDao.updateUserTgSize(shangjia5);
        }
        user.setIsok(1);
        user.setTj(0l);
        user2 = uDao.addUser(user);
        usermoney.setAllmoney(0l);
        usermoney.setAlljifeng(point);
        addMoney(user2, point);
        if (user2 != null) {
          addFirstRegestHongBao(user2.getId());
        }
      }
      if (user2 == null) {
        json.put("isok", false);
      } else {
        if (!userMoneyDao.isExit(user2.getId())) {
          addMoney(user2, point);
        }
        usermoney = userMoneyDao.getUsermoney(user2.getId());
        json.put("isok", true);
        json.put("user", changeBean(user2, usermoney));
      }
      write();
    }
  }
Example #3
0
  private UserBean changeBean(User user, Usermoney usermoney) {
    UserBean user2 = new UserBean();
    user2.setId(user.getId());
    user2.setIsok(user.getIsok());
    user2.setMac(user.getMac());
    user2.setName(user.getNicheng());
    user2.setTg(user.getTj());
    user2.setXinshou(user.getXinshou());
    user2.setQq(user.getQq());
    user2.setPhone(user.getPhone());
    user2.setZhifubao(user.getZhifubao());
    double tgMoney = usermoney.getTjmoney() / 1000.00;
    String TG = new String(tgMoney + "");
    TG = TG.substring(0, TG.indexOf(".") + 2);
    user2.setTGMoney(TG);
    if (user.getShangjia1() != null) {
      user2.setShangjia1(user.getShangjia1());
    }
    if (user.getShangjia2() != null) {
      user2.setShangjia2(user.getShangjia2());
    }
    if (user.getShangjia3() != null) {
      user2.setShangjia3(user.getShangjia3());
    }
    if (user.getShangjia4() != null) {
      user2.setShangjia4(user.getShangjia4());
    }
    if (user.getShangjia5() != null) {
      user2.setShangjia5(user.getShangjia5());
    }
    if (usermoney != null) {
      user2.setAllMoney(usermoney.getAllmoney());
      user2.setKedoubi(usermoney.getAlljifeng());
    }
    user2.setChoujiang(user.getChoujiang());

    return user2;
  }