|
- <?php
- //引入词典
- require_once 'dictionary.php';
- header("Access-Control-Allow-Origin:*");
-
- //获取参数
- //$select_sale_style = 1;
- //$select_user_style = 1;
- //$select_sale_shop = 2;
- //$keywords = "刘";
- //print_r($_POST);
- $currpage = $_POST['currpage'];
- $pagesize = $_POST['pagesize'];
- $select_sale_style = $_POST['select_sale_style'];
- $select_user_style = $_POST['select_user_style'];
- $shop = $_POST['select_sale_shop'];
- $keywords = $_POST['keywords'];
-
- $sqlWhere = array();
-
- ($select_sale_style==-1)? null : $sqlWhere[] = " SELA_TYPE = '$select_sale_style'";
- ($select_user_style==-1)? null : $sqlWhere[] = " STATUS = '$select_user_style'";
- empty($keywords)? null : $sqlWhere[] = " $sale_shop[$shop] like '%$keywords%'";
-
- if(count($sqlWhere) == 0){
- $sql_txt = "";
- }else{
- $sql_txt = " where ".implode(" and ",$sqlWhere);
- }
-
-
-
- $num = ($currpage-1)*$pagesize;
-
-
- //获取营销员信息
- $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;
- $result=$pdo->query($sql);
-
- //处理
- if($result){
- $list=$result->fetchAll(PDO::FETCH_ASSOC);
- $code = 0;
- $info = 'success';
- $massge = '成功';
- foreach($list as $k => $v){
- foreach($v as $kk => $vv){
- if(array_key_exists($kk,$coutomer)){
- $list[$k][$kk] = $coutomer[$kk][$vv];
- }
- if($kk == 'AREA_ID'){
- $sql = "select AREA_NAME,PARENT_AREA_NAME_LIST from base_area_view where AREA_ID = '$vv'";
- $result11=$pdo->query($sql);
- $area = $result11->fetchAll(PDO::FETCH_ASSOC);
- $area = $area[0];
- $area = str_replace('{','',$area);
- $area = str_replace('}','',$area);
- $area = str_replace('省',' ',$area);
- $area = str_replace('市',' ',$area);
- $area = str_replace('区',' ',$area);
- $areaa = $area['PARENT_AREA_NAME_LIST'].$area['AREA_NAME'];
- $list[$k][$kk] = $areaa;
- }
- }
- }
- $sql = "select count(*) as totalNum from base_customer".$sql_txt;
- $result=$pdo->query($sql);
- $totalNum = $result->fetchAll(PDO::FETCH_ASSOC);
- $totalNum = $totalNum[0]['totalNum'];
- }else{
- $code = -1;
- $info = 'fail';
- $massge = '失败';
- $totalNum = 0;
- $list = '';
- }
- $json['code'] = $code;
- $json['info'] = $info;
- $json['massge'] = $massge;
- $json['totalNum'] = $totalNum;
- $json['list'] = $list;
- // print_r($json);
- echo json_encode($json);
-
-
-
- ?>
|