Commit efa4290e authored by zhuwei's avatar zhuwei

add 隐藏客户手机号中间几位 公共方法

parent 920efbf2
......@@ -227,8 +227,8 @@ class Broker extends Basic
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params['user_id'] ='1';
$params['searchdate'] ='跟进内容';*/
$params['user_id'] ='1';
$params['searchdate'] ='跟进内容';
if (!isset($params['user_id'])) {
return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]);
......@@ -271,6 +271,7 @@ class Broker extends Basic
$user_res =$user->useraction_search_user_res($user_id);
//dump($user_res);
$user_res['user_pic']=HEADERIMGURL.$user_res['user_pic'];
$user_res['user_phone']=hide_customer_phone($user_res['user_phone']);
$table= new Agents();
$Agents_res =$table->Agents_res($user_res['agent_id']);
//dump($Agents_res);
......@@ -279,7 +280,7 @@ class Broker extends Basic
$records = new GOperatingRecords();
$records_result = $records->user_history($user_id);
//dump($records_result);
//dump($user_id);
//dump($user_res);
return $this->response("200", "success!", ['user_info'=>$user_res,'user_date'=>$UPhoneFollowPp_res,'user_history'=>$records_result]);
......
......@@ -93,4 +93,46 @@ function down_file($url, $dir, $filename=''){
fwrite($fp2, $img);
fclose($fp2);
return $filename;
}
\ No newline at end of file
}
/**
* 隐藏客户手机号中间几位
* zhuwei 2017年12月22日15:33:48
*/
function hide_customer_phone($phone)
{
//首先去除前后'|'
$phone=trim($phone, "|");
//然后判断里面是否有'|'
if(strpos($phone, "|") !== false){
$explode_phone = explode("|", $phone);
foreach ($explode_phone as $k => $v) {
if(checkMobileValidity($v)){
$explode_phone[$k]=substr_replace($v,'****',3,4);
}
}
return implode("|", $explode_phone);
}else{
if(checkMobileValidity($phone)){
$phone=substr_replace($phone,'****',3,4);
}
return $phone;
}
}
/**^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
* 验证手机号是否正确
* zhuwei 2017-10-18 17:28:01
*/
function checkMobileValidity($phone)
{
$mobilephone = trim($phone);
// $exp = "/^13[0-9]{1}[0-9]{8}$|15[012356789]{1}[0-9]{8}$|18[012356789]{1}[0-9]{8}$|14[57]{1}[0-9]$/";
$exp = "/^(1[0-9])\d{9}$/";
if (preg_match($exp, $mobilephone)) {
return true;
} else {
return false;
}
}
......@@ -38,4 +38,5 @@ function list_to_tree($list, $pk='id', $pid = 'pid', $child = '_child', $root =
}
}
return $tree;
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment