File: /var/www/dk/wp-content/themes/food/NoauthController/RankingNoauth.php
<?php
/**
* 排行比赛
*/
class RankingNoauth extends NoauthController
{
public $RankingBsObj = null;
public function __construct()
{
$this->RankingBsObj = new RankingBs();
}
public function getInfoByPage()
{
$where = [];
$where['debug'] = $this->debug;
$where['pageNum'] = CheckFunc::checkInputInt2('pageNum', 10, 1);
$where['pageSize'] = CheckFunc::checkInputInt2('pageSize', 10, 10);
$where['order'] = 'mtime desc';
$title = CheckFunc::checkInput2('title');
if ($title != '') {
$where['title'] = $title;
}
$id = CheckFunc::checkInputInt2('id', 10, 0);
if ($id != 0) {
$where['id'] = $id;
}
// print_r($where);
# 获取配置
// $UBiz = new OnlineclassBs();
// $pageObj = $UBiz->getInfoByPage($where);
//
$this->result->rc = ApiErrorDesc::SUCCESS[0];
$this->result->msg = ApiErrorDesc::SUCCESS[1];
//
// $this->result->currentPage = $pageObj->currentPage;
// $this->result->total = $pageObj->total;
// $this->result->data = $pageObj->dataList;
}
/**
* 设置活动
* @return void
*/
public function setActivity()
{
// `id`, `name`, `content`, `user_id`, `user_name`, `score`, `start_date`, `end_date`, `add_time`, `update_time`, `status`
$where = [];
$where['debug'] = $this->debug;
$where['action'] = CheckFunc::checkInput2('action');
$where['status'] = CheckFunc::checkInputInt2('status', 2, 0);
$where['name'] = CheckFunc::checkInput2('name');
$where['content'] = CheckFunc::checkInput2('content');
$where['user_id'] = CheckFunc::checkInputInt2('user_id');
$where['user_name'] = CheckFunc::checkInput2('user_name');
$where['score'] = CheckFunc::checkInputInt2('score', 10, 0);
$where['start_date'] = CheckFunc::checkInput2('start_date');
$where['end_date'] = CheckFunc::checkInput2('end_date');
if ($where['debug']) {
print_r($where);
}
$resObj = new stdClass();
$resObj->rc = ApiErrorDesc::ERR_ACTION[0];
$resObj->msg = ApiErrorDesc::ERR_ACTION[1];
if ($where['action'] == 'update' || $where['action'] == 'add' || $where['action'] == 'del') {
# 获取配置
try {
$resObj = $this->RankingBsObj->setActivity($where['action'], $where, $where['debug']);
} catch (Exception $e) {
}
}
$this->result->rc = $resObj->rc;
$this->result->msg = $resObj->msg;
}
/**
* 直播录制回调包括录制状态回调和文件生成回调。
* 录制状态回调:在文件开始录制与结束录制时发出,主要表示文件已经开始和结束录制。
* 文件生成回调:在文件生成时发出,主要包括文件名称,开始结束时间与时长信息。
* 回调内容为JSON格式,通过HTTP POST请求包含在请求体(Request Body)中发送到录制回调配置中的NotifyUrl接收方解析请求体获取回调内容。
*
* 录制状态回调参数和示例
* 录制状态回调参数示例
* {
* "domain": "gs_domain",
* "app": "gs_app",
* "stream": "gs_stream",
* "event": "record_started"
* }
*
*
* event 事件名,取值:
* record_started:录制已经成功开始。
* record_paused:录制已经成功暂停。
* record_resumed:录制已经成功恢复继续录制。
*
*
*
* 文件生成回调参数示例
* 则回调内容为
* {
* // "domain": "demo.aliyundoc.com",
* // "app": "liveApp****",
* // "stream": "liveStream****",
* // uri: liveApp/liveStream/0_2017-03-08-23:09:46_2017-03-08-23:10:40.flv,
* // duration: 69.403,
* // start_time: 1488985786,
* // stop_time: 1488985840,
* // push_args: {
* // callback_args1": "value1",
* // callback_myid": "1231389741"
* // }
* //}
*/
public function addAliLiveRecordStatus()
{
//`id`, `post_id`, `user_id`, `type`, `title`, `introduction`, `language`, `class_range`, `lesson_type`, `tag`, `price`, `try_learn`, `status`,
$where = [];
$where['debug'] = $this->debug;
$where['action'] = 'add'; // CheckFunc::checkInput2('action'); //$data['action'];
$where['status'] = '1'; // CheckFunc::checkInputInt2('status', 2, 0);
/// 阿里直播参数
//获取body里的参数
$bodyData = @file_get_contents('php://input');
//将获取到的值转化为数组格式
$bodyData = json_decode($bodyData, true);
$resObj = new stdClass();
$resObj->rc = ApiErrorDesc::ERR_ACTION[0];
$resObj->msg = ApiErrorDesc::ERR_ACTION[1];
$where['domain'] = $bodyData['domain'];
$where['app'] = $bodyData['app'];
$where['stream'] = $bodyData['stream'];
if (isset($bodyData['uri'])) {
$where['uri'] = $bodyData['uri'];
$where['duration'] = $bodyData['duration'];
$where['start_time'] = $bodyData['start_time'];
$where['stop_time'] = $bodyData['stop_time'];
$where['push_args'] = $bodyData['push_args'];
if ($where['debug']) {
print_r($bodyData);
print_r($where);
}
if ($where['action'] == 'update' || $where['action'] == 'add') {
# 获取配置
try {
$UBiz = new AliLiveFileStatusBs();
$resObj = $UBiz->setAliLiveFileStatus($where);
} catch (Exception $e) {
}
}
} else {
$where['event'] = $bodyData['event'];
if ($where['debug']) {
print_r($bodyData);
print_r($where);
}
if ($where['action'] == 'update' || $where['action'] == 'add') {
# 获取配置
try {
$UBiz = new AliLiveRecordStatusBs();
$resObj = $UBiz->setAliLiveRecordStatus($where);
} catch (Exception $e) {
}
}
}
$this->result->rc = $resObj->rc;
$this->result->msg = $resObj->msg;
}
/**
* 直播录制回调包括录制状态回调和文件生成回调。
* 录制状态回调:在文件开始录制与结束录制时发出,主要表示文件已经开始和结束录制。
* 文件生成回调:在文件生成时发出,主要包括文件名称,开始结束时间与时长信息。
* 回调内容为JSON格式,通过HTTP POST请求包含在请求体(Request Body)中发送到录制回调配置中的NotifyUrl接收方解析请求体获取回调内容。
*
* 录制状态回调参数和示例
*/
// public function addAliLiveFileStatus()
// {
// //`id`, `post_id`, `user_id`, `type`, `title`, `introduction`, `language`, `class_range`, `lesson_type`, `tag`, `price`, `try_learn`, `status`,
// $where = [];
// $where['debug'] = $this->debug;
// $where['action'] = 'add'; // CheckFunc::checkInput2('action'); //$data['action'];
// $where['status'] = '1'; // CheckFunc::checkInputInt2('status', 2, 0);
//
// /// 阿里直播参数
//
// //获取body里的参数
// $bodyData = @file_get_contents('php://input');
// //将获取到的值转化为数组格式
// $bodyData = json_decode($bodyData, true);
//
// $where['domian'] = $bodyData['domian'];
// $where['app'] = $bodyData['app'];
// $where['stream'] = $bodyData['stream'];
//
// $where['uri'] = $bodyData['uri'];
// $where['duration'] = $bodyData['duration'];
// $where['start_time'] = $bodyData['start_time'];
// $where['stop_time'] = $bodyData['stop_time'];
// $where['push_args'] = $bodyData['push_args'];
//
// if ($where['debug']) {
// print_r($where);
// }
//
// $resObj = new stdClass();
// $resObj->rc = ApiErrorDesc::ERR_ACTION[0];
// $resObj->msg = ApiErrorDesc::ERR_ACTION[1];
//
// if ($where['action'] == 'update' || $where['action'] == 'add') {
// # 获取配置
// try {
// $UBiz = new AliLiveFileStatusBs();
// $resObj = $UBiz->setAliLiveFileStatus($where);
// } catch (Exception $e) {
//
// }
// }
//
// $this->result->rc = $resObj->rc;
// $this->result->msg = $resObj->msg;
// }
}