execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER ); // // if($routeRs['1']!="loginHttp"){ // if(isset($_COOKIE["staff"])){ // if(empty($_COOKIE["staff"])){ // setcookie("staff", '', time()+36000,"/"); // echo json_encode(array('status'=>3,'msg'=>'请登录'));die; // } // }else{ // setcookie("staff", '', time()+36000,"/"); // echo json_encode(array('status'=>3,'msg'=>'请登录'));die; // } // // } } function loginHttp(){ $pw2=$pw = $this->get_args('pw') ? $this->get_args('pw') : ""; $user = $this->get_args('user') ? $this->get_args('user') : ""; //$t = $this->get_args('t') ? $this->get_args('t') : 0; Doo::loadModel ( 'staff' ); Doo::loadModel('tag'); $tag=new tag(); $staff = new staff (); if(!empty($pw)){ if(isset($_COOKIE['staff']))//$this->authcode(,'DECODE',$this->key) $pw2=base64_decode($pw); $userinfo=$staff->checkUser($user,$pw2); if(!empty($userinfo)){//$pw;$this->authcode(,'',$this->key) //get user tag $tagList=$tag->find(array('where'=>'sid='.$userinfo[0]['sid'],'asArray'=>true)); $userinfo[0]['passwork']=base64_encode($pw2); setcookie("staff", $userinfo[0]['sid'], time()+36000,"/"); $a=filemtime(DOO::conf()->SITE_PATH.$userinfo[0]['avatar']."_2.jpg"); $userinfo[0]['avatarUpdateTime']=$a; //if ($t){ $staff->appDate=date('Y-m-d H:i'); $staff->update(array('where'=>'sid='.$userinfo[0]['sid'])); //} echo json_encode(array('status'=>1,'msg'=>'登陆成功','userList'=>$userinfo,'tagList'=>$tagList)); }else{ if(isset($_COOKIE['staff'])) $userinfo=$staff->checkUser($user,$pw); if(!empty($userinfo)){//$pw;$this->authcode(,'',$this->key) //get user tag $tagList=$tag->find(array('where'=>'sid='.$userinfo[0]['sid'],'asArray'=>true)); $userinfo[0]['passwork']=base64_encode($pw); $a=filemtime(DOO::conf()->SITE_PATH.$userinfo[0]['avatar']."_2.jpg"); $userinfo[0]['avatarUpdateTime']=$a; //if ($t){ $staff->appDate=date('Y-m-d H:i'); $staff->update(array('where'=>'sid='.$userinfo[0]['sid'])); //} echo json_encode(array('status'=>1,'msg'=>'登陆成功C','userList'=>$userinfo,'tagList'=>$tagList)); }else echo json_encode(array('status'=>2,'msg'=>'账号或密码不正确','userList'=>array())); } }else echo json_encode(array('status'=>2,'msg'=>'账号或密码不正确','userList'=>array())); } function outHttp(){ setcookie("staff", '', time()+36000,"/"); echo json_encode(array('status'=>1,'msg'=>'退出成功')); } function searchHttp(){ $search=$pw = $this->get_args('search') ? $this->get_args('search') : ""; $page = $this->get_args('page')&&is_numeric($this->get_args('page')) ? $this->get_args('page') : 1; $size = $this->get_args('size')&&is_numeric($this->get_args('size')) ? $this->get_args('size') : 10; Doo::loadModel ( 'client' ); $client = new client (); Doo::loadModel ( 'staff' ); Doo::loadModel('tag_client'); Doo::loadModel('C_tooltip'); Doo::loadModel('tag'); $tagObj = new tag (); $cTooltip=new C_tooltip(); $tagClient=new tag_client(); $staff = new staff (); $staffDetail=$staff->getOne(array('where'=>'sid='.$_COOKIE["staff"],'asArray'=>true)); if ($page!=1) $page=$page*$size-1; else $page--; $ClientTagList=$tagClient->getTagClientBySid( $_COOKIE["staff"]); $toollist=$cTooltip->find(array('where'=>'cateid='.$staffDetail["cid"],'asArray'=>true)); $count=$client->count(array('limit'=>$page.','.$size,'where'=>" address like '%".$search."%' or clientname like '%".$search."%' or companyname like '%".$search."%' or qq like '%".$search."%' or telephone like '%".$search."%' or phone like '%".$search."%'",'asArray'=>true)); $list=$client->find(array('limit'=>$page.','.$size,'where'=>" address like '%".$search."%' or clientname like '%".$search."%' or companyname like '%".$search."%' or qq like '%".$search."%' or telephone like '%".$search."%' or phone like '%".$search."%'",'asArray'=>true)); foreach ($ClientTagList as $key=>$value){ $ClientTagList[$key]['taginfo']= $tagObj->getTagByTidL($value['tag']); } foreach ($list as $key=>$value){ if(!empty($value['cid'])){ $list[$key]['taginfo']= array(); $list[$key]['tag']=""; foreach ($ClientTagList as $k=>$v){ if($value['cid']==$v['client']){ $list[$key]['taginfo']= $v['taginfo']; $list[$key]['tag']=$v['tag']; } } } $list[$key]['tooltipList']=array(); foreach ($toollist as $k=>$v){ if($v['cid']==$value['cid']){ $list[$key]['tooltipList']=explode(",", $v['name']); break; }//array_pop 可以优化数组 } } echo json_encode(array('status'=>1,'clientList'=>$list,'count'=>$count)); } function districtHttp(){ $did = $this->get_args('did')&&is_numeric($this->get_args('did')) ? $this->get_args('did') : 0; Doo::loadModel('district'); Doo::loadModel('staff'); $staff=new staff(); $district=new district(); $staffDetail=$staff->getOne(array('where'=>'sid='.$_COOKIE["staff"],'asArray'=>true)); if($did==0){ if ($staffDetail['isadmin']) $districtList=$district->get_lvByid(0,$did); else $districtList=$district->get_lvByStaffid(1,$_COOKIE["staff"]); }else{ $districtList=$district->get_lvByid(0,$did); } echo json_encode(array('msg'=>"",'districtList'=>$districtList)); } function clientDetailHttp(){ $cid = $this->get_args('cid')&&is_numeric($this->get_args('cid')) ? $this->get_args('cid') : 0; if($cid!=0){ Doo::loadModel ( 'client' ); Doo::loadModel ( 'company' ); Doo::loadModel ( 'service_log' ); Doo::loadModel('longle'); $longle = new longle(); $client = new client (); $company = new company (); $serviceLog = new service_log (); Doo::loadModel ( 'client_staff' ); Doo::loadModel ( 'staff' ); Doo::loadModel('tag_client'); Doo::loadModel('C_tooltip'); Doo::loadModel('tag'); $tagObj = new tag (); $cTooltip=new C_tooltip(); $tagClient=new tag_client(); $staff = new staff (); $client_staff = new client_staff (); Doo::loadModel('tagCompany'); $tagCompany = new tagCompany (); Doo::loadModel('tagCompanyNexus'); $tagCompanyNexus = new tagCompanyNexus (); $clientList=$client->getOne(array('where'=>'cid='.$cid,'asArray'=>true)); $companyList=$company->getOne(array('where'=>'cid='.$clientList['companyid'],'asArray'=>true)); $serviceLogList=$serviceLog->find(array('where'=>'clientid='.$cid,'desc'=>'date','asArray'=>true)); $clientCount=$client->count(array('where'=>'companyid='.$clientList['companyid'],'asArray'=>true)); $longleList=$longle->find(array('where'=>'clientid='.$cid,'asArray'=>true)); $colleague=$client->find(array('where'=>'companyid='.$clientList['companyid'].' and cid!='.$cid,'asArray'=>true)); $staffDetail=$staff->getOne(array('where'=>'sid='.$_COOKIE["staff"],'asArray'=>true)); $ClientTagList=$tagClient->getTagClientBySid( $_COOKIE["staff"]); $toollist=$cTooltip->find(array('where'=>'cateid='.$staffDetail["cid"],'asArray'=>true)); $companyTagL=$tagCompany->find(array('where'=>'sid='.$_COOKIE["staff"],'asArray'=>true)); $CompanyTagList=$tagCompanyNexus->getTagClientBySid( $_COOKIE["staff"]); foreach ($CompanyTagList as $key=>$value){ $CompanyTagList[$key]['taginfo']= $tagCompany->getTagByTidL($value['tag']); } if(!empty($companyList['cid'])){ $companyList['taginfo']= array(); $companyList['tag']=""; foreach ($CompanyTagList as $k=>$v){ if($companyList['cid']==$v['company']){ $companyList['taginfo']= $v['taginfo']; $companyList['tag']=$v['tag']; } } } foreach ($ClientTagList as $key=>$value){ $ClientTagList[$key]['taginfo']= $tagObj->getTagByTidL($value['tag']); } if(!empty($clientList['cid'])){ $clientList['taginfo']= array(); $clientList['tag']=""; foreach ($ClientTagList as $k=>$v){ if($clientList['cid']==$v['client']){ $clientList['taginfo']= $v['taginfo']; $clientList['tag']=$v['tag']; } } } $list[$key]['tooltipList']=array(); foreach ($toollist as $k=>$v){ if($v['cid']==$clientList['cid']){ $clientList['tooltipList']=explode(",", $v['name']); break; }//array_pop 可以优化数组 } foreach ($colleague as $key=>$value){ if(!empty($value['cid'])){ $colleague[$key]['taginfo']= array(); $colleague[$key]['tag']=""; foreach ($ClientTagList as $k=>$v){ if($value['cid']==$v['client']){ $colleague[$key]['taginfo']= $v['taginfo']; $colleague[$key]['tag']=$v['tag']; } } } $colleague[$key]['tooltipList']=array(); foreach ($toollist as $k=>$v){ if($v['cid']==$value['cid']){ $colleague[$key]['tooltipList']=explode(",", $v['name']); break; }//array_pop 可以优化数组 } } $companyList['clientCount']=$clientCount; echo json_encode(array('status'=>1,'clientList'=>$clientList,'colleague'=>$colleague,'companyList'=>$companyList,'companyTag'=>$companyTagL,'serviceLogList'=>$serviceLogList,'longleList'=>$longleList,'msg'=>''));die; } echo json_encode(array('status'=>2,'clientList'=>array(),'companyList'=>array(),'serviceLogList'=>array(),'msg'=>"请输入正确的请求路径")); } function advancedSearchHttp(){ $lv1 = $this->get_args('lv1')&&is_numeric($this->get_args('lv1')) ? $this->get_args('lv1') : ""; $lv2 = $this->get_args('lv2')&&is_numeric($this->get_args('lv2')) ? $this->get_args('lv2') : ""; $lv3 = $this->get_args('lv3')&&is_numeric($this->get_args('lv3')) ? $this->get_args('lv3') : ""; $tag = $this->get_args('tag') ? $this->get_args('tag') : ""; $teamTag = $this->get_args('teamTag') ? $this->get_args('teamTag') : ""; $page = $this->get_args('page')&&is_numeric($this->get_args('page')) ? $this->get_args('page') : 1; $size = $this->get_args('size')&&is_numeric($this->get_args('size')) ? $this->get_args('size') : 10; Doo::loadModel ( 'client_staff' ); Doo::loadModel ( 'staff' ); Doo::loadModel('tag_client'); Doo::loadModel('C_tooltip'); Doo::loadModel('tag'); $tagObj = new tag (); $cTooltip=new C_tooltip(); $tagClient=new tag_client(); $staff = new staff (); $client_staff = new client_staff (); $staffDetail=$staff->getOne(array('where'=>'sid='.$_COOKIE["staff"],'asArray'=>true)); $condition=""; if(!empty($lv1)) $condition.=" and district like '".$lv1.",%'"; if(!empty($lv2)) $condition.=" and district like '".$lv1.",".$lv2.",%'"; if(!empty($lv3)) $condition.=" and district like '".$lv1.",".$lv2.",".$lv3."'"; if(!empty($tag)){ $tagList=explode("@", $tag); foreach ($tagList as $value){ $condition.=" and c.tag like '%".$value."%' "; } } if ($page!=1) $page=$page*$size-1; else $page--; $limit = " limit " . $page . " , " . $size . " "; //获得标签 $ClientTagList=$tagClient->getTagClientBySid( $_COOKIE["staff"]); $toollist=$cTooltip->find(array('where'=>'cateid='.$staffDetail["cid"],'asArray'=>true)); $count = $this->getTableCount ( "CLD_client_staff", $condition ,$staffDetail["sid"],"",$teamTag,$staffDetail['cid']); $clientList=$client_staff->getClientByStaff($condition,$limit,$staffDetail["sid"],$staffDetail["sid"],"",$teamTag,$staffDetail['cid']); foreach ($ClientTagList as $key=>$value){ $ClientTagList[$key]['taginfo']= $tagObj->getTagByTidL($value['tag']); } foreach ($clientList as $key=>$value){ if(!empty($value['cid'])){ $clientList[$key]['taginfo']= array(); $clientList[$key]['tag']=""; foreach ($ClientTagList as $k=>$v){ if($value['cid']==$v['client']){ $clientList[$key]['taginfo']= $v['taginfo']; $clientList[$key]['tag']=$v['tag']; } } } $clientList[$key]['tooltipList']=array(); foreach ($toollist as $k=>$v){ if($v['cid']==$value['cid']){ $clientList[$key]['tooltipList']=explode(",", $v['name']); break; }//array_pop 可以优化数组 } $clientList[$key]['locount']=0; } echo json_encode(array('status'=>1,'clientList'=>$clientList,'count'=>$count,'msg'=>'')); } function lockNoHttp(){ $lockNo = $this->get_args('lockNo') ? $this->get_args('lockNo') : ""; $page = $this->get_args('page')&&is_numeric($this->get_args('page')) ? $this->get_args('page') : 1; $size = $this->get_args('size')&&is_numeric($this->get_args('size')) ? $this->get_args('size') : 10; if (!empty($lockNo)){ // Doo::loadModel("service_log"); // $service_log = new service_log (); Doo::loadModel("longle"); $longle = new longle (); if ($page!=1) $page=$page*$size-1; else $page--; $count=$longle->count(array('limit'=>$page.','.$size,'where'=>" key_num like '%".$lockNo."%' ",'asArray'=>true)); $lockList=$longle->find(array('limit'=>$page.','.$size,'where'=>" key_num like '%".$lockNo."%' ",'asArray'=>true)); echo json_encode(array('status'=>1,'lockList'=>$lockList,'count'=>$count,'msg'=>''));die; } echo json_encode(array('status'=>1,'lockList'=>array(),'count'=>0,'msg'=>'')); } function lockJournalHttp(){ $lid = $this->get_args('lid')&&is_numeric($this->get_args('lid')) ? $this->get_args('lid') : 0; if(!empty($lid)){ Doo::loadModel("longle_log"); $longleLog = new longle_log (); $longleLogList=$longleLog->find(array('where'=>'lid='.$lid,'asArray'=>true)); echo json_encode(array('status'=>1,'JournalList'=>$longleLogList,'msg'=>''));die; } echo json_encode(array('status'=>1,'JournalList'=>array(),'msg'=>'')); } function districtDetailHttp(){ $dStr = $this->get_args('dStr') ? $this->get_args('dStr') : ""; $cid = $this->get_args('cid') ? $this->get_args('cid') : 0; if(!empty($dStr)){ Doo::loadModel('district'); Doo::loadModel ( 'client' ); $district=new district(); $client = new client (); $districtList=$district->find(array('where'=>'id in('.$dStr.')','asArray'=>true)); $jsonString=array(); foreach ($districtList as $value){ array_push($jsonString, $value['name']); } $jsonString=implode(",", $jsonString); if (!empty($jsonString)&&!empty($cid)){ $client->cid=$cid; $client->local=$jsonString; $client->update(); } echo json_encode(array('status'=>1,'districtList'=>$jsonString,'msg'=>''));die; } } function clientInfoHttp(){ $cid=$this->get_args('cid')?$this->get_args('cid'):0; $clientname=$this->get_args('clientname')?$this->get_args('clientname'):""; $gender=$this->get_args('gender')?$this->get_args('gender'):""; $nicename=$this->get_args('nicename')?$this->get_args('nicename'):""; $telephone=$this->get_args('telephone')?$this->get_args('telephone'):""; $phone=$this->get_args('phone')?$this->get_args('phone'):""; $email=$this->get_args('email')?$this->get_args('email'):""; $unit=$this->get_args('unit')?$this->get_args('unit'):""; $fax=$this->get_args('fax')?$this->get_args('fax'):""; $webservice=$this->get_args('webservice')?$this->get_args('webservice'):""; $department=$this->get_args('department')?$this->get_args('department'):""; $position=$this->get_args('position')?$this->get_args('position'):""; $office=$this->get_args('office')?$this->get_args('office'):""; $address=$this->get_args('address')?$this->get_args('address'):""; $ride=$this->get_args('ride')?$this->get_args('ride'):""; $landmarks=$this->get_args('landmarks')?$this->get_args('landmarks'):""; $qq=$this->get_args('qq')?$this->get_args('qq'):""; $priority=$this->get_args('priority')?$this->get_args('priority'):5; $stay=$this->get_args('stay')?$this->get_args('stay'):""; $mark=$this->get_args('mark')?$this->get_args('mark'):""; $lv21=$this->get_args('lv21')?$this->get_args('lv21'):0; $lv22=$this->get_args('lv22')?$this->get_args('lv22'):0; $lv23=$this->get_args('lv23')?$this->get_args('lv23'):0; if(!empty($cid)&&!empty($clientname)){ Doo::loadModel ( 'client' ); Doo::loadModel('district'); $district=new district(); $client = new client(); Doo::loadModel ( 'staff' ); $staff = new staff (); $client->cid=$cid; $client->clientname=$clientname; if(!empty($gender)) $client->gender=$gender; if(!empty($nicename)) $client->nicename=$nicename; if(!empty($telephone)) $client->telephone=$telephone; if(!empty($phone)) $client->phone=$phone; if(!empty($email)) $client->email=$email; if(!empty($lv21)&&!empty($lv22)&&!empty($lv23)){ $client->district=$lv21.",".$lv22.",".$lv23; } if(!empty($client->district)){ $districtList=$district->find(array('where'=>'id in('.$client->district.')','asArray'=>true)); $jsonString=array(); foreach ($districtList as $value){ array_push($jsonString, $value['name']); } $jsonString=implode(",", $jsonString); if (!empty($jsonString)) $client->local=$jsonString; } if(!empty($fax)) $client->fax=$fax; if(!empty($webservice)) $client->webservice=$webservice; if(!empty($department)) $client->department=$department; if(!empty($position)) $client->position=$position; if(!empty($office)) $client->office=$office; if(!empty($address)) $client->address=$address; if(!empty($ride)) $client->ride=$ride; if(!empty($landmarks)) $client->landmarks=$landmarks; if(!empty($qq)) $client->qq=$qq; if(!empty($stay)) $client->stay=$stay; if(!empty($priority)) $client->priority=$priority; if(!empty($mark)) $client->mark=$mark; $client->updatetime=time(); $client->update(); $staffDetail=$staff->getOne(array('where'=>'sid='.$_COOKIE["staff"],'asArray'=>true)); //标签 $tid = $this->get_args ( 'tagALD' ); Doo::loadModel('tag_client'); //$strtid=implode(",", $tid); $strtid=$tid; $tagClient=new tag_client(); $tagClientInfo=$tagClient->getTagClientBySCid($cid,$_COOKIE["staff"]); //$ar=explode(",", $strtid.','.$tagClientInfo['tag']); //$re=array_filter(array_unique($ar)); //$tagClient->tag=implode(",", $re); $tagClient->tag=$strtid; if(!empty($tagClientInfo)){ $tagClient->tcid=$tagClientInfo['tcid']; $tagClient->update(); }else{ $tagClient->sid=$_COOKIE["staff"]; $tagClient->client=$cid; $tagClient->insert(); } $tid = $this->get_args ( 'tooltiplist' ); //$k=implode(",", $tid); $k=$tid; Doo::loadModel('C_tooltip'); $s=" and cateid=".$staffDetail["cid"]; if(!empty($staffDetail['othercid'])){ $othercid=explode(",", $staffDetail['othercid']); foreach ($othercid as $value){ $s.=" or cateid=".$value; } } //foreach ($cid as $key=>$value){ $C_tooltip = new C_tooltip (); $tooltip=$C_tooltip->getOne(array('where'=>'cid='.$cid." ".$s,'asArray'=>true)); if(empty($tooltip)){ $C_tooltip->cid=$cid; $C_tooltip->name=$k; $C_tooltip->cateid=$staffDetail['cid']; $C_tooltip->insert(); }else{ $C_tooltip->tip=$tooltip['tip']; $C_tooltip->name=$k; $C_tooltip->update(); } //} $clientInfo=$client->getOne(array('where'=>' cid='.$cid,'asArray'=>true)); //日常行为 Doo::loadModel("action_log"); $action_log=new action_log(); $action_log->action=$staffDetail['category'].''.$staffDetail['username'].'编辑了'.$clientname.'('.$clientInfo['companyname'].')'; $action_log->updatetime=date("Y-m-d"); $action_log->sid=$staffDetail['sid']; $action_log->cid=$staffDetail['cid']; $action_log->status=2; $action_log->time=date("H:i"); $action_log->class=$action_log->iconContacts; $action_log->districtid=$clientInfo['district']; $local=$district->getbyidlist($clientInfo['district']); $action_log->city=$local[0]['name']; $action_log->province=$local[1]['name']; $action_log->company=$clientInfo['companyname']; Doo::loadModel('company'); $company=new company(); $companyInfo=$company->getOne(array('where'=>' companyname="'.$clientInfo['companyname'].'"','asArray'=>true)); $nature=explode(',', $companyInfo['nature']); $action_log->nature=$nature[0]; $action_log->insert(); echo json_encode(array('status'=>1,'msg'=>''));die; }else echo json_encode(array('status'=>2,'msg'=>''));die; } function serviceLogHttp(){ $status=$this->get_args('status')?$this->get_args('status'):""; $clientid=$this->get_args('cid')?$this->get_args('cid'):""; $mark=$this->get_args('mark')?$this->get_args('mark'):""; $m=$this->get_args('m')?$this->get_args('m'):""; $d=$this->get_args('d')?$this->get_args('d'):""; $y=$this->get_args('y')?$this->get_args('y'):date("Y"); $Remind=isset($_POST['Remind'])?$_POST['Remind']:0; $time=isset($_POST['time'])?$_POST['time']:0; $remark=isset($_POST['remark'])?$_POST['remark']:""; //echo $mark;die; if(!empty($status)&&!empty($clientid)){ Doo::loadModel ( 'service_log' ); Doo::loadModel ( 'client_staff' ); $clientStaff=new client_staff(); $service_log = new service_log(); Doo::loadModel("action_log"); $action_log=new action_log(); Doo::loadModel("client"); $client=new client(); Doo::loadModel ( 'staff' ); $staff = new staff (); $staffDetail=$staff->getOne(array('where'=>'sid='.$_COOKIE["staff"],'asArray'=>true)); $service_log->status=$status; $service_log->clientid=$clientid; $service_log->mark=htmlspecialchars($mark); $service_log->date=$y."-".$m."-".$d; $service_log->category=$staffDetail['category']; $service_log->staffname=$staffDetail['username']; $service_log->staffid=$staffDetail['sid']; $service_log->insert(); //日常行为 //记录服务时间 $client->cid=$clientid; $client->servicetime=time(); $client->update(); $clientInfo=$client->getOne(array('where'=>' cid='.$clientid,'asArray' => TRUE)); $action_log->action=$staffDetail['category'].''.$staffDetail['username'].''.$clientInfo['clientname'].'('.$clientInfo['companyname'].')添加新客户记录。'; $action_log->updatetime=date("Y-m-d"); $action_log->sid=$staffDetail['sid']; $action_log->cid=$staffDetail['cid']; $action_log->time=date("H:i"); $action_log->status=3; $action_log->districtid=$clientInfo['district']; Doo::loadModel('district'); $district=new district(); $local=$district->getbyidlist($clientInfo['district']); $action_log->city=$local[0]['name']; $action_log->province=$local[1]['name']; $action_log->company=$clientInfo['companyname']; Doo::loadModel('company'); $company=new company(); $companyInfo=$company->getOne(array('where'=>' companyname="'.$clientInfo['companyname'].'"','asArray'=>true)); $nature=explode(',', $companyInfo['nature']); $action_log->nature=$nature[0]; $action_log->class=$action_log->iconContacts; $action_log->insert(); if (!empty($Remind)){ Doo::loadModel('remind'); $remindObj=new remind(); $datetime1 = new DateTime(date('Y-m-d')); $datetime2 = new DateTime($time); $interval = $datetime1->diff($datetime2); $remindObj->day=$interval->format('%a'); $remindObj->remark=$remark; $remindObj->time=date("Y-m-d"); $remindObj->clientName=$clientInfo['clientname']; $remindObj->clientID=$clientid; $remindObj->companyName=$clientInfo['companyname']; $remindObj->companyID=$companyInfo['cid']; $remindObj->staffID=$_COOKIE["staff"]; if ($status==1) $remindObj->class="iconService"; if ($status==2) $remindObj->class="iconPhone"; if ($status==3) $remindObj->class="iconOther"; $remindObj->insert(); } echo json_encode(array('status'=>1,'msg'=>''));die; }else echo json_encode(array('status'=>2,'msg'=>''));die; } function updateCompanyHttp(){ $cid=$this->get_args('cid')?$this->get_args('cid'):0; $companyname=$this->get_args('companyName')?$this->get_args('companyName'):""; $lv21=$this->get_args('lv21')?$this->get_args('lv21'):0; $lv22=$this->get_args('lv22')?$this->get_args('lv22'):0; $lv23=$this->get_args('lv23')?$this->get_args('lv23'):0; $nature=isset($_POST['nature'])?$_POST['nature']:false; $fax=isset($_POST['fax'])?$_POST['fax']:false; $webservice=isset($_POST['webservice'])?$_POST['webservice']:false; $address=isset($_POST['address'])?$_POST['address']:false; $ride=isset($_POST['ride'])?$_POST['ride']:false; $stay=isset($_POST['stay'])?$_POST['stay']:false; $landmarks=isset($_POST['landmarks'])?$_POST['landmarks']:false; if(empty($cid)||empty($companyname)){ echo json_encode(array('status'=>2,'msg'=>''));die; } Doo::loadModel("company"); Doo::loadModel("client"); $client=new client(); $company=new company(); $company->cid=$cid; if(!empty($lv21)&&!empty($lv22)&&!empty($lv23)){ Doo::loadModel ( 'district' ); $district = new district (); //更新公司信息 $lv1=$district->getbyid($lv21); $lv2=$district->getbyid($lv22); $lv3=$district->getbyid($lv23); $company->district=$lv21.",".$lv22.",".$lv23; $company->local=$lv1[0]['name'].",".$lv2[0]['name'].",".$lv3[0]['name']; } if(!empty($companyname)){ $company->companyname=$companyname; $client->companyname=$companyname; } if($fax!==false) $company->fax=$fax; if($webservice!==false){ $company->webservice=$webservice; } if($address!==false) $company->address=$address; if($ride!==false) $company->ride=$ride; if($stay!==false) $company->stay=$stay; if($landmarks!==false) $company->landmarks=$landmarks; $company->update(); $client->update(array('where'=>' companyid ='.$cid)); //标签 $tid = $this->get_args ( 'tagALD' ); Doo::loadModel('tagCompanyNexus'); $strtid=$tid; $tagClient=new tagCompanyNexus(); $tagClientInfo=$tagClient->getTagClientBySCid($cid,$_COOKIE["staff"]); $tagClient->tag=$strtid; if(!empty($tagClientInfo)){ $tagClient->tcid=$tagClientInfo['tcid']; $tagClient->update(); }else{ $tagClient->sid=$_COOKIE["staff"]; $tagClient->company=$cid; $tagClient->insert(); } echo json_encode(array('status'=>1,'msg'=>''));die; } function searchCompanyHttp(){ $searchDbInforItem=$this->get_args('searchDbInforItem')?$this->get_args('searchDbInforItem'):""; if(!empty($searchDbInforItem)){ Doo::loadModel ( 'company' ); $company = new company(); $clientInfo=$company->searchCompany($searchDbInforItem); echo json_encode(array('status'=>1,'companyList'=>$clientInfo));die; }else echo json_encode(array('status'=>2,'companyList'=>''));die; } function changeCompanyHttp(){ $cid=$this->get_args('cid')?$this->get_args('cid'):0; $clientID=$this->get_args('clientID')?$this->get_args('clientID'):0; $companyname=$this->get_args('companyName')?$this->get_args('companyName'):""; Doo::loadModel ( 'company' ); Doo::loadModel ( 'client' ); $client = new client(); $company = new company(); $companyname=explode("-", $companyname); if(isset($companyname[1])) $k=$company->getCompanyByName($companyname[0], $companyname[1]); else $k=array(); if(!empty($cid)&&!empty($k)&&!empty($clientID)){ $client->cid=$clientID; $client->companyid=$cid; $client->companyname=$companyname[0]; $client->update(); }else{ $local1=$this->get_args('lv21')?$this->get_args('lv21'):0; $local2=$this->get_args('lv22')?$this->get_args('lv22'):0; $local3=$this->get_args('lv23')?$this->get_args('lv23'):0; Doo::loadModel ('district'); $district = new district (); //更新公司信息 $lv1=$district->getbyid($local1); $lv2=$district->getbyid($local2); $lv3=$district->getbyid($local3); if(empty($local1)||empty($local2)){ echo json_encode(array('status'=>2,'msg'=>''));die; } if(!empty($local1)&&!empty($local2)) $company->local=$lv1[0]['name'].",".$lv2[0]['name'].",".$lv3[0]['name']; if(!empty($local1)&&!empty($local2)) $company->district=$local1.",".$local2.",".$local3; $nature=$this->get_args('nature')?$this->get_args('nature'):""; $fax=$this->get_args('fax')?$this->get_args('fax'):""; $webservice=$this->get_args('webservice')?$this->get_args('webservice'):""; $address=$this->get_args('address')?$this->get_args('address'):""; $landmarks=$this->get_args('landmarks')?$this->get_args('landmarks'):""; $stay=$this->get_args('stay')?$this->get_args('stay'):""; $ride=$this->get_args('ride')?$this->get_args('ride'):""; //$nature=implode(",", $nature); $company->companyname=$companyname[0]; $company->ride=$ride; $company->fax=$fax; $company->webservice=$webservice; $company->address=$address; $company->landmarks=$landmarks; $company->stay=$stay; $company->nature=$nature; $cid=$company->insert(); $client->cid=$clientID; $client->companyid=$cid; $client->companyname=$companyname[0]; $client->update(); } echo json_encode(array('status'=>1,'msg'=>''));die; } function getProudctHttp(){ Doo::loadModel('product'); $product=new product(); $product=$product->getProudct(); echo json_encode(array('status'=>1,'product'=>$product)); } function getClientHttp(){ $searchDbInforItem=$this->get_args('searchDbInforItem')?$this->get_args('searchDbInforItem'):""; if(!empty($searchDbInforItem)){ Doo::loadModel ( 'client' ); $client = new client(); $clientInfo=$client->getClientByName($searchDbInforItem); echo json_encode(array('status'=>1,'client'=>$clientInfo)); }else echo json_encode(array('status'=>2,'client'=>array())); } function getLongleHttp(){ $searchDbInforItem=$this->get_args('searchDbInforItem')?$this->get_args('searchDbInforItem'):""; if(!empty($searchDbInforItem)){ Doo::loadModel ( 'longle' ); $longle = new longle(); $longleInfo=$longle->getLongleBykeynum2($searchDbInforItem); echo json_encode(array('status'=>1,'longle'=>$longleInfo)); }else{ echo json_encode(array('status'=>2,'longle'=>array())); } } function getLongleIdHttp(){ $id=$this->get_args('id')?$this->get_args('id'):""; if(!empty($id)){ Doo::loadModel ( 'longle' ); $longle = new longle(); $longleInfo=$longle->getOne(array('where'=>'lid ='.$id,'asArray'=>true)); echo json_encode(array('status'=>1,'longle'=>$longleInfo)); }else{ echo json_encode(array('status'=>2,'longle'=>array())); } } function addLockLogHttp(){ Doo::loadModel ( 'longle_log' ); Doo::loadModel ( 'longle' ); Doo::loadModel("action_log"); Doo::loadModel ( 'client' ); $clientobj = new client (); $longle = new longle (); $longle_log = new longle_log (); Doo::loadModel ( 'district' ); $district = new district (); Doo::loadModel ( 'staff' ); $staff = new staff (); $status=$this->get_args('longleStatus')?$this->get_args('longleStatus'):0; $lid=$this->get_args('klid')?$this->get_args('klid'):0; if(empty($lid)){ echo json_encode(array('status'=>2,'msg'=>''));die; } $linfo=$longle->getLongleByLid($lid); $this->staff=$staff->find(array('where'=>'sid='.$_COOKIE["staff"],'asArray'=>true)); if($status==0){ echo json_encode(array('status'=>2,'msg'=>''));die; }elseif($status==3){ $client=$this->get_args('browseClient')?$this->get_args('browseClient'):""; $client=explode('-', $client); $product=isset($_POST['browseProduct'])?$_POST['browseProduct']:""; $clientname=$clientobj->getClientByName2($client[0],$client[1]); if(empty($clientname)){ echo json_encode(array('status'=>2,'msg'=>''));die; } if($client[0]!=""){ $longle->client=$client[0]; $longle->clientid=$clientname[0]['cid']; } // if($product!="") // $longle->product=$product; $longle->statusT="借出"; $longle_log->client=$client[0]; $longle_log->clientid=$clientname[0]['cid']; $longle_log->product=$linfo[0]['product']; $longle_log->statusT="借出"; //日常行为 $action_log=new action_log(); $action_log->action=$this->staff[0]['category'].''.$this->staff[0]['username'].'借出'.$linfo[0]['key_num'].''.$client[0].'('.$clientname[0]['companyname'].')'; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->updatetime=date("Y-m-d"); $action_log->time=date("H:i"); $action_log->status=4; $action_log->districtid=$clientname[0]['district']; $local=$district->getbyidlist($clientname[0]['district']); $action_log->city=$local[0]['name']; $action_log->province=$local[1]['name']; $action_log->company=$clientname[0]['companyname']; Doo::loadModel('company'); $company=new company(); $companyInfo=$company->getOne(array('where'=>' companyname="'.$clientname[0]['companyname'].'"','asArray'=>true)); $nature=explode(',', $companyInfo['nature']); $action_log->nature=$nature[0]; $action_log->class=$action_log->iconBorrow; $action_log->insert(); }elseif($status==4){ $product=isset($_POST['sellProduct'])?$_POST['sellProduct']:""; $client=isset($_POST['sellClient'])?$_POST['sellClient']:""; $client=explode('-', $client); $clientname=$clientobj->getClientByName2($client[0],$client[1]); if(empty($clientname)){ echo json_encode(array('status'=>2,'msg'=>''));die; } if($client[0]!=""){ $longle->client=$client[0]; $longle->clientid=$clientname[0]['cid']; } // if($product!="") // $longle->product=$product; $longle->statusT="销售"; $longle_log->client=$client[0]; $longle_log->clientid=$clientname[0]['cid']; $longle_log->product=$linfo[0]['product']; $longle_log->statusT="销售"; //日常行为 $action_log=new action_log(); $action_log->action=$this->staff[0]['category'].''.$this->staff[0]['username'].'销售'.$linfo[0]['key_num'].''.$client[0].'('.$clientname[0]['companyname'].')'; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->updatetime=date("Y-m-d"); $action_log->time=date("H:i"); $action_log->status=5; $action_log->districtid=$clientname[0]['district']; $local=$district->getbyidlist($clientname[0]['district']); $action_log->city=$local[0]['name']; $action_log->province=$local[1]['name']; $action_log->company=$clientname[0]['companyname']; Doo::loadModel('company'); $company=new company(); $companyInfo=$company->getOne(array('where'=>' companyname="'.$clientname[0]['companyname'].'"','asArray'=>true)); $nature=explode(',', $companyInfo['nature']); $action_log->nature=$nature[0]; $action_log->class=$action_log->iconSell; $action_log->insert(); }elseif($status==5){ $product=isset($_POST['newProduct'])?$_POST['newProduct']:""; if($product!="") $longle->product=$linfo[0]['product']."+".$product; $longle->statusT="升级"; $longle_log->product=$linfo[0]['product']."+".$product; $longle_log->statusT="升级"; $longle_log->client=$linfo[0]['client']; $longle_log->clientid=$linfo[0]['clientid']; $clientname=$clientobj->getOne( array ('where' => "cid= '".$linfo[0]['clientid']."'",'asArray' => TRUE)); //日常行为 $action_log=new action_log(); $action_log->action=$this->staff[0]['category'].''.$this->staff[0]['username'].''.$linfo[0]['client'].'('.$clientname['companyname'].')升级为'.$linfo[0]['key_num'].''; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->updatetime=date("Y-m-d"); $action_log->time=date("H:i"); $action_log->class=$action_log->iconUpdate; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->status=7; $action_log->insert(); }elseif($status==6){ $key_num=isset($_POST['key_num'])?$_POST['key_num']:""; $key_num2=explode("-", $key_num); $key_num=$key_num2[0]."-".$key_num2[1]; //if($key_num!="") // $longle->key_num=$key_num; //新锁拷贝记录 $newLongle=new longle(); $newLongle->product=$linfo[0]['product']; $newLongle->statusT="更换"; $newLongle->status=6; $newLongle->client=$linfo[0]['client']; $newlid=$newLongle->update(array('where'=>' key_num= \''.$key_num."'")); $longleinfo=$longle->getOne(array('where'=>' key_num =\''.$key_num."'",'asArray'=>true)); //新记录日志 $newlongle_log=new longle_log(); $newlongle_log->statusT="更换"; $newlongle_log->status=6; $newlongle_log->client=$linfo[0]['client']; $newlongle_log->new_key_num=$linfo[0]['key_num']; $newlongle_log->product=$linfo[0]['product']; $newlongle_log->category=$this->staff[0]['category']; $newlongle_log->dateline=date("Y-m-d"); $newlongle_log->operator=$this->staff[0]['username']; $newlongle_log->lid=$longleinfo['lid']; $newlongle_log->insert(); //新锁状态拷贝 $longle->statusT="更换"; $longle_log->new_key_num=$key_num; $longle_log->statusT="更换"; $longle_log->client=$linfo[0]['client']; $clientname=$clientobj->getOne( array ('where' => "cid= '".$linfo[0]['clientid']."'",'asArray' => TRUE)); //日常行为 $action_log=new action_log(); $action_log->action=$this->staff[0]['category'].''.$this->staff[0]['username'].''.$linfo[0]['client'].'('.$clientname['companyname'].')更换为'.$key_num.'('.$linfo[0]['key_num'].')'; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->updatetime=date("Y-m-d"); $action_log->time=date("H:i"); $action_log->class=$action_log->iconReplace; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->status=8; $action_log->insert(); }elseif($status==7){ $longle->statusT="收回"; $longle_log->statusT="收回"; $longle_log->responsible=$linfo[0]['responsible']; //日常行为 $action_log=new action_log(); $action_log->action=$this->staff[0]['category'].''.$this->staff[0]['username'].'收回'.$linfo[0]['client'].''.$linfo[0]['key_num'].'通过'.$linfo[0]['responsible'].''; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->updatetime=date("Y-m-d"); $action_log->time=date("H:i"); $action_log->class=$action_log->iconRecycle; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->status=9; $action_log->insert(); }elseif($status==8){ $mark=isset($_POST['mark'])?$_POST['mark']:""; $longle_log->mark=$mark; //日常行为 $action_log=new action_log(); $action_log->action=$this->staff[0]['category'].''.$this->staff[0]['username'].''.$linfo[0]['key_num'].'添加新备注。'; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->updatetime=date("Y-m-d"); $action_log->time=date("H:i"); $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->status=10; $action_log->class=$action_log->iconLock; $action_log->insert(); }elseif($status==9){ $longle->statusT="赠送"; $longle_log->statusT="赠送"; $client=isset($_POST['giftClient'])?$_POST['giftClient']:""; $client=explode('-', $client); $clientname=$clientobj->getClientByName2($client[0],$client[1]); if(empty($clientname)){ echo json_encode(array('status'=>2,'msg'=>''));die; } if($client[0]!=""){ $longle->client=$client[0]; $longle->clientid=$clientname[0]['cid']; } $longle_log->client=$client[0]; $longle_log->clientid=$clientname[0]['cid']; //日常行为 $action_log=new action_log(); $action_log->action=$this->staff[0]['category'].''.$this->staff[0]['username'].'赠送'.$linfo[0]['key_num'].''.$client[0].'('.$clientname[0]['companyname'].')'; $action_log->updatetime=date("Y-m-d"); $action_log->time=date("H:i"); $action_log->class=$action_log->iconRecycle; $action_log->sid=$this->staff[0]['sid']; $action_log->cid=$this->staff[0]['cid']; $action_log->status=6; $action_log->districtid=$clientname[0]['district']; $local=$district->getbyidlist($clientname[0]['district']); $action_log->city=$local[0]['name']; $action_log->province=$local[1]['name']; $action_log->company=$clientname[0]['companyname']; Doo::loadModel('company'); $company=new company(); $companyInfo=$company->getOne(array('where'=>' companyname="'.$clientname[0]['companyname'].'"','asArray'=>true)); $nature=explode(',', $companyInfo['nature']); $action_log->nature=$nature[0]; $action_log->insert(); } //记录使用过的状态 $statuslog=$status.",".$linfo[0]['statuslog']; $ar=explode(',', $statuslog); $statuslog=implode(',', array_unique(array_filter($ar))); $longle->statuslog=$statuslog; if($linfo[0]['status']<=2){ if($status>=4&&$status<=2){ echo json_encode(array('status'=>1,'msg'=>''));die; } } if($lid!=0){ $longle->lid=$lid; if($status!=8) $longle->status=$status; //if($status!=8) $longle->responsible=$this->staff[0]['username']; $longle->update(); } $longle_log->lid=$lid; $longle_log->status=$status; $longle_log->operator=$this->staff[0]['username']; //责任人 $longle_log->category=$this->staff[0]['category']; $longle_log->dateline=date("Y-m-d"); $longle_log->insert(); echo json_encode(array('status'=>1,'msg'=>''));die; } function getClientByPhoneHttp(){ $phone = $this->get_args('phone') ? $this->get_args('phone') : ''; if(!empty($phone)){ Doo::loadModel ( 'client' ); $client = new client (); Doo::loadModel('district'); $district=new district(); $con=""; if(preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$phone)||preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$phone)){ $con='telephone like "%'.$phone.'"'; }elseif(preg_match("/^(0(10|21|22|23|[1-9][0-9]{2})(-|))?[0-9]{7,8}$/",$phone)){ if(strlen ($phone)==10){ $phone=substr($phone, 3); $con='phone like "%'.$phone.'"'; }elseif (strlen ($phone)==11){ $phone=substr($phone, 4); $con='phone like "%'.$phone.'"'; }elseif (strlen ($phone)==12){ $phone=substr($phone, 5); $con='phone like "%'.$phone.'"'; }else{ $con='telephone like "%'.$phone.'" or phone like "%'.$phone.'"'; } }else{ $con='telephone like "%'.$phone.'" or phone like "%'.$phone.'"'; } $info=$client->getOne(array('where'=>$con,'asArray'=>true)); $d=$district->find(array('select'=>'name','where'=>'id in('.$info['district'].')','asArray'=>true)); $info['local']=$d; echo json_encode(array('status'=>1,'info'=>$info));die; } echo json_encode(array('status'=>2,'info'=>''));die; } function informationHttp(){ $sid=$this->get_args('sid')?$this->get_args('sid'):0; $DATE=$this->get_args('date')?$this->get_args('date'):date("Y-m-d"); //$month=$this->get_args('month')?$this->get_args('month'):date('m'); $status=$this->get_args('status')?$this->get_args('status'):0; Doo::loadModel('action_log'); $action_log=new action_log(); Doo::loadModel ( 'staff' ); $staff = new staff (); Doo::loadModel('client_staff'); $client_staff=new client_staff(); Doo::loadModel('longle'); $longle=new longle(); Doo::loadModel('L_category'); $lcategory = new L_category (); $condition="";$limit=50; if(!empty($sid)) $condition.=" and sid=".$sid; if (!empty($status)) $condition.=" and status in (".$status.")"; $actionLogList=$action_log->find(array('where'=>' 1 '.$condition.' and date(updatetime) >= date_sub("'.$DATE.'",interval 30 day) and date(updatetime) <= date_sub("'.$DATE.'",interval 0 day) ','desc'=>'aid','asArray'=>true)); //抽取日期 ,'groupby'=>'updatetime' $dateLog=$action_log->find(array('select'=>'updatetime','where'=>' 1 '.$condition.' and date(updatetime) >= date_sub("'.$DATE.'",interval 30 day) and date(updatetime) <= date_sub("'.$DATE.'",interval 0 day) ','limit'=>50,'desc'=>'aid','asArray'=>true)); $count=$action_log->count(array('where'=>' 1 '.$condition,'limit'=>$limit,'asArray'=>true)); $dl=array(); foreach ($dateLog as $value){ array_push($dl, $value['updatetime']); } $dateLog=array_unique($dl); $log=array(); foreach ($dateLog as $key=>$value){ $log[$value]=array(); foreach ($actionLogList as $k=>$v){ if($value==$v['updatetime']){ array_push($log[$value], $v); unset($actionLogList[$k]); } } } $i=0; foreach ($log as $key=>$value){ if (empty($value)) unset($log[$key]); if($i>=3) unset($log[$key]); $i++; } echo json_encode(array('status'=>1,'count'=>$count,'list'=>$log));die; } function communicationHttp(){ Doo::loadModel ( 'staff' ); $staff = new staff (); $list=$staff->find(array ('where' => "username!= 'admin'", 'asArray' => TRUE )); echo json_encode(array('status'=>1,'list'=>$list));die; } function getStaffHttp(){ $sid=$this->get_args('sid')?$this->get_args('sid'):0; Doo::loadModel ( 'staff' ); $staff = new staff (); if (!empty($sid)){ $info=$staff->getOne(array ('where' => "username!= 'admin' and sid='".$sid."'", 'asArray' => TRUE )); $colleague=$staff->find(array ('where' => "cid= '".$info['cid']."' and sid!='".$info['sid']."'", 'asArray' => TRUE )); array_push($colleague, $info); echo json_encode(array('status'=>1,'list'=>$colleague));die; } echo json_encode(array('status'=>2,'list'=>array()));die; } function getUserHttp(){ $sid=$this->get_args('sid')?$this->get_args('sid'):0; Doo::loadModel ( 'staff' ); $staff = new staff (); if (!empty($sid)){ $info=$staff->getOne(array ('where' => "username!= 'admin' and sid='".$sid."'", 'asArray' => TRUE )); echo json_encode(array('status'=>1,'list'=>$info));die; } echo json_encode(array('status'=>2,'list'=>array()));die; } function editStaffHttp(){ $telephone=$this->get_args('telephone')?$_POST['telephone']:0; $phone=$this->get_args('phone')?$_POST['phone']:0; $email=isset($_POST['email'])?$_POST['email']:""; $qq=is_numeric($this->get_args('qq'))?$_POST['qq']:0; $year=$this->get_args('year')?$_POST['year']:date("Y"); $month=$this->get_args('month')?$_POST['month']:""; $day=$this->get_args('day')?$_POST['day']:""; $position=$this->get_args('position')?$_POST['position']:""; $gender=$this->get_args('gender')?$_POST['gender']:"男"; $oldpassword=isset($_POST['oldpassword'])?$_POST['oldpassword']:""; $newpassword=isset($_POST['newpassword'])?$_POST['newpassword']:""; $rnewpassword=isset($_POST['rnewpassword'])?$_POST['rnewpassword']:""; Doo::loadModel ( 'staff' ); $staff = new staff (); Doo::loadModel ( 'staffDynamic' ); $staffDynamic=new staffDynamic(); $this->staff=$staff->find(array ('where' => "sid='".$_COOKIE["staff"]."'", 'asArray' => TRUE )); $staff->sid=$this->staff[0]['sid']; $content="";$ext="更新了他的"; if($telephone!=0&&$this->staff[0]['telephone']!=$telephone){ $staff->telephone=$telephone; $content.="手机 "; } if($phone!=0&&$this->staff[0]['phone']!=$phone){ $staff->phone=$phone; $content.="电话 "; } if($qq!=0&&$this->staff[0]['qq']!=$qq){ $staff->qq=$qq; $content.="QQ "; } if($year!=2014){ $staff->birthday=$year."-".$month."-".$day; $content.="生日 "; } if($email!=""&&filter_var($email, FILTER_VALIDATE_EMAIL)&&$this->staff[0]['email']!=$email){ $staff->email=$email; $content.="邮箱 "; } if (!empty($position)){ $staff->position=$position; $content.="职位 "; } $staff->gender=$gender; $msg="更新成功"; if($this->staff[0]['passwork']==md5($oldpassword)){ if($newpassword==$rnewpassword&&(!empty($newpassword))) $staff->passwork=md5($newpassword); else $msg="密码不一致"; }else{ if($oldpassword!="") $msg="密码错误"; } if (!empty($content)){ $staffDynamic->content=$ext.$content; $staffDynamic->cid=$this->staff[0]['cid']; $staffDynamic->category=$this->staff[0]['category']; $staffDynamic->time=time(); $staffDynamic->sid=$this->staff[0]['sid']; $staffDynamic->staff=$this->staff[0]['username']; $staffDynamic->insert(); } $fileName='avatar_'.$this->staff[0]['sid']; $t=DOO::conf()->SITE_PATH."global/avatar/"; if(isset($_FILES['photo100'])){ $file = $_FILES['photo100']['tmp_name']; if (is_uploaded_file($file) ){ $upload_file ='avatar_'.$this->staff[0]['sid']."_1.jpg"; move_uploaded_file($file, $t.$upload_file); } } if(isset($_FILES['photo50'])){ $file2 = $_FILES['photo50']['tmp_name']; if (is_uploaded_file($file2) ){ $upload_file ='avatar_'.$this->staff[0]['sid']."_2.jpg"; move_uploaded_file($file2, $t.$upload_file); } } if(isset($_FILES['photo32'])){ $file3 = $_FILES['photo32']['tmp_name']; if (is_uploaded_file($file3) ){ $upload_file ='avatar_'.$this->staff[0]['sid']."_3.jpg"; move_uploaded_file($file3, $t.$upload_file); } } //echo $_FILES['photo50']['tmp_name']; //var_dump($_FILES['photo32']['tmp_name']); $staff->avatar="/global/avatar/".$fileName; $staff->update(array('where'=>' sid='.$this->staff[0]['sid'])); //phpinfo(); echo json_encode(array('status'=>1,'msg'=>''));die; } function getRemindHttp(){ Doo::loadModel('remind'); $remind=new remind(); //Doo::loadModel ( 'client' ); //$client = new client(); // and date_add(time, INTERVAL day DAY) <= CURDATE() $remindList=$remind->find(array('where' => "staffID = '".$_COOKIE["staff"]."' and status=0 ",'asc'=>'date_add(time, INTERVAL day DAY)','asArray' => TRUE)); $rc=0; foreach ($remindList as $key=>$value){ $a=strtotime($value['time']." +".$value['day']." days"); $b=strtotime(date('y-m-d')); if ($a<=$b){ $rc++; $remindList[$key]['isRemind']=1; }else $remindList[$key]['isRemind']=0; //$remindList[$key]['clientInfo']=$client->getOne(array('where' => "cid = '".$value["clientID"]."'",'asArray' => TRUE)); $remindList[$key]['Ctime']=date('m-d',strtotime($value['time'])); $remindList[$key]['Etime']=date('m-d',strtotime($value['time']." +".$value['day']." days")); } echo json_encode(array('status'=>1,'remindList'=>$remindList,'remindCount'=>$rc,'msg'=>''));die; } function remindCLHttp(){ $rid=$this->get_args('rid')&&is_numeric($this->get_args('rid'))?$this->get_args('rid'):0; if (!empty($rid)){ Doo::loadModel('remind'); $remind=new remind(); $remind->status=1; $remind->update(array('where' => "staffID = '".$_COOKIE["staff"]."' and rid=".$rid,'asArray' => TRUE)); echo json_encode(array('status'=>1,'msg'=>''));die; } echo json_encode(array('status'=>2,'msg'=>''));die; } /** * 获取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; } } /** * 获取总页数 * @param unknown_type $table * @param unknown_type $condition */ public function getTableCount($table = "", $condition = "",$staffid="",$search,$tooltip,$cateid) { if (!empty($staffid)){ //$staffid="and a.sid= '".$staffid."'"; " . $table . " as a left join on (a.cid=b.cid ".$staffid.") $sql = "select count(*) as count from CLD_client as b left join CLD_tag_client as c on (b.cid=c.client) where 1 " . $condition ; }else{ if(strlen($condition)==1||empty($condition)) $sql = "select count(*) as count from CLD_client as a ".$condition; else $sql = "select count(*) as count from CLD_tag_client as a left join CLD_client as c on (a.client=c.cid) where 1 ".$condition; } if(!empty($search)) $sql = "select count(*) as count from CLD_client as a where 1 ".$condition ; if(!empty($tooltip)){ $condition=str_replace("a.","c.",$condition); $sql = "select count(*) as count from CLD_C_tooltip as a left join CLD_tag_client as c on (a.cid=c.client) left join CLD_client as b on (c.client=b.cid ) where a.name like '%".$tooltip."%' and a.cateid = ".$cateid." ".$condition ; } //echo $sql; $query = Doo::db ()->query ( $sql ); $result = $query->fetch (); return $result ['count']; } /* * 生成WSDL文件 */ function interfaceDetail(){ Doo::loadClass("MobileApi/Service"); } function login($user,$pw){ Doo::loadModel ( 'staff' ); $staff = new staff (); if(!empty($pw)){ $userinfo=$staff->checkUser($user,$pw); if(!empty($userinfo)){ setcookie("staff", $userinfo[0]['sid'], time()+36000,"/"); return array('status'=>1,'msg'=>'登陆成功','userList'=>$userinfo); }else return array('status'=>2,'msg'=>'账号或密码不正确2','userList'=>array()); }else return array('status'=>2,'msg'=>'账号或密码不正确3','userList'=>array()); } function register($username, $gameid, $fromurl, $advertiser, $adfrom, $pagetype, $pagename, $tgid, $ip, $registertime) { $param = array( 'tg_account' => $username, 'tg_gameID' => $gameid, 'tg_advertiser' => $fromurl, 'tg_adFrom'=>$advertiser, 'tg_pageParam' => $adfrom, 'tg_adType' => $pagetype, 'tg_adsID' => $tgid, 'tg_ip' => $tgid, 'tg_registerTime' => $registertime ); return $param; } public function service(){ ini_set("soap.wsdl_cache_enabled", "0"); $server = new SoapServer('protected/class/MobileApi/interfaceDetail.wsdl', array('soap_version' => SOAP_1_2)); $server->setClass("MobileController"); $server->addFunction(array('login','register')); $server->addFunction(SOAP_FUNCTIONS_ALL); $server->handle(); } } ?>