예제 #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;
 }
예제 #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();
    }
  }