| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- /**
- *
- * @copyright ©2020 点小铺
- * @author hanj
- * @link: https://dyuit.com
- * Created by VSCode
- */
- namespace app\store\controller\apps\live;
- use app\store\controller\Controller;
- use app\store\model\wxapp\LiveRoom as LiveRoomModel;
- /**
- * 小程序直播间管理
- * Class Room
- * @package app\store\controller\apps\live
- */
- class Room extends Controller
- {
- /**
- * 直播间列表页
- * @param string $search 检索词
- * @return mixed
- * @throws \think\exception\DbException
- */
- public function index($search = '')
- {
- $model = new LiveRoomModel;
- $list = $model->getList($search);
- return $this->fetch('index', compact('list'));
- }
- /**
- * 同步刷新直播间列表
- * @return array|bool
- * @throws \app\common\exception\BaseException
- * @throws \think\exception\DbException
- */
- public function refresh()
- {
- $model = new LiveRoomModel;
- if ($model->refreshLiveList()) {
- return $this->renderSuccess('同步成功');
- }
- return $this->renderError($model->getError() ?: '同步失败');
- }
- /**
- * 修改直播间置顶状态
- * @param $room_id
- * @param $is_top
- * @return array|bool
- * @throws \think\exception\DbException
- */
- public function settop($room_id, $is_top)
- {
- // 商品详情
- $model = LiveRoomModel::detail($room_id);
- if (!$model->setIsTop($is_top)) {
- return $this->renderError('操作失败');
- }
- return $this->renderSuccess('操作成功');
- }
- }
|