<?php
|
|
class xjh_controller extends zphnetv_controller{
|
/**
|
* 直播开启、关闭通知,修改状态
|
*/
|
function livetz_action(){
|
|
$post = str_replace('“','"',stripslashes($_POST['postdata']));
|
|
$patterns = array("{", "}");
|
$replacements = array("{", "}");
|
|
$post = str_replace($patterns,$replacements,$post);
|
$post = json_decode($post,true);
|
|
if ($_POST['appKey'] == $this->config['sy_xjhlive_appkey']){
|
|
$xjhM = $this->MODEL('xjhlive');
|
|
$data = array();
|
|
if (isset($post['livestatus'])){
|
// 直播状态
|
$data['livestatus'] = $post['livestatus'];
|
|
if ($post['livestatus'] == 2){
|
|
$data['recordurl'] = $post['recordurl'];
|
|
$info = $xjhM->getInfo(array('id'=>$post['xid']), array('field'=>'`caster`'));
|
if ($info['caster'] == 2){
|
|
$data['caster'] = 1;
|
}
|
}
|
}
|
$nid = $xjhM->upXjh(array('id'=>$post['xid']), $data);
|
}
|
|
$error = isset($nid) ? 0: 1;
|
|
$this -> render_json($error, 'ok');
|
}
|
/**
|
* 超过30分钟未直播,关闭导播台通知,修改状态
|
*/
|
function castertz_action(){
|
|
$post = str_replace('“','"',stripslashes($_POST['postdata']));
|
|
$patterns = array("{", "}");
|
$replacements = array("{", "}");
|
|
$post = str_replace($patterns,$replacements,$post);
|
$post = json_decode($post,true);
|
|
if ($_POST['appKey'] == $this->config['sy_xjhlive_appkey']){
|
|
$xjhM = $this->MODEL('xjhlive');
|
|
$data = array(
|
'caster' => $post['state']
|
);
|
|
$nid = $xjhM->upXjh(array('id'=>$post['xid']), $data);
|
}
|
|
$error = isset($nid) ? 0: 1;
|
|
$this -> render_json($error, 'ok');
|
}
|
}
|
?>
|