quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
 
namespace app\operations\controller\plus\live;
 
use app\operations\controller\Controller;
use app\operations\model\plus\live\Room as RoomModel;
use app\operations\model\plus\live\RoomGift as RoomGiftModel;
use app\operations\model\plus\live\LiveProduct as LiveProductModel;
use app\common\model\plus\live\UserGift as UserGiftModel;
/**
 * 房间控制器
 */
class Room extends Controller
{
 
    /**
     * 列表
     */
    public function index()
    {
        $model = new RoomModel();
        $list = $model->getList($this->postData());
        return $this->renderSuccess('', compact('list'));
    }
 
    /**
     * 礼物列表
     */
    public function gift()
    {
        $model = new RoomGiftModel();
        $list = $model->getList($this->postData());
        return $this->renderSuccess('', compact('list'));
    }
 
    /**
     * 商品列表
     */
    public function product()
    {
        $model = new LiveProductModel();
        $list = $model->getList($this->postData());
        return $this->renderSuccess('', compact('list'));
    }
 
 
    /**
     * 删除
     */
    public function delete($room_id)
    {
        // 详情
        $model = new RoomModel;
        // 更新记录
        if ($model->setDelete(['room_id' => $room_id])) {
            return $this->renderSuccess('删除成功');
        }
        return $this->renderError('删除失败');
    }
 
    /**
     * 修改
     */
    public function edit($room_id)
    {
        // 详情
        $model = RoomModel::detail($room_id);
        // 更新记录
        if ($model->edit($this->postData())) {
            return $this->renderSuccess('设置成功');
        }
        return $this->renderError('设置失败');
    }
    /**
     * 礼物排行
     */
    public function user_gift()
    {
        $model = new UserGiftModel();
        $list = $model->getList($this->postData());
        return $this->renderSuccess('', compact('list'));
    }
    /**
     * 审核
     */
    public function audit($room_id)
    {
        // 文章详情
        $model = RoomModel::detail($room_id);
        if ($model->audit($this->postData())) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?:'操作失败');
    }
}