public function microaccount_searchAction() { $conn = $this->get('we_data_access'); $conn_im = $this->get('we_data_access_im'); $userinfo = $this->get('security.context')->getToken()->getUser(); $logger = $this->get("logger"); $getRequest = $this->getRequest(); $MicroAccountMgr = new MicroAccountMgr($conn, $conn_im, $userinfo, $logger, $this->container); $micro_search = $getRequest->get("txtsearch"); $micro = $MicroAccountMgr->microaccount_search($micro_search); return $this->res(json_encode($micro), 'json'); }
public function queryAction() { $request = $this->getRequest(); $da = $this->get("we_data_access"); $currUser = $this->get('security.context')->getToken(); if (!empty($currUser)) { $currUser = $currUser->getUser(); } else { $baseinfoCtl = new \Justsy\BaseBundle\Management\Staff($da, null, $request->get("openid"), $this->get("logger")); $currUser = $baseinfoCtl->getSessionUser(); } $re = array("returncode" => ReturnCode::$SUCCESS); $microAccount = $request->get("microaccount"); $micro_use = $request->get('micro_use'); if ($micro_use != null && $micro_use != 1 && $micro_use != 0) { $re = array("returncode" => ReturnCode::$SYSERROR, 'msg' => '参数micro_use无效'); $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } if (empty($microAccount)) { $re["returncode"] = ReturnCode::$SYSERROR; $re["msg"] = "公众号不能为空"; } else { $mgr = new MicroAccountMgr($da, $this->get("we_data_access_im"), $currUser, $this->get("logger"), $this->container); $mode = $request->get("mode"); $mode = empty($mode) || $mode != 'EXCLUDE-ATTEN' ? false : true; $result = $mgr->microaccount_search($microAccount, $mode, $micro_use); for ($i = 0; $i < count($result); $i++) { $micro_account = $result[$i]["number"]; $group = $mgr->getgrouplist($micro_account); $result[$i]["grouplist"] = $group; } $re["list"] = $result; //var_dump($result); } $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; }