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.
 
 
 
 

87 lines
2.9 KiB

  1. <?php
  2. //引入词典
  3. require_once 'dictionary.php';
  4. header("Access-Control-Allow-Origin:*");
  5. //获取参数
  6. //$select_sale_style = 1;
  7. //$select_user_style = 1;
  8. //$select_sale_shop = 2;
  9. //$keywords = "刘";
  10. //print_r($_POST);
  11. $currpage = $_POST['currpage'];
  12. $pagesize = $_POST['pagesize'];
  13. $select_sale_style = $_POST['select_sale_style'];
  14. $select_user_style = $_POST['select_user_style'];
  15. $shop = $_POST['select_sale_shop'];
  16. $keywords = $_POST['keywords'];
  17. $sqlWhere = array();
  18. ($select_sale_style==-1)? null : $sqlWhere[] = " SELA_TYPE = '$select_sale_style'";
  19. ($select_user_style==-1)? null : $sqlWhere[] = " STATUS = '$select_user_style'";
  20. empty($keywords)? null : $sqlWhere[] = " $sale_shop[$shop] like '%$keywords%'";
  21. if(count($sqlWhere) == 0){
  22. $sql_txt = "";
  23. }else{
  24. $sql_txt = " where ".implode(" and ",$sqlWhere);
  25. }
  26. $num = ($currpage-1)*$pagesize;
  27. //获取营销员信息
  28. $sql = "select CUST_ID,CHAN_QUALITY,CHAN_TYPE,ORG_ID,CHAN_NAME,AREA_ID,LINKMAN,RESMAN,SELA_TYPE,STATUS from base_customer ".$sql_txt." order by CUST_ID desc limit ".$num.",".$pagesize;
  29. $result=$pdo->query($sql);
  30. //处理
  31. if($result){
  32. $list=$result->fetchAll(PDO::FETCH_ASSOC);
  33. $code = 0;
  34. $info = 'success';
  35. $massge = '成功';
  36. foreach($list as $k => $v){
  37. foreach($v as $kk => $vv){
  38. if(array_key_exists($kk,$coutomer)){
  39. $list[$k][$kk] = $coutomer[$kk][$vv];
  40. }
  41. if($kk == 'AREA_ID'){
  42. $sql = "select AREA_NAME,PARENT_AREA_NAME_LIST from base_area_view where AREA_ID = '$vv'";
  43. $result11=$pdo->query($sql);
  44. $area = $result11->fetchAll(PDO::FETCH_ASSOC);
  45. $area = $area[0];
  46. $area = str_replace('{','',$area);
  47. $area = str_replace('}','',$area);
  48. $area = str_replace('省',' ',$area);
  49. $area = str_replace('市',' ',$area);
  50. $area = str_replace('区',' ',$area);
  51. $areaa = $area['PARENT_AREA_NAME_LIST'].$area['AREA_NAME'];
  52. $list[$k][$kk] = $areaa;
  53. }
  54. }
  55. }
  56. $sql = "select count(*) as totalNum from base_customer".$sql_txt;
  57. $result=$pdo->query($sql);
  58. $totalNum = $result->fetchAll(PDO::FETCH_ASSOC);
  59. $totalNum = $totalNum[0]['totalNum'];
  60. }else{
  61. $code = -1;
  62. $info = 'fail';
  63. $massge = '失败';
  64. $totalNum = 0;
  65. $list = '';
  66. }
  67. $json['code'] = $code;
  68. $json['info'] = $info;
  69. $json['massge'] = $massge;
  70. $json['totalNum'] = $totalNum;
  71. $json['list'] = $list;
  72. // print_r($json);
  73. echo json_encode($json);
  74. ?>