Commit 78513e85 by Liu Lida

add Controllers/MiniLiveRoomController

1 parent 731dabc6
Showing with 57 additions and 0 deletions
<?php
/**
* @controllerDes:直播
* @author: Lyda <damonlld@163.com>
* @createTime: 2020/4/22 17:00
*/
namespace Lestore\Minilive\Controllers;
use core\common\ErrorCode;
use Lestore\Minilive\Models\MiniLiveRoom;
class MiniLiveRoomController extends BaseController
{
public function onConstruct()
{
parent::onConstruct(); // TODO: Change the autogenerated stub
}
/**
* @return \Phalcon\Http\Response
*/
public function createLiveRoom()
{
try {
if (empty($this->claims) || !isset($this->claims['mtoken'])) {
return $this->jsonApiReturn(ErrorCode::AUTHORIZE_TOKEN_VALIDATION_FAILED);
}
$miniLiveRoom = new MiniLiveRoom();
$miniLiveRoom->mtoken = $this->claims['mtoken'];
$miniLiveRoom->cate_id = $this->params('cate_id', null, null, true);
$miniLiveRoom->live_name = $this->params('live_name', null, null, true);
$miniLiveRoom->live_cover = $this->params('live_cover', null, null, true);
$miniLiveRoom->live_description = $this->params('live_description', null, null, true);
$miniLiveRoom->start_time = $this->params('live_description', null, null, true);
$miniLiveRoom->end_time = $this->params('live_description', null, null, true);
$miniLiveRoom->live_type = $this->params('live_description', 'online', null, true);
$miniLiveRoom->is_popular = $this->params('live_description', 0, null, true);
$result = $miniLiveRoom->save();
if ($result) {
return $this->jsonApiReturn(ErrorCode::SUCCESS, 'success', $miniLiveRoom);
}
return $this->jsonApiReturn(ErrorCode::SUCCESS, '创建房间错误');
} catch (\Exception $exception) {
debug('------创建直播间错误-----' . $exception->getLine() . '--' . $exception->getMessage());
return $this->jsonApiReturn(ErrorCode::FAILED, '创建失败');
}
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!