Update avaliable. Click RELOAD to update.
目录

建站系统苹果 CMS10 使用问题汇总

00-mac-cms-10-issue-rollup

1. 如何怎么设置代理

若服务器搭建在国内,采集入口要求外网才能访问,此时可设置代理服务器,让其以外部IP地址做采集工作

编辑文件php-fpm.conf,通常所在位置在 /usr/local/php/etc/php-fpm.conf,添加如下代理配置

# 增加代理
env[http_proxy]="http_proxy=http://127.0.0.1:7890"
env[https_proxy]="https_proxy=http://127.0.0.1:7890"
env[no_proxy]="localhost, 192.168.2.201, 127.0.0.1, ::1"

使用命令 lnmp php-fpm restart 重新启动PHP环境生效,可检查代理服务器日志确定是否走到

2. 如何调试苹果CMS程序

想通过IDE断点调试比较复杂,直接放弃,这里使用输出日志的方式进行问题定位

打开 application/config.php 文件,找到日志配置,打开日志文件输出,如下

'log' => [
    // 日志记录方式,内置 file socket test 支持扩展
    'type'  => 'file',
    // 日志保存目录
    'path'  => LOG_PATH,
    // 日志记录级别
    'level' => ['sql'],
],

重新启动 lnmp php-fpm restart 让配置生效,在需要调试的PHP文件里加入日志输出代码,如下例子:

// 检查文件头是否包含,没有则添加
use think\Log;

// 这是一个示范变量
$pse_name = mac_txt_explain($config['namewords'], true);

// 测试输出
Log::write('pse_name ' .dump($pse_name,1,'',0),'info');
Log::write('vod_name ' .$v['vod_name'],'info');
Log::write('vod_name ' .preg_replace("/\s(?=\s)/","\\1",$v['vod_name']),'info');

输出的日志文件的目录在应用跟路径 runtime\log 中,可自行在日志中检查变量

3. 自定义参数的使用

进入苹果CMS10后台,”系统-网站参数配置-预留参数“,最下面有自定义参数配置,在里面定义自己的变量和值

hotIds$$$42967,43440,43441

在PHP页面通过 $GLOBALS['config']['extra']['hotIds'] 方式获取配置的值

// 标签中使用
{maccms:vod num="10" paging="no" ids="'.$GLOBALS['config']['extra']['hotIds'].'" order="desc" by="sort"}

// 直接输出
{php} dump($GLOBALS['config']['extra']['hotIds']);die; {/php}

4. 名称重复处理方式

不同的采集源会导致同一影视不同的名称,其实内容是一样的,因为不同源的入库方式不同,会导致这种情况。针对这种情况主要采用下面两种方式解决:

application/common/model/Collect.php (大约在553行)

public function vod_data($param,$data,$show=1)
{
  ......
  ......

  if ($config['psename'] == 1) {

    // 过滤采集的名称中包含多个空格的场景,多个空格转一个空格,
    $v['vod_name'] = mac_rep_pse_syn($pse_name, preg_replace("/\s(?=\s)/","\\1",$v['vod_name']));

    // 在去空格一次
    $v['vod_name'] = preg_replace("/\s(?=\s)/","\\1",$v['vod_name']);

    // 替换关键字                     
    $v['vod_name'] = str_replace("(普通话版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(普通话版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(普通话版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("普通话版","",$v['vod_name']);
    $v['vod_name'] = str_replace("(普通话)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(原声)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(原声版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(原声版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(原声版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("原声版","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("(双语版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("双语版","",$v['vod_name']);
    $v['vod_name'] = str_replace("(粤泰双语)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(国粤双语)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(国粤双语版)","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("(英语) ","",$v['vod_name']);
    $v['vod_name'] = str_replace("(英语版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(英语版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("英语版","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("(日语版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("日语版","",$v['vod_name']);
    $v['vod_name'] = str_replace("(美版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(日语版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(国)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(国)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(国)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(国语)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(中文版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(国语)","",$v['vod_name']);
    $v['vod_name'] = str_replace("国语","",$v['vod_name']);
    $v['vod_name'] = str_replace("(双语字幕)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(双语字幕)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(普通话)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(双语字幕版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(版)","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("(电视剧版)","",$v['vod_name']);                    
    $v['vod_name'] = str_replace(":电视剧版","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("(电视剧)","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("[电视剧]","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("电视剧版","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("电视剧","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("(重制版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(重制版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(重制版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(重制版","",$v['vod_name']);
    
    $v['vod_name'] = str_replace("(中配版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(中配版)","",$v['vod_name']);                    
    $v['vod_name'] = str_replace("中配版","",$v['vod_name']);

    $v['vod_name'] = str_replace("(中配)","",$v['vod_name']);
    $v['vod_name'] = str_replace("《中配》","",$v['vod_name']);
    $v['vod_name'] = str_replace("中配","",$v['vod_name']);

    $v['vod_name'] = str_replace("(纯享版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(中国版)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(无字幕)","",$v['vod_name']);
    $v['vod_name'] = str_replace("(精编版)","",$v['vod_name']);

    $v['vod_name'] = str_replace("()","",$v['vod_name']);
    $v['vod_name'] = str_replace("()","",$v['vod_name']);
    $v['vod_name'] = str_replace("()","",$v['vod_name']);
    $v['vod_name'] = str_replace("()","",$v['vod_name']);

    $v['vod_name'] = str_replace("(上)","(上)",$v['vod_name']);
    $v['vod_name'] = str_replace("(下)","(下)",$v['vod_name']);

    // 去除首尾空格
    $v['vod_name'] = trim($v['vod_name']);
  }
}

5. AWS FRPS server migration

5.1. Create a new AWS account to take advantage of the Free Tier.

5.2. Create server instance with t2.micro format, and generate key pair.

5.3. Enable root login

$ ssh -i frps.pem [email protected]
$ sudo su -

# PermitRootLogin yes
# PasswordAuthentication yes
$ vi /etc/ssh/sshd_config

$ systemctl restart sshd

5.4. Backup the original Server data

$ tar -cvf letsencrypt.tar /etc/letsencrypt/
$ tar -cvf nginx.tar /etc/nginx/
$ tar -cvf frps.tar frps/
$ cp /etc/systemd/system/frps.service .

5.5. Download data on new Server

$ scp [email protected]:/root/frps.tar .
$ scp [email protected]:/root/nginx.tar .
$ scp [email protected]:/root/letsencrypt.tar .
$ scp [email protected]:/root/backup .
$ scp [email protected]:/root/qshell .
$ scp [email protected]:/root/frps.service .

5.6. Install nginx

$ sudo yum install nginx
$ nginx
$ rm -rf /etc/nginx
$ tar -cvf nginx.tar /etc/nginx

5.7. Initial frps

$ cp frps.service /etc/systemd/system/
$ systemctl daemon-reload
$ systemctl start frps.service
$ systemctl enable frps.service

5.8. Using new FRPS server ip to replace the original ip in frpc server

5.9. Change cloudflare dns settings.

版权所有,本作品采用知识共享署名-非商业性使用 3.0 未本地化版本许可协议进行许可。转载请注明出处:https://www.wangjun.dev//2023/11/mac-cms-10-issue-rollup/

Related posts