public function attenAction() { $da = $this->get('we_data_access'); $request = $this->getRequest(); $user = $this->get('security.context')->getToken()->getUser(); $atten = $request->get('atten'); $eno = $request->get('eno'); $enterprise = new Enterprise($da, $this->get('logger'), $this->container); $bool = false; if ($atten == '1') { $bool = $enterprise->attenEno($user->getUserName(), $eno); } else { if ($atten == '0') { $bool = $enterprise->cancelatten($user->getUserName(), $eno); } } $re = $bool ? array('s' => 1, 'm' => '') : array('s' => 0, 'm' => '操作失败'); $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'Application/json'); return $response; }