// +---------------------------------------------------------------------- namespace app\admin\controller; use think\Db; use think\Validate; use think\Request; use think\captcha\Captcha; class Feedback extends Base { public function fdlist() { $where=[]; $db=Db::name('feedback'); $account=input('account'); $org=input('org'); $tel=input('tel'); $platform=input('platform'); $startdate=input('startdate'); $enddate=input('enddate'); $target=input('target'); $this->assign('account',$account); $this->assign('org',$org); $this->assign('tel',$tel); $this->assign('platform',$platform); $this->assign('startdate',$startdate); $this->assign('enddate',$enddate); $this->assign('target',$target); if($account){ $db->where('account','like',['%'.$account.'%',$account.'%']); } if($tel){ $db->where('tel','like',['%'.$tel.'%',$tel.'%']); } if($org){ $db->where('org','like',['%'.$org.'%',$org.'%']); } if($target){ $db->where('target','like',['%'.$target.'%',$target.'%']); } if($platform){ $db->where('platform','like',['%'.$platform.'%',$platform.'%']); } if($startdate&&empty($enddate)){ $db->where('create_time','>=',strtotime($startdate)); }else if($enddate&&empty($startdate)){ $db->where('create_time','<=',strtotime($enddate." 11:59:59")); }else if($enddate&&$startdate){ $db->where('create_time',['>=',strtotime($startdate)],['<=',strtotime($enddate." 11:59:59")],'and'); } $docs =$db->order("id desc")->select(); //echo $db->getLastSql();exit; foreach ($docs as &$doc){ $doc['color']='text-primary'; if($doc['state']==1){ $cur=time(); $create=$doc['create_time']; $time=$cur-$create; if($time>3600*3&&$time<3600*6){ $doc['color']='text-warning'; }else if($time>=3600*6){ $doc['color']='text-danger'; } } if($doc['state']==1)$doc['state']='未处理客诉'; if($doc['state']==2)$doc['state']='处理中客诉'; if($doc['state']==3)$doc['state']=' 已处理客诉'; if($doc['score']==1)$doc['score']='非常满意'; if($doc['score']==3)$doc['score']='基本满意'; if($doc['score']==2)$doc['score']='满意'; } $this->assign('fdlist', $docs); return $this->view->fetch(); } public function edit(){ $id = input('id',''); $remark = input('remark',''); $state=input('state','','intval'); $doc = Db::name('feedback')->where('id', $id)->find(); $remarks=$doc['remarks']; try { $remarks=json_decode($remarks,true); } catch (Exception $e) { } if(!is_array($remarks))$remarks=[]; $remarks[$state]=$remark; /* if($state==3){ $tels=array('complaint'); if(count($tels)){ foreach ($tels as $tel){ $token=md5('szwjs_'.$id); $href=url('home/feedback/review',['token'=>$token,'id'=>$id],false,true); send_sms($tel,'深圳文化产权交易所有限公司:这次处理的满意度:非常满意、基本满意、不满意!谢谢!回复网址'); } } } */ $query = Db::name('feedback')->where('id', $id)->update(['state'=>$state,'remarks'=>json_encode($remarks)]); if($query){ $this->success('提交成功',url('fdlist')); }else{ $this->error('提交失败'); } } public function detail() { $id = input('get.id',''); if(empty($id)) { return $this->view->fetch(); } $doc = Db::name('feedback')->where('id', $id)->find(); if($doc['attach']){ $doc['attach']=htmlspecialchars_decode($doc['attach'],true); try { $doc['attach']=json_decode($doc['attach'],true); } catch (Exception $e) { $doc['attach']=[]; } } $remarks=$doc['remarks']; try { $remarks=json_decode($remarks,true); } catch (Exception $e) { } if(!is_array($remarks))$remarks=[]; $doc['remarks']=$remarks; $this->assign('detail',$doc); return $this->view->fetch(); } public function culist() { $cid=input('cid','1','intval'); $where=[]; $db=Db::name('cultureapply'); $docs =$db->where(['cid'=>$cid])->order("id desc")->select(); //echo $db->getLastSql();exit; foreach ($docs as &$doc){ $doc['create_time']=date("Y-m-d",$doc['create_time']); if($doc['cid']==1){ if($doc['company']==1)$doc['company']='中央政府部门所属机构'; if($doc['company']==2)$doc['company']='国有独资企业'; if($doc['company']==3)$doc['company']='国有控股企业'; if($doc['company']==4)$doc['company']='股份有限公司'; if($doc['company']==5)$doc['company']='有限责任公司'; if($doc['company']==6)$doc['company']='其他'; }else{ if($doc['company']==1)$doc['company']='股份有限公司'; if($doc['company']==2)$doc['company']='有限责任公司'; if($doc['company']==3)$doc['company']='其他企业'; } } $this->assign('fdlist', $docs); return $this->view->fetch(); } public function cudetail() { $id = input('get.id',''); if(empty($id)) { return $this->view->fetch(); } $doc = Db::name('cultureapply')->where('id', $id)->find(); $doc['create_time']=date("Y-m-d",$doc['create_time']); if($doc['cid']==1){ if($doc['company']==1)$doc['company']='中央政府部门所属机构'; if($doc['company']==2)$doc['company']='国有独资企业'; if($doc['company']==3)$doc['company']='国有控股企业'; if($doc['company']==4)$doc['company']='股份有限公司'; if($doc['company']==5)$doc['company']='有限责任公司'; if($doc['company']==6)$doc['company']='其他'; }else{ if($doc['company']==1)$doc['company']='股份有限公司'; if($doc['company']==2)$doc['company']='有限责任公司'; if($doc['company']==3)$doc['company']='其他企业'; } $legal=$doc['legal']; try { $legal=json_decode($legal,true); } catch (Exception $e) { } if(!is_array($legal))$legal=[]; $doc['legal']=$legal; $this->assign('legal',$legal); $org=$doc['org']; try { $org=json_decode($org,true); } catch (Exception $e) { } if(!is_array($org))$org=[]; $doc['org']=$org; $this->assign('org',$org); $cont=$doc['cont']; try { $cont=json_decode($cont,true); } catch (Exception $e) { } if(!is_array($cont))$cont=[]; $doc['cont']=$cont; $this->assign('cont',$cont); $parter=$doc['parter']; try { $parter=json_decode($parter,true); } catch (Exception $e) { } if(!is_array($parter))$parter=[]; $this->assign('parter',$parter); $base=$doc['base']; try { $base=json_decode($base,true); } catch (Exception $e) { } if(!is_array($base))$base=[]; $this->assign('base',$base); $pro=$doc['pro']; try { $pro=json_decode($pro,true); } catch (Exception $e) { } if(!is_array($pro))$pro=[]; $this->assign('pro',$pro); $doc['financefile']=$doc['financefile']?explode(';', $doc['financefile']):[]; $doc['relatedfile']=$doc['relatedfile']?explode(';', $doc['relatedfile']):[]; $this->assign('detail',$doc); return $this->view->fetch(); } }