get_args('key')? $this->get_args('key') :""; if (!empty($key)){ Doo::loadModel ( 'longle' ); $longle = new longle (); Doo::loadModel('staff'); $staff=new staff(); Doo::loadModel('client'); $client=new client(); $longleInfo=$longle->getOne(array ('where' => "key_num= '".$key."' and (status=3 or status=4 or status=5)",'asArray' => TRUE)); if (empty($longleInfo)){ echo json_encode(array('list'=>array()));die; } $clientInfo=$client->getOne(array ('where' => "cid= '".$longleInfo['clientid']."'",'asArray' => TRUE)); $staffInfo=$staff->getOne(array ('where' => "username= '".$longleInfo['responsible']."'",'asArray' => TRUE)); $productCount=explode('+', $longleInfo['product']); $list['product']=strtr($longleInfo['product'],"+"," "); $list['productCount']=count($productCount); $list['key_num']=$key; $list['telephone']=$staffInfo['telephone']; $list['username']=$staffInfo['category'].$staffInfo['username']; $list['qq']=$staffInfo['qq']; $count=mb_strlen($longleInfo['client'],'UTF8'); if ($clientInfo['gender']=='男') $k=' 先生'; else $k=' 女士'; if ($count<=2) $list['client']=mb_strcut($longleInfo['client'],0,4,'utf8')."*".$k; elseif ($count>2&&$count<=4) $list['client']=mb_strcut($longleInfo['client'],0,4,'utf8')."**".$k; else $list['client']=mb_strcut($longleInfo['client'],0,4,'utf8')."***".$k; echo json_encode(array('list'=>$list));die; } echo json_encode(array('list'=>array()));die; } function getAuthenticationBySerial(){ $key = $this->get_args('SerialNumber')? $this->get_args('SerialNumber') :""; if (!empty($key)){ Doo::loadModel ( 'longle' ); $longle = new longle (); Doo::loadModel('staff'); $staff=new staff(); Doo::loadModel('client'); $client=new client(); $longleInfo=$longle->getOne(array ('where' => "SerialNumber= '".$key."' and (status=3 or status=4 or status=5)",'asArray' => TRUE)); if (empty($longleInfo)){ echo json_encode(array('list'=>array()));die; } $clientInfo=$client->getOne(array ('where' => "cid= '".$longleInfo['clientid']."'",'asArray' => TRUE)); $staffInfo=$staff->getOne(array ('where' => "username= '".$longleInfo['responsible']."'",'asArray' => TRUE)); $productCount=explode('+', $longleInfo['product']); $list['product']=strtr($longleInfo['product'],"+"," "); $list['productCount']=count($productCount); $list['key_num']=$longleInfo['key_num']; $list['telephone']=$staffInfo['telephone']; $list['username']=$staffInfo['category'].$staffInfo['username']; $list['qq']=$staffInfo['qq']; if ($clientInfo['gender']=='男') $k=' 先生'; else $k=' 女士'; $list['client']=$longleInfo['client'].$k; $list['SerialNumber']=$this->half_replace($longleInfo['SerialNumber']); echo json_encode(array('list'=>$list));die; } echo json_encode(array('list'=>array()));die; } function half_replace($str){ $len = strlen($str)/2; return substr_replace($str,str_repeat('*',$len),ceil(($len)/2),$len); } /** * 获取get或者POST值 * @param string $name 属性名称 * @return fixed 值 */ function get_args($name) { if (isset ( $_GET [$name] )) { if (is_array ( $_GET [$name] )) return $_GET [$name]; else { //return addslashes ( $_GET [$name] ); return $_GET [$name] ; } } elseif (isset ( $_POST [$name] )) { if (is_array ( $_POST [$name] )) return $_POST [$name]; else { //return addslashes ( $_POST [$name] ); return $_POST [$name]; } } else { return false; } } } ?>