OrderSearch.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. session_start();
  3. include_once("../../untils/conn.php");
  4. mysqli_query($con, "set names utf8");
  5. // 获取当前正在登录的账号信息的代理
  6. $proxy_acc = $_SESSION["account"];
  7. $sql = "SELECT proxy_id FROM proxy WHERE proxy_acc = '$proxy_acc'";
  8. $result = mysqli_query($con, $sql);
  9. if ($result) {
  10. $row = mysqli_fetch_assoc($result);
  11. $proxy_id = $row['proxy_id'];
  12. }
  13. $searchValue = $_POST['searchValue'];
  14. // 判断是否为手机号
  15. if (preg_match('/^1[3456789]\d{9}$/', $searchValue)) {
  16. // 查询订单表中手机号为$searchValue的订单信息
  17. $sql = "SELECT * FROM oder WHERE phone = '$searchValue'";
  18. $result = mysqli_query($con, $sql);
  19. if (mysqli_num_rows($result) > 0) {
  20. $row = mysqli_fetch_assoc($result);
  21. $data = [
  22. 'oderid' => $row['oderid'],
  23. 'phones' => $row['phone'],
  24. 'uid' => $row['uid'],
  25. 'status' => $row['status'],
  26. 'name' => $row['name'],
  27. 'time' => date('Y-m-d H:i:s', $row['time']),
  28. 'tgaccount' => $proxy_acc,
  29. 'goods' => $row['goods'],
  30. 'thirdphone' => $row['thirdphone'],
  31. 'iccid' => $row['iccid'],
  32. 'notes'=> $row['beizhu']
  33. ];
  34. echo json_encode($data);
  35. } else {
  36. // 手机号没有对应的订单
  37. $msg = '没有找到对应的订单';
  38. $response = [
  39. 'status' => 'error',
  40. 'msg' => $msg
  41. ];
  42. echo json_encode($response);
  43. }
  44. }
  45. // 判断是否为身份证号
  46. else if (preg_match('/^\d{17}[\d|x]|\d{15}$/', $searchValue)) {
  47. // 查询订单表中身份证号为$searchValue的订单信息
  48. $sql = "SELECT * FROM oder WHERE uid = '$searchValue'";
  49. $result = mysqli_query($con, $sql);
  50. if (mysqli_num_rows($result) > 0) {
  51. $row = mysqli_fetch_assoc($result);
  52. // $xdtime = $row['time'];
  53. $data = [
  54. 'oderid' => $row['oderid'],
  55. 'phones' => $row['phone'],
  56. 'uid' => $row['uid'],
  57. 'status' => $row['status'],
  58. 'name' => $row['name'],
  59. 'time' => date('Y-m-d H:i:s', $row['time']),
  60. 'tgaccount' => $proxy_acc,
  61. 'goods' => $row['goods'],
  62. 'thirdphone' => $row['thirdphone'],
  63. 'iccid' => $row['iccid'],
  64. 'notes'=> $row['beizhu']
  65. ];
  66. echo json_encode($data);
  67. } else {
  68. // 身份证号没有对应的订单
  69. $msg = '没有找到对应的订单';
  70. $response = [
  71. 'status' => 'error',
  72. 'msg' => $msg
  73. ];
  74. echo json_encode($response);
  75. }
  76. }
  77. // 判断是否为订单号
  78. else if (strpos($searchValue, 'KJKJ') === 0) {
  79. // 查询订单表中订单号为$searchValue的订单信息
  80. $sql = "SELECT * FROM oder WHERE oderid = '$searchValue'";
  81. $result = mysqli_query($con, $sql);
  82. if (mysqli_num_rows($result) > 0) {
  83. $row = mysqli_fetch_assoc($result);
  84. $data = [
  85. 'oderid' => $row['oderid'],
  86. 'phones' => $row['phone'],
  87. 'uid' => $row['uid'],
  88. 'status' => $row['status'],
  89. 'name' => $row['name'],
  90. 'time' => date('Y-m-d H:i:s', $row['time']),
  91. 'tgaccount' => $proxy_acc,
  92. 'goods' => $row['goods'],
  93. 'thirdphone' => $row['thirdphone'],
  94. 'iccid' => $row['iccid'],
  95. 'notes'=> $row['beizhu']
  96. ];
  97. echo json_encode($data);
  98. } else {
  99. // 订单号没有对应的订单
  100. $msg = '没有找到对应的订单';
  101. $response = [
  102. 'status' => 'error',
  103. 'msg' => $msg
  104. ];
  105. echo json_encode($response);
  106. }
  107. }
  108. // 输入的信息有误
  109. else {
  110. $msg = '您输入的信息有误';
  111. $response = [
  112. 'status' => 'error',
  113. 'msg' => $msg
  114. ];
  115. echo json_encode($response);
  116. }