You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ordersource.php 1.1 KiB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. header("Access-Control-Allow-Origin:*");
  3. //载入配置文件和连接数据库
  4. //获取地名
  5. $pdo=conn();
  6. $ordersource = $_POST['ordersource'];
  7. //$area = "上";
  8. $sql = "select supplier_name as org_name, id as org_id from base_supplier where supplier_name like '%".$ordersource."%' and cancel_flag = 0 and SUPPLIER_TYPE=301";
  9. $main_corp_id = isset($_COOKIE["user_main_corp"]) ? $_COOKIE["user_main_corp"] : 0;
  10. if( $main_corp_id > 0 ) {
  11. $sql .= " AND MAIN_CORP_ID IN(0,{$main_corp_id}) ";
  12. }
  13. if( $main_corp_id != 3 ) {
  14. $sql .= " AND MAIN_CORP_ID NOT IN(3) ";
  15. }
  16. $result=$pdo->query($sql);
  17. //成功
  18. if($result){
  19. $code = 0;
  20. $info = "返回数据成功";
  21. $list = $result->fetchAll(PDO::FETCH_ASSOC);
  22. }else{
  23. //系统错误,请联系管理员
  24. $code = 1;
  25. $info = "代码错误,请联系系统管理员";
  26. $list = "";
  27. }
  28. $json = array();
  29. $json['code'] = $code;
  30. $json['info'] = $info;
  31. $json['list'] = $list;
  32. //print_r($json);
  33. echo json_encode($json);
  34. ?>