FIX SITE MAP

This commit is contained in:
Default
2025-04-24 01:18:17 +08:00
parent 7494188846
commit 8754bbc58e
11 changed files with 571 additions and 84 deletions

View File

@@ -89,12 +89,17 @@ class DomainModel extends BaseModel
/**
* Undocumented function
* GetFomartSubjectEx
*
* @param string $strKey
* @param string $strDomain
* @param string $strController
* @param string $strAction
* @param string $strDiff
* @param boolean $boolJoin
* @return string
*/
public function getFomartSubject($strKey, $strDiff = '', bool $boolJoin = true)
public function getFomartSubjectEx(string $strKey, string $strDomain, string $strController, string $strAction, $strDiff = '', bool $boolJoin = true): string
{
$intSfgId = $this->t_cfg->{$strKey}['sfg_id'];
$SubjectFomartModel = NULL;
@@ -104,10 +109,6 @@ class DomainModel extends BaseModel
return '';
}
$strDomain = request()->DomainModel->d_domain;
$strController = request()->controller();
$strAction = request()->action();
if ($boolJoin) {
$strUUId = sprintf('%s-%s-%s-%s-%s', $strDomain, $strController, $strAction, $strKey, $strDiff);
} else {
@@ -126,8 +127,6 @@ class DomainModel extends BaseModel
'csf_key' => $strUUId,
'sf_id' => $SubjectFomartModel->sf_id,
]);
} else {
$intSfId = $arrConfigSubjectFomart['sf_id'];
@@ -137,12 +136,65 @@ class DomainModel extends BaseModel
break;
}
}
}
return $SubjectFomartModel->sf_val ?? '';
}
/**
* Undocumented function
*
* @param string $strKey
* @return string
*/
public function getFomartSubject($strKey, $strDiff = '', bool $boolJoin = true)
{
$strDomain = request()->DomainModel->d_domain;
$strController = request()->controller();
$strAction = request()->action();
return $this->getFomartSubjectEx($strKey, $strDomain, $strController, $strAction, $strDiff, $boolJoin);
}
/**
* GetFomartUrl
*
* @param string $strKey
* @param array $arrArgs
* @return string
*/
public function getFomartUrl(string $strKey, array $arrArgs): string
{
$strSfVal = $this->getFomartSubject($strKey, '', false);
$arrKeys = [];
$arrVals = [];
foreach ($arrArgs as $strKey => $strVal) {
$arrKeys[] = '{' . $strKey . '}';
$arrVals[] = $strVal;
}
return str_replace($arrKeys, $arrVals, $strSfVal);
}
/**
* GetFomartUrl
*
* @param string $strKey
* @param array $arrArgs
* @return string
*/
public function getFomartUrlEx(string $strKey, string $strDomain, string $strController, string $strAction, array $arrArgs): string
{
$strSfVal = $this->getFomartSubjectEx($strKey, $strDomain, $strController, $strAction, '', false);
$arrKeys = [];
$arrVals = [];
foreach ($arrArgs as $strKey => $strVal) {
$arrKeys[] = '{' . $strKey . '}';
$arrVals[] = $strVal;
}
$strUri = str_replace($arrKeys, $arrVals, $strSfVal);
$strUri = str_replace('//', '/', $strUri);
return $strUri;
}
}