user.php 939 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. ini_set("display_errors", "On");
  3. error_reporting(E_ALL | E_STRICT);
  4. require "autoload.php";
  5. $name = $_REQUEST['account'];
  6. $pas = $_REQUEST['paw'];
  7. $type = !empty($_REQUEST['type']) ? $_REQUEST['type'] : ZERO; // 1 注册 2 登录
  8. log_message::info(1);
  9. $ChatModel = new ChatModel($type);
  10. log_message::info(2);
  11. log_message::info(json_encode($_REQUEST, JSON_UNESCAPED_UNICODE));
  12. log_message::info($name . "--" . $pas);
  13. if (isBlank($name) || isBlank($pas)) {
  14. $rs = [
  15. 'msg' => '用户名密码不能为空',
  16. ];
  17. echo json_encode($rs, JSON_UNESCAPED_UNICODE);
  18. }
  19. if (!isBlank($name) && !isBlank($pas)) {
  20. log_message::info(3);
  21. $data = $ChatModel->userVerif();
  22. $data = is_string($data) ? json_decode($data, true) : $data;
  23. $rs = [
  24. 'msg' => '用户名密码ok',
  25. 'data' => $data
  26. ];
  27. log_message::info(4);
  28. echo json_encode($data, JSON_UNESCAPED_UNICODE);
  29. // 校验用户名
  30. }