<?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('操作成功');
|
}
|
}
|
|
}
|