register.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const Parse = require("parse/node");
  2. Parse.serverURL = "http://web2023.fmode.cn:9999/parse"; // 配置服务器地址
  3. Parse.initialize("dev"); // 配置应用名称
  4. async function registerUser(user) {
  5. let query = new Parse.Query("LjUser");
  6. query.descending("stuno");
  7. query.first().then(async result => {
  8. const maxStuno = result.get("stuno");
  9. console.log(maxStuno);
  10. const stuno_new = (parseInt(maxStuno) + 1).toString().padStart(9, "0");
  11. console.log(user.account)
  12. const user1 = new Parse.User();
  13. user1.set("username", "12")
  14. user1.set("account", user.account);
  15. user1.set("name", "雅力士")
  16. user1.set("password", user.password);
  17. user1.set("email", user.email);
  18. user1.set("gender", user.gender);
  19. user1.set("stuno", stuno_new);
  20. user1.set("member", "1");
  21. user1.set("skills", user.skills);
  22. user1.set("isFirstRegister", "1");
  23. user1.set("availableBalance", "2.00");
  24. user1.set("birthday", user.birthday);
  25. user1.set("phoneNumber", "")
  26. try {
  27. await user1.signUp();
  28. // Hooray! Let them use the app now.
  29. } catch (error) {
  30. console.log(error)
  31. }
  32. // UPDATE "Profile" SET "schoolClass"='DGnxrAMgJD';
  33. }).catch(error => {
  34. console.log("请检查网络问题");
  35. });
  36. }
  37. registerUser({
  38. account: "2",
  39. password: "12",
  40. email: "122@qq.com",
  41. skills: "1",
  42. birthday: "1"
  43. });