9 changed files with 126 additions and 4 deletions
@ -0,0 +1,18 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace app\admin\controller\liveroom; |
||||
|
|
||||
|
use app\admin\model\LiveRoom; |
||||
|
use app\common\controller\AdminController; |
||||
|
use think\App; |
||||
|
|
||||
|
class Index extends AdminController |
||||
|
{ |
||||
|
|
||||
|
public function __construct(App $app) |
||||
|
{ |
||||
|
parent::__construct($app); |
||||
|
$this->model = new LiveRoom(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace app\admin\controller\liveroom; |
||||
|
|
||||
|
use app\common\controller\AdminController; |
||||
|
use think\App; |
||||
|
use app\admin\model\Task as TaskModel; |
||||
|
|
||||
|
class Task extends AdminController |
||||
|
{ |
||||
|
|
||||
|
public function __construct(App $app) |
||||
|
{ |
||||
|
parent::__construct($app); |
||||
|
$this->model = new TaskModel(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace app\admin\model; |
||||
|
|
||||
|
use app\common\model\TimeModel; |
||||
|
|
||||
|
class LiveRoom extends TimeModel |
||||
|
{ |
||||
|
protected $deleteTime = 'delete_time'; |
||||
|
|
||||
|
protected $defaultSoftDelete = '0'; |
||||
|
|
||||
|
public static function getPageList($param = []): array |
||||
|
{ |
||||
|
$page = $param['page'] ?? 1; |
||||
|
$limit = $param['limit'] ?? 10; |
||||
|
$where = [['status', '=', 1]]; |
||||
|
if (isset($param['keyword'])) { |
||||
|
$where[] = ['room_id', 'like', '%'.$param['keyword'].'%']; |
||||
|
} |
||||
|
$field = 'id, room_id, anchor_information, link, create_time'; |
||||
|
$order = 'id desc'; |
||||
|
$count = self::where($where)->count(); |
||||
|
$list = self::where($where)->field($field)->order($order)->page($page, $limit)->select(); |
||||
|
return ['data' => $list, 'count' => $count]; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace app\api\controller; |
||||
|
use app\admin\model\LiveRoom as LiveRoomModel; |
||||
|
use think\response\Json; |
||||
|
|
||||
|
class LiveRoom extends ApiController |
||||
|
{ |
||||
|
|
||||
|
public function getList(): Json |
||||
|
{ |
||||
|
if (!$this->request->isPost()) { |
||||
|
return $this->renderError('不支持GET请求'); |
||||
|
} |
||||
|
$param = $this->request->post(); |
||||
|
$list = LiveRoomModel::getPageList($param); |
||||
|
return $this->renderSuccess(['list' => $list['data'], 'count' => $list['count']]); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace app\api\controller; |
||||
|
|
||||
|
use \app\admin\model\Task as TaskModel; |
||||
|
use think\response\Json; |
||||
|
|
||||
|
class Task extends ApiController |
||||
|
{ |
||||
|
|
||||
|
public function getList(): Json |
||||
|
{ |
||||
|
if (!$this->request->isPost()) { |
||||
|
return $this->renderError('不支持GET请求'); |
||||
|
} |
||||
|
$param = $this->request->post(); |
||||
|
$list = TaskModel::getPageList($param); |
||||
|
return $this->renderSuccess(['list' => $list['data'], 'count' => $list['count']]); |
||||
|
} |
||||
|
|
||||
|
} |
||||
Loading…
Reference in new issue