Exemplo n.º 1
0
    $htmlNode .= "    <meta charset='utf-8'>\r\n                      <meta name='viewport' content='initial-scale=1, maximum-scale=1, user-scalable=no'>\r\n                      <meta name='format-detection' content='telephone=no'>\r\n                      <title>" . $task_name . "</title>\r\n                      <link rel='stylesheet' href='../frozenui/css/frozen.css'>\r\n                  </head>";
    $htmlNode .= "<body ontouchstart='' style='background-image: url(../frozenui/img/h5BG3.png)'>";
    $htmlNode .= "<header class='ui-header ui-header-positive ui-border-b'>\r\n                      <h1>抱歉,这次签到未成功</h1>\r\n                  </header>";
    $htmlNode .= "<section class='ui-container ui-center' style='margin-top: 20%'>";
    $htmlNode .= "<div class='ui-avatar-lg'>\r\n                      <span style='background-image:url(" . $avatar . ")'></span>\r\n                  </div>";
    $htmlNode .= "<div class='okToast'>\r\n                      <img src='../frozenui/img/warning.png'>\r\n                  </div>";
    $htmlNode .= " <div class='ui-whitespace'>\r\n                       <p class='ui-txt-highlight'>Sorry~ " . $userName . ",请再试一次!</p>\r\n                   </div>";
    $htmlNode .= "</section>\r\n                  <script src='../frozenui/lib/zepto.min.js'></script>\r\n                  <script src='../frozenui/js/frozen.js'></script>\r\n                  </body>\r\n                  </html>";
    echo $htmlNode;
    exit;
} else {
    $postDataArr = array('ticket' => $ticket);
}
$postDataJson = json_encode($postDataArr);
$postUrl = 'https://qyapi.weixin.qq.com/cgi-bin/shakearound/getshakeinfo?access_token=' . $accessToken;
$iBeaconAndUserInfo = $wxApi->getiBeaconAndUserInfo($postUrl, $postDataJson);
$iBeaconAndUserInfoObj = json_decode($iBeaconAndUserInfo, true);
//获得对象格式的设备及用户
$getData = $iBeaconAndUserInfoObj['data'];
if (!empty($getData['openid'])) {
    //将openid转化为userid
    $openid = $getData['openid'];
    //echo $openid;
    $transUrl = "https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_userid?access_token=" . $accessToken;
    $requesDataArr = array("openid" => $openid);
    $requesDataJson = json_encode($requesDataArr);
    $useridInfo = $wxApi->openidToUserid($transUrl, $requesDataJson);
    $useridArr = json_decode($useridInfo, true);
    $userid = $useridArr['userid'];
} else {
    $userid = $getData['userid'];