getUserIp(); $clickModel = new \common\models\HouseClickrecord(); $row = $clickModel->FingByIp($ip,$hid); if(empty($row)) { $clickModel->ip = $ip; $clickModel->hid = $hid; if($clickModel->save()) { $houseModel = new \common\models\House(); $houseRow = $houseModel->FindById($hid); if(!empty($houseRow)) { $houseRow->click_num = ++$houseRow->click_num; if($houseRow->save(false)) { return true; } } } } } //处理搜索楼盘名字时出现特殊字符 public function HouseNameConvert($name) { if(empty($name)) return; $Symbol = [',','.'," ",',','。','/','?']; $str = $name; $mb = mb_strlen($str,'utf-8'); $st = strlen($str); $arr['pinyin'] = []; $arr['zhongwen'] = []; if($st==$mb) { $arr['pinyin'] = $str; foreach ($Symbol as $val) { $exp = explode($val,$str); if(count($exp) >1) { $arr['pinyin'] = $exp; } } if(is_array($arr['pinyin'])) { $namestrs = ''; foreach ( $arr['pinyin'] as $key=>$val) { if(empty($val) || in_array($val,$Symbol)) { unset( $arr['pinyin'][$key]); } $namestrs .= $val; } array_push( $arr['pinyin'],$namestrs); } } else { $arr['zhongwen'] = $str; foreach ($Symbol as $val) { $exp = explode($val,$name); if(count($exp) >1) { $arr['zhongwen'] = $exp; } } if(is_array($arr['zhongwen'])) { $namestr = ''; foreach ( $arr['zhongwen'] as $key=>$val) { if(empty($val) || in_array($val,$Symbol)) { unset( $arr['zhongwen'][$key]); } $namestr .= $val; } array_push( $arr['zhongwen'],$namestr); } } return $arr; } }