$tempxyinfo = Addressinfo::getLocationByxy($xytude[0], $xytude[1]); $tempaddress = $tempxyinfo['result']['address_component']; $addressinfo['country'] = $tempaddress['nation']; $addressinfo['province'] = $tempaddress['province']; $addressinfo['city'] = $tempaddress['city']; $addressinfo['district'] = $tempaddress['district']; } else { $tempaddress = Addressinfo::getAddressByIp($_SERVER['REMOTE_ADDR']); $addressinfo['country'] = $tempaddress['country']; $addressinfo['province'] = $tempaddress['province']; $addressinfo['city'] = $tempaddress['city']; $addressinfo['district'] = $tempaddress['district']; SystemTool::systemLog($db, '位置数据跟踪', '没取到位置坐标,用ip取位置信息', $_SERVER['REMOTE_ADDR'] . print_r($_POST, true)); } SystemTool::systemLog($db, '位置数据跟踪', '位置信息', print_r($addressinfo, true)); $clickresult = ClickCount::logClick($db, $contentinfo, $clickOpenid, $shareOpenid, $_SERVER['REMOTE_ADDR'], $clickprice, $addressinfo); switch ($clickresult) { case -1: $db->query("insert into clicklog(`contentid`,`openid`,`shareopenid`,`ip`,`msg`,`isvalid`) values(" . $contentinfo['id'] . ",'" . $clickOpenid . "','" . $shareOpenid . "','" . $_SERVER['REMOTE_ADDR'] . "','重复点击','0')"); $msg = array('result' => false, 'msg' => '重复点击'); echo json_encode($msg); exit; break; case 0: $db->query("insert into clicklog(`contentid`,`openid`,`shareopenid`,`ip`,`msg`,`isvalid`) values(" . $contentinfo['id'] . ",'" . $clickOpenid . "','" . $shareOpenid . "','" . $_SERVER['REMOTE_ADDR'] . "','位置不在分钱范围内','0')"); $msg = array('result' => false, 'msg' => '位置不在分钱范围内'); echo json_encode($msg); exit; break; case -2: $db->query("insert into clicklog(`contentid`,`openid`,`shareopenid`,`ip`,`msg`,`isvalid`) values(" . $contentinfo['id'] . ",'" . $clickOpenid . "','" . $shareOpenid . "','" . $_SERVER['REMOTE_ADDR'] . "','数据插入错误','0')");
SystemTool::systemLog($db, 'content.php', 'empty session openid', 'check openid'); $redirecturl = SITE_DOMAIN . 'content.php?id=' . $contentid; if (!empty($shareopenid)) { $redirecturl .= '&shareopenid=' . $shareopenid; } $redirecturl .= '#' . time(); SystemTool::checkOpenid($db, 'snsapi_userinfo', $redirecturl); exit; } $content = ContentClass::getArticle($db, $contentid); if (empty($content)) { echo '内容不存在或者已删除'; exit; } if (!empty($shareopenid)) { $isclicked = ClickCount::checkisClicked($db, $contentid, $_SESSION['openid'], $shareopenid); } $tempareadata = json_decode($content['city'], true); $data['province'] = $tempareadata['province']; $data['tempcity'] = $tempareadata['city']; $data['district'] = is_array($tempareadata['district']) ? implode(',', $tempareadata['district']) : ''; if (!empty($data['district'])) { $areadata = $data['tempcity'] . '(' . $data['district'] . ')'; } else { if ($data['tempcity'] != 'all') { $areadata = $data['tempcity']; } else { $areadata = $data['province']; } } $pageidx = 'content';