feature
This commit is contained in:
@@ -32,7 +32,7 @@ class VideoCategoryModel extends MongoModel
|
||||
static $arrCategoryTypeONE = [
|
||||
[
|
||||
"v_category" => "电影",
|
||||
"v_category_en" => "dianying",
|
||||
"v_category_en" => 'dian-ying',
|
||||
"children" => [
|
||||
[
|
||||
"v_category_en" => "dong-zuo-pian",
|
||||
@@ -88,7 +88,7 @@ class VideoCategoryModel extends MongoModel
|
||||
],
|
||||
[
|
||||
"v_category" => "电视剧",
|
||||
"v_category_en" => "dianshiju",
|
||||
"v_category_en" =>'dian-shi-ju',
|
||||
"children" => [
|
||||
[
|
||||
"v_category_en" => "guo-chan-ju",
|
||||
@@ -134,7 +134,7 @@ class VideoCategoryModel extends MongoModel
|
||||
],
|
||||
[
|
||||
"v_category" => "综艺",
|
||||
"v_category_en" => "zonyi",
|
||||
"v_category_en" => 'zong-yi',
|
||||
"children" => [
|
||||
[
|
||||
"v_category_en" => "da-lu-zong-yi",
|
||||
@@ -160,7 +160,7 @@ class VideoCategoryModel extends MongoModel
|
||||
],
|
||||
[
|
||||
"v_category" => "动漫",
|
||||
"v_category_en" => "donman",
|
||||
"v_category_en" => 'dong-man',
|
||||
"children" => [
|
||||
[
|
||||
"v_category_en" => "guo-chan-dong-man",
|
||||
@@ -191,7 +191,7 @@ class VideoCategoryModel extends MongoModel
|
||||
],
|
||||
[
|
||||
"v_category" => "短剧",
|
||||
"v_category_en" => "duanju",
|
||||
"v_category_en" => 'duan-ju-da-quan',
|
||||
"children" => [
|
||||
[
|
||||
"v_category_en" => "duan-ju-da-quan",
|
||||
|
||||
@@ -39,12 +39,12 @@ class VideoClicksModel extends MongoModel
|
||||
public function addStatis(int $intVId)
|
||||
{
|
||||
|
||||
$NovelModel = NovelModel::getInstance();
|
||||
$Novel = $NovelModel->getCol()->findOne([
|
||||
$VideoModel = VideoModel::getInstance();
|
||||
$Video = $VideoModel->getCol()->findOne([
|
||||
"v_id" => $intVId,
|
||||
]);
|
||||
|
||||
if (empty($Novel)) {
|
||||
if (empty($Video)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,10 @@ class VideoClicksModel extends MongoModel
|
||||
],
|
||||
[
|
||||
'$inc' => ['vc_clicks' => 1],
|
||||
'$set' => [
|
||||
'v_category' => $Video->v_category,
|
||||
'v_parent_category' => $Video->v_parent_category
|
||||
],
|
||||
],
|
||||
[
|
||||
'upsert' => true
|
||||
|
||||
@@ -49,10 +49,10 @@ class VideoModel extends MongoModel
|
||||
/**
|
||||
* 根据关键词数组更新小说推荐等级
|
||||
* @param array $arrKeywords 关键词数组,例如 ["斗罗", "遮天", "凡人"]
|
||||
* @param int $intLevel 推荐等级1~9,例如 3
|
||||
* @param array 待修改的字段
|
||||
* @return array 更新结果
|
||||
*/
|
||||
public function updateByKeywords(array $arrKeywords, int $intLevel)
|
||||
public function updateByKeywords(array $arrKeywords, array $arrUpdate)
|
||||
{
|
||||
if (empty($arrKeywords)) {
|
||||
return false;
|
||||
@@ -65,7 +65,7 @@ class VideoModel extends MongoModel
|
||||
|
||||
$UpdateResult = $this->getCol()->updateMany(
|
||||
['$or' => $arrConditions],
|
||||
['$set' => ['v_level' => $intLevel]]
|
||||
['$set' => $arrUpdate]
|
||||
);
|
||||
|
||||
$UpdateResult->getModifiedCount();
|
||||
@@ -236,7 +236,7 @@ class VideoModel extends MongoModel
|
||||
int $intLifeTime = 24 * 3600,
|
||||
): array {
|
||||
try {
|
||||
|
||||
|
||||
$arrResult = $this->checkCacheByKey($strKey);
|
||||
if ($arrResult !== NULL) {
|
||||
return $arrResult;
|
||||
@@ -409,8 +409,14 @@ class VideoModel extends MongoModel
|
||||
* * total 总
|
||||
* @return array
|
||||
*/
|
||||
public function getRankVideoOnCache(string $strKey, int $intCount = 10, $strDateType = 'daily', $strStatus = NULL): array
|
||||
{
|
||||
public function getRankVideoOnCache(
|
||||
string $strKey,
|
||||
int $intCount = 10,
|
||||
$strDateType = 'daily',
|
||||
$strStatus = NULL,
|
||||
$strVCategoryEn = NULL,
|
||||
$strVParentCategoryEn = NULL,
|
||||
): array {
|
||||
try {
|
||||
$intLifeTime = 24 * 3600;
|
||||
|
||||
@@ -418,17 +424,26 @@ class VideoModel extends MongoModel
|
||||
if ($arrResult !== NULL) {
|
||||
return $arrResult;
|
||||
}
|
||||
|
||||
|
||||
$arrFilter = [
|
||||
'nc_type' => $strDateType,
|
||||
'vc_type' => $strDateType,
|
||||
];
|
||||
|
||||
if ($strStatus !== NULL) {
|
||||
$arrFilter['v_status'] = $strStatus;
|
||||
}
|
||||
|
||||
if ($strVCategoryEn !== NULL) {
|
||||
$arrFilter['v_category_en'] = $strVCategoryEn;
|
||||
}
|
||||
|
||||
if ($strVParentCategoryEn !== NULL) {
|
||||
$arrFilter['v_parent_category_en'] = $strVParentCategoryEn;
|
||||
}
|
||||
|
||||
$arrOptions = [
|
||||
'sort' => ['nc_clicks' => -1],
|
||||
'sort' => ['vc_clicks' => -1],
|
||||
'limit' => $intCount * 3,
|
||||
'projection' => [
|
||||
'v_id' => 1,
|
||||
@@ -466,8 +481,4 @@ class VideoModel extends MongoModel
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user