123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836 |
- <?php
- /**
- * @author darkredz
- */
- class MobileController extends DooController {
-
- function __construct() {
-
- // Doo::loadCore ( 'uri/DooUriRouter' );
- // $router = new DooUriRouter ();
- // $routeRs = $router->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 ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
-
- 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", $XDeode->encode ($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 ();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
-
- $staffDetail=$staff->getOne(array('where'=>'sid='.$sid,'asArray'=>true));
-
- if ($page!=1)
- $page=$page*$size-1;
- else
- $page--;
-
- $ClientTagList=$tagClient->getTagClientBySid( $sid);
- $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();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
-
- $staffDetail=$staff->getOne(array('where'=>'sid='.$sid,'asArray'=>true));
-
- if($did==0){
- if ($staffDetail['isadmin'])
- $districtList=$district->get_lvByid(0,$did);
- else
- $districtList=$district->get_lvByStaffid(1,$sid);
- }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 ();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- if (!isset($_COOKIE ["staff"])){
- $sid=0;
- }else{
-
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
- }
-
-
-
- $clientList=$client->getOne(array('where'=>'cid='.$cid,'asArray'=>true));
-
- $companyList=$longleList=$colleague=$serviceLogList=array();$clientCount=array();
- if (!empty($clientList)){
-
- $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='.$sid,'asArray'=>true));
- $ClientTagList=$tagClient->getTagClientBySid( $sid);
- $toollist=array();
- if (!empty($staffDetail))
- $toollist=$cTooltip->find(array('where'=>'cateid='.$staffDetail["cid"],'asArray'=>true));
-
- $companyTagL=$tagCompany->find(array('where'=>'sid='.$sid,'asArray'=>true));
- $CompanyTagList=$tagCompanyNexus->getTagClientBySid( $sid);
- 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 ();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
-
- $staffDetail=$staff->getOne(array('where'=>'sid='.$sid,'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( $sid);
- $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();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
-
- $staffDetail=$staff->getOne(array('where'=>'sid='.$sid,'asArray'=>true));
-
- //标签
- $tid = $this->get_args ( 'tagALD' );
- Doo::loadModel('tag_client');
- //$strtid=implode(",", $tid);
- $strtid=$tid;
-
- $tagClient=new tag_client();
- $tagClientInfo=$tagClient->getTagClientBySCid($cid,$sid);
-
- //$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=$sid;
- $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'].'<b href="javascript:void(0)" onclick="showStaff(\''.$staffDetail['sid'].'\')" >'.$staffDetail['username'].'</b>编辑了<a href="javascript:void(0)" onclick="showClick(\''.$cid.'\')">'.$clientname.'</a>('.$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 ();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
-
- $staffDetail=$staff->getOne(array('where'=>'sid='.$sid,'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'].'<b href="javascript:void(0)" onclick="showStaff(\''.$staffDetail['sid'].'\')">'.$staffDetail['username'].'</b>为<a href="javascript:void(0)" onclick="showClick(\''.$clientInfo['cid'].'\')">'.$clientInfo['clientname'].'</a>('.$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();
-
-
- // 更新信息中心服务日志统计数量
- $redis = new Redis ();
- $redis->connect ( '127.0.0.1', '6379' );
-
- $categoryCondition = " and cid=" . $staffDetail ['cid'];
- $sidCondition = " and sid=" . $staffDetail ['sid'];
- // actionlog免查询值 $alCondition='';
- $alCondition = ' aid>' . REMIT . ' and ';
-
- // 个人服务日志数量redis值
- $redisKeyCS = date ( 'Y-m-d' ) . 'SL_' . $staffDetail ['cid'] . '_' . $staffDetail ['sid'];
- $action_log = new action_log ();
-
- $actionLogLongle = $action_log->find ( array (
- 'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
- 'where' => $alCondition . " status=3 " . $categoryCondition . $sidCondition . " and date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) ",
- 'groupby' => 'date_format(updatetime,"%m-%d")',
- 'asArray' => true
- ) );
-
- $statisticsLongle = array ();
- for($d = 0; $d <= 29; $d ++) {
- $MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
- $falgLongle = true;
-
- foreach ( $actionLogLongle as $value ) {
- if ($value ['updatetime'] == $MD) {
- array_push ( $statisticsLongle, $value ['count'] );
- $falgLongle = false;
- break;
- }
- }
- if ($falgLongle)
- array_push ( $statisticsLongle, 0 );
- }
- $statisticsLongle = array_reverse ( $statisticsLongle );
- $jsl = json_encode ( $statisticsLongle );
- $redis->set ( $redisKeyCS, $jsl );
-
- // 办事处服务日志数量reids值
- $redisKeyC = date ( 'Y-m-d' ) . 'SL_' . $staffDetail ['cid'] . '_';
- $action_log = new action_log ();
- $actionLogLongle = $action_log->find ( array (
- 'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
- 'where' => $alCondition . " status=3 " . $categoryCondition . " and date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) ",
- 'groupby' => 'date_format(updatetime,"%m-%d")',
- 'asArray' => true
- ) );
- $statisticsLongle = array ();
- for($d = 0; $d <= 29; $d ++) {
- $MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
- $falgLongle = true;
-
- foreach ( $actionLogLongle as $value ) {
- if ($value ['updatetime'] == $MD) {
- array_push ( $statisticsLongle, $value ['count'] );
- $falgLongle = false;
- break;
- }
- }
- if ($falgLongle)
- array_push ( $statisticsLongle, 0 );
- }
- $statisticsLongle = array_reverse ( $statisticsLongle );
- $jsl = json_encode ( $statisticsLongle );
- $redis->set ( $redisKeyC, $jsl );
-
- // 全员处服务日志数量的redis值
- $redisKey = date ( 'Y-m-d' ) . 'SL__';
- $action_log = new action_log ();
- $actionLogLongle = $action_log->find ( array (
- 'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
- 'where' => $alCondition . " status=3 and date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) ",
- 'groupby' => 'date_format(updatetime,"%m-%d")',
- 'asArray' => true
- ) );
- $statisticsLongle = array ();
- for($d = 0; $d <= 29; $d ++) {
- $MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
- $falgLongle = true;
-
- foreach ( $actionLogLongle as $value ) {
- if ($value ['updatetime'] == $MD) {
- array_push ( $statisticsLongle, $value ['count'] );
- $falgLongle = false;
- break;
- }
- }
- if ($falgLongle)
- array_push ( $statisticsLongle, 0 );
- }
- $statisticsLongle = array_reverse ( $statisticsLongle );
- $jsl = json_encode ( $statisticsLongle );
- $redis->set ( $redisKey, $jsl );
-
-
-
- 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=$sid;
- 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();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
-
- $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,$sid);
- $tagClient->tag=$strtid;
- if(!empty($tagClientInfo)){
- $tagClient->tcid=$tagClientInfo['tcid'];
- $tagClient->update();
- }else{
- $tagClient->sid=$sid;
- $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 ();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["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='.$sid,'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'].'<b href="javascript:void(0)" onclick="showStaff(\''.$this->staff[0]['sid'].'\')">'.$this->staff[0]['username'].'</b>借出<a href="javascript:void(0)" onclick="showLook(\''.$linfo[0]['key_num'].'\')">'.$linfo[0]['key_num'].'</a>给<a href="javascript:void(0)" onclick="showClick(\''.$clientname[0]['cid'].'\')">'.$client[0].'</a>('.$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){
-
- //$sellClient =
-
- $product=isset($_POST['sellProduct'])?$_POST['sellProduct']:"";
- $client=$this->get_args ( 'sellClient' ) ? $this->get_args ( 'sellClient' ) : "";//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'=>'not found client'));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'].'<b href="javascript:void(0)" onclick="showStaff(\''.$this->staff[0]['sid'].'\')">'.$this->staff[0]['username'].'</b>销售<a href="javascript:void(0)" onclick="showLook(\''.$linfo[0]['key_num'].'\')">'.$linfo[0]['key_num'].'</a>给<a href="javascript:void(0)" onclick="showClick(\''.$clientname[0]['cid'].'\')">'.$client[0].'</a>('.$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'].'<b href="javascript:void(0)" onclick="showStaff(\''.$this->staff[0]['sid'].'\')" >'.$this->staff[0]['username'].'</b>为<a href="javascript:void(0)" onclick="showClick(\''.$linfo[0]['clientid'].'\')">'.$linfo[0]['client'].'</a>('.$clientname['companyname'].')升级为<a href="javascript:void(0)" onclick="showLook(\''.$linfo[0]['key_num'].'\')">'.$linfo[0]['key_num'].'</a>';
- $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'].'<b href="javascript:void(0)" onclick="showStaff(\''.$this->staff[0]['sid'].'\')">'.$this->staff[0]['username'].'</b>为<a href="javascript:void(0)" onclick="showClick(\''.$linfo[0]['clientid'].'\')">'.$linfo[0]['client'].'</a>('.$clientname['companyname'].')更换为<a href="javascript:void(0)" onclick="showLook(\''.$key_num.'\')">'.$key_num.'</a>('.$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'].'<b href="javascript:void(0)" onclick="showStaff(\''.$this->staff[0]['sid'].'\')">'.$this->staff[0]['username'].'</b>收回<a href="javascript:void(0)">'.$linfo[0]['client'].'</a>的<a href="javascript:void(0)" onclick="showLook(\''.$linfo[0]['key_num'].'\')">'.$linfo[0]['key_num'].'</a>通过<a href="javascript:void(0)" onclick="showStaff(\''.$linfo[0]['responsible'].'\')">'.$linfo[0]['responsible'].'</a>';
- $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'].'<b href="javascript:void(0)" onclick="showStaff(\''.$this->staff[0]['sid'].'\')">'.$this->staff[0]['username'].'</b>为<a href="javascript:void(0)" onclick="showLook(\''.$linfo[0]['key_num'].'\')">'.$linfo[0]['key_num'].'</a>添加新备注。';
- $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'].'<b href="javascript:void(0)" onclick="showStaff(\''.$this->staff[0]['username'].'\')">'.$this->staff[0]['username'].'</b>赠送<a href="javascript:void(0)" onclick="showLook(\''.$linfo[0]['key_num'].'\')">'.$linfo[0]['key_num'].'</a>给<a href="javascript:void(0)" onclick="showClick(\''.$clientname[0]['cid'].'\')">'.$client[0].'</a>('.$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();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
-
- $this->staff=$staff->find(array ('where' => "sid='".$sid."'", 'asArray' => TRUE ));
-
- $staff->sid=$this->staff[0]['sid'];
-
- $content="";$ext="更新了他的";
- if($telephone!=0&&$this->staff[0]['telephone']!=$telephone){
- $staff->telephone=$telephone;
- $content.="<b>手机</b> ";
- }
- if($phone!=0&&$this->staff[0]['phone']!=$phone){
- $staff->phone=$phone;
- $content.="<b>电话</b> ";
- }
-
- if($qq!=0&&$this->staff[0]['qq']!=$qq){
- $staff->qq=$qq;
- $content.="<b>QQ</b> ";
- }
- if($year!=2014){
- $staff->birthday=$year."-".$month."-".$day;
- $content.="<b>生日</b> ";
- }
- if($email!=""&&filter_var($email, FILTER_VALIDATE_EMAIL)&&$this->staff[0]['email']!=$email){
- $staff->email=$email;
- $content.="<b>邮箱</b> ";
- }
- if (!empty($position)){
- $staff->position=$position;
- $content.="<b>职位</b> ";
- }
-
- $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::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
-
- //Doo::loadModel ( 'client' );
- //$client = new client();
- // and date_add(time, INTERVAL day DAY) <= CURDATE()
- $remindList=$remind->find(array('where' => "staffID = '".$sid."' 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();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- $sid = $XDeode->decode ( $_COOKIE ["staff"] );
-
- $remind->status=1;
- $remind->update(array('where' => "staffID = '".$sid."' 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();
-
- }
-
- }
- ?>
|