|
|
|
@ -958,4 +958,54 @@ class PromoteService {
|
|
|
|
|
|
|
|
|
|
return M('promote', 'tab_')->add($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getLandingPageIdentifier($url)
|
|
|
|
|
{
|
|
|
|
|
$code = $this->getUrlParam($url, 'code');
|
|
|
|
|
if ($code === null) {
|
|
|
|
|
$pid = $this->getUrlParam($url, 'gid');
|
|
|
|
|
$gid = $this->getUrlParam($url, 'pid');
|
|
|
|
|
if ($gid === null || $gid === null) {
|
|
|
|
|
return null;
|
|
|
|
|
} else {
|
|
|
|
|
return $gid . '-' . $pid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDownloadIdentifier($url)
|
|
|
|
|
{
|
|
|
|
|
$code = $this->getUrlParam($url, 'code');
|
|
|
|
|
if ($code === null) {
|
|
|
|
|
$pid = $this->getUrlParam($url, 'game_id');
|
|
|
|
|
$gid = $this->getUrlParam($url, 'promote_id');
|
|
|
|
|
if ($gid === null || $gid === null) {
|
|
|
|
|
return null;
|
|
|
|
|
} else {
|
|
|
|
|
return $gid . '-' . $pid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getUrlParam($url, $name)
|
|
|
|
|
{
|
|
|
|
|
$items = parse_url($url);
|
|
|
|
|
$queryString = ltrim($items['query'], 's=');
|
|
|
|
|
$queryString = ltrim($queryString, '/');
|
|
|
|
|
$queryString = rtrim($queryString, '.html');
|
|
|
|
|
$rows = explode('/', $queryString);
|
|
|
|
|
$codeIndex = null;
|
|
|
|
|
foreach ($rows as $key => $value) {
|
|
|
|
|
if ($key >= 3 && $value == $name) {
|
|
|
|
|
$codeIndex = $key;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($codeIndex !== null) {
|
|
|
|
|
return $rows[$codeIndex + 1] ?? null;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|