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
<?php
 
namespace app\operations\controller\plus\ticket;
 
use app\operations\controller\Controller;
use app\operations\model\plus\ticket\Ticket as TicketModel;
use app\operations\model\settings\Setting as SettingModel;
 
/**
 * 活动控制器
 */
class Ticket extends Controller
{
    /**
     * 列表
     */
    public function index()
    {
        $model = new TicketModel;
        $list = $model->getList($this->postData());
        return $this->renderSuccess('', compact('list'));
    }
 
    /**
     *详情
     */
    public function edit($upload_id)
    {
        $model = new TicketModel;
        return $this->renderSuccess('', $model->detail($upload_id));
    }
 
    /**
     * 删除活动
     */
    public function delete($upload_id)
    {
        // 详情
        $model = TicketModel::detail($upload_id);
        if ($model->setDelete()) {
            return $this->renderSuccess('删除成功');
        }
        return $this->renderError($model->getError() ?:'删除失败');
    }
 
    /**
     *配置
     */
    public function settings()
    {
        if($this->request->isGet()){
            $vars['values'] = SettingModel::getItem('ticket');
            return $this->renderSuccess('', compact('vars'));
        }
 
        $model = new SettingModel;
        $data = $this->request->param();
        if ($model->edit('ticket', $data)) {
            return $this->renderSuccess('操作成功');
        }
    }
 
}