PostOder.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. require('SendSms.php');
  3. session_start();
  4. include_once("../../untils/conn.php");
  5. mysqli_query($con, "set names utf8");
  6. // 获取当前正在登录的账号信息的代理
  7. $proxy_acc = $_SESSION["account"];
  8. // 查询代理的proxy_upid
  9. $sql = "SELECT proxy_upid FROM proxy WHERE proxy_acc = '$proxy_acc'";
  10. $result = mysqli_query($con, $sql);
  11. $row = mysqli_fetch_assoc($result);
  12. $proxy_upids = $row['proxy_upid'];
  13. // 查询代理的proxy_acc
  14. $sql = "SELECT proxy_acc FROM proxy WHERE proxy_id = '$proxy_upids'";
  15. $result = mysqli_query($con, $sql);
  16. $row = mysqli_fetch_assoc($result);
  17. $proxy_accs = $row['proxy_acc'];
  18. // 存储为变量
  19. $proxy_upid = $proxy_accs;
  20. // echo $proxy_upid;
  21. $goods = $_POST['goods'];
  22. $name = $_POST['name'];
  23. $uid = $_POST['uid'];
  24. $phone = $_POST['phone'];
  25. $sf = $_POST['sf'];
  26. $city = $_POST['city'];
  27. $xian = $_POST['xian'];
  28. $dizhi = $_POST['dizhi'];
  29. $oderid = $_POST['oderid'];
  30. $time = $_POST['time'];
  31. $price =$_POST['price'];
  32. $proxy_id = $_POST['proxyid'];
  33. $proxy_price = $_POST['prices'];
  34. $proxy_prices = $_POST['proxy_pricesss'];
  35. $beizhu = "订单号:" . $oderid . "返佣¥" . $proxy_prices;
  36. // echo $beizhu;
  37. include_once("../../untils/conn.php");
  38. if ($con) {
  39. mysqli_query($con, "set names utf8");
  40. $data_query = mysqli_query($con, "select * from oder where uid='$uid'");
  41. $count = mysqli_num_rows($data_query);
  42. if ($count > 3) {
  43. // 用户已经申请过了,返回状态码1和提示信息
  44. $response = array('status' => 1, 'msg' => '您申请的卡数已超限!请联系客服!');
  45. echo json_encode($response);
  46. } else {
  47. $data_insert = mysqli_query($con, "insert into oder(goods,name,uid,phone,sf,city,xian,dizhi,oderid,time,proxy_id,proxy_price,proxy_prices,price) values('$goods','$name','$uid','$phone','$sf','$city','$xian','$dizhi','$oderid','$time','$proxy_id','$proxy_price','$proxy_prices','$price')");
  48. // echo $data_insert;
  49. // echo "SQL: " . $data_insert . "<br>";
  50. if ($data_insert) {
  51. // 申请成功,返回状态码0和提示信息
  52. $response = array('status' => 0, 'msg' => '申请成功');
  53. echo json_encode($response);
  54. // 判断$status是否为0,如果是则执行$sendSms()函数
  55. if ($response['status'] == 0) {
  56. // 写入佣金记录表
  57. $data_revenue = mysqli_query($con, "insert into revenue(account,oderid,name,price,beizhu,cr_time,proxy_upid,proxy_prices) values('$proxy_acc','$oderid','$name','$proxy_prices','$beizhu','$time','$proxy_upid','$proxy_price')");
  58. //发送短信通知
  59. sendSms($appId, $appKey, $phoneNumber, $templateId, $smsSign);
  60. }
  61. } else {
  62. // 信息不全,返回状态码-1和提示信息
  63. $response = array('status' => -1, 'msg' => '信息不全,请输入全部信息');
  64. echo json_encode($response);
  65. }
  66. }
  67. }