<?php
|
|
namespace app\api\controller\plus\ticket;
|
|
use app\api\controller\Controller;
|
use app\api\model\plus\ticket\Ticket as TicketModel;
|
use app\api\model\settings\Setting as SettingModel;
|
|
/**
|
* 活动控制器
|
*/
|
class Index extends Controller
|
{
|
|
/**
|
* 列表
|
*/
|
public function index()
|
{
|
$model = new TicketModel;
|
// 用户信息
|
$user = $this->getUser();
|
$list = $model->getList($this->postData(),$user);
|
return $this->renderSuccess('', compact('list'));
|
}
|
|
/**
|
*详情
|
*/
|
public function detail($upload_id)
|
{
|
$detail = TicketModel::detail($upload_id);
|
return $this->renderSuccess('', compact('detail'));
|
}
|
|
/**
|
*详获取设置
|
*/
|
public function setting()
|
{
|
$setting = SettingModel::getSupplierItem('ticket',0);
|
return $this->renderSuccess('', compact('setting'));
|
}
|
|
/**
|
*提交小票上传
|
*/
|
public function submit()
|
{
|
$params = $this->request->param();
|
// 用户信息
|
$user = $this->getUser();
|
// 生成记录
|
$model = new TicketModel();
|
$upload_id = $model->addTicket($user,$params);
|
if(!$upload_id){
|
return $this->renderError($model->getError() ?: '上传失败');
|
}
|
|
return $this->renderSuccess('', compact('upload_id'));
|
|
}
|
|
}
|