This commit is contained in:
Default
2025-04-22 22:10:45 +08:00
parent 06ba3c8411
commit 1c1734bd60
12 changed files with 228 additions and 507 deletions

View File

@@ -88,7 +88,7 @@ class ConverterMovel
* Undocumented function
*
* @param string $strKey
* @return void
* @return string
*/
static public function getVal(string $strKey)
{

View File

@@ -70,7 +70,6 @@ class VideoClicksModel extends MongoModel
],
[
'$inc' => ['vc_clicks' => 1],
'$set' => ['v_category_id' => $Novel->v_category_id]
],
[
'upsert' => true

View File

@@ -43,9 +43,6 @@ class VideoModel extends MongoModel
],
'projection' => [
'_id' => 0,
'n_site_code' => 0,
'n_source_uuid' => 0,
'n_source_id' => 0,
],
];
@@ -63,12 +60,12 @@ class VideoModel extends MongoModel
try {
$arrConditions = array_map(function ($strKeyword) {
return ['n_name' => ['$regex' => trim($strKeyword), '$options' => 'i']];
return ['v_name' => ['$regex' => trim($strKeyword), '$options' => 'i']];
}, $arrKeywords);
$UpdateResult = $this->getCol()->updateMany(
['$or' => $arrConditions],
['$set' => ['n_level' => $intLevel]]
['$set' => ['v_level' => $intLevel]]
);
$UpdateResult->getModifiedCount();
@@ -99,7 +96,6 @@ class VideoModel extends MongoModel
$arrOptions['sort'] = $arrSort;
}
$arrFilter['n_have_chapter'] = 1;
$Cursor = $this->getCol()->find($arrFilter, $arrOptions);
@@ -179,7 +175,7 @@ class VideoModel extends MongoModel
*/
public function getVideoByNId(int $intNId): null|array
{
$arrFilter = ['n_id' => $intNId, 'n_have_chapter' => 1];
$arrFilter = ['v_id' => $intNId];
return $this->findOne($arrFilter);
}
@@ -202,7 +198,6 @@ class VideoModel extends MongoModel
return $arrResult;
}
$arrFilter['n_have_chapter'] = 1;
$arrPipeline = [
['$match' => $arrFilter],
@@ -236,12 +231,11 @@ class VideoModel extends MongoModel
array $arrFilter,
int $intPage = 1,
int $intLimit = 20,
array $arrSort = ['n_level' => -1],
array $arrSort = ['v_level' => -1],
string $strKey = '',
int $intLifeTime = 24 * 3600,
): array {
try {
$arrFilter['n_have_chapter'] = 1;
$arrResult = $this->checkCacheByKey($strKey);
if ($arrResult !== NULL) {
@@ -295,23 +289,23 @@ class VideoModel extends MongoModel
int $intLifeTime = 24 * 3600,
int $intType = 0,
$strStatus = NULL,
array $arrSort = ['n_level' => -1]
array $arrSort = ['v_level' => -1]
): array {
$arrFilter = ['n_have_chapter' => 1,];
$arrFilter = [];
switch ($intType) {
case 1:
$arrCategory = array_values(CategoryModel::getManCategory());
$arrFilter['n_category'] = ['$in' => $arrCategory];
$arrFilter['v_category'] = ['$in' => $arrCategory];
break;
case 2:
$arrCategory = array_values(CategoryModel::getWomenCategory());
$arrFilter['n_category'] = ['$in' => $arrCategory];
$arrFilter['v_category'] = ['$in' => $arrCategory];
break;
}
if ($strStatus !== NULL) {
$arrFilter['n_status'] = $strStatus;
$arrFilter['v_status'] = $strStatus;
}
return $this->findPaginatedWithCache($arrFilter, $intPage, $intLimit, $arrSort, $strKey, $intLifeTime,);
}
@@ -340,7 +334,6 @@ class VideoModel extends MongoModel
return $arrResult;
}
$arrFilter['n_have_chapter'] = 1;
$arrOptions = self::$arrOptions;
@@ -385,17 +378,17 @@ class VideoModel extends MongoModel
int $intCount = 10,
int $intType = 0,
$strStatus = NULL,
array $arrSort = ['n_level' => -1]
array $arrSort = ['v_level' => -1]
): array {
try {
$arrFilter = [];
if (in_array($intType, [1, 2])) {
$arrFilter['n_category'] = ['$in' => CategoryModel::getCategoryByType($intType)];
$arrFilter['v_category'] = ['$in' => CategoryModel::getCategoryByType($intType)];
}
if ($strStatus !== NULL) {
$arrFilter['n_status'] = $strStatus;
$arrFilter['v_status'] = $strStatus;
}
return $this->findManyShuffledWithCache($arrFilter, $intCount, $arrSort, $strKey, $intLifeTime);
@@ -409,7 +402,6 @@ class VideoModel extends MongoModel
*
* @param string $strSign
* @param integer $intCount
* @param integer $intType
* @param string strDateType
* * daily 天
* * weekly 周
@@ -417,7 +409,7 @@ class VideoModel extends MongoModel
* * total 总
* @return array
*/
public function getRankVideoOnCache(string $strKey, int $intCount = 10, int $intType = 0, $strDateType = 'daily', $strStatus = NULL): array
public function getRankVideoOnCache(string $strKey, int $intCount = 10, $strDateType = 'daily', $strStatus = NULL): array
{
try {
$intLifeTime = 24 * 3600;
@@ -431,18 +423,15 @@ class VideoModel extends MongoModel
];
if ($strStatus !== NULL) {
$arrFilter['n_status'] = $strStatus;
$arrFilter['v_status'] = $strStatus;
}
if (in_array($intType, [1, 2])) {
$arrFilter['n_category'] = ['$in' => CategoryModel::getCategoryByType($intType)];
}
$arrOptions = [
'sort' => ['nc_clicks' => -1],
'limit' => $intCount * 3,
'projection' => [
'n_id' => 1,
'v_id' => 1,
],
];
@@ -452,10 +441,10 @@ class VideoModel extends MongoModel
$arrNId = [];
foreach ($Cursor as $Doc) {
$arrNId[] = $Doc['n_id'];
$arrNId[] = $Doc['v_id'];
}
$arrFilter = ['n_id' => ['$in' => $arrNId]];
$arrFilter = ['v_id' => ['$in' => $arrNId]];
$arrOptions = self::$arrOptions;
unset($arrOptions['typeMap']);