public function loginAction($name) { $cache = new \Justsy\BaseBundle\DataAccess\DACache($this->container); //var_dump($name); $request = $this->get("request"); if (preg_match("/\\/interface(\\/.*)*\$/", $request->server->get("ORIG_PATH_INFO")) || preg_match("/\\/interface(\\/.*)*\$/", $request->server->get("REDIRECT_URL"))) { $re = array(); $re["returncode"] = "0001"; $response = new Response(json_encode($re)); $response->headers->set('Content-Type', 'text/json'); return $response; } else { if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { $error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR); } else { $error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR); } if ($error == null) { $DataAccess = $this->container->get('we_data_access'); // $dataset = $DataAccess->GetData("domain","select domain_name from we_public_domain order by order_num limit 0,10"); $dataset = $cache->get("LoginDomain10", "AllEn"); if (!$dataset) { $dataset = $DataAccess->GetData("domain", "select domain_name from we_public_domain order by order_num limit 0,10"); $arrkeyvalue = array_map(function ($item) { return $item["domain_name"]; }, $dataset["domain"]["rows"]); $cache->set("LoginDomain10", "AllEn", $dataset, array("we_public_domain" => $arrkeyvalue)); } $emials = $dataset["domain"]["rows"]; $huowa = array(); for ($i = 0; $i < count($emials); $i++) { $huowa[] = $emials[$i]["domain_name"]; } $sql = " select * from (select filetype,fileversion,case when filesize is null then '未知' else concat(cast(round(filesize/1024) as char(10)),' KB') end filesize,case filetype when 'Iphone' then 'https://itunes.apple.com/cn/app/fafa/id687237651?mt=8' else fileurl end url,versionmemo\n\t from we_download order by publishdate desc ) a group by filetype"; $f = $DataAccess->GetData("data", $sql, array()); $pc = null; $android = null; $ios = null; for ($i = 0; $i < 3; $i++) { $filetype = $f["data"]["rows"][$i]["filetype"]; if ($filetype == "PC") { $pc = $f["data"]["rows"][$i]; } else { if ($filetype == "Android") { $android = $f["data"]["rows"][$i]; } else { if ($filetype == "Iphone") { $ios = $f["data"]["rows"][$i]; } } } } $start_model = $this->container->getParameter('start_model'); if (!empty($start_model) && $start_model == "MAPP") { return $this->render('JustsyBaseBundle:Login:index_2.html.twig', array('isreg' => "", 'domain' => json_encode($huowa), "pc" => $pc, "android" => $android, "ios" => $ios)); } else { return $this->render('JustsyBaseBundle:Login:index_2.html.twig', array('isreg' => "", 'domain' => json_encode($huowa), "pc" => $pc, "android" => $android, "ios" => $ios)); } } else { $u = $this->get('request')->getSession()->get(SecurityContext::LAST_USERNAME); return $this->render('JustsyBaseBundle:Login:default.html.twig', array('error' => $error, '_user' => $u, 'this' => $this, "code_url" => '')); } } }
public function getRecommendCircle($da, $account) { $cache = new \Justsy\BaseBundle\DataAccess\DACache($this->container); $da = $this->get("we_data_access"); $re = array(); $fileurl = $this->container->getParameter('FILE_WEBSERVER_URL'); $sql = "select a.circle_id,circle_name,a.circle_desc,\n concat('" . $fileurl . "',case trim(logo_path_big) when '' then '' else logo_path_big end) as logo_path_big, \n circle_recommend,b.nick_name,create_staff,\n (select count(*) from we_circle_staff c where c.circle_id=a.circle_id) as cnt,\n case ifnull(c.circle_id,'') when '' then '0' else '1' end as isjoin\n from we_circle a left join we_staff b on a.create_staff=b.login_account\n left join we_circle_staff c on a.circle_id=c.circle_id and c.login_account=?\n where enterprise_no is null and join_method='0' and 0+a.circle_id>10000 \n and not exists(select 1 from we_circle_staff wcs where wcs.circle_id=a.circle_id and wcs.login_account=?)\n and not exists(select 1 from we_apply wa where wa.recv_type='c' and wa.recv_id=a.circle_id and wa.account=?)\n and circle_recommend is not null\n order by circle_recommend desc, a.create_date"; // $ds = $da->GetData('we_circle',$sql,array((string)$account,(string)$account,(string)$account)); $ds = $cache->get("getRecommendCircle", $account); if (!$ds) { $ds = $da->GetData('we_circle', $sql, array((string) $account, (string) $account, (string) $account)); $cache->set("getRecommendCircle", $account, $ds, array()); //不设置依赖表,相当于30分钟才更新一次 } if ($ds && $ds['we_circle']['recordcount'] > 0) { $re = $ds['we_circle']; } else { $re = array('rows' => array(), 'recordcount' => 0); } return $re; }