申明:本人并非小程序作者,但本文是原创
小程序升级最新版苹果cmsV10,我相信往下看的,都是知道这个小程序的,就不详细介绍了!因为可以安装在任何苹果cmsV10主程序上就勉强称他为插件把,对原苹果cms主体结构无任何修改,安装后开可任意更新苹果cms,前后端开源去授权
简介:可在某种场景下限制使用在线播放功能,防止TX审核到在线播放(腾讯不允许个人类小程序有在线播放功能),开审核模式百分百能过!过了之后按需求开启部分场景防止被封!小程序无明显BUG(至少我没遇到,有几个修复了),支持官解、支持m3u8、电视据可自动下一集、投屏,记忆播放,流量主,激励视频、历史、收藏、消息推送、太多就部介绍了
插件和前端下载地址:https://m.lvdoui.cn/post/5.html
1、正常安装苹果cms10最新版(任何版本…如果你喜欢用旧的的话)
2、添加一个小程序设置按钮,复制下面代码添加到、苹果cms\application\admin\common\auth.php
'12' => array('name' => '小程序', 'icon' => 'xe621', 'sub' => array(
'121' => array("show"=>1,"name" => '小程序配置', 'controller' => 'wxapi','action' => 'index'),
'12100' => array("show"=>0,'name' => '添加配置', 'controller' => 'wxapi','action' => 'info'),
'12101' => array("show"=>0,'name' => '删除配置', 'controller' => 'wxapi','action' => 'del'),
'12102' => array("show"=>0,'name' => '修改配置', 'controller' => 'wxapi','action' => 'field'),
)),
大概这个位置就行(你喜欢也可以放别的地方)
3、把“丢网站目录.zip”上传到苹果cms10根目录并解压!找到网站目录/wxapi/config/dbs.php–修改为你苹果cms的数据库信息“内有说明”
4、在苹果cms后台----数据库----执行sql语句----分别执行(在苹果数据库用户表添加一个user_pid_num字段和修改user_portrait属性)你也可以手动去数据库添加和修改
ALTER TABLE mac_user ADD user_pid_num INT(10) UNSIGNED NOT NULL Default 0;
ALTER TABLE mac_user MODIFY column user_portrait varchar(200) NOT NULL Default 0;
5、添加一个API方法,找到:/application/api/controller/Provide.php 编辑它,找到
}
←←←把下面的方法放到这个位置(不一定要放这里,但有的人会纠结到底放哪里)
public function vod() “这一行不是”
复制下面的API方法
public function search()
{
if($GLOBALS['config']['api']['vod']['status'] != 1){
echo 'closed';
exit;
}
// if($GLOBALS['config']['api']['vod']['charge'] == 1) {
// $h = $_SERVER['REMOTE_ADDR'];
// if (!$h) {
// echo '域名未授权!';
// exit;
// }
// else {
// $auth = $GLOBALS['config']['api']['vod']['auth'];
// $auths = array();
// if(!empty($auth)){
// $auths = explode('#',$auth);
// foreach($auths as $k=>$v){
// $auths[$k] = gethostbyname(trim($v));
// }
// }
// if($h != 'localhost' && $h != '127.0.0.1') {
// if(!in_array($h, $auths)){
// echo '域名未授权!';
// exit;
// }
// }
// }
// }
$cache_time = intval($GLOBALS['config']['api']['vod']['cachetime']);
$cach_name = 'api_vod_'.md5(http_build_query($this->_param));
$html = Cache::get($cach_name);
if(empty($html) || $cache_time==0) {
$where = [];
if (!empty($GLOBALS['config']['api']['vod']['typefilter'])) {
$where['type_id'] = ['in', $GLOBALS['config']['api']['vod']['typefilter']];
}
if (!empty($this->_param['t'])) {
if (empty($GLOBALS['config']['api']['vod']['typefilter']) || strpos($GLOBALS['config']['api']['vod']['typefilter'], $this->_param['t']) !== false) {
$where['type_id'] = $this->_param['t'];
}
}
if (!empty($this->_param['h'])) {
$todaydate = date('Y-m-d', strtotime('+1 days'));
$tommdate = date('Y-m-d H:i:s', strtotime('-' . $this->_param['h'] . ' hours'));
$todayunix = strtotime($todaydate);
$tommunix = strtotime($tommdate);
$where['vod_time'] = [['gt', $tommunix], ['lt', $todayunix]];
}
if (!empty($this->_param['wd'])) {
$pre = 'vod';
$where[$pre.'_name|'.$pre.'_en'] = ['like', '%' . $this->_param['wd'] . '%'];
}
if (empty($GLOBALS['config']['api']['vod']['from']) && !empty($this->_param['from'])) {
$GLOBALS['config']['api']['vod']['from'] = $this->_param['from'];
}
if (!empty($GLOBALS['config']['api']['vod']['from'])) {
$where['vod_play_from'] = ['like', '%' . $GLOBALS['config']['api']['vod']['from'] . '%'];
}
// if (!empty($GLOBALS['config']['api']['vod']['datafilter'])) {
// $where['_string'] .= ' ' . $GLOBALS['config']['api']['vod']['datafilter'];
// }
// if (empty($this->_param['pg'])) {
// $this->_param['pg'] = 1;
// }
$where['type_id'] =["in","1,2,3,4"];
$order = 'vod_id desc';
$field = 'vod_id as id,vod_name as name,vod_en as en';
if ($this->_param['ac'] == 'videolist' || $this->_param['ac'] == 'detail') {
$field = 'vod_id as id,vod_name as name,vod_en as en';
}
$res = model('vod')->listData($where,$order,1,10,0,$field);
if ($this->_param['at'] == 'xml') {
$html = $this->vod_xml($res);
} else {
$html = json_encode($res);
}
if($cache_time>0) {
Cache::set($cach_name, $html, $cache_time);
}
}
echo $html;
exit;
}
后端部分已经完成了!采集和数据管理都使用苹果cmsV10,导入项目及发布可参考:https://m.lvdoui.cn/post/4.html