debug
This commit is contained in:
17
code/app/model/GuangGaoFenZuModel.php
Normal file
17
code/app/model/GuangGaoFenZuModel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\facade\Cache;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class GuangGaoFenZuModel extends BaseModel
|
||||
{
|
||||
protected $name = 'guang_gao_fen_zu';
|
||||
protected $pk = 'ggfz_id';
|
||||
}
|
||||
59
code/app/model/GuangGaoModel.php
Normal file
59
code/app/model/GuangGaoModel.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\facade\Cache;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class GuangGaoModel extends BaseModel
|
||||
{
|
||||
protected $name = 'guang_gao';
|
||||
protected $pk = 'gg_id';
|
||||
|
||||
static $arrGuangGao = [];
|
||||
|
||||
static public function getAdByCache($strGGFZCode, $intLimit = 10, $strSort = 'asc')
|
||||
{
|
||||
if (self::$arrGuangGao == []) {
|
||||
self::$arrGuangGao = Cache::get('GuangGao');
|
||||
if (empty(self::$arrGuangGao)) {
|
||||
self::flushCache();
|
||||
self::$arrGuangGao = Cache::get('GuangGao');
|
||||
}
|
||||
}
|
||||
$arrTemp = self::$arrGuangGao[$strGGFZCode] ?? [];
|
||||
|
||||
if ($strSort == 'rand') {
|
||||
shuffle($arrTemp);
|
||||
}
|
||||
|
||||
return array_slice($arrTemp, 0, $intLimit);
|
||||
}
|
||||
|
||||
static public function flushCache()
|
||||
{
|
||||
$arrGuangGao = [];
|
||||
$arrGGFZCode = GuangGaoFenZuModel::column('ggfz_code', 'ggfz_id');
|
||||
$GuangGaoModelAll = self::where('site_id',config('app.default_app_id'))->order('ggfz_id', 'desc')->order('gg_sort', 'desc')->where('gg_status',0)->select();
|
||||
|
||||
foreach ($GuangGaoModelAll as $GuangGaoModel) {
|
||||
$GuangGaoModel->ggfz_id;
|
||||
if (!key_exists($GuangGaoModel->ggfz_id, $arrGGFZCode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!key_exists($arrGGFZCode[$GuangGaoModel->ggfz_id], $arrGuangGao)) {
|
||||
$arrGuangGao[$arrGGFZCode[$GuangGaoModel->ggfz_id]] = [];
|
||||
}
|
||||
|
||||
$arrGuangGao[$arrGGFZCode[$GuangGaoModel->ggfz_id]][] = $GuangGaoModel->toArray();
|
||||
}
|
||||
|
||||
Cache::tag('GuangGao')->set('GuangGao', $arrGuangGao);
|
||||
}
|
||||
}
|
||||
40
code/app/model/GuangGaoPeiZhiModel.php
Normal file
40
code/app/model/GuangGaoPeiZhiModel.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\facade\Cache;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin think\Model
|
||||
*/
|
||||
class GuangGaoPeiZhiModel extends BaseModel
|
||||
{
|
||||
protected $name = 'guang_gao_pei_zhi';
|
||||
protected $pk = 'ggpz_id';
|
||||
|
||||
static $arrGuangGaoPeiZhi = [];
|
||||
|
||||
static public function getValByCode($strCode)
|
||||
{
|
||||
self::flushCache();
|
||||
if (self::$arrGuangGaoPeiZhi == []) {
|
||||
self::$arrGuangGaoPeiZhi = Cache::get('GuangGaoPeiZhi');
|
||||
|
||||
if (empty(self::$arrGuangGaoPeiZhi)) {
|
||||
self::flushCache();
|
||||
self::$arrGuangGaoPeiZhi = Cache::get('GuangGaoPeiZhi');
|
||||
}
|
||||
}
|
||||
|
||||
return self::$arrGuangGaoPeiZhi[$strCode] ?? NULL;
|
||||
}
|
||||
|
||||
static public function flushCache()
|
||||
{
|
||||
$arrGuangGaoPeiZhi = self::column('ggpz_val', 'ggpz_code');
|
||||
Cache::tag('GuangGaoPeiZhi')->set('GuangGaoPeiZhi', $arrGuangGaoPeiZhi);
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,11 @@ class VideoCategoryModel extends MongoModel
|
||||
"v_category" => "电影",
|
||||
"v_category_en" => 'dian-ying',
|
||||
"children" => [
|
||||
[
|
||||
"v_category_en" => "shao-shi-dian-ying",
|
||||
"v_category" => "邵氏电影",
|
||||
"children" => [],
|
||||
],
|
||||
[
|
||||
"v_category_en" => "dong-zuo-pian",
|
||||
"v_category" => "动作片",
|
||||
@@ -79,6 +84,17 @@ class VideoCategoryModel extends MongoModel
|
||||
"v_category" => "动画片",
|
||||
"children" => [],
|
||||
],
|
||||
[
|
||||
"v_category_en" => "gao-xiao",
|
||||
"v_category" => "搞笑",
|
||||
"children" => [],
|
||||
],
|
||||
[
|
||||
"v_category_en" => "yu-gao-pian",
|
||||
"v_category" => "预告片",
|
||||
"children" => [],
|
||||
],
|
||||
|
||||
// [
|
||||
// "v_category_en" => "lun-li-pian",
|
||||
// "v_category" => "倫理片",
|
||||
@@ -136,6 +152,11 @@ class VideoCategoryModel extends MongoModel
|
||||
"v_category" => "综艺",
|
||||
"v_category_en" => 'zong-yi',
|
||||
"children" => [
|
||||
[
|
||||
"v_category_en" => "yan-chang-hui",
|
||||
"v_category" => "演唱会",
|
||||
"children" => [],
|
||||
],
|
||||
[
|
||||
"v_category_en" => "da-lu-zong-yi",
|
||||
"v_category" => "大陆综艺",
|
||||
@@ -156,6 +177,21 @@ class VideoCategoryModel extends MongoModel
|
||||
"v_category" => "欧美综艺",
|
||||
"children" => [],
|
||||
],
|
||||
[
|
||||
"v_category_en" => "si-nuo-ke",
|
||||
"v_category" => "斯诺克",
|
||||
"children" => [],
|
||||
],
|
||||
[
|
||||
"v_category_en" => "yin-le",
|
||||
"v_category" => "音乐",
|
||||
"children" => [],
|
||||
],
|
||||
[
|
||||
"v_category_en" => "qi-che",
|
||||
"v_category" => "汽车",
|
||||
"children" => [],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user