Esempio n. 1
0
 public static function tokenAction($container, $con, $appid, $openid, $encrypt)
 {
     $da = $con;
     //$result = Utils::do_post_request("http://www.wefafa.com", array());
     $sql = "select appkey from we_appcenter_apps where appid=?";
     $ds = $da->GetData("t", $sql, array((string) $appid));
     $result = "";
     if (count($ds["t"]["rows"]) == 0) {
         $json = array("error" => "invalid appid");
     } else {
         $appkey = $ds["t"]["rows"][0]["appkey"];
         $sql = "select 1 from we_staff_account_bind a,we_staff b where a.bind_account=b.openid and a.bind_account=? and a.appid=?";
         $ds = $da->GetData("tb", $sql, array((string) $openid, (string) $appid));
         if (count($ds["tb"]["rows"]) > 0) {
             $api = new \Justsy\OpenAPIBundle\Controller\ApiController();
             $api->setContainer($container->container);
             $code = md5($appid . $appkey);
             $json = $api->getProxySession($appid, $code, "394usjf0sd");
         } else {
             $json = array("error" => "not bind");
         }
     }
     return $json;
 }